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. EachBalance 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 richBalance: 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 aRainTokenTransferResult carrying the transactionHash.
Send tokens
Send an ERC-20 token. Omitdecimals to let the SDK resolve them.
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.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:
- Android: RainTransaction
- iOS: WalletTransaction
Deprecated shims (Android)
The pre-modularDouble-based methods survive as @Deprecated default implementations so existing integrations keep compiling:
getAddress()getNativeBalancegetERC20BalancegetERC20BalancesgetBalances(map form)sendToken(amount: Double, decimals: Int)
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.