@fileverse-dev/formulajs 4.4.11-mod-25 → 4.4.11-mod-27
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 +1367 -358
- package/lib/browser/formula.min.js +10 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +968 -68
- package/lib/esm/crypto-constants.mjs +61 -37
- package/lib/esm/index.mjs +968 -68
- package/package.json +2 -1
- package/types/cjs/index.d.cts +2 -2
- package/types/esm/index.d.mts +2 -2
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-27 */
|
|
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) {
|
|
@@ -11126,21 +11128,786 @@ function _typeof(o) {
|
|
|
11126
11128
|
})));
|
|
11127
11129
|
return _handleScanRequest.apply(this, arguments);
|
|
11128
11130
|
}
|
|
11129
|
-
function
|
|
11131
|
+
function toTimestamp(dateStr) {
|
|
11132
|
+
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];
|
|
11133
|
+
var date = new Date(year, month - 1, day);
|
|
11134
|
+
return Math.floor(date.getTime() / 1e3);
|
|
11135
|
+
}
|
|
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;
|
|
11756
|
+
}
|
|
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;
|
|
11764
|
+
return _regeneratorRuntime().wrap((function _callee3$(_context3) {
|
|
11765
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
11766
|
+
case 0:
|
|
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
|
+
});
|
|
11786
|
+
|
|
11787
|
+
case 5:
|
|
11788
|
+
resolverRes = _context3.sent;
|
|
11789
|
+
_context3.next = 8;
|
|
11790
|
+
return resolverRes.json();
|
|
11791
|
+
|
|
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;
|
|
11798
|
+
break;
|
|
11799
|
+
}
|
|
11800
|
+
return _context3.abrupt("return", null);
|
|
11801
|
+
|
|
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
|
+
});
|
|
11819
|
+
|
|
11820
|
+
case 15:
|
|
11821
|
+
nameRes = _context3.sent;
|
|
11822
|
+
_context3.next = 18;
|
|
11823
|
+
return nameRes.json();
|
|
11824
|
+
|
|
11825
|
+
case 18:
|
|
11826
|
+
_yield$nameRes$json = _context3.sent;
|
|
11827
|
+
nameHex = _yield$nameRes$json.result;
|
|
11828
|
+
if (!(!nameHex || nameHex === "0x")) {
|
|
11829
|
+
_context3.next = 22;
|
|
11830
|
+
break;
|
|
11831
|
+
}
|
|
11832
|
+
return _context3.abrupt("return", null);
|
|
11833
|
+
|
|
11834
|
+
case 22:
|
|
11835
|
+
hex = nameHex.slice(2);
|
|
11836
|
+
name = "";
|
|
11837
|
+
i = 0;
|
|
11838
|
+
|
|
11839
|
+
case 25:
|
|
11840
|
+
if (!(i < hex.length)) {
|
|
11841
|
+
_context3.next = 33;
|
|
11842
|
+
break;
|
|
11843
|
+
}
|
|
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;
|
|
11857
|
+
break;
|
|
11858
|
+
|
|
11859
|
+
case 33:
|
|
11860
|
+
return _context3.abrupt("return", name || null);
|
|
11861
|
+
|
|
11862
|
+
case 34:
|
|
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) {
|
|
11130
11897
|
return _FIREFLY.apply(this, arguments);
|
|
11131
11898
|
}
|
|
11132
11899
|
function _FIREFLY() {
|
|
11133
|
-
_FIREFLY = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11900
|
+
_FIREFLY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee4(platform, contentType, identifier) {
|
|
11134
11901
|
var API_KEY, baseUrl, headers, query, type, normalizedId, url, res, json, flattened;
|
|
11135
|
-
return _regeneratorRuntime().wrap((function
|
|
11136
|
-
while (1) switch (
|
|
11902
|
+
return _regeneratorRuntime().wrap((function _callee4$(_context4) {
|
|
11903
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
11137
11904
|
case 0:
|
|
11138
11905
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
11139
11906
|
if (API_KEY) {
|
|
11140
|
-
|
|
11907
|
+
_context4.next = 3;
|
|
11141
11908
|
break;
|
|
11142
11909
|
}
|
|
11143
|
-
return
|
|
11910
|
+
return _context4.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11144
11911
|
|
|
11145
11912
|
case 3:
|
|
11146
11913
|
baseUrl = "https://openapi.firefly.land/v1/fileverse/fetch";
|
|
@@ -11151,68 +11918,68 @@ function _typeof(o) {
|
|
|
11151
11918
|
type = "";
|
|
11152
11919
|
normalizedId = identifier.trim().replace(/.*\/([^\/]+)$/, "$1");
|
|
11153
11920
|
if (!(platform === "farcaster")) {
|
|
11154
|
-
|
|
11921
|
+
_context4.next = 22;
|
|
11155
11922
|
break;
|
|
11156
11923
|
}
|
|
11157
11924
|
if (!(contentType === "posts")) {
|
|
11158
|
-
|
|
11925
|
+
_context4.next = 14;
|
|
11159
11926
|
break;
|
|
11160
11927
|
}
|
|
11161
11928
|
type = "farcasterid";
|
|
11162
11929
|
query = normalizedId;
|
|
11163
|
-
|
|
11930
|
+
_context4.next = 20;
|
|
11164
11931
|
break;
|
|
11165
11932
|
|
|
11166
11933
|
case 14:
|
|
11167
11934
|
if (!(contentType === "replies")) {
|
|
11168
|
-
|
|
11935
|
+
_context4.next = 19;
|
|
11169
11936
|
break;
|
|
11170
11937
|
}
|
|
11171
11938
|
type = "farcasterpostid";
|
|
11172
11939
|
query = normalizedId.startsWith("0x") ? normalizedId : Number(normalizedId).toString();
|
|
11173
|
-
|
|
11940
|
+
_context4.next = 20;
|
|
11174
11941
|
break;
|
|
11175
11942
|
|
|
11176
11943
|
case 19:
|
|
11177
|
-
return
|
|
11944
|
+
return _context4.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11178
11945
|
|
|
11179
11946
|
case 20:
|
|
11180
|
-
|
|
11947
|
+
_context4.next = 37;
|
|
11181
11948
|
break;
|
|
11182
11949
|
|
|
11183
11950
|
case 22:
|
|
11184
11951
|
if (!(platform === "lens")) {
|
|
11185
|
-
|
|
11952
|
+
_context4.next = 36;
|
|
11186
11953
|
break;
|
|
11187
11954
|
}
|
|
11188
11955
|
if (!(contentType === "posts")) {
|
|
11189
|
-
|
|
11956
|
+
_context4.next = 28;
|
|
11190
11957
|
break;
|
|
11191
11958
|
}
|
|
11192
11959
|
type = "lensid";
|
|
11193
11960
|
query = normalizedId;
|
|
11194
|
-
|
|
11961
|
+
_context4.next = 34;
|
|
11195
11962
|
break;
|
|
11196
11963
|
|
|
11197
11964
|
case 28:
|
|
11198
11965
|
if (!(contentType === "replies")) {
|
|
11199
|
-
|
|
11966
|
+
_context4.next = 33;
|
|
11200
11967
|
break;
|
|
11201
11968
|
}
|
|
11202
11969
|
type = "lenspostid";
|
|
11203
11970
|
query = normalizedId;
|
|
11204
|
-
|
|
11971
|
+
_context4.next = 34;
|
|
11205
11972
|
break;
|
|
11206
11973
|
|
|
11207
11974
|
case 33:
|
|
11208
|
-
return
|
|
11975
|
+
return _context4.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11209
11976
|
|
|
11210
11977
|
case 34:
|
|
11211
|
-
|
|
11978
|
+
_context4.next = 37;
|
|
11212
11979
|
break;
|
|
11213
11980
|
|
|
11214
11981
|
case 36:
|
|
11215
|
-
return
|
|
11982
|
+
return _context4.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11216
11983
|
|
|
11217
11984
|
case 37:
|
|
11218
11985
|
url = new URL(baseUrl);
|
|
@@ -11220,26 +11987,26 @@ function _typeof(o) {
|
|
|
11220
11987
|
url.searchParams.set("type", type);
|
|
11221
11988
|
url.searchParams.set("size", "10");
|
|
11222
11989
|
url.searchParams.set("cursor", "0");
|
|
11223
|
-
|
|
11224
|
-
|
|
11990
|
+
_context4.prev = 42;
|
|
11991
|
+
_context4.next = 45;
|
|
11225
11992
|
return fetch(url.toString(), {
|
|
11226
11993
|
headers: headers
|
|
11227
11994
|
});
|
|
11228
11995
|
|
|
11229
11996
|
case 45:
|
|
11230
|
-
res =
|
|
11997
|
+
res = _context4.sent;
|
|
11231
11998
|
if (res.ok) {
|
|
11232
|
-
|
|
11999
|
+
_context4.next = 48;
|
|
11233
12000
|
break;
|
|
11234
12001
|
}
|
|
11235
12002
|
throw new Error("HTTP ".concat(res.status));
|
|
11236
12003
|
|
|
11237
12004
|
case 48:
|
|
11238
|
-
|
|
12005
|
+
_context4.next = 50;
|
|
11239
12006
|
return res.json();
|
|
11240
12007
|
|
|
11241
12008
|
case 50:
|
|
11242
|
-
json =
|
|
12009
|
+
json = _context4.sent;
|
|
11243
12010
|
flattened = Array.isArray(json === null || json === void 0 ? void 0 : json.data) ? json.data.map((function(item) {
|
|
11244
12011
|
var _item$author, _item$author2, _item$metadata;
|
|
11245
12012
|
return {
|
|
@@ -11250,39 +12017,39 @@ function _typeof(o) {
|
|
|
11250
12017
|
platform: platform
|
|
11251
12018
|
};
|
|
11252
12019
|
})) : [];
|
|
11253
|
-
return
|
|
12020
|
+
return _context4.abrupt("return", flattened);
|
|
11254
12021
|
|
|
11255
12022
|
case 55:
|
|
11256
|
-
|
|
11257
|
-
|
|
11258
|
-
console.error("FIREFLY fetch error:",
|
|
11259
|
-
return
|
|
12023
|
+
_context4.prev = 55;
|
|
12024
|
+
_context4.t0 = _context4["catch"](42);
|
|
12025
|
+
console.error("FIREFLY fetch error:", _context4.t0);
|
|
12026
|
+
return _context4.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11260
12027
|
|
|
11261
12028
|
case 59:
|
|
11262
12029
|
case "end":
|
|
11263
|
-
return
|
|
12030
|
+
return _context4.stop();
|
|
11264
12031
|
}
|
|
11265
|
-
}),
|
|
12032
|
+
}), _callee4, null, [ [ 42, 55 ] ]);
|
|
11266
12033
|
})));
|
|
11267
12034
|
return _FIREFLY.apply(this, arguments);
|
|
11268
12035
|
}
|
|
11269
|
-
function BLOCKSCOUT(
|
|
12036
|
+
function BLOCKSCOUT(_x9, _x0, _x1, _x10, _x11, _x12, _x13) {
|
|
11270
12037
|
return _BLOCKSCOUT.apply(this, arguments);
|
|
11271
12038
|
}
|
|
11272
12039
|
function _BLOCKSCOUT() {
|
|
11273
|
-
_BLOCKSCOUT = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12040
|
+
_BLOCKSCOUT = _asyncToGenerator(_regeneratorRuntime().mark((function _callee5(address, type, chain, startTimestamp, endTimestamp, page, offset) {
|
|
11274
12041
|
var currentTimestamp, hostname, requestUrl, _json$result, _json$result2, response, json;
|
|
11275
|
-
return _regeneratorRuntime().wrap((function
|
|
11276
|
-
while (1) switch (
|
|
12042
|
+
return _regeneratorRuntime().wrap((function _callee5$(_context5) {
|
|
12043
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
11277
12044
|
case 0:
|
|
11278
12045
|
if (!chain) {
|
|
11279
12046
|
chain = "ethereum";
|
|
11280
12047
|
}
|
|
11281
12048
|
if (type) {
|
|
11282
|
-
|
|
12049
|
+
_context5.next = 3;
|
|
11283
12050
|
break;
|
|
11284
12051
|
}
|
|
11285
|
-
return
|
|
12052
|
+
return _context5.abrupt("return", "TYPE_MISSING");
|
|
11286
12053
|
|
|
11287
12054
|
case 3:
|
|
11288
12055
|
if (!startTimestamp) {
|
|
@@ -11291,78 +12058,78 @@ function _typeof(o) {
|
|
|
11291
12058
|
startTimestamp = Math.floor(startTimestamp / 1e3);
|
|
11292
12059
|
}
|
|
11293
12060
|
hostname = BLOCKSCOUT_CHAINS_MAP[chain];
|
|
11294
|
-
|
|
11295
|
-
|
|
12061
|
+
_context5.t0 = type;
|
|
12062
|
+
_context5.next = _context5.t0 === "stat" ? 8 : _context5.t0 === "txns" ? 10 : _context5.t0 === "tokens" ? 12 : 14;
|
|
11296
12063
|
break;
|
|
11297
12064
|
|
|
11298
12065
|
case 8:
|
|
11299
12066
|
requestUrl = "".concat(hostname, "/api/v2/addresses/").concat(address, "/counters");
|
|
11300
|
-
return
|
|
12067
|
+
return _context5.abrupt("break", 15);
|
|
11301
12068
|
|
|
11302
12069
|
case 10:
|
|
11303
12070
|
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
|
|
12071
|
+
return _context5.abrupt("break", 15);
|
|
11305
12072
|
|
|
11306
12073
|
case 12:
|
|
11307
12074
|
requestUrl = "".concat(hostname, "/api?module=account&action=tokenlist&address=").concat(address);
|
|
11308
|
-
return
|
|
12075
|
+
return _context5.abrupt("break", 15);
|
|
11309
12076
|
|
|
11310
12077
|
case 14:
|
|
11311
|
-
return
|
|
12078
|
+
return _context5.abrupt("return", "INVALID_TYPE");
|
|
11312
12079
|
|
|
11313
12080
|
case 15:
|
|
11314
|
-
|
|
11315
|
-
|
|
12081
|
+
_context5.prev = 15;
|
|
12082
|
+
_context5.next = 18;
|
|
11316
12083
|
return fetch(requestUrl);
|
|
11317
12084
|
|
|
11318
12085
|
case 18:
|
|
11319
|
-
response =
|
|
12086
|
+
response = _context5.sent;
|
|
11320
12087
|
if (response.ok) {
|
|
11321
|
-
|
|
12088
|
+
_context5.next = 21;
|
|
11322
12089
|
break;
|
|
11323
12090
|
}
|
|
11324
12091
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
11325
12092
|
|
|
11326
12093
|
case 21:
|
|
11327
|
-
|
|
12094
|
+
_context5.next = 23;
|
|
11328
12095
|
return response.json();
|
|
11329
12096
|
|
|
11330
12097
|
case 23:
|
|
11331
|
-
json =
|
|
12098
|
+
json = _context5.sent;
|
|
11332
12099
|
console.log(json);
|
|
11333
12100
|
if (!(json !== null && json !== void 0 && (_json$result = json.result) !== null && _json$result !== void 0 && _json$result.includes("Invalid parameter(s)"))) {
|
|
11334
|
-
|
|
12101
|
+
_context5.next = 27;
|
|
11335
12102
|
break;
|
|
11336
12103
|
}
|
|
11337
|
-
return
|
|
12104
|
+
return _context5.abrupt("return", "INVALID_REQUEST_PARAMS");
|
|
11338
12105
|
|
|
11339
12106
|
case 27:
|
|
11340
12107
|
if (!(json !== null && json !== void 0 && (_json$result2 = json.result) !== null && _json$result2 !== void 0 && _json$result2.includes("Not found"))) {
|
|
11341
|
-
|
|
12108
|
+
_context5.next = 29;
|
|
11342
12109
|
break;
|
|
11343
12110
|
}
|
|
11344
|
-
return
|
|
12111
|
+
return _context5.abrupt("return", "ADDRESS_NOT_FOUND");
|
|
11345
12112
|
|
|
11346
12113
|
case 29:
|
|
11347
12114
|
if (!(type === "stat")) {
|
|
11348
|
-
|
|
12115
|
+
_context5.next = 31;
|
|
11349
12116
|
break;
|
|
11350
12117
|
}
|
|
11351
|
-
return
|
|
12118
|
+
return _context5.abrupt("return", [ json ]);
|
|
11352
12119
|
|
|
11353
12120
|
case 31:
|
|
11354
|
-
return
|
|
12121
|
+
return _context5.abrupt("return", json.result);
|
|
11355
12122
|
|
|
11356
12123
|
case 34:
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
return
|
|
12124
|
+
_context5.prev = 34;
|
|
12125
|
+
_context5.t1 = _context5["catch"](15);
|
|
12126
|
+
return _context5.abrupt("return", "ERROR IN FETCHING");
|
|
11360
12127
|
|
|
11361
12128
|
case 37:
|
|
11362
12129
|
case "end":
|
|
11363
|
-
return
|
|
12130
|
+
return _context5.stop();
|
|
11364
12131
|
}
|
|
11365
|
-
}),
|
|
12132
|
+
}), _callee5, null, [ [ 15, 34 ] ]);
|
|
11366
12133
|
})));
|
|
11367
12134
|
return _BLOCKSCOUT.apply(this, arguments);
|
|
11368
12135
|
}
|
|
@@ -11370,17 +12137,17 @@ function _typeof(o) {
|
|
|
11370
12137
|
return _BASESCAN.apply(this, arguments);
|
|
11371
12138
|
}
|
|
11372
12139
|
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 (
|
|
12140
|
+
_BASESCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee6() {
|
|
12141
|
+
var _len2, args, _key2, type, chain, address, startDate, endDate, page, limit, _args6 = arguments;
|
|
12142
|
+
return _regeneratorRuntime().wrap((function _callee6$(_context6) {
|
|
12143
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
11377
12144
|
case 0:
|
|
11378
|
-
for (_len2 =
|
|
11379
|
-
args[_key2] =
|
|
12145
|
+
for (_len2 = _args6.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
12146
|
+
args[_key2] = _args6[_key2];
|
|
11380
12147
|
}
|
|
11381
12148
|
type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4],
|
|
11382
12149
|
page = args[5], limit = args[6];
|
|
11383
|
-
return
|
|
12150
|
+
return _context6.abrupt("return", handleScanRequest({
|
|
11384
12151
|
scanKey: SERVICE_API_KEY.Basescan,
|
|
11385
12152
|
baseUrl: "https://api.basescan.org/api",
|
|
11386
12153
|
type: type,
|
|
@@ -11394,9 +12161,9 @@ function _typeof(o) {
|
|
|
11394
12161
|
|
|
11395
12162
|
case 3:
|
|
11396
12163
|
case "end":
|
|
11397
|
-
return
|
|
12164
|
+
return _context6.stop();
|
|
11398
12165
|
}
|
|
11399
|
-
}),
|
|
12166
|
+
}), _callee6);
|
|
11400
12167
|
})));
|
|
11401
12168
|
return _BASESCAN.apply(this, arguments);
|
|
11402
12169
|
}
|
|
@@ -11404,17 +12171,17 @@ function _typeof(o) {
|
|
|
11404
12171
|
return _GNOSISSCAN.apply(this, arguments);
|
|
11405
12172
|
}
|
|
11406
12173
|
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 (
|
|
12174
|
+
_GNOSISSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee7() {
|
|
12175
|
+
var _len3, args, _key3, type, chain, address, startDate, endDate, page, limit, _args7 = arguments;
|
|
12176
|
+
return _regeneratorRuntime().wrap((function _callee7$(_context7) {
|
|
12177
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
11411
12178
|
case 0:
|
|
11412
|
-
for (_len3 =
|
|
11413
|
-
args[_key3] =
|
|
12179
|
+
for (_len3 = _args7.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
12180
|
+
args[_key3] = _args7[_key3];
|
|
11414
12181
|
}
|
|
11415
12182
|
type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4],
|
|
11416
12183
|
page = args[5], limit = args[6];
|
|
11417
|
-
return
|
|
12184
|
+
return _context7.abrupt("return", handleScanRequest({
|
|
11418
12185
|
scanKey: SERVICE_API_KEY.Gnosisscan,
|
|
11419
12186
|
baseUrl: "https://api.gnosisscan.io/api",
|
|
11420
12187
|
type: type,
|
|
@@ -11428,27 +12195,27 @@ function _typeof(o) {
|
|
|
11428
12195
|
|
|
11429
12196
|
case 3:
|
|
11430
12197
|
case "end":
|
|
11431
|
-
return
|
|
12198
|
+
return _context7.stop();
|
|
11432
12199
|
}
|
|
11433
|
-
}),
|
|
12200
|
+
}), _callee7);
|
|
11434
12201
|
})));
|
|
11435
12202
|
return _GNOSISSCAN.apply(this, arguments);
|
|
11436
12203
|
}
|
|
11437
|
-
function NEYNAR(
|
|
12204
|
+
function NEYNAR(_x14, _x15, _x16, _x17, _x18) {
|
|
11438
12205
|
return _NEYNAR.apply(this, arguments);
|
|
11439
12206
|
}
|
|
11440
12207
|
function _NEYNAR() {
|
|
11441
|
-
_NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12208
|
+
_NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function _callee8(fid, viewerFid, sortType, limit, cursor) {
|
|
11442
12209
|
var API_KEY, url, _json$users, response, json;
|
|
11443
|
-
return _regeneratorRuntime().wrap((function
|
|
11444
|
-
while (1) switch (
|
|
12210
|
+
return _regeneratorRuntime().wrap((function _callee8$(_context8) {
|
|
12211
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
11445
12212
|
case 0:
|
|
11446
12213
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Neynar);
|
|
11447
12214
|
if (API_KEY) {
|
|
11448
|
-
|
|
12215
|
+
_context8.next = 3;
|
|
11449
12216
|
break;
|
|
11450
12217
|
}
|
|
11451
|
-
return
|
|
12218
|
+
return _context8.abrupt("return", "".concat(SERVICE_API_KEY.Neynar).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11452
12219
|
|
|
11453
12220
|
case 3:
|
|
11454
12221
|
url = new URL("https://api.neynar.com/v2/farcaster/followers");
|
|
@@ -11457,8 +12224,8 @@ function _typeof(o) {
|
|
|
11457
12224
|
url.searchParams.set("limit", limit.toString());
|
|
11458
12225
|
if (viewerFid !== null) url.searchParams.set("viewer_fid", viewerFid.toString());
|
|
11459
12226
|
if (cursor) url.searchParams.set("cursor", cursor);
|
|
11460
|
-
|
|
11461
|
-
|
|
12227
|
+
_context8.prev = 9;
|
|
12228
|
+
_context8.next = 12;
|
|
11462
12229
|
return fetch(url.toString(), {
|
|
11463
12230
|
headers: {
|
|
11464
12231
|
"x-api-key": API_KEY,
|
|
@@ -11467,27 +12234,27 @@ function _typeof(o) {
|
|
|
11467
12234
|
});
|
|
11468
12235
|
|
|
11469
12236
|
case 12:
|
|
11470
|
-
response =
|
|
12237
|
+
response = _context8.sent;
|
|
11471
12238
|
if (response.ok) {
|
|
11472
|
-
|
|
12239
|
+
_context8.next = 15;
|
|
11473
12240
|
break;
|
|
11474
12241
|
}
|
|
11475
12242
|
throw new Error("HTTP ".concat(response.status));
|
|
11476
12243
|
|
|
11477
12244
|
case 15:
|
|
11478
|
-
|
|
12245
|
+
_context8.next = 17;
|
|
11479
12246
|
return response.json();
|
|
11480
12247
|
|
|
11481
12248
|
case 17:
|
|
11482
|
-
json =
|
|
12249
|
+
json = _context8.sent;
|
|
11483
12250
|
if (json !== null && json !== void 0 && (_json$users = json.users) !== null && _json$users !== void 0 && _json$users.length) {
|
|
11484
|
-
|
|
12251
|
+
_context8.next = 20;
|
|
11485
12252
|
break;
|
|
11486
12253
|
}
|
|
11487
|
-
return
|
|
12254
|
+
return _context8.abrupt("return", []);
|
|
11488
12255
|
|
|
11489
12256
|
case 20:
|
|
11490
|
-
return
|
|
12257
|
+
return _context8.abrupt("return", json.users.map((function(_ref4) {
|
|
11491
12258
|
var _user$profile, _user$profile2;
|
|
11492
12259
|
var user = _ref4.user;
|
|
11493
12260
|
return {
|
|
@@ -11500,27 +12267,27 @@ function _typeof(o) {
|
|
|
11500
12267
|
})));
|
|
11501
12268
|
|
|
11502
12269
|
case 23:
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
console.error("NEYNAR_FETCH_FOLLOWERS error:",
|
|
11506
|
-
return
|
|
12270
|
+
_context8.prev = 23;
|
|
12271
|
+
_context8.t0 = _context8["catch"](9);
|
|
12272
|
+
console.error("NEYNAR_FETCH_FOLLOWERS error:", _context8.t0);
|
|
12273
|
+
return _context8.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11507
12274
|
|
|
11508
12275
|
case 27:
|
|
11509
12276
|
case "end":
|
|
11510
|
-
return
|
|
12277
|
+
return _context8.stop();
|
|
11511
12278
|
}
|
|
11512
|
-
}),
|
|
12279
|
+
}), _callee8, null, [ [ 9, 23 ] ]);
|
|
11513
12280
|
})));
|
|
11514
12281
|
return _NEYNAR.apply(this, arguments);
|
|
11515
12282
|
}
|
|
11516
|
-
function GNOSIS(
|
|
12283
|
+
function GNOSIS(_x19) {
|
|
11517
12284
|
return _GNOSIS.apply(this, arguments);
|
|
11518
12285
|
}
|
|
11519
12286
|
function _GNOSIS() {
|
|
11520
|
-
_GNOSIS = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12287
|
+
_GNOSIS = _asyncToGenerator(_regeneratorRuntime().mark((function _callee9(_ref3) {
|
|
11521
12288
|
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 (
|
|
12289
|
+
return _regeneratorRuntime().wrap((function _callee9$(_context9) {
|
|
12290
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
11524
12291
|
case 0:
|
|
11525
12292
|
cardId = _ref3.cardId, startDate = _ref3.startDate, endDate = _ref3.endDate, _ref3$limit = _ref3.limit,
|
|
11526
12293
|
limit = _ref3$limit === void 0 ? 20 : _ref3$limit, _ref3$offset = _ref3.offset,
|
|
@@ -11528,17 +12295,17 @@ function _typeof(o) {
|
|
|
11528
12295
|
apiKeyKey = SERVICE_API_KEY.GnosisPay;
|
|
11529
12296
|
API_KEY = window.localStorage.getItem(apiKeyKey);
|
|
11530
12297
|
if (API_KEY) {
|
|
11531
|
-
|
|
12298
|
+
_context9.next = 5;
|
|
11532
12299
|
break;
|
|
11533
12300
|
}
|
|
11534
|
-
return
|
|
12301
|
+
return _context9.abrupt("return", "".concat(apiKeyKey).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11535
12302
|
|
|
11536
12303
|
case 5:
|
|
11537
12304
|
if (cardId) {
|
|
11538
|
-
|
|
12305
|
+
_context9.next = 7;
|
|
11539
12306
|
break;
|
|
11540
12307
|
}
|
|
11541
|
-
return
|
|
12308
|
+
return _context9.abrupt("return", "".concat(apiKeyKey).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11542
12309
|
|
|
11543
12310
|
case 7:
|
|
11544
12311
|
url = new URL("https://api.gnosispay.com/cards/".concat(cardId, "/transactions"));
|
|
@@ -11550,8 +12317,8 @@ function _typeof(o) {
|
|
|
11550
12317
|
if (!isNaN(endDate)) {
|
|
11551
12318
|
url.searchParams.set("endDate", new Date(endDate * 1e3).toISOString());
|
|
11552
12319
|
}
|
|
11553
|
-
|
|
11554
|
-
|
|
12320
|
+
_context9.prev = 12;
|
|
12321
|
+
_context9.next = 15;
|
|
11555
12322
|
return fetch(url.toString(), {
|
|
11556
12323
|
headers: {
|
|
11557
12324
|
Authorization: "Bearer ".concat(API_KEY),
|
|
@@ -11560,27 +12327,27 @@ function _typeof(o) {
|
|
|
11560
12327
|
});
|
|
11561
12328
|
|
|
11562
12329
|
case 15:
|
|
11563
|
-
res =
|
|
12330
|
+
res = _context9.sent;
|
|
11564
12331
|
if (res.ok) {
|
|
11565
|
-
|
|
12332
|
+
_context9.next = 18;
|
|
11566
12333
|
break;
|
|
11567
12334
|
}
|
|
11568
12335
|
throw new Error("HTTP error! Status: ".concat(res.status));
|
|
11569
12336
|
|
|
11570
12337
|
case 18:
|
|
11571
|
-
|
|
12338
|
+
_context9.next = 20;
|
|
11572
12339
|
return res.json();
|
|
11573
12340
|
|
|
11574
12341
|
case 20:
|
|
11575
|
-
json =
|
|
12342
|
+
json = _context9.sent;
|
|
11576
12343
|
if (Array.isArray(json)) {
|
|
11577
|
-
|
|
12344
|
+
_context9.next = 23;
|
|
11578
12345
|
break;
|
|
11579
12346
|
}
|
|
11580
|
-
return
|
|
12347
|
+
return _context9.abrupt("return", []);
|
|
11581
12348
|
|
|
11582
12349
|
case 23:
|
|
11583
|
-
return
|
|
12350
|
+
return _context9.abrupt("return", json.map((function(tx) {
|
|
11584
12351
|
return {
|
|
11585
12352
|
createdAt: tx.createdAt,
|
|
11586
12353
|
clearedAt: tx.clearedAt,
|
|
@@ -11598,16 +12365,16 @@ function _typeof(o) {
|
|
|
11598
12365
|
})));
|
|
11599
12366
|
|
|
11600
12367
|
case 26:
|
|
11601
|
-
|
|
11602
|
-
|
|
11603
|
-
console.error("GNOSISPAY_CARD_TXNS error:",
|
|
11604
|
-
return
|
|
12368
|
+
_context9.prev = 26;
|
|
12369
|
+
_context9.t0 = _context9["catch"](12);
|
|
12370
|
+
console.error("GNOSISPAY_CARD_TXNS error:", _context9.t0);
|
|
12371
|
+
return _context9.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11605
12372
|
|
|
11606
12373
|
case 30:
|
|
11607
12374
|
case "end":
|
|
11608
|
-
return
|
|
12375
|
+
return _context9.stop();
|
|
11609
12376
|
}
|
|
11610
|
-
}),
|
|
12377
|
+
}), _callee9, null, [ [ 12, 26 ] ]);
|
|
11611
12378
|
})));
|
|
11612
12379
|
return _GNOSIS.apply(this, arguments);
|
|
11613
12380
|
}
|
|
@@ -11615,17 +12382,17 @@ function _typeof(o) {
|
|
|
11615
12382
|
return _ETHERSCAN.apply(this, arguments);
|
|
11616
12383
|
}
|
|
11617
12384
|
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 (
|
|
12385
|
+
_ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee0() {
|
|
12386
|
+
var _len4, args, _key4, type, chain, address, startDate, endDate, page, limit, _args0 = arguments;
|
|
12387
|
+
return _regeneratorRuntime().wrap((function _callee0$(_context0) {
|
|
12388
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
11622
12389
|
case 0:
|
|
11623
|
-
for (_len4 =
|
|
11624
|
-
args[_key4] =
|
|
12390
|
+
for (_len4 = _args0.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
12391
|
+
args[_key4] = _args0[_key4];
|
|
11625
12392
|
}
|
|
11626
12393
|
type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4],
|
|
11627
12394
|
page = args[5], limit = args[6];
|
|
11628
|
-
return
|
|
12395
|
+
return _context0.abrupt("return", handleScanRequest({
|
|
11629
12396
|
scanKey: SERVICE_API_KEY.Etherscan,
|
|
11630
12397
|
baseUrl: "https://api.etherscan.io/v2/api",
|
|
11631
12398
|
type: type,
|
|
@@ -11639,288 +12406,530 @@ function _typeof(o) {
|
|
|
11639
12406
|
|
|
11640
12407
|
case 3:
|
|
11641
12408
|
case "end":
|
|
11642
|
-
return
|
|
12409
|
+
return _context0.stop();
|
|
11643
12410
|
}
|
|
11644
|
-
}),
|
|
12411
|
+
}), _callee0);
|
|
11645
12412
|
})));
|
|
11646
12413
|
return _ETHERSCAN.apply(this, arguments);
|
|
11647
12414
|
}
|
|
11648
|
-
function COINGECKO(
|
|
12415
|
+
function COINGECKO(_x20, _x21, _x22) {
|
|
11649
12416
|
return _COINGECKO.apply(this, arguments);
|
|
11650
12417
|
}
|
|
11651
12418
|
function _COINGECKO() {
|
|
11652
|
-
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11653
|
-
var API_KEY, url,
|
|
11654
|
-
return _regeneratorRuntime().wrap((function
|
|
11655
|
-
while (1) switch (
|
|
12419
|
+
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function _callee1(category, param1, param2) {
|
|
12420
|
+
var page, perPage, API_KEY, headers, url, token, vsCurrencies, ecosystemMap, key, categoryVal, trend, _category, _trend, exchange, response, json, _json$status, message, output, _i10, _Object$entries, _Object$entries$_i, _token, prices, _i11, _Object$entries2, _Object$entries2$_i, currency, _value5, _key5, flatArray, _args1 = arguments;
|
|
12421
|
+
return _regeneratorRuntime().wrap((function _callee1$(_context1) {
|
|
12422
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
11656
12423
|
case 0:
|
|
12424
|
+
page = _args1.length > 3 && _args1[3] !== undefined ? _args1[3] : 1;
|
|
12425
|
+
perPage = _args1.length > 4 && _args1[4] !== undefined ? _args1[4] : 2;
|
|
11657
12426
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Coingecko);
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
12427
|
+
if (API_KEY) {
|
|
12428
|
+
_context1.next = 5;
|
|
12429
|
+
break;
|
|
12430
|
+
}
|
|
12431
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
12432
|
+
|
|
12433
|
+
case 5:
|
|
12434
|
+
headers = {
|
|
12435
|
+
accept: "application/json",
|
|
12436
|
+
"x-cg-demo-api-key": API_KEY
|
|
11665
12437
|
};
|
|
11666
|
-
|
|
11667
|
-
|
|
11668
|
-
|
|
12438
|
+
url = "";
|
|
12439
|
+
_context1.t0 = (category || "").toLowerCase();
|
|
12440
|
+
_context1.next = _context1.t0 === "price" ? 10 : _context1.t0 === "market" ? 16 : _context1.t0 === "stablecoins" ? 26 : _context1.t0 === "derivatives" ? 30 : 33;
|
|
12441
|
+
break;
|
|
11669
12442
|
|
|
11670
|
-
case
|
|
11671
|
-
|
|
11672
|
-
|
|
11673
|
-
|
|
12443
|
+
case 10:
|
|
12444
|
+
token = param1;
|
|
12445
|
+
vsCurrencies = param2;
|
|
12446
|
+
if (!(!token || !vsCurrencies)) {
|
|
12447
|
+
_context1.next = 14;
|
|
11674
12448
|
break;
|
|
11675
12449
|
}
|
|
11676
|
-
|
|
12450
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAMS));
|
|
12451
|
+
|
|
12452
|
+
case 14:
|
|
12453
|
+
url = "https://api.coingecko.com/api/v3/simple/price?vs_currencies=".concat(vsCurrencies, "&ids=").concat(token);
|
|
12454
|
+
return _context1.abrupt("break", 34);
|
|
12455
|
+
|
|
12456
|
+
case 16:
|
|
12457
|
+
ecosystemMap = {
|
|
12458
|
+
eth: "ethereum-ecosystem",
|
|
12459
|
+
base: "base-ecosystem",
|
|
12460
|
+
sol: "solana-ecosystem",
|
|
12461
|
+
gnosis: "gnosis-chain",
|
|
12462
|
+
hyperliquid: "hyperliquid",
|
|
12463
|
+
bitcoin: "bitcoin-ecosystem",
|
|
12464
|
+
pump: "pump-ecosystem"
|
|
12465
|
+
};
|
|
12466
|
+
key = param1 === null || param1 === void 0 ? void 0 : param1.toLowerCase();
|
|
12467
|
+
categoryVal = key ? ecosystemMap[key] : "";
|
|
12468
|
+
if (!(param1 && !categoryVal)) {
|
|
12469
|
+
_context1.next = 21;
|
|
12470
|
+
break;
|
|
12471
|
+
}
|
|
12472
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12473
|
+
|
|
12474
|
+
case 21:
|
|
12475
|
+
trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
12476
|
+
url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&include_tokens=top&page=".concat(page, "&per_page=").concat(perPage);
|
|
12477
|
+
if (categoryVal) url += "&category=".concat(categoryVal);
|
|
12478
|
+
if (trend) url += trend;
|
|
12479
|
+
return _context1.abrupt("break", 34);
|
|
12480
|
+
|
|
12481
|
+
case 26:
|
|
12482
|
+
_category = param1 === "all" || !param1 ? "stablecoins" : param1 === null || param1 === void 0 ? void 0 : param1.toLowerCase();
|
|
12483
|
+
_trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
12484
|
+
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);
|
|
12485
|
+
return _context1.abrupt("break", 34);
|
|
12486
|
+
|
|
12487
|
+
case 30:
|
|
12488
|
+
exchange = param1;
|
|
12489
|
+
if (exchange) {
|
|
12490
|
+
url = "https://api.coingecko.com/api/v3/derivatives/exchanges/".concat(exchange, "?include_tickers=all");
|
|
12491
|
+
} else {
|
|
12492
|
+
url = "https://api.coingecko.com/api/v3/derivatives?page=".concat(page, "&per_page=").concat(perPage);
|
|
12493
|
+
}
|
|
12494
|
+
return _context1.abrupt("break", 34);
|
|
12495
|
+
|
|
12496
|
+
case 33:
|
|
12497
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAMS));
|
|
12498
|
+
|
|
12499
|
+
case 34:
|
|
12500
|
+
_context1.prev = 34;
|
|
12501
|
+
_context1.next = 37;
|
|
12502
|
+
return fetch(url, {
|
|
12503
|
+
method: "GET",
|
|
12504
|
+
headers: headers
|
|
12505
|
+
});
|
|
12506
|
+
|
|
12507
|
+
case 37:
|
|
12508
|
+
response = _context1.sent;
|
|
12509
|
+
_context1.next = 40;
|
|
11677
12510
|
return response.json();
|
|
11678
12511
|
|
|
11679
|
-
case
|
|
11680
|
-
json =
|
|
11681
|
-
if (
|
|
11682
|
-
|
|
12512
|
+
case 40:
|
|
12513
|
+
json = _context1.sent;
|
|
12514
|
+
if (response.ok) {
|
|
12515
|
+
_context1.next = 47;
|
|
12516
|
+
break;
|
|
12517
|
+
}
|
|
12518
|
+
message = (json === null || json === void 0 || (_json$status = json.status) === null || _json$status === void 0 ? void 0 : _json$status.error_message) || "";
|
|
12519
|
+
if (!message.includes("API Key Missing")) {
|
|
12520
|
+
_context1.next = 45;
|
|
11683
12521
|
break;
|
|
11684
12522
|
}
|
|
11685
|
-
return
|
|
12523
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
11686
12524
|
|
|
11687
|
-
case
|
|
12525
|
+
case 45:
|
|
11688
12526
|
if (!(response.status === 429)) {
|
|
11689
|
-
|
|
12527
|
+
_context1.next = 47;
|
|
11690
12528
|
break;
|
|
11691
12529
|
}
|
|
11692
|
-
return
|
|
11693
|
-
|
|
11694
|
-
case 15:
|
|
11695
|
-
_context0.next = 17;
|
|
11696
|
-
return response.json();
|
|
12530
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
11697
12531
|
|
|
11698
|
-
case
|
|
11699
|
-
|
|
12532
|
+
case 47:
|
|
12533
|
+
if (!(category.toLowerCase() === "price")) {
|
|
12534
|
+
_context1.next = 51;
|
|
12535
|
+
break;
|
|
12536
|
+
}
|
|
11700
12537
|
output = {};
|
|
11701
|
-
for (_i10 = 0, _Object$entries = Object.entries(
|
|
11702
|
-
_Object$entries$_i = _slicedToArray(_Object$entries[_i10], 2),
|
|
12538
|
+
for (_i10 = 0, _Object$entries = Object.entries(json); _i10 < _Object$entries.length; _i10++) {
|
|
12539
|
+
_Object$entries$_i = _slicedToArray(_Object$entries[_i10], 2), _token = _Object$entries$_i[0],
|
|
11703
12540
|
prices = _Object$entries$_i[1];
|
|
11704
12541
|
for (_i11 = 0, _Object$entries2 = Object.entries(prices); _i11 < _Object$entries2.length; _i11++) {
|
|
11705
12542
|
_Object$entries2$_i = _slicedToArray(_Object$entries2[_i11], 2), currency = _Object$entries2$_i[0],
|
|
11706
12543
|
_value5 = _Object$entries2$_i[1];
|
|
11707
|
-
|
|
11708
|
-
output[
|
|
12544
|
+
_key5 = "".concat(_token.charAt(0).toUpperCase() + _token.slice(1), "_").concat(currency.toUpperCase());
|
|
12545
|
+
output[_key5] = _value5;
|
|
11709
12546
|
}
|
|
11710
12547
|
}
|
|
11711
|
-
return
|
|
12548
|
+
return _context1.abrupt("return", [ output ]);
|
|
12549
|
+
|
|
12550
|
+
case 51:
|
|
12551
|
+
flatArray = Array.isArray(json) ? json : [ json ];
|
|
12552
|
+
return _context1.abrupt("return", flatArray.map((function(item) {
|
|
12553
|
+
var flat = {};
|
|
12554
|
+
for (var _i12 = 0, _Object$entries3 = Object.entries(item); _i12 < _Object$entries3.length; _i12++) {
|
|
12555
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i12], 2), _key6 = _Object$entries3$_i[0], _value6 = _Object$entries3$_i[1];
|
|
12556
|
+
if (_typeof(_value6) !== "object" || _value6 === null) {
|
|
12557
|
+
flat[_key6] = _value6;
|
|
12558
|
+
}
|
|
12559
|
+
}
|
|
12560
|
+
return flat;
|
|
12561
|
+
})));
|
|
11712
12562
|
|
|
11713
|
-
case
|
|
11714
|
-
|
|
11715
|
-
|
|
11716
|
-
console.
|
|
11717
|
-
return
|
|
12563
|
+
case 55:
|
|
12564
|
+
_context1.prev = 55;
|
|
12565
|
+
_context1.t1 = _context1["catch"](34);
|
|
12566
|
+
console.error(_context1.t1);
|
|
12567
|
+
return _context1.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11718
12568
|
|
|
11719
|
-
case
|
|
12569
|
+
case 59:
|
|
11720
12570
|
case "end":
|
|
11721
|
-
return
|
|
12571
|
+
return _context1.stop();
|
|
11722
12572
|
}
|
|
11723
|
-
}),
|
|
12573
|
+
}), _callee1, null, [ [ 34, 55 ] ]);
|
|
11724
12574
|
})));
|
|
11725
12575
|
return _COINGECKO.apply(this, arguments);
|
|
11726
12576
|
}
|
|
11727
|
-
function EOA(
|
|
12577
|
+
function EOA(_x23, _x24, _x25, _x26, _x27) {
|
|
11728
12578
|
return _EOA.apply(this, arguments);
|
|
11729
12579
|
}
|
|
11730
12580
|
function _EOA() {
|
|
11731
|
-
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11732
|
-
var page, offset,
|
|
11733
|
-
return _regeneratorRuntime().wrap((function
|
|
11734
|
-
while (1) switch (
|
|
12581
|
+
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11(addresses, category, chains, startTime, endTime) {
|
|
12582
|
+
var page, offset, API_KEY, INPUTS, CHAINS, out, ADDRESS_MAP, _iterator, _step, input, resolved, ADDRS, _iterator2, _step2, _loop, _ret, fetchJSON, _fetchJSON, _args13 = arguments;
|
|
12583
|
+
return _regeneratorRuntime().wrap((function _callee11$(_context13) {
|
|
12584
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
11735
12585
|
case 0:
|
|
11736
|
-
|
|
11737
|
-
|
|
11738
|
-
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
12586
|
+
_fetchJSON = function _fetchJSON3() {
|
|
12587
|
+
_fetchJSON = _asyncToGenerator(_regeneratorRuntime().mark((function _callee10(url) {
|
|
12588
|
+
var _json$result3, _json$result3$include, _json$result4, _json$result4$include, res, json;
|
|
12589
|
+
return _regeneratorRuntime().wrap((function _callee10$(_context12) {
|
|
12590
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
12591
|
+
case 0:
|
|
12592
|
+
_context12.prev = 0;
|
|
12593
|
+
_context12.next = 3;
|
|
12594
|
+
return fetch(url);
|
|
12595
|
+
|
|
12596
|
+
case 3:
|
|
12597
|
+
res = _context12.sent;
|
|
12598
|
+
if (res.ok) {
|
|
12599
|
+
_context12.next = 6;
|
|
12600
|
+
break;
|
|
12601
|
+
}
|
|
12602
|
+
return _context12.abrupt("return", "HTTP_".concat(res.status));
|
|
12603
|
+
|
|
12604
|
+
case 6:
|
|
12605
|
+
_context12.next = 8;
|
|
12606
|
+
return res.json();
|
|
12607
|
+
|
|
12608
|
+
case 8:
|
|
12609
|
+
json = _context12.sent;
|
|
12610
|
+
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"))) {
|
|
12611
|
+
_context12.next = 11;
|
|
12612
|
+
break;
|
|
12613
|
+
}
|
|
12614
|
+
return _context12.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
12615
|
+
|
|
12616
|
+
case 11:
|
|
12617
|
+
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"))) {
|
|
12618
|
+
_context12.next = 13;
|
|
12619
|
+
break;
|
|
12620
|
+
}
|
|
12621
|
+
return _context12.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
12622
|
+
|
|
12623
|
+
case 13:
|
|
12624
|
+
if (!(json.status === "0" && json.message !== "No transactions found")) {
|
|
12625
|
+
_context12.next = 15;
|
|
12626
|
+
break;
|
|
12627
|
+
}
|
|
12628
|
+
return _context12.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12629
|
+
|
|
12630
|
+
case 15:
|
|
12631
|
+
return _context12.abrupt("return", json.result);
|
|
12632
|
+
|
|
12633
|
+
case 18:
|
|
12634
|
+
_context12.prev = 18;
|
|
12635
|
+
_context12.t0 = _context12["catch"](0);
|
|
12636
|
+
return _context12.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12637
|
+
|
|
12638
|
+
case 21:
|
|
12639
|
+
case "end":
|
|
12640
|
+
return _context12.stop();
|
|
12641
|
+
}
|
|
12642
|
+
}), _callee10, null, [ [ 0, 18 ] ]);
|
|
12643
|
+
})));
|
|
12644
|
+
return _fetchJSON.apply(this, arguments);
|
|
12645
|
+
};
|
|
12646
|
+
fetchJSON = function _fetchJSON2(_x35) {
|
|
12647
|
+
return _fetchJSON.apply(this, arguments);
|
|
12648
|
+
};
|
|
12649
|
+
page = _args13.length > 5 && _args13[5] !== undefined ? _args13[5] : 1;
|
|
12650
|
+
offset = _args13.length > 6 && _args13[6] !== undefined ? _args13[6] : 10;
|
|
11746
12651
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
|
|
11747
12652
|
if (API_KEY) {
|
|
11748
|
-
|
|
12653
|
+
_context13.next = 7;
|
|
11749
12654
|
break;
|
|
11750
12655
|
}
|
|
11751
|
-
return
|
|
12656
|
+
return _context13.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11752
12657
|
|
|
11753
|
-
case
|
|
11754
|
-
|
|
11755
|
-
|
|
12658
|
+
case 7:
|
|
12659
|
+
INPUTS = addresses.split(",").map((function(a) {
|
|
12660
|
+
return a.trim();
|
|
12661
|
+
})).filter(Boolean);
|
|
12662
|
+
CHAINS = chains.split(",").map((function(c) {
|
|
12663
|
+
return c.trim();
|
|
12664
|
+
})).filter(Boolean);
|
|
12665
|
+
out = [];
|
|
12666
|
+
ADDRESS_MAP = {};
|
|
12667
|
+
_iterator = _createForOfIteratorHelper(INPUTS);
|
|
12668
|
+
_context13.prev = 12;
|
|
11756
12669
|
_iterator.s();
|
|
11757
12670
|
|
|
11758
|
-
case
|
|
12671
|
+
case 14:
|
|
11759
12672
|
if ((_step = _iterator.n()).done) {
|
|
11760
|
-
|
|
12673
|
+
_context13.next = 32;
|
|
11761
12674
|
break;
|
|
11762
12675
|
}
|
|
11763
|
-
|
|
11764
|
-
|
|
11765
|
-
|
|
11766
|
-
_context1.next = 17;
|
|
12676
|
+
input = _step.value;
|
|
12677
|
+
if (!/^0x[a-fA-F0-9]{40}$/.test(input)) {
|
|
12678
|
+
_context13.next = 20;
|
|
11767
12679
|
break;
|
|
11768
12680
|
}
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
|
|
11772
|
-
_iterator2 = _createForOfIteratorHelper(ADDRESSES);
|
|
11773
|
-
_context1.prev = 18;
|
|
11774
|
-
_iterator2.s();
|
|
12681
|
+
ADDRESS_MAP[input.toLowerCase()] = null;
|
|
12682
|
+
_context13.next = 30;
|
|
12683
|
+
break;
|
|
11775
12684
|
|
|
11776
12685
|
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);
|
|
12686
|
+
_context13.prev = 20;
|
|
12687
|
+
_context13.next = 23;
|
|
12688
|
+
return toEnsName(input);
|
|
12689
|
+
|
|
12690
|
+
case 23:
|
|
12691
|
+
resolved = _context13.sent;
|
|
12692
|
+
if (resolved) ADDRESS_MAP[resolved.toLowerCase()] = input;
|
|
12693
|
+
_context13.next = 30;
|
|
12694
|
+
break;
|
|
11790
12695
|
|
|
11791
12696
|
case 27:
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
return
|
|
12697
|
+
_context13.prev = 27;
|
|
12698
|
+
_context13.t0 = _context13["catch"](20);
|
|
12699
|
+
return _context13.abrupt("return", "".concat(input).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11795
12700
|
|
|
11796
12701
|
case 30:
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
12702
|
+
_context13.next = 14;
|
|
12703
|
+
break;
|
|
12704
|
+
|
|
12705
|
+
case 32:
|
|
12706
|
+
_context13.next = 37;
|
|
11800
12707
|
break;
|
|
11801
12708
|
|
|
11802
12709
|
case 34:
|
|
11803
|
-
|
|
12710
|
+
_context13.prev = 34;
|
|
12711
|
+
_context13.t1 = _context13["catch"](12);
|
|
12712
|
+
_iterator.e(_context13.t1);
|
|
11804
12713
|
|
|
11805
|
-
case
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
12714
|
+
case 37:
|
|
12715
|
+
_context13.prev = 37;
|
|
12716
|
+
_iterator.f();
|
|
12717
|
+
return _context13.finish(37);
|
|
12718
|
+
|
|
12719
|
+
case 40:
|
|
12720
|
+
ADDRS = Object.keys(ADDRESS_MAP);
|
|
12721
|
+
_iterator2 = _createForOfIteratorHelper(CHAINS);
|
|
12722
|
+
_context13.prev = 42;
|
|
12723
|
+
_loop = _regeneratorRuntime().mark((function _loop() {
|
|
12724
|
+
var chain, chainId, i, slice, action, url, _data, startBlock, endBlock, _loop2, _ret2, _i13, _ADDRS;
|
|
12725
|
+
return _regeneratorRuntime().wrap((function _loop$(_context11) {
|
|
12726
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
12727
|
+
case 0:
|
|
12728
|
+
chain = _step2.value;
|
|
12729
|
+
chainId = CHAIN_ID_MAP[chain];
|
|
12730
|
+
if (chainId) {
|
|
12731
|
+
_context11.next = 4;
|
|
12732
|
+
break;
|
|
12733
|
+
}
|
|
12734
|
+
return _context11.abrupt("return", {
|
|
12735
|
+
v: ERROR_MESSAGES_FLAG.UNSUPPORTED_CHAIN
|
|
12736
|
+
});
|
|
11810
12737
|
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
|
|
11816
|
-
|
|
11817
|
-
return _context1.abrupt("return", "HTTP_".concat(response.status));
|
|
12738
|
+
case 4:
|
|
12739
|
+
if (!(category === "balance")) {
|
|
12740
|
+
_context11.next = 20;
|
|
12741
|
+
break;
|
|
12742
|
+
}
|
|
12743
|
+
i = 0;
|
|
11818
12744
|
|
|
11819
|
-
|
|
11820
|
-
|
|
11821
|
-
|
|
12745
|
+
case 6:
|
|
12746
|
+
if (!(i < ADDRS.length)) {
|
|
12747
|
+
_context11.next = 19;
|
|
12748
|
+
break;
|
|
12749
|
+
}
|
|
12750
|
+
slice = ADDRS.slice(i, i + 20).join(",");
|
|
12751
|
+
action = ADDRS.length > 1 ? "balancemulti" : "balance";
|
|
12752
|
+
url = "https://api.etherscan.io/v2/api?chainid=".concat(chainId) + "&module=account&action=".concat(action, "&address=").concat(slice) + "&tag=latest&apikey=".concat(API_KEY);
|
|
12753
|
+
_context11.next = 12;
|
|
12754
|
+
return fetchJSON(url);
|
|
12755
|
+
|
|
12756
|
+
case 12:
|
|
12757
|
+
_data = _context11.sent;
|
|
12758
|
+
if (!(typeof _data === "string")) {
|
|
12759
|
+
_context11.next = 15;
|
|
12760
|
+
break;
|
|
12761
|
+
}
|
|
12762
|
+
return _context11.abrupt("return", {
|
|
12763
|
+
v: _data
|
|
12764
|
+
});
|
|
11822
12765
|
|
|
11823
|
-
|
|
11824
|
-
|
|
11825
|
-
|
|
11826
|
-
|
|
12766
|
+
case 15:
|
|
12767
|
+
(Array.isArray(_data) ? _data : [ _data ]).forEach((function(r) {
|
|
12768
|
+
return out.push(_objectSpread(_objectSpread({
|
|
12769
|
+
chain: chain
|
|
12770
|
+
}, r), {}, {
|
|
12771
|
+
name: ADDRESS_MAP[(r.account || r.address || "").toLowerCase()] || null
|
|
12772
|
+
}));
|
|
12773
|
+
}));
|
|
12774
|
+
|
|
12775
|
+
case 16:
|
|
12776
|
+
i += 20;
|
|
12777
|
+
_context11.next = 6;
|
|
12778
|
+
break;
|
|
12779
|
+
|
|
12780
|
+
case 19:
|
|
12781
|
+
return _context11.abrupt("return", 0);
|
|
12782
|
+
|
|
12783
|
+
case 20:
|
|
12784
|
+
if (!(category === "txns")) {
|
|
12785
|
+
_context11.next = 38;
|
|
12786
|
+
break;
|
|
12787
|
+
}
|
|
12788
|
+
_context11.next = 23;
|
|
12789
|
+
return fromTimeStampToBlock(toTimestamp(startTime), chain, API_KEY);
|
|
12790
|
+
|
|
12791
|
+
case 23:
|
|
12792
|
+
startBlock = _context11.sent;
|
|
12793
|
+
_context11.next = 26;
|
|
12794
|
+
return fromTimeStampToBlock(toTimestamp(endTime), chain, API_KEY);
|
|
12795
|
+
|
|
12796
|
+
case 26:
|
|
12797
|
+
endBlock = _context11.sent;
|
|
12798
|
+
_loop2 = _regeneratorRuntime().mark((function _loop2() {
|
|
12799
|
+
var addr, url, data;
|
|
12800
|
+
return _regeneratorRuntime().wrap((function _loop2$(_context10) {
|
|
12801
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
12802
|
+
case 0:
|
|
12803
|
+
addr = _ADDRS[_i13];
|
|
12804
|
+
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);
|
|
12805
|
+
_context10.next = 4;
|
|
12806
|
+
return fetchJSON(url);
|
|
12807
|
+
|
|
12808
|
+
case 4:
|
|
12809
|
+
data = _context10.sent;
|
|
12810
|
+
if (!(typeof data === "string")) {
|
|
12811
|
+
_context10.next = 7;
|
|
12812
|
+
break;
|
|
12813
|
+
}
|
|
12814
|
+
return _context10.abrupt("return", {
|
|
12815
|
+
v: {
|
|
12816
|
+
v: data
|
|
12817
|
+
}
|
|
12818
|
+
});
|
|
12819
|
+
|
|
12820
|
+
case 7:
|
|
12821
|
+
data.forEach((function(tx) {
|
|
12822
|
+
return out.push(_objectSpread({
|
|
12823
|
+
chain: chain,
|
|
12824
|
+
address: addr,
|
|
12825
|
+
name: ADDRESS_MAP[addr]
|
|
12826
|
+
}, tx));
|
|
12827
|
+
}));
|
|
12828
|
+
|
|
12829
|
+
case 8:
|
|
12830
|
+
case "end":
|
|
12831
|
+
return _context10.stop();
|
|
12832
|
+
}
|
|
12833
|
+
}), _loop2);
|
|
12834
|
+
}));
|
|
12835
|
+
_i13 = 0, _ADDRS = ADDRS;
|
|
12836
|
+
|
|
12837
|
+
case 29:
|
|
12838
|
+
if (!(_i13 < _ADDRS.length)) {
|
|
12839
|
+
_context11.next = 37;
|
|
12840
|
+
break;
|
|
12841
|
+
}
|
|
12842
|
+
return _context11.delegateYield(_loop2(), "t0", 31);
|
|
12843
|
+
|
|
12844
|
+
case 31:
|
|
12845
|
+
_ret2 = _context11.t0;
|
|
12846
|
+
if (!_ret2) {
|
|
12847
|
+
_context11.next = 34;
|
|
12848
|
+
break;
|
|
12849
|
+
}
|
|
12850
|
+
return _context11.abrupt("return", _ret2.v);
|
|
12851
|
+
|
|
12852
|
+
case 34:
|
|
12853
|
+
_i13++;
|
|
12854
|
+
_context11.next = 29;
|
|
12855
|
+
break;
|
|
12856
|
+
|
|
12857
|
+
case 37:
|
|
12858
|
+
return _context11.abrupt("return", 0);
|
|
12859
|
+
|
|
12860
|
+
case 38:
|
|
12861
|
+
return _context11.abrupt("return", {
|
|
12862
|
+
v: ERROR_MESSAGES_FLAG.INVALID_CATEGORY
|
|
12863
|
+
});
|
|
12864
|
+
|
|
12865
|
+
case 39:
|
|
12866
|
+
case "end":
|
|
12867
|
+
return _context11.stop();
|
|
12868
|
+
}
|
|
12869
|
+
}), _loop);
|
|
12870
|
+
}));
|
|
12871
|
+
_iterator2.s();
|
|
12872
|
+
|
|
12873
|
+
case 45:
|
|
12874
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
12875
|
+
_context13.next = 54;
|
|
11827
12876
|
break;
|
|
11828
12877
|
}
|
|
11829
|
-
return
|
|
12878
|
+
return _context13.delegateYield(_loop(), "t2", 47);
|
|
11830
12879
|
|
|
11831
12880
|
case 47:
|
|
11832
|
-
|
|
11833
|
-
|
|
12881
|
+
_ret = _context13.t2;
|
|
12882
|
+
if (!(_ret === 0)) {
|
|
12883
|
+
_context13.next = 50;
|
|
11834
12884
|
break;
|
|
11835
12885
|
}
|
|
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;
|
|
12886
|
+
return _context13.abrupt("continue", 52);
|
|
11856
12887
|
|
|
11857
|
-
case
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
12888
|
+
case 50:
|
|
12889
|
+
if (!_ret) {
|
|
12890
|
+
_context13.next = 52;
|
|
12891
|
+
break;
|
|
12892
|
+
}
|
|
12893
|
+
return _context13.abrupt("return", _ret.v);
|
|
11861
12894
|
|
|
11862
|
-
case
|
|
11863
|
-
|
|
12895
|
+
case 52:
|
|
12896
|
+
_context13.next = 45;
|
|
11864
12897
|
break;
|
|
11865
12898
|
|
|
11866
|
-
case
|
|
11867
|
-
|
|
12899
|
+
case 54:
|
|
12900
|
+
_context13.next = 59;
|
|
11868
12901
|
break;
|
|
11869
12902
|
|
|
11870
|
-
case
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
_iterator2.e(
|
|
12903
|
+
case 56:
|
|
12904
|
+
_context13.prev = 56;
|
|
12905
|
+
_context13.t3 = _context13["catch"](42);
|
|
12906
|
+
_iterator2.e(_context13.t3);
|
|
11874
12907
|
|
|
11875
|
-
case
|
|
11876
|
-
|
|
12908
|
+
case 59:
|
|
12909
|
+
_context13.prev = 59;
|
|
11877
12910
|
_iterator2.f();
|
|
11878
|
-
return
|
|
11879
|
-
|
|
11880
|
-
case 67:
|
|
11881
|
-
_context1.next = 12;
|
|
11882
|
-
break;
|
|
11883
|
-
|
|
11884
|
-
case 69:
|
|
11885
|
-
_context1.next = 74;
|
|
11886
|
-
break;
|
|
12911
|
+
return _context13.finish(59);
|
|
11887
12912
|
|
|
11888
|
-
case
|
|
11889
|
-
|
|
11890
|
-
_context1.t2 = _context1["catch"](10);
|
|
11891
|
-
_iterator.e(_context1.t2);
|
|
12913
|
+
case 62:
|
|
12914
|
+
return _context13.abrupt("return", out);
|
|
11892
12915
|
|
|
11893
|
-
case
|
|
11894
|
-
_context1.prev = 74;
|
|
11895
|
-
_iterator.f();
|
|
11896
|
-
return _context1.finish(74);
|
|
11897
|
-
|
|
11898
|
-
case 77:
|
|
11899
|
-
return _context1.abrupt("return", flatResults);
|
|
11900
|
-
|
|
11901
|
-
case 80:
|
|
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:
|
|
12916
|
+
case 63:
|
|
11908
12917
|
case "end":
|
|
11909
|
-
return
|
|
12918
|
+
return _context13.stop();
|
|
11910
12919
|
}
|
|
11911
|
-
}),
|
|
12920
|
+
}), _callee11, null, [ [ 12, 34, 37, 40 ], [ 20, 27 ], [ 42, 56, 59, 62 ] ]);
|
|
11912
12921
|
})));
|
|
11913
12922
|
return _EOA.apply(this, arguments);
|
|
11914
12923
|
}
|
|
11915
|
-
function FLVURL(
|
|
12924
|
+
function FLVURL(_x28, _x29) {
|
|
11916
12925
|
return _FLVURL.apply(this, arguments);
|
|
11917
12926
|
}
|
|
11918
12927
|
function _FLVURL() {
|
|
11919
|
-
_FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11920
|
-
return _regeneratorRuntime().wrap((function
|
|
11921
|
-
while (1) switch (
|
|
12928
|
+
_FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee12(token, vs_currencies) {
|
|
12929
|
+
return _regeneratorRuntime().wrap((function _callee12$(_context14) {
|
|
12930
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
11922
12931
|
case 0:
|
|
11923
|
-
return
|
|
12932
|
+
return _context14.abrupt("return", new Promise((function(resolve) {
|
|
11924
12933
|
setTimeout((function() {
|
|
11925
12934
|
resolve([ {
|
|
11926
12935
|
Yoo: "gotcha"
|
|
@@ -11930,61 +12939,61 @@ function _typeof(o) {
|
|
|
11930
12939
|
|
|
11931
12940
|
case 1:
|
|
11932
12941
|
case "end":
|
|
11933
|
-
return
|
|
12942
|
+
return _context14.stop();
|
|
11934
12943
|
}
|
|
11935
|
-
}),
|
|
12944
|
+
}), _callee12);
|
|
11936
12945
|
})));
|
|
11937
12946
|
return _FLVURL.apply(this, arguments);
|
|
11938
12947
|
}
|
|
11939
|
-
function SAFE(
|
|
12948
|
+
function SAFE(_x30, _x31, _x32, _x33, _x34) {
|
|
11940
12949
|
return _SAFE.apply(this, arguments);
|
|
11941
12950
|
}
|
|
11942
12951
|
function _SAFE() {
|
|
11943
|
-
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12952
|
+
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee13(address, utility, chain, limit, offset) {
|
|
11944
12953
|
var apiKey, chainIdentifier, url, response, json;
|
|
11945
|
-
return _regeneratorRuntime().wrap((function
|
|
11946
|
-
while (1) switch (
|
|
12954
|
+
return _regeneratorRuntime().wrap((function _callee13$(_context15) {
|
|
12955
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
11947
12956
|
case 0:
|
|
11948
12957
|
if (!(typeof limit !== "number" || limit < 0)) {
|
|
11949
|
-
|
|
12958
|
+
_context15.next = 2;
|
|
11950
12959
|
break;
|
|
11951
12960
|
}
|
|
11952
|
-
return
|
|
12961
|
+
return _context15.abrupt("return", "INVALID_LIMIT");
|
|
11953
12962
|
|
|
11954
12963
|
case 2:
|
|
11955
12964
|
if (!(typeof offset !== "number" || offset < 0)) {
|
|
11956
|
-
|
|
12965
|
+
_context15.next = 4;
|
|
11957
12966
|
break;
|
|
11958
12967
|
}
|
|
11959
|
-
return
|
|
12968
|
+
return _context15.abrupt("return", "INVALID_OFFSET");
|
|
11960
12969
|
|
|
11961
12970
|
case 4:
|
|
11962
12971
|
if (!(utility !== "txns")) {
|
|
11963
|
-
|
|
12972
|
+
_context15.next = 6;
|
|
11964
12973
|
break;
|
|
11965
12974
|
}
|
|
11966
|
-
return
|
|
12975
|
+
return _context15.abrupt("return", "UTILITY IS NOT SUPPORTED");
|
|
11967
12976
|
|
|
11968
12977
|
case 6:
|
|
11969
12978
|
apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
|
|
11970
12979
|
chainIdentifier = SAFE_CHAIN_MAP[chain];
|
|
11971
12980
|
if (apiKey) {
|
|
11972
|
-
|
|
12981
|
+
_context15.next = 10;
|
|
11973
12982
|
break;
|
|
11974
12983
|
}
|
|
11975
|
-
return
|
|
12984
|
+
return _context15.abrupt("return", "".concat(SERVICE_API_KEY.Safe, "_MISSING"));
|
|
11976
12985
|
|
|
11977
12986
|
case 10:
|
|
11978
12987
|
if (chainIdentifier) {
|
|
11979
|
-
|
|
12988
|
+
_context15.next = 12;
|
|
11980
12989
|
break;
|
|
11981
12990
|
}
|
|
11982
|
-
return
|
|
12991
|
+
return _context15.abrupt("return", "CHAIN IS NOT SUPPORTED");
|
|
11983
12992
|
|
|
11984
12993
|
case 12:
|
|
11985
12994
|
url = "https://api.safe.global/tx-service/".concat(chainIdentifier, "/api/v2/safes/").concat(address, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
|
|
11986
|
-
|
|
11987
|
-
|
|
12995
|
+
_context15.prev = 13;
|
|
12996
|
+
_context15.next = 16;
|
|
11988
12997
|
return fetch(url, {
|
|
11989
12998
|
headers: {
|
|
11990
12999
|
Authorization: "Bearer ".concat(apiKey)
|
|
@@ -11992,42 +13001,42 @@ function _typeof(o) {
|
|
|
11992
13001
|
});
|
|
11993
13002
|
|
|
11994
13003
|
case 16:
|
|
11995
|
-
response =
|
|
13004
|
+
response = _context15.sent;
|
|
11996
13005
|
if (response.ok) {
|
|
11997
|
-
|
|
13006
|
+
_context15.next = 19;
|
|
11998
13007
|
break;
|
|
11999
13008
|
}
|
|
12000
13009
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
12001
13010
|
|
|
12002
13011
|
case 19:
|
|
12003
|
-
|
|
13012
|
+
_context15.next = 21;
|
|
12004
13013
|
return response.json();
|
|
12005
13014
|
|
|
12006
13015
|
case 21:
|
|
12007
|
-
json =
|
|
13016
|
+
json = _context15.sent;
|
|
12008
13017
|
if (Array.isArray(json.results)) {
|
|
12009
|
-
|
|
13018
|
+
_context15.next = 24;
|
|
12010
13019
|
break;
|
|
12011
13020
|
}
|
|
12012
|
-
return
|
|
13021
|
+
return _context15.abrupt("return", "INVALID API RESPONSE");
|
|
12013
13022
|
|
|
12014
13023
|
case 24:
|
|
12015
|
-
return
|
|
13024
|
+
return _context15.abrupt("return", json.results.map((function(_ref5) {
|
|
12016
13025
|
var confirmations = _ref5.confirmations, dataDecoded = _ref5.dataDecoded, rest = _objectWithoutProperties(_ref5, _excluded);
|
|
12017
13026
|
return rest;
|
|
12018
13027
|
})));
|
|
12019
13028
|
|
|
12020
13029
|
case 27:
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
console.log(
|
|
12024
|
-
return
|
|
13030
|
+
_context15.prev = 27;
|
|
13031
|
+
_context15.t0 = _context15["catch"](13);
|
|
13032
|
+
console.log(_context15.t0);
|
|
13033
|
+
return _context15.abrupt("return", "ERROR IN FETCHING");
|
|
12025
13034
|
|
|
12026
13035
|
case 31:
|
|
12027
13036
|
case "end":
|
|
12028
|
-
return
|
|
13037
|
+
return _context15.stop();
|
|
12029
13038
|
}
|
|
12030
|
-
}),
|
|
13039
|
+
}), _callee13, null, [ [ 13, 27 ] ]);
|
|
12031
13040
|
})));
|
|
12032
13041
|
return _SAFE.apply(this, arguments);
|
|
12033
13042
|
}
|