Deposits
Move tokens from the owner's wallet into an account.
A deposit is an ordinary ERC-20 transfer from a wallet the owner controls to the account's address. The SDK builds the transfer, checks it, sends it from the wallet you pass in, and waits for the receipt. It never holds a key.
const deposit = await account.prepareDeposit({
token: { address: USDC },
amount: 25_000_000n, // raw units, bigint
})
// A viem WalletClient the owner controls, with an account attached.
await deposit.submit({ walletClient })
What submit does
- Checks that the wallet has an account and, if it knows its chain, that the chain matches the SDK's.
- Sends
transfer(account, amount)on the token from that wallet. - Waits for the receipt and throws
Transaction reverted: <hash>if it failed.
prepareDeposit is async, so an account that is not deployed on the configured chain gives a rejected promise, not a synchronous throw.
Using another wallet stack
If you do not use viem, take the transfer and send it yourself:
const { to, data, chainId } = deposit.transfer
// Send a transaction to `to` with calldata `data` on `chainId`.