rpc_call

Sends a low-level JSON-RPC request and returns the response's result value as JSON. Provider errors and transport failures are raised as SQL errors.

Scalar functionLive RPC Client

Example

Live RPC

-- Fetch the current gas price via eth_gasPrice
SELECT rpc_call(
  $client,
  'eth_gasPrice',
  '[]'::JSON
) AS response;

API reference

rpc_call(CLIENT, VARCHAR, JSON) # RPC required

Sends one method call with params in provider order and returns only the JSON-RPC result field.

Inputs

Name Type Use
client CLIENT

Attached live CLIENT used for the JSON-RPC request.

required positional
method VARCHAR

Method name such as eth_blockNumber or eth_getBalance.

required positional
params JSON

JSON array of method parameters in provider order.

required positional

Returns

Name Type
result JSON

Raw JSON-RPC result. Returns the JSON result field from the provider response. RPC errors are raised as SQL errors.

Guidance

When to use rpc_call

rpc_call is the escape hatch for methods that do not have a typed Determica function.

  • Prefer typed functions such as get_block, get_logs, or read_contract when you want validated inputs and typed SQL results.
  • Pass params as a JSON array in the exact order required by the RPC method.
  • The response envelope is not returned; provider and transport errors become SQL errors.