Skip to content

[FEATURE] add avmChains to aztec.js #19223

@olehmisar

Description

@olehmisar

Problem Statement

Add default definitions of aztec vm chains to aztec.js. Similar to viem/chains. This will keep the ecosystem aligned on the chains info and make upgrades smoother(no need to update RPC urls etc)

Proposed Solution

export interface AvmChain {
  id: number;
  name: string;
  rpcUrls: {
    default: AvmChainRpcUrls;
    [key: string]: AvmChainRpcUrls;
  };
}

export interface AvmChainRpcUrls {
  http: readonly [string, ...string[]];
}

export const avmChains = {
  devnet20251212: {
    id: 829903097, // bytes4(keccak256('aztec-devnet20251212'))
    name: "Aztec Devnet 20251212",
    rpcUrls: {
      default: {
        http: ["https://next.devnet.aztec-labs.com"],
      },
    },
  },

  sandbox: {
    id: 147120760, // bytes4(keccak256('aztec-sandbox'))
    name: "Aztec Sandbox",
    rpcUrls: {
      default: {
        http: ["http://localhost:8080"],
      },
    },
  },
} as const satisfies Record<string, AvmChain>;

Example Use Case

import { avmChains } from '@aztec/aztec.js/chains';

// automatically pulls `.rpcUrls.default[0]`
const node = createAztecNode(avmChains.devnet20251212);

console.log(node.chain.id) // 829903097

Alternative Solutions

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-feature-requestType: Adding a brand new feature (not to be confused with improving an existing feature).from-communityThis originated from the community :)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions