@parallel-protocol/chains
v0.1.1
Published
Parallel Protocol on-chain catalogue — chain ids, contract addresses, viem-typed ABIs
Readme
@parallel-protocol/chains
On-chain catalogue for the Parallel Protocol — viem chain objects, Parallel-specific contract addresses, and viem-typed ABIs.
Install
npm install @parallel-protocol/chains viemviem is a peer dependency.
Design
Each entry in CHAINS_STATIC is a Parallel overlay on top of a canonical
viem Chain object:
interface ChainStaticConfig {
viem: ViemChain; // id, name, native currency, RPCs, explorers, multicall3 — from viem/chains
status: ChainStatus; // "active" | "paused" | "sunset"
lzEid: number; // LayerZero V2 endpoint id
contracts: ChainContracts; // Parallel-specific: usdp, parallelizer, susdp, bridgeableUsdp, …
}viem stays the source of truth for chain id, name, native currency, default RPCs, block explorers, and multicall3. The two chains that don't ship multicall3 in viem (hyperEvm, hemi) get the canonical address injected.
Usage
import {
CHAINS_STATIC,
ACTIVE_CHAINS,
PARALLELIZER_CHAINS,
getUSDpAddress,
isParallelizerChain,
} from "@parallel-protocol/chains";
CHAINS_STATIC.ethereum.viem.id; // 1
CHAINS_STATIC.ethereum.viem.name; // "Ethereum"
CHAINS_STATIC.ethereum.contracts.parallelizer;
// → "0x6efeDDF9269c3683Ba516cb0e2124FE335F262a2"
ACTIVE_CHAINS;
// → ["ethereum", "base", "arbitrum", …] (status: "active")
isParallelizerChain("ethereum"); // true
getUSDpAddress("base"); // "0x76A9A0062ec…"ABIs are exposed under the /abi subpath:
import { PARALLELIZER_ABI, ERC20_ABI } from "@parallel-protocol/chains/abi";Composing your RPC layer
Pass .viem straight to createPublicClient — RPC URLs are intentionally
not bundled so consumers stay free to pick Alchemy, Infura, public RPCs, or
any combination:
import { createPublicClient, http } from "viem";
import { CHAINS_STATIC, PARALLELIZER_ABI } from "@parallel-protocol/chains";
const eth = createPublicClient({
chain: CHAINS_STATIC.ethereum.viem,
transport: http(`https://eth-mainnet.g.alchemy.com/v2/${process.env.ALCHEMY_KEY}`),
});
const fees = await eth.readContract({
address: CHAINS_STATIC.ethereum.contracts.parallelizer!,
abi: PARALLELIZER_ABI,
functionName: "getCollateralRatio",
});License
MIT
