Class: TrezorExportPublicKey

trezor.TrezorExportPublicKey()

Returns the public key at a given BIP32 path.

Constructor

new TrezorExportPublicKey()

Source:
Example
import {MAINNET} from "unchained-bitcoin";
import {TrezorExportPublicKey} from "unchained-wallets";
const interaction = new TrezorExportPublicKey({network: MAINNET, bip32Path: "m/48'/0'/0'/2'/0"});
const publicKey = await interaction.run();
console.log(publicKey);
// "03..."

Extends

Methods

connectParams() → {Array.<function(), Object>}

Overrides:
Source:
Returns:

TrezorConnect parameters

Type
Array.<function(), Object>

messages() → {Array.<module:interaction.Message>}

Adds messages related to warnings Trezor devices make depending on the BIP32 path passed.

Overrides:
Source:
Returns:

messages for this interaction

Type
Array.<module:interaction.Message>

parse() → {void}

Throws an error.

Overrides:
Source:
Throws:

An error since this is a direct interaction.

Returns:
Type
void

parsePayload(payload) → {string|Object}

Parses the public key from the HD node response.

Parameters:
Name Type Description
payload object

the original payload from the device response

Overrides:
Source:
Returns:

the (compressed) public key in hex or Object if root fingerprint requested

Type
string | Object

request() → {void}

Throws an error.

Overrides:
Source:
Throws:

An error since this is a direct interaction.

Returns:
Type
void

(async) run() → {Promise}

Awaits the call of this.method, passing in the output of this.params().

If the call returns but is unsuccessful (result.success) is false, will throw the returned error message. If some other error is thrown, it will not be caught.

Otherwise it returns the result of passing result.payload to this.parsePayload.

Overrides:
Source:
Returns:

handles the work of calling TrezorConnect

Type
Promise