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