ContractState
@midnight-ntwrk/onchain-runtime v0.2.2 β’ Readme | API
@midnight-ntwrk/onchain-runtime v0.2.2 / ContractState
Class: ContractState
The state of a contract, consisting primarily of the data accessible directly to the contract, and the map of ContractOperations that can be called on it, the keys of which can be accessed with operations, and the individual operations can be read with operation and written to with setOperation.
Constructorsβ
new ContractState()β
new ContractState(): ContractState
Creates a blank contract state
Returnsβ
Propertiesβ
dataβ
data: StateValue;
The current value of the primary state of the contract
maintenanceAuthorityβ
maintenanceAuthority: ContractMaintenanceAuthority;
The maintenance authority associated with this contract
Methodsβ
operation()β
operation(operation): undefined | ContractOperation
Get the operation at a specific entry point name
Parametersβ
β’ operation: string | Uint8Array
Returnsβ
undefined | ContractOperation
operations()β
operations(): (string | Uint8Array)[]
Return a list of the entry points currently registered on this contract
Returnsβ
(string | Uint8Array)[]
query()β
query(query, cost_model): GatherResult[]
Runs a series of operations against the current state, and returns the results
Parametersβ
β’ query: Op<null>[]
β’ cost_model: CostModel
Returnsβ
serialize()β
serialize(networkid): Uint8Array
Parametersβ
β’ networkid: NetworkId
Returnsβ
Uint8Array
setOperation()β
setOperation(operation, value): void
Set a specific entry point name to contain a given operation
Parametersβ
β’ operation: string | Uint8Array
β’ value: ContractOperation
Returnsβ
void
toString()β
toString(compact?): string
Parametersβ
β’ compact?: boolean
Returnsβ
string
deserialize()β
static deserialize(raw, networkid): ContractState
Parametersβ
β’ raw: Uint8Array
β’ networkid: NetworkId