Skip to content

Latest commit

 

History

History
346 lines (243 loc) · 11 KB

API.md

File metadata and controls

346 lines (243 loc) · 11 KB

Modules

@services/soundtrack

Implements the Soundtrack type.

Classes

InterfaceEventEmitter

Interfaces compile abstract contract code into Chain-executable transactions, or "chaincode". For example, the "Bitcoin" interface might compile a Swap contract into Script, preparing a valid Bitcoin transaction for broadcast which executes the swap contract.

Chain

Chain.

State

The State is the core of most User-facing interactions. To interact with the User, simply propose a change in the state by committing to the outcome. This workflow keeps app design quite simple!

@services/soundtrack

Implements the Soundtrack type.

@services/soundtrack~Soundtrack ⇐ Interface

Kind: inner class of @services/soundtrack
Extends: Interface

new Soundtrack([settings])

Create an instance of Soundtrack.

Param Type Description
[settings] Object List of options.

soundtrack.state

Getter for State.

Kind: instance property of Soundtrack

soundtrack.start()

Start the Interface.

Kind: instance method of Soundtrack

soundtrack.stop()

Stop the Interface.

Kind: instance method of Soundtrack

soundtrack.cycle(val)

Ticks the clock with a named Cycle.

Kind: instance method of Soundtrack

Param Type Description
val String Name of cycle to scribe.

soundtrack.log(...inputs)

Log some output to the console.

Kind: instance method of Soundtrack

Param Type Description
...inputs any Components of the message to long. Can be a single {@link} String, many String objects, or anything else.

soundtrack.now() ⇒ Number

Returns current timestamp.

Kind: instance method of Soundtrack

Interface ⇐ EventEmitter

Interfaces compile abstract contract code into Chain-executable transactions, or "chaincode". For example, the "Bitcoin" interface might compile a Swap contract into Script, preparing a valid Bitcoin transaction for broadcast which executes the swap contract.

Kind: global class
Extends: EventEmitter
Properties

Name Type Description
status String Human-friendly value representing the Interface's current State.

new Interface(settings)

Define an Interface by creating an instance of this class.

Returns: Interface - Instance of the Interface.

Param Type Description
settings Object Configuration values.

interface.state

Getter for State.

Kind: instance property of Interface

interface.start()

Start the Interface.

Kind: instance method of Interface

interface.stop()

Stop the Interface.

Kind: instance method of Interface

interface.cycle(val)

Ticks the clock with a named Cycle.

Kind: instance method of Interface

Param Type Description
val String Name of cycle to scribe.

interface.log(...inputs)

Log some output to the console.

Kind: instance method of Interface

Param Type Description
...inputs any Components of the message to long. Can be a single {@link} String, many String objects, or anything else.

interface.now() ⇒ Number

Returns current timestamp.

Kind: instance method of Interface

Chain

Chain.

Kind: global class
Properties

Name Type Description
name String Current name.
indices Map
ledger Ledger
storage Storage

new Chain(genesis)

Holds an immutable chain of events.

Param Type Description
genesis Vector Initial state for the chain of events.

State

The State is the core of most User-facing interactions. To interact with the User, simply propose a change in the state by committing to the outcome. This workflow keeps app design quite simple!

Kind: global class
Properties

Name Type Description
size Number Size of state in bytes.
@buffer Buffer Byte-for-byte memory representation of state.
@type String Named type.
@data Mixed Local instance of the state.
@id String Unique identifier for this data.

new State(data)

Creates a snapshot of some information.

Returns: State - Resulting state.

Param Type Description
data Mixed Input data.

state.toString() ⇒ String

Unmarshall an existing state to an instance of a Blob.

Kind: instance method of State
Returns: String - Serialized Blob.

state.serialize([input]) ⇒ Buffer

Convert to Buffer.

Kind: instance method of State
Returns: Buffer - Store-able blob.

Param Type Description
[input] Mixed Input to serialize.

state.deserialize(input) ⇒ State

Take a hex-encoded input and convert to a State object.

Kind: instance method of State
Returns: State - [description]

Param Type Description
input String [description]

state.fork() ⇒ State

Creates a new child State, with @parent set to the current State by immutable identifier.

Kind: instance method of State

state.get(path) ⇒ Mixed

Retrieve a key from the State.

Kind: instance method of State

Param Type Description
path Path Key to retrieve.

state.set(path) ⇒ Mixed

Set a key in the State to a particular value.

Kind: instance method of State

Param Type Description
path Path Key to retrieve.

state.commit()

Increment the vector clock, broadcast all changes as a transaction.

Kind: instance method of State

state.render() ⇒ String

Compose a JSON string for network consumption.

Kind: instance method of State
Returns: String - JSON-encoded String.

State.fromJSON(input) ⇒ State

Marshall an input into an instance of a State. States have absolute authority over their own domain, so choose your States wisely.

Kind: static method of State
Returns: State - Resulting instance of the State.

Param Type Description
input String Arbitrary input.