Get account info
Gets an info of specified account.
const result = await TrezorConnect.getAccountInfo(params);Params
Using path
path
String | Array<Number>
minimum length is 3. read more
coin
String
determines network definition specified in coins.json file. Coin shortcut, name or label can be used.
Using public key or address
descriptor
String
public key or address of account
coin
String
determines network definition specified in coins.json file. Coin shortcut, name or label can be used.
Using discovery
BIP-0044 account discovery is performed and user is presented with a list of accounts. Result is returned after account selection.
coin
String
determines network definition specified in coins.json file. Coin shortcut, name or label can be used.
Other optional params
params are forwarded to BlockBook backend using @trezor/blockchain-link package
details
"basic" | "tokens" | "tokenBalances" | "txs"
specifies level of details returned by request
basic(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
"nonzero" | "used" | "derived"
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
Number
transaction history page index, subject of details: txs
pageSize
Number
transaction history page size, subject of details: txs
from
Number
transaction history from block filter, subject of details: txs
to
Number
transaction history to block filter, subject of details: txs
gap
Number
address derivation gap size, subject of details: tokens
contractFilter
String
Ethereum-like accounts only: get ERC20 token info and balance
marker
Object
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 of Using discovery
suppressBackupWarning
Boolean
By default, this method will emit an event to show a warning if the wallet does not have a backup. This option suppresses the message.
Example
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',
});Result
{
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,
contractInfo?: 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,
}
} //
}Error
{
success: false,
payload: {
error: string // error message
}
}