Skip to main content
Bitcoin, Stablecoins, and Token hero

Overview

Starkzap provides comprehensive support for ERC20 token operations, including balance queries, transfers, and type-safe amount handling. This module allows you to work with:
  • Bitcoin wrappers on Starknet - wBTC, lBTC, tBTC (wrapped Bitcoin tokens that represent Bitcoin on Starknet)
  • Stablecoins - USDC, USDT, and other stablecoins
  • Other ERC20 tokens - Any ERC20-compatible token on Starknet
This guide covers all token-related functionality for these different token types.

Token Presets

The SDK ships with pre-configured token definitions for mainnet and Sepolia:

Token Shape

Getting Tokens for Current Network

Resolving Unknown Tokens

Resolve tokens from on-chain contract addresses:

Checking Balances

Transferring Tokens

Single Transfer

Batch Transfer (Multiple Recipients)

Send to multiple recipients in a single transaction:

With Sponsored Fees

Working with Amounts

The Amount class provides precision-safe handling of token amounts, preventing common errors when converting between human-readable values and raw blockchain values.

Creating Amounts

Converting and Displaying

Arithmetic

All arithmetic operations return new Amount instances (immutable):
Arithmetic between incompatible amounts (different decimals or symbols) throws an error.

Comparisons

Comparisons between incompatible amounts return false (never throw).

Using Amounts in Transactions

Amounts work seamlessly with all SDK methods:

Token Approval

For operations that require spending tokens (like staking), you may need to approve first:

Best Practices

  1. Always use Amount.parse() for user input to avoid precision errors
  2. Use token presets instead of hardcoding addresses
  3. Check balances before transfers to provide better UX
  4. Use batch transfers when sending to multiple recipients to save gas
  5. Format amounts for display using toFormatted() for better UX

Common Patterns

Checking if User Has Enough Balance

Checking Balance Covers Transfer + Fee

Next Steps