@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.cjs.js +247 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +247 -16
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
@@ -64049,52 +64049,283 @@ const gBase64 = {
|
|
64049
64049
|
extendBuiltins: extendBuiltins,
|
64050
64050
|
};
|
64051
64051
|
|
64052
|
+
(typeof window === "undefined" ? "undefined" : _typeof(window)).toLowerCase() === 'undefined' && (global.window = global);
|
64053
|
+
var dbEngine = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
|
64054
|
+
window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction || {
|
64055
|
+
READ_WRITE: 'readwrite'
|
64056
|
+
};
|
64057
|
+
window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange;
|
64058
|
+
var dbName = 'ethereansos';
|
64059
|
+
var dbTable = 'ethereansos';
|
64060
|
+
var dbVersion = 1;
|
64061
|
+
|
64062
|
+
function openDB(name, version) {
|
64063
|
+
return new Promise(function (ok, ko) {
|
64064
|
+
var request = dbEngine.open(name, version);
|
64065
|
+
|
64066
|
+
request.onerror = function (event) {
|
64067
|
+
return ko(event.target.errorCode);
|
64068
|
+
};
|
64069
|
+
|
64070
|
+
request.onsuccess = function (event) {
|
64071
|
+
return ok(event.target.result);
|
64072
|
+
};
|
64073
|
+
|
64074
|
+
request.onupgradeneeded = function (event) {
|
64075
|
+
var store = event.target.result.createObjectStore(dbTable, {
|
64076
|
+
autoIncrement: true
|
64077
|
+
});
|
64078
|
+
store.createIndex('key', 'key', {
|
64079
|
+
unique: true
|
64080
|
+
});
|
64081
|
+
};
|
64082
|
+
});
|
64083
|
+
}
|
64084
|
+
|
64085
|
+
function closeDB(db) {
|
64086
|
+
return new Promise(function (ok, ko) {
|
64087
|
+
var request = db.close();
|
64088
|
+
|
64089
|
+
if (!request) {
|
64090
|
+
return ok();
|
64091
|
+
}
|
64092
|
+
|
64093
|
+
request.onerror = function (event) {
|
64094
|
+
return ko(event.target.errorCode);
|
64095
|
+
};
|
64096
|
+
|
64097
|
+
request.onsuccess = function (event) {
|
64098
|
+
return ok(event.target.result);
|
64099
|
+
};
|
64100
|
+
});
|
64101
|
+
}
|
64102
|
+
|
64103
|
+
function setItem(key, value) {
|
64104
|
+
return new Promise( /*#__PURE__*/function () {
|
64105
|
+
var _ref = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ok, ko) {
|
64106
|
+
var db, txn, store, query;
|
64107
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
64108
|
+
while (1) {
|
64109
|
+
switch (_context2.prev = _context2.next) {
|
64110
|
+
case 0:
|
64111
|
+
_context2.next = 2;
|
64112
|
+
return openDB(dbName, dbVersion);
|
64113
|
+
|
64114
|
+
case 2:
|
64115
|
+
db = _context2.sent;
|
64116
|
+
txn = db.transaction(dbTable, 'readwrite');
|
64117
|
+
store = txn.objectStore(dbTable);
|
64118
|
+
query = store.put({
|
64119
|
+
key: key,
|
64120
|
+
value: value && _typeof(value).toLowerCase() === 'string' ? value : JSON.stringify(value || null)
|
64121
|
+
});
|
64122
|
+
|
64123
|
+
query.onsuccess = function (event) {
|
64124
|
+
return ok(event.target.result);
|
64125
|
+
};
|
64126
|
+
|
64127
|
+
query.onerror = function (event) {
|
64128
|
+
return ko(event.target.errorCode);
|
64129
|
+
};
|
64130
|
+
|
64131
|
+
txn.oncomplete = /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
64132
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
64133
|
+
while (1) {
|
64134
|
+
switch (_context.prev = _context.next) {
|
64135
|
+
case 0:
|
64136
|
+
_context.next = 2;
|
64137
|
+
return closeDB(db);
|
64138
|
+
|
64139
|
+
case 2:
|
64140
|
+
case "end":
|
64141
|
+
return _context.stop();
|
64142
|
+
}
|
64143
|
+
}
|
64144
|
+
}, _callee);
|
64145
|
+
}));
|
64146
|
+
|
64147
|
+
case 9:
|
64148
|
+
case "end":
|
64149
|
+
return _context2.stop();
|
64150
|
+
}
|
64151
|
+
}
|
64152
|
+
}, _callee2);
|
64153
|
+
}));
|
64154
|
+
|
64155
|
+
return function (_x, _x2) {
|
64156
|
+
return _ref.apply(this, arguments);
|
64157
|
+
};
|
64158
|
+
}());
|
64159
|
+
}
|
64160
|
+
|
64161
|
+
function getItem(key) {
|
64162
|
+
return new Promise( /*#__PURE__*/function () {
|
64163
|
+
var _ref3 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(ok, ko) {
|
64164
|
+
var db, txn, store, index, query;
|
64165
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
64166
|
+
while (1) {
|
64167
|
+
switch (_context4.prev = _context4.next) {
|
64168
|
+
case 0:
|
64169
|
+
_context4.next = 2;
|
64170
|
+
return openDB(dbName, dbVersion);
|
64171
|
+
|
64172
|
+
case 2:
|
64173
|
+
db = _context4.sent;
|
64174
|
+
txn = db.transaction(dbTable, 'readonly');
|
64175
|
+
store = txn.objectStore(dbTable);
|
64176
|
+
index = store.index('key');
|
64177
|
+
query = index.get(key);
|
64178
|
+
|
64179
|
+
query.onsuccess = function (event) {
|
64180
|
+
var _event$target, _event$target$result;
|
64181
|
+
|
64182
|
+
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');
|
64183
|
+
};
|
64184
|
+
|
64185
|
+
query.onerror = function (event) {
|
64186
|
+
return ko(event.target.errorCode);
|
64187
|
+
};
|
64188
|
+
|
64189
|
+
txn.oncomplete = /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
64190
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
64191
|
+
while (1) {
|
64192
|
+
switch (_context3.prev = _context3.next) {
|
64193
|
+
case 0:
|
64194
|
+
_context3.next = 2;
|
64195
|
+
return closeDB(db);
|
64196
|
+
|
64197
|
+
case 2:
|
64198
|
+
case "end":
|
64199
|
+
return _context3.stop();
|
64200
|
+
}
|
64201
|
+
}
|
64202
|
+
}, _callee3);
|
64203
|
+
}));
|
64204
|
+
|
64205
|
+
case 10:
|
64206
|
+
case "end":
|
64207
|
+
return _context4.stop();
|
64208
|
+
}
|
64209
|
+
}
|
64210
|
+
}, _callee4);
|
64211
|
+
}));
|
64212
|
+
|
64213
|
+
return function (_x3, _x4) {
|
64214
|
+
return _ref3.apply(this, arguments);
|
64215
|
+
};
|
64216
|
+
}());
|
64217
|
+
}
|
64218
|
+
|
64219
|
+
function clear(_x5) {
|
64220
|
+
return _clear.apply(this, arguments);
|
64221
|
+
}
|
64222
|
+
|
64223
|
+
function _clear() {
|
64224
|
+
_clear = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(key) {
|
64225
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
64226
|
+
while (1) {
|
64227
|
+
switch (_context5.prev = _context5.next) {
|
64228
|
+
case 0:
|
64229
|
+
case "end":
|
64230
|
+
return _context5.stop();
|
64231
|
+
}
|
64232
|
+
}
|
64233
|
+
}, _callee5);
|
64234
|
+
}));
|
64235
|
+
return _clear.apply(this, arguments);
|
64236
|
+
}
|
64237
|
+
|
64238
|
+
var cache = window.ethereansOSCache = {
|
64239
|
+
getItem: getItem,
|
64240
|
+
setItem: setItem,
|
64241
|
+
clear: clear
|
64242
|
+
};
|
64243
|
+
|
64052
64244
|
function memoryFetch(_x, _x2) {
|
64053
64245
|
return _memoryFetch.apply(this, arguments);
|
64054
64246
|
}
|
64055
64247
|
|
64056
64248
|
function _memoryFetch() {
|
64057
64249
|
_memoryFetch = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url, type) {
|
64058
|
-
var element;
|
64250
|
+
var element, key;
|
64059
64251
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
64060
64252
|
while (1) {
|
64061
64253
|
switch (_context.prev = _context.next) {
|
64062
64254
|
case 0:
|
64063
|
-
|
64064
|
-
|
64065
|
-
|
64255
|
+
if (!(url.indexOf('data') === 0)) {
|
64256
|
+
_context.next = 8;
|
64257
|
+
break;
|
64258
|
+
}
|
64066
64259
|
|
64260
|
+
_context.next = 3;
|
64261
|
+
return fetch(url);
|
64262
|
+
|
64263
|
+
case 3:
|
64264
|
+
element = _context.sent;
|
64265
|
+
_context.next = 6;
|
64266
|
+
return element[type || 'json']();
|
64267
|
+
|
64268
|
+
case 6:
|
64269
|
+
element = _context.sent;
|
64270
|
+
return _context.abrupt("return", element);
|
64271
|
+
|
64272
|
+
case 8:
|
64273
|
+
key = web3Utils__default["default"].sha3(url);
|
64274
|
+
_context.prev = 9;
|
64275
|
+
_context.t0 = JSON;
|
64276
|
+
_context.next = 13;
|
64277
|
+
return cache.getItem(key);
|
64278
|
+
|
64279
|
+
case 13:
|
64280
|
+
_context.t1 = _context.sent;
|
64281
|
+
element = _context.t0.parse.call(_context.t0, _context.t1);
|
64282
|
+
_context.next = 19;
|
64283
|
+
break;
|
64284
|
+
|
64285
|
+
case 17:
|
64286
|
+
_context.prev = 17;
|
64287
|
+
_context.t2 = _context["catch"](9);
|
64288
|
+
|
64289
|
+
case 19:
|
64067
64290
|
if (!element) {
|
64068
|
-
_context.next =
|
64291
|
+
_context.next = 21;
|
64069
64292
|
break;
|
64070
64293
|
}
|
64071
64294
|
|
64072
64295
|
return _context.abrupt("return", element);
|
64073
64296
|
|
64074
|
-
case
|
64075
|
-
_context.next =
|
64297
|
+
case 21:
|
64298
|
+
_context.next = 23;
|
64076
64299
|
return fetch(url);
|
64077
64300
|
|
64078
|
-
case
|
64301
|
+
case 23:
|
64079
64302
|
element = _context.sent;
|
64080
|
-
_context.next =
|
64303
|
+
_context.next = 26;
|
64081
64304
|
return element[type || 'json']();
|
64082
64305
|
|
64083
|
-
case
|
64306
|
+
case 26:
|
64084
64307
|
element = _context.sent;
|
64308
|
+
_context.prev = 27;
|
64309
|
+
_context.next = 30;
|
64310
|
+
return cache.setItem(key, JSON.stringify(element));
|
64085
64311
|
|
64086
|
-
|
64087
|
-
|
64088
|
-
|
64312
|
+
case 30:
|
64313
|
+
_context.next = 34;
|
64314
|
+
break;
|
64315
|
+
|
64316
|
+
case 32:
|
64317
|
+
_context.prev = 32;
|
64318
|
+
_context.t3 = _context["catch"](27);
|
64089
64319
|
|
64320
|
+
case 34:
|
64090
64321
|
return _context.abrupt("return", element);
|
64091
64322
|
|
64092
|
-
case
|
64323
|
+
case 35:
|
64093
64324
|
case "end":
|
64094
64325
|
return _context.stop();
|
64095
64326
|
}
|
64096
64327
|
}
|
64097
|
-
}, _callee);
|
64328
|
+
}, _callee, null, [[9, 17], [27, 32]]);
|
64098
64329
|
}));
|
64099
64330
|
return _memoryFetch.apply(this, arguments);
|
64100
64331
|
}
|
@@ -65414,6 +65645,7 @@ exports.Wordlist = Wordlist;
|
|
65414
65645
|
exports.abi = abi;
|
65415
65646
|
exports.add = add;
|
65416
65647
|
exports.blockchainCall = blockchainCall;
|
65648
|
+
exports.cache = cache;
|
65417
65649
|
exports.checkCoverSize = checkCoverSize;
|
65418
65650
|
exports.computePoolAddress = computePoolAddress;
|
65419
65651
|
exports.computePriceImpact = computePriceImpact;
|