@fileverse-dev/formulajs 4.4.11-mod-26 → 4.4.11-mod-28
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/lib/browser/formula.js +1423 -444
- package/lib/browser/formula.min.js +10 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +1025 -119
- package/lib/esm/crypto-constants.mjs +130 -92
- package/lib/esm/index.mjs +1025 -119
- package/package.json +2 -1
- package/types/cjs/index.d.cts +4 -4
- package/types/esm/index.d.mts +4 -4
package/lib/browser/formula.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @fileverse-dev/formulajs v4.4.11-mod-
|
|
1
|
+
/* @fileverse-dev/formulajs v4.4.11-mod-28 */
|
|
2
2
|
var _excluded = [ "confirmations", "dataDecoded" ];
|
|
3
3
|
|
|
4
4
|
function _objectWithoutProperties(e, t) {
|
|
@@ -1132,6 +1132,7 @@ function _typeof(o) {
|
|
|
1132
1132
|
return 64;
|
|
1133
1133
|
}
|
|
1134
1134
|
}
|
|
1135
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
1135
1136
|
function getDefaultExportFromCjs(x) {
|
|
1136
1137
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
1137
1138
|
}
|
|
@@ -10953,7 +10954,8 @@ function _typeof(o) {
|
|
|
10953
10954
|
Safe: "SAFE_API_KEY",
|
|
10954
10955
|
Basescan: "BASESCAN_API_KEY",
|
|
10955
10956
|
Gnosisscan: "GNOSIS_API_KEY",
|
|
10956
|
-
Firefly: "FIRE_FLY_API_KEY"
|
|
10957
|
+
Firefly: "FIRE_FLY_API_KEY",
|
|
10958
|
+
GnosisPay: "GNOSIS_API_KEY"
|
|
10957
10959
|
};
|
|
10958
10960
|
var fromTimeStampToBlock = function() {
|
|
10959
10961
|
var _ref = _asyncToGenerator(_regeneratorRuntime().mark((function _callee(timestamp, chain, apiKey) {
|
|
@@ -10992,6 +10994,11 @@ function _typeof(o) {
|
|
|
10992
10994
|
return _ref.apply(this, arguments);
|
|
10993
10995
|
};
|
|
10994
10996
|
}();
|
|
10997
|
+
function toTimestamp(dateStr) {
|
|
10998
|
+
var _dateStr$split$map = dateStr.split("/").map(Number), _dateStr$split$map2 = _slicedToArray(_dateStr$split$map, 3), day = _dateStr$split$map2[0], month = _dateStr$split$map2[1], year = _dateStr$split$map2[2];
|
|
10999
|
+
var date = new Date(year, month - 1, day);
|
|
11000
|
+
return Math.floor(date.getTime() / 1e3);
|
|
11001
|
+
}
|
|
10995
11002
|
function handleScanRequest(_x4) {
|
|
10996
11003
|
return _handleScanRequest.apply(this, arguments);
|
|
10997
11004
|
}
|
|
@@ -11061,7 +11068,7 @@ function _typeof(o) {
|
|
|
11061
11068
|
break;
|
|
11062
11069
|
}
|
|
11063
11070
|
_context2.next = 23;
|
|
11064
|
-
return Promise.all([ fromTimeStampToBlock(startDate, chain, API_KEY), fromTimeStampToBlock(endDate, chain, API_KEY) ]);
|
|
11071
|
+
return Promise.all([ fromTimeStampToBlock(toTimestamp(startDate), chain, API_KEY), fromTimeStampToBlock(toTimestamp(endDate), chain, API_KEY) ]);
|
|
11065
11072
|
|
|
11066
11073
|
case 23:
|
|
11067
11074
|
_yield$Promise$all = _context2.sent;
|
|
@@ -11126,163 +11133,887 @@ function _typeof(o) {
|
|
|
11126
11133
|
})));
|
|
11127
11134
|
return _handleScanRequest.apply(this, arguments);
|
|
11128
11135
|
}
|
|
11129
|
-
|
|
11130
|
-
|
|
11136
|
+
var sha3 = {
|
|
11137
|
+
exports: {}
|
|
11138
|
+
};
|
|
11139
|
+
/**
|
|
11140
|
+
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
11141
|
+
*
|
|
11142
|
+
* @version 0.9.3
|
|
11143
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
11144
|
+
* @copyright Chen, Yi-Cyuan 2015-2023
|
|
11145
|
+
* @license MIT
|
|
11146
|
+
*/ var hasRequiredSha3;
|
|
11147
|
+
function requireSha3() {
|
|
11148
|
+
if (hasRequiredSha3) return sha3.exports;
|
|
11149
|
+
hasRequiredSha3 = 1;
|
|
11150
|
+
(function(module) {
|
|
11151
|
+
(function() {
|
|
11152
|
+
var INPUT_ERROR = "input is invalid type";
|
|
11153
|
+
var FINALIZE_ERROR = "finalize already called";
|
|
11154
|
+
var WINDOW = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object";
|
|
11155
|
+
var root = WINDOW ? window : {};
|
|
11156
|
+
if (root.JS_SHA3_NO_WINDOW) {
|
|
11157
|
+
WINDOW = false;
|
|
11158
|
+
}
|
|
11159
|
+
var WEB_WORKER = !WINDOW && (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object";
|
|
11160
|
+
var NODE_JS = !root.JS_SHA3_NO_NODE_JS && (typeof process === "undefined" ? "undefined" : _typeof(process)) === "object" && process.versions && process.versions.node;
|
|
11161
|
+
if (NODE_JS) {
|
|
11162
|
+
root = commonjsGlobal;
|
|
11163
|
+
} else if (WEB_WORKER) {
|
|
11164
|
+
root = self;
|
|
11165
|
+
}
|
|
11166
|
+
var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && "object" === "object" && module.exports;
|
|
11167
|
+
var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== "undefined";
|
|
11168
|
+
var HEX_CHARS = "0123456789abcdef".split("");
|
|
11169
|
+
var SHAKE_PADDING = [ 31, 7936, 2031616, 520093696 ];
|
|
11170
|
+
var CSHAKE_PADDING = [ 4, 1024, 262144, 67108864 ];
|
|
11171
|
+
var KECCAK_PADDING = [ 1, 256, 65536, 16777216 ];
|
|
11172
|
+
var PADDING = [ 6, 1536, 393216, 100663296 ];
|
|
11173
|
+
var SHIFT = [ 0, 8, 16, 24 ];
|
|
11174
|
+
var RC = [ 1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648 ];
|
|
11175
|
+
var BITS = [ 224, 256, 384, 512 ];
|
|
11176
|
+
var SHAKE_BITS = [ 128, 256 ];
|
|
11177
|
+
var OUTPUT_TYPES = [ "hex", "buffer", "arrayBuffer", "array", "digest" ];
|
|
11178
|
+
var CSHAKE_BYTEPAD = {
|
|
11179
|
+
128: 168,
|
|
11180
|
+
256: 136
|
|
11181
|
+
};
|
|
11182
|
+
var isArray = root.JS_SHA3_NO_NODE_JS || !Array.isArray ? function(obj) {
|
|
11183
|
+
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
11184
|
+
} : Array.isArray;
|
|
11185
|
+
var isView = ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView) ? function(obj) {
|
|
11186
|
+
return _typeof(obj) === "object" && obj.buffer && obj.buffer.constructor === ArrayBuffer;
|
|
11187
|
+
} : ArrayBuffer.isView;
|
|
11188
|
+
var formatMessage = function formatMessage(message) {
|
|
11189
|
+
var type = _typeof(message);
|
|
11190
|
+
if (type === "string") {
|
|
11191
|
+
return [ message, true ];
|
|
11192
|
+
}
|
|
11193
|
+
if (type !== "object" || message === null) {
|
|
11194
|
+
throw new Error(INPUT_ERROR);
|
|
11195
|
+
}
|
|
11196
|
+
if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
|
|
11197
|
+
return [ new Uint8Array(message), false ];
|
|
11198
|
+
}
|
|
11199
|
+
if (!isArray(message) && !isView(message)) {
|
|
11200
|
+
throw new Error(INPUT_ERROR);
|
|
11201
|
+
}
|
|
11202
|
+
return [ message, false ];
|
|
11203
|
+
};
|
|
11204
|
+
var empty = function empty(message) {
|
|
11205
|
+
return formatMessage(message)[0].length === 0;
|
|
11206
|
+
};
|
|
11207
|
+
var cloneArray = function cloneArray(array) {
|
|
11208
|
+
var newArray = [];
|
|
11209
|
+
for (var i = 0; i < array.length; ++i) {
|
|
11210
|
+
newArray[i] = array[i];
|
|
11211
|
+
}
|
|
11212
|
+
return newArray;
|
|
11213
|
+
};
|
|
11214
|
+
var createOutputMethod = function createOutputMethod(bits, padding, outputType) {
|
|
11215
|
+
return function(message) {
|
|
11216
|
+
return new Keccak(bits, padding, bits).update(message)[outputType]();
|
|
11217
|
+
};
|
|
11218
|
+
};
|
|
11219
|
+
var createShakeOutputMethod = function createShakeOutputMethod(bits, padding, outputType) {
|
|
11220
|
+
return function(message, outputBits) {
|
|
11221
|
+
return new Keccak(bits, padding, outputBits).update(message)[outputType]();
|
|
11222
|
+
};
|
|
11223
|
+
};
|
|
11224
|
+
var createCshakeOutputMethod = function createCshakeOutputMethod(bits, padding, outputType) {
|
|
11225
|
+
return function(message, outputBits, n, s) {
|
|
11226
|
+
return methods["cshake" + bits].update(message, outputBits, n, s)[outputType]();
|
|
11227
|
+
};
|
|
11228
|
+
};
|
|
11229
|
+
var createKmacOutputMethod = function createKmacOutputMethod(bits, padding, outputType) {
|
|
11230
|
+
return function(key, message, outputBits, s) {
|
|
11231
|
+
return methods["kmac" + bits].update(key, message, outputBits, s)[outputType]();
|
|
11232
|
+
};
|
|
11233
|
+
};
|
|
11234
|
+
var createOutputMethods = function createOutputMethods(method, createMethod, bits, padding) {
|
|
11235
|
+
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
|
|
11236
|
+
var type = OUTPUT_TYPES[i];
|
|
11237
|
+
method[type] = createMethod(bits, padding, type);
|
|
11238
|
+
}
|
|
11239
|
+
return method;
|
|
11240
|
+
};
|
|
11241
|
+
var createMethod = function createMethod(bits, padding) {
|
|
11242
|
+
var method = createOutputMethod(bits, padding, "hex");
|
|
11243
|
+
method.create = function() {
|
|
11244
|
+
return new Keccak(bits, padding, bits);
|
|
11245
|
+
};
|
|
11246
|
+
method.update = function(message) {
|
|
11247
|
+
return method.create().update(message);
|
|
11248
|
+
};
|
|
11249
|
+
return createOutputMethods(method, createOutputMethod, bits, padding);
|
|
11250
|
+
};
|
|
11251
|
+
var createShakeMethod = function createShakeMethod(bits, padding) {
|
|
11252
|
+
var method = createShakeOutputMethod(bits, padding, "hex");
|
|
11253
|
+
method.create = function(outputBits) {
|
|
11254
|
+
return new Keccak(bits, padding, outputBits);
|
|
11255
|
+
};
|
|
11256
|
+
method.update = function(message, outputBits) {
|
|
11257
|
+
return method.create(outputBits).update(message);
|
|
11258
|
+
};
|
|
11259
|
+
return createOutputMethods(method, createShakeOutputMethod, bits, padding);
|
|
11260
|
+
};
|
|
11261
|
+
var createCshakeMethod = function createCshakeMethod(bits, padding) {
|
|
11262
|
+
var w = CSHAKE_BYTEPAD[bits];
|
|
11263
|
+
var method = createCshakeOutputMethod(bits, padding, "hex");
|
|
11264
|
+
method.create = function(outputBits, n, s) {
|
|
11265
|
+
if (empty(n) && empty(s)) {
|
|
11266
|
+
return methods["shake" + bits].create(outputBits);
|
|
11267
|
+
} else {
|
|
11268
|
+
return new Keccak(bits, padding, outputBits).bytepad([ n, s ], w);
|
|
11269
|
+
}
|
|
11270
|
+
};
|
|
11271
|
+
method.update = function(message, outputBits, n, s) {
|
|
11272
|
+
return method.create(outputBits, n, s).update(message);
|
|
11273
|
+
};
|
|
11274
|
+
return createOutputMethods(method, createCshakeOutputMethod, bits, padding);
|
|
11275
|
+
};
|
|
11276
|
+
var createKmacMethod = function createKmacMethod(bits, padding) {
|
|
11277
|
+
var w = CSHAKE_BYTEPAD[bits];
|
|
11278
|
+
var method = createKmacOutputMethod(bits, padding, "hex");
|
|
11279
|
+
method.create = function(key, outputBits, s) {
|
|
11280
|
+
return new Kmac(bits, padding, outputBits).bytepad([ "KMAC", s ], w).bytepad([ key ], w);
|
|
11281
|
+
};
|
|
11282
|
+
method.update = function(key, message, outputBits, s) {
|
|
11283
|
+
return method.create(key, outputBits, s).update(message);
|
|
11284
|
+
};
|
|
11285
|
+
return createOutputMethods(method, createKmacOutputMethod, bits, padding);
|
|
11286
|
+
};
|
|
11287
|
+
var algorithms = [ {
|
|
11288
|
+
name: "keccak",
|
|
11289
|
+
padding: KECCAK_PADDING,
|
|
11290
|
+
bits: BITS,
|
|
11291
|
+
createMethod: createMethod
|
|
11292
|
+
}, {
|
|
11293
|
+
name: "sha3",
|
|
11294
|
+
padding: PADDING,
|
|
11295
|
+
bits: BITS,
|
|
11296
|
+
createMethod: createMethod
|
|
11297
|
+
}, {
|
|
11298
|
+
name: "shake",
|
|
11299
|
+
padding: SHAKE_PADDING,
|
|
11300
|
+
bits: SHAKE_BITS,
|
|
11301
|
+
createMethod: createShakeMethod
|
|
11302
|
+
}, {
|
|
11303
|
+
name: "cshake",
|
|
11304
|
+
padding: CSHAKE_PADDING,
|
|
11305
|
+
bits: SHAKE_BITS,
|
|
11306
|
+
createMethod: createCshakeMethod
|
|
11307
|
+
}, {
|
|
11308
|
+
name: "kmac",
|
|
11309
|
+
padding: CSHAKE_PADDING,
|
|
11310
|
+
bits: SHAKE_BITS,
|
|
11311
|
+
createMethod: createKmacMethod
|
|
11312
|
+
} ];
|
|
11313
|
+
var methods = {}, methodNames = [];
|
|
11314
|
+
for (var i = 0; i < algorithms.length; ++i) {
|
|
11315
|
+
var algorithm = algorithms[i];
|
|
11316
|
+
var bits = algorithm.bits;
|
|
11317
|
+
for (var j = 0; j < bits.length; ++j) {
|
|
11318
|
+
var methodName = algorithm.name + "_" + bits[j];
|
|
11319
|
+
methodNames.push(methodName);
|
|
11320
|
+
methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);
|
|
11321
|
+
if (algorithm.name !== "sha3") {
|
|
11322
|
+
var newMethodName = algorithm.name + bits[j];
|
|
11323
|
+
methodNames.push(newMethodName);
|
|
11324
|
+
methods[newMethodName] = methods[methodName];
|
|
11325
|
+
}
|
|
11326
|
+
}
|
|
11327
|
+
}
|
|
11328
|
+
function Keccak(bits, padding, outputBits) {
|
|
11329
|
+
this.blocks = [];
|
|
11330
|
+
this.s = [];
|
|
11331
|
+
this.padding = padding;
|
|
11332
|
+
this.outputBits = outputBits;
|
|
11333
|
+
this.reset = true;
|
|
11334
|
+
this.finalized = false;
|
|
11335
|
+
this.block = 0;
|
|
11336
|
+
this.start = 0;
|
|
11337
|
+
this.blockCount = 1600 - (bits << 1) >> 5;
|
|
11338
|
+
this.byteCount = this.blockCount << 2;
|
|
11339
|
+
this.outputBlocks = outputBits >> 5;
|
|
11340
|
+
this.extraBytes = (outputBits & 31) >> 3;
|
|
11341
|
+
for (var i = 0; i < 50; ++i) {
|
|
11342
|
+
this.s[i] = 0;
|
|
11343
|
+
}
|
|
11344
|
+
}
|
|
11345
|
+
Keccak.prototype.update = function(message) {
|
|
11346
|
+
if (this.finalized) {
|
|
11347
|
+
throw new Error(FINALIZE_ERROR);
|
|
11348
|
+
}
|
|
11349
|
+
var result = formatMessage(message);
|
|
11350
|
+
message = result[0];
|
|
11351
|
+
var isString = result[1];
|
|
11352
|
+
var blocks = this.blocks, byteCount = this.byteCount, length = message.length, blockCount = this.blockCount, index = 0, s = this.s, i, code;
|
|
11353
|
+
while (index < length) {
|
|
11354
|
+
if (this.reset) {
|
|
11355
|
+
this.reset = false;
|
|
11356
|
+
blocks[0] = this.block;
|
|
11357
|
+
for (i = 1; i < blockCount + 1; ++i) {
|
|
11358
|
+
blocks[i] = 0;
|
|
11359
|
+
}
|
|
11360
|
+
}
|
|
11361
|
+
if (isString) {
|
|
11362
|
+
for (i = this.start; index < length && i < byteCount; ++index) {
|
|
11363
|
+
code = message.charCodeAt(index);
|
|
11364
|
+
if (code < 128) {
|
|
11365
|
+
blocks[i >> 2] |= code << SHIFT[i++ & 3];
|
|
11366
|
+
} else if (code < 2048) {
|
|
11367
|
+
blocks[i >> 2] |= (192 | code >> 6) << SHIFT[i++ & 3];
|
|
11368
|
+
blocks[i >> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
|
|
11369
|
+
} else if (code < 55296 || code >= 57344) {
|
|
11370
|
+
blocks[i >> 2] |= (224 | code >> 12) << SHIFT[i++ & 3];
|
|
11371
|
+
blocks[i >> 2] |= (128 | code >> 6 & 63) << SHIFT[i++ & 3];
|
|
11372
|
+
blocks[i >> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
|
|
11373
|
+
} else {
|
|
11374
|
+
code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023);
|
|
11375
|
+
blocks[i >> 2] |= (240 | code >> 18) << SHIFT[i++ & 3];
|
|
11376
|
+
blocks[i >> 2] |= (128 | code >> 12 & 63) << SHIFT[i++ & 3];
|
|
11377
|
+
blocks[i >> 2] |= (128 | code >> 6 & 63) << SHIFT[i++ & 3];
|
|
11378
|
+
blocks[i >> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
|
|
11379
|
+
}
|
|
11380
|
+
}
|
|
11381
|
+
} else {
|
|
11382
|
+
for (i = this.start; index < length && i < byteCount; ++index) {
|
|
11383
|
+
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
|
|
11384
|
+
}
|
|
11385
|
+
}
|
|
11386
|
+
this.lastByteIndex = i;
|
|
11387
|
+
if (i >= byteCount) {
|
|
11388
|
+
this.start = i - byteCount;
|
|
11389
|
+
this.block = blocks[blockCount];
|
|
11390
|
+
for (i = 0; i < blockCount; ++i) {
|
|
11391
|
+
s[i] ^= blocks[i];
|
|
11392
|
+
}
|
|
11393
|
+
f(s);
|
|
11394
|
+
this.reset = true;
|
|
11395
|
+
} else {
|
|
11396
|
+
this.start = i;
|
|
11397
|
+
}
|
|
11398
|
+
}
|
|
11399
|
+
return this;
|
|
11400
|
+
};
|
|
11401
|
+
Keccak.prototype.encode = function(x, right) {
|
|
11402
|
+
var o = x & 255, n = 1;
|
|
11403
|
+
var bytes = [ o ];
|
|
11404
|
+
x = x >> 8;
|
|
11405
|
+
o = x & 255;
|
|
11406
|
+
while (o > 0) {
|
|
11407
|
+
bytes.unshift(o);
|
|
11408
|
+
x = x >> 8;
|
|
11409
|
+
o = x & 255;
|
|
11410
|
+
++n;
|
|
11411
|
+
}
|
|
11412
|
+
if (right) {
|
|
11413
|
+
bytes.push(n);
|
|
11414
|
+
} else {
|
|
11415
|
+
bytes.unshift(n);
|
|
11416
|
+
}
|
|
11417
|
+
this.update(bytes);
|
|
11418
|
+
return bytes.length;
|
|
11419
|
+
};
|
|
11420
|
+
Keccak.prototype.encodeString = function(str) {
|
|
11421
|
+
var result = formatMessage(str);
|
|
11422
|
+
str = result[0];
|
|
11423
|
+
var isString = result[1];
|
|
11424
|
+
var bytes = 0, length = str.length;
|
|
11425
|
+
if (isString) {
|
|
11426
|
+
for (var i = 0; i < str.length; ++i) {
|
|
11427
|
+
var code = str.charCodeAt(i);
|
|
11428
|
+
if (code < 128) {
|
|
11429
|
+
bytes += 1;
|
|
11430
|
+
} else if (code < 2048) {
|
|
11431
|
+
bytes += 2;
|
|
11432
|
+
} else if (code < 55296 || code >= 57344) {
|
|
11433
|
+
bytes += 3;
|
|
11434
|
+
} else {
|
|
11435
|
+
code = 65536 + ((code & 1023) << 10 | str.charCodeAt(++i) & 1023);
|
|
11436
|
+
bytes += 4;
|
|
11437
|
+
}
|
|
11438
|
+
}
|
|
11439
|
+
} else {
|
|
11440
|
+
bytes = length;
|
|
11441
|
+
}
|
|
11442
|
+
bytes += this.encode(bytes * 8);
|
|
11443
|
+
this.update(str);
|
|
11444
|
+
return bytes;
|
|
11445
|
+
};
|
|
11446
|
+
Keccak.prototype.bytepad = function(strs, w) {
|
|
11447
|
+
var bytes = this.encode(w);
|
|
11448
|
+
for (var i = 0; i < strs.length; ++i) {
|
|
11449
|
+
bytes += this.encodeString(strs[i]);
|
|
11450
|
+
}
|
|
11451
|
+
var paddingBytes = (w - bytes % w) % w;
|
|
11452
|
+
var zeros = [];
|
|
11453
|
+
zeros.length = paddingBytes;
|
|
11454
|
+
this.update(zeros);
|
|
11455
|
+
return this;
|
|
11456
|
+
};
|
|
11457
|
+
Keccak.prototype.finalize = function() {
|
|
11458
|
+
if (this.finalized) {
|
|
11459
|
+
return;
|
|
11460
|
+
}
|
|
11461
|
+
this.finalized = true;
|
|
11462
|
+
var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;
|
|
11463
|
+
blocks[i >> 2] |= this.padding[i & 3];
|
|
11464
|
+
if (this.lastByteIndex === this.byteCount) {
|
|
11465
|
+
blocks[0] = blocks[blockCount];
|
|
11466
|
+
for (i = 1; i < blockCount + 1; ++i) {
|
|
11467
|
+
blocks[i] = 0;
|
|
11468
|
+
}
|
|
11469
|
+
}
|
|
11470
|
+
blocks[blockCount - 1] |= 2147483648;
|
|
11471
|
+
for (i = 0; i < blockCount; ++i) {
|
|
11472
|
+
s[i] ^= blocks[i];
|
|
11473
|
+
}
|
|
11474
|
+
f(s);
|
|
11475
|
+
};
|
|
11476
|
+
Keccak.prototype.toString = Keccak.prototype.hex = function() {
|
|
11477
|
+
this.finalize();
|
|
11478
|
+
var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i = 0, j = 0;
|
|
11479
|
+
var hex = "", block;
|
|
11480
|
+
while (j < outputBlocks) {
|
|
11481
|
+
for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
|
|
11482
|
+
block = s[i];
|
|
11483
|
+
hex += HEX_CHARS[block >> 4 & 15] + HEX_CHARS[block & 15] + HEX_CHARS[block >> 12 & 15] + HEX_CHARS[block >> 8 & 15] + HEX_CHARS[block >> 20 & 15] + HEX_CHARS[block >> 16 & 15] + HEX_CHARS[block >> 28 & 15] + HEX_CHARS[block >> 24 & 15];
|
|
11484
|
+
}
|
|
11485
|
+
if (j % blockCount === 0) {
|
|
11486
|
+
s = cloneArray(s);
|
|
11487
|
+
f(s);
|
|
11488
|
+
i = 0;
|
|
11489
|
+
}
|
|
11490
|
+
}
|
|
11491
|
+
if (extraBytes) {
|
|
11492
|
+
block = s[i];
|
|
11493
|
+
hex += HEX_CHARS[block >> 4 & 15] + HEX_CHARS[block & 15];
|
|
11494
|
+
if (extraBytes > 1) {
|
|
11495
|
+
hex += HEX_CHARS[block >> 12 & 15] + HEX_CHARS[block >> 8 & 15];
|
|
11496
|
+
}
|
|
11497
|
+
if (extraBytes > 2) {
|
|
11498
|
+
hex += HEX_CHARS[block >> 20 & 15] + HEX_CHARS[block >> 16 & 15];
|
|
11499
|
+
}
|
|
11500
|
+
}
|
|
11501
|
+
return hex;
|
|
11502
|
+
};
|
|
11503
|
+
Keccak.prototype.arrayBuffer = function() {
|
|
11504
|
+
this.finalize();
|
|
11505
|
+
var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i = 0, j = 0;
|
|
11506
|
+
var bytes = this.outputBits >> 3;
|
|
11507
|
+
var buffer;
|
|
11508
|
+
if (extraBytes) {
|
|
11509
|
+
buffer = new ArrayBuffer(outputBlocks + 1 << 2);
|
|
11510
|
+
} else {
|
|
11511
|
+
buffer = new ArrayBuffer(bytes);
|
|
11512
|
+
}
|
|
11513
|
+
var array = new Uint32Array(buffer);
|
|
11514
|
+
while (j < outputBlocks) {
|
|
11515
|
+
for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
|
|
11516
|
+
array[j] = s[i];
|
|
11517
|
+
}
|
|
11518
|
+
if (j % blockCount === 0) {
|
|
11519
|
+
s = cloneArray(s);
|
|
11520
|
+
f(s);
|
|
11521
|
+
}
|
|
11522
|
+
}
|
|
11523
|
+
if (extraBytes) {
|
|
11524
|
+
array[j] = s[i];
|
|
11525
|
+
buffer = buffer.slice(0, bytes);
|
|
11526
|
+
}
|
|
11527
|
+
return buffer;
|
|
11528
|
+
};
|
|
11529
|
+
Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;
|
|
11530
|
+
Keccak.prototype.digest = Keccak.prototype.array = function() {
|
|
11531
|
+
this.finalize();
|
|
11532
|
+
var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i = 0, j = 0;
|
|
11533
|
+
var array = [], offset, block;
|
|
11534
|
+
while (j < outputBlocks) {
|
|
11535
|
+
for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
|
|
11536
|
+
offset = j << 2;
|
|
11537
|
+
block = s[i];
|
|
11538
|
+
array[offset] = block & 255;
|
|
11539
|
+
array[offset + 1] = block >> 8 & 255;
|
|
11540
|
+
array[offset + 2] = block >> 16 & 255;
|
|
11541
|
+
array[offset + 3] = block >> 24 & 255;
|
|
11542
|
+
}
|
|
11543
|
+
if (j % blockCount === 0) {
|
|
11544
|
+
s = cloneArray(s);
|
|
11545
|
+
f(s);
|
|
11546
|
+
}
|
|
11547
|
+
}
|
|
11548
|
+
if (extraBytes) {
|
|
11549
|
+
offset = j << 2;
|
|
11550
|
+
block = s[i];
|
|
11551
|
+
array[offset] = block & 255;
|
|
11552
|
+
if (extraBytes > 1) {
|
|
11553
|
+
array[offset + 1] = block >> 8 & 255;
|
|
11554
|
+
}
|
|
11555
|
+
if (extraBytes > 2) {
|
|
11556
|
+
array[offset + 2] = block >> 16 & 255;
|
|
11557
|
+
}
|
|
11558
|
+
}
|
|
11559
|
+
return array;
|
|
11560
|
+
};
|
|
11561
|
+
function Kmac(bits, padding, outputBits) {
|
|
11562
|
+
Keccak.call(this, bits, padding, outputBits);
|
|
11563
|
+
}
|
|
11564
|
+
Kmac.prototype = new Keccak;
|
|
11565
|
+
Kmac.prototype.finalize = function() {
|
|
11566
|
+
this.encode(this.outputBits, true);
|
|
11567
|
+
return Keccak.prototype.finalize.call(this);
|
|
11568
|
+
};
|
|
11569
|
+
var f = function f(s) {
|
|
11570
|
+
var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;
|
|
11571
|
+
for (n = 0; n < 48; n += 2) {
|
|
11572
|
+
c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];
|
|
11573
|
+
c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];
|
|
11574
|
+
c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];
|
|
11575
|
+
c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];
|
|
11576
|
+
c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];
|
|
11577
|
+
c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];
|
|
11578
|
+
c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];
|
|
11579
|
+
c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];
|
|
11580
|
+
c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];
|
|
11581
|
+
c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];
|
|
11582
|
+
h = c8 ^ (c2 << 1 | c3 >>> 31);
|
|
11583
|
+
l = c9 ^ (c3 << 1 | c2 >>> 31);
|
|
11584
|
+
s[0] ^= h;
|
|
11585
|
+
s[1] ^= l;
|
|
11586
|
+
s[10] ^= h;
|
|
11587
|
+
s[11] ^= l;
|
|
11588
|
+
s[20] ^= h;
|
|
11589
|
+
s[21] ^= l;
|
|
11590
|
+
s[30] ^= h;
|
|
11591
|
+
s[31] ^= l;
|
|
11592
|
+
s[40] ^= h;
|
|
11593
|
+
s[41] ^= l;
|
|
11594
|
+
h = c0 ^ (c4 << 1 | c5 >>> 31);
|
|
11595
|
+
l = c1 ^ (c5 << 1 | c4 >>> 31);
|
|
11596
|
+
s[2] ^= h;
|
|
11597
|
+
s[3] ^= l;
|
|
11598
|
+
s[12] ^= h;
|
|
11599
|
+
s[13] ^= l;
|
|
11600
|
+
s[22] ^= h;
|
|
11601
|
+
s[23] ^= l;
|
|
11602
|
+
s[32] ^= h;
|
|
11603
|
+
s[33] ^= l;
|
|
11604
|
+
s[42] ^= h;
|
|
11605
|
+
s[43] ^= l;
|
|
11606
|
+
h = c2 ^ (c6 << 1 | c7 >>> 31);
|
|
11607
|
+
l = c3 ^ (c7 << 1 | c6 >>> 31);
|
|
11608
|
+
s[4] ^= h;
|
|
11609
|
+
s[5] ^= l;
|
|
11610
|
+
s[14] ^= h;
|
|
11611
|
+
s[15] ^= l;
|
|
11612
|
+
s[24] ^= h;
|
|
11613
|
+
s[25] ^= l;
|
|
11614
|
+
s[34] ^= h;
|
|
11615
|
+
s[35] ^= l;
|
|
11616
|
+
s[44] ^= h;
|
|
11617
|
+
s[45] ^= l;
|
|
11618
|
+
h = c4 ^ (c8 << 1 | c9 >>> 31);
|
|
11619
|
+
l = c5 ^ (c9 << 1 | c8 >>> 31);
|
|
11620
|
+
s[6] ^= h;
|
|
11621
|
+
s[7] ^= l;
|
|
11622
|
+
s[16] ^= h;
|
|
11623
|
+
s[17] ^= l;
|
|
11624
|
+
s[26] ^= h;
|
|
11625
|
+
s[27] ^= l;
|
|
11626
|
+
s[36] ^= h;
|
|
11627
|
+
s[37] ^= l;
|
|
11628
|
+
s[46] ^= h;
|
|
11629
|
+
s[47] ^= l;
|
|
11630
|
+
h = c6 ^ (c0 << 1 | c1 >>> 31);
|
|
11631
|
+
l = c7 ^ (c1 << 1 | c0 >>> 31);
|
|
11632
|
+
s[8] ^= h;
|
|
11633
|
+
s[9] ^= l;
|
|
11634
|
+
s[18] ^= h;
|
|
11635
|
+
s[19] ^= l;
|
|
11636
|
+
s[28] ^= h;
|
|
11637
|
+
s[29] ^= l;
|
|
11638
|
+
s[38] ^= h;
|
|
11639
|
+
s[39] ^= l;
|
|
11640
|
+
s[48] ^= h;
|
|
11641
|
+
s[49] ^= l;
|
|
11642
|
+
b0 = s[0];
|
|
11643
|
+
b1 = s[1];
|
|
11644
|
+
b32 = s[11] << 4 | s[10] >>> 28;
|
|
11645
|
+
b33 = s[10] << 4 | s[11] >>> 28;
|
|
11646
|
+
b14 = s[20] << 3 | s[21] >>> 29;
|
|
11647
|
+
b15 = s[21] << 3 | s[20] >>> 29;
|
|
11648
|
+
b46 = s[31] << 9 | s[30] >>> 23;
|
|
11649
|
+
b47 = s[30] << 9 | s[31] >>> 23;
|
|
11650
|
+
b28 = s[40] << 18 | s[41] >>> 14;
|
|
11651
|
+
b29 = s[41] << 18 | s[40] >>> 14;
|
|
11652
|
+
b20 = s[2] << 1 | s[3] >>> 31;
|
|
11653
|
+
b21 = s[3] << 1 | s[2] >>> 31;
|
|
11654
|
+
b2 = s[13] << 12 | s[12] >>> 20;
|
|
11655
|
+
b3 = s[12] << 12 | s[13] >>> 20;
|
|
11656
|
+
b34 = s[22] << 10 | s[23] >>> 22;
|
|
11657
|
+
b35 = s[23] << 10 | s[22] >>> 22;
|
|
11658
|
+
b16 = s[33] << 13 | s[32] >>> 19;
|
|
11659
|
+
b17 = s[32] << 13 | s[33] >>> 19;
|
|
11660
|
+
b48 = s[42] << 2 | s[43] >>> 30;
|
|
11661
|
+
b49 = s[43] << 2 | s[42] >>> 30;
|
|
11662
|
+
b40 = s[5] << 30 | s[4] >>> 2;
|
|
11663
|
+
b41 = s[4] << 30 | s[5] >>> 2;
|
|
11664
|
+
b22 = s[14] << 6 | s[15] >>> 26;
|
|
11665
|
+
b23 = s[15] << 6 | s[14] >>> 26;
|
|
11666
|
+
b4 = s[25] << 11 | s[24] >>> 21;
|
|
11667
|
+
b5 = s[24] << 11 | s[25] >>> 21;
|
|
11668
|
+
b36 = s[34] << 15 | s[35] >>> 17;
|
|
11669
|
+
b37 = s[35] << 15 | s[34] >>> 17;
|
|
11670
|
+
b18 = s[45] << 29 | s[44] >>> 3;
|
|
11671
|
+
b19 = s[44] << 29 | s[45] >>> 3;
|
|
11672
|
+
b10 = s[6] << 28 | s[7] >>> 4;
|
|
11673
|
+
b11 = s[7] << 28 | s[6] >>> 4;
|
|
11674
|
+
b42 = s[17] << 23 | s[16] >>> 9;
|
|
11675
|
+
b43 = s[16] << 23 | s[17] >>> 9;
|
|
11676
|
+
b24 = s[26] << 25 | s[27] >>> 7;
|
|
11677
|
+
b25 = s[27] << 25 | s[26] >>> 7;
|
|
11678
|
+
b6 = s[36] << 21 | s[37] >>> 11;
|
|
11679
|
+
b7 = s[37] << 21 | s[36] >>> 11;
|
|
11680
|
+
b38 = s[47] << 24 | s[46] >>> 8;
|
|
11681
|
+
b39 = s[46] << 24 | s[47] >>> 8;
|
|
11682
|
+
b30 = s[8] << 27 | s[9] >>> 5;
|
|
11683
|
+
b31 = s[9] << 27 | s[8] >>> 5;
|
|
11684
|
+
b12 = s[18] << 20 | s[19] >>> 12;
|
|
11685
|
+
b13 = s[19] << 20 | s[18] >>> 12;
|
|
11686
|
+
b44 = s[29] << 7 | s[28] >>> 25;
|
|
11687
|
+
b45 = s[28] << 7 | s[29] >>> 25;
|
|
11688
|
+
b26 = s[38] << 8 | s[39] >>> 24;
|
|
11689
|
+
b27 = s[39] << 8 | s[38] >>> 24;
|
|
11690
|
+
b8 = s[48] << 14 | s[49] >>> 18;
|
|
11691
|
+
b9 = s[49] << 14 | s[48] >>> 18;
|
|
11692
|
+
s[0] = b0 ^ ~b2 & b4;
|
|
11693
|
+
s[1] = b1 ^ ~b3 & b5;
|
|
11694
|
+
s[10] = b10 ^ ~b12 & b14;
|
|
11695
|
+
s[11] = b11 ^ ~b13 & b15;
|
|
11696
|
+
s[20] = b20 ^ ~b22 & b24;
|
|
11697
|
+
s[21] = b21 ^ ~b23 & b25;
|
|
11698
|
+
s[30] = b30 ^ ~b32 & b34;
|
|
11699
|
+
s[31] = b31 ^ ~b33 & b35;
|
|
11700
|
+
s[40] = b40 ^ ~b42 & b44;
|
|
11701
|
+
s[41] = b41 ^ ~b43 & b45;
|
|
11702
|
+
s[2] = b2 ^ ~b4 & b6;
|
|
11703
|
+
s[3] = b3 ^ ~b5 & b7;
|
|
11704
|
+
s[12] = b12 ^ ~b14 & b16;
|
|
11705
|
+
s[13] = b13 ^ ~b15 & b17;
|
|
11706
|
+
s[22] = b22 ^ ~b24 & b26;
|
|
11707
|
+
s[23] = b23 ^ ~b25 & b27;
|
|
11708
|
+
s[32] = b32 ^ ~b34 & b36;
|
|
11709
|
+
s[33] = b33 ^ ~b35 & b37;
|
|
11710
|
+
s[42] = b42 ^ ~b44 & b46;
|
|
11711
|
+
s[43] = b43 ^ ~b45 & b47;
|
|
11712
|
+
s[4] = b4 ^ ~b6 & b8;
|
|
11713
|
+
s[5] = b5 ^ ~b7 & b9;
|
|
11714
|
+
s[14] = b14 ^ ~b16 & b18;
|
|
11715
|
+
s[15] = b15 ^ ~b17 & b19;
|
|
11716
|
+
s[24] = b24 ^ ~b26 & b28;
|
|
11717
|
+
s[25] = b25 ^ ~b27 & b29;
|
|
11718
|
+
s[34] = b34 ^ ~b36 & b38;
|
|
11719
|
+
s[35] = b35 ^ ~b37 & b39;
|
|
11720
|
+
s[44] = b44 ^ ~b46 & b48;
|
|
11721
|
+
s[45] = b45 ^ ~b47 & b49;
|
|
11722
|
+
s[6] = b6 ^ ~b8 & b0;
|
|
11723
|
+
s[7] = b7 ^ ~b9 & b1;
|
|
11724
|
+
s[16] = b16 ^ ~b18 & b10;
|
|
11725
|
+
s[17] = b17 ^ ~b19 & b11;
|
|
11726
|
+
s[26] = b26 ^ ~b28 & b20;
|
|
11727
|
+
s[27] = b27 ^ ~b29 & b21;
|
|
11728
|
+
s[36] = b36 ^ ~b38 & b30;
|
|
11729
|
+
s[37] = b37 ^ ~b39 & b31;
|
|
11730
|
+
s[46] = b46 ^ ~b48 & b40;
|
|
11731
|
+
s[47] = b47 ^ ~b49 & b41;
|
|
11732
|
+
s[8] = b8 ^ ~b0 & b2;
|
|
11733
|
+
s[9] = b9 ^ ~b1 & b3;
|
|
11734
|
+
s[18] = b18 ^ ~b10 & b12;
|
|
11735
|
+
s[19] = b19 ^ ~b11 & b13;
|
|
11736
|
+
s[28] = b28 ^ ~b20 & b22;
|
|
11737
|
+
s[29] = b29 ^ ~b21 & b23;
|
|
11738
|
+
s[38] = b38 ^ ~b30 & b32;
|
|
11739
|
+
s[39] = b39 ^ ~b31 & b33;
|
|
11740
|
+
s[48] = b48 ^ ~b40 & b42;
|
|
11741
|
+
s[49] = b49 ^ ~b41 & b43;
|
|
11742
|
+
s[0] ^= RC[n];
|
|
11743
|
+
s[1] ^= RC[n + 1];
|
|
11744
|
+
}
|
|
11745
|
+
};
|
|
11746
|
+
if (COMMON_JS) {
|
|
11747
|
+
module.exports = methods;
|
|
11748
|
+
} else {
|
|
11749
|
+
for (i = 0; i < methodNames.length; ++i) {
|
|
11750
|
+
root[methodNames[i]] = methods[methodNames[i]];
|
|
11751
|
+
}
|
|
11752
|
+
}
|
|
11753
|
+
})();
|
|
11754
|
+
})(sha3);
|
|
11755
|
+
return sha3.exports;
|
|
11131
11756
|
}
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11757
|
+
var sha3Exports = requireSha3();
|
|
11758
|
+
function toEnsName(_x5) {
|
|
11759
|
+
return _toEnsName.apply(this, arguments);
|
|
11760
|
+
}
|
|
11761
|
+
function _toEnsName() {
|
|
11762
|
+
_toEnsName = _asyncToGenerator(_regeneratorRuntime().mark((function _callee3(address) {
|
|
11763
|
+
var reverseName, node, endpoint, resolverRes, _yield$resolverRes$js, resolverHex, resolverAddress, nameRes, _yield$nameRes$json, nameHex, hex, name, i, code;
|
|
11135
11764
|
return _regeneratorRuntime().wrap((function _callee3$(_context3) {
|
|
11136
11765
|
while (1) switch (_context3.prev = _context3.next) {
|
|
11137
11766
|
case 0:
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
11767
|
+
reverseName = address.toLowerCase().replace(/^0x/, "") + ".addr.reverse";
|
|
11768
|
+
node = namehash(reverseName);
|
|
11769
|
+
endpoint = "https://cloudflare-eth.com";
|
|
11770
|
+
_context3.next = 5;
|
|
11771
|
+
return fetch(endpoint, {
|
|
11772
|
+
method: "POST",
|
|
11773
|
+
headers: {
|
|
11774
|
+
"Content-Type": "application/json"
|
|
11775
|
+
},
|
|
11776
|
+
body: JSON.stringify({
|
|
11777
|
+
jsonrpc: "2.0",
|
|
11778
|
+
id: 1,
|
|
11779
|
+
method: "eth_call",
|
|
11780
|
+
params: [ {
|
|
11781
|
+
to: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
|
|
11782
|
+
data: "0x0178b8bf" + node.slice(2).padStart(64, "0")
|
|
11783
|
+
}, "latest" ]
|
|
11784
|
+
})
|
|
11785
|
+
});
|
|
11144
11786
|
|
|
11145
|
-
case
|
|
11146
|
-
|
|
11147
|
-
|
|
11148
|
-
|
|
11149
|
-
};
|
|
11150
|
-
query = "";
|
|
11151
|
-
type = "";
|
|
11152
|
-
normalizedId = identifier.trim().replace(/.*\/([^\/]+)$/, "$1");
|
|
11153
|
-
if (!(platform === "farcaster")) {
|
|
11154
|
-
_context3.next = 22;
|
|
11155
|
-
break;
|
|
11156
|
-
}
|
|
11157
|
-
if (!(contentType === "posts")) {
|
|
11158
|
-
_context3.next = 14;
|
|
11159
|
-
break;
|
|
11160
|
-
}
|
|
11161
|
-
type = "farcasterid";
|
|
11162
|
-
query = normalizedId;
|
|
11163
|
-
_context3.next = 20;
|
|
11164
|
-
break;
|
|
11787
|
+
case 5:
|
|
11788
|
+
resolverRes = _context3.sent;
|
|
11789
|
+
_context3.next = 8;
|
|
11790
|
+
return resolverRes.json();
|
|
11165
11791
|
|
|
11166
|
-
case
|
|
11167
|
-
|
|
11168
|
-
|
|
11792
|
+
case 8:
|
|
11793
|
+
_yield$resolverRes$js = _context3.sent;
|
|
11794
|
+
resolverHex = _yield$resolverRes$js.result;
|
|
11795
|
+
resolverAddress = "0x" + resolverHex.slice(-40);
|
|
11796
|
+
if (/^0x[0-9a-f]{40}$/i.test(resolverAddress)) {
|
|
11797
|
+
_context3.next = 13;
|
|
11169
11798
|
break;
|
|
11170
11799
|
}
|
|
11171
|
-
|
|
11172
|
-
query = normalizedId.startsWith("0x") ? normalizedId : Number(normalizedId).toString();
|
|
11173
|
-
_context3.next = 20;
|
|
11174
|
-
break;
|
|
11800
|
+
return _context3.abrupt("return", null);
|
|
11175
11801
|
|
|
11176
|
-
case
|
|
11177
|
-
|
|
11802
|
+
case 13:
|
|
11803
|
+
_context3.next = 15;
|
|
11804
|
+
return fetch(endpoint, {
|
|
11805
|
+
method: "POST",
|
|
11806
|
+
headers: {
|
|
11807
|
+
"Content-Type": "application/json"
|
|
11808
|
+
},
|
|
11809
|
+
body: JSON.stringify({
|
|
11810
|
+
jsonrpc: "2.0",
|
|
11811
|
+
id: 2,
|
|
11812
|
+
method: "eth_call",
|
|
11813
|
+
params: [ {
|
|
11814
|
+
to: resolverAddress,
|
|
11815
|
+
data: "0x691f3431" + node.slice(2)
|
|
11816
|
+
}, "latest" ]
|
|
11817
|
+
})
|
|
11818
|
+
});
|
|
11178
11819
|
|
|
11179
|
-
case
|
|
11180
|
-
|
|
11181
|
-
|
|
11820
|
+
case 15:
|
|
11821
|
+
nameRes = _context3.sent;
|
|
11822
|
+
_context3.next = 18;
|
|
11823
|
+
return nameRes.json();
|
|
11182
11824
|
|
|
11183
|
-
case
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
|
|
11188
|
-
if (!(contentType === "posts")) {
|
|
11189
|
-
_context3.next = 28;
|
|
11825
|
+
case 18:
|
|
11826
|
+
_yield$nameRes$json = _context3.sent;
|
|
11827
|
+
nameHex = _yield$nameRes$json.result;
|
|
11828
|
+
if (!(!nameHex || nameHex === "0x")) {
|
|
11829
|
+
_context3.next = 22;
|
|
11190
11830
|
break;
|
|
11191
11831
|
}
|
|
11192
|
-
|
|
11193
|
-
query = normalizedId;
|
|
11194
|
-
_context3.next = 34;
|
|
11195
|
-
break;
|
|
11832
|
+
return _context3.abrupt("return", null);
|
|
11196
11833
|
|
|
11197
|
-
case
|
|
11198
|
-
|
|
11834
|
+
case 22:
|
|
11835
|
+
hex = nameHex.slice(2);
|
|
11836
|
+
name = "";
|
|
11837
|
+
i = 0;
|
|
11838
|
+
|
|
11839
|
+
case 25:
|
|
11840
|
+
if (!(i < hex.length)) {
|
|
11199
11841
|
_context3.next = 33;
|
|
11200
11842
|
break;
|
|
11201
11843
|
}
|
|
11202
|
-
|
|
11203
|
-
|
|
11204
|
-
|
|
11844
|
+
code = parseInt(hex.slice(i, i + 2), 16);
|
|
11845
|
+
if (!(code === 0)) {
|
|
11846
|
+
_context3.next = 29;
|
|
11847
|
+
break;
|
|
11848
|
+
}
|
|
11849
|
+
return _context3.abrupt("break", 33);
|
|
11850
|
+
|
|
11851
|
+
case 29:
|
|
11852
|
+
name += String.fromCharCode(code);
|
|
11853
|
+
|
|
11854
|
+
case 30:
|
|
11855
|
+
i += 2;
|
|
11856
|
+
_context3.next = 25;
|
|
11205
11857
|
break;
|
|
11206
11858
|
|
|
11207
11859
|
case 33:
|
|
11208
|
-
return _context3.abrupt("return",
|
|
11860
|
+
return _context3.abrupt("return", name || null);
|
|
11209
11861
|
|
|
11210
11862
|
case 34:
|
|
11211
|
-
|
|
11212
|
-
|
|
11863
|
+
case "end":
|
|
11864
|
+
return _context3.stop();
|
|
11865
|
+
}
|
|
11866
|
+
}), _callee3);
|
|
11867
|
+
})));
|
|
11868
|
+
return _toEnsName.apply(this, arguments);
|
|
11869
|
+
}
|
|
11870
|
+
function namehash(name) {
|
|
11871
|
+
var node = "0000000000000000000000000000000000000000000000000000000000000000";
|
|
11872
|
+
if (name) {
|
|
11873
|
+
var labels = name.toLowerCase().split(".");
|
|
11874
|
+
for (var i = labels.length - 1; i >= 0; i--) {
|
|
11875
|
+
var labelSha = sha3Exports.sha3_256.array(labels[i]);
|
|
11876
|
+
var combined = node + bytesToHex(labelSha);
|
|
11877
|
+
node = sha3Exports.sha3_256.array(hexToBytes(combined));
|
|
11878
|
+
node = bytesToHex(node);
|
|
11879
|
+
}
|
|
11880
|
+
}
|
|
11881
|
+
return "0x" + node;
|
|
11882
|
+
}
|
|
11883
|
+
function hexToBytes(hex) {
|
|
11884
|
+
hex = hex.replace(/^0x/, "");
|
|
11885
|
+
var bytes = new Uint8Array(hex.length / 2);
|
|
11886
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
11887
|
+
bytes[i] = parseInt(hex.substr(i * 2, 2), 16);
|
|
11888
|
+
}
|
|
11889
|
+
return bytes;
|
|
11890
|
+
}
|
|
11891
|
+
function bytesToHex(bytes) {
|
|
11892
|
+
return Array.from(bytes).map((function(b) {
|
|
11893
|
+
return b.toString(16).padStart(2, "0");
|
|
11894
|
+
})).join("");
|
|
11895
|
+
}
|
|
11896
|
+
function FIREFLY(_x6, _x7, _x8) {
|
|
11897
|
+
return _FIREFLY.apply(this, arguments);
|
|
11898
|
+
}
|
|
11899
|
+
function _FIREFLY() {
|
|
11900
|
+
_FIREFLY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee4(platform, contentType, identifier) {
|
|
11901
|
+
var _typeMap$platform;
|
|
11902
|
+
var start, end, API_KEY, baseUrl, headers, typeMap, platformType, query, url, res, json, _args4 = arguments;
|
|
11903
|
+
return _regeneratorRuntime().wrap((function _callee4$(_context4) {
|
|
11904
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
11905
|
+
case 0:
|
|
11906
|
+
start = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : 0;
|
|
11907
|
+
end = _args4.length > 4 && _args4[4] !== undefined ? _args4[4] : 10;
|
|
11908
|
+
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
11909
|
+
if (API_KEY) {
|
|
11910
|
+
_context4.next = 5;
|
|
11911
|
+
break;
|
|
11912
|
+
}
|
|
11913
|
+
return _context4.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11213
11914
|
|
|
11214
|
-
case
|
|
11215
|
-
|
|
11915
|
+
case 5:
|
|
11916
|
+
baseUrl = "https://openapi.firefly.land/v1/fileverse/fetch";
|
|
11917
|
+
headers = {
|
|
11918
|
+
"x-api-key": API_KEY
|
|
11919
|
+
};
|
|
11920
|
+
typeMap = {
|
|
11921
|
+
farcaster: {
|
|
11922
|
+
posts: "farcasterid",
|
|
11923
|
+
replies: "farcasterpostid",
|
|
11924
|
+
channels: "farcasterchannels"
|
|
11925
|
+
},
|
|
11926
|
+
lens: {
|
|
11927
|
+
posts: "lensid",
|
|
11928
|
+
replies: "lenspostid"
|
|
11929
|
+
}
|
|
11930
|
+
};
|
|
11931
|
+
platformType = (_typeMap$platform = typeMap[platform]) === null || _typeMap$platform === void 0 ? void 0 : _typeMap$platform[contentType];
|
|
11932
|
+
if (platformType) {
|
|
11933
|
+
_context4.next = 11;
|
|
11934
|
+
break;
|
|
11935
|
+
}
|
|
11936
|
+
return _context4.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11216
11937
|
|
|
11217
|
-
case
|
|
11938
|
+
case 11:
|
|
11939
|
+
query = identifier.split(",").map((function(s) {
|
|
11940
|
+
return s.trim();
|
|
11941
|
+
})).filter(Boolean).join(",");
|
|
11218
11942
|
url = new URL(baseUrl);
|
|
11219
11943
|
url.searchParams.set("query", query);
|
|
11220
|
-
url.searchParams.set("type",
|
|
11221
|
-
url.searchParams.set("
|
|
11222
|
-
url.searchParams.set("
|
|
11223
|
-
|
|
11224
|
-
|
|
11944
|
+
url.searchParams.set("type", platformType);
|
|
11945
|
+
url.searchParams.set("start", String(start));
|
|
11946
|
+
url.searchParams.set("end", String(end));
|
|
11947
|
+
_context4.prev = 17;
|
|
11948
|
+
_context4.next = 20;
|
|
11225
11949
|
return fetch(url.toString(), {
|
|
11226
11950
|
headers: headers
|
|
11227
11951
|
});
|
|
11228
11952
|
|
|
11229
|
-
case
|
|
11230
|
-
res =
|
|
11953
|
+
case 20:
|
|
11954
|
+
res = _context4.sent;
|
|
11231
11955
|
if (res.ok) {
|
|
11232
|
-
|
|
11956
|
+
_context4.next = 23;
|
|
11233
11957
|
break;
|
|
11234
11958
|
}
|
|
11235
11959
|
throw new Error("HTTP ".concat(res.status));
|
|
11236
11960
|
|
|
11237
|
-
case
|
|
11238
|
-
|
|
11961
|
+
case 23:
|
|
11962
|
+
_context4.next = 25;
|
|
11239
11963
|
return res.json();
|
|
11240
11964
|
|
|
11241
|
-
case
|
|
11242
|
-
json =
|
|
11243
|
-
|
|
11244
|
-
|
|
11245
|
-
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
text: (item === null || item === void 0 ? void 0 : item.text) || (item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 || (_item$metadata = _item$metadata.content) === null || _item$metadata === void 0 ? void 0 : _item$metadata.content) || "",
|
|
11249
|
-
createdAt: (item === null || item === void 0 ? void 0 : item.createdAt) || "",
|
|
11250
|
-
platform: platform
|
|
11251
|
-
};
|
|
11252
|
-
})) : [];
|
|
11253
|
-
return _context3.abrupt("return", flattened);
|
|
11965
|
+
case 25:
|
|
11966
|
+
json = _context4.sent;
|
|
11967
|
+
if (Array.isArray(json === null || json === void 0 ? void 0 : json.data)) {
|
|
11968
|
+
_context4.next = 28;
|
|
11969
|
+
break;
|
|
11970
|
+
}
|
|
11971
|
+
return _context4.abrupt("return", []);
|
|
11254
11972
|
|
|
11255
|
-
case
|
|
11256
|
-
|
|
11257
|
-
|
|
11258
|
-
|
|
11259
|
-
|
|
11973
|
+
case 28:
|
|
11974
|
+
return _context4.abrupt("return", json.data.map((function(item) {
|
|
11975
|
+
var flat = {};
|
|
11976
|
+
for (var _i10 = 0, _Object$entries = Object.entries(item); _i10 < _Object$entries.length; _i10++) {
|
|
11977
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i10], 2), key = _Object$entries$_i[0], _value5 = _Object$entries$_i[1];
|
|
11978
|
+
if (_typeof(_value5) !== "object" || _value5 === null) {
|
|
11979
|
+
flat[key] = _value5;
|
|
11980
|
+
}
|
|
11981
|
+
}
|
|
11982
|
+
flat.platform = platform;
|
|
11983
|
+
return flat;
|
|
11984
|
+
})));
|
|
11260
11985
|
|
|
11261
|
-
case
|
|
11986
|
+
case 31:
|
|
11987
|
+
_context4.prev = 31;
|
|
11988
|
+
_context4.t0 = _context4["catch"](17);
|
|
11989
|
+
console.error("FIREFLY fetch error:", _context4.t0);
|
|
11990
|
+
return _context4.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11991
|
+
|
|
11992
|
+
case 35:
|
|
11262
11993
|
case "end":
|
|
11263
|
-
return
|
|
11994
|
+
return _context4.stop();
|
|
11264
11995
|
}
|
|
11265
|
-
}),
|
|
11996
|
+
}), _callee4, null, [ [ 17, 31 ] ]);
|
|
11266
11997
|
})));
|
|
11267
11998
|
return _FIREFLY.apply(this, arguments);
|
|
11268
11999
|
}
|
|
11269
|
-
function BLOCKSCOUT(
|
|
12000
|
+
function BLOCKSCOUT(_x9, _x0, _x1, _x10, _x11, _x12, _x13) {
|
|
11270
12001
|
return _BLOCKSCOUT.apply(this, arguments);
|
|
11271
12002
|
}
|
|
11272
12003
|
function _BLOCKSCOUT() {
|
|
11273
|
-
_BLOCKSCOUT = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12004
|
+
_BLOCKSCOUT = _asyncToGenerator(_regeneratorRuntime().mark((function _callee5(address, type, chain, startTimestamp, endTimestamp, page, offset) {
|
|
11274
12005
|
var currentTimestamp, hostname, requestUrl, _json$result, _json$result2, response, json;
|
|
11275
|
-
return _regeneratorRuntime().wrap((function
|
|
11276
|
-
while (1) switch (
|
|
12006
|
+
return _regeneratorRuntime().wrap((function _callee5$(_context5) {
|
|
12007
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
11277
12008
|
case 0:
|
|
11278
12009
|
if (!chain) {
|
|
11279
12010
|
chain = "ethereum";
|
|
11280
12011
|
}
|
|
11281
12012
|
if (type) {
|
|
11282
|
-
|
|
12013
|
+
_context5.next = 3;
|
|
11283
12014
|
break;
|
|
11284
12015
|
}
|
|
11285
|
-
return
|
|
12016
|
+
return _context5.abrupt("return", "TYPE_MISSING");
|
|
11286
12017
|
|
|
11287
12018
|
case 3:
|
|
11288
12019
|
if (!startTimestamp) {
|
|
@@ -11290,79 +12021,85 @@ function _typeof(o) {
|
|
|
11290
12021
|
startTimestamp = currentTimestamp - 30 * 24 * 60 * 60 * 1e3;
|
|
11291
12022
|
startTimestamp = Math.floor(startTimestamp / 1e3);
|
|
11292
12023
|
}
|
|
12024
|
+
if (isNaN(startTimestamp)) {
|
|
12025
|
+
startTimestamp = toTimestamp(startTimestamp);
|
|
12026
|
+
}
|
|
12027
|
+
if (isNaN(endTimestamp) && endTimestamp) {
|
|
12028
|
+
endTimestamp = toTimestamp(endTimestamp);
|
|
12029
|
+
}
|
|
11293
12030
|
hostname = BLOCKSCOUT_CHAINS_MAP[chain];
|
|
11294
|
-
|
|
11295
|
-
|
|
12031
|
+
_context5.t0 = type;
|
|
12032
|
+
_context5.next = _context5.t0 === "stat" ? 10 : _context5.t0 === "txns" ? 12 : _context5.t0 === "tokens" ? 14 : 16;
|
|
11296
12033
|
break;
|
|
11297
12034
|
|
|
11298
|
-
case
|
|
12035
|
+
case 10:
|
|
11299
12036
|
requestUrl = "".concat(hostname, "/api/v2/addresses/").concat(address, "/counters");
|
|
11300
|
-
return
|
|
12037
|
+
return _context5.abrupt("break", 17);
|
|
11301
12038
|
|
|
11302
|
-
case
|
|
12039
|
+
case 12:
|
|
11303
12040
|
requestUrl = "".concat(hostname, "/api?module=account&action=txlist&address=").concat(address, "&start_timestamp=").concat(startTimestamp, "&end_timestamp=").concat(endTimestamp, "&page=").concat(page, "&offset=").concat(offset, "&sort=asc");
|
|
11304
|
-
return
|
|
12041
|
+
return _context5.abrupt("break", 17);
|
|
11305
12042
|
|
|
11306
|
-
case
|
|
12043
|
+
case 14:
|
|
11307
12044
|
requestUrl = "".concat(hostname, "/api?module=account&action=tokenlist&address=").concat(address);
|
|
11308
|
-
return
|
|
12045
|
+
return _context5.abrupt("break", 17);
|
|
11309
12046
|
|
|
11310
|
-
case
|
|
11311
|
-
return
|
|
12047
|
+
case 16:
|
|
12048
|
+
return _context5.abrupt("return", "INVALID_TYPE");
|
|
11312
12049
|
|
|
11313
|
-
case
|
|
11314
|
-
|
|
11315
|
-
|
|
12050
|
+
case 17:
|
|
12051
|
+
_context5.prev = 17;
|
|
12052
|
+
_context5.next = 20;
|
|
11316
12053
|
return fetch(requestUrl);
|
|
11317
12054
|
|
|
11318
|
-
case
|
|
11319
|
-
response =
|
|
12055
|
+
case 20:
|
|
12056
|
+
response = _context5.sent;
|
|
11320
12057
|
if (response.ok) {
|
|
11321
|
-
|
|
12058
|
+
_context5.next = 23;
|
|
11322
12059
|
break;
|
|
11323
12060
|
}
|
|
11324
12061
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
11325
12062
|
|
|
11326
|
-
case
|
|
11327
|
-
|
|
12063
|
+
case 23:
|
|
12064
|
+
_context5.next = 25;
|
|
11328
12065
|
return response.json();
|
|
11329
12066
|
|
|
11330
|
-
case
|
|
11331
|
-
json =
|
|
12067
|
+
case 25:
|
|
12068
|
+
json = _context5.sent;
|
|
11332
12069
|
console.log(json);
|
|
11333
12070
|
if (!(json !== null && json !== void 0 && (_json$result = json.result) !== null && _json$result !== void 0 && _json$result.includes("Invalid parameter(s)"))) {
|
|
11334
|
-
|
|
12071
|
+
_context5.next = 29;
|
|
11335
12072
|
break;
|
|
11336
12073
|
}
|
|
11337
|
-
return
|
|
12074
|
+
return _context5.abrupt("return", "INVALID_REQUEST_PARAMS");
|
|
11338
12075
|
|
|
11339
|
-
case
|
|
12076
|
+
case 29:
|
|
11340
12077
|
if (!(json !== null && json !== void 0 && (_json$result2 = json.result) !== null && _json$result2 !== void 0 && _json$result2.includes("Not found"))) {
|
|
11341
|
-
|
|
12078
|
+
_context5.next = 31;
|
|
11342
12079
|
break;
|
|
11343
12080
|
}
|
|
11344
|
-
return
|
|
12081
|
+
return _context5.abrupt("return", "ADDRESS_NOT_FOUND");
|
|
11345
12082
|
|
|
11346
|
-
case
|
|
12083
|
+
case 31:
|
|
11347
12084
|
if (!(type === "stat")) {
|
|
11348
|
-
|
|
12085
|
+
_context5.next = 33;
|
|
11349
12086
|
break;
|
|
11350
12087
|
}
|
|
11351
|
-
return
|
|
12088
|
+
return _context5.abrupt("return", [ json ]);
|
|
11352
12089
|
|
|
11353
|
-
case
|
|
11354
|
-
return
|
|
12090
|
+
case 33:
|
|
12091
|
+
return _context5.abrupt("return", json.result);
|
|
11355
12092
|
|
|
11356
|
-
case
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
return
|
|
12093
|
+
case 36:
|
|
12094
|
+
_context5.prev = 36;
|
|
12095
|
+
_context5.t1 = _context5["catch"](17);
|
|
12096
|
+
return _context5.abrupt("return", "ERROR IN FETCHING");
|
|
11360
12097
|
|
|
11361
|
-
case
|
|
12098
|
+
case 39:
|
|
11362
12099
|
case "end":
|
|
11363
|
-
return
|
|
12100
|
+
return _context5.stop();
|
|
11364
12101
|
}
|
|
11365
|
-
}),
|
|
12102
|
+
}), _callee5, null, [ [ 17, 36 ] ]);
|
|
11366
12103
|
})));
|
|
11367
12104
|
return _BLOCKSCOUT.apply(this, arguments);
|
|
11368
12105
|
}
|
|
@@ -11370,17 +12107,17 @@ function _typeof(o) {
|
|
|
11370
12107
|
return _BASESCAN.apply(this, arguments);
|
|
11371
12108
|
}
|
|
11372
12109
|
function _BASESCAN() {
|
|
11373
|
-
_BASESCAN = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11374
|
-
var _len2, args, _key2, type, chain, address, startDate, endDate, page, limit,
|
|
11375
|
-
return _regeneratorRuntime().wrap((function
|
|
11376
|
-
while (1) switch (
|
|
12110
|
+
_BASESCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee6() {
|
|
12111
|
+
var _len2, args, _key2, type, chain, address, startDate, endDate, page, limit, _args6 = arguments;
|
|
12112
|
+
return _regeneratorRuntime().wrap((function _callee6$(_context6) {
|
|
12113
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
11377
12114
|
case 0:
|
|
11378
|
-
for (_len2 =
|
|
11379
|
-
args[_key2] =
|
|
12115
|
+
for (_len2 = _args6.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
12116
|
+
args[_key2] = _args6[_key2];
|
|
11380
12117
|
}
|
|
11381
12118
|
type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4],
|
|
11382
12119
|
page = args[5], limit = args[6];
|
|
11383
|
-
return
|
|
12120
|
+
return _context6.abrupt("return", handleScanRequest({
|
|
11384
12121
|
scanKey: SERVICE_API_KEY.Basescan,
|
|
11385
12122
|
baseUrl: "https://api.basescan.org/api",
|
|
11386
12123
|
type: type,
|
|
@@ -11394,9 +12131,9 @@ function _typeof(o) {
|
|
|
11394
12131
|
|
|
11395
12132
|
case 3:
|
|
11396
12133
|
case "end":
|
|
11397
|
-
return
|
|
12134
|
+
return _context6.stop();
|
|
11398
12135
|
}
|
|
11399
|
-
}),
|
|
12136
|
+
}), _callee6);
|
|
11400
12137
|
})));
|
|
11401
12138
|
return _BASESCAN.apply(this, arguments);
|
|
11402
12139
|
}
|
|
@@ -11404,17 +12141,17 @@ function _typeof(o) {
|
|
|
11404
12141
|
return _GNOSISSCAN.apply(this, arguments);
|
|
11405
12142
|
}
|
|
11406
12143
|
function _GNOSISSCAN() {
|
|
11407
|
-
_GNOSISSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11408
|
-
var _len3, args, _key3, type, chain, address, startDate, endDate, page, limit,
|
|
11409
|
-
return _regeneratorRuntime().wrap((function
|
|
11410
|
-
while (1) switch (
|
|
12144
|
+
_GNOSISSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee7() {
|
|
12145
|
+
var _len3, args, _key3, type, chain, address, startDate, endDate, page, limit, _args7 = arguments;
|
|
12146
|
+
return _regeneratorRuntime().wrap((function _callee7$(_context7) {
|
|
12147
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
11411
12148
|
case 0:
|
|
11412
|
-
for (_len3 =
|
|
11413
|
-
args[_key3] =
|
|
12149
|
+
for (_len3 = _args7.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
12150
|
+
args[_key3] = _args7[_key3];
|
|
11414
12151
|
}
|
|
11415
12152
|
type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4],
|
|
11416
12153
|
page = args[5], limit = args[6];
|
|
11417
|
-
return
|
|
12154
|
+
return _context7.abrupt("return", handleScanRequest({
|
|
11418
12155
|
scanKey: SERVICE_API_KEY.Gnosisscan,
|
|
11419
12156
|
baseUrl: "https://api.gnosisscan.io/api",
|
|
11420
12157
|
type: type,
|
|
@@ -11428,27 +12165,27 @@ function _typeof(o) {
|
|
|
11428
12165
|
|
|
11429
12166
|
case 3:
|
|
11430
12167
|
case "end":
|
|
11431
|
-
return
|
|
12168
|
+
return _context7.stop();
|
|
11432
12169
|
}
|
|
11433
|
-
}),
|
|
12170
|
+
}), _callee7);
|
|
11434
12171
|
})));
|
|
11435
12172
|
return _GNOSISSCAN.apply(this, arguments);
|
|
11436
12173
|
}
|
|
11437
|
-
function NEYNAR(
|
|
12174
|
+
function NEYNAR(_x14, _x15, _x16, _x17, _x18) {
|
|
11438
12175
|
return _NEYNAR.apply(this, arguments);
|
|
11439
12176
|
}
|
|
11440
12177
|
function _NEYNAR() {
|
|
11441
|
-
_NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12178
|
+
_NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function _callee8(fid, viewerFid, sortType, limit, cursor) {
|
|
11442
12179
|
var API_KEY, url, _json$users, response, json;
|
|
11443
|
-
return _regeneratorRuntime().wrap((function
|
|
11444
|
-
while (1) switch (
|
|
12180
|
+
return _regeneratorRuntime().wrap((function _callee8$(_context8) {
|
|
12181
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
11445
12182
|
case 0:
|
|
11446
12183
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Neynar);
|
|
11447
12184
|
if (API_KEY) {
|
|
11448
|
-
|
|
12185
|
+
_context8.next = 3;
|
|
11449
12186
|
break;
|
|
11450
12187
|
}
|
|
11451
|
-
return
|
|
12188
|
+
return _context8.abrupt("return", "".concat(SERVICE_API_KEY.Neynar).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11452
12189
|
|
|
11453
12190
|
case 3:
|
|
11454
12191
|
url = new URL("https://api.neynar.com/v2/farcaster/followers");
|
|
@@ -11457,8 +12194,8 @@ function _typeof(o) {
|
|
|
11457
12194
|
url.searchParams.set("limit", limit.toString());
|
|
11458
12195
|
if (viewerFid !== null) url.searchParams.set("viewer_fid", viewerFid.toString());
|
|
11459
12196
|
if (cursor) url.searchParams.set("cursor", cursor);
|
|
11460
|
-
|
|
11461
|
-
|
|
12197
|
+
_context8.prev = 9;
|
|
12198
|
+
_context8.next = 12;
|
|
11462
12199
|
return fetch(url.toString(), {
|
|
11463
12200
|
headers: {
|
|
11464
12201
|
"x-api-key": API_KEY,
|
|
@@ -11467,27 +12204,27 @@ function _typeof(o) {
|
|
|
11467
12204
|
});
|
|
11468
12205
|
|
|
11469
12206
|
case 12:
|
|
11470
|
-
response =
|
|
12207
|
+
response = _context8.sent;
|
|
11471
12208
|
if (response.ok) {
|
|
11472
|
-
|
|
12209
|
+
_context8.next = 15;
|
|
11473
12210
|
break;
|
|
11474
12211
|
}
|
|
11475
12212
|
throw new Error("HTTP ".concat(response.status));
|
|
11476
12213
|
|
|
11477
12214
|
case 15:
|
|
11478
|
-
|
|
12215
|
+
_context8.next = 17;
|
|
11479
12216
|
return response.json();
|
|
11480
12217
|
|
|
11481
12218
|
case 17:
|
|
11482
|
-
json =
|
|
12219
|
+
json = _context8.sent;
|
|
11483
12220
|
if (json !== null && json !== void 0 && (_json$users = json.users) !== null && _json$users !== void 0 && _json$users.length) {
|
|
11484
|
-
|
|
12221
|
+
_context8.next = 20;
|
|
11485
12222
|
break;
|
|
11486
12223
|
}
|
|
11487
|
-
return
|
|
12224
|
+
return _context8.abrupt("return", []);
|
|
11488
12225
|
|
|
11489
12226
|
case 20:
|
|
11490
|
-
return
|
|
12227
|
+
return _context8.abrupt("return", json.users.map((function(_ref4) {
|
|
11491
12228
|
var _user$profile, _user$profile2;
|
|
11492
12229
|
var user = _ref4.user;
|
|
11493
12230
|
return {
|
|
@@ -11500,27 +12237,27 @@ function _typeof(o) {
|
|
|
11500
12237
|
})));
|
|
11501
12238
|
|
|
11502
12239
|
case 23:
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
console.error("NEYNAR_FETCH_FOLLOWERS error:",
|
|
11506
|
-
return
|
|
12240
|
+
_context8.prev = 23;
|
|
12241
|
+
_context8.t0 = _context8["catch"](9);
|
|
12242
|
+
console.error("NEYNAR_FETCH_FOLLOWERS error:", _context8.t0);
|
|
12243
|
+
return _context8.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11507
12244
|
|
|
11508
12245
|
case 27:
|
|
11509
12246
|
case "end":
|
|
11510
|
-
return
|
|
12247
|
+
return _context8.stop();
|
|
11511
12248
|
}
|
|
11512
|
-
}),
|
|
12249
|
+
}), _callee8, null, [ [ 9, 23 ] ]);
|
|
11513
12250
|
})));
|
|
11514
12251
|
return _NEYNAR.apply(this, arguments);
|
|
11515
12252
|
}
|
|
11516
|
-
function
|
|
11517
|
-
return
|
|
12253
|
+
function GNOSISPAY(_x19) {
|
|
12254
|
+
return _GNOSISPAY.apply(this, arguments);
|
|
11518
12255
|
}
|
|
11519
|
-
function
|
|
11520
|
-
|
|
12256
|
+
function _GNOSISPAY() {
|
|
12257
|
+
_GNOSISPAY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee9(_ref3) {
|
|
11521
12258
|
var cardId, startDate, endDate, _ref3$limit, limit, _ref3$offset, offset, apiKeyKey, API_KEY, url, res, json;
|
|
11522
|
-
return _regeneratorRuntime().wrap((function
|
|
11523
|
-
while (1) switch (
|
|
12259
|
+
return _regeneratorRuntime().wrap((function _callee9$(_context9) {
|
|
12260
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
11524
12261
|
case 0:
|
|
11525
12262
|
cardId = _ref3.cardId, startDate = _ref3.startDate, endDate = _ref3.endDate, _ref3$limit = _ref3.limit,
|
|
11526
12263
|
limit = _ref3$limit === void 0 ? 20 : _ref3$limit, _ref3$offset = _ref3.offset,
|
|
@@ -11528,30 +12265,30 @@ function _typeof(o) {
|
|
|
11528
12265
|
apiKeyKey = SERVICE_API_KEY.GnosisPay;
|
|
11529
12266
|
API_KEY = window.localStorage.getItem(apiKeyKey);
|
|
11530
12267
|
if (API_KEY) {
|
|
11531
|
-
|
|
12268
|
+
_context9.next = 5;
|
|
11532
12269
|
break;
|
|
11533
12270
|
}
|
|
11534
|
-
return
|
|
12271
|
+
return _context9.abrupt("return", "".concat(apiKeyKey).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11535
12272
|
|
|
11536
12273
|
case 5:
|
|
11537
12274
|
if (cardId) {
|
|
11538
|
-
|
|
12275
|
+
_context9.next = 7;
|
|
11539
12276
|
break;
|
|
11540
12277
|
}
|
|
11541
|
-
return
|
|
12278
|
+
return _context9.abrupt("return", "".concat(apiKeyKey).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11542
12279
|
|
|
11543
12280
|
case 7:
|
|
11544
12281
|
url = new URL("https://api.gnosispay.com/cards/".concat(cardId, "/transactions"));
|
|
11545
12282
|
url.searchParams.set("limit", limit.toString());
|
|
11546
12283
|
url.searchParams.set("offset", offset.toString());
|
|
11547
|
-
if (!isNaN(startDate)) {
|
|
12284
|
+
if (!isNaN(toTimestamp(startDate))) {
|
|
11548
12285
|
url.searchParams.set("startDate", new Date(startDate * 1e3).toISOString());
|
|
11549
12286
|
}
|
|
11550
|
-
if (!isNaN(endDate)) {
|
|
12287
|
+
if (!isNaN(toTimestamp(endDate))) {
|
|
11551
12288
|
url.searchParams.set("endDate", new Date(endDate * 1e3).toISOString());
|
|
11552
12289
|
}
|
|
11553
|
-
|
|
11554
|
-
|
|
12290
|
+
_context9.prev = 12;
|
|
12291
|
+
_context9.next = 15;
|
|
11555
12292
|
return fetch(url.toString(), {
|
|
11556
12293
|
headers: {
|
|
11557
12294
|
Authorization: "Bearer ".concat(API_KEY),
|
|
@@ -11560,27 +12297,27 @@ function _typeof(o) {
|
|
|
11560
12297
|
});
|
|
11561
12298
|
|
|
11562
12299
|
case 15:
|
|
11563
|
-
res =
|
|
12300
|
+
res = _context9.sent;
|
|
11564
12301
|
if (res.ok) {
|
|
11565
|
-
|
|
12302
|
+
_context9.next = 18;
|
|
11566
12303
|
break;
|
|
11567
12304
|
}
|
|
11568
12305
|
throw new Error("HTTP error! Status: ".concat(res.status));
|
|
11569
12306
|
|
|
11570
12307
|
case 18:
|
|
11571
|
-
|
|
12308
|
+
_context9.next = 20;
|
|
11572
12309
|
return res.json();
|
|
11573
12310
|
|
|
11574
12311
|
case 20:
|
|
11575
|
-
json =
|
|
12312
|
+
json = _context9.sent;
|
|
11576
12313
|
if (Array.isArray(json)) {
|
|
11577
|
-
|
|
12314
|
+
_context9.next = 23;
|
|
11578
12315
|
break;
|
|
11579
12316
|
}
|
|
11580
|
-
return
|
|
12317
|
+
return _context9.abrupt("return", []);
|
|
11581
12318
|
|
|
11582
12319
|
case 23:
|
|
11583
|
-
return
|
|
12320
|
+
return _context9.abrupt("return", json.map((function(tx) {
|
|
11584
12321
|
return {
|
|
11585
12322
|
createdAt: tx.createdAt,
|
|
11586
12323
|
clearedAt: tx.clearedAt,
|
|
@@ -11598,34 +12335,34 @@ function _typeof(o) {
|
|
|
11598
12335
|
})));
|
|
11599
12336
|
|
|
11600
12337
|
case 26:
|
|
11601
|
-
|
|
11602
|
-
|
|
11603
|
-
console.error("GNOSISPAY_CARD_TXNS error:",
|
|
11604
|
-
return
|
|
12338
|
+
_context9.prev = 26;
|
|
12339
|
+
_context9.t0 = _context9["catch"](12);
|
|
12340
|
+
console.error("GNOSISPAY_CARD_TXNS error:", _context9.t0);
|
|
12341
|
+
return _context9.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11605
12342
|
|
|
11606
12343
|
case 30:
|
|
11607
12344
|
case "end":
|
|
11608
|
-
return
|
|
12345
|
+
return _context9.stop();
|
|
11609
12346
|
}
|
|
11610
|
-
}),
|
|
12347
|
+
}), _callee9, null, [ [ 12, 26 ] ]);
|
|
11611
12348
|
})));
|
|
11612
|
-
return
|
|
12349
|
+
return _GNOSISPAY.apply(this, arguments);
|
|
11613
12350
|
}
|
|
11614
12351
|
function ETHERSCAN() {
|
|
11615
12352
|
return _ETHERSCAN.apply(this, arguments);
|
|
11616
12353
|
}
|
|
11617
12354
|
function _ETHERSCAN() {
|
|
11618
|
-
_ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11619
|
-
var _len4, args, _key4, type, chain, address, startDate, endDate, page, limit,
|
|
11620
|
-
return _regeneratorRuntime().wrap((function
|
|
11621
|
-
while (1) switch (
|
|
12355
|
+
_ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee0() {
|
|
12356
|
+
var _len4, args, _key4, type, chain, address, startDate, endDate, page, limit, _args0 = arguments;
|
|
12357
|
+
return _regeneratorRuntime().wrap((function _callee0$(_context0) {
|
|
12358
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
11622
12359
|
case 0:
|
|
11623
|
-
for (_len4 =
|
|
11624
|
-
args[_key4] =
|
|
12360
|
+
for (_len4 = _args0.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
12361
|
+
args[_key4] = _args0[_key4];
|
|
11625
12362
|
}
|
|
11626
12363
|
type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4],
|
|
11627
12364
|
page = args[5], limit = args[6];
|
|
11628
|
-
return
|
|
12365
|
+
return _context0.abrupt("return", handleScanRequest({
|
|
11629
12366
|
scanKey: SERVICE_API_KEY.Etherscan,
|
|
11630
12367
|
baseUrl: "https://api.etherscan.io/v2/api",
|
|
11631
12368
|
type: type,
|
|
@@ -11639,288 +12376,530 @@ function _typeof(o) {
|
|
|
11639
12376
|
|
|
11640
12377
|
case 3:
|
|
11641
12378
|
case "end":
|
|
11642
|
-
return
|
|
12379
|
+
return _context0.stop();
|
|
11643
12380
|
}
|
|
11644
|
-
}),
|
|
12381
|
+
}), _callee0);
|
|
11645
12382
|
})));
|
|
11646
12383
|
return _ETHERSCAN.apply(this, arguments);
|
|
11647
12384
|
}
|
|
11648
|
-
function COINGECKO(
|
|
12385
|
+
function COINGECKO(_x20, _x21, _x22) {
|
|
11649
12386
|
return _COINGECKO.apply(this, arguments);
|
|
11650
12387
|
}
|
|
11651
12388
|
function _COINGECKO() {
|
|
11652
|
-
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11653
|
-
var API_KEY, url,
|
|
11654
|
-
return _regeneratorRuntime().wrap((function
|
|
11655
|
-
while (1) switch (
|
|
12389
|
+
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function _callee1(category, param1, param2) {
|
|
12390
|
+
var page, perPage, API_KEY, headers, url, token, vsCurrencies, ecosystemMap, key, categoryVal, trend, _category, _trend, exchange, response, json, _json$status, message, output, _i11, _Object$entries2, _Object$entries2$_i, _token, prices, _i12, _Object$entries3, _Object$entries3$_i, currency, _value6, _key5, flatArray, _args1 = arguments;
|
|
12391
|
+
return _regeneratorRuntime().wrap((function _callee1$(_context1) {
|
|
12392
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
11656
12393
|
case 0:
|
|
12394
|
+
page = _args1.length > 3 && _args1[3] !== undefined ? _args1[3] : 1;
|
|
12395
|
+
perPage = _args1.length > 4 && _args1[4] !== undefined ? _args1[4] : 2;
|
|
11657
12396
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Coingecko);
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
12397
|
+
if (API_KEY) {
|
|
12398
|
+
_context1.next = 5;
|
|
12399
|
+
break;
|
|
12400
|
+
}
|
|
12401
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
12402
|
+
|
|
12403
|
+
case 5:
|
|
12404
|
+
headers = {
|
|
12405
|
+
accept: "application/json",
|
|
12406
|
+
"x-cg-demo-api-key": API_KEY
|
|
11665
12407
|
};
|
|
11666
|
-
|
|
11667
|
-
|
|
11668
|
-
|
|
12408
|
+
url = "";
|
|
12409
|
+
_context1.t0 = (category || "").toLowerCase();
|
|
12410
|
+
_context1.next = _context1.t0 === "price" ? 10 : _context1.t0 === "market" ? 16 : _context1.t0 === "stablecoins" ? 26 : _context1.t0 === "derivatives" ? 30 : 33;
|
|
12411
|
+
break;
|
|
11669
12412
|
|
|
11670
|
-
case
|
|
11671
|
-
|
|
11672
|
-
|
|
11673
|
-
|
|
12413
|
+
case 10:
|
|
12414
|
+
token = param1;
|
|
12415
|
+
vsCurrencies = param2;
|
|
12416
|
+
if (!(!token || !vsCurrencies)) {
|
|
12417
|
+
_context1.next = 14;
|
|
12418
|
+
break;
|
|
12419
|
+
}
|
|
12420
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAMS));
|
|
12421
|
+
|
|
12422
|
+
case 14:
|
|
12423
|
+
url = "https://api.coingecko.com/api/v3/simple/price?vs_currencies=".concat(vsCurrencies, "&ids=").concat(token);
|
|
12424
|
+
return _context1.abrupt("break", 34);
|
|
12425
|
+
|
|
12426
|
+
case 16:
|
|
12427
|
+
ecosystemMap = {
|
|
12428
|
+
eth: "ethereum-ecosystem",
|
|
12429
|
+
base: "base-ecosystem",
|
|
12430
|
+
sol: "solana-ecosystem",
|
|
12431
|
+
gnosis: "gnosis-chain",
|
|
12432
|
+
hyperliquid: "hyperliquid",
|
|
12433
|
+
bitcoin: "bitcoin-ecosystem",
|
|
12434
|
+
pump: "pump-ecosystem"
|
|
12435
|
+
};
|
|
12436
|
+
key = param1 === null || param1 === void 0 ? void 0 : param1.toLowerCase();
|
|
12437
|
+
categoryVal = key ? ecosystemMap[key] : "";
|
|
12438
|
+
if (!(param1 && !categoryVal)) {
|
|
12439
|
+
_context1.next = 21;
|
|
11674
12440
|
break;
|
|
11675
12441
|
}
|
|
11676
|
-
|
|
12442
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12443
|
+
|
|
12444
|
+
case 21:
|
|
12445
|
+
trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
12446
|
+
url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&include_tokens=top&page=".concat(page, "&per_page=").concat(perPage);
|
|
12447
|
+
if (categoryVal) url += "&category=".concat(categoryVal);
|
|
12448
|
+
if (trend) url += trend;
|
|
12449
|
+
return _context1.abrupt("break", 34);
|
|
12450
|
+
|
|
12451
|
+
case 26:
|
|
12452
|
+
_category = param1 === "all" || !param1 ? "stablecoins" : param1 === null || param1 === void 0 ? void 0 : param1.toLowerCase();
|
|
12453
|
+
_trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
12454
|
+
url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&category=".concat(_category, "&page=").concat(page, "&per_page=").concat(perPage).concat(_trend);
|
|
12455
|
+
return _context1.abrupt("break", 34);
|
|
12456
|
+
|
|
12457
|
+
case 30:
|
|
12458
|
+
exchange = param1;
|
|
12459
|
+
if (exchange) {
|
|
12460
|
+
url = "https://api.coingecko.com/api/v3/derivatives/exchanges/".concat(exchange, "?include_tickers=all");
|
|
12461
|
+
} else {
|
|
12462
|
+
url = "https://api.coingecko.com/api/v3/derivatives?page=".concat(page, "&per_page=").concat(perPage);
|
|
12463
|
+
}
|
|
12464
|
+
return _context1.abrupt("break", 34);
|
|
12465
|
+
|
|
12466
|
+
case 33:
|
|
12467
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAMS));
|
|
12468
|
+
|
|
12469
|
+
case 34:
|
|
12470
|
+
_context1.prev = 34;
|
|
12471
|
+
_context1.next = 37;
|
|
12472
|
+
return fetch(url, {
|
|
12473
|
+
method: "GET",
|
|
12474
|
+
headers: headers
|
|
12475
|
+
});
|
|
12476
|
+
|
|
12477
|
+
case 37:
|
|
12478
|
+
response = _context1.sent;
|
|
12479
|
+
_context1.next = 40;
|
|
11677
12480
|
return response.json();
|
|
11678
12481
|
|
|
11679
|
-
case
|
|
11680
|
-
json =
|
|
11681
|
-
if (
|
|
11682
|
-
|
|
12482
|
+
case 40:
|
|
12483
|
+
json = _context1.sent;
|
|
12484
|
+
if (response.ok) {
|
|
12485
|
+
_context1.next = 47;
|
|
12486
|
+
break;
|
|
12487
|
+
}
|
|
12488
|
+
message = (json === null || json === void 0 || (_json$status = json.status) === null || _json$status === void 0 ? void 0 : _json$status.error_message) || "";
|
|
12489
|
+
if (!message.includes("API Key Missing")) {
|
|
12490
|
+
_context1.next = 45;
|
|
11683
12491
|
break;
|
|
11684
12492
|
}
|
|
11685
|
-
return
|
|
12493
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
11686
12494
|
|
|
11687
|
-
case
|
|
12495
|
+
case 45:
|
|
11688
12496
|
if (!(response.status === 429)) {
|
|
11689
|
-
|
|
12497
|
+
_context1.next = 47;
|
|
11690
12498
|
break;
|
|
11691
12499
|
}
|
|
11692
|
-
return
|
|
12500
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
11693
12501
|
|
|
11694
|
-
case
|
|
11695
|
-
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
jsonResponse = _context0.sent;
|
|
12502
|
+
case 47:
|
|
12503
|
+
if (!(category.toLowerCase() === "price")) {
|
|
12504
|
+
_context1.next = 51;
|
|
12505
|
+
break;
|
|
12506
|
+
}
|
|
11700
12507
|
output = {};
|
|
11701
|
-
for (
|
|
11702
|
-
_Object$
|
|
11703
|
-
prices = _Object$
|
|
11704
|
-
for (
|
|
11705
|
-
_Object$
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
output[
|
|
12508
|
+
for (_i11 = 0, _Object$entries2 = Object.entries(json); _i11 < _Object$entries2.length; _i11++) {
|
|
12509
|
+
_Object$entries2$_i = _slicedToArray(_Object$entries2[_i11], 2), _token = _Object$entries2$_i[0],
|
|
12510
|
+
prices = _Object$entries2$_i[1];
|
|
12511
|
+
for (_i12 = 0, _Object$entries3 = Object.entries(prices); _i12 < _Object$entries3.length; _i12++) {
|
|
12512
|
+
_Object$entries3$_i = _slicedToArray(_Object$entries3[_i12], 2), currency = _Object$entries3$_i[0],
|
|
12513
|
+
_value6 = _Object$entries3$_i[1];
|
|
12514
|
+
_key5 = "".concat(_token.charAt(0).toUpperCase() + _token.slice(1), "_").concat(currency.toUpperCase());
|
|
12515
|
+
output[_key5] = _value6;
|
|
11709
12516
|
}
|
|
11710
12517
|
}
|
|
11711
|
-
return
|
|
12518
|
+
return _context1.abrupt("return", [ output ]);
|
|
12519
|
+
|
|
12520
|
+
case 51:
|
|
12521
|
+
flatArray = Array.isArray(json) ? json : [ json ];
|
|
12522
|
+
return _context1.abrupt("return", flatArray.map((function(item) {
|
|
12523
|
+
var flat = {};
|
|
12524
|
+
for (var _i13 = 0, _Object$entries4 = Object.entries(item); _i13 < _Object$entries4.length; _i13++) {
|
|
12525
|
+
var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i13], 2), _key6 = _Object$entries4$_i[0], _value7 = _Object$entries4$_i[1];
|
|
12526
|
+
if (_typeof(_value7) !== "object" || _value7 === null) {
|
|
12527
|
+
flat[_key6] = _value7;
|
|
12528
|
+
}
|
|
12529
|
+
}
|
|
12530
|
+
return flat;
|
|
12531
|
+
})));
|
|
11712
12532
|
|
|
11713
|
-
case
|
|
11714
|
-
|
|
11715
|
-
|
|
11716
|
-
console.
|
|
11717
|
-
return
|
|
12533
|
+
case 55:
|
|
12534
|
+
_context1.prev = 55;
|
|
12535
|
+
_context1.t1 = _context1["catch"](34);
|
|
12536
|
+
console.error(_context1.t1);
|
|
12537
|
+
return _context1.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11718
12538
|
|
|
11719
|
-
case
|
|
12539
|
+
case 59:
|
|
11720
12540
|
case "end":
|
|
11721
|
-
return
|
|
12541
|
+
return _context1.stop();
|
|
11722
12542
|
}
|
|
11723
|
-
}),
|
|
12543
|
+
}), _callee1, null, [ [ 34, 55 ] ]);
|
|
11724
12544
|
})));
|
|
11725
12545
|
return _COINGECKO.apply(this, arguments);
|
|
11726
12546
|
}
|
|
11727
|
-
function EOA(
|
|
12547
|
+
function EOA(_x23, _x24, _x25, _x26, _x27) {
|
|
11728
12548
|
return _EOA.apply(this, arguments);
|
|
11729
12549
|
}
|
|
11730
12550
|
function _EOA() {
|
|
11731
|
-
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11732
|
-
var page, offset,
|
|
11733
|
-
return _regeneratorRuntime().wrap((function
|
|
11734
|
-
while (1) switch (
|
|
12551
|
+
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11(addresses, category, chains, startTime, endTime) {
|
|
12552
|
+
var page, offset, API_KEY, INPUTS, CHAINS, out, ADDRESS_MAP, _iterator, _step, input, resolved, ADDRS, _iterator2, _step2, _loop, _ret, fetchJSON, _fetchJSON, _args13 = arguments;
|
|
12553
|
+
return _regeneratorRuntime().wrap((function _callee11$(_context13) {
|
|
12554
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
11735
12555
|
case 0:
|
|
11736
|
-
|
|
11737
|
-
|
|
11738
|
-
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
12556
|
+
_fetchJSON = function _fetchJSON3() {
|
|
12557
|
+
_fetchJSON = _asyncToGenerator(_regeneratorRuntime().mark((function _callee10(url) {
|
|
12558
|
+
var _json$result3, _json$result3$include, _json$result4, _json$result4$include, res, json;
|
|
12559
|
+
return _regeneratorRuntime().wrap((function _callee10$(_context12) {
|
|
12560
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
12561
|
+
case 0:
|
|
12562
|
+
_context12.prev = 0;
|
|
12563
|
+
_context12.next = 3;
|
|
12564
|
+
return fetch(url);
|
|
12565
|
+
|
|
12566
|
+
case 3:
|
|
12567
|
+
res = _context12.sent;
|
|
12568
|
+
if (res.ok) {
|
|
12569
|
+
_context12.next = 6;
|
|
12570
|
+
break;
|
|
12571
|
+
}
|
|
12572
|
+
return _context12.abrupt("return", "HTTP_".concat(res.status));
|
|
12573
|
+
|
|
12574
|
+
case 6:
|
|
12575
|
+
_context12.next = 8;
|
|
12576
|
+
return res.json();
|
|
12577
|
+
|
|
12578
|
+
case 8:
|
|
12579
|
+
json = _context12.sent;
|
|
12580
|
+
if (!((_json$result3 = json.result) !== null && _json$result3 !== void 0 && (_json$result3$include = _json$result3.includes) !== null && _json$result3$include !== void 0 && _json$result3$include.call(_json$result3, "Invalid API Key"))) {
|
|
12581
|
+
_context12.next = 11;
|
|
12582
|
+
break;
|
|
12583
|
+
}
|
|
12584
|
+
return _context12.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
12585
|
+
|
|
12586
|
+
case 11:
|
|
12587
|
+
if (!((_json$result4 = json.result) !== null && _json$result4 !== void 0 && (_json$result4$include = _json$result4.includes) !== null && _json$result4$include !== void 0 && _json$result4$include.call(_json$result4, "Max rate limit reached"))) {
|
|
12588
|
+
_context12.next = 13;
|
|
12589
|
+
break;
|
|
12590
|
+
}
|
|
12591
|
+
return _context12.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
12592
|
+
|
|
12593
|
+
case 13:
|
|
12594
|
+
if (!(json.status === "0" && json.message !== "No transactions found")) {
|
|
12595
|
+
_context12.next = 15;
|
|
12596
|
+
break;
|
|
12597
|
+
}
|
|
12598
|
+
return _context12.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12599
|
+
|
|
12600
|
+
case 15:
|
|
12601
|
+
return _context12.abrupt("return", json.result);
|
|
12602
|
+
|
|
12603
|
+
case 18:
|
|
12604
|
+
_context12.prev = 18;
|
|
12605
|
+
_context12.t0 = _context12["catch"](0);
|
|
12606
|
+
return _context12.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12607
|
+
|
|
12608
|
+
case 21:
|
|
12609
|
+
case "end":
|
|
12610
|
+
return _context12.stop();
|
|
12611
|
+
}
|
|
12612
|
+
}), _callee10, null, [ [ 0, 18 ] ]);
|
|
12613
|
+
})));
|
|
12614
|
+
return _fetchJSON.apply(this, arguments);
|
|
12615
|
+
};
|
|
12616
|
+
fetchJSON = function _fetchJSON2(_x35) {
|
|
12617
|
+
return _fetchJSON.apply(this, arguments);
|
|
12618
|
+
};
|
|
12619
|
+
page = _args13.length > 5 && _args13[5] !== undefined ? _args13[5] : 1;
|
|
12620
|
+
offset = _args13.length > 6 && _args13[6] !== undefined ? _args13[6] : 10;
|
|
11746
12621
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
|
|
11747
12622
|
if (API_KEY) {
|
|
11748
|
-
|
|
12623
|
+
_context13.next = 7;
|
|
11749
12624
|
break;
|
|
11750
12625
|
}
|
|
11751
|
-
return
|
|
12626
|
+
return _context13.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11752
12627
|
|
|
11753
|
-
case
|
|
11754
|
-
|
|
11755
|
-
|
|
12628
|
+
case 7:
|
|
12629
|
+
INPUTS = addresses.split(",").map((function(a) {
|
|
12630
|
+
return a.trim();
|
|
12631
|
+
})).filter(Boolean);
|
|
12632
|
+
CHAINS = chains.split(",").map((function(c) {
|
|
12633
|
+
return c.trim();
|
|
12634
|
+
})).filter(Boolean);
|
|
12635
|
+
out = [];
|
|
12636
|
+
ADDRESS_MAP = {};
|
|
12637
|
+
_iterator = _createForOfIteratorHelper(INPUTS);
|
|
12638
|
+
_context13.prev = 12;
|
|
11756
12639
|
_iterator.s();
|
|
11757
12640
|
|
|
11758
|
-
case
|
|
12641
|
+
case 14:
|
|
11759
12642
|
if ((_step = _iterator.n()).done) {
|
|
11760
|
-
|
|
12643
|
+
_context13.next = 32;
|
|
11761
12644
|
break;
|
|
11762
12645
|
}
|
|
11763
|
-
|
|
11764
|
-
|
|
11765
|
-
|
|
11766
|
-
_context1.next = 17;
|
|
12646
|
+
input = _step.value;
|
|
12647
|
+
if (!/^0x[a-fA-F0-9]{40}$/.test(input)) {
|
|
12648
|
+
_context13.next = 20;
|
|
11767
12649
|
break;
|
|
11768
12650
|
}
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
|
|
11772
|
-
_iterator2 = _createForOfIteratorHelper(ADDRESSES);
|
|
11773
|
-
_context1.prev = 18;
|
|
11774
|
-
_iterator2.s();
|
|
12651
|
+
ADDRESS_MAP[input.toLowerCase()] = null;
|
|
12652
|
+
_context13.next = 30;
|
|
12653
|
+
break;
|
|
11775
12654
|
|
|
11776
12655
|
case 20:
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
|
|
11780
|
-
|
|
11781
|
-
|
|
11782
|
-
|
|
11783
|
-
|
|
11784
|
-
|
|
11785
|
-
|
|
11786
|
-
break;
|
|
11787
|
-
}
|
|
11788
|
-
_context1.next = 27;
|
|
11789
|
-
return fromTimeStampToBlock(startTime, chain, API_KEY);
|
|
12656
|
+
_context13.prev = 20;
|
|
12657
|
+
_context13.next = 23;
|
|
12658
|
+
return toEnsName(input);
|
|
12659
|
+
|
|
12660
|
+
case 23:
|
|
12661
|
+
resolved = _context13.sent;
|
|
12662
|
+
if (resolved) ADDRESS_MAP[resolved.toLowerCase()] = input;
|
|
12663
|
+
_context13.next = 30;
|
|
12664
|
+
break;
|
|
11790
12665
|
|
|
11791
12666
|
case 27:
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
return
|
|
12667
|
+
_context13.prev = 27;
|
|
12668
|
+
_context13.t0 = _context13["catch"](20);
|
|
12669
|
+
return _context13.abrupt("return", "".concat(input).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11795
12670
|
|
|
11796
12671
|
case 30:
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
12672
|
+
_context13.next = 14;
|
|
12673
|
+
break;
|
|
12674
|
+
|
|
12675
|
+
case 32:
|
|
12676
|
+
_context13.next = 37;
|
|
11800
12677
|
break;
|
|
11801
12678
|
|
|
11802
12679
|
case 34:
|
|
11803
|
-
|
|
12680
|
+
_context13.prev = 34;
|
|
12681
|
+
_context13.t1 = _context13["catch"](12);
|
|
12682
|
+
_iterator.e(_context13.t1);
|
|
11804
12683
|
|
|
11805
|
-
case
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
12684
|
+
case 37:
|
|
12685
|
+
_context13.prev = 37;
|
|
12686
|
+
_iterator.f();
|
|
12687
|
+
return _context13.finish(37);
|
|
12688
|
+
|
|
12689
|
+
case 40:
|
|
12690
|
+
ADDRS = Object.keys(ADDRESS_MAP);
|
|
12691
|
+
_iterator2 = _createForOfIteratorHelper(CHAINS);
|
|
12692
|
+
_context13.prev = 42;
|
|
12693
|
+
_loop = _regeneratorRuntime().mark((function _loop() {
|
|
12694
|
+
var chain, chainId, i, slice, action, url, _data, startBlock, endBlock, _loop2, _ret2, _i14, _ADDRS;
|
|
12695
|
+
return _regeneratorRuntime().wrap((function _loop$(_context11) {
|
|
12696
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
12697
|
+
case 0:
|
|
12698
|
+
chain = _step2.value;
|
|
12699
|
+
chainId = CHAIN_ID_MAP[chain];
|
|
12700
|
+
if (chainId) {
|
|
12701
|
+
_context11.next = 4;
|
|
12702
|
+
break;
|
|
12703
|
+
}
|
|
12704
|
+
return _context11.abrupt("return", {
|
|
12705
|
+
v: ERROR_MESSAGES_FLAG.UNSUPPORTED_CHAIN
|
|
12706
|
+
});
|
|
11810
12707
|
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
|
|
11816
|
-
|
|
11817
|
-
return _context1.abrupt("return", "HTTP_".concat(response.status));
|
|
12708
|
+
case 4:
|
|
12709
|
+
if (!(category === "balance")) {
|
|
12710
|
+
_context11.next = 20;
|
|
12711
|
+
break;
|
|
12712
|
+
}
|
|
12713
|
+
i = 0;
|
|
11818
12714
|
|
|
11819
|
-
|
|
11820
|
-
|
|
11821
|
-
|
|
12715
|
+
case 6:
|
|
12716
|
+
if (!(i < ADDRS.length)) {
|
|
12717
|
+
_context11.next = 19;
|
|
12718
|
+
break;
|
|
12719
|
+
}
|
|
12720
|
+
slice = ADDRS.slice(i, i + 20).join(",");
|
|
12721
|
+
action = ADDRS.length > 1 ? "balancemulti" : "balance";
|
|
12722
|
+
url = "https://api.etherscan.io/v2/api?chainid=".concat(chainId) + "&module=account&action=".concat(action, "&address=").concat(slice) + "&tag=latest&apikey=".concat(API_KEY);
|
|
12723
|
+
_context11.next = 12;
|
|
12724
|
+
return fetchJSON(url);
|
|
12725
|
+
|
|
12726
|
+
case 12:
|
|
12727
|
+
_data = _context11.sent;
|
|
12728
|
+
if (!(typeof _data === "string")) {
|
|
12729
|
+
_context11.next = 15;
|
|
12730
|
+
break;
|
|
12731
|
+
}
|
|
12732
|
+
return _context11.abrupt("return", {
|
|
12733
|
+
v: _data
|
|
12734
|
+
});
|
|
11822
12735
|
|
|
11823
|
-
|
|
11824
|
-
|
|
11825
|
-
|
|
11826
|
-
|
|
12736
|
+
case 15:
|
|
12737
|
+
(Array.isArray(_data) ? _data : [ _data ]).forEach((function(r) {
|
|
12738
|
+
return out.push(_objectSpread(_objectSpread({
|
|
12739
|
+
chain: chain
|
|
12740
|
+
}, r), {}, {
|
|
12741
|
+
name: ADDRESS_MAP[(r.account || r.address || "").toLowerCase()] || null
|
|
12742
|
+
}));
|
|
12743
|
+
}));
|
|
12744
|
+
|
|
12745
|
+
case 16:
|
|
12746
|
+
i += 20;
|
|
12747
|
+
_context11.next = 6;
|
|
12748
|
+
break;
|
|
12749
|
+
|
|
12750
|
+
case 19:
|
|
12751
|
+
return _context11.abrupt("return", 0);
|
|
12752
|
+
|
|
12753
|
+
case 20:
|
|
12754
|
+
if (!(category === "txns")) {
|
|
12755
|
+
_context11.next = 38;
|
|
12756
|
+
break;
|
|
12757
|
+
}
|
|
12758
|
+
_context11.next = 23;
|
|
12759
|
+
return fromTimeStampToBlock(toTimestamp(startTime), chain, API_KEY);
|
|
12760
|
+
|
|
12761
|
+
case 23:
|
|
12762
|
+
startBlock = _context11.sent;
|
|
12763
|
+
_context11.next = 26;
|
|
12764
|
+
return fromTimeStampToBlock(toTimestamp(endTime), chain, API_KEY);
|
|
12765
|
+
|
|
12766
|
+
case 26:
|
|
12767
|
+
endBlock = _context11.sent;
|
|
12768
|
+
_loop2 = _regeneratorRuntime().mark((function _loop2() {
|
|
12769
|
+
var addr, url, data;
|
|
12770
|
+
return _regeneratorRuntime().wrap((function _loop2$(_context10) {
|
|
12771
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
12772
|
+
case 0:
|
|
12773
|
+
addr = _ADDRS[_i14];
|
|
12774
|
+
url = "https://api.etherscan.io/v2/api?chainid=".concat(chainId) + "&module=account&action=txlist&address=".concat(addr) + "&startblock=".concat(startBlock, "&endblock=").concat(endBlock) + "&page=".concat(page, "&offset=").concat(offset, "&sort=asc&apikey=").concat(API_KEY);
|
|
12775
|
+
_context10.next = 4;
|
|
12776
|
+
return fetchJSON(url);
|
|
12777
|
+
|
|
12778
|
+
case 4:
|
|
12779
|
+
data = _context10.sent;
|
|
12780
|
+
if (!(typeof data === "string")) {
|
|
12781
|
+
_context10.next = 7;
|
|
12782
|
+
break;
|
|
12783
|
+
}
|
|
12784
|
+
return _context10.abrupt("return", {
|
|
12785
|
+
v: {
|
|
12786
|
+
v: data
|
|
12787
|
+
}
|
|
12788
|
+
});
|
|
12789
|
+
|
|
12790
|
+
case 7:
|
|
12791
|
+
data.forEach((function(tx) {
|
|
12792
|
+
return out.push(_objectSpread({
|
|
12793
|
+
chain: chain,
|
|
12794
|
+
address: addr,
|
|
12795
|
+
name: ADDRESS_MAP[addr]
|
|
12796
|
+
}, tx));
|
|
12797
|
+
}));
|
|
12798
|
+
|
|
12799
|
+
case 8:
|
|
12800
|
+
case "end":
|
|
12801
|
+
return _context10.stop();
|
|
12802
|
+
}
|
|
12803
|
+
}), _loop2);
|
|
12804
|
+
}));
|
|
12805
|
+
_i14 = 0, _ADDRS = ADDRS;
|
|
12806
|
+
|
|
12807
|
+
case 29:
|
|
12808
|
+
if (!(_i14 < _ADDRS.length)) {
|
|
12809
|
+
_context11.next = 37;
|
|
12810
|
+
break;
|
|
12811
|
+
}
|
|
12812
|
+
return _context11.delegateYield(_loop2(), "t0", 31);
|
|
12813
|
+
|
|
12814
|
+
case 31:
|
|
12815
|
+
_ret2 = _context11.t0;
|
|
12816
|
+
if (!_ret2) {
|
|
12817
|
+
_context11.next = 34;
|
|
12818
|
+
break;
|
|
12819
|
+
}
|
|
12820
|
+
return _context11.abrupt("return", _ret2.v);
|
|
12821
|
+
|
|
12822
|
+
case 34:
|
|
12823
|
+
_i14++;
|
|
12824
|
+
_context11.next = 29;
|
|
12825
|
+
break;
|
|
12826
|
+
|
|
12827
|
+
case 37:
|
|
12828
|
+
return _context11.abrupt("return", 0);
|
|
12829
|
+
|
|
12830
|
+
case 38:
|
|
12831
|
+
return _context11.abrupt("return", {
|
|
12832
|
+
v: ERROR_MESSAGES_FLAG.INVALID_CATEGORY
|
|
12833
|
+
});
|
|
12834
|
+
|
|
12835
|
+
case 39:
|
|
12836
|
+
case "end":
|
|
12837
|
+
return _context11.stop();
|
|
12838
|
+
}
|
|
12839
|
+
}), _loop);
|
|
12840
|
+
}));
|
|
12841
|
+
_iterator2.s();
|
|
12842
|
+
|
|
12843
|
+
case 45:
|
|
12844
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
12845
|
+
_context13.next = 54;
|
|
11827
12846
|
break;
|
|
11828
12847
|
}
|
|
11829
|
-
return
|
|
12848
|
+
return _context13.delegateYield(_loop(), "t2", 47);
|
|
11830
12849
|
|
|
11831
12850
|
case 47:
|
|
11832
|
-
|
|
11833
|
-
|
|
12851
|
+
_ret = _context13.t2;
|
|
12852
|
+
if (!(_ret === 0)) {
|
|
12853
|
+
_context13.next = 50;
|
|
11834
12854
|
break;
|
|
11835
12855
|
}
|
|
11836
|
-
return
|
|
11837
|
-
|
|
11838
|
-
case 49:
|
|
11839
|
-
entries = Array.isArray(json.result) ? json.result : [ json.result ];
|
|
11840
|
-
_iterator3 = _createForOfIteratorHelper(entries);
|
|
11841
|
-
try {
|
|
11842
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
|
|
11843
|
-
entry = _step3.value;
|
|
11844
|
-
flatResults.push(_objectSpread({
|
|
11845
|
-
chain: chain,
|
|
11846
|
-
address: address
|
|
11847
|
-
}, entry));
|
|
11848
|
-
}
|
|
11849
|
-
} catch (err) {
|
|
11850
|
-
_iterator3.e(err);
|
|
11851
|
-
} finally {
|
|
11852
|
-
_iterator3.f();
|
|
11853
|
-
}
|
|
11854
|
-
_context1.next = 57;
|
|
11855
|
-
break;
|
|
12856
|
+
return _context13.abrupt("continue", 52);
|
|
11856
12857
|
|
|
11857
|
-
case
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
12858
|
+
case 50:
|
|
12859
|
+
if (!_ret) {
|
|
12860
|
+
_context13.next = 52;
|
|
12861
|
+
break;
|
|
12862
|
+
}
|
|
12863
|
+
return _context13.abrupt("return", _ret.v);
|
|
11861
12864
|
|
|
11862
|
-
case
|
|
11863
|
-
|
|
12865
|
+
case 52:
|
|
12866
|
+
_context13.next = 45;
|
|
11864
12867
|
break;
|
|
11865
12868
|
|
|
11866
|
-
case
|
|
11867
|
-
|
|
12869
|
+
case 54:
|
|
12870
|
+
_context13.next = 59;
|
|
11868
12871
|
break;
|
|
11869
12872
|
|
|
11870
|
-
case
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
_iterator2.e(
|
|
12873
|
+
case 56:
|
|
12874
|
+
_context13.prev = 56;
|
|
12875
|
+
_context13.t3 = _context13["catch"](42);
|
|
12876
|
+
_iterator2.e(_context13.t3);
|
|
11874
12877
|
|
|
11875
|
-
case
|
|
11876
|
-
|
|
12878
|
+
case 59:
|
|
12879
|
+
_context13.prev = 59;
|
|
11877
12880
|
_iterator2.f();
|
|
11878
|
-
return
|
|
11879
|
-
|
|
11880
|
-
case 67:
|
|
11881
|
-
_context1.next = 12;
|
|
11882
|
-
break;
|
|
11883
|
-
|
|
11884
|
-
case 69:
|
|
11885
|
-
_context1.next = 74;
|
|
11886
|
-
break;
|
|
11887
|
-
|
|
11888
|
-
case 71:
|
|
11889
|
-
_context1.prev = 71;
|
|
11890
|
-
_context1.t2 = _context1["catch"](10);
|
|
11891
|
-
_iterator.e(_context1.t2);
|
|
11892
|
-
|
|
11893
|
-
case 74:
|
|
11894
|
-
_context1.prev = 74;
|
|
11895
|
-
_iterator.f();
|
|
11896
|
-
return _context1.finish(74);
|
|
12881
|
+
return _context13.finish(59);
|
|
11897
12882
|
|
|
11898
|
-
case
|
|
11899
|
-
return
|
|
12883
|
+
case 62:
|
|
12884
|
+
return _context13.abrupt("return", out);
|
|
11900
12885
|
|
|
11901
|
-
case
|
|
11902
|
-
_context1.prev = 80;
|
|
11903
|
-
_context1.t3 = _context1["catch"](2);
|
|
11904
|
-
console.log(_context1.t3);
|
|
11905
|
-
return _context1.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11906
|
-
|
|
11907
|
-
case 84:
|
|
12886
|
+
case 63:
|
|
11908
12887
|
case "end":
|
|
11909
|
-
return
|
|
12888
|
+
return _context13.stop();
|
|
11910
12889
|
}
|
|
11911
|
-
}),
|
|
12890
|
+
}), _callee11, null, [ [ 12, 34, 37, 40 ], [ 20, 27 ], [ 42, 56, 59, 62 ] ]);
|
|
11912
12891
|
})));
|
|
11913
12892
|
return _EOA.apply(this, arguments);
|
|
11914
12893
|
}
|
|
11915
|
-
function FLVURL(
|
|
12894
|
+
function FLVURL(_x28, _x29) {
|
|
11916
12895
|
return _FLVURL.apply(this, arguments);
|
|
11917
12896
|
}
|
|
11918
12897
|
function _FLVURL() {
|
|
11919
|
-
_FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11920
|
-
return _regeneratorRuntime().wrap((function
|
|
11921
|
-
while (1) switch (
|
|
12898
|
+
_FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee12(token, vs_currencies) {
|
|
12899
|
+
return _regeneratorRuntime().wrap((function _callee12$(_context14) {
|
|
12900
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
11922
12901
|
case 0:
|
|
11923
|
-
return
|
|
12902
|
+
return _context14.abrupt("return", new Promise((function(resolve) {
|
|
11924
12903
|
setTimeout((function() {
|
|
11925
12904
|
resolve([ {
|
|
11926
12905
|
Yoo: "gotcha"
|
|
@@ -11930,61 +12909,61 @@ function _typeof(o) {
|
|
|
11930
12909
|
|
|
11931
12910
|
case 1:
|
|
11932
12911
|
case "end":
|
|
11933
|
-
return
|
|
12912
|
+
return _context14.stop();
|
|
11934
12913
|
}
|
|
11935
|
-
}),
|
|
12914
|
+
}), _callee12);
|
|
11936
12915
|
})));
|
|
11937
12916
|
return _FLVURL.apply(this, arguments);
|
|
11938
12917
|
}
|
|
11939
|
-
function SAFE(
|
|
12918
|
+
function SAFE(_x30, _x31, _x32, _x33, _x34) {
|
|
11940
12919
|
return _SAFE.apply(this, arguments);
|
|
11941
12920
|
}
|
|
11942
12921
|
function _SAFE() {
|
|
11943
|
-
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12922
|
+
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee13(address, utility, chain, limit, offset) {
|
|
11944
12923
|
var apiKey, chainIdentifier, url, response, json;
|
|
11945
|
-
return _regeneratorRuntime().wrap((function
|
|
11946
|
-
while (1) switch (
|
|
12924
|
+
return _regeneratorRuntime().wrap((function _callee13$(_context15) {
|
|
12925
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
11947
12926
|
case 0:
|
|
11948
12927
|
if (!(typeof limit !== "number" || limit < 0)) {
|
|
11949
|
-
|
|
12928
|
+
_context15.next = 2;
|
|
11950
12929
|
break;
|
|
11951
12930
|
}
|
|
11952
|
-
return
|
|
12931
|
+
return _context15.abrupt("return", "INVALID_LIMIT");
|
|
11953
12932
|
|
|
11954
12933
|
case 2:
|
|
11955
12934
|
if (!(typeof offset !== "number" || offset < 0)) {
|
|
11956
|
-
|
|
12935
|
+
_context15.next = 4;
|
|
11957
12936
|
break;
|
|
11958
12937
|
}
|
|
11959
|
-
return
|
|
12938
|
+
return _context15.abrupt("return", "INVALID_OFFSET");
|
|
11960
12939
|
|
|
11961
12940
|
case 4:
|
|
11962
12941
|
if (!(utility !== "txns")) {
|
|
11963
|
-
|
|
12942
|
+
_context15.next = 6;
|
|
11964
12943
|
break;
|
|
11965
12944
|
}
|
|
11966
|
-
return
|
|
12945
|
+
return _context15.abrupt("return", "UTILITY IS NOT SUPPORTED");
|
|
11967
12946
|
|
|
11968
12947
|
case 6:
|
|
11969
12948
|
apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
|
|
11970
12949
|
chainIdentifier = SAFE_CHAIN_MAP[chain];
|
|
11971
12950
|
if (apiKey) {
|
|
11972
|
-
|
|
12951
|
+
_context15.next = 10;
|
|
11973
12952
|
break;
|
|
11974
12953
|
}
|
|
11975
|
-
return
|
|
12954
|
+
return _context15.abrupt("return", "".concat(SERVICE_API_KEY.Safe, "_MISSING"));
|
|
11976
12955
|
|
|
11977
12956
|
case 10:
|
|
11978
12957
|
if (chainIdentifier) {
|
|
11979
|
-
|
|
12958
|
+
_context15.next = 12;
|
|
11980
12959
|
break;
|
|
11981
12960
|
}
|
|
11982
|
-
return
|
|
12961
|
+
return _context15.abrupt("return", "CHAIN IS NOT SUPPORTED");
|
|
11983
12962
|
|
|
11984
12963
|
case 12:
|
|
11985
12964
|
url = "https://api.safe.global/tx-service/".concat(chainIdentifier, "/api/v2/safes/").concat(address, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
|
|
11986
|
-
|
|
11987
|
-
|
|
12965
|
+
_context15.prev = 13;
|
|
12966
|
+
_context15.next = 16;
|
|
11988
12967
|
return fetch(url, {
|
|
11989
12968
|
headers: {
|
|
11990
12969
|
Authorization: "Bearer ".concat(apiKey)
|
|
@@ -11992,42 +12971,42 @@ function _typeof(o) {
|
|
|
11992
12971
|
});
|
|
11993
12972
|
|
|
11994
12973
|
case 16:
|
|
11995
|
-
response =
|
|
12974
|
+
response = _context15.sent;
|
|
11996
12975
|
if (response.ok) {
|
|
11997
|
-
|
|
12976
|
+
_context15.next = 19;
|
|
11998
12977
|
break;
|
|
11999
12978
|
}
|
|
12000
12979
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
12001
12980
|
|
|
12002
12981
|
case 19:
|
|
12003
|
-
|
|
12982
|
+
_context15.next = 21;
|
|
12004
12983
|
return response.json();
|
|
12005
12984
|
|
|
12006
12985
|
case 21:
|
|
12007
|
-
json =
|
|
12986
|
+
json = _context15.sent;
|
|
12008
12987
|
if (Array.isArray(json.results)) {
|
|
12009
|
-
|
|
12988
|
+
_context15.next = 24;
|
|
12010
12989
|
break;
|
|
12011
12990
|
}
|
|
12012
|
-
return
|
|
12991
|
+
return _context15.abrupt("return", "INVALID API RESPONSE");
|
|
12013
12992
|
|
|
12014
12993
|
case 24:
|
|
12015
|
-
return
|
|
12994
|
+
return _context15.abrupt("return", json.results.map((function(_ref5) {
|
|
12016
12995
|
var confirmations = _ref5.confirmations, dataDecoded = _ref5.dataDecoded, rest = _objectWithoutProperties(_ref5, _excluded);
|
|
12017
12996
|
return rest;
|
|
12018
12997
|
})));
|
|
12019
12998
|
|
|
12020
12999
|
case 27:
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
console.log(
|
|
12024
|
-
return
|
|
13000
|
+
_context15.prev = 27;
|
|
13001
|
+
_context15.t0 = _context15["catch"](13);
|
|
13002
|
+
console.log(_context15.t0);
|
|
13003
|
+
return _context15.abrupt("return", "ERROR IN FETCHING");
|
|
12025
13004
|
|
|
12026
13005
|
case 31:
|
|
12027
13006
|
case "end":
|
|
12028
|
-
return
|
|
13007
|
+
return _context15.stop();
|
|
12029
13008
|
}
|
|
12030
|
-
}),
|
|
13009
|
+
}), _callee13, null, [ [ 13, 27 ] ]);
|
|
12031
13010
|
})));
|
|
12032
13011
|
return _SAFE.apply(this, arguments);
|
|
12033
13012
|
}
|
|
@@ -12195,7 +13174,7 @@ function _typeof(o) {
|
|
|
12195
13174
|
exports.GCD = GCD;
|
|
12196
13175
|
exports.GEOMEAN = GEOMEAN;
|
|
12197
13176
|
exports.GESTEP = GESTEP;
|
|
12198
|
-
exports.
|
|
13177
|
+
exports.GNOSISPAY = GNOSISPAY;
|
|
12199
13178
|
exports.GNOSISSCAN = GNOSISSCAN;
|
|
12200
13179
|
exports.GROWTH = GROWTH;
|
|
12201
13180
|
exports.HARMEAN = HARMEAN;
|