> ## Documentation Index
> Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# prepareClaimRewards

> Builds the unsigned transaction that claims an owner's Earn vault rewards

## Function Signature

```typescript theme={"system"}
client.earn.prepareClaimRewards(params: {
  vaultId: string;
  ownerAddress: string;
  traceContext?: TraceContext;
}): Promise<EarnSigningPayload>
```

## Description

Builds the unsigned transaction that claims every reward `ownerAddress` has accrued in an [Earn](https://www.dynamic.xyz/docs/earn/overview.md) vault. Rewards are supported only for vaults from some providers; for any other provider the API rejects the request with an HTTP 400 error. See [Provider support](https://www.dynamic.xyz/docs/earn/overview.md#provider-support).

The method only builds the payload. Execute it with `executeEarnTransaction`, or use `claimEarnRewards` 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`](https://www.dynamic.xyz/docs/node/reference/earn/list-vaults).
* **`ownerAddress`** (`string`): The wallet address that accrued the rewards.

### Optional Parameters

* **`traceContext`** (`TraceContext`): Trace context forwarded to the Dynamic API.

## Returns

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

## Example

```typescript theme={"system"}
import { authenticatedEvmClient } from './client';

const evmClient = await authenticatedEvmClient();

const signingPayload = await evmClient.earn.prepareClaimRewards({
  vaultId: 'steakhouse-prime-usdc',
  ownerAddress: walletMetadata.accountAddress,
});

const { transactionHash } = await evmClient.executeEarnTransaction({
  signingPayload,
  walletMetadata,
  externalServerKeyShares,
  password: 'user-password',
  rpcUrl: 'https://mainnet.base.org',
});
```

## Error Handling

Fails with an HTTP 403 error when Earn is not enabled for your environment, an HTTP 400 error when the vault's provider does not support rewards, or an HTTP 422 error when the wallet has nothing to claim.

## See Also

* [Earn](https://www.dynamic.xyz/docs/node/earn.md)
* [getRewards](https://www.dynamic.xyz/docs/node/reference/earn/get-rewards.md)
* [claimEarnRewards](https://www.dynamic.xyz/docs/node/reference/evm/claim-earn-rewards.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.