View this page as Markdown

attach_transport

Attaches transport authority to a pinned or execution CLIENT so missing state can be fetched without changing the CLIENT's durable state identity.

Example

Needs RPC · RPC required

WITH execution AS MATERIALIZED (
  -- Materialize run() to make its execution visible to client(execution_id).
  SELECT execution_id
  FROM run((SELECT
    -- Pin the CLIENT so this simulation uses one block.
    pin(client($transport), 'finalized') AS client,
    'attach-transport-example' AS candidate_key,
    program([
      -- Use the identity precompile for a minimal successful program.
      execute_call(
        '0x00'::ADDRESS,
        '0x04'::ADDRESS,
        '0x'::BYTES,
        0::UINT256,
        50000
      )
    ]) AS program
  ))
)
-- Attach the TRANSPORT to the retained execution CLIENT.
SELECT attach_transport(client(execution_id), $transport) AS client
FROM execution;

API reference

Exact signatures with descriptions, requirements, inputs, returns, and examples.

attach_transport(CLIENT, TRANSPORT) #

Checks the TRANSPORT against the CLIENT lineage and returns a new CLIENT that can fetch missing state.

Inputs

Name Type Use
client CLIENT

Pinned or execution CLIENT whose durable state identity the function preserves.

required positional
transport TRANSPORT

TRANSPORT used to fetch chain state missing from local retained state.

required positional

Returns

Name Type
client CLIENT

Hydrated CLIENT. Returns a new CLIENT with the TRANSPORT attached. The function does not modify the input CLIENT.

Guidance

Transport does not change identity

attach_transport lets a CLIENT fetch missing state. It does not change the chain, block, or execution state that the CLIENT identifies.

  • The function does not modify the source CLIENT.
  • The TRANSPORT's trusted declared chain id must match the CLIENT lineage. For a pinned CLIENT, the function also validates the pinned header against the provider.
  • Store credentials in runtime TRANSPORT configuration. The durable CLIENT identity does not include them.

Category and tags

Tag
Client