ContractState
@midnight-ntwrk/compact-runtime v0.9.0
@midnight-ntwrk/compact-runtime / 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β
Constructorβ
new ContractState(): ContractState;
Creates a blank contract state
Returnsβ
ContractState
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<ArrayBufferLike>
Returnsβ
undefined | ContractOperation
operations()β
operations(): (string | Uint8Array<ArrayBufferLike>)[];
Return a list of the entry points currently registered on this contract
Returnsβ
(string | Uint8Array<ArrayBufferLike>)[]
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β
Returnsβ
serialize()β
serialize(networkid): Uint8Array;
Parametersβ
networkidβ
Returnsβ
Uint8Array
setOperation()β
setOperation(operation, value): void;
Set a specific entry point name to contain a given operation
Parametersβ
operationβ
string | Uint8Array<ArrayBufferLike>
valueβ
Returnsβ
void
toString()β
toString(compact?): string;
Parametersβ
compact?β
boolean
Returnsβ
string
deserialize()β
static deserialize(raw, networkid): ContractState;
Parametersβ
rawβ
Uint8Array
networkidβ
Returnsβ
ContractState