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

# getEarnings

> Aggregates an owner's Earn earnings across every vault on a chain

## Function Signature

```typescript theme={"system"}
client.earn.getEarnings(params: {
  ownerAddress: string;
  chainId: number;
  chainName?: EarnChainName;
  traceContext?: TraceContext;
}): Promise<EarnEarnings>
```

## Description

Returns an owner's earnings across every [Earn](https://www.dynamic.xyz/docs/earn/overview.md) vault on a chain, with USD totals and a per-vault breakdown.

Available as `client.earn` on `DynamicEvmWalletClient` and `DynamicSvmWalletClient`.

## Parameters

### Required Parameters

* **`ownerAddress`** (`string`): The wallet address that owns the positions.
* **`chainId`** (`number`): The chain to aggregate earnings on.

### Optional Parameters

* **`chainName`** (`EarnChainName`): The chain family (for example `ChainEnum.Evm` or `ChainEnum.Sol`). Defaults to EVM.
* **`traceContext`** (`TraceContext`): Trace context forwarded to the Dynamic API.

## Returns

* **`Promise<EarnEarnings>`**: The owner's earnings, with USD totals and a per-vault breakdown.

## Example

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

const evmClient = await authenticatedEvmClient();

const earnings = await evmClient.earn.getEarnings({
  ownerAddress: walletMetadata.accountAddress,
  chainId: 8453, // Base
});

console.log(`Total earnings: ${earnings.totalEarningsUsd} USD`);
```

## Error Handling

Fails with an HTTP 403 error when Earn is not enabled for your environment.

## See Also

* [Earn](https://www.dynamic.xyz/docs/node/earn.md)
* [getPosition](https://www.dynamic.xyz/docs/node/reference/earn/get-position.md)
* [getPerformance](https://www.dynamic.xyz/docs/node/reference/earn/get-performance.md)


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