ZswapChainState
For the complete documentation index, see llms.txt
@midnight/zswap / ZswapChainState
Class: ZswapChainState
The on-chain state of Zswap, consisting of a Merkle tree of coin commitments, a set of nullifiers, an index into the Merkle tree, and a set of valid past Merkle tree roots
Constructors
new ZswapChainState()
new ZswapChainState(): ZswapChainState
Returns
Properties
firstFree
readonly firstFree: bigint;
코인 커밋먼트 트리의 첫 번째 빈 인덱스입니다.
Methods
serialize()
serialize(netid): Uint8Array<ArrayBufferLike>
Parameters
netid
Returns
Uint8Array<ArrayBufferLike>
toString()
toString(compact?): string
Parameters
compact?
boolean
Returns
string
tryApply()
tryApply(offer, whitelist?): [ZswapChainState, Map<string, bigint>]
Offer를 상태에 적용하고, 업데이트된 상태를 반환합니다. and a map on newly inserted coin commitments to their inserted indices.
Parameters
offer
whitelist?
Set<string>
A set of contract addresses that are of interest. If set, only these addresses are tracked, and all other information is discarded.
Returns
[ZswapChainState, Map<string, bigint>]
tryApplyProofErased()
tryApplyProofErased(offer, whitelist?): [ZswapChainState, Map<string, bigint>]
tryApply for ProofErasedOffers
Parameters
offer
whitelist?
Set<string>
Returns
[ZswapChainState, Map<string, bigint>]
deserialize()
static deserialize(raw, netid): ZswapChainState
Parameters
raw
Uint8Array<ArrayBufferLike>
netid
Returns
deserializeFromLedgerState()
static deserializeFromLedgerState(raw, netid): ZswapChainState
전체 원장 직렬화 상태가 주어지면 Zswap 부분만 역직렬화합니다.
Parameters
raw
Uint8Array<ArrayBufferLike>