Skip to main content
Version: 2.15.0

state

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

Defined in: lib/mina/v1/state.ts:100

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​

A

Parameters​

type​

| ProvableTypePure<A> | FlexibleProvablePure<A>

Returns​

(target: SmartContract & { constructor: any; }, key: string, _descriptor?: PropertyDescriptor) => void