From ebdb51b786f3605745f86fa4455ad19e5a934815 Mon Sep 17 00:00:00 2001 From: tngzixiang Date: Thu, 18 Apr 2024 18:03:57 +0800 Subject: [PATCH] feat: update config to support amoy --- src/types/network.ts | 2 +- src/types/supportedChains.test.ts | 10 +++++----- src/types/supportedChains.ts | 18 +++++++++--------- src/views/verify.tsx | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/types/network.ts b/src/types/network.ts index 6ca5893..a587a20 100644 --- a/src/types/network.ts +++ b/src/types/network.ts @@ -1,3 +1,3 @@ -export type networkName = "local" | "mainnet" | "matic" | "maticmum" | "sepolia"; +export type networkName = "local" | "mainnet" | "matic" | "amoy" | "sepolia"; export type networkType = "production" | "test" | "development"; export type networkCurrency = "ETH" | "MATIC"; diff --git a/src/types/supportedChains.test.ts b/src/types/supportedChains.test.ts index 24d411b..a041b6a 100644 --- a/src/types/supportedChains.test.ts +++ b/src/types/supportedChains.test.ts @@ -31,14 +31,14 @@ describe("supportedChains", () => { expect(explorerUrl).toBe("https://polygonscan.com"); }); - it("should maticmum chain info correctly", () => { - const { id, name, type, currency, explorerUrl } = SUPPORTED_CHAINS[CHAIN_ID.maticmum]; + it("should polygon amoy chain info correctly", () => { + const { id, name, type, currency, explorerUrl } = SUPPORTED_CHAINS[CHAIN_ID.amoy]; - expect(id).toBe(CHAIN_ID.maticmum); - expect(name).toBe("maticmum"); + expect(id).toBe(CHAIN_ID.amoy); + expect(name).toBe("amoy"); expect(type).toBe("test"); expect(currency).toBe("MATIC"); - expect(explorerUrl).toBe("https://mumbai.polygonscan.com"); + expect(explorerUrl).toBe("https://www.oklink.com/amoy"); }); it("should sepolia chain info correctly", () => { diff --git a/src/types/supportedChains.ts b/src/types/supportedChains.ts index 303f448..a06bac2 100644 --- a/src/types/supportedChains.ts +++ b/src/types/supportedChains.ts @@ -4,7 +4,7 @@ export enum CHAIN_ID { local = "1337", mainnet = "1", matic = "137", - maticmum = "80001", + amoy = "80002", sepolia = "11155111", } @@ -59,18 +59,18 @@ export const SUPPORTED_CHAINS: supportedChains = { decimals: 18, }, }, - [CHAIN_ID.maticmum]: { - id: CHAIN_ID.maticmum, - label: "Polygon Mumbai", - name: "maticmum", + [CHAIN_ID.amoy]: { + id: CHAIN_ID.amoy, + label: "Polygon Amoy", + name: "amoy", type: "test", currency: "MATIC", - explorerUrl: "https://mumbai.polygonscan.com", - explorerApiUrl: "https://api-testnet.polygonscan.com", - rpcUrl: "https://rpc-mumbai.matic.today", + explorerUrl: "https://www.oklink.com/amoy", + explorerApiUrl: "https://api-amoy.polygonscan.com", + rpcUrl: "https://rpc-amoy.polygon.technology", nativeCurrency: { name: "MATIC", - symbol: "mMATIC", + symbol: "aMATIC", decimals: 18, }, }, diff --git a/src/views/verify.tsx b/src/views/verify.tsx index 114bee5..1df7906 100644 --- a/src/views/verify.tsx +++ b/src/views/verify.tsx @@ -27,9 +27,9 @@ const SUPPORTED_NETWORKS: supportedNetworks = { ...SUPPORTED_CHAINS[CHAIN_ID.matic], provider: infuraProvider("matic"), }, - [CHAIN_ID.maticmum]: { - ...SUPPORTED_CHAINS[CHAIN_ID.maticmum], - provider: infuraProvider("maticmum"), + [CHAIN_ID.amoy]: { + ...SUPPORTED_CHAINS[CHAIN_ID.amoy], + provider: jsonRpcProvider(SUPPORTED_CHAINS[CHAIN_ID.amoy].rpcUrl as string), }, [CHAIN_ID.sepolia]: { ...SUPPORTED_CHAINS[CHAIN_ID.sepolia],