@ethereansos/interfaces-core 0.4.115 → 0.4.118
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs.js +81 -56
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +81 -56
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -48914,8 +48914,8 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
48914
48914
|
|
48915
48915
|
if (wallet && wallet.ethereum || dualProvider) {
|
48916
48916
|
setIntervalId(setInterval(function () {
|
48917
|
-
tryUpdateBlock(wallet.ethereum, block, setBlock);
|
48918
|
-
tryUpdateBlock(dualProvider, dualBlock, setDualBlock);
|
48917
|
+
wallet && wallet.ethereum && tryUpdateBlock(wallet.ethereum, block, setBlock);
|
48918
|
+
dualProvider && tryUpdateBlock(dualProvider, dualBlock, setDualBlock);
|
48919
48919
|
}, realBlockIntervalTimeout));
|
48920
48920
|
}
|
48921
48921
|
}, [wallet, dualProvider, realBlockIntervalTimeout, intervalId]);
|
@@ -64416,12 +64416,12 @@ function getTokenPricesInDollarsOnCoingecko(_x4, _x5) {
|
|
64416
64416
|
}
|
64417
64417
|
|
64418
64418
|
function _getTokenPricesInDollarsOnCoingecko() {
|
64419
|
-
_getTokenPricesInDollarsOnCoingecko = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function
|
64419
|
+
_getTokenPricesInDollarsOnCoingecko = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(_ref2, t) {
|
64420
64420
|
var context, web3Data, tokens, response, tkns, _iterator2, _step2, token, prom, _i, _tkns, _i2, _tkns2, _iterator3, _step3;
|
64421
64421
|
|
64422
|
-
return regeneratorRuntime.wrap(function
|
64422
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
64423
64423
|
while (1) {
|
64424
|
-
switch (
|
64424
|
+
switch (_context4.prev = _context4.next) {
|
64425
64425
|
case 0:
|
64426
64426
|
context = _ref2.context, web3Data = _ref2.web3Data;
|
64427
64427
|
tokens = (!(t instanceof Array) ? t = t.split(',') : t).map(function (it) {
|
@@ -64432,139 +64432,164 @@ function _getTokenPricesInDollarsOnCoingecko() {
|
|
64432
64432
|
};
|
64433
64433
|
tkns = [];
|
64434
64434
|
_iterator2 = _createForOfIteratorHelper(tokens);
|
64435
|
-
|
64435
|
+
_context4.prev = 5;
|
64436
64436
|
|
64437
64437
|
_iterator2.s();
|
64438
64438
|
|
64439
64439
|
case 7:
|
64440
64440
|
if ((_step2 = _iterator2.n()).done) {
|
64441
|
-
|
64441
|
+
_context4.next = 29;
|
64442
64442
|
break;
|
64443
64443
|
}
|
64444
64444
|
|
64445
64445
|
token = _step2.value;
|
64446
64446
|
|
64447
64447
|
if (!(!token || token === VOID_ETHEREUM_ADDRESS)) {
|
64448
|
-
|
64448
|
+
_context4.next = 14;
|
64449
64449
|
break;
|
64450
64450
|
}
|
64451
64451
|
|
64452
|
-
|
64452
|
+
_context4.next = 12;
|
64453
64453
|
return getEthereumPrice({
|
64454
64454
|
context: context
|
64455
64455
|
});
|
64456
64456
|
|
64457
64457
|
case 12:
|
64458
|
-
response.data[token] =
|
64459
|
-
return
|
64458
|
+
response.data[token] = _context4.sent;
|
64459
|
+
return _context4.abrupt("continue", 27);
|
64460
64460
|
|
64461
64461
|
case 14:
|
64462
64462
|
if (!(tokenPrices[token] && tokenPrices[token].requestExpires > new Date().getTime() && tokenPrices[token].price !== 0)) {
|
64463
|
-
|
64463
|
+
_context4.next = 18;
|
64464
64464
|
break;
|
64465
64465
|
}
|
64466
64466
|
|
64467
64467
|
response.data[token] = {
|
64468
64468
|
usd: tokenPrices[token].price
|
64469
64469
|
};
|
64470
|
-
|
64470
|
+
_context4.next = 27;
|
64471
64471
|
break;
|
64472
64472
|
|
64473
64473
|
case 18:
|
64474
64474
|
if (!tokenPricesPromises[token]) {
|
64475
|
-
|
64475
|
+
_context4.next = 26;
|
64476
64476
|
break;
|
64477
64477
|
}
|
64478
64478
|
|
64479
|
-
|
64479
|
+
_context4.next = 21;
|
64480
64480
|
return tokenPricesPromises[token];
|
64481
64481
|
|
64482
64482
|
case 21:
|
64483
|
-
|
64484
|
-
|
64483
|
+
_context4.t0 = token;
|
64484
|
+
_context4.t1 = _context4.sent.data[_context4.t0].usd;
|
64485
64485
|
response.data[token] = {
|
64486
|
-
usd:
|
64486
|
+
usd: _context4.t1
|
64487
64487
|
};
|
64488
|
-
|
64488
|
+
_context4.next = 27;
|
64489
64489
|
break;
|
64490
64490
|
|
64491
64491
|
case 26:
|
64492
64492
|
tkns.push(token);
|
64493
64493
|
|
64494
64494
|
case 27:
|
64495
|
-
|
64495
|
+
_context4.next = 7;
|
64496
64496
|
break;
|
64497
64497
|
|
64498
64498
|
case 29:
|
64499
|
-
|
64499
|
+
_context4.next = 34;
|
64500
64500
|
break;
|
64501
64501
|
|
64502
64502
|
case 31:
|
64503
|
-
|
64504
|
-
|
64503
|
+
_context4.prev = 31;
|
64504
|
+
_context4.t2 = _context4["catch"](5);
|
64505
64505
|
|
64506
|
-
_iterator2.e(
|
64506
|
+
_iterator2.e(_context4.t2);
|
64507
64507
|
|
64508
64508
|
case 34:
|
64509
|
-
|
64509
|
+
_context4.prev = 34;
|
64510
64510
|
|
64511
64511
|
_iterator2.f();
|
64512
64512
|
|
64513
|
-
return
|
64513
|
+
return _context4.finish(34);
|
64514
64514
|
|
64515
64515
|
case 37:
|
64516
64516
|
prom = /*#__PURE__*/function () {
|
64517
|
-
var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function
|
64517
|
+
var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(t1, t2) {
|
64518
64518
|
var res;
|
64519
|
-
return regeneratorRuntime.wrap(function
|
64519
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
64520
64520
|
while (1) {
|
64521
|
-
switch (
|
64521
|
+
switch (_context3.prev = _context3.next) {
|
64522
64522
|
case 0:
|
64523
64523
|
res = {
|
64524
64524
|
data: {}
|
64525
64525
|
};
|
64526
|
-
|
64527
|
-
|
64526
|
+
_context3.prev = 1;
|
64527
|
+
_context3.t0 = t1.length > 0;
|
64528
64528
|
|
64529
|
-
if (!
|
64530
|
-
|
64529
|
+
if (!_context3.t0) {
|
64530
|
+
_context3.next = 7;
|
64531
64531
|
break;
|
64532
64532
|
}
|
64533
64533
|
|
64534
|
-
|
64535
|
-
return
|
64534
|
+
_context3.next = 6;
|
64535
|
+
return Promise.all(context.coingeckoCoinPriceURLTemplates.map( /*#__PURE__*/function () {
|
64536
|
+
var _ref4 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(it) {
|
64537
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
64538
|
+
while (1) {
|
64539
|
+
switch (_context2.prev = _context2.next) {
|
64540
|
+
case 0:
|
64541
|
+
_context2.next = 2;
|
64542
|
+
return fetch(it + t1.join(','));
|
64543
|
+
|
64544
|
+
case 2:
|
64545
|
+
_context2.next = 4;
|
64546
|
+
return _context2.sent.json();
|
64547
|
+
|
64548
|
+
case 4:
|
64549
|
+
return _context2.abrupt("return", _context2.sent);
|
64550
|
+
|
64551
|
+
case 5:
|
64552
|
+
case "end":
|
64553
|
+
return _context2.stop();
|
64554
|
+
}
|
64555
|
+
}
|
64556
|
+
}, _callee2);
|
64557
|
+
}));
|
64558
|
+
|
64559
|
+
return function (_x8) {
|
64560
|
+
return _ref4.apply(this, arguments);
|
64561
|
+
};
|
64562
|
+
}()));
|
64536
64563
|
|
64537
64564
|
case 6:
|
64538
|
-
|
64539
|
-
|
64565
|
+
res.data = _context3.sent.reduce(function (acc, it) {
|
64566
|
+
return _objectSpread2(_objectSpread2({}, acc), it);
|
64567
|
+
}, {});
|
64540
64568
|
|
64541
|
-
case
|
64542
|
-
|
64569
|
+
case 7:
|
64570
|
+
_context3.next = 11;
|
64571
|
+
break;
|
64543
64572
|
|
64544
64573
|
case 9:
|
64545
|
-
|
64546
|
-
|
64574
|
+
_context3.prev = 9;
|
64575
|
+
_context3.t1 = _context3["catch"](1);
|
64547
64576
|
|
64548
64577
|
case 11:
|
64549
|
-
|
64550
|
-
_context2.t1 = _context2["catch"](1);
|
64551
|
-
|
64552
|
-
case 13:
|
64553
|
-
_context2.next = 15;
|
64578
|
+
_context3.next = 13;
|
64554
64579
|
return elaboratePrices({
|
64555
64580
|
context: context,
|
64556
64581
|
web3Data: web3Data
|
64557
64582
|
}, res, t2);
|
64558
64583
|
|
64559
|
-
case
|
64560
|
-
return
|
64584
|
+
case 13:
|
64585
|
+
return _context3.abrupt("return", _context3.sent);
|
64561
64586
|
|
64562
|
-
case
|
64587
|
+
case 14:
|
64563
64588
|
case "end":
|
64564
|
-
return
|
64589
|
+
return _context3.stop();
|
64565
64590
|
}
|
64566
64591
|
}
|
64567
|
-
},
|
64592
|
+
}, _callee3, null, [[1, 9]]);
|
64568
64593
|
}));
|
64569
64594
|
|
64570
64595
|
return function prom(_x6, _x7) {
|
@@ -64579,11 +64604,11 @@ function _getTokenPricesInDollarsOnCoingecko() {
|
|
64579
64604
|
tokenPricesPromises[token] = prom;
|
64580
64605
|
}
|
64581
64606
|
|
64582
|
-
|
64607
|
+
_context4.next = 42;
|
64583
64608
|
return prom;
|
64584
64609
|
|
64585
64610
|
case 42:
|
64586
|
-
prom =
|
64611
|
+
prom = _context4.sent;
|
64587
64612
|
Object.entries(prom.data).forEach(function (it) {
|
64588
64613
|
return response.data[it[0]] = it[1];
|
64589
64614
|
});
|
@@ -64609,14 +64634,14 @@ function _getTokenPricesInDollarsOnCoingecko() {
|
|
64609
64634
|
_iterator3.f();
|
64610
64635
|
}
|
64611
64636
|
|
64612
|
-
return
|
64637
|
+
return _context4.abrupt("return", response);
|
64613
64638
|
|
64614
64639
|
case 48:
|
64615
64640
|
case "end":
|
64616
|
-
return
|
64641
|
+
return _context4.stop();
|
64617
64642
|
}
|
64618
64643
|
}
|
64619
|
-
},
|
64644
|
+
}, _callee4, null, [[5, 31, 34, 37]]);
|
64620
64645
|
}));
|
64621
64646
|
return _getTokenPricesInDollarsOnCoingecko.apply(this, arguments);
|
64622
64647
|
}
|