(data.evm.balances)
- getNativeBalance - Get native token balance
- listErc20Balances - List ERC-20 balances
- listErc721Balances - List ERC-721 balances
- listErc1155Balances - List ERC-1155 balances
- listCollectibleBalances - List collectible (ERC-721/ERC-1155) balances
Gets native token balance of a wallet address.
Balance at a given block can be retrieved with the blockNumber
parameter.
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
const avaCloudSDK = new AvaCloudSDK({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const result = await avaCloudSDK.data.evm.balances.getNativeBalance({
blockNumber: "6479329",
address: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
currency: "usd",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { AvaCloudSDKCore } from "@avalabs/avacloud-sdk/core.js";
import { dataEvmBalancesGetNativeBalance } from "@avalabs/avacloud-sdk/funcs/dataEvmBalancesGetNativeBalance.js";
// Use `AvaCloudSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const avaCloudSDK = new AvaCloudSDKCore({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const res = await dataEvmBalancesGetNativeBalance(avaCloudSDK, {
blockNumber: "6479329",
address: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
currency: "usd",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetNativeBalanceRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
options.serverURL |
string | ➖ | An optional server URL to use. |
Promise<components.GetNativeBalanceResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.TooManyRequests | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.BadGateway | 502 | application/json |
errors.ServiceUnavailable | 503 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Lists ERC-20 token balances of a wallet address.
Balance at a given block can be retrieved with the blockNumber
parameter.
Balance for specific contracts can be retrieved with the contractAddresses
parameter.
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
const avaCloudSDK = new AvaCloudSDK({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const result = await avaCloudSDK.data.evm.balances.listErc20Balances({
blockNumber: "6479329",
pageSize: 10,
address: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
contractAddresses: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7, 0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",
currency: "usd",
});
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
The standalone function version of this method:
import { AvaCloudSDKCore } from "@avalabs/avacloud-sdk/core.js";
import { dataEvmBalancesListErc20Balances } from "@avalabs/avacloud-sdk/funcs/dataEvmBalancesListErc20Balances.js";
// Use `AvaCloudSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const avaCloudSDK = new AvaCloudSDKCore({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const res = await dataEvmBalancesListErc20Balances(avaCloudSDK, {
blockNumber: "6479329",
pageSize: 10,
address: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
contractAddresses: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7, 0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",
currency: "usd",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ListErc20BalancesRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
options.serverURL |
string | ➖ | An optional server URL to use. |
Promise<operations.ListErc20BalancesResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.TooManyRequests | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.BadGateway | 502 | application/json |
errors.ServiceUnavailable | 503 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Lists ERC-721 token balances of a wallet address.
Balance for a specific contract can be retrieved with the contractAddress
parameter.
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
const avaCloudSDK = new AvaCloudSDK({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const result = await avaCloudSDK.data.evm.balances.listErc721Balances({
pageSize: 10,
address: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
contractAddress: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
});
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
The standalone function version of this method:
import { AvaCloudSDKCore } from "@avalabs/avacloud-sdk/core.js";
import { dataEvmBalancesListErc721Balances } from "@avalabs/avacloud-sdk/funcs/dataEvmBalancesListErc721Balances.js";
// Use `AvaCloudSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const avaCloudSDK = new AvaCloudSDKCore({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const res = await dataEvmBalancesListErc721Balances(avaCloudSDK, {
pageSize: 10,
address: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
contractAddress: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ListErc721BalancesRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
options.serverURL |
string | ➖ | An optional server URL to use. |
Promise<operations.ListErc721BalancesResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.TooManyRequests | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.BadGateway | 502 | application/json |
errors.ServiceUnavailable | 503 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Lists ERC-1155 token balances of a wallet address.
Balance at a given block can be retrieved with the blockNumber
parameter.
Balance for a specific contract can be retrieved with the contractAddress
parameter.
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
const avaCloudSDK = new AvaCloudSDK({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const result = await avaCloudSDK.data.evm.balances.listErc1155Balances({
blockNumber: "6479329",
pageSize: 10,
address: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
contractAddress: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
});
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
The standalone function version of this method:
import { AvaCloudSDKCore } from "@avalabs/avacloud-sdk/core.js";
import { dataEvmBalancesListErc1155Balances } from "@avalabs/avacloud-sdk/funcs/dataEvmBalancesListErc1155Balances.js";
// Use `AvaCloudSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const avaCloudSDK = new AvaCloudSDKCore({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const res = await dataEvmBalancesListErc1155Balances(avaCloudSDK, {
blockNumber: "6479329",
pageSize: 10,
address: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
contractAddress: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ListErc1155BalancesRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
options.serverURL |
string | ➖ | An optional server URL to use. |
Promise<operations.ListErc1155BalancesResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.TooManyRequests | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.BadGateway | 502 | application/json |
errors.ServiceUnavailable | 503 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Lists ERC-721 and ERC-1155 token balances of a wallet address.
Balance for a specific contract can be retrieved with the contractAddress
parameter.
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";
const avaCloudSDK = new AvaCloudSDK({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const result = await avaCloudSDK.data.evm.balances.listCollectibleBalances({
pageSize: 10,
address: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
contractAddress: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
});
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
The standalone function version of this method:
import { AvaCloudSDKCore } from "@avalabs/avacloud-sdk/core.js";
import { dataEvmBalancesListCollectibleBalances } from "@avalabs/avacloud-sdk/funcs/dataEvmBalancesListCollectibleBalances.js";
// Use `AvaCloudSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const avaCloudSDK = new AvaCloudSDKCore({
apiKey: "<YOUR_API_KEY_HERE>",
chainId: "43114",
network: "mainnet",
});
async function run() {
const res = await dataEvmBalancesListCollectibleBalances(avaCloudSDK, {
pageSize: 10,
address: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
contractAddress: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ListCollectibleBalancesRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
options.serverURL |
string | ➖ | An optional server URL to use. |
Promise<operations.ListCollectibleBalancesResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.TooManyRequests | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.BadGateway | 502 | application/json |
errors.ServiceUnavailable | 503 | application/json |
errors.SDKError | 4XX, 5XX | */* |