Skip to main content

Intent

@midnight/ledger v7.0.0


@midnight/ledger / Intent

Class: Intent<S, P, B>

An intent is a potentially unbalanced partial transaction, that may be combined with other intents to form a whole.

Type Parameters

S

S extends Signaturish

P

P extends Proofish

B

B extends Bindingish

Properties

actions

actions: ContractAction<P>[];

The action sequence of this intent.

Throws

Writing throws if B is Binding.


binding

readonly binding: B;

dustActions

dustActions: undefined | DustActions<S, P>;

The DUST interactions made by this intent

Throws

Writing throws if B is Binding.


fallibleUnshieldedOffer

fallibleUnshieldedOffer: undefined | UnshieldedOffer<S>;

The UTXO inputs and outputs in the fallible section of this intent.

Throws

Writing throws if B is Binding, unless the only change is in the signature set.


guaranteedUnshieldedOffer

guaranteedUnshieldedOffer: undefined | UnshieldedOffer<S>;

The UTXO inputs and outputs in the guaranteed section of this intent.

Throws

Writing throws if B is Binding, unless the only change is in the signature set.


ttl

ttl: Date;

The time this intent expires.

Throws

Writing throws if B is Binding.

Methods

addCall()

addCall(call): Intent<S, PreProof, PreBinding>;

Adds a contract call to this intent.

Parameters

call

ContractCallPrototype

Returns

Intent<S, PreProof, PreBinding>


addDeploy()

addDeploy(deploy): Intent<S, PreProof, PreBinding>;

Adds a contract deploy to this intent.

Parameters

deploy

ContractDeploy

Returns

Intent<S, PreProof, PreBinding>


addMaintenanceUpdate()

addMaintenanceUpdate(update): Intent<S, PreProof, PreBinding>;

Adds a maintenance update to this intent.

Parameters

update

MaintenanceUpdate

Returns

Intent<S, PreProof, PreBinding>


bind()

bind(segmentId): Intent<S, P, Binding>;

Enforces binding for this intent. This is irreversible.

Parameters

segmentId

number

Returns

Intent<S, P, Binding>

Throws

If segmentId is not a valid segment ID.


eraseProofs()

eraseProofs(): Intent<S, NoProof, NoBinding>;

Removes proofs from this intent.

Returns

Intent<S, NoProof, NoBinding>


eraseSignatures()

eraseSignatures(): Intent<SignatureErased, P, B>;

Removes signatures from this intent.

Returns

Intent<SignatureErased, P, B>


intentHash()

intentHash(segmentId): string;

Returns the hash of this intent, for it's given segment ID.

Parameters

segmentId

number

Returns

string


serialize()

serialize(): Uint8Array;

Returns

Uint8Array


signatureData()

signatureData(segmentId): Uint8Array;

The raw data that is signed for unshielded inputs in this intent.

Parameters

segmentId

number

Returns

Uint8Array


toString()

toString(compact?): string;

Parameters

compact?

boolean

Returns

string


deserialize()

static deserialize<S, P, B>(
markerS,
markerP,
markerB,
raw): Intent<S, P, B>;

Type Parameters

S

S extends Signaturish

P

P extends Proofish

B

B extends Bindingish

Parameters

markerS

S["instance"]

markerP

P["instance"]

markerB

B["instance"]

raw

Uint8Array

Returns

Intent<S, P, B>


new()

static new(ttl): UnprovenIntent;

Parameters

ttl

Date

Returns

UnprovenIntent