Constructor
new TrezorGetMetadata()
This class doesn't actually require a network
.
Example
import {TrezorGetMetadata} from "unchained-wallets";
const interaction = new TrezorGetMetadata();
const result = await interaction.run();
console.log(result);
{
spec: "Model 1 v1.8.3 w/PIN",
model: "Model 1",
version: {
major: 1,
minor: 8,
patch: 3,
string: "1.8.3",
},
label: "My Trezor",
pin: true,
passphrase: false,
}
Extends
Methods
connectParams() → {Array.<function(), Object>}
It is underdocumented, but TrezorConnect does support the
getFeatures
API call.
See https://github.com/trezor/connect/blob/v8/src/js/core/methods/GetFeatures.js.
- Overrides:
- Source:
Returns:
TrezorConnect parameters
- Type
- Array.<function(), Object>
messages() → {Array.<module:interaction.Message>}
Default messages are added asking the user to plug in their
Trezor device (device.connect
) and about the TrezorConnect
popups (trezor.connect.generic
).
Subclasses should override this method and add their own messages
(don't forget to call super()
).
- 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}
Parses Trezor device featuress into an appropriate metadata shape.
Parameters:
Name | Type | Description |
---|---|---|
payload |
Object | the original payload from the device response |
- Overrides:
- Source:
Returns:
device metadata & features
- 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