Class

Tape

Tape(attrs) → {Tape}

Class for working with Operate tapes.

An Operate program is a tape made up of one or more cells, where each cell contains a single atomic procedure call (known as an "Op").

When a tape is run, each cell is executed in turn, with the result from each cell is passed to the next cell. This is known as the "state". Each cell returns a new state, until the final cell in the tape returns the result of the tape.

Constructor

# new Tape(attrs) → {Tape}

Creates a Tape instance.

Parameters:
Name Type Description
attrs Object

Attributes

View Source operate/tape.js, line 24

Tape

Members

# isValid

Validates the given tape. Returns true if all the tape's cells are valid.

View Source operate/tape.js, line 132

Methods

# static fromBPU(attrs) → {Tape}

Converts the given BPU Transaction into an Operate Tape.

Parameters:
Name Type Description
attrs Object

BPU Transaction

View Source operate/tape.js, line 39

Tape

# getOpRefs(aliases) → {Array}

Returns a list of Op references from the tape's cells. If an aliases object is specifed, this is used to alias references to alternative values.

Parameters:
Name Type Description
aliases Object

Aliases

View Source operate/tape.js, line 121

Array

# async run(vm, opts) → {Promise(any)}

Runs the tape in the given VM state.

Parameters:
Name Type Description
vm VM

VM state

opts Object

Options

View Source operate/tape.js, line 68

Promise(any)

# setCellOps(ops, aliases) → {Tape}

Sets the given Ops into the cells of the tape. If an aliases object is specifed, this is used to reverse map any procedure scripts onto aliased cells.

Parameters:
Name Type Description
ops Array

Op functions

aliases Object

Aliases

View Source operate/tape.js, line 100

Tape