Skip to main content

claimYieldRewards

Claims a wallet’s accrued bonus rewards in an Earn vault, then signs and sends the transaction for you. You only pass a vaultId, and Dynamic resolves everything else needed to process the claim. This is separate from base yield, which never needs claiming. Rewards are an optional bonus some vaults pay out in addition to base yield, and they sit unclaimed until you call this function. This function currently supports vaults from these providers: Morpho and Kamino. For a vault from any other provider, such as an Aave vault, the call rejects because the API responds with an HTTP 400 error, so check the vault’s provider from getYieldDetails first. A Morpho claim is a single EVM transaction. A Kamino claim is an ordered sequence of Solana transactions, one for each of the vault’s reward farms that has something pending, so a user can be asked to approve more than one signature. claimYieldRewards signs, sends, and confirms each transaction before it starts the next, and onTransactionStepChange reports progress through the sequence. If a later transaction fails or expires, the earlier ones have already confirmed, so read getYieldRewards again before retrying. For a supported vault, the call rejects when there’s nothing claimable for this vault right now, either because no reward campaign is active or because everything has already been claimed. Check getYieldRewards first, and only show a claim action when it returns a non-zero accrued amount.

Usage

Parameters

Returns

Promise<{ transactionHash: string }> - The hash of the claim transaction. For a Solana vault, this is the signature of the last transaction in the sequence.
For an EVM vault action that is not sponsored, a resolved claimYieldRewards call means the claim transaction mined successfully. A sponsored EVM action resolves after the relayer reports the transaction hash, so it can still fail or revert afterward. See Confirmation and errors before showing a success state to the user.

Confirmation and errors

EVM transaction errors

For an EVM vault action that is not sponsored, the built-in EVM wallet provider waits for the transaction receipt before claimYieldRewards resolves. If the mined transaction reverts, the call rejects with EvmTransactionRevertedError. If another transaction takes its nonce first, the call rejects with EvmTransactionReplacedError. Both errors are exported from @dynamic-labs-sdk/evm. See EVM transaction errors for the error fields and an instanceof example. When the EVM action is sponsored, claimYieldRewards resolves after the relayer reports the transaction hash, and the transaction can still fail or revert afterward. Wait for a receipt before telling the user their claim succeeded:

Solana vaults

For a Solana vault, claimYieldRewards polls each transaction until it reaches the confirmed commitment level before it starts the next one, and it resolves only after the last transaction has confirmed. A resolved call therefore means every transaction in the sequence landed, although a confirmed transaction is not yet finalized. A non-sponsored EVM claim waits for a successful receipt before it resolves, while a sponsored EVM claim still needs the receipt check described above.

Examples

Only offer claim when something is claimable

Follow a multi-transaction Solana claim

Supported Chains

claimYieldRewards supports EVM wallet accounts for EVM vaults and Solana wallet accounts for Solana vaults. Calling it with a wallet account from a chain family that does not implement the underlying executeYieldTransaction method throws a WalletProviderMethodUnavailableError. A wallet account from the other chain family than the vault’s is rejected with an HTTP 400 error.

React

This hides the button entirely when there’s nothing to claim, rather than showing it and reporting the resulting rejection as a normal outcome:
useClaimYieldRewards invalidates useGetYieldRewards on success, so rewards refetch automatically. That refetch can still briefly show the old amount while the rewards catch up with the confirmed transaction (see Confirmation and errors).
Last modified on November 18, 2026