diff --git a/README.md b/README.md index abfaa4c..60fe599 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,10 @@ Alchemy API key If given, the action substitute missing RPC_URLs with one constructed from the given key. +### Supported Environment Variables + +The supported environment variables are documented in [this](src/lib.test.ts) test. + #### Usage ```yaml diff --git a/src/lib.test.ts b/src/lib.test.ts index a4ba17d..9efdadd 100644 --- a/src/lib.test.ts +++ b/src/lib.test.ts @@ -1,7 +1,7 @@ import { describe } from "node:test"; import { expect, it } from "vitest"; import { networkMap } from "./alchemyIds"; -import { ChainId, getRPCUrl, supportedChainIds } from "./lib"; +import { ChainId, getNetworkEnv, getRPCUrl, supportedChainIds } from "./lib"; describe("lib", () => { it("should use env var if given", () => { @@ -28,4 +28,42 @@ describe("lib", () => { it.each(supportedChainIds)("should return supported chain %s", (chainId) => { expect(getRPCUrl(chainId, "abc")).toMatchSnapshot(networkMap[chainId]); }); + + it("has sensible env names for RPC_", () => { + const envs = Object.fromEntries( + supportedChainIds.map((chainId) => [ + getNetworkEnv(chainId), + getRPCUrl(chainId, "abc"), + ]), + ); + + expect(envs).toMatchInlineSnapshot(` + { + "RPC_ARBITRUM_GOERLI": "https://arb-goerli.g.alchemy.com/v2/abc", + "RPC_ARBITRUM_ONE": "https://arb-mainnet.g.alchemy.com/v2/abc", + "RPC_ARBITRUM_SEPOLIA": "https://arb-sepolia.g.alchemy.com/v2/abc", + "RPC_AVALANCHE": "https://avax-mainnet.g.alchemy.com/v2/abc", + "RPC_BASE": "https://base-mainnet.g.alchemy.com/v2/abc", + "RPC_BASE_SEPOLIA": "https://base-sepolia.g.alchemy.com/v2/abc", + "RPC_BNB": "https://bnb-mainnet.g.alchemy.com/v2/abc", + "RPC_FANTOM": "https://fantom-mainnet.g.alchemy.com/v2/abc", + "RPC_FANTOM_TESTNET": "https://fantom-testnet.g.alchemy.com/v2/abc", + "RPC_FUJI": "https://avax-fuji.g.alchemy.com/v2/abc", + "RPC_GNOSIS": "https://gnosis-mainnet.g.alchemy.com/v2/abc", + "RPC_GOERLI": "https://eth-goerli.g.alchemy.com/v2/abc", + "RPC_MAINNET": "https://eth-mainnet.g.alchemy.com/v2/abc", + "RPC_METIS": "https://metis-mainnet.g.alchemy.com/v2/abc", + "RPC_MUMBAI": "https://polygon-mumbai.g.alchemy.com/v2/abc", + "RPC_OPTIMISM": "https://opt-mainnet.g.alchemy.com/v2/abc", + "RPC_OPTIMISM_GOERLI": "https://opt-goerli.g.alchemy.com/v2/abc", + "RPC_OPTIMISM_SEPOLIA": "https://opt-sepolia.g.alchemy.com/v2/abc", + "RPC_POLYGON": "https://polygon-mainnet.g.alchemy.com/v2/abc", + "RPC_SCROLL": "https://scroll-mainnet.g.alchemy.com/v2/abc", + "RPC_SCROLL_SEPOLIA": "https://scroll-sepolia.g.alchemy.com/v2/abc", + "RPC_SEPOLIA": "https://eth-sepolia.g.alchemy.com/v2/abc", + "RPC_ZKEVM": "https://polygonzkevm-mainnet.g.alchemy.com/v2/abc", + "RPC_ZKSYNC": "https://zksync-mainnet.g.alchemy.com/v2/abc", + } + `); + }); });