Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SmartContract

The main zkapp class. To write a zkapp, extend this class as such:

class YourSmartContract extends SmartContract {
// your smart contract code here
}

Hierarchy

  • SmartContract

Index

Constructors

Properties

_executionState: undefined | ExecutionState
address: Types.PublicKey
events: {} = {}

Type declaration

_maxProofsVerified?: 0 | 2 | 1
_methodMetadata: Record<string, { digest: string; hasReturn: boolean; rows: number; sequenceEvents: number }> = {}
_methods?: MethodInterface[]
_provers?: Prover[]
_verificationKey?: { data: string; hash: Field }

Type declaration

Accessors

  • get account(): PreconditionClassType<AccountPrecondition>
  • get balance(): { addInPlace: any; subInPlace: any }
  • get experimental(): { get token(): { id: Field; parentTokenId: Field; tokenOwner: Types.PublicKey; burn: any; mint: any; send: any } }
  • get network(): PreconditionClassType<{ blockchainLength: { isSome: Bool; value: { lower: UInt32; upper: UInt32 } }; globalSlotSinceGenesis: { isSome: Bool; value: { lower: UInt32; upper: UInt32 } }; globalSlotSinceHardFork: { 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 } }; timestamp: { isSome: Bool; value: { lower: UInt64; upper: UInt64 } }; totalCurrency: { isSome: Bool; value: { lower: UInt64; upper: UInt64 } } }>
  • get tokenSymbol(): { set: any }
  • get Proof(): typeof __class

Methods

  • deploy(__namedParameters: { verificationKey?: { data: string; hash: string | Field }; zkappKey?: PrivateKey }): void
  • Parameters

    • __namedParameters: { verificationKey?: { data: string; hash: string | Field }; zkappKey?: PrivateKey }
      • Optional verificationKey?: { data: string; hash: string | Field }
        • data: string
        • hash: string | Field
      • Optional zkappKey?: PrivateKey

    Returns void

  • emitEvent<K>(type: K, event: any): void
  • Type parameters

    • K: string | number

    Parameters

    • type: K
    • event: any

    Returns void

  • executionState(): ExecutionState
  • send(args: Omit<SendParams, "from">): void
  • setValue<T>(maybeValue: SetOrKeep<T>, value: T): void
  • Type parameters

    • T

    Parameters

    • maybeValue: SetOrKeep<T>
    • value: T

    Returns void

  • sign(zkappKey?: PrivateKey, fallbackToZeroNonce?: boolean): void
  • analyzeMethods(address: Types.PublicKey): Record<string, { digest: string; hasReturn: boolean; rows: number; sequenceEvents: number }>
  • Parameters

    Returns Record<string, { digest: string; hasReturn: boolean; rows: number; sequenceEvents: number }>

  • compile(address: Types.PublicKey): Promise<{ provers: Prover[]; verificationKey: { data: string; hash: string }; verify: (publicInput: PublicInput, proof: unknown) => Promise<boolean> }>
  • Parameters

    Returns Promise<{ provers: Prover[]; verificationKey: { data: string; hash: string }; verify: (publicInput: PublicInput, proof: unknown) => Promise<boolean> }>

  • runOutsideCircuit(run: () => void): void
  • Parameters

    • run: () => void
        • (): void
        • Returns void

    Returns void

Generated using TypeDoc