Skip to content

Commit

Permalink
fix(constants): Derive supported chain IDs from constants repo (#654)
Browse files Browse the repository at this point in the history
The existing defs currently lack Mode.
  • Loading branch information
pxrl authored May 30, 2024
1 parent 361258b commit 11dcc30
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 32 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@across-protocol/sdk-v2",
"author": "UMA Team",
"version": "0.24.3",
"version": "0.24.4",
"license": "AGPL-3.0",
"homepage": "https://docs.across.to/reference/sdk",
"files": [
Expand Down
28 changes: 0 additions & 28 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as acxConstants from "@across-protocol/constants-v2";
import { constants as ethersConstants, BigNumber, utils } from "ethers";

export {
Expand Down Expand Up @@ -40,33 +39,6 @@ export const ARWEAVE_TAG_APP_VERSION = 2;
*/
export const PROTOCOL_DEFAULT_CHAIN_ID_INDICES = [1, 10, 137, 288, 42161];

// See src/utils/NetworkUtils for helpers.
export const PRODUCTION_CHAIN_IDS = [
acxConstants.MAINNET_CHAIN_IDs.MAINNET,
acxConstants.MAINNET_CHAIN_IDs.OPTIMISM,
acxConstants.MAINNET_CHAIN_IDs.POLYGON,
acxConstants.MAINNET_CHAIN_IDs.ZK_SYNC,
acxConstants.MAINNET_CHAIN_IDs.BASE,
acxConstants.MAINNET_CHAIN_IDs.ARBITRUM,
acxConstants.MAINNET_CHAIN_IDs.LINEA,
];

export const TESTNET_CHAIN_IDS = [
acxConstants.TESTNET_CHAIN_IDs.GOERLI,
acxConstants.TESTNET_CHAIN_IDs.ZK_SYNC_GOERLI,
acxConstants.TESTNET_CHAIN_IDs.ZK_SYNC_SEPOLIA,
acxConstants.TESTNET_CHAIN_IDs.OPTIMISM_GOERLI,
acxConstants.TESTNET_CHAIN_IDs.MUMBAI,
acxConstants.TESTNET_CHAIN_IDs.POLYGON_AMOY,
acxConstants.TESTNET_CHAIN_IDs.BASE_GOERLI,
acxConstants.TESTNET_CHAIN_IDs.BASE_SEPOLIA,
acxConstants.TESTNET_CHAIN_IDs.ARBITRUM_GOERLI,
acxConstants.TESTNET_CHAIN_IDs.ARBITRUM_SEPOLIA,
acxConstants.TESTNET_CHAIN_IDs.SEPOLIA,
acxConstants.TESTNET_CHAIN_IDs.OPTIMISM_SEPOLIA,
acxConstants.TESTNET_CHAIN_IDs.LINEA_GOERLI,
];

export const DEFAULT_CACHING_TTL = 60 * 60 * 24 * 7 * 2; // 2 Weeks
export const DEFAULT_CACHING_SAFE_LAG = 60 * 60; // 1 hour

Expand Down
6 changes: 3 additions & 3 deletions src/utils/NetworkUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CHAIN_IDs, PRODUCTION_CHAIN_IDS, PUBLIC_NETWORKS, TESTNET_CHAIN_IDS } from "../constants";
import { CHAIN_IDs, MAINNET_CHAIN_IDs, PUBLIC_NETWORKS, TESTNET_CHAIN_IDs } from "../constants";

const hreNetworks: Record<number, string> = {
666: "Hardhat1",
Expand Down Expand Up @@ -30,7 +30,7 @@ export function getNativeTokenSymbol(chainId: number | string): string {
* @returns true if the chain ID is part of the production network, otherwise false.
*/
export function chainIsProd(chainId: number): boolean {
return PRODUCTION_CHAIN_IDS.includes(chainId);
return Object.values(MAINNET_CHAIN_IDs).includes(chainId);
}

/**
Expand All @@ -39,7 +39,7 @@ export function chainIsProd(chainId: number): boolean {
* @returns true if the chain ID is part of the production network, otherwise false.
*/
export function chainIsTestnet(chainId: number): boolean {
return TESTNET_CHAIN_IDS.includes(chainId);
return Object.values(TESTNET_CHAIN_IDs).includes(chainId);
}

/**
Expand Down

0 comments on commit 11dcc30

Please sign in to comment.