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.
The wallet account whose accrued rewards are being claimed. Must be an EVM wallet account for an EVM vault, or a Solana wallet account for a Solana vault.
Callback invoked when the execution step changes. 'approval' never fires for a claim. For a Solana vault, 'transaction' fires once per transaction in the sequence.
Callback invoked as each transaction of a multi-transaction claim begins, which only happens for Solana vaults. progress has ordinal (zero-based position), total (number of transactions), and an optional label such as 'claim-vault-farm'.
client
DynamicClient (optional)
The Dynamic client instance. Only required when using multiple Dynamic clients.
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, a resolved claimYieldRewards call means the claim transaction was sent, not that it finished. See Waiting for confirmation before showing a success state to the user.
For an EVM vault, transactionHash is returned as soon as the claim is broadcast to the network, and it can still fail or revert after that. Wait for a receipt before telling the user their claim succeeded:
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. You do not need to wait for a receipt the way you do for an EVM vault.
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.
useClaimYieldRewards invalidates useGetYieldRewards on success, so rewards refetch automatically. That refetch can still briefly show the old amount, since the claim transaction may not be mined yet (see Waiting for confirmation).