@ethereansos/interfaces-core 0.4.115 → 0.4.118

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 CHANGED
@@ -48926,8 +48926,8 @@ var Web3ContextInitializer = function Web3ContextInitializer(_ref) {
48926
48926
 
48927
48927
  if (wallet && wallet.ethereum || dualProvider) {
48928
48928
  setIntervalId(setInterval(function () {
48929
- tryUpdateBlock(wallet.ethereum, block, setBlock);
48930
- tryUpdateBlock(dualProvider, dualBlock, setDualBlock);
48929
+ wallet && wallet.ethereum && tryUpdateBlock(wallet.ethereum, block, setBlock);
48930
+ dualProvider && tryUpdateBlock(dualProvider, dualBlock, setDualBlock);
48931
48931
  }, realBlockIntervalTimeout));
48932
48932
  }
48933
48933
  }, [wallet, dualProvider, realBlockIntervalTimeout, intervalId]);
@@ -64428,12 +64428,12 @@ function getTokenPricesInDollarsOnCoingecko(_x4, _x5) {
64428
64428
  }
64429
64429
 
64430
64430
  function _getTokenPricesInDollarsOnCoingecko() {
64431
- _getTokenPricesInDollarsOnCoingecko = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(_ref2, t) {
64431
+ _getTokenPricesInDollarsOnCoingecko = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(_ref2, t) {
64432
64432
  var context, web3Data, tokens, response, tkns, _iterator2, _step2, token, prom, _i, _tkns, _i2, _tkns2, _iterator3, _step3;
64433
64433
 
64434
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
64434
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
64435
64435
  while (1) {
64436
- switch (_context3.prev = _context3.next) {
64436
+ switch (_context4.prev = _context4.next) {
64437
64437
  case 0:
64438
64438
  context = _ref2.context, web3Data = _ref2.web3Data;
64439
64439
  tokens = (!(t instanceof Array) ? t = t.split(',') : t).map(function (it) {
@@ -64444,139 +64444,164 @@ function _getTokenPricesInDollarsOnCoingecko() {
64444
64444
  };
64445
64445
  tkns = [];
64446
64446
  _iterator2 = _createForOfIteratorHelper(tokens);
64447
- _context3.prev = 5;
64447
+ _context4.prev = 5;
64448
64448
 
64449
64449
  _iterator2.s();
64450
64450
 
64451
64451
  case 7:
64452
64452
  if ((_step2 = _iterator2.n()).done) {
64453
- _context3.next = 29;
64453
+ _context4.next = 29;
64454
64454
  break;
64455
64455
  }
64456
64456
 
64457
64457
  token = _step2.value;
64458
64458
 
64459
64459
  if (!(!token || token === VOID_ETHEREUM_ADDRESS)) {
64460
- _context3.next = 14;
64460
+ _context4.next = 14;
64461
64461
  break;
64462
64462
  }
64463
64463
 
64464
- _context3.next = 12;
64464
+ _context4.next = 12;
64465
64465
  return getEthereumPrice({
64466
64466
  context: context
64467
64467
  });
64468
64468
 
64469
64469
  case 12:
64470
- response.data[token] = _context3.sent;
64471
- return _context3.abrupt("continue", 27);
64470
+ response.data[token] = _context4.sent;
64471
+ return _context4.abrupt("continue", 27);
64472
64472
 
64473
64473
  case 14:
64474
64474
  if (!(tokenPrices[token] && tokenPrices[token].requestExpires > new Date().getTime() && tokenPrices[token].price !== 0)) {
64475
- _context3.next = 18;
64475
+ _context4.next = 18;
64476
64476
  break;
64477
64477
  }
64478
64478
 
64479
64479
  response.data[token] = {
64480
64480
  usd: tokenPrices[token].price
64481
64481
  };
64482
- _context3.next = 27;
64482
+ _context4.next = 27;
64483
64483
  break;
64484
64484
 
64485
64485
  case 18:
64486
64486
  if (!tokenPricesPromises[token]) {
64487
- _context3.next = 26;
64487
+ _context4.next = 26;
64488
64488
  break;
64489
64489
  }
64490
64490
 
64491
- _context3.next = 21;
64491
+ _context4.next = 21;
64492
64492
  return tokenPricesPromises[token];
64493
64493
 
64494
64494
  case 21:
64495
- _context3.t0 = token;
64496
- _context3.t1 = _context3.sent.data[_context3.t0].usd;
64495
+ _context4.t0 = token;
64496
+ _context4.t1 = _context4.sent.data[_context4.t0].usd;
64497
64497
  response.data[token] = {
64498
- usd: _context3.t1
64498
+ usd: _context4.t1
64499
64499
  };
64500
- _context3.next = 27;
64500
+ _context4.next = 27;
64501
64501
  break;
64502
64502
 
64503
64503
  case 26:
64504
64504
  tkns.push(token);
64505
64505
 
64506
64506
  case 27:
64507
- _context3.next = 7;
64507
+ _context4.next = 7;
64508
64508
  break;
64509
64509
 
64510
64510
  case 29:
64511
- _context3.next = 34;
64511
+ _context4.next = 34;
64512
64512
  break;
64513
64513
 
64514
64514
  case 31:
64515
- _context3.prev = 31;
64516
- _context3.t2 = _context3["catch"](5);
64515
+ _context4.prev = 31;
64516
+ _context4.t2 = _context4["catch"](5);
64517
64517
 
64518
- _iterator2.e(_context3.t2);
64518
+ _iterator2.e(_context4.t2);
64519
64519
 
64520
64520
  case 34:
64521
- _context3.prev = 34;
64521
+ _context4.prev = 34;
64522
64522
 
64523
64523
  _iterator2.f();
64524
64524
 
64525
- return _context3.finish(34);
64525
+ return _context4.finish(34);
64526
64526
 
64527
64527
  case 37:
64528
64528
  prom = /*#__PURE__*/function () {
64529
- var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(t1, t2) {
64529
+ var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(t1, t2) {
64530
64530
  var res;
64531
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
64531
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
64532
64532
  while (1) {
64533
- switch (_context2.prev = _context2.next) {
64533
+ switch (_context3.prev = _context3.next) {
64534
64534
  case 0:
64535
64535
  res = {
64536
64536
  data: {}
64537
64537
  };
64538
- _context2.prev = 1;
64539
- _context2.t0 = t1.length > 0;
64538
+ _context3.prev = 1;
64539
+ _context3.t0 = t1.length > 0;
64540
64540
 
64541
- if (!_context2.t0) {
64542
- _context2.next = 9;
64541
+ if (!_context3.t0) {
64542
+ _context3.next = 7;
64543
64543
  break;
64544
64544
  }
64545
64545
 
64546
- _context2.next = 6;
64547
- return fetch(context.coingeckoCoinPriceURL + t1.join(','));
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
+ }()));
64548
64575
 
64549
64576
  case 6:
64550
- _context2.next = 8;
64551
- return _context2.sent.json();
64577
+ res.data = _context3.sent.reduce(function (acc, it) {
64578
+ return _objectSpread2(_objectSpread2({}, acc), it);
64579
+ }, {});
64552
64580
 
64553
- case 8:
64554
- res.data = _context2.sent;
64581
+ case 7:
64582
+ _context3.next = 11;
64583
+ break;
64555
64584
 
64556
64585
  case 9:
64557
- _context2.next = 13;
64558
- break;
64586
+ _context3.prev = 9;
64587
+ _context3.t1 = _context3["catch"](1);
64559
64588
 
64560
64589
  case 11:
64561
- _context2.prev = 11;
64562
- _context2.t1 = _context2["catch"](1);
64563
-
64564
- case 13:
64565
- _context2.next = 15;
64590
+ _context3.next = 13;
64566
64591
  return elaboratePrices({
64567
64592
  context: context,
64568
64593
  web3Data: web3Data
64569
64594
  }, res, t2);
64570
64595
 
64571
- case 15:
64572
- return _context2.abrupt("return", _context2.sent);
64596
+ case 13:
64597
+ return _context3.abrupt("return", _context3.sent);
64573
64598
 
64574
- case 16:
64599
+ case 14:
64575
64600
  case "end":
64576
- return _context2.stop();
64601
+ return _context3.stop();
64577
64602
  }
64578
64603
  }
64579
- }, _callee2, null, [[1, 11]]);
64604
+ }, _callee3, null, [[1, 9]]);
64580
64605
  }));
64581
64606
 
64582
64607
  return function prom(_x6, _x7) {
@@ -64591,11 +64616,11 @@ function _getTokenPricesInDollarsOnCoingecko() {
64591
64616
  tokenPricesPromises[token] = prom;
64592
64617
  }
64593
64618
 
64594
- _context3.next = 42;
64619
+ _context4.next = 42;
64595
64620
  return prom;
64596
64621
 
64597
64622
  case 42:
64598
- prom = _context3.sent;
64623
+ prom = _context4.sent;
64599
64624
  Object.entries(prom.data).forEach(function (it) {
64600
64625
  return response.data[it[0]] = it[1];
64601
64626
  });
@@ -64621,14 +64646,14 @@ function _getTokenPricesInDollarsOnCoingecko() {
64621
64646
  _iterator3.f();
64622
64647
  }
64623
64648
 
64624
- return _context3.abrupt("return", response);
64649
+ return _context4.abrupt("return", response);
64625
64650
 
64626
64651
  case 48:
64627
64652
  case "end":
64628
- return _context3.stop();
64653
+ return _context4.stop();
64629
64654
  }
64630
64655
  }
64631
- }, _callee3, null, [[5, 31, 34, 37]]);
64656
+ }, _callee4, null, [[5, 31, 34, 37]]);
64632
64657
  }));
64633
64658
  return _getTokenPricesInDollarsOnCoingecko.apply(this, arguments);
64634
64659
  }