Client Initialization
Use Environment Variables
Keep configuration out of source code:Use a Singleton Client
Create one client instance and reuse it throughout your application:Error Handling
Always Handle Errors
Wrap SDK calls in try/catch blocks and handle specific error types:Check Retryability
UseisRetryable() before implementing retry logic:
Async Patterns
TypeScript: Parallel Requests
UsePromise.all for independent requests:
Promise.allSettled when you want partial results:
Python: Sequential with Error Recovery
Amount Handling
Always Use Raw Units for API Calls
The API works with raw (smallest unit) amounts. Convert display amounts before sending:Use PrecisionHandler for Multi-Asset Apps
When working with multiple assets, usePrecisionHandler to avoid precision errors: