View Wallets and Balances
Overview
BitGo enables you to retrieve wallet details, including addresses and balances. Every BitGo wallet has a wallet ID that identifies it on its respective blockchain. Even though wallets may have multiple receive addresses, each wallet can only have 1 wallet ID. Using the wallet ID and or the ticker symbol of the asset, you can retrieve various combinations of wallet details, such as:
- Addresses
- Balances
- All addresses in a wallet
- All your cyrptocurrencies from all your wallets
- Specific currencies
- Specific wallets
- Keys
- Users
- Staking data
- Wallet types
Most of the endpoints that return wallet-balance data include NFT data. However, some of the endpoints don't return NFT data. Review the following:
Balances (Including NFTs) | Balances (Excluding NFTs) |
---|---|
List Addresses | List Total Balances |
List Wallet by Coin | Get Wallet by Address |
List Wallets | |
Get Wallet |
Prerequisites
Steps
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
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}); console.dir(wallet._wallet); } main().catch((err) => console.error(err));
Step Result
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
{ "id": "63bc8506e014900008265c65363245f4", "users": [ { "user": "62ab90e06dfda30007974f0a52a12995", "permissions": [ "admin", "view", "spend" ] } ], "coin": "hteth", "label": "NFT Wallet (1)", "m": 2, "n": 3, "keys": [ "63bc8505f4df3c000793bfd753bcef4f", "63bc85058426ee00073e74fdf5418927", "62c5ae7f74ac860007aff0cb9bcf93a6" ], "keySignatures": { "backupPub": "1f6dd167231bcc02352b7bb201fa87aeddec2468769e824d33422499ac25c450fb5b1d52802bde6f6e7e4bb16668b519986c4e003fd4ee24d9aa968e2981b8e8f6", "bitgoPub": "1f9f442835d19fc875748f3aa21cdd7aad8404ef32a616bf17028a5e4f66bab317433050d496f89799dbe0dcbd5077cc4f04532fcf02fb3c342988ae85ac36987e" }, "enterprise": "62c5ae8174ac860007aff138a2d74df7", "tags": [ "63bc8506e014900008265c65363245f4", "62c5ae8174ac860007aff138a2d74df7" ], "disableTransactionNotifications": false, "freeze": {}, "deleted": false, "approvalsRequired": 1, "isCold": false, "coinSpecific": { "deployedInBlock": false, "deployTxHash": "0xecfd15fc430d1df805a386b88fdd9dc43256e08080c4645f227b76cf01d0c42e", "lastChainIndex": { "0": 0, "1": -1 }, "baseAddress": "0x7be0205683657c1a025aca0cb4ad2b9b37c74ff0", "feeAddress": "0x90e1d81e6ac41c71c3e19a2e787b38e21063edb3", "pendingChainInitialization": false, "creationFailure": [], "gasPriceTier": "fast", "tokenFlushThresholds": {}, "lowPriorityFeeAddress": "0x5d651c84bd8c09da044aa10322c992f04c7df369", "salt": "0x7", "walletVersion": 2, "pendingDeployment": false, "deployForwardersManually": false, "flushForwardersManually": false, "enableMMI": false, "enableNFT": true }, "admin": { "policy": { "date": "2023-01-09T21:20:07.453Z", "id": "63bc8507e014900008265d017902c133", "label": "default", "rules": [], "version": 0, "latest": true } }, "clientFlags": [], "walletFlags": [], "allowBackupKeySigning": false, "recoverable": false, "startDate": "2023-01-09T21:20:06.000Z", "type": "hot", "buildDefaults": {}, "customChangeKeySignatures": {}, "hasLargeNumberOfAddresses": false, "multisigType": "onchain", "config": {}, "balanceString": "1000000000000000", "confirmedBalanceString": "1000000000000000", "spendableBalanceString": "1000000000000000", "receiveAddress": { "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 } }, "pendingApprovals": [] }