Skip to content

Commit 09d19a9

Browse files
Add Polygon network to config
1 parent 8af3c7f commit 09d19a9

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

src/config.ts

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ export type WindowEnv = { platformFee: string; network: string };
88

99
let config: any;
1010
// TODO test only, remove the next line for production
11-
// const windowEnv: WindowEnv = { network: "sepolia", platformFee: "0.002" };
12-
// window.env = windowEnv;
11+
const windowEnv: WindowEnv = { network: "polygon", platformFee: "0.0013" };
12+
window.env = windowEnv;
1313
// set default values
1414
let platformFee = "0.001";
1515
let network = "sepolia";
1616
let chainName = "Sepolia Ether";
1717
if (window.env) {
1818
platformFee = window.env.platformFee;
1919
network = window.env.network;
20-
chainName = network === "sepolia" ? "Sepolia Ether" : "Polygon";
20+
chainName = network === "sepolia" ? "Sepolia Ether" : "Polygon Mainnet";
2121
}
2222
if (network === "sepolia") {
2323
config = {
@@ -33,14 +33,37 @@ if (network === "sepolia") {
3333
chainName,
3434
rpcUrls: ["https://rpc.sepolia.org"],
3535
nativeCurrency: {
36-
name: chainName,
36+
name: "SEP",
3737
symbol: "SEP",
3838
decimals: 18,
3939
},
4040
blockExplorerUrls: ["https://sepolia.etherscan.io"],
4141
},
4242
],
4343
};
44+
} else if (network === "polygon") {
45+
config = {
46+
chainNameDisplay: chainName,
47+
contractArtifact: contractArtifactSepolia,
48+
platformFee,
49+
contractAddress: "0xXXX",
50+
chainIDBigInt: 137n,
51+
chainIDHex: "0x89",
52+
ethRequestParams: [
53+
{
54+
chainId: "0x89",
55+
chainName,
56+
rpcUrls: ["https://polygon-rpc.com/"],
57+
nativeCurrency: {
58+
name: "MATIC",
59+
symbol: "MATIC",
60+
decimals: 18,
61+
},
62+
blockExplorerUrls: ["https://polygonscan.com/"],
63+
},
64+
],
65+
};
66+
} else {
67+
throw "Chain config does not exist";
4468
}
45-
4669
export default config;

0 commit comments

Comments
 (0)