From d964764d5c9b496c1b0b2b897e8b182efc46ce86 Mon Sep 17 00:00:00 2001 From: Felipe Forbeck Date: Wed, 3 Apr 2024 16:27:23 -0300 Subject: [PATCH] Added Polygon network support --- .env.sample | 8 ++++---- README.md | 6 +++--- hardhat.config.js | 4 ++-- src/utils/contract.js | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.env.sample b/.env.sample index 604f0d6..260cc40 100644 --- a/.env.sample +++ b/.env.sample @@ -25,12 +25,12 @@ DEBUG=false # The API that you are using to connect to Ethereum Blockchain # # ALCHEMY Mainnet: https://eth-mainnet.alchemyapi.io/v2/[YOUR_ALCHEMY_API_KEY] -# ALCHEMY Goerli: https://eth-goerli.alchemyapi.io/v2/[YOUR_ALCHEMY_API_KEY] +# ALCHEMY Polygon: https://polygon-mainnet.alchemyapi.io/v2/[YOUR_ALCHEMY_API_KEY] # # INFURA Mainnet: https://mainnet.infura.io/v3/[YOUR_INFURA_API_KEY] -# INFURA Goerli: https://goerli.infura.io/v3/[YOUR_INFURA_API_KEY] +# INFURA Polygon: https://polygon-mainnet.infura.io/v3/[YOUR_INFURA_API_KEY] ETHEREUM_BLOCKCHAIN_API=https://... ## -# The Ethereum Network which CLI should interact with: ganache, goerli, mainnet -ETHEREUM_NETWORK=goerli \ No newline at end of file +# The Ethereum Network which CLI should interact with: ganache, polygon, mainnet +ETHEREUM_NETWORK=polygon \ No newline at end of file diff --git a/README.md b/README.md index 665e9a4..4eb67d0 100644 --- a/README.md +++ b/README.md @@ -34,14 +34,14 @@ DEBUG=false # The API that you are using to connect to Ethereum Blockchain # # ALCHEMY Mainnet: https://eth-mainnet.alchemyapi.io/v2/[YOUR_ALCHEMY_API_KEY] -# ALCHEMY Goerli: https://eth-goerli.alchemyapi.io/v2/[YOUR_ALCHEMY_API_KEY] +# ALCHEMY Polygon: https://polygon-mainnet.alchemyapi.io/v2/[YOUR_ALCHEMY_API_KEY] # # INFURA Mainnet: https://mainnet.infura.io/v3/[YOUR_INFURA_API_KEY] -# INFURA Goerli: https://goerli.infura.io/v3/[YOUR_INFURA_API_KEY] +# INFURA Polygon: https://polygon-mainnet.io/v3/[YOUR_INFURA_API_KEY] ETHEREUM_BLOCKCHAIN_API=... ## -# The Ethereum Network which CLI should interact with: ganache, goerli, mainnet +# The Ethereum Network which CLI should interact with: ganache, polygon, mainnet ETHEREUM_NETWORK=.. ## diff --git a/hardhat.config.js b/hardhat.config.js index dfb9848..9630f89 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -13,9 +13,9 @@ module.exports = { path: "m/44'/60'/0'/0", }, }, - goerli: { + polygon: { url: configs.ethBlockchainApi, - network_id: 5, + network_id: 137, skipDryRun: true, networkCheckTimeout: 10000, deploymentPollingInterval: 10000, diff --git a/src/utils/contract.js b/src/utils/contract.js index d5e1ca9..2580d24 100644 --- a/src/utils/contract.js +++ b/src/utils/contract.js @@ -24,7 +24,7 @@ const getProvider = (network) => { throw new Error("Unable to get the provider due to invalid network"); switch (network) { - case "goerli": + case "polygon": case "mainnet": { if (configs.alchemyApiKey) return new ethers.providers.AlchemyProvider(