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

# getYieldDetails

# getYieldDetails

Gets full details for one [Earn](https://docs.dynamic.xyz/docs/earn/overview.md) vault: fixed info like its contract address and curator, plus live numbers like `netApy` and `tvlUsd`. The live numbers are best-effort and may be missing (`undefined`) if that data is temporarily unavailable, so always check for that before displaying them.

## Usage

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

const details = await getYieldDetails({ vaultId: 'fb-eth-galaxy-usdc-fw-01' });

console.log(details.contractAddress, details.netApy);
```

## Parameters

| Parameter | Type | Description |
| - | - | - |
| `vaultId` | `string` | Opaque vault identifier, from [`listYieldVaults`](https://docs.dynamic.xyz/docs/javascript/reference/client/list-yield-vaults). |
| `client` | `DynamicClient` (optional) | The Dynamic client instance. Only required when using multiple Dynamic clients. |

## Returns

`Promise<YieldVaultDetails>` - The vault's full details.

| Field | Type | Description |
| - | - | - |
| `vaultId` | `string` | Opaque identifier for the vault. |
| `contractAddress` | `string` | On-chain address of the vault. Which contract or account this is depends on the vault's provider, and it is a Solana address for a Solana vault. |
| `chainId` | `number` | Chain ID where the vault is deployed. An EVM chain ID for an EVM vault, and a Solana network ID for a Solana vault. |
| `chainName` | `'EVM' \| 'SOL'` (optional) | The chain family the vault runs on. Use a wallet account from the same family for every Earn action on this vault. |
| `curator` | `string` | Name of the organization or team that curates this vault. |
| `provider` | `'MORPHO' \| 'AAVE' \| 'KAMINO'` | The DeFi protocol that serves the vault. Handle values your code does not recognize. See [Provider support](https://docs.dynamic.xyz/docs/earn/overview.md#provider-support). |
| `assetAddress` | `string` | Address of the underlying asset token. |
| `assetSymbol` | `string` | Ticker symbol of the underlying asset (e.g. `USDC`). |
| `assetDecimals` | `number` | Number of decimals for the underlying asset token. Use this to format `getYieldPosition` amounts. |
| `isFeeWrapper` | `boolean` | `true` if a fee is taken before your deposit reaches the vault. Informational only: you don't need to do anything differently either way, and every Earn function works the same regardless of this value. |
| `netApy` | `number` (optional) | Estimated yearly return, as a decimal (e.g. `0.05` = 5% per year). Includes any bonus rewards. Missing when live data is temporarily unavailable. |
| `netApyExcludingRewards` | `number` (optional) | Same as `netApy`, but base yield only, with bonus rewards excluded. |
| `tvlUsd` | `number` (optional) | Total amount deposited in the vault by everyone, in US dollars. Missing when live data is temporarily unavailable. |
| `tvlRaw` | `string` (optional) | Same as `tvlUsd`, but in the vault's raw, undecimalized token units instead of dollars. Prefer `tvlUsd` unless you need the raw figure. |

> [!WARNING]
>
> `getYieldDetails` throws if `vaultId` doesn't match a vault available to your environment. This looks identical whether the ID is simply wrong or points to a vault scoped to a different environment. Treat any error here as "vault not found."

## Examples

### Format an amount using assetDecimals

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

const details = await getYieldDetails({ vaultId: 'fb-eth-galaxy-usdc-fw-01' });

console.log(`${details.assetSymbol} decimals: ${details.assetDecimals}`);
console.log(
  `TVL: ${details.tvlRaw ? formatUnits(BigInt(details.tvlRaw), details.assetDecimals) : 'n/a'}`
);
```

## React

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

function VaultDetails({ vaultId }: { vaultId: string }) {
  const { data: details, isLoading } = useGetYieldDetails({ vaultId });

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

  return (
    <p>
      {details?.assetSymbol} vault by {details?.curator} — APY:{' '}
      {details?.netApy ?? 'n/a'}
    </p>
  );
}
```

## Related

* [`listYieldVaults`](https://docs.dynamic.xyz/docs/javascript/reference/client/list-yield-vaults) - List all accessible vaults
* [`getYieldPosition`](https://docs.dynamic.xyz/docs/javascript/reference/client/get-yield-position) - A wallet's position in this vault
* [`depositToYieldVault`](https://docs.dynamic.xyz/docs/javascript/reference/client/deposit-to-yield-vault) - Deposit into this vault


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