Interface

Adapter

Adapter

An adapter is responsible for loading tapes and ops from a datasource - potentially a web API, a database or even a Bitcoin node. Operate ships with two default adapters, although these can be swapped out with any other adpater by changing the configuration.

An adapter must implement one or more of the following static methods:

  • fetchTx()
  • fetchTxBy()
  • fetchOps()

Methods

# static fetchOps(refs, opts) → {Promise}

Fetches a list of Ops by the given list of Op references, and returns a Promise.

Parameters:
Name Type Description
refs Array

Op references

opts Object

Options

View Source operate/adapter.js, line 50

Promise

# static fetchTx(txid, opts) → {Promise}

Fetches a transaction by the given txid, and returns a Promise.

Parameters:
Name Type Description
txid String

Transaction id

opts Object

Options

View Source operate/adapter.js, line 26

Promise

# static fetchTxBy(query, opts) → {Promise}

Fetches a list of transactions by the given query object, and returns a Promise.

Parameters:
Name Type Description
query Object

Query object

opts Object

Options

View Source operate/adapter.js, line 38

Promise