Skip to main content

state-1

function state<A>(stateType: FlexibleProvablePure<A>): (target: SmartContract & {
"constructor": any;
}, key: string, _descriptor?: PropertyDescriptor) => void

A decorator to use within a zkapp to indicate what will be stored on-chain. For example, if you want to store a field element some_state in a zkapp, you can use the following in the declaration of your zkapp:

@state(Field) some_state = State<Field>();

Type parameters

A

Parameters

stateType: FlexibleProvablePure\<A>

Returns

Function

Parameters

target: SmartContract & { "constructor": any; }

key: string

_descriptor?: PropertyDescriptor

Returns

void

Source

lib/mina/state.ts:87