Skip to content

Commit

Permalink
doc and types for getPortfolios
Browse files Browse the repository at this point in the history
  • Loading branch information
brendan-defi committed Jan 31, 2025
1 parent 40d40b3 commit f931a56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
# `getPortfolioTokenBalances`
# `getPortfolios`

The `getPortfolioTokenBalances` function returns an object containing an array of
The `getPortfolios` function returns an object containing an array of
portfolios for the provided addresses. Each portfolio is an object with the address
of the wallet, the fiat value of the portfolio, and an array of tokens held by the
provided address.

:::info
Before using this endpoint, make sure to obtain a [Client API Key](https://portal.cdp.coinbase.com/projects/api-keys/client-key)
from Coinbase Developer Platform.
:::

## Usage

:::code-group

```tsx twoslash [code]
import { setOnchainKitConfig } from '@coinbase/onchainkit';
import { getPortfolioTokenBalances } from '@coinbase/onchainkit/api';
import { getPortfolios } from '@coinbase/onchainkit/api';

const response = await getPortfolioTokenBalances({
const response = await getPortfolios({
addresses: ['0x...'],
});
```
Expand Down Expand Up @@ -44,8 +46,8 @@ const response = await getPortfolioTokenBalances({

## Returns

[`Promise<GetPortfoliosAPIResponse>`](/api/types#getportfoliosapiresponse)
[`Promise<GetPortfoliosResponse>`](/api/types#getportfoliosresponse)

## Parameters

[`GetPortfolioTokenBalancesParams`](/api/types#getportfoliotokenbalancesparams)
[`GetPortfoliosParams`](/api/types#getportfoliosparams)
12 changes: 5 additions & 7 deletions site/docs/pages/api/types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,18 @@ type BuildMintTransactionParams = {
type BuildMintTransactionResponse = MintTransaction | APIError;
```

## `GetPortfolioTokenBalancesParams`
## `GetPortfolioParams`

```ts
type GetPortfolioTokenBalancesParams = {
type GetPortfolioParams = {
addresses: Address[] | null | undefined;
};
```

## `PortfolioTokenBalances`
## `GetPortfoliosResponse`

```ts
type PortfolioTokenBalances = {
address: Address;
portfolioBalanceInUsd: number;
tokenBalances: PortfolioTokenWithFiatValue[];
type GetPortfoliosResponse = {
portfolios: Portfolio[];
};
```

0 comments on commit f931a56

Please sign in to comment.