SnarkyJS
Table of contents
References
Namespaces
Classes
- AccountUpdate
- Bool
- Character
- Circuit
- CircuitString
- CircuitValue
- Field
- Group
- Int64
- Keypair
- Ledger
- MerkleMap
- MerkleMapWitness
- MerkleTree
- PrivateKey
- Proof
- Scalar
- SelfProof
- Sign
- Signature
- SmartContract
- Token
- TokenSymbol
- UInt32
- UInt64
- VerificationKey
Interfaces
Type Aliases
- DeployArgs
- Empty
- FlexibleProvable
- FlexibleProvablePure
- InferProvable
- JsonProof
- ProvableExtended
- Reducer
- State
- Struct
- TransactionStatus
- Undefined
- Void
- ZkappPublicInput
Variables
Functions
- Account
- MerkleWitness
- Reducer
- State
- Struct
- addCachedAccount
- arrayProp
- checkZkappTransaction
- circuitMain
- declareMethods
- declareState
- fetchAccount
- fetchEvents
- fetchLastBlock
- fetchTransactionStatus
- matrixProp
- method
- prop
- provable
- provablePure
- public_
- sendZkapp
- setArchiveGraphqlEndpoint
- setGraphqlEndpoint
- setGraphqlEndpoints
- shutdown
- signFeePayer
- state
- verify
References
PublicKey
Re-exports PublicKey
Type Aliases
DeployArgs
Ƭ DeployArgs: { verificationKey?
: { data
: string
; hash
: string
| Field
} ; zkappKey?
: PrivateKey
} | undefined
Defined in
Empty
Ƭ Empty: Undefined
Defined in
FlexibleProvable
Ƭ FlexibleProvable<T
>: Provable
<T
> | Struct
<T
>
Type parameters
Name |
---|
T |
Defined in
FlexibleProvablePure
Ƭ FlexibleProvablePure<T
>: ProvablePure
<T
> | StructPure
<T
>
Type parameters
Name |
---|
T |
Defined in
InferProvable
Ƭ InferProvable<A
>: A
extends Constructor
<infer U> ? A
extends Provable
<U
> ? U
: A
extends Struct
<U
> ? U
: InferProvableBase
<A
> : InferProvableBase
<A
>
Type parameters
Name |
---|
A |
Defined in
bindings/lib/provable-snarky.ts:277
JsonProof
Ƭ JsonProof: Object
Type declaration
Name | Type |
---|---|
maxProofsVerified | 0 | 1 | 2 |
proof | string |
publicInput | string [] |
publicOutput | string [] |
Defined in
ProvableExtended
Ƭ ProvableExtended<T
, TJson
>: Provable
<T
> & ProvableExtension
<T
, TJson
>
Type parameters
Name | Type |
---|---|
T | T |
TJson | any |
Defined in
Reducer
Ƭ Reducer<Action
>: Object
Type parameters
Name |
---|
Action |
Type declaration
Name | Type |
---|---|
actionType | FlexibleProvablePure <Action > |
Defined in
State
Ƭ State<A
>: Object
Gettable and settable state that can be checked for equality.
Type parameters
Name |
---|
A |
Type declaration
Name | Type |
---|---|
assertEquals | (a : A ) => void |
assertNothing | () => void |
fetch | () => Promise <undefined | A > |
fromAppState | (appState : Field []) => A |
get | () => A |
getAndAssertEquals | () => A |
set | (a : A ) => void |
Defined in
Struct
Ƭ Struct<T
>: ProvableExtended
<NonMethods
<T
>> & Constructor
<T
> & { _isStruct
: true
}
Type parameters
Name |
---|
T |
Defined in
TransactionStatus
Ƭ TransactionStatus: "INCLUDED"
| "PENDING"
| "UNKNOWN"
INCLUDED: A transaction that is on the longest chain
PENDING: A transaction either in the transition frontier or in transaction pool but is not on the longest chain
UNKNOWN: The transaction has either been snarked, reached finality through consensus or has been dropped
Defined in
Undefined
Ƭ Undefined: undefined
Defined in
Void
Ƭ Void: undefined
Defined in
ZkappPublicInput
Ƭ ZkappPublicInput: Object
The public input for zkApps consists of certain hashes of the proving AccountUpdate (and its child accountUpdates) which is constructed during method execution.
For SmartContract proving, a method is run twice: First outside the proof, to obtain the public input, and once in the prover, which takes the public input as input. The current transaction is hashed again inside the prover, which asserts that the result equals the input public input, as part of the snark circuit. The block producer will also hash the transaction they receive and pass it as a public input to the verifier. Thus, the transaction is fully constrained by the proof - the proof couldn't be used to attest to a different transaction.
Type declaration
Name | Type |
---|---|
accountUpdate | Field |
calls | Field |
Defined in
Variables
Empty
• Empty: ProvablePureExtended
<undefined
, null
>
Defined in
Permissions
• Permissions: Object
Type declaration
Name | Type |
---|---|
allImpossible | () => Permissions |
default | () => Permissions |
dummy | () => Permissions |
fromJSON | (permissions : { access : AuthRequired ; editActionState : AuthRequired ; editState : AuthRequired ; incrementNonce : AuthRequired ; receive : AuthRequired ; send : AuthRequired ; setDelegate : AuthRequired ; setPermissions : AuthRequired ; setTiming : AuthRequired ; setTokenSymbol : AuthRequired ; setVerificationKey : AuthRequired ; setVotingFor : AuthRequired ; setZkappUri : AuthRequired }) => Permissions |
fromString | (permission : AuthRequired ) => AuthRequired |
impossible | () => AuthRequired |
initial | () => Permissions |
none | () => AuthRequired |
proof | () => AuthRequired |
proofOrSignature | () => AuthRequired |
signature | () => AuthRequired |
Defined in
Poseidon
• Const
Poseidon: Object
Type declaration
Name | Type |
---|---|
Sponge | typeof Sponge |
hash | (input : Field []) => Field |
hashToGroup | (input : Field []) => { x : Field ; y : { x0 : Field ; x1 : Field } } |
initialState | () => [Field , Field , Field ] |
update | (state : [Field , Field , Field ], input : Field []) => [Field , Field , Field ] |
Defined in
TokenId
• Const
TokenId: Object
Type declaration
Name | Type |
---|---|
check | (x : Field ) => void |
default | Field |
fromFields | (x : Field [], aux : any []) => Field |
toAuxiliary | (x? : Field ) => any [] |
toFields | (x : Field ) => Field [] |
toInput | (x : Field ) => { fields? : Field [] ; packed? : [Field , number ][] } |
derive | (tokenOwner : PublicKey , parentTokenId : Field ) => Field |
emptyValue | () => Field |
fromBase58 | (base58 : string ) => Field |
fromJSON | (x : string ) => Field |
sizeInFields | () => number |
toBase58 | (t : Field ) => string |
toJSON | (x : Field ) => string |
Defined in
Undefined
• Undefined: ProvablePureExtended
<undefined
, null
>
Defined in
Void
• Void: ProvablePureExtended
<void
, null
>
Defined in
ZkappPublicInput
• ZkappPublicInput: ProvablePure
<{ accountUpdate
: Field
= Field; calls
: Field
= Field }> & ProvableExtension
<{ accountUpdate
: Field
= Field; calls
: Field
= Field }, { accountUpdate
: string
= Field; calls
: string
= Field }>
Defined in
isReady
• isReady: Promise
<undefined
>
Deprecated
await isReady
is no longer needed. Remove it from your code.
Defined in
Functions
Account
▸ Account(address
, tokenId?
): Account
Parameters
Name | Type |
---|---|
address | PublicKey |
tokenId? | Field |
Returns
Account
Defined in
MerkleWitness
▸ MerkleWitness(height
): typeof BaseMerkleWitness
Returns a circuit-compatible Witness for a specific Tree height.
Parameters
Name | Type | Description |
---|---|---|
height | number | Height of the Merkle Tree that this Witness belongs to. |
Returns
typeof BaseMerkleWitness
A circuit-compatible Merkle Witness.
Defined in
Reducer
▸ Reducer<T
, A
>(reducer
): ReducerReturn
<A
>
Type parameters
Name | Type |
---|---|
T | extends FlexibleProvablePure <any > |
A | extends any = InferProvable <T > |
Parameters
Name | Type |
---|---|
reducer | Object |
reducer.actionType | T |
Returns
ReducerReturn
<A
>
Defined in
State
▸ State<A
>(): State
<A
>
Type parameters
Name |
---|
A |
Returns
State
<A
>
Defined in
Struct
▸ Struct<A
, T
, J
, Pure
>(type
, options?
): (value
: T
) => T
& { _isStruct
: true
} & Pure
extends true
? ProvablePure
<T
> : Provable
<T
> & { fromJSON
: (x
: J
) => T
; toInput
: (x
: T
) => { fields?
: Field
[] ; packed?
: [Field
, number
][] } ; toJSON
: (x
: T
) => J
}
Struct
lets you declare composite types for use in snarkyjs circuits.
These composite types can be passed in as arguments to smart contract methods, used for on-chain state variables or as event / action types.
Here's an example of creating a "Voter" struct, which holds a public key and a collection of votes on 3 different proposals:
let Vote = { hasVoted: Bool, inFavor: Bool };
class Voter extends Struct({
publicKey: PublicKey,
votes: [Vote, Vote, Vote]
}) {}
// use Voter as SmartContract input:
class VoterContract extends SmartContract {
\@method register(voter: Voter) {
// ...
}
}
In this example, there are no instance methods on the class. This makes Voter
type-compatible with an anonymous object of the form
{ publicKey: PublicKey, votes: Vote[] }
.
This mean you don't have to create instances by using new Voter(...)
, you can operate with plain objects:
voterContract.register({ publicKey, votes });
On the other hand, you can also add your own methods:
class Voter extends Struct({
publicKey: PublicKey,
votes: [Vote, Vote, Vote]
}) {
vote(index: number, inFavor: Bool) {
let vote = this.votes[i];
vote.hasVoted = Bool(true);
vote.inFavor = inFavor;
}
}
In this case, you'll need the constructor to create instances of Voter
. It always takes as input the plain object:
let emptyVote = { hasVoted: Bool(false), inFavor: Bool(false) };
let voter = new Voter({ publicKey, votes: Array(3).fill(emptyVote) });
voter.vote(1, Bool(true));
In addition to creating types composed of Field elements, you can also include auxiliary data which does not become part of the proof. This, for example, allows you to re-use the same type outside snarkyjs methods, where you might want to store additional metadata.
To declare non-proof values of type string
, number
, etc, you can use the built-in objects String
, Number
, etc.
Here's how we could add the voter's name (a string) as auxiliary data:
class Voter extends Struct({
publicKey: PublicKey,
votes: [Vote, Vote, Vote],
fullName: String
}) {}
Again, it's important to note that this doesn't enable you to prove anything about the fullName
string.
From the circuit point of view, it simply doesn't exist!
Type parameters
Name | Type |
---|---|
A | A |
T | extends unknown = InferProvable <A > |
J | extends unknown = InferJson <A > |
Pure | extends boolean = IsPure <A > |
Parameters
Name | Type | Description |
---|---|---|
type | A | Object specifying the layout of the Struct |
options | Object | Advanced option which allows you to force a certain order of object keys |
options.customObjectKeys? | string [] | - |
Returns
(value
: T
) => T
& { _isStruct
: true
} & Pure
extends true
? ProvablePure
<T
> : Provable
<T
> & { fromJSON
: (x
: J
) => T
; toInput
: (x
: T
) => { fields?
: Field
[] ; packed?
: [Field
, number
][] } ; toJSON
: (x
: T
) => J
}
Class which you can extend
Defined in
addCachedAccount
▸ addCachedAccount(partialAccount
, graphqlEndpoint?
): void
Adds an account to the local cache, indexed by a GraphQL endpoint.
Parameters
Name | Type | Default value |
---|---|---|
partialAccount | PartialAccount | undefined |
graphqlEndpoint | string | networkConfig.minaEndpoint |
Returns
void
Defined in
arrayProp
▸ arrayProp<T
>(elementType
, length
): (target
: any
, key
: string
) => void
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
elementType | FlexibleProvable <T > |
length | number |
Returns
fn
▸ (target
, key
): void
Parameters
Name | Type |
---|---|
target | any |
key | string |
Returns
void
Defined in
checkZkappTransaction
▸ checkZkappTransaction(txnId
): Promise
<{ failureReason
: string
[] ; success
: boolean
= false } | { failureReason
: null
= null; success
: boolean
= true }>
Parameters
Name | Type |
---|---|
txnId | string |
Returns
Promise
<{ failureReason
: string
[] ; success
: boolean
= false } | { failureReason
: null
= null; success
: boolean
= true }>
Defined in
circuitMain
▸ circuitMain(target
, propertyName
, _descriptor?
): any
Parameters
Name | Type |
---|---|
target | any |
propertyName | string |
_descriptor? | PropertyDescriptor |
Returns
any
Defined in
declareMethods
▸ declareMethods<T
>(SmartContract
, methodArguments
): void
declareMethods
can be used in place of the @method
decorator
to declare SmartContract methods along with their list of arguments.
It should be placed after the class declaration.
Here is an example of declaring a method update
, which takes a single argument of type Field
:
class MyContract extends SmartContract {
// ...
update(x: Field) {
// ...
}
}
declareMethods(MyContract, { update: [Field] }); // `[Field]` is the list of arguments!
Note that a method of the same name must still be defined on the class, just without the decorator.
Type parameters
Name | Type |
---|---|
T | extends typeof SmartContract |
Parameters
Name | Type |
---|---|
SmartContract | T |
methodArguments | Record <string , Provable <unknown >[]> |
Returns
void
Defined in
declareState
▸ declareState<T
>(SmartContract
, states
): void
declareState
can be used in place of the @state
decorator to declare on-chain state on a SmartContract.
It should be placed after the class declaration.
Here is an example of declaring a state property x
of type Field
.
class MyContract extends SmartContract {
x = State<Field>();
// ...
}
declareState(MyContract, { x: Field });
If you're using pure JS, it's not possible to use the built-in class field syntax, i.e. the following will not work:
// THIS IS WRONG IN JS!
class MyContract extends SmartContract {
x = State();
}
declareState(MyContract, { x: Field });
Instead, add a constructor where you assign the property:
class MyContract extends SmartContract {
constructor(x) {
super();
this.x = State();
}
}
declareState(MyContract, { x: Field });
Type parameters
Name | Type |
---|---|
T | extends typeof SmartContract |
Parameters
Name | Type |
---|---|
SmartContract | T |
states | Record <string , FlexibleProvablePure <unknown >> |
Returns
void
Defined in
fetchAccount
▸ fetchAccount(accountInfo
, graphqlEndpoint?
, «destructured»?
): Promise
<{ account
: Account
; error
: undefined
} | { account
: undefined
; error
: FetchError
}>
Gets account information on the specified publicKey by performing a GraphQL query to the specified endpoint. This will call the 'GetAccountInfo' query which fetches zkapp related account information.
If an error is returned by the specified endpoint, an error is thrown. Otherwise, the data is returned.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
accountInfo | Object | undefined | - |
accountInfo.publicKey | string | PublicKey | undefined | - |
accountInfo.tokenId? | string | Field | undefined | - |
graphqlEndpoint | string | networkConfig.minaEndpoint | The graphql endpoint to fetch from |
«destructured» | Object | {} | - |
› timeout | undefined | number | undefined | - |
Returns
Promise
<{ account
: Account
; error
: undefined
} | { account
: undefined
; error
: FetchError
}>
zkapp information on the specified account or an error is thrown
Defined in
fetchEvents
▸ fetchEvents(accountInfo
, graphqlEndpoint?
, filterOptions?
): Promise
<{ blockHash
: string
= event.blockInfo.stateHash; blockHeight
: UInt32
; chainStatus
: string
= event.blockInfo.chainStatus; events
: { data
: string
[] ; transactionInfo
: { hash
: string
; memo
: string
; status
: string
} }[] ; globalSlot
: UInt32
; parentBlockHash
: string
= event.blockInfo.parentHash }[]>
Asynchronously fetches event data for an account from the Mina Archive Node GraphQL API.
Async
Throws
If the GraphQL request fails or the response is invalid.
Example
const accountInfo = { publicKey: 'B62qiwmXrWn7Cok5VhhB3KvCwyZ7NHHstFGbiU5n7m8s2RqqNW1p1wF' };
const events = await fetchEvents(accountInfo);
console.log(events);
Parameters
Name | Type | Default value | Description |
---|---|---|---|
accountInfo | Object | undefined | The account information object. |
accountInfo.publicKey | string | undefined | The account public key. |
accountInfo.tokenId? | string | undefined | The optional token ID for the account. |
graphqlEndpoint? | string | networkConfig.archiveEndpoint | The GraphQL endpoint to query. Defaults to the Archive Node GraphQL API. |
filterOptions? | EventActionFilterOptions | {} | The optional filter options object. |
Returns
Promise
<{ blockHash
: string
= event.blockInfo.stateHash; blockHeight
: UInt32
; chainStatus
: string
= event.blockInfo.chainStatus; events
: { data
: string
[] ; transactionInfo
: { hash
: string
; memo
: string
; status
: string
} }[] ; globalSlot
: UInt32
; parentBlockHash
: string
= event.blockInfo.parentHash }[]>
A promise that resolves to an array of objects containing event data, block information and transaction information for the account.
Defined in
fetchLastBlock
▸ fetchLastBlock(graphqlEndpoint?
): Promise
<PreconditionBaseTypes
<{ blockchainLength
: { isSome
: Bool
; value
: { lower
: UInt32
; upper
: UInt32
} } ; globalSlotSinceGenesis
: { isSome
: Bool
; value
: { lower
: UInt32
; upper
: UInt32
} } ; minWindowDensity
: { isSome
: Bool
; value
: { lower
: UInt32
; upper
: UInt32
} } ; nextEpochData
: { epochLength
: { isSome
: Bool
; value
: { lower
: UInt32
; upper
: UInt32
} } ; ledger
: { hash
: { isSome
: Bool
; value
: Field
} ; totalCurrency
: { isSome
: Bool
; value
: { lower
: UInt64
; upper
: UInt64
} } } ; lockCheckpoint
: { isSome
: Bool
; value
: Field
} ; seed
: { isSome
: Bool
; value
: Field
} ; startCheckpoint
: { isSome
: Bool
; value
: Field
} } ; snarkedLedgerHash
: { isSome
: Bool
; value
: Field
} ; stakingEpochData
: { epochLength
: { isSome
: Bool
; value
: { lower
: UInt32
; upper
: UInt32
} } ; ledger
: { hash
: { isSome
: Bool
; value
: Field
} ; totalCurrency
: { isSome
: Bool
; value
: { lower
: UInt64
; upper
: UInt64
} } } ; lockCheckpoint
: { isSome
: Bool
; value
: Field
} ; seed
: { isSome
: Bool
; value
: Field
} ; startCheckpoint
: { isSome
: Bool
; value
: Field
} } ; totalCurrency
: { isSome
: Bool
; value
: { lower
: UInt64
; upper
: UInt64
} } }>>
Fetches the last block on the Mina network.
Parameters
Name | Type | Default value |
---|---|---|
graphqlEndpoint | string | networkConfig.minaEndpoint |
Returns
Promise
<PreconditionBaseTypes
<{ blockchainLength
: { isSome
: Bool
; value
: { lower
: UInt32
; upper
: UInt32
} } ; globalSlotSinceGenesis
: { isSome
: Bool
; value
: { lower
: UInt32
; upper
: UInt32
} } ; minWindowDensity
: { isSome
: Bool
; value
: { lower
: UInt32
; upper
: UInt32
} } ; nextEpochData
: { epochLength
: { isSome
: Bool
; value
: { lower
: UInt32
; upper
: UInt32
} } ; ledger
: { hash
: { isSome
: Bool
; value
: Field
} ; totalCurrency
: { isSome
: Bool
; value
: { lower
: UInt64
; upper
: UInt64
} } } ; lockCheckpoint
: { isSome
: Bool
; value
: Field
} ; seed
: { isSome
: Bool
; value
: Field
} ; startCheckpoint
: { isSome
: Bool
; value
: Field
} } ; snarkedLedgerHash
: { isSome
: Bool
; value
: Field
} ; stakingEpochData
: { epochLength
: { isSome
: Bool
; value
: { lower
: UInt32
; upper
: UInt32
} } ; ledger
: { hash
: { isSome
: Bool
; value
: Field
} ; totalCurrency
: { isSome
: Bool
; value
: { lower
: UInt64
; upper
: UInt64
} } } ; lockCheckpoint
: { isSome
: Bool
; value
: Field
} ; seed
: { isSome
: Bool
; value
: Field
} ; startCheckpoint
: { isSome
: Bool
; value
: Field
} } ; totalCurrency
: { isSome
: Bool
; value
: { lower
: UInt64
; upper
: UInt64
} } }>>
Defined in
fetchTransactionStatus
▸ fetchTransactionStatus(txId
, graphqlEndpoint?
): Promise
<TransactionStatus
>
Fetches the status of a transaction.
Parameters
Name | Type | Default value |
---|---|---|
txId | string | undefined |
graphqlEndpoint | string | networkConfig.minaEndpoint |
Returns
Promise
<TransactionStatus
>
Defined in
matrixProp
▸ matrixProp<T
>(elementType
, nRows
, nColumns
): (target
: any
, key
: string
) => void
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
elementType | FlexibleProvable <T > |
nRows | number |
nColumns | number |
Returns
fn
▸ (target
, key
): void
Parameters
Name | Type |
---|---|
target | any |
key | string |
Returns
void
Defined in
method
▸ method<T
>(target
, methodName
, descriptor
): void
A decorator to use in a zkApp to mark a method as callable by anyone. You can use inside your zkApp class as:
\@method myMethod(someArg: Field) {
// your code here
}
Type parameters
Name | Type |
---|---|
T | extends SmartContract <T > |
Parameters
Name | Type |
---|---|
target | T & { constructor : any } |
methodName | keyof T & string |
descriptor | PropertyDescriptor |
Returns
void
Defined in
prop
▸ prop(this
, target
, key
): void
Parameters
Name | Type |
---|---|
this | any |
target | any |
key | string |
Returns
void
Defined in
provable
▸ provable<A
>(typeObj
, options?
): ProvableExtended
<InferProvable
<A
>, InferJson
<A
>>
Type parameters
Name |
---|
A |
Parameters
Name | Type |
---|---|
typeObj | A |
options? | Object |
options.customObjectKeys? | string [] |
options.isPure? | boolean |
Returns
ProvableExtended
<InferProvable
<A
>, InferJson
<A
>>
Defined in
bindings/lib/provable-snarky.ts:47
provablePure
▸ provablePure<A
>(typeObj
, options?
): ProvablePure
<InferProvable
<A
>> & ProvableExtension
<InferProvable
<A
>, InferJson
<A
>>
Type parameters
Name |
---|
A |
Parameters
Name | Type |
---|---|
typeObj | A |
options | Object |
options.customObjectKeys? | string [] |
Returns
ProvablePure
<InferProvable
<A
>> & ProvableExtension
<InferProvable
<A
>, InferJson
<A
>>
Defined in
bindings/lib/provable-snarky.ts:224
public_
▸ public_(target
, _key
, index
): void
Parameters
Name | Type |
---|---|
target | any |
_key | string | symbol |
index | number |
Returns
void
Defined in
sendZkapp
▸ sendZkapp(json
, graphqlEndpoint?
, «destructured»?
): Promise
<[FetchResponse
, undefined
] | [undefined
, FetchError
]>
Sends a zkApp command (transaction) to the specified GraphQL endpoint.
Parameters
Name | Type | Default value |
---|---|---|
json | string | undefined |
graphqlEndpoint | string | networkConfig.minaEndpoint |
«destructured» | Object | {} |
› timeout | undefined | number | undefined |
Returns
Promise
<[FetchResponse
, undefined
] | [undefined
, FetchError
]>
Defined in
setArchiveGraphqlEndpoint
▸ setArchiveGraphqlEndpoint(graphqlEndpoint
): void
Sets up a GraphQL endpoint to be used for fetching information from an Archive Node.
Parameters
Name | Type |
---|---|
graphqlEndpoint | string |
Returns
void
Defined in
setGraphqlEndpoint
▸ setGraphqlEndpoint(graphqlEndpoint
): void
Parameters
Name | Type |
---|---|
graphqlEndpoint | string |
Returns
void
Defined in
setGraphqlEndpoints
▸ setGraphqlEndpoints(«destructured»
): void
Parameters
Name | Type |
---|---|
«destructured» | string [] |
Returns
void
Defined in
shutdown
▸ shutdown(): Promise
<undefined
>
Deprecated
shutdown()
is no longer needed, and is a no-op. Remove it from your code.
Returns
Promise
<undefined
>
Defined in
signFeePayer
▸ signFeePayer(transactionJson
, feePayerKey
, «destructured»
): string
Parameters
Name | Type |
---|---|
transactionJson | string |
feePayerKey | string | PrivateKey |
«destructured» | Object |
Returns
string
Defined in
state
▸ state<A
>(stateType
): (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
Name |
---|
A |
Parameters
Name | Type |
---|---|
stateType | FlexibleProvablePure <A > |
Returns
fn
▸ (target
, key
, _descriptor?
): void
Parameters
Name | Type |
---|---|
target | SmartContract & { constructor : any } |
key | string |
_descriptor? | PropertyDescriptor |
Returns
void
Defined in
verify
▸ verify(proof
, verificationKey
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
proof | JsonProof | Proof <any , any > |
verificationKey | string |
Returns
Promise
<boolean
>