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

# getYieldRewards

# getYieldRewards

Gets a wallet's accrued bonus [rewards](/docs/overview/yield#key-concepts) in an [Earn](/docs/overview/yield) vault. Rewards are separate from base yield — base yield accrues automatically and never needs claiming, but rewards sit here until you call [`claimYieldRewards`](/docs/javascript/reference/client/claim-yield-rewards).

Returns an empty array when the wallet has no accrued rewards in this vault. A vault can run more than one reward campaign at once, each paying out in a different token, so each entry carries its own token identity (address, symbol, decimals) alongside the amount.

## Usage

```javascript theme={"system"}
import { getYieldRewards } from '@dynamic-labs-sdk/client';

const rewards = await getYieldRewards({
  vaultId: 'fb-eth-galaxy-usdc-fw-01',
  walletAccount,
});

console.log(rewards[0]?.accrued, rewards[0]?.tokenSymbol);
```

## Parameters

| Parameter       | Type                       | Description                                                                                        |
| --------------- | -------------------------- | -------------------------------------------------------------------------------------------------- |
| `vaultId`       | `string`                   | Opaque vault identifier, from [`listYieldVaults`](/docs/javascript/reference/client/list-yield-vaults). |
| `walletAccount` | `WalletAccount`            | The wallet account whose accrued rewards are being read.                                           |
| `client`        | `DynamicClient` (optional) | The Dynamic client instance. Only required when using multiple Dynamic clients.                    |

## Returns

`Promise<YieldVaultReward[]>` - The wallet's accrued rewards in the vault, one entry per reward token/campaign.

| Field           | Type             | Description                                                                                                                          |
| --------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `accrued`       | `string \| null` | Amount claimable right now, as a raw string (e.g. `"5000000"`). Divide by `tokenDecimals` before displaying.                         |
| `tokenAddress`  | `string \| null` | Contract address of the reward token.                                                                                                |
| `tokenSymbol`   | `string \| null` | Ticker symbol of the reward token.                                                                                                   |
| `tokenDecimals` | `number`         | Number of decimals for the reward token — use this to format `accrued`, the same way you'd use `assetDecimals` for a vault position. |

## Examples

### Sum rewards by token

```javascript theme={"system"}
import { getYieldRewards } from '@dynamic-labs-sdk/client';

const rewards = await getYieldRewards({ vaultId, walletAccount });

for (const reward of rewards) {
  if (reward.accrued && reward.accrued !== '0') {
    console.log(`${reward.tokenSymbol}: ${reward.accrued}`);
  }
}
```

## React

`useGetYieldRewards` is a query hook that stays disabled until `walletAccount` is defined.

```tsx theme={"system"}
import { useGetYieldRewards } from '@dynamic-labs-sdk/react-hooks';
import type { WalletAccount } from '@dynamic-labs-sdk/client';

function Rewards({
  vaultId,
  walletAccount,
}: {
  vaultId: string;
  walletAccount: WalletAccount | undefined;
}) {
  const { data: rewards = [], isLoading } = useGetYieldRewards({
    vaultId,
    walletAccount,
  });

  if (isLoading) {
    return <p>Loading rewards...</p>;
  }

  return (
    <ul>
      {rewards.map((reward) => (
        <li key={reward.tokenAddress}>
          {reward.tokenSymbol}: {reward.accrued}
        </li>
      ))}
    </ul>
  );
}
```

## Related

* [`claimYieldRewards`](/docs/javascript/reference/client/claim-yield-rewards) - Claim these rewards
* [`getYieldPosition`](/docs/javascript/reference/client/get-yield-position) - The wallet's share balance and asset value
