Skip to content

defineAlchemyChain

Defines an Alchemy chain configuration by adding an Alchemy-specific RPC base URL to the chain's RPC URLs.

Import

import { defineAlchemyChain } from "@account-kit/infra";

Usage

import { defineAlchemyChain } from "@account-kit/infra";
import { sepolia } from "viem/chains";
 
const chain = defineAlchemyChain({
  chain: sepolia,
  rpcBaseUrl: "https://eth-sepolia.g.alchemy.com/v2",
});

Parameters

params

AlchemyChainConfig The parameters for defining the Alchemy chain

params.chain

Chain The original chain configuration

params.rpcBaseUrl

string The Alchemy-specific RPC base URL

Returns

Chain The updated chain configuration with the Alchemy RPC URL added