transport

Builds a TRANSPORT containing type, url, and chain_id without contacting the endpoint. Unlike http_transport, it does not add a config object.

Scalar function Client

Example

Runs locally

-- Anvil uses chain id 31337 by default.
SELECT transport('http://127.0.0.1:8545', 31337) AS transport;

API reference

transport(VARCHAR, UBIGINT) #

Stores the supplied chain_id without calling eth_chainId or comparing it with the endpoint.

Inputs

Name Type Use
url VARCHAR

HTTP or HTTPS JSON-RPC endpoint. Use a lowercase scheme. Without a scheme, localhost and 127.0.0.1 use http://; other hosts use https://.

required positional
chain_id UBIGINT

Unsigned EVM chain id stored as caller-supplied metadata. transport does not query or verify it.

required positional

Returns

Name Type
transport TRANSPORT

TRANSPORT value. Returns a TRANSPORT value with a lowercase type, the endpoint URL, and chain_id. Bare endpoints receive an http:// or https:// prefix.

transport(VARCHAR) #

Sets chain_id to 1 without querying the endpoint. Call transport(url, chain_id) to set a different value.

Inputs

Name Type Use
url VARCHAR

HTTP or HTTPS JSON-RPC endpoint. Use a lowercase scheme. Without a scheme, localhost and 127.0.0.1 use http://; other hosts use https://.

required positional

Returns

Name Type
transport TRANSPORT

TRANSPORT value. Returns a TRANSPORT value with a lowercase type, the endpoint URL, and chain_id. Bare endpoints receive an http:// or https:// prefix.

Overload examples

Runs locally

SELECT transport('https://eth.llamarpc.com') AS transport;

Guidance

Validation

Casting VARCHAR or JSON to TRANSPORT, and creating a CLIENT from a TRANSPORT, reject malformed transport data.

  • type must be http or https, url must start with the matching lowercase scheme, and chain_id must be a non-negative integer.
  • config, when present, must be an object. Recognized fields must have the required type and range; access_list_provider is rejected.

transport vs http_transport

  • Use http_transport when you need HTTP-specific options like timeout, retry count, rate limits, concurrency, SSL verification, or log pagination limits.
  • Use transport for minimal generic transport construction.

Examples

Runs locally

SELECT transport('http://127.0.0.1:8545', 31337) AS transport;