Skip to main content
Query native and token balances, fetch transaction history, and send tokens directly from your app once you’ve set up a wallet. Every method here runs against the resolved RainClient.

Query a balance

Get a single balance: native or a specific token. Pass .native for the chain’s native token, or .contract(address:) for an ERC-20. The SDK resolves the token’s decimals and symbol for you.

Query every balance on a chain

Get all non-zero balances for the wallet on one network. The native balance is always included.

Query balances across all chains

Get balances across every configured chain in one call, flattened into a single list. Each Balance carries its own chainId, and a chain that fails contributes no entries rather than failing the whole call.

The Balance type

Every balance method returns a rich Balance: the exact base-unit amount, never a lossy Double. Metadata for well-known tokens is built in; unknown tokens are resolved on-chain once and cached. To resolve a token without any on-chain lookup, register it up front with registerTokens(...) on the builder, the SDK, or the client.

Send native tokens

Send the chain’s native token (for example AVAX). Both platforms return a RainTokenTransferResult carrying the transactionHash.

Send tokens

Send an ERC-20 token. Omit decimals to let the SDK resolve them.
Amounts are converted to base units exactly. On iOS, RainTokenTransferResult.transactionHash carries the EVM hash, or the Solana signature for Solana-routed sends (sentinel chain ids 101/102/103, provider support required).
Sends through the Portal and Privy adapters are simulated with eth_call before broadcasting: a transfer that would revert throws RAIN_403 before any gas is spent. Turnkey sends are not simulated and go straight to broadcast.

Fetch transaction history

Retrieve the wallet’s transaction history with optional pagination and sort order.
On iOS, getTransactions returns [WalletTransaction] directly. On Android, it returns a RainTransactionResult with a transactions list. The Privy adapter returns an empty result, since Privy has no history endpoint. Here’s what each field carries:
Field availability depends on what the underlying RPC provider returns. Treat optional fields as actually optional and code defensively.

Deprecated shims (Android)

The pre-modular Double-based methods survive as @Deprecated default implementations so existing integrations keep compiling:
  • getAddress()
  • getNativeBalance
  • getERC20Balance
  • getERC20Balances
  • getBalances (map form)
  • sendToken(amount: Double, decimals: Int)
Migrate to the Balance/BigDecimal API: the shims lose precision by design.

Error handling

Balance and transaction methods can throw: See the full Error Reference for all codes and handling patterns.

What’s next

Sends & DeFi

Make arbitrary sends and contract calls.

Withdraw Collateral

Execute collateral withdrawals from your app.

Error Reference

Handle SDK errors with standardized error codes.