Skip to main content

method

function method<K, T>(
target: T & { [k in string]: Function },
methodName: K & string & keyof T,
descriptor: PropertyDescriptor,
returnType?: Provable<any>): void

A decorator to use in a zkApp to mark a method as provable. You can use inside your zkApp class as:

\@method async myMethod(someArg: Field) {
// your code here
}

To return a value from the method, you have to explicitly declare the return type using the method.returns decorator:

\@method.returns(Field)
async myMethod(someArg: Field): Promise<Field> {
// your code here
}

Type parameters

K extends string

T extends SmartContract

Parameters

target: T & { [k in string]: Function }

methodName: K & string & keyof T

descriptor: PropertyDescriptor

returnType?: Provable\<any>

Returns

void

Source

lib/mina/zkapp.ts:105