Skip to main content

Function Signature

Description

Builds the unsigned transaction that deposits amount into an Earn vault. On EVM the payload also carries an evmApproval when the vault’s ERC-20 allowance is short. On Solana the payload carries an ordered transactions sequence instead of a single transaction. Shares are credited to receiverAddress when given, otherwise to ownerAddress. The method only builds the payload. Execute it with executeEarnTransaction, or use depositToEarnVault to prepare and execute in one call. Available as client.earn on DynamicEvmWalletClient and DynamicSvmWalletClient.

Parameters

Required Parameters

  • vaultId (string): The vault identifier from listVaults.
  • ownerAddress (string): The wallet address funding the deposit.
  • amount (string): How much of the vault’s underlying asset to deposit, in the asset’s human-readable units ('12.5' USDC, not '12500000'). Needs a leading zero ('0.01', not '.01').

Optional Parameters

  • receiverAddress (string): The address that receives the vault shares. Defaults to ownerAddress. For a Solana vault, omit it or set it to ownerAddress: Solana vaults always credit shares to the depositor’s own accounts.
  • traceContext (TraceContext): Trace context forwarded to the Dynamic API.

Returns

  • Promise<EarnSigningPayload>: The unsigned signing payload to execute.

Example

Error Handling

Fails with an HTTP 403 error when Earn is not enabled for your environment, or an HTTP 400 error when the amount or address is invalid.

See Also

Last modified on October 29, 2026