QueryContext
@midnight-ntwrk/compact-runtime v0.9.0
@midnight-ntwrk/compact-runtime / QueryContext
Class: QueryContext
Provides the information needed to fully process a transaction, including information about the rest of the transaction, and the state of the chain at the time of execution.
Constructorsβ
Constructorβ
new QueryContext(state, address): QueryContext;
Construct a basic context from a contract's address and current state value
Parametersβ
stateβ
addressβ
string
Returnsβ
QueryContext
Propertiesβ
addressβ
readonly address: string;
The address of the contract
blockβ
block: BlockContext;
The block-level information accessible to the contract
comIndiciesβ
readonly comIndicies: Map<string, bigint>;
The commitment indices map accessible to the contract, primarily via qualify
effectsβ
effects: Effects;
The effects that occurred during execution against this context, should match those declared in a Transcript
stateβ
readonly state: StateValue;
The current contract state retained in the context
Methodsβ
insertCommitment()β
insertCommitment(comm, index): QueryContext;
Register a given coin commitment as being accessible at a specific index, for use when receiving coins in-contract, and needing to record their index to later spend them
Parametersβ
commβ
string
indexβ
bigint
Returnsβ
QueryContext
intoTranscript()β
intoTranscript(program, cost_model): [
| undefined
| Transcript<AlignedValue>,
| undefined
| Transcript<AlignedValue>];
Finalizes a sequence of operations against their initial context, resulting in a guaranteed and fallible Transcript, optimally allocated, and heuristically covered for gas fees.
Parametersβ
programβ
Op<AlignedValue>[]
cost_modelβ
Returnsβ
[
| undefined
| Transcript<AlignedValue>,
| undefined
| Transcript<AlignedValue>]
Deprecatedβ
Please use the ledger's partitionTranscripts instead.
qualify()β
qualify(coin): undefined | Value;
Internal
Internal counterpart to insertCommitment; upgrades an encoded CoinInfo to an encoded QualifiedCoinInfo using the inserted commitments
Parametersβ
coinβ
Returnsβ
undefined | Value
query()β
query(
ops,
cost_model,
gas_limit?): QueryResults;
Runs a sequence of operations in gather mode, returning the results of the gather.
Parametersβ
opsβ
Op<null>[]
cost_modelβ
gas_limit?β
bigint
Returnsβ
runTranscript()β
runTranscript(transcript, cost_model): QueryContext;
Runs a transcript in verifying mode against the current query context, outputting a new query context, with the state and effects from after the execution.
Parametersβ
transcriptβ
Transcript<AlignedValue>
cost_modelβ
Returnsβ
QueryContext
toString()β
toString(compact?): string;
Parametersβ
compact?β
boolean
Returnsβ
string