@proto-kit/protocol β€’ Docs


Documentation / @proto-kit/protocol / StateTransition

Class: StateTransition<Value>

Generic state transition that constraints the current method circuit to external state, by providing a state anchor.

Type Parameters

β€’ Value

Constructors

new StateTransition()

new StateTransition<Value>(path, fromValue, toValue): StateTransition<Value>

Parameters

β€’ path: Field

β€’ fromValue: Option<Value>

β€’ toValue: Option<Field> | Option<Value>

Returns

StateTransition<Value>

Defined in

packages/protocol/src/model/StateTransition.ts:51

Properties

fromValue

fromValue: Option<Value>

Defined in

packages/protocol/src/model/StateTransition.ts:53


path

path: Field

Defined in

packages/protocol/src/model/StateTransition.ts:52


toValue

toValue: Option<Field> | Option<Value>

Defined in

packages/protocol/src/model/StateTransition.ts:54

Accessors

from

Get Signature

get from(): Option<Value>

Returns

Option<Value>

Defined in

packages/protocol/src/model/StateTransition.ts:57


to

Get Signature

get to(): Option<Field> | Option<Value>

Returns

Option<Field> | Option<Value>

Defined in

packages/protocol/src/model/StateTransition.ts:63

Methods

toConstant()

toConstant(): StateTransition<Value>

Returns

StateTransition<Value>

Defined in

packages/protocol/src/model/StateTransition.ts:87


toJSON()

toJSON(): object

Returns

object

from

from: object

from.isForcedSome

from.isForcedSome: boolean

from.isSome

from.isSome: boolean

from.value

from.value: string[]

path

path: string

to

to: object

to.isForcedSome

to.isForcedSome: boolean

to.isSome

to.isSome: boolean

to.value

to.value: string[]

Defined in

packages/protocol/src/model/StateTransition.ts:79


toProvable()

toProvable(): ProvableStateTransition

Converts a StateTransition to a ProvableStateTransition, while enforcing the β€˜from’ property to be β€˜Some’ in all cases.

Returns

ProvableStateTransition

Defined in

packages/protocol/src/model/StateTransition.ts:71


from()

static from<Value>(path, fromValue): StateTransition<Value>

Type Parameters

β€’ Value

Parameters

β€’ path: Field

β€’ fromValue: Option<Value>

Returns

StateTransition<Value>

Defined in

packages/protocol/src/model/StateTransition.ts:39


fromTo()

static fromTo<Value>(path, fromValue, toValue): StateTransition<Value>

Type Parameters

β€’ Value

Parameters

β€’ path: Field

β€’ fromValue: Option<Value>

β€’ toValue: Option<Value>

Returns

StateTransition<Value>

Defined in

packages/protocol/src/model/StateTransition.ts:43