Skip to content

Commit

Permalink
feat: support polygon amoy (#58)
Browse files Browse the repository at this point in the history
* chore: update dnsprove

* feat: update config to support amoy

* chore: bump dnsprove

---------

Co-authored-by: tngzixiang <[email protected]>
  • Loading branch information
zixiang2018 and tngzixiang authored May 9, 2024
1 parent 24ebb94 commit 795a148
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@govtechsg/dnsprove": "^2.6.1",
"@govtechsg/dnsprove": "^2.7.1",
"@govtechsg/oa-encryption": "^1.3.5",
"@govtechsg/oa-verify": "^7.12.0",
"@govtechsg/open-attestation": "^6.6.0",
Expand Down
2 changes: 1 addition & 1 deletion src/types/network.ts
Original file line number Diff line number Diff line change
@@ -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";
10 changes: 5 additions & 5 deletions src/types/supportedChains.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
18 changes: 9 additions & 9 deletions src/types/supportedChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export enum CHAIN_ID {
local = "1337",
mainnet = "1",
matic = "137",
maticmum = "80001",
amoy = "80002",
sepolia = "11155111",
}

Expand Down Expand Up @@ -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,
},
},
Expand Down
6 changes: 3 additions & 3 deletions src/views/verify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit 795a148

Please sign in to comment.