Skip to main content

CircuitContextOptions

For the complete documentation index, see llms.txt

@midnight-ntwrk/compact-runtime v0.20.0


@midnight-ntwrk/compact-runtime / CircuitContextOptions

Type Alias: CircuitContextOptions<PS>

type CircuitContextOptions<PS> = {
circuitId: CircuitId;
coinPublicKeyOrZswapState: | CoinPublicKey
| EncodedCoinPublicKey
| ZswapLocalState
| EncodedZswapLocalState;
contractAddress: ContractAddress;
contractState: | ContractState
| StateValue
| ChargedState;
costModel?: CostModel;
crossContract?: CrossContractInputs;
gasLimit?: RunningCost;
parentBlockHash?: string;
privateState: PS;
time?: number;
};

The inputs to createCircuitContext.

Type Parameters​

PS​

PS = any

Properties​

circuitId​

readonly circuitId: CircuitId;

The name of the circuit being executed.


coinPublicKeyOrZswapState​

readonly coinPublicKeyOrZswapState:
| CoinPublicKey
| EncodedCoinPublicKey
| ZswapLocalState
| EncodedZswapLocalState;

The initial Zswap local state, for tracking shielded coin transfers.


contractAddress​

readonly contractAddress: ContractAddress;

The address of the contract defining the circuit being executed.


contractState​

readonly contractState:
| ContractState
| StateValue
| ChargedState;

The ledger state to execute against — most often a snapshot fetched from the chain.


costModel?​

readonly optional costModel: CostModel;

The model capturing how much ledger operations cost.


crossContract?​

readonly optional crossContract: CrossContractInputs;

Present exactly when this execution may make cross-contract calls.


gasLimit?​

readonly optional gasLimit: RunningCost;

The maximum gas this contract should consume.


parentBlockHash?​

readonly optional parentBlockHash: string;

The hash of the block this transaction is built on. Reaches the VM's block context, and pins the block a cross-contract callee's state is fetched at.


privateState​

readonly privateState: PS;

The witness / private state — most often a snapshot from local storage.


time?​

readonly optional time: number;

The current time, for the block-time kernel operations. Defaults to now.