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": "tbtc4",
"totalAddressCount": 3,
"addresses": [
{
"id": "5f3a9b2c1d4e8f7a6b0c2d1e",
"address": "tb1qvk9ayd7xhkdnhp8clu7m2p84jmk3dt0szqg6qe6q8j5wmn2zsr0sj0kfhq",
"chain": 20,
"index": 0,
"coin": "tbtc4",
"wallet": "5e8d3f1a2b7c4e9d0f1a2b3c",
"label": "Primary Receive",
"coinSpecific": {
"witnessScript": "5221034ab17c91d582b9c3e285fccb8b8c6e31e1a9d7f2b543c0e1d6a7f8b9c2d4e5f2102a1b2c3d4e5f607182930a1b2c3d4e5f607182930a1b2c3d4e5f607182930a121039b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c3d2e1f0a9b853ae"
}
}
],
"count": 3
}