build() the SDK. There’s no singleton and no initialize call.
Once built, resolve a wallet-bound RainClient for each provider you registered. A RainClient is bound to one provider for its lifetime, but multiple providers can coexist on the same built SDK.
1
Build the SDK with a provider
Register the provider adapter(s) your app ships: the examples use the managed Turnkey provider with the authenticated Optional builder calls:
TurnkeyContext from the authentication step. build() validates the configuration and throws RainSDKError.invalidConfig / RainError.InvalidConfig if the configuration is incomplete.On iOS, providers are optional: build with endpoints alone for a wallet-agnostic instance that only does transaction building and Rain API calls.
rpcEndpoints also accepts [NetworkConfig] when you want to name networks or use CAIP-2 ids. On Android, build() requires at least one registered provider.2
Resolve the wallet client
Resolve the You can also resolve by capability instead of id:Resolving an unregistered id throws
RainClient for a registered provider. This suspends on first access: it materializes the vendor wallet. The Turnkey and Privy adapters fail fast here if the provider has no usable account (Portal validates lazily on first use). Resolution runs once per id and is cached; a failed resolution is evicted so you can retry.RAIN_102 (RainSDKError.providerNotRegistered / RainError.InvalidConfig). Use client for every wallet operation: balances and transfers, withdrawals, and the calls below.3
Get the wallet address
Read the resolved wallet’s address:Rain records the wallet address against the user, so you never handle key material. Turnkey wallets also hold a Solana account. Pass a Solana chain id to read the base58 address:
4
Generate a QR code
Create a QR code image for the wallet address so users can receive funds:On Android, pass an explicit
address to encode a different one.Your user now has a non-custodial embedded wallet. Query balances, withdraw collateral, or fund a card against it.
Test your integration
Use a testnet chain ID to validate before production:1
Build for testnet
Point
rpcEndpoints at a testnet, for example Avalanche Fuji (RainChain.avalancheTestnet / RainChain.AVALANCHE_TESTNET, chain id 43113) at https://api.avax-test.network/ext/bc/C/rpc, and resolve the client as above.2
Fund your test wallet
Mint rUSD test tokens and deposit them to your user’s collateral contract. See Mint Test Tokens.
3
Verify each operation
Confirm you get a
0x... address, read a testnet balance, send a small amount, and build a test withdrawal.What’s next
Create the user & KYC
Onboard the user with the wallet address.
Balances & Transactions
Query balances, fetch history, and send tokens.
Fund the Wallet
Give the card spending power with on-chain collateral.
Withdraw Collateral
Execute collateral withdrawals from your app.