Class: DirectKeystoreInteraction

interaction.DirectKeystoreInteraction()

Base class for direct keystore interactions.

Subclasses must implement a run method which communicates directly with the keystore. This method must be asynchronous (return a Promise) to accommodate delays with network, devices, &c.

Constructor

new DirectKeystoreInteraction()

Sets the this.direct property to true. This property can be utilized when introspecting on interaction classes..

Source:
Example
import {DirectKeystoreInteraction} from "unchained-wallets";
class SimpleDirectInteraction extends DirectKeystoreInteraction {   *

  constructor({param}) {
    super();
    this.param = param;
  }

  async run() {
    // Or do something complicated...
    return this.param;
  }
}

const interaction = new SimpleDirectInteraction({param: "foo"});

const result = await interaction.run();
console.log(result);
// "foo"

Methods

parse() → {void}

Throws an error.

Source:
Throws:

An error since this is a direct interaction.

Returns:
Type
void

request() → {void}

Throws an error.

Source:
Throws:

An error since this is a direct interaction.

Returns:
Type
void

(async) run() → {Promise}

Initiate the intended interaction and return a result.

Subclasses must override this function. This function must always return a promise as it is designed to be called within an await block.

Source:
Returns:

Does the work of interacting with the keystore.

Type
Promise