@ethereansos/interfaces-core 0.4.116 → 0.4.117

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.cjs.js CHANGED
@@ -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,162 @@ 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(({}));
64552
64578
 
64553
- case 8:
64554
- res.data = _context2.sent;
64579
+ case 7:
64580
+ _context3.next = 11;
64581
+ break;
64555
64582
 
64556
64583
  case 9:
64557
- _context2.next = 13;
64558
- break;
64584
+ _context3.prev = 9;
64585
+ _context3.t1 = _context3["catch"](1);
64559
64586
 
64560
64587
  case 11:
64561
- _context2.prev = 11;
64562
- _context2.t1 = _context2["catch"](1);
64563
-
64564
- case 13:
64565
- _context2.next = 15;
64588
+ _context3.next = 13;
64566
64589
  return elaboratePrices({
64567
64590
  context: context,
64568
64591
  web3Data: web3Data
64569
64592
  }, res, t2);
64570
64593
 
64571
- case 15:
64572
- return _context2.abrupt("return", _context2.sent);
64594
+ case 13:
64595
+ return _context3.abrupt("return", _context3.sent);
64573
64596
 
64574
- case 16:
64597
+ case 14:
64575
64598
  case "end":
64576
- return _context2.stop();
64599
+ return _context3.stop();
64577
64600
  }
64578
64601
  }
64579
- }, _callee2, null, [[1, 11]]);
64602
+ }, _callee3, null, [[1, 9]]);
64580
64603
  }));
64581
64604
 
64582
64605
  return function prom(_x6, _x7) {
@@ -64591,11 +64614,11 @@ function _getTokenPricesInDollarsOnCoingecko() {
64591
64614
  tokenPricesPromises[token] = prom;
64592
64615
  }
64593
64616
 
64594
- _context3.next = 42;
64617
+ _context4.next = 42;
64595
64618
  return prom;
64596
64619
 
64597
64620
  case 42:
64598
- prom = _context3.sent;
64621
+ prom = _context4.sent;
64599
64622
  Object.entries(prom.data).forEach(function (it) {
64600
64623
  return response.data[it[0]] = it[1];
64601
64624
  });
@@ -64621,14 +64644,14 @@ function _getTokenPricesInDollarsOnCoingecko() {
64621
64644
  _iterator3.f();
64622
64645
  }
64623
64646
 
64624
- return _context3.abrupt("return", response);
64647
+ return _context4.abrupt("return", response);
64625
64648
 
64626
64649
  case 48:
64627
64650
  case "end":
64628
- return _context3.stop();
64651
+ return _context4.stop();
64629
64652
  }
64630
64653
  }
64631
- }, _callee3, null, [[5, 31, 34, 37]]);
64654
+ }, _callee4, null, [[5, 31, 34, 37]]);
64632
64655
  }));
64633
64656
  return _getTokenPricesInDollarsOnCoingecko.apply(this, arguments);
64634
64657
  }