Sigil documentation
ReferenceJSON-RPC

sigil_quoteDexSwapExactOut

Quote an exact-output swap.

Method

sigil_quoteDexSwapExactOut 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.

Quote an exact-output swap.

Request binding

Source handler: rpc_dex::handle_quote_dex_swap_exact_out in sigil/node/sigil-node/src/rpc_dex.rs, line 143.

The handler uses no directly named params.get fields, or delegates input parsing to a typed helper. Use the request types below rather than assuming an empty parameter object.

Parsing excerpt

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

    let pool_id = match extract_string_param(&req.params, 0, "pool_id") {
        Some(pool_id) => pool_id,
        None => return RpcResponse::error(req.id.clone(), -32602, "missing 'pool_id' parameter"),
    };

    let asset_out = match extract_string_param(&req.params, 1, "asset_out") {
        Some(asset_out) => asset_out,
        None => return RpcResponse::error(req.id.clone(), -32602, "missing 'asset_out' parameter"),
    };

    let amount_out = match extract_u64_param(&req.params, 2, "amount_out") {
        Some(amount_out) => amount_out,
        None => {
            return RpcResponse::error(req.id.clone(), -32602, "missing 'amount_out' parameter")
        }
    };

    let max_amount_in = match extract_u64_param(&req.params, 3, "max_amount_in") {
        Some(max_amount_in) => max_amount_in,
        None => {
            return RpcResponse::error(req.id.clone(), -32602, "missing 'max_amount_in' parameter")
        }
    };

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