From 84c295208a9378b7f7e4dbb3eef7b8f70d0b285d Mon Sep 17 00:00:00 2001 From: Nicholas Addison Date: Sun, 6 Nov 2022 16:56:34 +1100 Subject: [PATCH] chore: added gnosis chain --- README.md | 2 +- lib/parserEtherscan.d.ts | 2 +- lib/parserEtherscan.js | 5 +++++ lib/sol2uml.js | 2 +- src/ts/parserEtherscan.ts | 4 ++++ src/ts/sol2uml.ts | 2 +- 6 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 141d595b..1c70e0f4 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Options: -f, --outputFormat output file format. (choices: "svg", "png", "dot", "all", default: "svg") -o, --outputFileName output file name -i, --ignoreFilesOrFolders comma separated list of files or folders to ignore - -n, --network Ethereum network (choices: "mainnet", "ropsten", "kovan", "rinkeby", "goerli", "sepolia", "polygon", "testnet.polygon", "arbitrum", "testnet.arbitrum", "avalanche", "testnet.avalanche", "bsc", "testnet.bsc", "crono", "fantom", "testnet.fantom", "moonbeam", "optimistic", "kovan-optimistic", default: "mainnet", env: ETH_NETWORK) + -n, --network Ethereum network (choices: "mainnet", "ropsten", "kovan", "rinkeby", "goerli", "sepolia", "polygon", "testnet.polygon", "arbitrum", "testnet.arbitrum", "avalanche", "testnet.avalanche", "bsc", "testnet.bsc", "crono", "fantom", "testnet.fantom", "moonbeam", "optimistic", "kovan-optimistic", "gnosisscan", default: "mainnet", env: ETH_NETWORK) -k, --apiKey Blockchain explorer API key. eg Etherscan, Arbiscan, BscScan, CronoScan, FTMScan, PolygonScan or SnowTrace API key (env: SCAN_API_KEY) -v, --verbose run with debugging statements (default: false) -h, --help display help for command diff --git a/lib/parserEtherscan.d.ts b/lib/parserEtherscan.d.ts index 4b7a16d3..3d4e1084 100644 --- a/lib/parserEtherscan.d.ts +++ b/lib/parserEtherscan.d.ts @@ -1,6 +1,6 @@ import { ASTNode } from '@solidity-parser/parser/dist/src/ast-types'; import { UmlClass } from './umlClass'; -export declare const networks: readonly ["mainnet", "ropsten", "kovan", "rinkeby", "goerli", "sepolia", "polygon", "testnet.polygon", "arbitrum", "testnet.arbitrum", "avalanche", "testnet.avalanche", "bsc", "testnet.bsc", "crono", "fantom", "testnet.fantom", "moonbeam", "optimistic", "kovan-optimistic"]; +export declare const networks: readonly ["mainnet", "ropsten", "kovan", "rinkeby", "goerli", "sepolia", "polygon", "testnet.polygon", "arbitrum", "testnet.arbitrum", "avalanche", "testnet.avalanche", "bsc", "testnet.bsc", "crono", "fantom", "testnet.fantom", "moonbeam", "optimistic", "kovan-optimistic", "gnosisscan"]; declare type Network = typeof networks[number]; export declare class EtherscanParser { protected apikey: string; diff --git a/lib/parserEtherscan.js b/lib/parserEtherscan.js index 9fe4b47c..42d624bf 100644 --- a/lib/parserEtherscan.js +++ b/lib/parserEtherscan.js @@ -32,6 +32,7 @@ exports.networks = [ 'moonbeam', 'optimistic', 'kovan-optimistic', + 'gnosisscan', ]; class EtherscanParser { constructor(apikey = 'ZAD4UI2RCXCQTP38EXS3UY2MPHFU5H9KB1', network = 'mainnet') { @@ -95,6 +96,10 @@ class EtherscanParser { this.url = 'https://api-moonbeam.moonscan.io/api'; this.apikey = '5EUFXW6TDC16VERF3D9SCWRRU6AEMTBHNJ'; } + else if (network === 'gnosisscan') { + this.url = 'https://api.gnosisscan.io/api'; + this.apikey = '2RWGXIWK538EJ8XSP9DE2JUINSCG7UCSJB'; + } else { this.url = `https://api-${network}.etherscan.io/api`; } diff --git a/lib/sol2uml.js b/lib/sol2uml.js index c0dd840e..caf8da3e 100755 --- a/lib/sol2uml.js +++ b/lib/sol2uml.js @@ -37,7 +37,7 @@ The Solidity code can be pulled from verified source code on Blockchain explorer .choices(parserEtherscan_1.networks) .default('mainnet') .env('ETH_NETWORK')) - .addOption(new commander_1.Option('-k, --apiKey ', 'Blockchain explorer API key. eg Etherscan, Arbiscan, BscScan, CronoScan, FTMScan, PolygonScan or SnowTrace API key').env('SCAN_API_KEY')) + .addOption(new commander_1.Option('-k, --apiKey ', 'Blockchain explorer API key. eg Etherscan, Arbiscan, Optimism, BscScan, CronoScan, FTMScan, PolygonScan or SnowTrace API key').env('SCAN_API_KEY')) .option('-v, --verbose', 'run with debugging statements', false); program .command('class', { isDefault: true }) diff --git a/src/ts/parserEtherscan.ts b/src/ts/parserEtherscan.ts index de755b8b..89979b69 100644 --- a/src/ts/parserEtherscan.ts +++ b/src/ts/parserEtherscan.ts @@ -31,6 +31,7 @@ export const networks = [ 'moonbeam', 'optimistic', 'kovan-optimistic', + 'gnosisscan', ] type Network = typeof networks[number] @@ -86,6 +87,9 @@ export class EtherscanParser { } else if (network === 'moonbeam') { this.url = 'https://api-moonbeam.moonscan.io/api' this.apikey = '5EUFXW6TDC16VERF3D9SCWRRU6AEMTBHNJ' + } else if (network === 'gnosisscan') { + this.url = 'https://api.gnosisscan.io/api' + this.apikey = '2RWGXIWK538EJ8XSP9DE2JUINSCG7UCSJB' } else { this.url = `https://api-${network}.etherscan.io/api` } diff --git a/src/ts/sol2uml.ts b/src/ts/sol2uml.ts index ab496af1..2dc6b2d1 100644 --- a/src/ts/sol2uml.ts +++ b/src/ts/sol2uml.ts @@ -60,7 +60,7 @@ The Solidity code can be pulled from verified source code on Blockchain explorer .addOption( new Option( '-k, --apiKey ', - 'Blockchain explorer API key. eg Etherscan, Arbiscan, BscScan, CronoScan, FTMScan, PolygonScan or SnowTrace API key' + 'Blockchain explorer API key. eg Etherscan, Arbiscan, Optimism, BscScan, CronoScan, FTMScan, PolygonScan or SnowTrace API key' ).env('SCAN_API_KEY') ) .option('-v, --verbose', 'run with debugging statements', false)