Fulfillment

types~ Fulfillment

Base class for fulfillment types.

Constructor

new Fulfillment()

Source:

Methods

(static) fromBinary(data) → {Fulfillment}

Create a Fulfillment object from a binary blob.

This method will parse a stream of binary data and construct a corresponding Fulfillment object.

Parameters:
Name Type Description
data Buffer

Binary buffer

Source:
Returns:

Resulting object

Type
Fulfillment

(static) fromUri(serializedFulfillment) → {Fulfillment}

Create a Fulfillment object from a URI.

This method will parse a fulfillment URI and construct a corresponding Fulfillment object.

Parameters:
Name Type Description
serializedFulfillment String

URI representing the fulfillment

Source:
Returns:

Resulting object

Type
Fulfillment

getCondition() → {Condition}

Generate condition corresponding to this fulfillment.

An important property of crypto-conditions is that the condition can always be derived from the fulfillment. This makes it very easy to post fulfillments to a system without having to specify which condition the relate to. The system can keep an index of conditions and look up any matching events related to that condition.

Source:
Returns:

Condition corresponding to this fulfillment.

Type
Condition

getConditionBinary() → {Buffer}

Shorthand for getting condition encoded as binary.

Stands for getCondition().serializeBinary().

Source:
Returns:

Binary encoded condition.

Type
Buffer

getConditionUri() → {String}

Shorthand for getting condition URI.

Stands for getCondition().serializeUri().

Source:
Returns:

Condition URI.

Type
String

getSubtypes() → {Set.<String>}

Return the bitmask of this fulfillment.

For simple fulfillment types this is simply the empty set.

For compound fulfillments, this returns the set of names of all subfulfillment types, recursively.

Source:
Returns:

Set of subtype names.

Type
Set.<String>

getTypeId() → {Number}

Return the type ID of this fulfillment.

Source:
Returns:

Type ID as an integer.

Type
Number

serializeBinary() → {Buffer}

Serialize fulfillment to a buffer.

Encodes the fulfillment as a string of bytes. This is used internally for encoding subfulfillments, but can also be used to passing around fulfillments in a binary protocol for instance.

Source:
Returns:

Serialized fulfillment

Type
Buffer

serializeUri() → {String}

Generate the URI form encoding of this fulfillment.

Turns the fulfillment into a URI containing only URL-safe characters. This format is convenient for passing around fulfillments in URLs, JSON and other text-based formats.

Source:
Returns:

Fulfillment as a URI

Type
String

validate() → {Boolean}

Validate this fulfillment.

This implementation is a stub and will be overridden by the subclasses.

Source:
Returns:

Validation result

Type
Boolean