import cobo_waas2
from cobo_waas2.models.list_account_balances200_response import (
ListAccountBalances200Response,
)
from cobo_waas2.rest import ApiException
from pprint import pprint
# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
# Replace `<YOUR_PRIVATE_KEY>` with your private key
api_private_key="<YOUR_PRIVATE_KEY>",
# Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = cobo_waas2.WalletsApi(api_client)
wallet_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479"
chain_id = "ETH"
queries = (
"ETH_USDT:0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b,"
"ETH:0x9bff46afe2b45ffdfd8a99d4990878d0a44a67b8"
)
try:
# List account balances
api_response = api_instance.list_account_balances(wallet_id, chain_id, queries)
print("The response of WalletsApi->list_account_balances:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling WalletsApi->list_account_balances: %s\n" % e)
// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.WalletsApi;
import com.cobo.waas2.model.*;
import java.util.UUID;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Select the development environment. To use the production environment, replace `Env.DEV` with
// `Env.PROD
defaultClient.setEnv(Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
WalletsApi apiInstance = new WalletsApi();
UUID walletId = UUID.fromString("f47ac10b-58cc-4372-a567-0e02b2c3d479");
String chainId = "ETH";
String queries =
"ETH_USDT:0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b,"
+ "ETH:0x9bff46afe2b45ffdfd8a99d4990878d0a44a67b8";
try {
ListAccountBalances200Response result =
apiInstance.listAccountBalances(walletId, chainId, queries);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletsApi#listAccountBalances");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
package main
import (
"context"
"fmt"
coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
"os"
)
func main() {
walletId := "f47ac10b-58cc-4372-a567-0e02b2c3d479"
chainId := "ETH"
queries := "ETH_USDT:0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b,ETH:0x9bff46afe2b45ffdfd8a99d4990878d0a44a67b8"
configuration := coboWaas2.NewConfiguration()
// Initialize the API client
apiClient := coboWaas2.NewAPIClient(configuration)
ctx := context.Background()
// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
// Replace `<YOUR_PRIVATE_KEY>` with your private key
ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
Secret: "<YOUR_PRIVATE_KEY>",
})
resp, r, err := apiClient.WalletsAPI.ListAccountBalances(ctx, walletId, chainId).
Queries(queries).
Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WalletsAPI.ListAccountBalances``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListAccountBalances`: ListAccountBalances200Response
fmt.Fprintf(os.Stdout, "Response from `WalletsAPI.ListAccountBalances`: %v\n", resp)
}
const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.WalletsApi();
const wallet_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
const chain_id = "ETH";
const queries =
"ETH_USDT:0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b,ETH:0x9bff46afe2b45ffdfd8a99d4990878d0a44a67b8";
apiInstance.listAccountBalances(wallet_id, chain_id, queries).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
{
"data": [
{
"address": "0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b",
"token_id": "ETH_USDT",
"balance": "1000.5",
"block_number": 20000000
}
]
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}List account balances
This operation retrieves the on-chain token balances of multiple addresses on a specified account-based chain in a single request. All balances in the response are retrieved from the same block state, together with the block number of that block.
You need to specify the wallet ID to scope the balance queries to a specific wallet. The wallet ID can be retrieved by calling List all wallets.
import cobo_waas2
from cobo_waas2.models.list_account_balances200_response import (
ListAccountBalances200Response,
)
from cobo_waas2.rest import ApiException
from pprint import pprint
# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
# Replace `<YOUR_PRIVATE_KEY>` with your private key
api_private_key="<YOUR_PRIVATE_KEY>",
# Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = cobo_waas2.WalletsApi(api_client)
wallet_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479"
chain_id = "ETH"
queries = (
"ETH_USDT:0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b,"
"ETH:0x9bff46afe2b45ffdfd8a99d4990878d0a44a67b8"
)
try:
# List account balances
api_response = api_instance.list_account_balances(wallet_id, chain_id, queries)
print("The response of WalletsApi->list_account_balances:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling WalletsApi->list_account_balances: %s\n" % e)
// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.WalletsApi;
import com.cobo.waas2.model.*;
import java.util.UUID;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Select the development environment. To use the production environment, replace `Env.DEV` with
// `Env.PROD
defaultClient.setEnv(Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
WalletsApi apiInstance = new WalletsApi();
UUID walletId = UUID.fromString("f47ac10b-58cc-4372-a567-0e02b2c3d479");
String chainId = "ETH";
String queries =
"ETH_USDT:0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b,"
+ "ETH:0x9bff46afe2b45ffdfd8a99d4990878d0a44a67b8";
try {
ListAccountBalances200Response result =
apiInstance.listAccountBalances(walletId, chainId, queries);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletsApi#listAccountBalances");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
package main
import (
"context"
"fmt"
coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
"os"
)
func main() {
walletId := "f47ac10b-58cc-4372-a567-0e02b2c3d479"
chainId := "ETH"
queries := "ETH_USDT:0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b,ETH:0x9bff46afe2b45ffdfd8a99d4990878d0a44a67b8"
configuration := coboWaas2.NewConfiguration()
// Initialize the API client
apiClient := coboWaas2.NewAPIClient(configuration)
ctx := context.Background()
// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
// Replace `<YOUR_PRIVATE_KEY>` with your private key
ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
Secret: "<YOUR_PRIVATE_KEY>",
})
resp, r, err := apiClient.WalletsAPI.ListAccountBalances(ctx, walletId, chainId).
Queries(queries).
Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WalletsAPI.ListAccountBalances``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListAccountBalances`: ListAccountBalances200Response
fmt.Fprintf(os.Stdout, "Response from `WalletsAPI.ListAccountBalances`: %v\n", resp)
}
const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.WalletsApi();
const wallet_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
const chain_id = "ETH";
const queries =
"ETH_USDT:0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b,ETH:0x9bff46afe2b45ffdfd8a99d4990878d0a44a67b8";
apiInstance.listAccountBalances(wallet_id, chain_id, queries).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
{
"data": [
{
"address": "0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b",
"token_id": "ETH_USDT",
"balance": "1000.5",
"block_number": 20000000
}
]
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}import cobo_waas2
from cobo_waas2.models.list_account_balances200_response import (
ListAccountBalances200Response,
)
from cobo_waas2.rest import ApiException
from pprint import pprint
# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
# Replace `<YOUR_PRIVATE_KEY>` with your private key
api_private_key="<YOUR_PRIVATE_KEY>",
# Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = cobo_waas2.WalletsApi(api_client)
wallet_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479"
chain_id = "ETH"
queries = (
"ETH_USDT:0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b,"
"ETH:0x9bff46afe2b45ffdfd8a99d4990878d0a44a67b8"
)
try:
# List account balances
api_response = api_instance.list_account_balances(wallet_id, chain_id, queries)
print("The response of WalletsApi->list_account_balances:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling WalletsApi->list_account_balances: %s\n" % e)
// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.WalletsApi;
import com.cobo.waas2.model.*;
import java.util.UUID;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Select the development environment. To use the production environment, replace `Env.DEV` with
// `Env.PROD
defaultClient.setEnv(Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
WalletsApi apiInstance = new WalletsApi();
UUID walletId = UUID.fromString("f47ac10b-58cc-4372-a567-0e02b2c3d479");
String chainId = "ETH";
String queries =
"ETH_USDT:0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b,"
+ "ETH:0x9bff46afe2b45ffdfd8a99d4990878d0a44a67b8";
try {
ListAccountBalances200Response result =
apiInstance.listAccountBalances(walletId, chainId, queries);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletsApi#listAccountBalances");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
package main
import (
"context"
"fmt"
coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
"os"
)
func main() {
walletId := "f47ac10b-58cc-4372-a567-0e02b2c3d479"
chainId := "ETH"
queries := "ETH_USDT:0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b,ETH:0x9bff46afe2b45ffdfd8a99d4990878d0a44a67b8"
configuration := coboWaas2.NewConfiguration()
// Initialize the API client
apiClient := coboWaas2.NewAPIClient(configuration)
ctx := context.Background()
// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
// Replace `<YOUR_PRIVATE_KEY>` with your private key
ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
Secret: "<YOUR_PRIVATE_KEY>",
})
resp, r, err := apiClient.WalletsAPI.ListAccountBalances(ctx, walletId, chainId).
Queries(queries).
Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WalletsAPI.ListAccountBalances``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListAccountBalances`: ListAccountBalances200Response
fmt.Fprintf(os.Stdout, "Response from `WalletsAPI.ListAccountBalances`: %v\n", resp)
}
const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.WalletsApi();
const wallet_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
const chain_id = "ETH";
const queries =
"ETH_USDT:0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b,ETH:0x9bff46afe2b45ffdfd8a99d4990878d0a44a67b8";
apiInstance.listAccountBalances(wallet_id, chain_id, queries).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
Authorizations
The API key. For more details, refer to API key.
In the API playground, enter your API secret, and your API key will be accordingly calculated.
Path Parameters
The wallet ID.
The chain ID, which is the unique identifier of a blockchain. Currently, only the following account-based chains are supported:
ETH: EthereumTRON: TRONSOL: SolanaSETH: Ethereum Sepolia TestnetTTRON: TRON TestnetSOLDEV_SOL: Solana Devnet
Query Parameters
A comma-separated list of balance queries. Each query is a token ID and a wallet address separated by a colon (:), in the format {token_id}:{address}. A maximum of 50 queries can be specified per request to ensure the URL length stays within standard web server limits (typically 8 KB).
You can retrieve the IDs of all the tokens you can use by calling List enabled tokens.
Example: ETH_USDT:0x1c53e3f2f8b59e5d6b6b6b6b6b6b6b6b6b6b6b6b,ETH:0x9bff46afe2b45ffdfd8a99d4990878d0a44a67b8
Response
The request was successful.
Show child attributes
Show child attributes
Was this page helpful?
