-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add docs for getPortfolioTokenBalances
- Loading branch information
1 parent
2f65eb9
commit 3d19876
Showing
2 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# `getPortfolioTokenBalances` | ||
|
||
The `getPortfolioTokenBalances` 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. | ||
|
||
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'; | ||
|
||
const response = await getPortfolioTokenBalances({ | ||
addresses: ['0x...'], | ||
}); | ||
``` | ||
|
||
```json [return value] | ||
"portfolios": [ | ||
{ | ||
"address": "0x...", | ||
"portfolioBalanceInUsd": 100, | ||
"tokenBalances": [{ | ||
"address": "0x...", | ||
"chainId": 1, | ||
"decimals": 18, | ||
"image": "https://example.com/image.png", | ||
"name": "Token Name", | ||
"symbol": "TKN", | ||
"cryptoBalance": 10, | ||
"fiatBalance": 100 | ||
}] | ||
} | ||
] | ||
``` | ||
|
||
::: | ||
|
||
## Returns | ||
|
||
[`Promise<GetPortfoliosAPIResponse>`](/api/types#getportfoliosapiresponse) | ||
|
||
## Parameters | ||
|
||
[`GetPortfolioTokenBalancesParams`](/api/types#getportfoliotokenbalancesparams) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters