> ## 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.

# getYieldRewards

# getYieldRewards

Gets accrued rewards for a wallet account in an [Earn](/docs/overview/yield) vault. Returns an empty array when the wallet has no accrued rewards in this vault. A vault can have more than one concurrent reward campaign paying out in different tokens, 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` | Accrued reward amount, in raw token units. |
| `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.   |

## 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
