@ethereansos/interfaces-core 0.4.100 → 0.4.103

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.cjs.js CHANGED
@@ -23086,10 +23086,6 @@ function _createSuper(Derived) {
23086
23086
  };
23087
23087
  }
23088
23088
 
23089
- function _readOnlyError(name) {
23090
- throw new TypeError("\"" + name + "\" is read-only");
23091
- }
23092
-
23093
23089
  function _slicedToArray(arr, i) {
23094
23090
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest();
23095
23091
  }
@@ -50371,14 +50367,15 @@ function fromDecimals(number, decimals, skipFormat) {
50371
50367
  return '0';
50372
50368
  }
50373
50369
 
50370
+ number = numberToString(number).split('.')[0];
50374
50371
  var symbol = toEthereumSymbol(decimals);
50375
50372
 
50376
50373
  if (symbol) {
50377
- var result = web3Utils__default["default"].fromWei(numberToString(number), symbol);
50374
+ var result = web3Utils__default["default"].fromWei(number, symbol);
50378
50375
  return skipFormat === true ? result : formatMoney(result);
50379
50376
  }
50380
50377
 
50381
- var nts = parseFloat(numberToString(number / (decimals < 2 ? 1 : Math.pow(10, decimals)))); // TODO verify if is expected that is rounded to 2 decimals
50378
+ var nts = parseFloat(numberToString(parseFloat(number) / (decimals < 2 ? 1 : Math.pow(10, decimals)))); // TODO verify if is expected that is rounded to 2 decimals
50382
50379
 
50383
50380
  return skipFormat === true ? numberToString(nts) : formatMoney(nts);
50384
50381
  }
@@ -63767,6 +63764,56 @@ const gBase64 = {
63767
63764
  extendBuiltins: extendBuiltins,
63768
63765
  };
63769
63766
 
63767
+ function memoryFetch(_x, _x2) {
63768
+ return _memoryFetch.apply(this, arguments);
63769
+ }
63770
+
63771
+ function _memoryFetch() {
63772
+ _memoryFetch = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url, type) {
63773
+ var element;
63774
+ return regeneratorRuntime.wrap(function _callee$(_context) {
63775
+ while (1) {
63776
+ switch (_context.prev = _context.next) {
63777
+ case 0:
63778
+ try {
63779
+ element = JSON.parse(window.localStorage.getItem(url));
63780
+ } catch (e) {}
63781
+
63782
+ if (!element) {
63783
+ _context.next = 3;
63784
+ break;
63785
+ }
63786
+
63787
+ return _context.abrupt("return", element);
63788
+
63789
+ case 3:
63790
+ _context.next = 5;
63791
+ return fetch(url);
63792
+
63793
+ case 5:
63794
+ element = _context.sent;
63795
+ _context.next = 8;
63796
+ return element[type || 'json']();
63797
+
63798
+ case 8:
63799
+ element = _context.sent;
63800
+
63801
+ try {
63802
+ window.localStorage.setItem(url, JSON.stringify(element));
63803
+ } catch (e) {}
63804
+
63805
+ return _context.abrupt("return", element);
63806
+
63807
+ case 11:
63808
+ case "end":
63809
+ return _context.stop();
63810
+ }
63811
+ }
63812
+ }, _callee);
63813
+ }));
63814
+ return _memoryFetch.apply(this, arguments);
63815
+ }
63816
+
63770
63817
  function cleanLink(linkToClean) {
63771
63818
  var cleanedLink = linkToClean;
63772
63819
 
@@ -63862,7 +63909,7 @@ function _tryRetrieveMetadata() {
63862
63909
 
63863
63910
  case 28:
63864
63911
  _context.next = 30;
63865
- return fetch(cleanLink(formatLink({
63912
+ return memoryFetch(cleanLink(formatLink({
63866
63913
  context: context
63867
63914
  }, item.metadataLink)));
63868
63915
 
@@ -64250,91 +64297,89 @@ function _getTokenPricesInDollarsOnCoingecko() {
64250
64297
  response = {
64251
64298
  data: {}
64252
64299
  };
64253
- _readOnlyError("tokenPrices");
64254
- _readOnlyError("tokenPricesPromises");
64255
64300
  tkns = [];
64256
64301
  _iterator2 = _createForOfIteratorHelper(tokens);
64257
- _context3.prev = 7;
64302
+ _context3.prev = 5;
64258
64303
 
64259
64304
  _iterator2.s();
64260
64305
 
64261
- case 9:
64306
+ case 7:
64262
64307
  if ((_step2 = _iterator2.n()).done) {
64263
- _context3.next = 31;
64308
+ _context3.next = 29;
64264
64309
  break;
64265
64310
  }
64266
64311
 
64267
64312
  token = _step2.value;
64268
64313
 
64269
64314
  if (!(!token || token === VOID_ETHEREUM_ADDRESS)) {
64270
- _context3.next = 16;
64315
+ _context3.next = 14;
64271
64316
  break;
64272
64317
  }
64273
64318
 
64274
- _context3.next = 14;
64319
+ _context3.next = 12;
64275
64320
  return getEthereumPrice({
64276
64321
  context: context
64277
64322
  });
64278
64323
 
64279
- case 14:
64324
+ case 12:
64280
64325
  response.data[token] = _context3.sent;
64281
- return _context3.abrupt("continue", 29);
64326
+ return _context3.abrupt("continue", 27);
64282
64327
 
64283
- case 16:
64328
+ case 14:
64284
64329
  if (!(tokenPrices[token] && tokenPrices[token].requestExpires > new Date().getTime() && tokenPrices[token].price !== 0)) {
64285
- _context3.next = 20;
64330
+ _context3.next = 18;
64286
64331
  break;
64287
64332
  }
64288
64333
 
64289
64334
  response.data[token] = {
64290
64335
  usd: tokenPrices[token].price
64291
64336
  };
64292
- _context3.next = 29;
64337
+ _context3.next = 27;
64293
64338
  break;
64294
64339
 
64295
- case 20:
64340
+ case 18:
64296
64341
  if (!tokenPricesPromises[token]) {
64297
- _context3.next = 28;
64342
+ _context3.next = 26;
64298
64343
  break;
64299
64344
  }
64300
64345
 
64301
- _context3.next = 23;
64346
+ _context3.next = 21;
64302
64347
  return tokenPricesPromises[token];
64303
64348
 
64304
- case 23:
64349
+ case 21:
64305
64350
  _context3.t0 = token;
64306
64351
  _context3.t1 = _context3.sent.data[_context3.t0].usd;
64307
64352
  response.data[token] = {
64308
64353
  usd: _context3.t1
64309
64354
  };
64310
- _context3.next = 29;
64355
+ _context3.next = 27;
64311
64356
  break;
64312
64357
 
64313
- case 28:
64358
+ case 26:
64314
64359
  tkns.push(token);
64315
64360
 
64316
- case 29:
64317
- _context3.next = 9;
64361
+ case 27:
64362
+ _context3.next = 7;
64318
64363
  break;
64319
64364
 
64320
- case 31:
64321
- _context3.next = 36;
64365
+ case 29:
64366
+ _context3.next = 34;
64322
64367
  break;
64323
64368
 
64324
- case 33:
64325
- _context3.prev = 33;
64326
- _context3.t2 = _context3["catch"](7);
64369
+ case 31:
64370
+ _context3.prev = 31;
64371
+ _context3.t2 = _context3["catch"](5);
64327
64372
 
64328
64373
  _iterator2.e(_context3.t2);
64329
64374
 
64330
- case 36:
64331
- _context3.prev = 36;
64375
+ case 34:
64376
+ _context3.prev = 34;
64332
64377
 
64333
64378
  _iterator2.f();
64334
64379
 
64335
- return _context3.finish(36);
64380
+ return _context3.finish(34);
64336
64381
 
64337
- case 39:
64382
+ case 37:
64338
64383
  prom = /*#__PURE__*/function () {
64339
64384
  var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(t1, t2) {
64340
64385
  var res;
@@ -64401,10 +64446,10 @@ function _getTokenPricesInDollarsOnCoingecko() {
64401
64446
  tokenPricesPromises[token] = prom;
64402
64447
  }
64403
64448
 
64404
- _context3.next = 44;
64449
+ _context3.next = 42;
64405
64450
  return prom;
64406
64451
 
64407
- case 44:
64452
+ case 42:
64408
64453
  prom = _context3.sent;
64409
64454
  Object.entries(prom.data).forEach(function (it) {
64410
64455
  return response.data[it[0]] = it[1];
@@ -64433,12 +64478,12 @@ function _getTokenPricesInDollarsOnCoingecko() {
64433
64478
 
64434
64479
  return _context3.abrupt("return", response);
64435
64480
 
64436
- case 50:
64481
+ case 48:
64437
64482
  case "end":
64438
64483
  return _context3.stop();
64439
64484
  }
64440
64485
  }
64441
- }, _callee3, null, [[7, 33, 36, 39]]);
64486
+ }, _callee3, null, [[5, 31, 34, 37]]);
64442
64487
  }));
64443
64488
  return _getTokenPricesInDollarsOnCoingecko.apply(this, arguments);
64444
64489
  }
@@ -65001,6 +65046,7 @@ exports.loadMetadatas = loadMetadatas;
65001
65046
  exports.loadOffchainWallets = loadOffChainWallets;
65002
65047
  exports.logger = logger;
65003
65048
  exports.maxLiquidityForAmounts = maxLiquidityForAmounts;
65049
+ exports.memoryFetch = memoryFetch;
65004
65050
  exports.methodSignatureMatch = methodSignatureMatch;
65005
65051
  exports.mint = mint;
65006
65052
  exports.mostSignificantBit = mostSignificantBit;