View the full API reference for the deposit endpoint.
Deposit flow
- Privy approves the vault to spend the specified amount of the wallet’s ERC-20 tokens.
- The vault converts the deposited assets into vault shares at the current share price.
- Shares are split between the depositing wallet and your app’s admin wallet based on the fee percentage configured during setup.
- The deposit is created as a wallet action with status
pending. Privy prepares, signs, and broadcasts the transaction asynchronously. The status moves tosucceededonce confirmed onchain.
share_amount in the response is null while the action is pending. Once the action succeeds, it reflects the number of shares minted to the depositing wallet. To see the admin wallet’s fee shares, query the admin wallet’s position.
Usage
Use the The
deposit method from useEarn to deposit assets from a user’s embedded wallet.useEarn is supported starting in @privy-io/react-auth@3.51.4.deposit method rejects its Promise if signing or request submission fails.
If signing takes longer than the request expiry window, it throws a PrivyClientError with code
embedded_wallet_request_expired. Prompt the user to retry; the expired request is not submitted.Parameters
In React and React Native,deposit(walletId, params) accepts the embedded wallet’s ID, not its blockchain address,
and an object with the fields below. Privy routes the request to the vault’s configured EVM chain; no chain parameter is needed.
The hook signs the request with the user’s signer. Never include app secrets or authorization private keys in client-side code.
The same fields apply to the REST request body:
The unique identifier for the vault. Copy this from vault
setup.
Human-readable decimal amount to deposit (e.g.
"1.5" for 1.5 OUSD). Exactly one of amount or
raw_amount must be provided.Amount to deposit in the token’s smallest unit (e.g.
"1500000" for 1.5 OUSD on Tempo with 6
decimals). Exactly one of amount or raw_amount must be provided.Returns
The SDK methods return a Promise for anEarnDepositActionResponse with status: 'pending', not onchain confirmation.
In React and React Native, use action.id with getAction from useWalletActions to track completion.
The wallet action ID. Use this to poll status with get wallet
action.
Human-readable decimal amount (e.g.
"1.5"). Only present when the token is known in the asset
registry.Asset identifier (e.g.
"ousd"). Only present when the token is known in the asset registry.Number of decimals for the underlying asset. Only present when the token is known in the asset
registry.
Vault shares received in base units.
null until the action succeeds.A
rejected status means the action failed before any transaction was signed or broadcast — for
example, due to insufficient balance or a policy violation. Your app can safely retry the request.
A failed status means a transaction was broadcast but reverted onchain. Inspect the action’s
steps for details.Next steps
Withdraw assets
Withdraw deposited assets with accrued yield.
Automate deposits
Deposit a wallet’s balance into a vault when matching funds arrive.

