@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.esm.js CHANGED
@@ -64416,12 +64416,12 @@ function getTokenPricesInDollarsOnCoingecko(_x4, _x5) {
64416
64416
  }
64417
64417
 
64418
64418
  function _getTokenPricesInDollarsOnCoingecko() {
64419
- _getTokenPricesInDollarsOnCoingecko = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(_ref2, t) {
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 _callee3$(_context3) {
64422
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
64423
64423
  while (1) {
64424
- switch (_context3.prev = _context3.next) {
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,162 @@ function _getTokenPricesInDollarsOnCoingecko() {
64432
64432
  };
64433
64433
  tkns = [];
64434
64434
  _iterator2 = _createForOfIteratorHelper(tokens);
64435
- _context3.prev = 5;
64435
+ _context4.prev = 5;
64436
64436
 
64437
64437
  _iterator2.s();
64438
64438
 
64439
64439
  case 7:
64440
64440
  if ((_step2 = _iterator2.n()).done) {
64441
- _context3.next = 29;
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
- _context3.next = 14;
64448
+ _context4.next = 14;
64449
64449
  break;
64450
64450
  }
64451
64451
 
64452
- _context3.next = 12;
64452
+ _context4.next = 12;
64453
64453
  return getEthereumPrice({
64454
64454
  context: context
64455
64455
  });
64456
64456
 
64457
64457
  case 12:
64458
- response.data[token] = _context3.sent;
64459
- return _context3.abrupt("continue", 27);
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
- _context3.next = 18;
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
- _context3.next = 27;
64470
+ _context4.next = 27;
64471
64471
  break;
64472
64472
 
64473
64473
  case 18:
64474
64474
  if (!tokenPricesPromises[token]) {
64475
- _context3.next = 26;
64475
+ _context4.next = 26;
64476
64476
  break;
64477
64477
  }
64478
64478
 
64479
- _context3.next = 21;
64479
+ _context4.next = 21;
64480
64480
  return tokenPricesPromises[token];
64481
64481
 
64482
64482
  case 21:
64483
- _context3.t0 = token;
64484
- _context3.t1 = _context3.sent.data[_context3.t0].usd;
64483
+ _context4.t0 = token;
64484
+ _context4.t1 = _context4.sent.data[_context4.t0].usd;
64485
64485
  response.data[token] = {
64486
- usd: _context3.t1
64486
+ usd: _context4.t1
64487
64487
  };
64488
- _context3.next = 27;
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
- _context3.next = 7;
64495
+ _context4.next = 7;
64496
64496
  break;
64497
64497
 
64498
64498
  case 29:
64499
- _context3.next = 34;
64499
+ _context4.next = 34;
64500
64500
  break;
64501
64501
 
64502
64502
  case 31:
64503
- _context3.prev = 31;
64504
- _context3.t2 = _context3["catch"](5);
64503
+ _context4.prev = 31;
64504
+ _context4.t2 = _context4["catch"](5);
64505
64505
 
64506
- _iterator2.e(_context3.t2);
64506
+ _iterator2.e(_context4.t2);
64507
64507
 
64508
64508
  case 34:
64509
- _context3.prev = 34;
64509
+ _context4.prev = 34;
64510
64510
 
64511
64511
  _iterator2.f();
64512
64512
 
64513
- return _context3.finish(34);
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 _callee2(t1, t2) {
64517
+ var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(t1, t2) {
64518
64518
  var res;
64519
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
64519
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
64520
64520
  while (1) {
64521
- switch (_context2.prev = _context2.next) {
64521
+ switch (_context3.prev = _context3.next) {
64522
64522
  case 0:
64523
64523
  res = {
64524
64524
  data: {}
64525
64525
  };
64526
- _context2.prev = 1;
64527
- _context2.t0 = t1.length > 0;
64526
+ _context3.prev = 1;
64527
+ _context3.t0 = t1.length > 0;
64528
64528
 
64529
- if (!_context2.t0) {
64530
- _context2.next = 9;
64529
+ if (!_context3.t0) {
64530
+ _context3.next = 7;
64531
64531
  break;
64532
64532
  }
64533
64533
 
64534
- _context2.next = 6;
64535
- 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
+ }()));
64536
64563
 
64537
64564
  case 6:
64538
- _context2.next = 8;
64539
- return _context2.sent.json();
64565
+ res.data = _context3.sent.reduce(({}));
64540
64566
 
64541
- case 8:
64542
- res.data = _context2.sent;
64567
+ case 7:
64568
+ _context3.next = 11;
64569
+ break;
64543
64570
 
64544
64571
  case 9:
64545
- _context2.next = 13;
64546
- break;
64572
+ _context3.prev = 9;
64573
+ _context3.t1 = _context3["catch"](1);
64547
64574
 
64548
64575
  case 11:
64549
- _context2.prev = 11;
64550
- _context2.t1 = _context2["catch"](1);
64551
-
64552
- case 13:
64553
- _context2.next = 15;
64576
+ _context3.next = 13;
64554
64577
  return elaboratePrices({
64555
64578
  context: context,
64556
64579
  web3Data: web3Data
64557
64580
  }, res, t2);
64558
64581
 
64559
- case 15:
64560
- return _context2.abrupt("return", _context2.sent);
64582
+ case 13:
64583
+ return _context3.abrupt("return", _context3.sent);
64561
64584
 
64562
- case 16:
64585
+ case 14:
64563
64586
  case "end":
64564
- return _context2.stop();
64587
+ return _context3.stop();
64565
64588
  }
64566
64589
  }
64567
- }, _callee2, null, [[1, 11]]);
64590
+ }, _callee3, null, [[1, 9]]);
64568
64591
  }));
64569
64592
 
64570
64593
  return function prom(_x6, _x7) {
@@ -64579,11 +64602,11 @@ function _getTokenPricesInDollarsOnCoingecko() {
64579
64602
  tokenPricesPromises[token] = prom;
64580
64603
  }
64581
64604
 
64582
- _context3.next = 42;
64605
+ _context4.next = 42;
64583
64606
  return prom;
64584
64607
 
64585
64608
  case 42:
64586
- prom = _context3.sent;
64609
+ prom = _context4.sent;
64587
64610
  Object.entries(prom.data).forEach(function (it) {
64588
64611
  return response.data[it[0]] = it[1];
64589
64612
  });
@@ -64609,14 +64632,14 @@ function _getTokenPricesInDollarsOnCoingecko() {
64609
64632
  _iterator3.f();
64610
64633
  }
64611
64634
 
64612
- return _context3.abrupt("return", response);
64635
+ return _context4.abrupt("return", response);
64613
64636
 
64614
64637
  case 48:
64615
64638
  case "end":
64616
- return _context3.stop();
64639
+ return _context4.stop();
64617
64640
  }
64618
64641
  }
64619
- }, _callee3, null, [[5, 31, 34, 37]]);
64642
+ }, _callee4, null, [[5, 31, 34, 37]]);
64620
64643
  }));
64621
64644
  return _getTokenPricesInDollarsOnCoingecko.apply(this, arguments);
64622
64645
  }