@ethereansos/interfaces-core 0.4.145 → 0.4.146

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,198 @@ 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
+
64050
+ function openDB(name, version) {
64051
+ return new Promise(function (ok, ko) {
64052
+ var request = dbEngine.open(name, version);
64053
+
64054
+ request.onerror = function (event) {
64055
+ return ko(event.target.errorCode);
64056
+ };
64057
+
64058
+ request.onsuccess = function (event) {
64059
+ return ok(event.target.result);
64060
+ };
64061
+
64062
+ request.onupgradeneeded = function (event) {
64063
+ var store = event.target.result.createObjectStore(dbTable, {
64064
+ autoIncrement: true
64065
+ });
64066
+ store.createIndex('key', 'key', {
64067
+ unique: true
64068
+ });
64069
+ };
64070
+ });
64071
+ }
64072
+
64073
+ function closeDB(db) {
64074
+ return new Promise(function (ok, ko) {
64075
+ var request = db.close();
64076
+
64077
+ if (!request) {
64078
+ return ok();
64079
+ }
64080
+
64081
+ request.onerror = function (event) {
64082
+ return ko(event.target.errorCode);
64083
+ };
64084
+
64085
+ request.onsuccess = function (event) {
64086
+ return ok(event.target.result);
64087
+ };
64088
+ });
64089
+ }
64090
+
64091
+ function setItem(key, value) {
64092
+ return new Promise( /*#__PURE__*/function () {
64093
+ var _ref = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ok, ko) {
64094
+ var db, txn, store, query;
64095
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
64096
+ while (1) {
64097
+ switch (_context2.prev = _context2.next) {
64098
+ case 0:
64099
+ _context2.next = 2;
64100
+ return openDB(dbName, dbVersion);
64101
+
64102
+ case 2:
64103
+ db = _context2.sent;
64104
+ txn = db.transaction(dbTable, 'readwrite');
64105
+ store = txn.objectStore(dbTable);
64106
+ query = store.put({
64107
+ key: key,
64108
+ value: value && _typeof(value).toLowerCase() === 'string' ? value : JSON.stringify(value || null)
64109
+ });
64110
+
64111
+ query.onsuccess = function (event) {
64112
+ return ok(event.target.result);
64113
+ };
64114
+
64115
+ query.onerror = function (event) {
64116
+ return ko(event.target.errorCode);
64117
+ };
64118
+
64119
+ txn.oncomplete = /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
64120
+ return regeneratorRuntime.wrap(function _callee$(_context) {
64121
+ while (1) {
64122
+ switch (_context.prev = _context.next) {
64123
+ case 0:
64124
+ _context.next = 2;
64125
+ return closeDB(db);
64126
+
64127
+ case 2:
64128
+ case "end":
64129
+ return _context.stop();
64130
+ }
64131
+ }
64132
+ }, _callee);
64133
+ }));
64134
+
64135
+ case 9:
64136
+ case "end":
64137
+ return _context2.stop();
64138
+ }
64139
+ }
64140
+ }, _callee2);
64141
+ }));
64142
+
64143
+ return function (_x, _x2) {
64144
+ return _ref.apply(this, arguments);
64145
+ };
64146
+ }());
64147
+ }
64148
+
64149
+ function getItem(key) {
64150
+ return new Promise( /*#__PURE__*/function () {
64151
+ var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(ok, ko) {
64152
+ var db, txn, store, index, query;
64153
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
64154
+ while (1) {
64155
+ switch (_context4.prev = _context4.next) {
64156
+ case 0:
64157
+ _context4.next = 2;
64158
+ return openDB(dbName, dbVersion);
64159
+
64160
+ case 2:
64161
+ db = _context4.sent;
64162
+ txn = db.transaction(dbTable, 'readonly');
64163
+ store = txn.objectStore(dbTable);
64164
+ index = store.index('key');
64165
+ query = index.get(key);
64166
+
64167
+ query.onsuccess = function (event) {
64168
+ var _event$target, _event$target$result;
64169
+
64170
+ 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');
64171
+ };
64172
+
64173
+ query.onerror = function (event) {
64174
+ return ko(event.target.errorCode);
64175
+ };
64176
+
64177
+ txn.oncomplete = /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
64178
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
64179
+ while (1) {
64180
+ switch (_context3.prev = _context3.next) {
64181
+ case 0:
64182
+ _context3.next = 2;
64183
+ return closeDB(db);
64184
+
64185
+ case 2:
64186
+ case "end":
64187
+ return _context3.stop();
64188
+ }
64189
+ }
64190
+ }, _callee3);
64191
+ }));
64192
+
64193
+ case 10:
64194
+ case "end":
64195
+ return _context4.stop();
64196
+ }
64197
+ }
64198
+ }, _callee4);
64199
+ }));
64200
+
64201
+ return function (_x3, _x4) {
64202
+ return _ref3.apply(this, arguments);
64203
+ };
64204
+ }());
64205
+ }
64206
+
64207
+ function clear(_x5) {
64208
+ return _clear.apply(this, arguments);
64209
+ }
64210
+
64211
+ function _clear() {
64212
+ _clear = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(key) {
64213
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
64214
+ while (1) {
64215
+ switch (_context5.prev = _context5.next) {
64216
+ case 0:
64217
+ case "end":
64218
+ return _context5.stop();
64219
+ }
64220
+ }
64221
+ }, _callee5);
64222
+ }));
64223
+ return _clear.apply(this, arguments);
64224
+ }
64225
+
64226
+ var cache = window.ethereansOSCache = {
64227
+ getItem: getItem,
64228
+ setItem: setItem,
64229
+ clear: clear
64230
+ };
64231
+
64040
64232
  function memoryFetch(_x, _x2) {
64041
64233
  return _memoryFetch.apply(this, arguments);
64042
64234
  }
@@ -64067,42 +64259,61 @@ function _memoryFetch() {
64067
64259
 
64068
64260
  case 8:
64069
64261
  key = web3Utils.sha3(url);
64262
+ _context.prev = 9;
64263
+ _context.t0 = JSON;
64264
+ _context.next = 13;
64265
+ return cache.getItem(key);
64070
64266
 
64071
- try {
64072
- element = JSON.parse(window.localStorage.getItem(key));
64073
- } catch (e) {}
64267
+ case 13:
64268
+ _context.t1 = _context.sent;
64269
+ element = _context.t0.parse.call(_context.t0, _context.t1);
64270
+ _context.next = 19;
64271
+ break;
64272
+
64273
+ case 17:
64274
+ _context.prev = 17;
64275
+ _context.t2 = _context["catch"](9);
64074
64276
 
64277
+ case 19:
64075
64278
  if (!element) {
64076
- _context.next = 12;
64279
+ _context.next = 21;
64077
64280
  break;
64078
64281
  }
64079
64282
 
64080
64283
  return _context.abrupt("return", element);
64081
64284
 
64082
- case 12:
64083
- _context.next = 14;
64285
+ case 21:
64286
+ _context.next = 23;
64084
64287
  return fetch(url);
64085
64288
 
64086
- case 14:
64289
+ case 23:
64087
64290
  element = _context.sent;
64088
- _context.next = 17;
64291
+ _context.next = 26;
64089
64292
  return element[type || 'json']();
64090
64293
 
64091
- case 17:
64294
+ case 26:
64092
64295
  element = _context.sent;
64296
+ _context.prev = 27;
64297
+ _context.next = 30;
64298
+ return cache.setItem(key, JSON.stringify(element));
64093
64299
 
64094
- try {
64095
- window.localStorage.setItem(key, JSON.stringify(element));
64096
- } catch (e) {}
64300
+ case 30:
64301
+ _context.next = 34;
64302
+ break;
64303
+
64304
+ case 32:
64305
+ _context.prev = 32;
64306
+ _context.t3 = _context["catch"](27);
64097
64307
 
64308
+ case 34:
64098
64309
  return _context.abrupt("return", element);
64099
64310
 
64100
- case 20:
64311
+ case 35:
64101
64312
  case "end":
64102
64313
  return _context.stop();
64103
64314
  }
64104
64315
  }
64105
- }, _callee);
64316
+ }, _callee, null, [[9, 17], [27, 32]]);
64106
64317
  }));
64107
64318
  return _memoryFetch.apply(this, arguments);
64108
64319
  }
@@ -65359,5 +65570,5 @@ var tokenPercentage = function tokenPercentage(amount, totalSupply) {
65359
65570
 
65360
65571
  var abi = new AbiCoder();
65361
65572
 
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 };
65573
+ 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
65574
  //# sourceMappingURL=index.esm.js.map