Credits
Designing for cost
Cache catalogs, pace polls, and treat prepare/broadcast as expensive meters.
Overview
Credits scale with traffic patterns. A chatty wallet UI can burn more than a careful backend cache. Design for the meter, not just latency.
Cache aggressively
- Cache
GET /v1/chains(and capabilities) for minutes to hours - Reuse gas fee tiers for short windows when UX allows
- Prefer portfolio holdings'
priceUsdwhen present over a separate prices call
Poll with intent
- Balance refresh every few seconds is rarely needed—align with user focus
- Activity: page with cursors; do not hammer first-page fetches
- Receipt polling: exponential backoff until terminal status
Multi and batch
- Portfolio multi (3 credits) can beat N × portfolio_get (1 each) for wide chain sets—but empty
chainIdsexpands to the full plan allowlist - Cap NFT fan-out concurrency; each chain is a separate
nft_list(2) - Prices multi max 50 tokens—batch instead of hundreds of
price_get
Transactions
- Prepare (5) + simulate (2) + broadcast (5) is expensive—simulate only when UX needs it
- Never retry broadcast blindly; check receipt first
Environments
- Separate staging and production projects — Dev vs prod projects
- Iterate on testnet chain ids where capabilities allow