@ethereansos/interfaces-core 0.4.149 → 0.4.152
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs.js +86 -54
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +86 -54
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -64065,32 +64065,64 @@ function openDB(name, version) {
|
|
64065
64065
|
};
|
64066
64066
|
|
64067
64067
|
request.onupgradeneeded = function (event) {
|
64068
|
-
|
64068
|
+
event.target.result.createObjectStore(dbTable, {
|
64069
64069
|
autoIncrement: true
|
64070
|
-
})
|
64071
|
-
store.createIndex('key', 'key', {
|
64070
|
+
}).createIndex('key', 'key', {
|
64072
64071
|
unique: true
|
64073
64072
|
});
|
64074
64073
|
};
|
64075
64074
|
});
|
64076
64075
|
}
|
64077
64076
|
|
64077
|
+
function closeDB(db) {
|
64078
|
+
if (!db) {
|
64079
|
+
return;
|
64080
|
+
}
|
64081
|
+
|
64082
|
+
return new Promise(function (ok, ko) {
|
64083
|
+
if (db === internalDB) {
|
64084
|
+
internalDB = undefined;
|
64085
|
+
}
|
64086
|
+
|
64087
|
+
var request = db.close();
|
64088
|
+
|
64089
|
+
if (!request) {
|
64090
|
+
return ok();
|
64091
|
+
}
|
64092
|
+
|
64093
|
+
request.onerror = function (event) {
|
64094
|
+
return ko(event.target.error || event.target.errorCode);
|
64095
|
+
};
|
64096
|
+
|
64097
|
+
request.onsuccess = function (event) {
|
64098
|
+
return ok(event.target.result);
|
64099
|
+
};
|
64100
|
+
});
|
64101
|
+
}
|
64102
|
+
|
64078
64103
|
function setItem(key, value) {
|
64104
|
+
if (window.ganache) {
|
64105
|
+
return;
|
64106
|
+
}
|
64107
|
+
|
64079
64108
|
return new Promise( /*#__PURE__*/function () {
|
64080
|
-
var _ref = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function
|
64109
|
+
var _ref = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee(ok, ko) {
|
64081
64110
|
var db, txn, store, query;
|
64082
|
-
return regeneratorRuntime.wrap(function
|
64111
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
64083
64112
|
while (1) {
|
64084
|
-
switch (
|
64113
|
+
switch (_context.prev = _context.next) {
|
64085
64114
|
case 0:
|
64086
|
-
|
64115
|
+
_context.next = 2;
|
64087
64116
|
return openDB(dbName, dbVersion);
|
64088
64117
|
|
64089
64118
|
case 2:
|
64090
|
-
db =
|
64119
|
+
db = _context.sent;
|
64091
64120
|
txn = db.transaction(dbTable, 'readwrite');
|
64092
64121
|
store = txn.objectStore(dbTable);
|
64093
|
-
query = store.put(
|
64122
|
+
query = store.put({
|
64123
|
+
key: key,
|
64124
|
+
value: value && _typeof(value).toLowerCase() === 'string' ? value : JSON.stringify(value || null)
|
64125
|
+
}, key);
|
64094
64126
|
|
64095
64127
|
query.onsuccess = function (event) {
|
64096
64128
|
return ok(event.target.result);
|
@@ -64100,24 +64132,12 @@ function setItem(key, value) {
|
|
64100
64132
|
return ko(event.target.error || event.target.errorCode);
|
64101
64133
|
};
|
64102
64134
|
|
64103
|
-
|
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:
|
64135
|
+
case 8:
|
64116
64136
|
case "end":
|
64117
|
-
return
|
64137
|
+
return _context.stop();
|
64118
64138
|
}
|
64119
64139
|
}
|
64120
|
-
},
|
64140
|
+
}, _callee);
|
64121
64141
|
}));
|
64122
64142
|
|
64123
64143
|
return function (_x, _x2) {
|
@@ -64128,73 +64148,85 @@ function setItem(key, value) {
|
|
64128
64148
|
|
64129
64149
|
function getItem(key) {
|
64130
64150
|
return new Promise( /*#__PURE__*/function () {
|
64131
|
-
var
|
64151
|
+
var _ref2 = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ok, ko) {
|
64132
64152
|
var db, txn, store, index, query;
|
64133
|
-
return regeneratorRuntime.wrap(function
|
64153
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
64134
64154
|
while (1) {
|
64135
|
-
switch (
|
64155
|
+
switch (_context2.prev = _context2.next) {
|
64136
64156
|
case 0:
|
64137
|
-
|
64157
|
+
_context2.next = 2;
|
64138
64158
|
return openDB(dbName, dbVersion);
|
64139
64159
|
|
64140
64160
|
case 2:
|
64141
|
-
db =
|
64161
|
+
db = _context2.sent;
|
64142
64162
|
txn = db.transaction(dbTable, 'readonly');
|
64143
64163
|
store = txn.objectStore(dbTable);
|
64144
64164
|
index = store.index('key');
|
64145
64165
|
query = index.get(key);
|
64146
64166
|
|
64147
64167
|
query.onsuccess = function (event) {
|
64148
|
-
var _event$target;
|
64168
|
+
var _event$target, _event$target$result;
|
64149
64169
|
|
64150
|
-
return ok(((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.result) || 'null');
|
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');
|
64151
64171
|
};
|
64152
64172
|
|
64153
64173
|
query.onerror = function (event) {
|
64154
64174
|
return ko(event.target.error || event.target.errorCode);
|
64155
64175
|
};
|
64156
64176
|
|
64157
|
-
|
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:
|
64177
|
+
case 9:
|
64170
64178
|
case "end":
|
64171
|
-
return
|
64179
|
+
return _context2.stop();
|
64172
64180
|
}
|
64173
64181
|
}
|
64174
|
-
},
|
64182
|
+
}, _callee2);
|
64175
64183
|
}));
|
64176
64184
|
|
64177
64185
|
return function (_x3, _x4) {
|
64178
|
-
return
|
64186
|
+
return _ref2.apply(this, arguments);
|
64179
64187
|
};
|
64180
64188
|
}());
|
64181
64189
|
}
|
64182
64190
|
|
64183
|
-
function clear(
|
64191
|
+
function clear() {
|
64184
64192
|
return _clear.apply(this, arguments);
|
64185
64193
|
}
|
64186
64194
|
|
64187
64195
|
function _clear() {
|
64188
|
-
_clear = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function
|
64189
|
-
return regeneratorRuntime.wrap(function
|
64196
|
+
_clear = _asyncToGenerator$1( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
64197
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
64190
64198
|
while (1) {
|
64191
|
-
switch (
|
64199
|
+
switch (_context3.prev = _context3.next) {
|
64192
64200
|
case 0:
|
64201
|
+
_context3.next = 2;
|
64202
|
+
return closeDB();
|
64203
|
+
|
64204
|
+
case 2:
|
64205
|
+
internalDB = undefined;
|
64206
|
+
_context3.next = 5;
|
64207
|
+
return new Promise(function (ok, ko) {
|
64208
|
+
var request = dbEngine.deleteDatabase(dbName);
|
64209
|
+
|
64210
|
+
request.onsuccess = function (event) {
|
64211
|
+
var _event$target2;
|
64212
|
+
|
64213
|
+
return ok(event === null || event === void 0 ? void 0 : (_event$target2 = event.target) === null || _event$target2 === void 0 ? void 0 : _event$target2.result);
|
64214
|
+
};
|
64215
|
+
|
64216
|
+
request.onerror = function (event) {
|
64217
|
+
return ko(event.target.error || event.target.errorCode);
|
64218
|
+
};
|
64219
|
+
});
|
64220
|
+
|
64221
|
+
case 5:
|
64222
|
+
return _context3.abrupt("return", _context3.sent);
|
64223
|
+
|
64224
|
+
case 6:
|
64193
64225
|
case "end":
|
64194
|
-
return
|
64226
|
+
return _context3.stop();
|
64195
64227
|
}
|
64196
64228
|
}
|
64197
|
-
},
|
64229
|
+
}, _callee3);
|
64198
64230
|
}));
|
64199
64231
|
return _clear.apply(this, arguments);
|
64200
64232
|
}
|
@@ -64303,7 +64335,7 @@ function cleanLink(linkToClean) {
|
|
64303
64335
|
|
64304
64336
|
var split = cleanedLink.split('/ipfs/');
|
64305
64337
|
var ipfsLink = split[split.length - 1];
|
64306
|
-
cleanedLink = '//
|
64338
|
+
cleanedLink = '//ipfs.io/ipfs/' + ipfsLink;
|
64307
64339
|
return cleanedLink;
|
64308
64340
|
}
|
64309
64341
|
|