Display requested address derived by given BIP44 path on device and returns it to caller. User is presented with a description of the requested key and asked to confirm the export on Trezor.
ES6
const result = await TrezorConnect.binanceGetAddress(params);
CommonJS
TrezorConnect.binanceGetAddress(params).then(function(result) {
});
path
— obligatorystring | Array<number>
minimum length is5
. read moreaddress
— optionalstring
address for validation (readHandle button request
section below)showOnTrezor
— optionalboolean
determines if address will be displayed on device. Default is set totrue
bundle
-Array
of Objects withpath
andshowOnTrezor
fields
Since trezor-connect@6.0.4 there is a possibility to handle UI.ADDRESS_VALIDATION
event which will be triggered once the address is displayed on the device.
You can handle this event and display custom UI inside of your application.
If certain conditions are fulfilled popup will not be used at all:
- the user gave permissions to communicate with Trezor
- device is authenticated by pin/passphrase
- application has
TrezorConnect.on(UI.ADDRESS_VALIDATION, () => {});
listener registered - parameter
address
is set - parameter
showOnTrezor
is set totrue
(or not set at all) - application is requesting ONLY ONE(!) address
Display address of first Binance account:
TrezorConnect.binanceGetAddress({
path: "m/44'/714'/0'/0/0"
});
Return a bundle of Binance addresses without displaying them on device:
TrezorConnect.binanceGetAddress({
bundle: [
{ path: "m/44'/714'/0'/0/0", showOnTrezor: false }, // account 1, address 1
{ path: "m/44'/714'/1'/0/1", showOnTrezor: false }, // account 2, address 2
{ path: "m/44'/714'/2'/0/2", showOnTrezor: false } // account 3, address 3
]
});
Validate address using custom UI inside of your application:
import TrezorConnect, { UI } from 'trezor-connect';
TrezorConnect.on(UI.ADDRESS_VALIDATION, data => {
console.log("Handle button request", data.address, data.serializedPath);
// here you can display custom UI inside of your app
});
const result = await TrezorConnect.binanceGetAddress({
path: "m/44'/714'/0'/0/0",
address: "bnb1afwh46v6nn30nkmugw5swdmsyjmlxslgjfugre",
});
// don't forget to hide your custom UI after you get the result!
Result with only one address
{
success: true,
payload: {
path: Array<number>, // hardended path
serializedPath: string,
address: string,
}
}
Result with bundle of addresses
{
success: true,
payload: [
{ path: Array<number>, serializedPath: string, address: string }, // account 1, address 1
{ path: Array<number>, serializedPath: string, address: string }, // account 2, address 2
{ path: Array<number>, serializedPath: string, address: string } // account 3, address 3
]
}
Error
{
success: false,
payload: {
error: string // error message
}
}