@ethereansos/interfaces-core 0.4.144 → 0.4.147

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -64037,54 +64037,262 @@ 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({
64094
+ key: key,
64095
+ value: value && _typeof(value).toLowerCase() === 'string' ? value : JSON.stringify(value || null)
64096
+ });
64097
+
64098
+ query.onsuccess = function (event) {
64099
+ return ok(event.target.result);
64100
+ };
64101
+
64102
+ query.onerror = function (event) {
64103
+ return ko(event.target.errorCode);
64104
+ };
64105
+
64106
+ txn.oncomplete = /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
64107
+ return regeneratorRuntime.wrap(function _callee$(_context) {
64108
+ while (1) {
64109
+ switch (_context.prev = _context.next) {
64110
+ case 0:
64111
+ case "end":
64112
+ return _context.stop();
64113
+ }
64114
+ }
64115
+ }, _callee);
64116
+ }));
64117
+
64118
+ case 9:
64119
+ case "end":
64120
+ return _context2.stop();
64121
+ }
64122
+ }
64123
+ }, _callee2);
64124
+ }));
64125
+
64126
+ return function (_x, _x2) {
64127
+ return _ref.apply(this, arguments);
64128
+ };
64129
+ }());
64130
+ }
64131
+
64132
+ function getItem(key) {
64133
+ return new Promise( /*#__PURE__*/function () {
64134
+ var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(ok, ko) {
64135
+ var db, txn, store, index, query;
64136
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
64137
+ while (1) {
64138
+ switch (_context4.prev = _context4.next) {
64139
+ case 0:
64140
+ _context4.next = 2;
64141
+ return openDB(dbName, dbVersion);
64142
+
64143
+ case 2:
64144
+ db = _context4.sent;
64145
+ txn = db.transaction(dbTable, 'readonly');
64146
+ store = txn.objectStore(dbTable);
64147
+ index = store.index('key');
64148
+ query = index.get(key);
64149
+
64150
+ query.onsuccess = function (event) {
64151
+ var _event$target, _event$target$result;
64152
+
64153
+ 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');
64154
+ };
64155
+
64156
+ query.onerror = function (event) {
64157
+ return ko(event.target.errorCode);
64158
+ };
64159
+
64160
+ txn.oncomplete = /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
64161
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
64162
+ while (1) {
64163
+ switch (_context3.prev = _context3.next) {
64164
+ case 0:
64165
+ case "end":
64166
+ return _context3.stop();
64167
+ }
64168
+ }
64169
+ }, _callee3);
64170
+ }));
64171
+
64172
+ case 10:
64173
+ case "end":
64174
+ return _context4.stop();
64175
+ }
64176
+ }
64177
+ }, _callee4);
64178
+ }));
64179
+
64180
+ return function (_x3, _x4) {
64181
+ return _ref3.apply(this, arguments);
64182
+ };
64183
+ }());
64184
+ }
64185
+
64186
+ function clear(_x5) {
64187
+ return _clear.apply(this, arguments);
64188
+ }
64189
+
64190
+ function _clear() {
64191
+ _clear = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(key) {
64192
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
64193
+ while (1) {
64194
+ switch (_context5.prev = _context5.next) {
64195
+ case 0:
64196
+ case "end":
64197
+ return _context5.stop();
64198
+ }
64199
+ }
64200
+ }, _callee5);
64201
+ }));
64202
+ return _clear.apply(this, arguments);
64203
+ }
64204
+
64205
+ var cache = window.ethereansOSCache = {
64206
+ getItem: getItem,
64207
+ setItem: setItem,
64208
+ clear: clear
64209
+ };
64210
+
64040
64211
  function memoryFetch(_x, _x2) {
64041
64212
  return _memoryFetch.apply(this, arguments);
64042
64213
  }
64043
64214
 
64044
64215
  function _memoryFetch() {
64045
64216
  _memoryFetch = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url, type) {
64046
- var key, element;
64217
+ var element, key;
64047
64218
  return regeneratorRuntime.wrap(function _callee$(_context) {
64048
64219
  while (1) {
64049
64220
  switch (_context.prev = _context.next) {
64050
64221
  case 0:
64222
+ if (!(url.indexOf('data') === 0)) {
64223
+ _context.next = 8;
64224
+ break;
64225
+ }
64226
+
64227
+ _context.next = 3;
64228
+ return fetch(url);
64229
+
64230
+ case 3:
64231
+ element = _context.sent;
64232
+ _context.next = 6;
64233
+ return element[type || 'json']();
64234
+
64235
+ case 6:
64236
+ element = _context.sent;
64237
+ return _context.abrupt("return", element);
64238
+
64239
+ case 8:
64051
64240
  key = web3Utils.sha3(url);
64241
+ _context.prev = 9;
64242
+ _context.t0 = JSON;
64243
+ _context.next = 13;
64244
+ return cache.getItem(key);
64052
64245
 
64053
- try {
64054
- element = JSON.parse(window.localStorage.getItem(key));
64055
- } catch (e) {}
64246
+ case 13:
64247
+ _context.t1 = _context.sent;
64248
+ element = _context.t0.parse.call(_context.t0, _context.t1);
64249
+ _context.next = 19;
64250
+ break;
64251
+
64252
+ case 17:
64253
+ _context.prev = 17;
64254
+ _context.t2 = _context["catch"](9);
64056
64255
 
64256
+ case 19:
64057
64257
  if (!element) {
64058
- _context.next = 4;
64258
+ _context.next = 21;
64059
64259
  break;
64060
64260
  }
64061
64261
 
64062
64262
  return _context.abrupt("return", element);
64063
64263
 
64064
- case 4:
64065
- _context.next = 6;
64264
+ case 21:
64265
+ _context.next = 23;
64066
64266
  return fetch(url);
64067
64267
 
64068
- case 6:
64268
+ case 23:
64069
64269
  element = _context.sent;
64070
- _context.next = 9;
64270
+ _context.next = 26;
64071
64271
  return element[type || 'json']();
64072
64272
 
64073
- case 9:
64273
+ case 26:
64074
64274
  element = _context.sent;
64275
+ _context.prev = 27;
64276
+ _context.next = 30;
64277
+ return cache.setItem(key, JSON.stringify(element));
64075
64278
 
64076
- try {
64077
- window.localStorage.setItem(key, JSON.stringify(element));
64078
- } catch (e) {}
64279
+ case 30:
64280
+ _context.next = 34;
64281
+ break;
64282
+
64283
+ case 32:
64284
+ _context.prev = 32;
64285
+ _context.t3 = _context["catch"](27);
64079
64286
 
64287
+ case 34:
64080
64288
  return _context.abrupt("return", element);
64081
64289
 
64082
- case 12:
64290
+ case 35:
64083
64291
  case "end":
64084
64292
  return _context.stop();
64085
64293
  }
64086
64294
  }
64087
- }, _callee);
64295
+ }, _callee, null, [[9, 17], [27, 32]]);
64088
64296
  }));
64089
64297
  return _memoryFetch.apply(this, arguments);
64090
64298
  }
@@ -65341,5 +65549,5 @@ var tokenPercentage = function tokenPercentage(amount, totalSupply) {
65341
65549
 
65342
65550
  var abi = new AbiCoder();
65343
65551
 
65344
- 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 };
65552
+ 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 };
65345
65553
  //# sourceMappingURL=index.esm.js.map