From f2f60c698f7b3ff5cbda934ec953068bf40a5448 Mon Sep 17 00:00:00 2001 From: coco50511 Date: Wed, 19 Feb 2020 07:47:37 +0800 Subject: [PATCH 01/13] proxyUrl and headers have been added --- lib/get-request.js | 23 +++++++++++++++++++---- lib/init.js | 6 ++++-- package-lock.json | 41 +++++++++++------------------------------ 3 files changed, 34 insertions(+), 36 deletions(-) diff --git a/lib/get-request.js b/lib/get-request.js index c81c37b4..af0320d8 100644 --- a/lib/get-request.js +++ b/lib/get-request.js @@ -21,11 +21,26 @@ const TESTNET_API_URL_MAP = { homestead: 'https://api.etherscan.io' }; -module.exports = function(chain, timeout) { - var client = axios.create({ - baseURL: pickChainUrl(chain), +module.exports = function(chain, timeout, proxyUrl, headers) { + var param = { timeout: timeout - }); + }; + + var baseUrl = pickChainUrl(chain); + if (proxyUrl && 0 < proxyUrl.length) { + if (proxyUrl.charAt(proxyUrl.length - 1) == '/') { + baseUrl = proxyUrl + '/' + baseUrl; + } else { + baseUrl = proxyUrl + baseUrl; + } + } + param[baseUrl] = baseUrl; + + if (headers) { + param[headers] = headers; + } + + var client = axios.create(param); /** * @param query diff --git a/lib/init.js b/lib/init.js index 986a90e4..c4ce1325 100644 --- a/lib/init.js +++ b/lib/init.js @@ -14,8 +14,10 @@ const account = require('./account'); * @param {string} apiKey - (optional) Your Etherscan APIkey * @param {string} chain - (optional) Testnet chain keys [ropsten, rinkeby, kovan] * @param {number} timeout - (optional) Timeout in milliseconds for requests, default 10000 + * @param {string} proxyUrl - (optional) The URL of proxy server to avoid CORS + * @param {object} headers - (optional) The object containing custom headers */ -module.exports = function(apiKey, chain, timeout) { +module.exports = function(apiKey, chain, timeout, proxyUrl, headers) { if (!apiKey) { apiKey = 'YourApiKeyToken'; @@ -26,7 +28,7 @@ module.exports = function(apiKey, chain, timeout) { timeout = 10000; } - var getRequest = require('./get-request')(chain, timeout); + var getRequest = require('./get-request')(chain, timeout, proxyUrl, headers); /** @lends module:etherscan/api */ return { diff --git a/package-lock.json b/package-lock.json index bdfc2d94..a7789c51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3315,8 +3315,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -3337,14 +3336,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3359,20 +3356,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -3489,8 +3483,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -3502,7 +3495,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3517,7 +3509,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3525,14 +3516,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -3551,7 +3540,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -3632,8 +3620,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -3645,7 +3632,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -3731,8 +3717,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -3768,7 +3753,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -3788,7 +3772,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -3832,14 +3815,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, From 9211df269e0757afba9c267e2e5a59e00d170055 Mon Sep 17 00:00:00 2001 From: coco50511 Date: Wed, 19 Feb 2020 07:52:41 +0800 Subject: [PATCH 02/13] bundle --- dist/bundle.js | 53 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/dist/bundle.js b/dist/bundle.js index 062e6482..0ec48754 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -94,14 +94,17 @@ module.exports = function(getRequest, apiKey) { if (!startblock) { startblock = 0; } + queryObject.startblock = startblock; if (!endblock) { endblock = 'latest'; } + queryObject.endblock = endblock; if (!sort) { sort = 'asc'; } + queryObject.sort = sort; if (txhash) { queryObject.txhash = txhash; @@ -174,13 +177,15 @@ module.exports = function(getRequest, apiKey) { * @param {string} address - Account address * @param {string} startblock - start looking here * @param {string} endblock - end looking there - * @param {string} sort - Sort asc/desc + * @param {number} page - Page number + * @param {number} offset - Max records to return + * @param {string} sort - Sort asc/desc * @param {string} contractaddress - Address of ERC20 token contract (if not specified lists transfers for all tokens) * @example * var txlist = api.account.tokentx('0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae', '0x5F988D968cb76c34C87e6924Cc1Ef1dCd4dE75da', 1, 'latest', 'asc'); * @returns {Promise.} */ - tokentx(address, contractaddress, startblock, endblock, sort) { + tokentx(address, contractaddress, startblock, endblock, page, offset, sort) { const module = 'account'; const action = 'tokentx'; @@ -192,12 +197,20 @@ module.exports = function(getRequest, apiKey) { endblock = 'latest'; } + if (!page) { + page = 1; + } + + if (!offset) { + offset = 100; + } + if (!sort) { sort = 'asc'; } var queryObject = { - module, action, startblock, endblock, sort, address, apiKey + module, action, startblock, endblock, page, offset, sort, address, apiKey }; if (contractaddress) { @@ -285,11 +298,26 @@ const TESTNET_API_URL_MAP = { homestead: 'https://api.etherscan.io' }; -module.exports = function(chain, timeout) { - var client = axios.create({ - baseURL: pickChainUrl(chain), +module.exports = function(chain, timeout, proxyUrl, headers) { + var param = { timeout: timeout - }); + }; + + var baseUrl = pickChainUrl(chain); + if (proxyUrl && 0 < proxyUrl.length) { + if (proxyUrl.charAt(proxyUrl.length - 1) == '/') { + baseUrl = proxyUrl + '/' + baseUrl; + } else { + baseUrl = proxyUrl + baseUrl; + } + } + param[baseUrl] = baseUrl; + + if (headers) { + param[headers] = headers; + } + + var client = axios.create(param); /** * @param query @@ -301,10 +329,13 @@ module.exports = function(chain, timeout) { var data = response.data; if (data.status && data.status != 1) { - let returnMessage = 'NOTOK'; + let returnMessage = data.message ||'NOTOK'; if (data.result && typeof data.result === 'string') { returnMessage = data.result; + } else if (data.message && typeof data.message === 'string') { + returnMessage = data.message; } + return reject(returnMessage); } @@ -345,8 +376,10 @@ const account = require('./account'); * @param {string} apiKey - (optional) Your Etherscan APIkey * @param {string} chain - (optional) Testnet chain keys [ropsten, rinkeby, kovan] * @param {number} timeout - (optional) Timeout in milliseconds for requests, default 10000 + * @param {string} proxyUrl - (optional) The URL of proxy server to avoid CORS + * @param {object} headers - (optional) The object containing custom headers */ -module.exports = function(apiKey, chain, timeout) { +module.exports = function(apiKey, chain, timeout, proxyUrl, headers) { if (!apiKey) { apiKey = 'YourApiKeyToken'; @@ -357,7 +390,7 @@ module.exports = function(apiKey, chain, timeout) { timeout = 10000; } - var getRequest = require('./get-request')(chain, timeout); + var getRequest = require('./get-request')(chain, timeout, proxyUrl, headers); /** @lends module:etherscan/api */ return { From 0a7f27e8f8070812639233d1620d4ab3c1f5eb67 Mon Sep 17 00:00:00 2001 From: coco50511 Date: Wed, 19 Feb 2020 08:16:08 +0800 Subject: [PATCH 03/13] bundle --- dist/bundle.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/bundle.js b/dist/bundle.js index 0ec48754..03bd3178 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -306,15 +306,15 @@ module.exports = function(chain, timeout, proxyUrl, headers) { var baseUrl = pickChainUrl(chain); if (proxyUrl && 0 < proxyUrl.length) { if (proxyUrl.charAt(proxyUrl.length - 1) == '/') { - baseUrl = proxyUrl + '/' + baseUrl; - } else { baseUrl = proxyUrl + baseUrl; + } else { + baseUrl = proxyUrl + '/' + baseUrl; } } - param[baseUrl] = baseUrl; + param['baseUrl'] = baseUrl; if (headers) { - param[headers] = headers; + param['headers'] = headers; } var client = axios.create(param); From 01cca79422830fafea942f09ff5d28f7cd959443 Mon Sep 17 00:00:00 2001 From: coco50511 Date: Wed, 19 Feb 2020 08:20:03 +0800 Subject: [PATCH 04/13] Fixed an error --- lib/get-request.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/get-request.js b/lib/get-request.js index af0320d8..d6c89fb7 100644 --- a/lib/get-request.js +++ b/lib/get-request.js @@ -29,15 +29,15 @@ module.exports = function(chain, timeout, proxyUrl, headers) { var baseUrl = pickChainUrl(chain); if (proxyUrl && 0 < proxyUrl.length) { if (proxyUrl.charAt(proxyUrl.length - 1) == '/') { - baseUrl = proxyUrl + '/' + baseUrl; - } else { baseUrl = proxyUrl + baseUrl; + } else { + baseUrl = proxyUrl + '/' + baseUrl; } } - param[baseUrl] = baseUrl; + param['baseURL'] = baseUrl; if (headers) { - param[headers] = headers; + param['headers'] = headers; } var client = axios.create(param); From 1afb9ad167882b02088dabc0d2768c4df92ba5fd Mon Sep 17 00:00:00 2001 From: coco50511 Date: Wed, 19 Feb 2020 08:20:21 +0800 Subject: [PATCH 05/13] bundle --- dist/bundle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/bundle.js b/dist/bundle.js index 03bd3178..e5608055 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -311,7 +311,7 @@ module.exports = function(chain, timeout, proxyUrl, headers) { baseUrl = proxyUrl + '/' + baseUrl; } } - param['baseUrl'] = baseUrl; + param['baseURL'] = baseUrl; if (headers) { param['headers'] = headers; From f639e6683f86236cc5a9028aec1df24945724abb Mon Sep 17 00:00:00 2001 From: coco50511 Date: Wed, 19 Feb 2020 08:33:49 +0800 Subject: [PATCH 06/13] README has been updated --- Readme.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 41f58999..514de1f1 100644 --- a/Readme.md +++ b/Readme.md @@ -1,5 +1,8 @@ # Etherscan API +It forked from [etherscan-api 10.0.5](https://github.com/sebs/etherscan-api/tree/v10.0.5) +The proxy URL and header have been added to avoid CORS. + ## Development of a NEXTGEN Version has started - please stand by [![npm](https://img.shields.io/npm/dt/etherscan-api.svg)](https://www.npmjs.com/package/etherscan-api) @@ -35,15 +38,15 @@ Supported: Latest ```javascript -// apikey, network, timeout -var api = require('etherscan-api').init('YourApiKey','rinkeby'. '3000'); +// apikey, network, timeout, proxyUrl, headers +var api = require('etherscan-api').init('YourApiKey','rinkeby'. '3000', 'https://cors-anywhere.herokuapp.com/', {'x-requested-with': 'me'}); ``` ## Install ```bash - npm install etherscan-api --save + npm install https://github.com/luckyCoco3418/etherscan-api.git ``` From 9748cd20cea503e5b9fddc1340c386604f16badc Mon Sep 17 00:00:00 2001 From: coco50511 Date: Wed, 19 Feb 2020 08:35:06 +0800 Subject: [PATCH 07/13] README has been updated --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 514de1f1..2eea9467 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,6 @@ # Etherscan API -It forked from [etherscan-api 10.0.5](https://github.com/sebs/etherscan-api/tree/v10.0.5) +It forked from [etherscan-api 10.0.5](https://github.com/sebs/etherscan-api/tree/v10.0.5)
The proxy URL and header have been added to avoid CORS. ## Development of a NEXTGEN Version has started - please stand by From 82efedbf20699a3c80ef0c9348fa132cf400843c Mon Sep 17 00:00:00 2001 From: coco50511 Date: Wed, 19 Feb 2020 08:35:21 +0800 Subject: [PATCH 08/13] README has been updated --- Readme.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 2eea9467..1082a335 100644 --- a/Readme.md +++ b/Readme.md @@ -39,7 +39,9 @@ Latest ```javascript // apikey, network, timeout, proxyUrl, headers -var api = require('etherscan-api').init('YourApiKey','rinkeby'. '3000', 'https://cors-anywhere.herokuapp.com/', {'x-requested-with': 'me'}); +var api = require('etherscan-api').init('YourApiKey','rinkeby'. '3000', 'https://cors-anywhere.herokuapp.com/', { + 'x-requested-with': 'me' +}); ``` From f20540c022e7ad2eaf7d7f4fa943c870a27344aa Mon Sep 17 00:00:00 2001 From: coco50511 Date: Tue, 23 Mar 2021 21:10:55 +0800 Subject: [PATCH 09/13] bundle --- dist/bundle.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dist/bundle.js b/dist/bundle.js index e5608055..34b56327 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -295,7 +295,9 @@ const TESTNET_API_URL_MAP = { ropsten: 'https://api-ropsten.etherscan.io', kovan: 'https://api-kovan.etherscan.io', rinkeby: 'https://api-rinkeby.etherscan.io', - homestead: 'https://api.etherscan.io' + homestead: 'https://api.etherscan.io', + heco_mainnet: 'https://api.hecoinfo.com', + heco_testnet: 'https://api-testnet.hecoinfo.com', }; module.exports = function(chain, timeout, proxyUrl, headers) { From 43d6ec6f46191e0d740c3acfbeeb986f4dfb3bb5 Mon Sep 17 00:00:00 2001 From: coco50511 Date: Tue, 23 Mar 2021 21:17:03 +0800 Subject: [PATCH 10/13] heco added --- Readme.md | 2 ++ lib/get-request.js | 4 +++- package-lock.json | 41 ++++++++++++++++++++++++++++++----------- package.json | 2 +- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/Readme.md b/Readme.md index 1082a335..348dcd06 100644 --- a/Readme.md +++ b/Readme.md @@ -34,6 +34,8 @@ Supported: * morden * ropsten * rinkeby +* heco_mainnet +* heco_testnet Latest diff --git a/lib/get-request.js b/lib/get-request.js index d6c89fb7..2a9d9796 100644 --- a/lib/get-request.js +++ b/lib/get-request.js @@ -18,7 +18,9 @@ const TESTNET_API_URL_MAP = { ropsten: 'https://api-ropsten.etherscan.io', kovan: 'https://api-kovan.etherscan.io', rinkeby: 'https://api-rinkeby.etherscan.io', - homestead: 'https://api.etherscan.io' + homestead: 'https://api.etherscan.io', + heco_mainnet: 'https://api.hecoinfo.com', + heco_testnet: 'https://api-testnet.hecoinfo.com', }; module.exports = function(chain, timeout, proxyUrl, headers) { diff --git a/package-lock.json b/package-lock.json index a7789c51..bdfc2d94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3315,7 +3315,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -3336,12 +3337,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3356,17 +3359,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3483,7 +3489,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3495,6 +3502,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3509,6 +3517,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3516,12 +3525,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -3540,6 +3551,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -3620,7 +3632,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -3632,6 +3645,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -3717,7 +3731,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -3753,6 +3768,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -3772,6 +3788,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -3815,12 +3832,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, diff --git a/package.json b/package.json index 7934a981..e1cef449 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "posttest": "npm run lint", "lint": "jshint lib test", "docs": "documentation build ./lib/init.js -f html -o out", - "bundle": "browserify index.js -s etherscanApi -o dist/bundle.js && git commit ./dist -m bundle && git push", + "bundle": "npx browserify index.js -s etherscanApi -o dist/bundle.js && git commit ./dist -m bundle && git push", "preversion": "npm run lint && npm run changelog", "postversion": "git push && git push --tags", "changelog": "rm ./docs/CHANGELOG.md && changelog https://github.com/sebs/etherscan-api all > ./docs/CHANGELOG.md && git add ./docs/CHANGELOG.md && git commit ./docs/CHANGELOG.md -m changelog", From c028a145caf519167c6e7169e084d2d0781a1fff Mon Sep 17 00:00:00 2001 From: coco50511 Date: Wed, 24 Mar 2021 02:46:24 +0800 Subject: [PATCH 11/13] npm published --- package.json | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index e1cef449..8a5dbfd5 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "etherscan-api", + "name": "etherscan-api-e", "version": "10.0.5", "description": "API to etherscan with a simple interface", "main": "index.js", @@ -25,14 +25,10 @@ ], "repository": { "type": "git", - "url": "git+https://github.com/sebs/etherscan-api.git" + "url": "git+https://github.com/luckyCoco3418/etherscan-api.git" }, - "author": "", + "author": "luckycoco3418", "license": "ISC", - "bugs": { - "url": "https://github.com/sebs/etherscan-api/issues" - }, - "homepage": "https://github.com/sebs/etherscan-api#readme", "devDependencies": { "browserify": "^16.5.0", "chai": "^4.2.0", From 9d26ab08b0189ecbf59c0c606feec0469eb508aa Mon Sep 17 00:00:00 2001 From: coco50511 Date: Wed, 28 Apr 2021 08:15:41 +0800 Subject: [PATCH 12/13] bundle --- dist/bundle.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/bundle.js b/dist/bundle.js index 34b56327..c1d28602 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -298,6 +298,8 @@ const TESTNET_API_URL_MAP = { homestead: 'https://api.etherscan.io', heco_mainnet: 'https://api.hecoinfo.com', heco_testnet: 'https://api-testnet.hecoinfo.com', + bsc_mainnet: 'https://api.bscscan.com', + bsc_testnet: 'https://api-testnet.bscscan.com', }; module.exports = function(chain, timeout, proxyUrl, headers) { From 6a55ef6867b97d6ad2bb93db6b400ad25b7cc6f8 Mon Sep 17 00:00:00 2001 From: coco50511 Date: Fri, 30 Apr 2021 03:50:28 +0800 Subject: [PATCH 13/13] BSC added --- Readme.md | 2 ++ dist/bundle.js | 2 ++ lib/get-request.js | 2 ++ package.json | 4 ++-- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 348dcd06..85ad2791 100644 --- a/Readme.md +++ b/Readme.md @@ -36,6 +36,8 @@ Supported: * rinkeby * heco_mainnet * heco_testnet +* bsc_mainnet +* bsc_testnet Latest diff --git a/dist/bundle.js b/dist/bundle.js index 34b56327..c1d28602 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -298,6 +298,8 @@ const TESTNET_API_URL_MAP = { homestead: 'https://api.etherscan.io', heco_mainnet: 'https://api.hecoinfo.com', heco_testnet: 'https://api-testnet.hecoinfo.com', + bsc_mainnet: 'https://api.bscscan.com', + bsc_testnet: 'https://api-testnet.bscscan.com', }; module.exports = function(chain, timeout, proxyUrl, headers) { diff --git a/lib/get-request.js b/lib/get-request.js index 2a9d9796..dfa5756c 100644 --- a/lib/get-request.js +++ b/lib/get-request.js @@ -21,6 +21,8 @@ const TESTNET_API_URL_MAP = { homestead: 'https://api.etherscan.io', heco_mainnet: 'https://api.hecoinfo.com', heco_testnet: 'https://api-testnet.hecoinfo.com', + bsc_mainnet: 'https://api.bscscan.com', + bsc_testnet: 'https://api-testnet.bscscan.com', }; module.exports = function(chain, timeout, proxyUrl, headers) { diff --git a/package.json b/package.json index e1cef449..7897c628 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "etherscan-api", - "version": "10.0.5", + "name": "etherscan-api-e", + "version": "10.0.6", "description": "API to etherscan with a simple interface", "main": "index.js", "scripts": {