Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions typescript/packages/http/paywall/src/paywallUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { PaymentRequirements } from "@x402/core/types";
import * as allChains from "viem/chains";
import { base, baseSepolia } from "viem/chains";

// Chain configuration constants

Expand All @@ -10,6 +10,9 @@ export const EVM_CHAIN_IDS = {
BASE_SEPOLIA: "84532",
} as const;

// Local map of supported EVM chains (avoids importing all viem/chains)
const SUPPORTED_EVM_CHAINS = [base, baseSepolia] as const;

// Solana Network References (CAIP-2 format: solana:genesisHash)
export const SOLANA_NETWORK_REFS = {
MAINNET: "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
Expand Down Expand Up @@ -102,8 +105,8 @@ export function getNetworkDisplayName(network: string): string {
if (network.startsWith("eip155:")) {
const chainId = parseInt(network.split(":")[1]);

// Find matching chain in viem's chain definitions
const chain = Object.values(allChains).find(c => c.id === chainId);
// Find matching chain in supported chain definitions
const chain = SUPPORTED_EVM_CHAINS.find(c => c.id === chainId);

if (chain) {
return chain.name;
Expand All @@ -130,7 +133,7 @@ export function getNetworkDisplayName(network: string): string {
export function isTestnetNetwork(network: string): boolean {
if (network.startsWith("eip155:")) {
const chainId = parseInt(network.split(":")[1]);
const chain = Object.values(allChains).find(c => c.id === chainId);
const chain = SUPPORTED_EVM_CHAINS.find(c => c.id === chainId);
return chain?.testnet ?? false;
}

Expand Down
Loading