LedgerState
@midnight-ntwrk/ledger v3.0.2 β’ Readme | API
@midnight-ntwrk/ledger v3.0.2 / LedgerState
Class: LedgerState
The state of the Midnight ledger
Constructorsβ
new LedgerState(zswap)β
new LedgerState(zswap): LedgerState
Initializes from a Zswap state, with an empty contract set
Parametersβ
β’ zswap: ZswapChainState
Returnsβ
Propertiesβ
unmintedNativeTokenSupplyβ
readonly unmintedNativeTokenSupply: bigint;
The remaining unminted supply of native tokens.
zswapβ
readonly zswap: ZswapChainState;
The Zswap part of the ledger state
Methodsβ
apply()β
apply(transaction, context): [LedgerState, TransactionResult]
Applies a ProofErasedTransaction
Parametersβ
β’ transaction: ProofErasedTransaction
β’ context: TransactionContext
Returnsβ
[LedgerState, TransactionResult]
applySystemTx()β
applySystemTx(transaction): LedgerState
Applies a system transaction to this ledger state.
Parametersβ
β’ transaction: SystemTransaction
Returnsβ
index()β
index(address): undefined | ContractState
Indexes into the contract state map with a given contract address
Parametersβ
β’ address: string
Returnsβ
undefined | ContractState
serialize()β
serialize(netid): Uint8Array
Parametersβ
β’ netid: NetworkId
Returnsβ
Uint8Array
toString()β
toString(compact?): string
Parametersβ
β’ compact?: boolean
Returnsβ
string
treasuryBalance()β
treasuryBalance(token_type): bigint
Retrieves the balance of the treasury for a specific token type.
Parametersβ
β’ token_type: string
Returnsβ
bigint
unclaimedMints()β
unclaimedMints(recipient, token_type): bigint
How much in minting rewards a recipient, for a specific token type, is owed and can claim.
Parametersβ
β’ recipient: string
β’ token_type: string
Returnsβ
bigint
updateIndex()β
updateIndex(address, context): LedgerState
Sets the state of a given contract address from a QueryContext
Parametersβ
β’ address: string
β’ context: QueryContext
Returnsβ
blank()β
static blank(): LedgerState
A fully blank state
Returnsβ
deserialize()β
static deserialize(raw, netid): LedgerState
Parametersβ
β’ raw: Uint8Array
β’ netid: NetworkId