Reports the chains this deployment can reach.
Reports the chains this deployment can reach.
GET /v1/web3/chains
| Address | https://api.hanzo.ai/v1/web3/chains |
| Method | GET |
| Operation | get_web3_chains |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Reports the chains this deployment can reach. The list is the declared registry, so it is exactly what /v1/web3/rpc will accept — a chain that appears here is one this deployment actually has an upstream for.
Request
GET /v1/web3/chains takes no parameters and no body — the credential is the whole request.
Response
| Status | Body | Meaning |
|---|---|---|
200 | chainList | ok |
200 body — 4 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
chains | body | Chain[] | — | Chains is every chain this deployment is configured to reach, sorted by id. |
chains[].chainId | body | integer | — | ChainID is the EIP-155 id, so a caller can check it matches the wallet they are about to sign with. |
chains[].id | body | string | — | ID is the URL name: the value of :chain. |
chains[].name | body | string | — | Name is for humans. |
Failure carries the platform error shape — see Errors.
Examples
hanzo has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.
import { Configuration, Web3Api } from 'hanzoai';
const api = new Web3Api(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getWeb3Chains();from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import Web3Api
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = Web3Api(client).get_web3_chains()cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.Web3API.GetWeb3Chains(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, web3_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = web3_api::get_web3_chains(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.Web3Api;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new Web3Api(client).getWeb3Chains();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl https://api.hanzo.ai/v1/web3/chains \
-H "Authorization: Bearer $HANZO_API_KEY"The door reaches web3 through the web3 tool, which names its 3 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_chains"
}
}
}'How is this guide?