Skip to content

Commit

Permalink
Merge pull request #45 from dwhiffing/polygonscan-patch-amoy
Browse files Browse the repository at this point in the history
Adds polygonscan-api patch to add amoy support and fixes other polygon issues
  • Loading branch information
dwhiffing authored Sep 5, 2024
2 parents b167603 + d501cec commit 13d2818
Show file tree
Hide file tree
Showing 6 changed files with 271 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ KV_URL="Retrieved from vercel"
OPENAI_API_KEY="YOUR_API_KEY"

ETHERSCAN_API_KEY="Your etherscan api key"

RPC_URL="Your RPC url"
POLYGONSCAN_API_KEY="Your polygonscan api key"
ALCHEMY_API_KEY="Your alchemy api key"
9 changes: 8 additions & 1 deletion constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@ export const CHAINS = {
11155111: {
name: "ETH Sepolia",
explorerURI: "https://sepolia.etherscan.io/tx/",
rpcURI: "https://eth-sepolia.g.alchemy.com/v2/",
},
1: {
name: "ETH Mainnet",
explorerURI: "https://etherscan.io/tx/",
rpcURI: "https://eth-mainnet.g.alchemy.com/v2/",
},
1: { name: "ETH Mainnet", explorerURI: "https://etherscan.io/tx/" },
137: {
name: "POLY Mainnet",
explorerURI: "https://polygonscan.com/tx/",
rpcURI: "https://polygon-mainnet.g.alchemy.com/v2/",
},
80002: {
name: "POLY Amoy",
explorerURI: "https://amoy.polygonscan.com/tx/",
rpcURI: "https://polygon-amoy.g.alchemy.com/v2/",
},
};

Expand Down
229 changes: 229 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"postinstall": "patch-package",
"format": "prettier --write \"app\""
},
"engines": {
Expand Down Expand Up @@ -58,6 +59,7 @@
},
"devDependencies": {
"abitype": "^1.0.6",
"patch-package": "^8.0.0",
"prettier": "3.0.0"
},
"resolutions": {
Expand Down
13 changes: 13 additions & 0 deletions patches/polygonscan-api+1.0.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/polygonscan-api/lib/get-request.js b/node_modules/polygonscan-api/lib/get-request.js
index be397d5..8d0cd9d 100755
--- a/node_modules/polygonscan-api/lib/get-request.js
+++ b/node_modules/polygonscan-api/lib/get-request.js
@@ -15,7 +15,7 @@ function pickChainUrl(chain) {

const MAIN_API_URL = 'https://api.polygonscan.com';
const TESTNET_API_URL_MAP = {
- mumbai: 'https://api-testnet.polygonscan.com',
+ amoy: 'https://api-amoy.polygonscan.com',
};

module.exports = function(chain, timeout) {
Loading

0 comments on commit 13d2818

Please sign in to comment.