Skip to content

Commit

Permalink
feat: expose chainList (#31)
Browse files Browse the repository at this point in the history
in most projects we need to actual chain object, mainting the list twice is not optimal, but the best i could come up with atm :/
  • Loading branch information
sakulstra authored Nov 21, 2024
1 parent 954d76f commit 9ca7ca1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
17 changes: 3 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
"format": "biome check --write",
"prepublishOnly": "npm run build"
},
"files": [
"src/*.ts",
"dist/lib*",
"dist/cli*"
],
"files": ["src/*.ts", "dist/lib*", "dist/cli*"],
"bin": "./dist/cli.js",
"main": "./dist/lib.js",
"module": "./dist/lib.mjs",
Expand Down Expand Up @@ -45,18 +41,11 @@
"vitest": "^2.1.4"
},
"tsup": {
"entry": [
"src/action.ts",
"src/lib.ts",
"src/cli.ts"
],
"entry": ["src/action.ts", "src/lib.ts", "src/cli.ts"],
"splitting": false,
"sourcemap": false,
"clean": true,
"dts": true,
"format": [
"esm",
"cjs"
]
"format": ["esm", "cjs"]
}
}
26 changes: 26 additions & 0 deletions src/chainIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,32 @@ import {
zksync,
} from "viem/chains";

export const ChainList = {
mainnet: mainnet,
polygon: polygon,
polygon_amoy: polygonAmoy,
avalanche: avalanche,
avalanche_fuji: avalancheFuji,
arbitrum: arbitrum,
arbitrum_sepolia: arbitrumSepolia,
fantom: fantom,
fantom_testnet: fantomTestnet,
optimism: optimism,
optimism_sepolia: optimismSepolia,
harmony: harmonyOne,
sepolia: sepolia,
scroll: scroll,
scroll_sepolia: scrollSepolia,
metis: metis,
base: base,
base_sepolia: baseSepolia,
bnb: bsc,
gnosis: gnosis,
zkEVM: polygonZkEvm,
celo: celo,
zksync: zksync,
};

export const ChainId = {
mainnet: mainnet.id,
polygon: polygon.id,
Expand Down
4 changes: 2 additions & 2 deletions src/lib.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { networkMap } from "./alchemyIds";
import { ChainId } from "./chainIds";
import { ChainId, ChainList } from "./chainIds";

type SupportedChainIds = (typeof ChainId)[keyof typeof ChainId];

Expand Down Expand Up @@ -91,4 +91,4 @@ export const getRPCUrl = (
}
};

export { ChainId };
export { ChainId, ChainList };

0 comments on commit 9ca7ca1

Please sign in to comment.