Batch Operations
The MNEE SDK provides a powerful batch processing system for handling multiple operations efficiently. It includes automatic chunking, rate limiting, error recovery, and progress tracking.
Setup
import Mnee from '@mnee/ts-sdk';
// Initialize MNEE SDK
const mnee = new Mnee({
environment: 'sandbox',
apiKey: 'your-api-key'
});
// For examples below, assume mnee is already set upGetting Started
Access batch operations through the batch() method:
const batch = mnee.batch();Available Methods
Get UTXOs for Multiple Addresses
Retrieve UTXOs for multiple addresses with automatic chunking and error handling.
Get Balances for Multiple Addresses
Efficiently retrieve balances for multiple addresses.
Get Transaction Histories
Retrieve transaction histories for multiple addresses with custom parameters.
Parse Multiple Transactions
Parse multiple transactions with optional extended data.
Configuration Options
All batch methods support the following options:
Response Structure
All batch operations return a BatchResult:
Common Use Cases
Portfolio Balance Check
UTXO Collection
Transaction Analysis
Error Recovery
High-Performance Processing
Progress Monitoring
Batch History Export
Best Practices
Chunk Size Optimization
Small operations: Use default chunk size (20)
Large datasets: Increase to 50-100 for better performance
Rate-limited APIs: Reduce chunk size to avoid hitting limits
Error Handling
Use
continueOnError: truefor resilient processingCheck the
errorsarray in the responseImplement custom retry logic for critical operations
Performance Tips
Adjust
requestsPerSecondbased on your API limitsUse progress callbacks for long-running operations
Process results as they complete rather than waiting for all
Memory Management
For very large datasets, process results incrementally
Clear processed data from memory when no longer needed
Consider streaming results to disk for massive operations
Rate Limiting
The batch system includes intelligent rate limiting:
Respects the configured
requestsPerSecondlimitAutomatically handles concurrent request management
Ensures minimum delay between API calls
Works efficiently even with fractional rates (e.g., 0.5 requests/second)
Error Types
Common errors you might encounter:
Invalid Input: Empty or malformed addresses/txids
API Errors: Network issues or service unavailability
Rate Limit: Exceeded API rate limits
Validation Errors: Invalid Bitcoin addresses or transaction IDs
See Also
Get UTXOs - Single address UTXO retrieval
Balance - Single address balance check
Transaction History - Single address history
Parse Transaction - Single transaction parsing
Last updated