Skip to content

Commit

Permalink
Merge pull request #46 from sarcophagus-org/polygon-mainnet
Browse files Browse the repository at this point in the history
Setup for Polygon mainnet
  • Loading branch information
sethhrbek authored Oct 11, 2023
2 parents 2cefa69 + bc40c95 commit d7e21ef
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sarcophagus-org/sarcophagus-v2-sdk-client",
"version": "0.2.28",
"version": "0.2.29",
"main": "dist/browser.js",
"browser": "dist/browser.js",
"type": "module",
Expand Down
11 changes: 10 additions & 1 deletion src/WebSarcoClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ import {
sepoliaNetworkConfig,
baseGoerliNetworkConfig,
polygonMumbaiNetworkConfig,
polygonMainnetNetworkConfig,
MAINNET_CHAIN_ID,
GOERLI_CHAIN_ID,
SEPOLIA_CHAIN_ID,
POLYGON_MUMBAI_CHAIN_ID,
BASE_GOERLI_CHAIN_ID,
POLYGON_MAINNET_CHAIN_ID,
} from './networkConfig';
import Arweave from 'arweave';
import { sponsoredBundlrProvider } from './helpers/bundlr';
Expand Down Expand Up @@ -90,7 +92,14 @@ export class WebSarcoClient {
[
POLYGON_MUMBAI_CHAIN_ID,
polygonMumbaiNetworkConfig(providerUrl, {
polygonMumbaiApiKey: initParams.polygonMumbaiApiKey,
polygonScanApiKey: initParams.polygonScanApiKey,
zeroExApiKey: initParams.zeroExApiKey,
}),
],
[
POLYGON_MAINNET_CHAIN_ID,
polygonMainnetNetworkConfig(providerUrl, {
polygonScanApiKey: initParams.polygonScanApiKey,
zeroExApiKey: initParams.zeroExApiKey,
}),
],
Expand Down
4 changes: 4 additions & 0 deletions src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ import {
GOERLI_CHAIN_ID,
HARDHAT_CHAIN_ID,
POLYGON_MUMBAI_CHAIN_ID,
POLYGON_MAINNET_CHAIN_ID,
MAINNET_CHAIN_ID,
SEPOLIA_CHAIN_ID,
hardhatNetworkConfig,
SarcoSupportedNetwork,
polygonMainnetNetworkConfig,
} from './networkConfig';
import {
CallOptions,
Expand Down Expand Up @@ -54,10 +56,12 @@ export {
sepoliaNetworkConfig,
baseGoerliNetworkConfig,
polygonMumbaiNetworkConfig,
polygonMainnetNetworkConfig,
BASE_GOERLI_CHAIN_ID,
GOERLI_CHAIN_ID,
HARDHAT_CHAIN_ID,
POLYGON_MUMBAI_CHAIN_ID,
POLYGON_MAINNET_CHAIN_ID,
MAINNET_CHAIN_ID,
SEPOLIA_CHAIN_ID,
hardhatNetworkConfig,
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const sarcoClientInitSchema = object({
chainId: number().required(),
bundlrPublicKey: string(),
etherscanApiKey: string(),
polygonMumbaiApiKey: string(),
polygonScanApiKey: string(),
basescanApiKey: string(),
zeroExApiKey: string(),
});
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
sepoliaNetworkConfig,
baseGoerliNetworkConfig,
polygonMumbaiNetworkConfig,
polygonMainnetNetworkConfig,
} from './networkConfig';
import {
CallOptions,
Expand Down Expand Up @@ -42,6 +43,7 @@ export {
sepoliaNetworkConfig,
baseGoerliNetworkConfig,
polygonMumbaiNetworkConfig,
polygonMainnetNetworkConfig,
};
export type {
ArchaeologistCurseNegotiationParams,
Expand Down
19 changes: 11 additions & 8 deletions src/networkConfig/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const GOERLI_CHAIN_ID = 5;
export const SEPOLIA_CHAIN_ID = 11155111;
export const BASE_GOERLI_CHAIN_ID = 84531;
export const POLYGON_MUMBAI_CHAIN_ID = 80001;
export const POLYGON_MAINNET_CHAIN_ID = 137;
export const HARDHAT_CHAIN_ID = 31337;

export type SarcoSupportedNetwork =
Expand All @@ -21,11 +22,13 @@ export type SarcoSupportedNetwork =
| 'sepolia'
| 'baseGoerli'
| 'polygonMumbai'
| 'polygonMainnet'
| typeof MAINNET_CHAIN_ID
| typeof GOERLI_CHAIN_ID
| typeof SEPOLIA_CHAIN_ID
| typeof BASE_GOERLI_CHAIN_ID
| typeof POLYGON_MUMBAI_CHAIN_ID;
| typeof POLYGON_MUMBAI_CHAIN_ID
| typeof POLYGON_MAINNET_CHAIN_ID;

export const hardhatNetworkConfig = (override?: {
providerUrl?: string;
Expand Down Expand Up @@ -55,7 +58,7 @@ export const hardhatNetworkConfig = (override?: {

export const polygonMumbaiNetworkConfig = (
providerUrl: string,
config?: { polygonMumbaiApiKey?: string; zeroExApiKey?: string }
config?: { polygonScanApiKey?: string; zeroExApiKey?: string }
): SarcoNetworkConfig => ({
chainId: POLYGON_MUMBAI_CHAIN_ID,
networkName: 'PolygonMumbai Testnet',
Expand All @@ -64,7 +67,7 @@ export const polygonMumbaiNetworkConfig = (
sarcoTokenAddress: '0x2BC9019e6d9e6a26D7D8d8CDDa4e5dE9B787D7bb',
diamondDeployAddress: '0x42F2C41e0285B3CBED8084b2c7476F11730935Bc',
etherscanApiUrl: 'https://api-testnet.polygonscan.com/api',
etherscanApiKey: config?.polygonMumbaiApiKey ?? '',
etherscanApiKey: config?.polygonScanApiKey ?? '',
explorerUrl: 'https://mumbai.polygonscan.com/',
bundlr: {
currencyName: 'ethereum',
Expand All @@ -80,24 +83,24 @@ export const polygonMumbaiNetworkConfig = (

export const polygonMainnetNetworkConfig = (
providerUrl: string,
config?: { polygonMainnetApiKey?: string; zeroExApiKey?: string }
config?: { polygonScanApiKey?: string; zeroExApiKey?: string }
): SarcoNetworkConfig => ({
chainId: POLYGON_MUMBAI_CHAIN_ID,
chainId: POLYGON_MAINNET_CHAIN_ID,
networkName: 'Polygon Mainnet',
networkShortName: 'Polygon',
tokenSymbol: 'MATIC',
sarcoTokenAddress: '0x80ae3b3847e4e8bd27a389f7686486cac9c3f3e8',
diamondDeployAddress: '',
diamondDeployAddress: '0xc1984df3e3ddc1DC24d54179CCD5537e290C7E9c',
etherscanApiUrl: 'https://api.polygonscan.com/api',
etherscanApiKey: config?.polygonMainnetApiKey ?? '',
etherscanApiKey: config?.polygonScanApiKey ?? '',
explorerUrl: 'https://polygonscan.com/',
bundlr: {
currencyName: 'ethereum',
nodeUrl: 'https://devnet.bundlr.network',
},
arweaveConfig,
providerUrl,
subgraphUrl: 'https://api.studio.thegraph.com/query/49076/polygon-mainnet/v0.0.1',
subgraphUrl: 'https://api.studio.thegraph.com/query/49076/polygon/v.0.0.1',
zeroExApiKey: config?.zeroExApiKey ?? '',
zeroExApiUrl: 'https://polygon.api.0x.org',
apiUrlBase: 'https://api.encryptafile.com',
Expand Down
4 changes: 4 additions & 0 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import {
GOERLI_CHAIN_ID,
HARDHAT_CHAIN_ID,
POLYGON_MUMBAI_CHAIN_ID,
POLYGON_MAINNET_CHAIN_ID,
MAINNET_CHAIN_ID,
SEPOLIA_CHAIN_ID,
hardhatNetworkConfig,
SarcoSupportedNetwork,
polygonMainnetNetworkConfig,
} from './networkConfig';
import {
CallOptions,
Expand Down Expand Up @@ -52,10 +54,12 @@ export {
sepoliaNetworkConfig,
baseGoerliNetworkConfig,
polygonMumbaiNetworkConfig,
polygonMainnetNetworkConfig,
BASE_GOERLI_CHAIN_ID,
GOERLI_CHAIN_ID,
HARDHAT_CHAIN_ID,
POLYGON_MUMBAI_CHAIN_ID,
POLYGON_MAINNET_CHAIN_ID,
MAINNET_CHAIN_ID,
SEPOLIA_CHAIN_ID,
hardhatNetworkConfig,
Expand Down

0 comments on commit d7e21ef

Please sign in to comment.