queryContractState

abstract suspend fun queryContractState(address: String): String

Query the current on-chain state of a deployed contract.

Returns the SCALE-encoded contract state as a hex string, suitable for passing to ContractRuntime.stateCreate().

GraphQL Query:

query ContractState($address: HexEncoded!) {
contractAction(address: $address) {
state
}
}

Return

SCALE-encoded contract state as hex string

Parameters

address

Hex-encoded contract address (64 chars)

Throws

if contract not found or response malformed