Constructor
new TrezorExportHDNode(options, bip32Path, includeXFP)
Requires a BIP32 path to the node to export as well as which network.
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
options |
object | options argument Properties
|
||||||
bip32Path |
string | the BIP32 path for the HD node |
||||||
includeXFP |
boolean | return xpub with root fingerprint concatenated |
Example
import {MAINNET} from "unchained-bitcoin";
import {TrezorExportHDNode} from "unchained-wallets";
const interaction = new TrezorExportHDNode({network: MAINNET, bip32Path: "m/48'/0'/0'/2'/0"});
const node = await interaction.run();
console.log(node); // {publicKey: "", xpub: "", ...}
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) → {Object}
Override this method in a subclass to parse the payload of a successful response from the device.
By default, the entire payload is returned.
Parameters:
| Name | Type | Description |
|---|---|---|
payload |
Object | the raw payload from the device response |
- Overrides:
- Source:
Returns:
- relevant or formatted data built from the raw payload
- Type
- 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