Display requested address on device and returns it to caller. User is presented with a description of the requested key and asked to confirm the export.
ES6
const result = await TrezorConnect.nemGetAddress(params);CommonJS
TrezorConnect.nemGetAddress(params).then(function(result) {
});path— obligatorystring | Array<number>minimum length is3. read moreaddress— optionalstringaddress for validation (readHandle button requestsection below)network— optionalnumber0x68- Mainnet,0x96- Testnet,0x60- Mijin. Default is set toMainnetshowOnTrezor— optionalbooleandetermines if address will be displayed on device. Default is set totrue
bundle-Arrayof Objects withpath,networkandshowOnTrezorfields
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
addressis set - parameter
showOnTrezoris set totrue(or not set at all) - application is requesting ONLY ONE(!) address
Display address of third nem account:
TrezorConnect.nemGetAddress({
path: "m/44'/43'/2'"
});Return a bundle of NEM addresses without displaying them on device:
TrezorConnect.nemGetAddress({
bundle: [
{ path: "m/44'/43'/0'", showOnTrezor: false }, // account 1
{ path: "m/44'/43'/1'", showOnTrezor: false }, // account 2
{ path: "m/44'/43'/2'", showOnTrezor: false } // account 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.nemGetAddress({
path: "m/44'/43'/0'",
address: "TDS7OQUHKNYMSC2WPJA6QUTLJIO22S27B4FMU2AJ",
});
// dont forget to hide your custom UI after you get the result!Result with only one address
{
success: true,
payload: {
address: string,
path: Array<number>,
serializedPath: string,
}
}Result with bundle of addresses
{
success: true,
payload: [
{ address: string, path: Array<number>, serializedPath: string }, // account 1
{ address: string, path: Array<number>, serializedPath: string }, // account 2
{ address: string, path: Array<number>, serializedPath: string }, // account 3
]
}Error
{
success: false,
payload: {
error: string // error message
}
}version 4 and below
TrezorConnect.nemGetAddress(
"m/44'/43'/0'",
0x68,
function(result) {
result.address,
result.path
}
);version 5
// params are key-value pairs inside Object
TrezorConnect.nemGetAddress({
path: "m/44'/43'/0'",
network: 0x68,
showOnTrezor: true
}).then(function(result) {
result.address, // no change
result.path, // no change
result.serializedPath // added
})