read_contract
Invokes eth_call with ABI-aware argument encoding. Returns a single value if the ABI function has one output, or a STRUCT with named fields if multiple outputs.
read_contract(TRANSPORT, ADDRESS, JSON, VARCHAR, ABI-dependent argument(s))
Calls contract function and returns typed result (single value or STRUCT based on ABI outputs). ABI must be constant.
Parameters
Returns
| Name | Type |
|---|---|
| result | ANY |
read_contract(TRANSPORT, ADDRESS, JSON, VARCHAR, JSON, VARCHAR, ABI-dependent argument(s))
Adds block_tag/block_number override (via options parameter) and explicit return type specification (via return_schema parameter). DYNAMIC ABI SUPPORT: When return_schema is provided, the ABI parameter can be non-constant (column reference from CTEs, subqueries, joins, etc.), allowing different ABIs per row. This is required because DuckDB needs return types at query planning time, and non-constant ABIs cannot be inspected during planning. The return_schema parameter explicitly specifies output types: 'raw' for BLOB, 'uint256' for UINT256, or 'uint256,address' for STRUCT with comma-separated field types. The options parameter can be NULL or '{}'::JSON if block pinning is not needed.
Parameters
Returns
| Name | Type |
|---|---|
| result | ANY |