Constructor
new TrezorExportExtendedPublicKey()
Example
import {MAINNET} from "unchained-bitcoin";
import {TrezorExportExtendedPublicKey} from "unchained-wallets";
const interaction = new TrezorExportExtendedPublicKey({network: MAINNET, bip32Path: "m/48'/0'/0'"});
const xpub = await interaction.run();
console.log(xpub);
// "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) → {string|Object}
Parses the extended public key from the HD node response.
If asking for XFP, return object with xpub and the root fingerprint.
Parameters:
| Name | Type | Description |
|---|---|---|
payload |
object | the original payload from the device response |
- Overrides:
- Source:
Returns:
the extended public key (returns object if asked to include root fingerprint)
- 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