method
function method<K, T>(
target: T & { [k in string]: (args: any) => Promise<void> },
methodName: K & string & keyof T,
descriptor: PropertyDescriptor,
returnType?: Provable<any>): void
Defined in: lib/mina/v1/zkapp.ts:98
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]: (args: any) => Promise<void> }
methodName
K
& string
& keyof T
descriptor
PropertyDescriptor
returnType?
Provable
<any
>
Returns
void