Skip to content

Latest commit

 

History

History
95 lines (86 loc) · 2.48 KB

File metadata and controls

95 lines (86 loc) · 2.48 KB

Ethereum: get address

Display requested address derived by given BIP32 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.ethereumGetAddress(params);

CommonJS

TrezorConnect.ethereumGetAddress(params).then(function(result) {

});

Params

Optional common params

Exporting single address

  • pathobligatory string | Array<number> minimum length is 3. read more
  • showOnTrezoroptional boolean determines if address will be displayed on device. Default is set to true

Exporting bundle of addresses

  • bundle - Array of Objects with path and showOnTrezor fields

Example

Display address of first ethereum account:

TrezorConnect.ethereumGetAddress({
    path: "m/44'/60'/0'"
});

Return a bundle of ethereum addresses without displaying them on device:

TrezorConnect.ethereumGetAddress({
    bundle: [
        { path: "m/44'/60'/0'", showOnTrezor: false }, // account 1
        { path: "m/44'/60'/1'", showOnTrezor: false }, // account 2
        { path: "m/44'/60'/2'", showOnTrezor: false }  // account 3
    ]
});

Result

Result with only one address

{
    success: true,
    payload: {
        address: string,     // displayed address
        path: Array<number>, // hardended path
        serializedPath: string,
    }
}

Result with bundle of addresses sorted by FIFO

{
    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
    }
}

Migration from older version

version 4 and below:

TrezorConnect.ethereumGetAddress("m/44'/60'/0'", function(result) {
    result.address // address without "0x" prefix and without checksum
    result.path
});

version 5

// params are key-value pairs inside Object
TrezorConnect.ethereumGetAddress({ 
    path: "m/44'/60'/0'" 
}).then(function(result) {
    result.address   // address with "0x" prefix and checksum
    result.path      // no change
    result.serializedPath // added
})