@ethereansos/interfaces-core 0.4.143 → 0.4.146

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -64037,52 +64037,283 @@ 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
  }
64043
64235
 
64044
64236
  function _memoryFetch() {
64045
64237
  _memoryFetch = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url, type) {
64046
- var element;
64238
+ var element, key;
64047
64239
  return regeneratorRuntime.wrap(function _callee$(_context) {
64048
64240
  while (1) {
64049
64241
  switch (_context.prev = _context.next) {
64050
64242
  case 0:
64051
- try {
64052
- element = JSON.parse(window.localStorage.getItem(url));
64053
- } catch (e) {}
64243
+ if (!(url.indexOf('data') === 0)) {
64244
+ _context.next = 8;
64245
+ break;
64246
+ }
64054
64247
 
64248
+ _context.next = 3;
64249
+ return fetch(url);
64250
+
64251
+ case 3:
64252
+ element = _context.sent;
64253
+ _context.next = 6;
64254
+ return element[type || 'json']();
64255
+
64256
+ case 6:
64257
+ element = _context.sent;
64258
+ return _context.abrupt("return", element);
64259
+
64260
+ case 8:
64261
+ key = web3Utils.sha3(url);
64262
+ _context.prev = 9;
64263
+ _context.t0 = JSON;
64264
+ _context.next = 13;
64265
+ return cache.getItem(key);
64266
+
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);
64276
+
64277
+ case 19:
64055
64278
  if (!element) {
64056
- _context.next = 3;
64279
+ _context.next = 21;
64057
64280
  break;
64058
64281
  }
64059
64282
 
64060
64283
  return _context.abrupt("return", element);
64061
64284
 
64062
- case 3:
64063
- _context.next = 5;
64285
+ case 21:
64286
+ _context.next = 23;
64064
64287
  return fetch(url);
64065
64288
 
64066
- case 5:
64289
+ case 23:
64067
64290
  element = _context.sent;
64068
- _context.next = 8;
64291
+ _context.next = 26;
64069
64292
  return element[type || 'json']();
64070
64293
 
64071
- case 8:
64294
+ case 26:
64072
64295
  element = _context.sent;
64296
+ _context.prev = 27;
64297
+ _context.next = 30;
64298
+ return cache.setItem(key, JSON.stringify(element));
64073
64299
 
64074
- try {
64075
- window.localStorage.setItem(url, JSON.stringify(element));
64076
- } 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);
64077
64307
 
64308
+ case 34:
64078
64309
  return _context.abrupt("return", element);
64079
64310
 
64080
- case 11:
64311
+ case 35:
64081
64312
  case "end":
64082
64313
  return _context.stop();
64083
64314
  }
64084
64315
  }
64085
- }, _callee);
64316
+ }, _callee, null, [[9, 17], [27, 32]]);
64086
64317
  }));
64087
64318
  return _memoryFetch.apply(this, arguments);
64088
64319
  }
@@ -65339,5 +65570,5 @@ var tokenPercentage = function tokenPercentage(amount, totalSupply) {
65339
65570
 
65340
65571
  var abi = new AbiCoder();
65341
65572
 
65342
- 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 };
65343
65574
  //# sourceMappingURL=index.esm.js.map