Skip to content

Commit 10c4273

Browse files
Migrate etherscan api to v2.
1 parent 2467725 commit 10c4273

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

js/history.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ var pageType = 'history';
10581058
unpacked.name != 'Sell' &&
10591059
unpacked.name != 'FillBuyOrder' &&
10601060
unpacked.name != 'FillSellOrder' &&
1061-
unpacked.name != 'Match'
1061+
unpacked.name != 'Match'
10621062
)
10631063
) {
10641064
continue;
@@ -1181,8 +1181,8 @@ var pageType = 'history';
11811181
}
11821182

11831183

1184-
let txListUrl = 'https://api.etherscan.io/api?module=account&action=txlist&address=';
1185-
let tokenListUrl = 'https://api.etherscan.io/api?module=account&action=tokentx&address=';
1184+
let txListUrl = 'https://api.etherscan.io/v2/api?chainid=1&module=account&action=txlist&address=';
1185+
let tokenListUrl = 'https://api.etherscan.io/v2/api?chainid=1&module=account&action=tokentx&address=';
11861186

11871187
getEtherscanTx(txListUrl, 'txlist');
11881188
// also get incoming token transfers from maker trades

js/recent.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ var pageType = 'recent';
525525

526526
//get a list of recent outgoing tx from etherscan
527527
function normalTransactions() {
528-
$.getJSON('https://api.etherscan.io/api?module=account&action=txlist&address=' + publicAddr + '&startblock=' + startblock + '&endblock=' + endblock + '&sort=desc&apikey=' + _delta.config.etherscanAPIKey).done((result) => {
528+
$.getJSON('https://api.etherscan.io/v2/api?chainid=1&module=account&action=txlist&address=' + publicAddr + '&startblock=' + startblock + '&endblock=' + endblock + '&sort=desc&apikey=' + _delta.config.etherscanAPIKey).done((result) => {
529529
if (requestID > rqid)
530530
return;
531531
if (result && result.status === '1')
@@ -549,7 +549,7 @@ var pageType = 'recent';
549549

550550

551551
function tokenTransactions() {
552-
$.getJSON('https://api.etherscan.io/api?module=account&action=tokentx&address=' + publicAddr + '&startblock=' + startblock + '&endblock=' + endblock + '&sort=desc&apikey=' + _delta.config.etherscanAPIKey).done((result) => {
552+
$.getJSON('https://api.etherscan.io/v2/api?chainid=1&module=account&action=tokentx&address=' + publicAddr + '&startblock=' + startblock + '&endblock=' + endblock + '&sort=desc&apikey=' + _delta.config.etherscanAPIKey).done((result) => {
553553
if (requestID > rqid)
554554
return;
555555
if (result && result.status === '1')
@@ -574,7 +574,7 @@ var pageType = 'recent';
574574

575575
function internalTransactions() {
576576
// internal ether transactions (withdraw)
577-
$.getJSON('https://api.etherscan.io/api?module=account&action=txlistinternal&address=' + publicAddr + '&startblock=' + startblock + '&endblock=' + endblock + '&sort=desc&apikey=' + _delta.config.etherscanAPIKey).done((result2) => {
577+
$.getJSON('https://api.etherscan.io/v2/api?chainid=1&module=account&action=txlistinternal&address=' + publicAddr + '&startblock=' + startblock + '&endblock=' + endblock + '&sort=desc&apikey=' + _delta.config.etherscanAPIKey).done((result2) => {
578578
if (requestID > rqid)
579579
return;
580580
if (result2 && result2.status === '1')

js/tx.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ var pageType = 'tx';
360360
}
361361

362362
function getTxStatus() {
363-
_util.getURL('https://api.etherscan.io/api?module=transaction&action=getstatus&txhash=' + transactionHash + '&apikey=' + _delta.config.etherscanAPIKey, (err, result) => {
363+
_util.getURL('https://api.etherscan.io/v2/api?chainid=1&module=transaction&action=getstatus&txhash=' + transactionHash + '&apikey=' + _delta.config.etherscanAPIKey, (err, result) => {
364364

365365
if (!err && result) {
366366
if (result && result.status === '1')
@@ -374,7 +374,7 @@ var pageType = 'tx';
374374
}
375375

376376
function getInternal() {
377-
_util.getURL('https://api.etherscan.io/api?module=account&action=txlistinternal&txhash=' + transactionHash + '&apikey=' + _delta.config.etherscanAPIKey, (err, result) => {
377+
_util.getURL('https://api.etherscan.io/v2/api?chainid=1&module=account&action=txlistinternal&txhash=' + transactionHash + '&apikey=' + _delta.config.etherscanAPIKey, (err, result) => {
378378
if (!isPending) {
379379
if (!err && result) {
380380
if (result && result.status === '1')

0 commit comments

Comments
 (0)