> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rialto.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Router Registries

> Discover the active Rialto router for taker-submitted and gasless swap flows.

## Overview

Rialto publishes Router Registry contracts so partners can discover the active
Rialto router instead of hardcoding router addresses.

Use feature id `2` when you submit the transaction returned by `GET /quote` from
the taker wallet. Use feature id `3` when you use Rialto's gasless relayer flow
through `POST /gasless/submit`.

| Feature id | Flow                           |
| ---------- | ------------------------------ |
| `2`        | Taker-submitted or normal swap |
| `3`        | Gasless or relayed swap        |

## Registry deployments

| Chain    | Chain id | API access                 | Router Registry                              |
| -------- | -------- | -------------------------- | -------------------------------------------- |
| RH Chain | `4663`   | `<your_robinhood_rpc_url>` | `0x71a120CbBf3Ce7cD910a3c50fF77aFc62735687E` |

## Registry reads

| Function                        | Meaning                                                                                           |
| ------------------------------- | ------------------------------------------------------------------------------------------------- |
| `ownerOf(uint256 featureId)`    | Current active router for the feature. Reverts when the feature is paused or uninitialized.       |
| `prev(uint128 featureId)`       | Previous router accepted during a migration dwell window. Reverts when no previous router is set. |
| `next(uint128 featureId)`       | Staged next router, or the zero address when none is staged.                                      |
| `getFeature(uint128 featureId)` | One-call read returning `(previous, current, next, paused)`.                                      |

In this registry, "owner" means the router address currently assigned to a
feature id. It is not the registry admin owner.

## JSON-RPC examples

```bash theme={null}
# Robinhood Chain:
# Use your own Robinhood Chain RPC endpoint if you need direct registry reads.
# RPC_URL='<your_robinhood_rpc_url>'
# REGISTRY_ADDRESS='0x71a120CbBf3Ce7cD910a3c50fF77aFc62735687E'

# Feature 2 = taker-submitted quote transaction.
# Feature 3 = gasless relayer flow.
FEATURE_ID=2
FEATURE_HEX=$(printf '%064x' "$FEATURE_ID")

# Current router: ownerOf(uint256)
DATA="0x6352211e${FEATURE_HEX}"
curl -sS "$RPC_URL" \
  -H 'Content-Type: application/json' \
  -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_call\",\"params\":[{\"to\":\"$REGISTRY_ADDRESS\",\"data\":\"$DATA\"},\"latest\"]}"

# Previous router: prev(uint128)
DATA="0xe2603dc2${FEATURE_HEX}"
curl -sS "$RPC_URL" \
  -H 'Content-Type: application/json' \
  -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_call\",\"params\":[{\"to\":\"$REGISTRY_ADDRESS\",\"data\":\"$DATA\"},\"latest\"]}"

# Staged next router: next(uint128)
DATA="0x74bcde51${FEATURE_HEX}"
curl -sS "$RPC_URL" \
  -H 'Content-Type: application/json' \
  -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_call\",\"params\":[{\"to\":\"$REGISTRY_ADDRESS\",\"data\":\"$DATA\"},\"latest\"]}"

# Full feature state: getFeature(uint128)
DATA="0x46df01a4${FEATURE_HEX}"
curl -sS "$RPC_URL" \
  -H 'Content-Type: application/json' \
  -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_call\",\"params\":[{\"to\":\"$REGISTRY_ADDRESS\",\"data\":\"$DATA\"},\"latest\"]}"
```

`eth_call` returns ABI-encoded hex. For single-address calls, the address is the
last 20 bytes of the returned 32-byte word. For `getFeature`, decode four ABI
words as `(address previous, address current, address next, bool paused)`.
