withdrawFromYieldVault
Withdraws assets from an Earn vault, then signs and sends the transaction for you. As withdepositToYieldVault, you pass a vaultId and a plain amount like '10.5' — Dynamic looks up the vault’s address and decimal places for you.
Unlike a deposit, there’s no approval step first: the wallet already owns its position in the vault, so a withdrawal is always a single transaction.
Usage
Parameters
Returns
Promise<{ transactionHash: string }> - The hash of the withdraw transaction.
Waiting for confirmation
transactionHash is returned as soon as the withdrawal is broadcast to the network — it can still fail or revert after that. Wait for a receipt before telling the user their withdrawal succeeded:
Examples
Withdraw the full position
Supported Chains
withdrawFromYieldVault only supports EVM wallet accounts — vault actions are EVM-only today. Calling it with a non-EVM walletAccount throws a WalletProviderMethodUnavailableError, since only EVM wallet providers implement the underlying executeYieldTransaction method.
React
useWithdrawFromYieldVault invalidates useGetYieldPosition on success, so the position refetches automatically. That refetch can still briefly show the old balance, since the withdrawal transaction may not be mined yet — see Waiting for confirmation.
Related
depositToYieldVault- Deposit into a vaultgetYieldPosition- Read the wallet’s remaining position