QueryContext
For the complete documentation index, see llms.txt
@midnight-ntwrk/compact-runtime v0.16.0
@midnight-ntwrk/compact-runtime / QueryContext
Class: QueryContext
트랜잭션을 완전히 처리하는 데 필요한 정보를 제공하며, 나머지 트랜잭션에 대한 정보와 실행 시점의 체인 상태를 포함합니다.
Constructors
Constructor
new QueryContext(state, address): QueryContext;
컨트랙트의 주소와 현재 상태 값으로 기본 컨텍스트를 생성합니다
Parameters
state
address
string
Returns
QueryContext
Properties
address
readonly address: string;
컨트랙트의 주소
block
block: CallContext;
컨트랙트가 접근할 수 있는 블록 수준 정보
comIndices
readonly comIndices: Map<string, bigint>;
컨트랙트가 접근할 수 있는 커밋먼트 인덱스 맵으로, 주로 qualify를 통해 사용합니다
effects
effects: Effects;
이 컨텍스트에 대한 실행 중 발생한 효과로, Transcript에 선언된 것과 일치해야 합니다
state
readonly state: ChargedState;
컨텍스트에 보유된 현재 컨트랙트 상태
Methods
insertCommitment()
insertCommitment(comm, index): QueryContext;
주어진 코인 커밋먼트를 특정 인덱스에서 접근 가능하도록 등록합니다. 컨트랙트 내에서 코인을 수신할 때 나중에 사용하기 위해 인덱스를 기록하는 용도입니다
Parameters
comm
string
index
bigint
Returns
QueryContext
qualify()
qualify(coin): Value | undefined;
Internal
insertCommitment의 내부 대응 함수로, 삽입된 커밋먼트를 사용하여 인코딩된 ShieldedCoinInfo를 인코딩된 QualifiedShieldedCoinInfo로 업그레이드합니다
Parameters
coin
Returns
Value | undefined
query()
query(
ops,
cost_model,
gas_limit?): QueryResults;
수집 모드에서 일련의 연산을 실행하고 수집 결과를 반환합니다.
Parameters
ops
Op<null>[]
cost_model
gas_limit?
Returns
runTranscript()
runTranscript(transcript, cost_model): QueryContext;
현재 쿼리 컨텍스트에 대해 검증 모드로 트랜스크립트를 실행하고, 실행 후의 state와 effects가 포함된 새 쿼리 컨텍스트를 출력합니다.
Parameters
transcript
cost_model
Returns
QueryContext
toString()
toString(compact?): string;
Parameters
compact?
boolean
Returns
string
toVmStack()
toVmStack(): VmStack;
QueryContext를 VmStack으로 변환합니다.