ContractRuntime
Native bridge to the Rust contract runtime.
Exposes functions that match the WASM onchain-runtime exactly:
persistentHashAligned: binary_repr + SHA-256 (proper field-aligned encoding)
bigIntToValue / valueToBigInt: field element encoding
contractQuery: VM opcode execution via state handles
Functions
Assemble a contract call transaction from circuit execution output.
Assemble a contract DEPLOY transaction from constructor output.
Convert BigInt (hex string) to Value (JSON).
Execute opcodes against a contract state handle.
The chain's global_ttl (in seconds) — the maximum a transaction's TTL may sit ahead of chain time before the node rejects it (custom error 182 / IntentTtlTooFarInFuture). Decoded from the SCALE-encoded ledger parameters.
The midnight-ledger version this client links against (e.g. "8.0.3").
Compute persistent commit: SHA-256(opening || binary_repr(value)).
Raw persistent hash (SHA-256) of hex bytes.
Persistent hash with proper AlignedValue encoding (matches WASM).
Sign the fallible unshielded offer on a PROVEN contract-call transaction.
Clone a state handle (saves initial state before circuit queries).
Create a contract state from SCALE hex, return handle.
Create state from a JSON structure descriptor (nested arrays of nulls).
Live entries in the native contract-state pool. Test/debug introspection: the pool is process-global (it survives QuickJS teardown), so leak tests assert it returns to baseline after a circuit execution or read.
Read contract state fields as JSON.
Set an operation on a state handle.
Convert Value (JSON) to BigInt (decimal string).