Sigil documentation
ReferenceJSON-RPC

sigil_getState

Read a value from chain state.

Method

sigil_getState is registered in the canonical JSON-RPC catalog. Use POST /rpc, Content-Type: application/json, JSON-RPC 2.0 and a caller-controlled request id. Node RPC profile, build feature and runtime activation checks still apply.

Read a value from chain state.

Request binding

Source handler: rpc_server::handle_get_state in sigil/node/sigil-node/src/rpc_server.rs, line 1608.

The handler directly reads these named fields: delegator, did, key, namespace, partition, validator, validator_did. Additional typed parsing, aliases and nested validation are defined by its request types. Field presence alone does not establish optionality.

Parsing excerpt

These source excerpts show binding and validation; they are not runnable client code.

    let partition = match rpc_param_str(req, &["partition", "namespace"], 0) {
        Some(partition) => partition,
        None => return RpcResponse::error(req.id.clone(), -32602, "missing 'partition' parameter"),
    };

    let key = match rpc_param_str(req, &["key", "did"], 1) {
        Some(key) => key,
        None => return RpcResponse::error(req.id.clone(), -32602, "missing 'key' parameter"),
    };

            let delegator = rpc_param_str(req, &["delegator", "did"], 1).unwrap_or(key);

            let validator = rpc_param_str(req, &["validator", "validator_did"], 2)
                .or_else(|| key.split_once('|').map(|(_, v)| v))
                .or_else(|| key.split_once('/').map(|(_, v)| v));

Responses and failures

Check HTTP status, parse the JSON-RPC envelope, reject error, and require result on success. Preserve large base-unit integers without floating-point rounding. A catalog method does not bypass authentication, capability, policy or activation requirements.

On this page