@ethereansos/interfaces-core 0.4.145 → 0.4.148

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -64037,6 +64037,174 @@ const gBase64 = {
64037
64037
  extendBuiltins: extendBuiltins,
64038
64038
  };
64039
64039
 
64040
+ (typeof window === "undefined" ? "undefined" : _typeof(window)).toLowerCase() === 'undefined' && (global.window = global);
64041
+ var dbEngine = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
64042
+ window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction || {
64043
+ READ_WRITE: 'readwrite'
64044
+ };
64045
+ window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange;
64046
+ var dbName = 'ethereansos';
64047
+ var dbTable = 'ethereansos';
64048
+ var dbVersion = 1;
64049
+ var internalDB;
64050
+
64051
+ function openDB(name, version) {
64052
+ return new Promise(function (ok, ko) {
64053
+ if (internalDB) {
64054
+ return ok(internalDB);
64055
+ }
64056
+
64057
+ var request = dbEngine.open(name, version);
64058
+
64059
+ request.onerror = function (event) {
64060
+ return ko(event.target.errorCode);
64061
+ };
64062
+
64063
+ request.onsuccess = function (event) {
64064
+ return ok(internalDB = event.target.result);
64065
+ };
64066
+
64067
+ request.onupgradeneeded = function (event) {
64068
+ var store = event.target.result.createObjectStore(dbTable, {
64069
+ autoIncrement: true
64070
+ });
64071
+ store.createIndex('key', 'key', {
64072
+ unique: true
64073
+ });
64074
+ };
64075
+ });
64076
+ }
64077
+
64078
+ function setItem(key, value) {
64079
+ return new Promise( /*#__PURE__*/function () {
64080
+ var _ref = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ok, ko) {
64081
+ var db, txn, store, query;
64082
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
64083
+ while (1) {
64084
+ switch (_context2.prev = _context2.next) {
64085
+ case 0:
64086
+ _context2.next = 2;
64087
+ return openDB(dbName, dbVersion);
64088
+
64089
+ case 2:
64090
+ db = _context2.sent;
64091
+ txn = db.transaction(dbTable, 'readwrite');
64092
+ store = txn.objectStore(dbTable);
64093
+ query = store.put(value && _typeof(value).toLowerCase() === 'string' ? value : JSON.stringify(value || null), key);
64094
+
64095
+ query.onsuccess = function (event) {
64096
+ return ok(event.target.result);
64097
+ };
64098
+
64099
+ query.onerror = function (event) {
64100
+ return ko(event.target.error || event.target.errorCode);
64101
+ };
64102
+
64103
+ txn.oncomplete = /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
64104
+ return regeneratorRuntime.wrap(function _callee$(_context) {
64105
+ while (1) {
64106
+ switch (_context.prev = _context.next) {
64107
+ case 0:
64108
+ case "end":
64109
+ return _context.stop();
64110
+ }
64111
+ }
64112
+ }, _callee);
64113
+ }));
64114
+
64115
+ case 9:
64116
+ case "end":
64117
+ return _context2.stop();
64118
+ }
64119
+ }
64120
+ }, _callee2);
64121
+ }));
64122
+
64123
+ return function (_x, _x2) {
64124
+ return _ref.apply(this, arguments);
64125
+ };
64126
+ }());
64127
+ }
64128
+
64129
+ function getItem(key) {
64130
+ return new Promise( /*#__PURE__*/function () {
64131
+ var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(ok, ko) {
64132
+ var db, txn, store, index, query;
64133
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
64134
+ while (1) {
64135
+ switch (_context4.prev = _context4.next) {
64136
+ case 0:
64137
+ _context4.next = 2;
64138
+ return openDB(dbName, dbVersion);
64139
+
64140
+ case 2:
64141
+ db = _context4.sent;
64142
+ txn = db.transaction(dbTable, 'readonly');
64143
+ store = txn.objectStore(dbTable);
64144
+ index = store.index('key');
64145
+ query = index.get(key);
64146
+
64147
+ query.onsuccess = function (event) {
64148
+ var _event$target, _event$target$result;
64149
+
64150
+ return ok(((_event$target = event.target) === null || _event$target === void 0 ? void 0 : (_event$target$result = _event$target.result) === null || _event$target$result === void 0 ? void 0 : _event$target$result.value) || 'null');
64151
+ };
64152
+
64153
+ query.onerror = function (event) {
64154
+ return ko(event.target.error || event.target.errorCode);
64155
+ };
64156
+
64157
+ txn.oncomplete = /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
64158
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
64159
+ while (1) {
64160
+ switch (_context3.prev = _context3.next) {
64161
+ case 0:
64162
+ case "end":
64163
+ return _context3.stop();
64164
+ }
64165
+ }
64166
+ }, _callee3);
64167
+ }));
64168
+
64169
+ case 10:
64170
+ case "end":
64171
+ return _context4.stop();
64172
+ }
64173
+ }
64174
+ }, _callee4);
64175
+ }));
64176
+
64177
+ return function (_x3, _x4) {
64178
+ return _ref3.apply(this, arguments);
64179
+ };
64180
+ }());
64181
+ }
64182
+
64183
+ function clear(_x5) {
64184
+ return _clear.apply(this, arguments);
64185
+ }
64186
+
64187
+ function _clear() {
64188
+ _clear = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(key) {
64189
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
64190
+ while (1) {
64191
+ switch (_context5.prev = _context5.next) {
64192
+ case 0:
64193
+ case "end":
64194
+ return _context5.stop();
64195
+ }
64196
+ }
64197
+ }, _callee5);
64198
+ }));
64199
+ return _clear.apply(this, arguments);
64200
+ }
64201
+
64202
+ var cache = window.ethereansOSCache = {
64203
+ getItem: getItem,
64204
+ setItem: setItem,
64205
+ clear: clear
64206
+ };
64207
+
64040
64208
  function memoryFetch(_x, _x2) {
64041
64209
  return _memoryFetch.apply(this, arguments);
64042
64210
  }
@@ -64067,42 +64235,61 @@ function _memoryFetch() {
64067
64235
 
64068
64236
  case 8:
64069
64237
  key = web3Utils.sha3(url);
64238
+ _context.prev = 9;
64239
+ _context.t0 = JSON;
64240
+ _context.next = 13;
64241
+ return cache.getItem(key);
64070
64242
 
64071
- try {
64072
- element = JSON.parse(window.localStorage.getItem(key));
64073
- } catch (e) {}
64243
+ case 13:
64244
+ _context.t1 = _context.sent;
64245
+ element = _context.t0.parse.call(_context.t0, _context.t1);
64246
+ _context.next = 19;
64247
+ break;
64074
64248
 
64249
+ case 17:
64250
+ _context.prev = 17;
64251
+ _context.t2 = _context["catch"](9);
64252
+
64253
+ case 19:
64075
64254
  if (!element) {
64076
- _context.next = 12;
64255
+ _context.next = 21;
64077
64256
  break;
64078
64257
  }
64079
64258
 
64080
64259
  return _context.abrupt("return", element);
64081
64260
 
64082
- case 12:
64083
- _context.next = 14;
64261
+ case 21:
64262
+ _context.next = 23;
64084
64263
  return fetch(url);
64085
64264
 
64086
- case 14:
64265
+ case 23:
64087
64266
  element = _context.sent;
64088
- _context.next = 17;
64267
+ _context.next = 26;
64089
64268
  return element[type || 'json']();
64090
64269
 
64091
- case 17:
64270
+ case 26:
64092
64271
  element = _context.sent;
64272
+ _context.prev = 27;
64273
+ _context.next = 30;
64274
+ return cache.setItem(key, JSON.stringify(element));
64093
64275
 
64094
- try {
64095
- window.localStorage.setItem(key, JSON.stringify(element));
64096
- } catch (e) {}
64276
+ case 30:
64277
+ _context.next = 34;
64278
+ break;
64279
+
64280
+ case 32:
64281
+ _context.prev = 32;
64282
+ _context.t3 = _context["catch"](27);
64097
64283
 
64284
+ case 34:
64098
64285
  return _context.abrupt("return", element);
64099
64286
 
64100
- case 20:
64287
+ case 35:
64101
64288
  case "end":
64102
64289
  return _context.stop();
64103
64290
  }
64104
64291
  }
64105
- }, _callee);
64292
+ }, _callee, null, [[9, 17], [27, 32]]);
64106
64293
  }));
64107
64294
  return _memoryFetch.apply(this, arguments);
64108
64295
  }
@@ -65359,5 +65546,5 @@ var tokenPercentage = function tokenPercentage(amount, totalSupply) {
65359
65546
 
65360
65547
  var abi = new AbiCoder();
65361
65548
 
65362
- export { ADDRESS_ZERO, BASE64_REGEXP, BLOCK_SEARCH_SIZE, gBase64 as Base64, BaseContract, BigNumber, Contract, ContractFactory, CurrencyAmount, DFO_DEPLOYED_EVENT, Ether, FACTORY_ADDRESS, FeeAmount, FixedNumber, Fraction, FullMath, GlobalContextsProvider, InitContextProvider, LiquidityMath, MaxUint256, Multicall, NEW_DFO_DEPLOYED_EVENT, NativeCurrency, NoTickDataProvider, NonfungiblePositionManager, POOL_INIT_CODE_HASH, Payments, Percent, PluginsContextProvider, Pool, Position, PositionLibrary, Price, Rounding, Route, SelfPermit, Signer, SqrtPriceMath, Staker, SwapMath, SwapQuoter, SwapRouter, TICK_SPACINGS, Tick, TickLibrary, TickList, TickListDataProvider, TickMath, Token, Trade, TradeType, URL_REGEXP, VOID_BYTES32, VOID_ETHEREUM_ADDRESS, VoidSigner, WETH9, Wallet, Web3ContextProvider, Wordlist, abi, add, blockchainCall, checkCoverSize, computePoolAddress, computePriceImpact, index$2 as constants, createContract, deployMetadataLink, div, eliminateFloatingFinalZeroes, encodeRouteToPath, encodeSqrtRatioX96, ErrorCode as errors, ethers, PubSub as ethosEvents, extractComment, extractHTMLDescription, formatLink, formatMoney, formatMoneyUniV3, formatNumber, formatString, fromDecimals, generateAndCompileContract, generateFunctionalityMetadataLink, getAllContracts, getDefaultProvider, getEthereumPrice, getLogs, getNetworkElement, getRandomArrayElement, getRandomArrayIndex, SolidityUtilities as getSolidityUtilities, getSupportedSolidityVersion, getTokenPriceInDollarsOnSushiSwap, getTokenPriceInDollarsOnUniswap, getTokenPriceInDollarsOnUniswapV3, getTokenPricesInDollarsOnCoingecko, hasEthereumAddress, isEthereumAddress, isSorted, loadBlockSearchTranches, loadContent, loadFunctionality, loadFunctionalityNames, loadMetadatas, loadOffChainWallets as loadOffchainWallets, logger, maxLiquidityForAmounts, memoryFetch, methodSignatureMatch, mint, mostSignificantBit, mul, nearestUsableTick, newContract, normalizeValue, numberToString, packCollection, pragmaSolidityRule, priceToClosestTick, index as providers, refreshBalances, resetContracts, searchForCodeErrors, sendAsync, sendGeneratedProposal, shortenWord, sleep, solidityImportRule, sortedInsert, split, sqrt, toLines as stringToLines, sub, subIn256, swap, tickToPrice, toDecimals, toEthereumSymbol, toHex, toSubArrays, tokenPercentage, tradeComparator, transfer, truncatedWord, tryRetrieveMetadata, uploadMetadata, uploadToIPFS, useEthosContext, useInit, useIsUnmounted, useLoadUniswapPairs, useLocalStorage, usePlaceholder, usePlugins, usePrevious, useSinglePlaceholder, useWeb3, utils, validateAndParseAddress, validateDFOMetadata, version$1 as version, web3States, wordlists };
65549
+ export { ADDRESS_ZERO, BASE64_REGEXP, BLOCK_SEARCH_SIZE, gBase64 as Base64, BaseContract, BigNumber, Contract, ContractFactory, CurrencyAmount, DFO_DEPLOYED_EVENT, Ether, FACTORY_ADDRESS, FeeAmount, FixedNumber, Fraction, FullMath, GlobalContextsProvider, InitContextProvider, LiquidityMath, MaxUint256, Multicall, NEW_DFO_DEPLOYED_EVENT, NativeCurrency, NoTickDataProvider, NonfungiblePositionManager, POOL_INIT_CODE_HASH, Payments, Percent, PluginsContextProvider, Pool, Position, PositionLibrary, Price, Rounding, Route, SelfPermit, Signer, SqrtPriceMath, Staker, SwapMath, SwapQuoter, SwapRouter, TICK_SPACINGS, Tick, TickLibrary, TickList, TickListDataProvider, TickMath, Token, Trade, TradeType, URL_REGEXP, VOID_BYTES32, VOID_ETHEREUM_ADDRESS, VoidSigner, WETH9, Wallet, Web3ContextProvider, Wordlist, abi, add, blockchainCall, cache, checkCoverSize, computePoolAddress, computePriceImpact, index$2 as constants, createContract, deployMetadataLink, div, eliminateFloatingFinalZeroes, encodeRouteToPath, encodeSqrtRatioX96, ErrorCode as errors, ethers, PubSub as ethosEvents, extractComment, extractHTMLDescription, formatLink, formatMoney, formatMoneyUniV3, formatNumber, formatString, fromDecimals, generateAndCompileContract, generateFunctionalityMetadataLink, getAllContracts, getDefaultProvider, getEthereumPrice, getLogs, getNetworkElement, getRandomArrayElement, getRandomArrayIndex, SolidityUtilities as getSolidityUtilities, getSupportedSolidityVersion, getTokenPriceInDollarsOnSushiSwap, getTokenPriceInDollarsOnUniswap, getTokenPriceInDollarsOnUniswapV3, getTokenPricesInDollarsOnCoingecko, hasEthereumAddress, isEthereumAddress, isSorted, loadBlockSearchTranches, loadContent, loadFunctionality, loadFunctionalityNames, loadMetadatas, loadOffChainWallets as loadOffchainWallets, logger, maxLiquidityForAmounts, memoryFetch, methodSignatureMatch, mint, mostSignificantBit, mul, nearestUsableTick, newContract, normalizeValue, numberToString, packCollection, pragmaSolidityRule, priceToClosestTick, index as providers, refreshBalances, resetContracts, searchForCodeErrors, sendAsync, sendGeneratedProposal, shortenWord, sleep, solidityImportRule, sortedInsert, split, sqrt, toLines as stringToLines, sub, subIn256, swap, tickToPrice, toDecimals, toEthereumSymbol, toHex, toSubArrays, tokenPercentage, tradeComparator, transfer, truncatedWord, tryRetrieveMetadata, uploadMetadata, uploadToIPFS, useEthosContext, useInit, useIsUnmounted, useLoadUniswapPairs, useLocalStorage, usePlaceholder, usePlugins, usePrevious, useSinglePlaceholder, useWeb3, utils, validateAndParseAddress, validateDFOMetadata, version$1 as version, web3States, wordlists };
65363
65550
  //# sourceMappingURL=index.esm.js.map