Constructor
new UnsupportedInteraction(options)
Accepts parameters to describe what is unsupported and why.
The text
should be human-readable. The code
is for machines.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options argument Properties
|
- Source:
Example
import {UnsupportedInteraction} from "unchained-wallets";
const interaction = new UnsupportedInteraction({text: "failure text", code: "fail"});
console.log(interaction.isSupported()); // false
Extends
Methods
hasMessagesFor(options) → {boolean}
Return whether there are any messages matching the given options.
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options argument Properties
|
- Overrides:
- Source:
Returns:
- whether any messages match the given filters
- Type
- boolean
isSupported() → {false}
By design, this method always returns false.
- Overrides:
- Source:
Returns:
Always.
- Type
- false
messageFor(options) → {module:interaction.Message|null}
Return the first message matching the given options (or null
if none is found).
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options argument Properties
|
- Overrides:
- Source:
Returns:
the first matching Message
object (or null
if none is found)
- Type
- module:interaction.Message | null
messages() → {Array.<module:interaction.Message>}
Returns a single error
level message at the unsupported
state.
- Overrides:
- Source:
Returns:
the messages for this class
- Type
- Array.<module:interaction.Message>
messagesFor(options) → {Array.<module:interaction.Message>}
Return messages filtered by the given options.
Multiple options can be given at once to filter along multiple dimensions.
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options argument Properties
|
- Overrides:
- Source:
Returns:
matching Message
objects
- Type
- Array.<module:interaction.Message>
Example
import {PENDING, ACTIVE} from "unchained-bitcoin";
// Create any interaction instance
interaction.messages().forEach(msg => console.log(msg));
{ code: "device.connect", state: "pending", level: "info", text: "Please plug in your device."}
{ code: "device.active", state: "active", level: "info", text: "Communicating with your device..."}
{ code: "device.active.warning", state: "active", level: "warning", text: "Your device will warn you about...", version: "2.x"}
interaction.messagesFor({state: PENDING}).forEach(msg => console.log(msg));
{ code: "device.connect", state: "pending", level: "info", text: "Please plug in your device."}
interaction.messagesFor({code: ACTIVE}).forEach(msg => console.log(msg));
{ code: "device.active", state: "active", level: "info", text: "Communicating with your device..."}
{ code: "device.active.warning", state: "active", level: "warning", text: "Your device will warn you about...", version: "2.x"}
interaction.messagesFor({version: /^2/}).forEach(msg => console.log(msg));
{ code: "device.active", state: "active", level: "warning", text: "Your device will warn you about...", version: "2.x"}
messageTextFor(options) → {string|null}
Retrieve the text of the first message matching the given options
(or null
if none is found).
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options argument Properties
|
- Overrides:
- Source:
Returns:
the text of the first matching message (or null
if none is found)
- Type
- string | null
parse() → {void}
Throws an error.
- Source:
Throws:
An error containing this this.text
.
Returns:
- Type
- void
request() → {void}
Throws an error.
- Source:
Throws:
An error containing this this.text
.
Returns:
- Type
- void
(async) run() → {void}
Throws an error.
- Source:
Throws:
An error containing this this.text
.
Returns:
- Type
- void