@ethereansos/interfaces-core 0.4.114 → 0.4.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +85 -58
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +85 -58
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -48922,10 +48922,14 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
|
|
|
48922
48922
|
var resetBlockInterval = React.useCallback(function () {
|
|
48923
48923
|
intervalId && clearInterval(intervalId);
|
|
48924
48924
|
tryUpdateBlock(wallet === null || wallet === void 0 ? void 0 : wallet.ethereum, block, setBlock, true);
|
|
48925
|
-
tryUpdateBlock(dualProvider, dualBlock, setDualBlock, true)
|
|
48926
|
-
|
|
48927
|
-
|
|
48928
|
-
|
|
48925
|
+
tryUpdateBlock(dualProvider, dualBlock, setDualBlock, true);
|
|
48926
|
+
|
|
48927
|
+
if (wallet && wallet.ethereum || dualProvider) {
|
|
48928
|
+
setIntervalId(setInterval(function () {
|
|
48929
|
+
wallet && wallet.ethereum && tryUpdateBlock(wallet.ethereum, block, setBlock);
|
|
48930
|
+
dualProvider && tryUpdateBlock(dualProvider, dualBlock, setDualBlock);
|
|
48931
|
+
}, realBlockIntervalTimeout));
|
|
48932
|
+
}
|
|
48929
48933
|
}, [wallet, dualProvider, realBlockIntervalTimeout, intervalId]);
|
|
48930
48934
|
React.useEffect(resetBlockInterval, [realBlockInterval, realBlockIntervalTimeout, wallet && wallet.ethereum, dualProvider]);
|
|
48931
48935
|
React.useEffect(function () {
|
|
@@ -64424,12 +64428,12 @@ function getTokenPricesInDollarsOnCoingecko(_x4, _x5) {
|
|
|
64424
64428
|
}
|
|
64425
64429
|
|
|
64426
64430
|
function _getTokenPricesInDollarsOnCoingecko() {
|
|
64427
|
-
_getTokenPricesInDollarsOnCoingecko = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
64431
|
+
_getTokenPricesInDollarsOnCoingecko = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(_ref2, t) {
|
|
64428
64432
|
var context, web3Data, tokens, response, tkns, _iterator2, _step2, token, prom, _i, _tkns, _i2, _tkns2, _iterator3, _step3;
|
|
64429
64433
|
|
|
64430
|
-
return regeneratorRuntime.wrap(function
|
|
64434
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
64431
64435
|
while (1) {
|
|
64432
|
-
switch (
|
|
64436
|
+
switch (_context4.prev = _context4.next) {
|
|
64433
64437
|
case 0:
|
|
64434
64438
|
context = _ref2.context, web3Data = _ref2.web3Data;
|
|
64435
64439
|
tokens = (!(t instanceof Array) ? t = t.split(',') : t).map(function (it) {
|
|
@@ -64440,139 +64444,162 @@ function _getTokenPricesInDollarsOnCoingecko() {
|
|
|
64440
64444
|
};
|
|
64441
64445
|
tkns = [];
|
|
64442
64446
|
_iterator2 = _createForOfIteratorHelper(tokens);
|
|
64443
|
-
|
|
64447
|
+
_context4.prev = 5;
|
|
64444
64448
|
|
|
64445
64449
|
_iterator2.s();
|
|
64446
64450
|
|
|
64447
64451
|
case 7:
|
|
64448
64452
|
if ((_step2 = _iterator2.n()).done) {
|
|
64449
|
-
|
|
64453
|
+
_context4.next = 29;
|
|
64450
64454
|
break;
|
|
64451
64455
|
}
|
|
64452
64456
|
|
|
64453
64457
|
token = _step2.value;
|
|
64454
64458
|
|
|
64455
64459
|
if (!(!token || token === VOID_ETHEREUM_ADDRESS)) {
|
|
64456
|
-
|
|
64460
|
+
_context4.next = 14;
|
|
64457
64461
|
break;
|
|
64458
64462
|
}
|
|
64459
64463
|
|
|
64460
|
-
|
|
64464
|
+
_context4.next = 12;
|
|
64461
64465
|
return getEthereumPrice({
|
|
64462
64466
|
context: context
|
|
64463
64467
|
});
|
|
64464
64468
|
|
|
64465
64469
|
case 12:
|
|
64466
|
-
response.data[token] =
|
|
64467
|
-
return
|
|
64470
|
+
response.data[token] = _context4.sent;
|
|
64471
|
+
return _context4.abrupt("continue", 27);
|
|
64468
64472
|
|
|
64469
64473
|
case 14:
|
|
64470
64474
|
if (!(tokenPrices[token] && tokenPrices[token].requestExpires > new Date().getTime() && tokenPrices[token].price !== 0)) {
|
|
64471
|
-
|
|
64475
|
+
_context4.next = 18;
|
|
64472
64476
|
break;
|
|
64473
64477
|
}
|
|
64474
64478
|
|
|
64475
64479
|
response.data[token] = {
|
|
64476
64480
|
usd: tokenPrices[token].price
|
|
64477
64481
|
};
|
|
64478
|
-
|
|
64482
|
+
_context4.next = 27;
|
|
64479
64483
|
break;
|
|
64480
64484
|
|
|
64481
64485
|
case 18:
|
|
64482
64486
|
if (!tokenPricesPromises[token]) {
|
|
64483
|
-
|
|
64487
|
+
_context4.next = 26;
|
|
64484
64488
|
break;
|
|
64485
64489
|
}
|
|
64486
64490
|
|
|
64487
|
-
|
|
64491
|
+
_context4.next = 21;
|
|
64488
64492
|
return tokenPricesPromises[token];
|
|
64489
64493
|
|
|
64490
64494
|
case 21:
|
|
64491
|
-
|
|
64492
|
-
|
|
64495
|
+
_context4.t0 = token;
|
|
64496
|
+
_context4.t1 = _context4.sent.data[_context4.t0].usd;
|
|
64493
64497
|
response.data[token] = {
|
|
64494
|
-
usd:
|
|
64498
|
+
usd: _context4.t1
|
|
64495
64499
|
};
|
|
64496
|
-
|
|
64500
|
+
_context4.next = 27;
|
|
64497
64501
|
break;
|
|
64498
64502
|
|
|
64499
64503
|
case 26:
|
|
64500
64504
|
tkns.push(token);
|
|
64501
64505
|
|
|
64502
64506
|
case 27:
|
|
64503
|
-
|
|
64507
|
+
_context4.next = 7;
|
|
64504
64508
|
break;
|
|
64505
64509
|
|
|
64506
64510
|
case 29:
|
|
64507
|
-
|
|
64511
|
+
_context4.next = 34;
|
|
64508
64512
|
break;
|
|
64509
64513
|
|
|
64510
64514
|
case 31:
|
|
64511
|
-
|
|
64512
|
-
|
|
64515
|
+
_context4.prev = 31;
|
|
64516
|
+
_context4.t2 = _context4["catch"](5);
|
|
64513
64517
|
|
|
64514
|
-
_iterator2.e(
|
|
64518
|
+
_iterator2.e(_context4.t2);
|
|
64515
64519
|
|
|
64516
64520
|
case 34:
|
|
64517
|
-
|
|
64521
|
+
_context4.prev = 34;
|
|
64518
64522
|
|
|
64519
64523
|
_iterator2.f();
|
|
64520
64524
|
|
|
64521
|
-
return
|
|
64525
|
+
return _context4.finish(34);
|
|
64522
64526
|
|
|
64523
64527
|
case 37:
|
|
64524
64528
|
prom = /*#__PURE__*/function () {
|
|
64525
|
-
var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
64529
|
+
var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(t1, t2) {
|
|
64526
64530
|
var res;
|
|
64527
|
-
return regeneratorRuntime.wrap(function
|
|
64531
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
64528
64532
|
while (1) {
|
|
64529
|
-
switch (
|
|
64533
|
+
switch (_context3.prev = _context3.next) {
|
|
64530
64534
|
case 0:
|
|
64531
64535
|
res = {
|
|
64532
64536
|
data: {}
|
|
64533
64537
|
};
|
|
64534
|
-
|
|
64535
|
-
|
|
64538
|
+
_context3.prev = 1;
|
|
64539
|
+
_context3.t0 = t1.length > 0;
|
|
64536
64540
|
|
|
64537
|
-
if (!
|
|
64538
|
-
|
|
64541
|
+
if (!_context3.t0) {
|
|
64542
|
+
_context3.next = 7;
|
|
64539
64543
|
break;
|
|
64540
64544
|
}
|
|
64541
64545
|
|
|
64542
|
-
|
|
64543
|
-
return
|
|
64546
|
+
_context3.next = 6;
|
|
64547
|
+
return Promise.all(context.coingeckoCoinPriceURLTemplates.map( /*#__PURE__*/function () {
|
|
64548
|
+
var _ref4 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(it) {
|
|
64549
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
64550
|
+
while (1) {
|
|
64551
|
+
switch (_context2.prev = _context2.next) {
|
|
64552
|
+
case 0:
|
|
64553
|
+
_context2.next = 2;
|
|
64554
|
+
return fetch(it + t1.join(','));
|
|
64555
|
+
|
|
64556
|
+
case 2:
|
|
64557
|
+
_context2.next = 4;
|
|
64558
|
+
return _context2.sent.json();
|
|
64559
|
+
|
|
64560
|
+
case 4:
|
|
64561
|
+
return _context2.abrupt("return", _context2.sent);
|
|
64562
|
+
|
|
64563
|
+
case 5:
|
|
64564
|
+
case "end":
|
|
64565
|
+
return _context2.stop();
|
|
64566
|
+
}
|
|
64567
|
+
}
|
|
64568
|
+
}, _callee2);
|
|
64569
|
+
}));
|
|
64570
|
+
|
|
64571
|
+
return function (_x8) {
|
|
64572
|
+
return _ref4.apply(this, arguments);
|
|
64573
|
+
};
|
|
64574
|
+
}()));
|
|
64544
64575
|
|
|
64545
64576
|
case 6:
|
|
64546
|
-
|
|
64547
|
-
return _context2.sent.json();
|
|
64577
|
+
res.data = _context3.sent.reduce(({}));
|
|
64548
64578
|
|
|
64549
|
-
case
|
|
64550
|
-
|
|
64579
|
+
case 7:
|
|
64580
|
+
_context3.next = 11;
|
|
64581
|
+
break;
|
|
64551
64582
|
|
|
64552
64583
|
case 9:
|
|
64553
|
-
|
|
64554
|
-
|
|
64584
|
+
_context3.prev = 9;
|
|
64585
|
+
_context3.t1 = _context3["catch"](1);
|
|
64555
64586
|
|
|
64556
64587
|
case 11:
|
|
64557
|
-
|
|
64558
|
-
_context2.t1 = _context2["catch"](1);
|
|
64559
|
-
|
|
64560
|
-
case 13:
|
|
64561
|
-
_context2.next = 15;
|
|
64588
|
+
_context3.next = 13;
|
|
64562
64589
|
return elaboratePrices({
|
|
64563
64590
|
context: context,
|
|
64564
64591
|
web3Data: web3Data
|
|
64565
64592
|
}, res, t2);
|
|
64566
64593
|
|
|
64567
|
-
case
|
|
64568
|
-
return
|
|
64594
|
+
case 13:
|
|
64595
|
+
return _context3.abrupt("return", _context3.sent);
|
|
64569
64596
|
|
|
64570
|
-
case
|
|
64597
|
+
case 14:
|
|
64571
64598
|
case "end":
|
|
64572
|
-
return
|
|
64599
|
+
return _context3.stop();
|
|
64573
64600
|
}
|
|
64574
64601
|
}
|
|
64575
|
-
},
|
|
64602
|
+
}, _callee3, null, [[1, 9]]);
|
|
64576
64603
|
}));
|
|
64577
64604
|
|
|
64578
64605
|
return function prom(_x6, _x7) {
|
|
@@ -64587,11 +64614,11 @@ function _getTokenPricesInDollarsOnCoingecko() {
|
|
|
64587
64614
|
tokenPricesPromises[token] = prom;
|
|
64588
64615
|
}
|
|
64589
64616
|
|
|
64590
|
-
|
|
64617
|
+
_context4.next = 42;
|
|
64591
64618
|
return prom;
|
|
64592
64619
|
|
|
64593
64620
|
case 42:
|
|
64594
|
-
prom =
|
|
64621
|
+
prom = _context4.sent;
|
|
64595
64622
|
Object.entries(prom.data).forEach(function (it) {
|
|
64596
64623
|
return response.data[it[0]] = it[1];
|
|
64597
64624
|
});
|
|
@@ -64617,14 +64644,14 @@ function _getTokenPricesInDollarsOnCoingecko() {
|
|
|
64617
64644
|
_iterator3.f();
|
|
64618
64645
|
}
|
|
64619
64646
|
|
|
64620
|
-
return
|
|
64647
|
+
return _context4.abrupt("return", response);
|
|
64621
64648
|
|
|
64622
64649
|
case 48:
|
|
64623
64650
|
case "end":
|
|
64624
|
-
return
|
|
64651
|
+
return _context4.stop();
|
|
64625
64652
|
}
|
|
64626
64653
|
}
|
|
64627
|
-
},
|
|
64654
|
+
}, _callee4, null, [[5, 31, 34, 37]]);
|
|
64628
64655
|
}));
|
|
64629
64656
|
return _getTokenPricesInDollarsOnCoingecko.apply(this, arguments);
|
|
64630
64657
|
}
|