@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
37 lines (33 loc) • 1.6 kB
text/typescript
/**
* Generated by orval v7.21.0 🍺
* Do not edit manually.
* Coinbase Developer Platform APIs
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
* OpenAPI spec version: 2.0.0
*/
import type {
ListEvmTokenBalances200,
ListEvmTokenBalancesNetwork,
ListEvmTokenBalancesParams,
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
import { cdpApiClient } from "../../cdpApiClient.js";
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* Lists the token balances of an EVM address on a given network. The balances include ERC-20 tokens and the native gas token (usually ETH). The response is paginated, and by default, returns 20 balances per page.
**Note:** This endpoint is still under development and does not yet provide strong freshness guarantees. Specifically, balances of new tokens can, on occasion, take up to ~30 seconds to appear, while balances of tokens already belonging to an address will generally be close to chain tip. Freshness of new token balances will improve over the coming weeks.
* @summary List EVM token balances
*/
export const listEvmTokenBalances = (
network: ListEvmTokenBalancesNetwork,
address: string,
params?: ListEvmTokenBalancesParams,
options?: SecondParameter<typeof cdpApiClient<ListEvmTokenBalances200>>,
) => {
return cdpApiClient<ListEvmTokenBalances200>(
{ url: `/v2/evm/token-balances/${network}/${address}`, method: "GET", params },
options,
);
};
export type ListEvmTokenBalancesResult = NonNullable<
Awaited<ReturnType<typeof listEvmTokenBalances>>
>;