Gets an info of specified account.
ES6
const result = await TrezorConnect.getAccountInfo(params);CommonJS
TrezorConnect.getAccountInfo(params).then(function(result) {
});path— requiredstring | Array<number>minimum length is3. read morecoin— requiredstringdetermines network definition specified in coins.json file. Coinshortcut,nameorlabelcan be used.
descriptor— requiredstringpublic key of accountcoin— requiredstringdetermines network definition specified in coins.json file. Coinshortcut,nameorlabelcan be used.
BIP-0044 account discovery is performed and user is presented with a list of accounts. Result is returned after account selection.
coin— requiredstringdetermines network definition specified in coins.json file. Coinshortcut,nameorlabelcan be used.
params are forwarded to BlockBook backend using @trezor/blockchain-link package
-
details— specifies level of details returned by requestbasic(default) return only account balances, without any derived addresses or transaction historytokens- response with derived addresses (Bitcoin-like accounts) and ERC20 tokens (Ethereum-like accounts), subject oftokensparamtokenBalances- same astokenswith balances, subject oftokensparamtxs-tokenBalances+ complete account transaction history
-
tokens— specifies which tokens (xpub addresses) are returned by the request (default nonzero)nonzero- (Default) return only addresses with nonzero balanceused- return addresses with at least one transactionderived- return all derived addresses
-
page—numbertransaction history page index, subject ofdetails: txs -
pageSize—numbertransaction history page size, subject ofdetails: txs -
from—numbertransaction history from block filter, subject ofdetails: txs -
to—numbertransaction history to block filter, subject ofdetails: txs -
gap—numberaddress derivation gap size, subject ofdetails: tokens -
contractFilter—stringEthereum-like accounts only: get ERC20 token info and balance -
marker—{ ledger: number, seq: number }XRP accounts only, transaction history page marker -
defaultAccountType—'normal' | 'segwit' | 'legacy'Bitcoin-like accounts only: specify which account group is displayed as default in popup, subject ofUsing discovery
Get info about first bitcoin account
TrezorConnect.getAccountInfo({
path: "m/49'/0'/0'",
coin: "btc",
});Get info about account using public key (device is not used)
TrezorConnect.getAccountInfo({
descriptor: "xpub6CVKsQYXc9awxgV1tWbG4foDvdcnieK2JkbpPEBKB5WwAPKBZ1mstLbKVB4ov7QzxzjaxNK6EfmNY5Jsk2cG26EVcEkycGW4tchT2dyUhrx",
coin: "btc",
});Get info about account using BIP-0044 account discovery
TrezorConnect.getAccountInfo({
coin: "btc",
});{
success: true,
payload: {
id: number, // account id
path: string, // serialized path
descriptor: string, // account public key
legacyXpub?: string, // (optional) account public key in legacy format (only for segwit and segwit native accounts)
balance: string, // account balance (confirmed transactions only)
availableBalance: string, // account balance (including unconfirmed transactions)
addresses: {
// subject of details:tokens param
unused: Array<AccountAddress>, // unused addresses
used: Array<AccountAddress>, // used addresses
change: Array<AccountAddress>, // change addresses (internal)
}, // list of derived addresses grouped by purpose (Bitcoin-like accounts)
history: Array<{
total: number,
unconfirmed: number,
transactions?: Array<AccountTransaction>, // subject of details:txs param
}> // account history object
utxo?: Array<AccountUtxo>, // account utxos (Bitcoin-like accounts), subject of details:tokens param
tokens?: Array<TokenInfo>, // account ERC20 tokens (Ethereum-like accounts), subject of details:tokens param
misc?: {
// Ethereum-like accounts only
nonce: string,
erc20Contract?: TokenInfo, // subject of contractFilter param
// XRP accounts only
sequence?: number,
reserve?: string,
},
page?: {
// subject of details:txs param
index: number, // current page index
size: number, // current page size
total: number, // total pages count
},
marker?: {
// XRP accounts only
// subject of details:txs param
ledger: number,
seq: number,
}
} //
}AccountInfo AccountAddress AccountTransaction AccountUtxo TokenInfo
Error
{
success: false,
payload: {
error: string // error message
}
}v7 and below:
TrezorConnect.getAccountInfo({
path: "m/49'/0'/0'",
}).then(function (result) {
result.id // removed
result.serializedPath // renamed to "path"
result.path // not changed
result.xpub // renamed to "descriptor"
result.address // renamed to "addresses.unused[0].address"
result.addressPath // renamed to "addresses.unused[0].path"
result.addressIndex // removed
result.addressSerializedPath // renamed to "addresses.unused[0].path"
result.balance // returned as string
result.confirmed // removed
});v4 and below:
TrezorConnect.getAccountInfo("m/49'/0'/0'", function(result) {
result.id // removed
result.serializedPath // renamed to "path"
result.path // not changed
result.xpub // renamed to "descriptor"
result.freshAddress // renamed to "addresses.unused[0].address"
result.freshAddressPath // renamed to "addresses.unused[0].path"
result.freshAddressId // removed
result.serializedFreshAddressPath // renamed to "addresses.unused[0].path"
result.balance // returned as string
result.confirmed // removed
});should be
// params are key-value pairs inside Object
TrezorConnect.getAccountInfo({
path: "m/49'/0'/0'",
coin: "btc"
}).then(function(result) {
...
})