View Wallet Addresses
List all addresses for a wallet including balances and coin-specific data. See the Guide.
-
You list all addresses associated with a wallet by providing the coin type and wallet ID. The response includes each address along with its balance, coin-specific metadata, and chain index.
Prerequisites: You must have completed Get Started and Create Wallets.
// 1. List Addresses
export COIN="tbtc4"
export WALLET_ID="<YOUR_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
curl -X GET \
https://app.bitgo-test.com/api/v2/$COIN/wallet/$WALLET_ID/addresses \
-H "Authorization: Bearer $ACCESS_TOKEN"
// 1. List Addresses
import * as dotenv from "dotenv";
import {EnvironmentName} from "bitgo";
import {BitGoAPI} from "@bitgo/sdk-api";
import {Tbtc4} from "@bitgo/sdk-coin-btc";
dotenv.config();
const bitgo = new BitGoAPI({
env: process.env.ENV as EnvironmentName,
accessToken: process.env.TESTNET_ACCESS_TOKEN
});
const coin = 'tbtc4';
bitgo.register(coin, Tbtc4.createInstance);
const walletId = process.env.WALLET_ID;
async function main() {
const wallet = await bitgo.coin(coin).wallets().get({id: walletId});
wallet.addresses().then(function (addresses) {
// print addresses
console.dir(addresses);
})
}
main().catch((err) => console.error(err));
Response
// 1. List Addresses Response
{
"coin": "hteth",
"totalAddressCount": 1,
"pendingAddressCount": 0,
"addresses": [
{
"id": "63bc8507e014900008265d292c356e72",
"address": "0x7be0205683657c1a025aca0cb4ad2b9b37c74ff0",
"chain": 0,
"index": 0,
"coin": "hteth",
"lastNonce": 0,
"wallet": "63bc8506e014900008265c65363245f4",
"coinSpecific": {
"nonce": -1,
"updateTime": "2023-01-09T21:20:07.554Z",
"txCount": 0,
"pendingChainInitialization": false,
"creationFailure": [],
"pendingDeployment": false,
"forwarderVersion": 0
},
"balance": {
"updated": "2023-01-10T23:53:51.851Z",
"balance": "1000000000000000",
"balanceString": "1000000000000000",
"totalReceived": "1000000000000000",
"totalSent": "0",
"confirmedBalanceString": "1000000000000000",
"spendableBalanceString": "1000000000000000"
}
}
],
"count": 1
}