@fileverse-dev/fortune-react 1.0.2-mod-81 → 1.0.2-mod-82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -37073,6 +37073,10 @@
37073
37073
  INVALID_PARAM: '_INVALID_PARAM'
37074
37074
  };
37075
37075
 
37076
+ const UTILITY = {
37077
+ ALCHEMY_API_KEY: 'ALCHEMY_API_KEY'
37078
+ };
37079
+
37076
37080
  const SERVICE_API_KEY = {
37077
37081
  Etherscan: "ETHERSCAN_API_KEY",
37078
37082
  Coingecko: "COINGECKO_API_KEY",
@@ -37100,6 +37104,37 @@
37100
37104
  return Math.floor(date.getTime() / 1000); // Unix timestamp in seconds
37101
37105
  }
37102
37106
 
37107
+ const isAddress = (input) => {
37108
+ return (/^0x[a-fA-F0-9]{40}$/.test(input))
37109
+ };
37110
+
37111
+ async function fromEnsNameToAddress(name) {
37112
+ if (typeof ethers === "undefined") {
37113
+ await new Promise((resolve, reject) => {
37114
+ const script = document.createElement("script");
37115
+ script.src = "https://cdn.jsdelivr.net/npm/ethers@6.10.0/dist/ethers.umd.min.js";
37116
+ script.onload = resolve;
37117
+ script.onerror = reject;
37118
+ document.head.appendChild(script);
37119
+ });
37120
+ }
37121
+
37122
+ const ALCHEMY_KEY = window.localStorage.getItem(UTILITY.ALCHEMY_API_KEY);
37123
+ if(!ALCHEMY_KEY){
37124
+ console.error("alchemy api key missing");
37125
+ return null
37126
+ }
37127
+ const provider = new ethers.AlchemyProvider("mainnet", ALCHEMY_KEY);
37128
+
37129
+ try {
37130
+ const resolved = await provider.resolveName(name); // ENS ➝ address
37131
+ return resolved || null;
37132
+ } catch (err) {
37133
+ console.error("ENS resolution failed:", err.message);
37134
+ return null;
37135
+ }
37136
+ }
37137
+
37103
37138
  async function handleScanRequest({
37104
37139
  scanKey,
37105
37140
  baseUrl,
@@ -37118,6 +37153,14 @@
37118
37153
  let chainId = CHAIN_ID_MAP[chain?.toLowerCase()];
37119
37154
  if (!chainId) return `${scanKey}${ERROR_MESSAGES_FLAG.INVALID_CHAIN}`;
37120
37155
 
37156
+ if(!isAddress(address)){
37157
+ address = await fromEnsNameToAddress(address);
37158
+ }
37159
+
37160
+ if(!address){
37161
+ return `${address}${ERROR_MESSAGES_FLAG.INVALID_PARAM}`
37162
+ }
37163
+
37121
37164
  const ACTION_MAP = {
37122
37165
  'all-txns': 'txlist',
37123
37166
  'token-txns': 'tokentx',
@@ -37165,767 +37208,6 @@
37165
37208
  }
37166
37209
  }
37167
37210
 
37168
- var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
37169
-
37170
- var sha3 = {exports: {}};
37171
-
37172
- /**
37173
- * [js-sha3]{@link https://github.com/emn178/js-sha3}
37174
- *
37175
- * @version 0.9.3
37176
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
37177
- * @copyright Chen, Yi-Cyuan 2015-2023
37178
- * @license MIT
37179
- */
37180
-
37181
- var hasRequiredSha3;
37182
-
37183
- function requireSha3 () {
37184
- if (hasRequiredSha3) return sha3.exports;
37185
- hasRequiredSha3 = 1;
37186
- (function (module) {
37187
- /*jslint bitwise: true */
37188
- (function () {
37189
-
37190
- var INPUT_ERROR = 'input is invalid type';
37191
- var FINALIZE_ERROR = 'finalize already called';
37192
- var WINDOW = typeof window === 'object';
37193
- var root = WINDOW ? window : {};
37194
- if (root.JS_SHA3_NO_WINDOW) {
37195
- WINDOW = false;
37196
- }
37197
- var WEB_WORKER = !WINDOW && typeof self === 'object';
37198
- var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
37199
- if (NODE_JS) {
37200
- root = commonjsGlobal$1;
37201
- } else if (WEB_WORKER) {
37202
- root = self;
37203
- }
37204
- var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports;
37205
- var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
37206
- var HEX_CHARS = '0123456789abcdef'.split('');
37207
- var SHAKE_PADDING = [31, 7936, 2031616, 520093696];
37208
- var CSHAKE_PADDING = [4, 1024, 262144, 67108864];
37209
- var KECCAK_PADDING = [1, 256, 65536, 16777216];
37210
- var PADDING = [6, 1536, 393216, 100663296];
37211
- var SHIFT = [0, 8, 16, 24];
37212
- var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,
37213
- 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,
37214
- 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,
37215
- 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,
37216
- 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];
37217
- var BITS = [224, 256, 384, 512];
37218
- var SHAKE_BITS = [128, 256];
37219
- var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest'];
37220
- var CSHAKE_BYTEPAD = {
37221
- '128': 168,
37222
- '256': 136
37223
- };
37224
-
37225
-
37226
- var isArray = root.JS_SHA3_NO_NODE_JS || !Array.isArray
37227
- ? function (obj) {
37228
- return Object.prototype.toString.call(obj) === '[object Array]';
37229
- }
37230
- : Array.isArray;
37231
-
37232
- var isView = (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView))
37233
- ? function (obj) {
37234
- return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;
37235
- }
37236
- : ArrayBuffer.isView;
37237
-
37238
- // [message: string, isString: bool]
37239
- var formatMessage = function (message) {
37240
- var type = typeof message;
37241
- if (type === 'string') {
37242
- return [message, true];
37243
- }
37244
- if (type !== 'object' || message === null) {
37245
- throw new Error(INPUT_ERROR);
37246
- }
37247
- if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
37248
- return [new Uint8Array(message), false];
37249
- }
37250
- if (!isArray(message) && !isView(message)) {
37251
- throw new Error(INPUT_ERROR);
37252
- }
37253
- return [message, false];
37254
- };
37255
-
37256
- var empty = function (message) {
37257
- return formatMessage(message)[0].length === 0;
37258
- };
37259
-
37260
- var cloneArray = function (array) {
37261
- var newArray = [];
37262
- for (var i = 0; i < array.length; ++i) {
37263
- newArray[i] = array[i];
37264
- }
37265
- return newArray;
37266
- };
37267
-
37268
- var createOutputMethod = function (bits, padding, outputType) {
37269
- return function (message) {
37270
- return new Keccak(bits, padding, bits).update(message)[outputType]();
37271
- };
37272
- };
37273
-
37274
- var createShakeOutputMethod = function (bits, padding, outputType) {
37275
- return function (message, outputBits) {
37276
- return new Keccak(bits, padding, outputBits).update(message)[outputType]();
37277
- };
37278
- };
37279
-
37280
- var createCshakeOutputMethod = function (bits, padding, outputType) {
37281
- return function (message, outputBits, n, s) {
37282
- return methods['cshake' + bits].update(message, outputBits, n, s)[outputType]();
37283
- };
37284
- };
37285
-
37286
- var createKmacOutputMethod = function (bits, padding, outputType) {
37287
- return function (key, message, outputBits, s) {
37288
- return methods['kmac' + bits].update(key, message, outputBits, s)[outputType]();
37289
- };
37290
- };
37291
-
37292
- var createOutputMethods = function (method, createMethod, bits, padding) {
37293
- for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
37294
- var type = OUTPUT_TYPES[i];
37295
- method[type] = createMethod(bits, padding, type);
37296
- }
37297
- return method;
37298
- };
37299
-
37300
- var createMethod = function (bits, padding) {
37301
- var method = createOutputMethod(bits, padding, 'hex');
37302
- method.create = function () {
37303
- return new Keccak(bits, padding, bits);
37304
- };
37305
- method.update = function (message) {
37306
- return method.create().update(message);
37307
- };
37308
- return createOutputMethods(method, createOutputMethod, bits, padding);
37309
- };
37310
-
37311
- var createShakeMethod = function (bits, padding) {
37312
- var method = createShakeOutputMethod(bits, padding, 'hex');
37313
- method.create = function (outputBits) {
37314
- return new Keccak(bits, padding, outputBits);
37315
- };
37316
- method.update = function (message, outputBits) {
37317
- return method.create(outputBits).update(message);
37318
- };
37319
- return createOutputMethods(method, createShakeOutputMethod, bits, padding);
37320
- };
37321
-
37322
- var createCshakeMethod = function (bits, padding) {
37323
- var w = CSHAKE_BYTEPAD[bits];
37324
- var method = createCshakeOutputMethod(bits, padding, 'hex');
37325
- method.create = function (outputBits, n, s) {
37326
- if (empty(n) && empty(s)) {
37327
- return methods['shake' + bits].create(outputBits);
37328
- } else {
37329
- return new Keccak(bits, padding, outputBits).bytepad([n, s], w);
37330
- }
37331
- };
37332
- method.update = function (message, outputBits, n, s) {
37333
- return method.create(outputBits, n, s).update(message);
37334
- };
37335
- return createOutputMethods(method, createCshakeOutputMethod, bits, padding);
37336
- };
37337
-
37338
- var createKmacMethod = function (bits, padding) {
37339
- var w = CSHAKE_BYTEPAD[bits];
37340
- var method = createKmacOutputMethod(bits, padding, 'hex');
37341
- method.create = function (key, outputBits, s) {
37342
- return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w);
37343
- };
37344
- method.update = function (key, message, outputBits, s) {
37345
- return method.create(key, outputBits, s).update(message);
37346
- };
37347
- return createOutputMethods(method, createKmacOutputMethod, bits, padding);
37348
- };
37349
-
37350
- var algorithms = [
37351
- { name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod },
37352
- { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod },
37353
- { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod },
37354
- { name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod },
37355
- { name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod }
37356
- ];
37357
-
37358
- var methods = {}, methodNames = [];
37359
-
37360
- for (var i = 0; i < algorithms.length; ++i) {
37361
- var algorithm = algorithms[i];
37362
- var bits = algorithm.bits;
37363
- for (var j = 0; j < bits.length; ++j) {
37364
- var methodName = algorithm.name + '_' + bits[j];
37365
- methodNames.push(methodName);
37366
- methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);
37367
- if (algorithm.name !== 'sha3') {
37368
- var newMethodName = algorithm.name + bits[j];
37369
- methodNames.push(newMethodName);
37370
- methods[newMethodName] = methods[methodName];
37371
- }
37372
- }
37373
- }
37374
-
37375
- function Keccak(bits, padding, outputBits) {
37376
- this.blocks = [];
37377
- this.s = [];
37378
- this.padding = padding;
37379
- this.outputBits = outputBits;
37380
- this.reset = true;
37381
- this.finalized = false;
37382
- this.block = 0;
37383
- this.start = 0;
37384
- this.blockCount = (1600 - (bits << 1)) >> 5;
37385
- this.byteCount = this.blockCount << 2;
37386
- this.outputBlocks = outputBits >> 5;
37387
- this.extraBytes = (outputBits & 31) >> 3;
37388
-
37389
- for (var i = 0; i < 50; ++i) {
37390
- this.s[i] = 0;
37391
- }
37392
- }
37393
-
37394
- Keccak.prototype.update = function (message) {
37395
- if (this.finalized) {
37396
- throw new Error(FINALIZE_ERROR);
37397
- }
37398
- var result = formatMessage(message);
37399
- message = result[0];
37400
- var isString = result[1];
37401
- var blocks = this.blocks, byteCount = this.byteCount, length = message.length,
37402
- blockCount = this.blockCount, index = 0, s = this.s, i, code;
37403
-
37404
- while (index < length) {
37405
- if (this.reset) {
37406
- this.reset = false;
37407
- blocks[0] = this.block;
37408
- for (i = 1; i < blockCount + 1; ++i) {
37409
- blocks[i] = 0;
37410
- }
37411
- }
37412
- if (isString) {
37413
- for (i = this.start; index < length && i < byteCount; ++index) {
37414
- code = message.charCodeAt(index);
37415
- if (code < 0x80) {
37416
- blocks[i >> 2] |= code << SHIFT[i++ & 3];
37417
- } else if (code < 0x800) {
37418
- blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];
37419
- blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
37420
- } else if (code < 0xd800 || code >= 0xe000) {
37421
- blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];
37422
- blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
37423
- blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
37424
- } else {
37425
- code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
37426
- blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];
37427
- blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];
37428
- blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
37429
- blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
37430
- }
37431
- }
37432
- } else {
37433
- for (i = this.start; index < length && i < byteCount; ++index) {
37434
- blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
37435
- }
37436
- }
37437
- this.lastByteIndex = i;
37438
- if (i >= byteCount) {
37439
- this.start = i - byteCount;
37440
- this.block = blocks[blockCount];
37441
- for (i = 0; i < blockCount; ++i) {
37442
- s[i] ^= blocks[i];
37443
- }
37444
- f(s);
37445
- this.reset = true;
37446
- } else {
37447
- this.start = i;
37448
- }
37449
- }
37450
- return this;
37451
- };
37452
-
37453
- Keccak.prototype.encode = function (x, right) {
37454
- var o = x & 255, n = 1;
37455
- var bytes = [o];
37456
- x = x >> 8;
37457
- o = x & 255;
37458
- while (o > 0) {
37459
- bytes.unshift(o);
37460
- x = x >> 8;
37461
- o = x & 255;
37462
- ++n;
37463
- }
37464
- if (right) {
37465
- bytes.push(n);
37466
- } else {
37467
- bytes.unshift(n);
37468
- }
37469
- this.update(bytes);
37470
- return bytes.length;
37471
- };
37472
-
37473
- Keccak.prototype.encodeString = function (str) {
37474
- var result = formatMessage(str);
37475
- str = result[0];
37476
- var isString = result[1];
37477
- var bytes = 0, length = str.length;
37478
- if (isString) {
37479
- for (var i = 0; i < str.length; ++i) {
37480
- var code = str.charCodeAt(i);
37481
- if (code < 0x80) {
37482
- bytes += 1;
37483
- } else if (code < 0x800) {
37484
- bytes += 2;
37485
- } else if (code < 0xd800 || code >= 0xe000) {
37486
- bytes += 3;
37487
- } else {
37488
- code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));
37489
- bytes += 4;
37490
- }
37491
- }
37492
- } else {
37493
- bytes = length;
37494
- }
37495
- bytes += this.encode(bytes * 8);
37496
- this.update(str);
37497
- return bytes;
37498
- };
37499
-
37500
- Keccak.prototype.bytepad = function (strs, w) {
37501
- var bytes = this.encode(w);
37502
- for (var i = 0; i < strs.length; ++i) {
37503
- bytes += this.encodeString(strs[i]);
37504
- }
37505
- var paddingBytes = (w - bytes % w) % w;
37506
- var zeros = [];
37507
- zeros.length = paddingBytes;
37508
- this.update(zeros);
37509
- return this;
37510
- };
37511
-
37512
- Keccak.prototype.finalize = function () {
37513
- if (this.finalized) {
37514
- return;
37515
- }
37516
- this.finalized = true;
37517
- var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;
37518
- blocks[i >> 2] |= this.padding[i & 3];
37519
- if (this.lastByteIndex === this.byteCount) {
37520
- blocks[0] = blocks[blockCount];
37521
- for (i = 1; i < blockCount + 1; ++i) {
37522
- blocks[i] = 0;
37523
- }
37524
- }
37525
- blocks[blockCount - 1] |= 0x80000000;
37526
- for (i = 0; i < blockCount; ++i) {
37527
- s[i] ^= blocks[i];
37528
- }
37529
- f(s);
37530
- };
37531
-
37532
- Keccak.prototype.toString = Keccak.prototype.hex = function () {
37533
- this.finalize();
37534
-
37535
- var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
37536
- extraBytes = this.extraBytes, i = 0, j = 0;
37537
- var hex = '', block;
37538
- while (j < outputBlocks) {
37539
- for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
37540
- block = s[i];
37541
- hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +
37542
- HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +
37543
- HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +
37544
- HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];
37545
- }
37546
- if (j % blockCount === 0) {
37547
- s = cloneArray(s);
37548
- f(s);
37549
- i = 0;
37550
- }
37551
- }
37552
- if (extraBytes) {
37553
- block = s[i];
37554
- hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];
37555
- if (extraBytes > 1) {
37556
- hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];
37557
- }
37558
- if (extraBytes > 2) {
37559
- hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];
37560
- }
37561
- }
37562
- return hex;
37563
- };
37564
-
37565
- Keccak.prototype.arrayBuffer = function () {
37566
- this.finalize();
37567
-
37568
- var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
37569
- extraBytes = this.extraBytes, i = 0, j = 0;
37570
- var bytes = this.outputBits >> 3;
37571
- var buffer;
37572
- if (extraBytes) {
37573
- buffer = new ArrayBuffer((outputBlocks + 1) << 2);
37574
- } else {
37575
- buffer = new ArrayBuffer(bytes);
37576
- }
37577
- var array = new Uint32Array(buffer);
37578
- while (j < outputBlocks) {
37579
- for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
37580
- array[j] = s[i];
37581
- }
37582
- if (j % blockCount === 0) {
37583
- s = cloneArray(s);
37584
- f(s);
37585
- }
37586
- }
37587
- if (extraBytes) {
37588
- array[j] = s[i];
37589
- buffer = buffer.slice(0, bytes);
37590
- }
37591
- return buffer;
37592
- };
37593
-
37594
- Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;
37595
-
37596
- Keccak.prototype.digest = Keccak.prototype.array = function () {
37597
- this.finalize();
37598
-
37599
- var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
37600
- extraBytes = this.extraBytes, i = 0, j = 0;
37601
- var array = [], offset, block;
37602
- while (j < outputBlocks) {
37603
- for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
37604
- offset = j << 2;
37605
- block = s[i];
37606
- array[offset] = block & 0xFF;
37607
- array[offset + 1] = (block >> 8) & 0xFF;
37608
- array[offset + 2] = (block >> 16) & 0xFF;
37609
- array[offset + 3] = (block >> 24) & 0xFF;
37610
- }
37611
- if (j % blockCount === 0) {
37612
- s = cloneArray(s);
37613
- f(s);
37614
- }
37615
- }
37616
- if (extraBytes) {
37617
- offset = j << 2;
37618
- block = s[i];
37619
- array[offset] = block & 0xFF;
37620
- if (extraBytes > 1) {
37621
- array[offset + 1] = (block >> 8) & 0xFF;
37622
- }
37623
- if (extraBytes > 2) {
37624
- array[offset + 2] = (block >> 16) & 0xFF;
37625
- }
37626
- }
37627
- return array;
37628
- };
37629
-
37630
- function Kmac(bits, padding, outputBits) {
37631
- Keccak.call(this, bits, padding, outputBits);
37632
- }
37633
-
37634
- Kmac.prototype = new Keccak();
37635
-
37636
- Kmac.prototype.finalize = function () {
37637
- this.encode(this.outputBits, true);
37638
- return Keccak.prototype.finalize.call(this);
37639
- };
37640
-
37641
- var f = function (s) {
37642
- var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,
37643
- b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,
37644
- b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,
37645
- b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;
37646
- for (n = 0; n < 48; n += 2) {
37647
- c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];
37648
- c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];
37649
- c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];
37650
- c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];
37651
- c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];
37652
- c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];
37653
- c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];
37654
- c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];
37655
- c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];
37656
- c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];
37657
-
37658
- h = c8 ^ ((c2 << 1) | (c3 >>> 31));
37659
- l = c9 ^ ((c3 << 1) | (c2 >>> 31));
37660
- s[0] ^= h;
37661
- s[1] ^= l;
37662
- s[10] ^= h;
37663
- s[11] ^= l;
37664
- s[20] ^= h;
37665
- s[21] ^= l;
37666
- s[30] ^= h;
37667
- s[31] ^= l;
37668
- s[40] ^= h;
37669
- s[41] ^= l;
37670
- h = c0 ^ ((c4 << 1) | (c5 >>> 31));
37671
- l = c1 ^ ((c5 << 1) | (c4 >>> 31));
37672
- s[2] ^= h;
37673
- s[3] ^= l;
37674
- s[12] ^= h;
37675
- s[13] ^= l;
37676
- s[22] ^= h;
37677
- s[23] ^= l;
37678
- s[32] ^= h;
37679
- s[33] ^= l;
37680
- s[42] ^= h;
37681
- s[43] ^= l;
37682
- h = c2 ^ ((c6 << 1) | (c7 >>> 31));
37683
- l = c3 ^ ((c7 << 1) | (c6 >>> 31));
37684
- s[4] ^= h;
37685
- s[5] ^= l;
37686
- s[14] ^= h;
37687
- s[15] ^= l;
37688
- s[24] ^= h;
37689
- s[25] ^= l;
37690
- s[34] ^= h;
37691
- s[35] ^= l;
37692
- s[44] ^= h;
37693
- s[45] ^= l;
37694
- h = c4 ^ ((c8 << 1) | (c9 >>> 31));
37695
- l = c5 ^ ((c9 << 1) | (c8 >>> 31));
37696
- s[6] ^= h;
37697
- s[7] ^= l;
37698
- s[16] ^= h;
37699
- s[17] ^= l;
37700
- s[26] ^= h;
37701
- s[27] ^= l;
37702
- s[36] ^= h;
37703
- s[37] ^= l;
37704
- s[46] ^= h;
37705
- s[47] ^= l;
37706
- h = c6 ^ ((c0 << 1) | (c1 >>> 31));
37707
- l = c7 ^ ((c1 << 1) | (c0 >>> 31));
37708
- s[8] ^= h;
37709
- s[9] ^= l;
37710
- s[18] ^= h;
37711
- s[19] ^= l;
37712
- s[28] ^= h;
37713
- s[29] ^= l;
37714
- s[38] ^= h;
37715
- s[39] ^= l;
37716
- s[48] ^= h;
37717
- s[49] ^= l;
37718
-
37719
- b0 = s[0];
37720
- b1 = s[1];
37721
- b32 = (s[11] << 4) | (s[10] >>> 28);
37722
- b33 = (s[10] << 4) | (s[11] >>> 28);
37723
- b14 = (s[20] << 3) | (s[21] >>> 29);
37724
- b15 = (s[21] << 3) | (s[20] >>> 29);
37725
- b46 = (s[31] << 9) | (s[30] >>> 23);
37726
- b47 = (s[30] << 9) | (s[31] >>> 23);
37727
- b28 = (s[40] << 18) | (s[41] >>> 14);
37728
- b29 = (s[41] << 18) | (s[40] >>> 14);
37729
- b20 = (s[2] << 1) | (s[3] >>> 31);
37730
- b21 = (s[3] << 1) | (s[2] >>> 31);
37731
- b2 = (s[13] << 12) | (s[12] >>> 20);
37732
- b3 = (s[12] << 12) | (s[13] >>> 20);
37733
- b34 = (s[22] << 10) | (s[23] >>> 22);
37734
- b35 = (s[23] << 10) | (s[22] >>> 22);
37735
- b16 = (s[33] << 13) | (s[32] >>> 19);
37736
- b17 = (s[32] << 13) | (s[33] >>> 19);
37737
- b48 = (s[42] << 2) | (s[43] >>> 30);
37738
- b49 = (s[43] << 2) | (s[42] >>> 30);
37739
- b40 = (s[5] << 30) | (s[4] >>> 2);
37740
- b41 = (s[4] << 30) | (s[5] >>> 2);
37741
- b22 = (s[14] << 6) | (s[15] >>> 26);
37742
- b23 = (s[15] << 6) | (s[14] >>> 26);
37743
- b4 = (s[25] << 11) | (s[24] >>> 21);
37744
- b5 = (s[24] << 11) | (s[25] >>> 21);
37745
- b36 = (s[34] << 15) | (s[35] >>> 17);
37746
- b37 = (s[35] << 15) | (s[34] >>> 17);
37747
- b18 = (s[45] << 29) | (s[44] >>> 3);
37748
- b19 = (s[44] << 29) | (s[45] >>> 3);
37749
- b10 = (s[6] << 28) | (s[7] >>> 4);
37750
- b11 = (s[7] << 28) | (s[6] >>> 4);
37751
- b42 = (s[17] << 23) | (s[16] >>> 9);
37752
- b43 = (s[16] << 23) | (s[17] >>> 9);
37753
- b24 = (s[26] << 25) | (s[27] >>> 7);
37754
- b25 = (s[27] << 25) | (s[26] >>> 7);
37755
- b6 = (s[36] << 21) | (s[37] >>> 11);
37756
- b7 = (s[37] << 21) | (s[36] >>> 11);
37757
- b38 = (s[47] << 24) | (s[46] >>> 8);
37758
- b39 = (s[46] << 24) | (s[47] >>> 8);
37759
- b30 = (s[8] << 27) | (s[9] >>> 5);
37760
- b31 = (s[9] << 27) | (s[8] >>> 5);
37761
- b12 = (s[18] << 20) | (s[19] >>> 12);
37762
- b13 = (s[19] << 20) | (s[18] >>> 12);
37763
- b44 = (s[29] << 7) | (s[28] >>> 25);
37764
- b45 = (s[28] << 7) | (s[29] >>> 25);
37765
- b26 = (s[38] << 8) | (s[39] >>> 24);
37766
- b27 = (s[39] << 8) | (s[38] >>> 24);
37767
- b8 = (s[48] << 14) | (s[49] >>> 18);
37768
- b9 = (s[49] << 14) | (s[48] >>> 18);
37769
-
37770
- s[0] = b0 ^ (~b2 & b4);
37771
- s[1] = b1 ^ (~b3 & b5);
37772
- s[10] = b10 ^ (~b12 & b14);
37773
- s[11] = b11 ^ (~b13 & b15);
37774
- s[20] = b20 ^ (~b22 & b24);
37775
- s[21] = b21 ^ (~b23 & b25);
37776
- s[30] = b30 ^ (~b32 & b34);
37777
- s[31] = b31 ^ (~b33 & b35);
37778
- s[40] = b40 ^ (~b42 & b44);
37779
- s[41] = b41 ^ (~b43 & b45);
37780
- s[2] = b2 ^ (~b4 & b6);
37781
- s[3] = b3 ^ (~b5 & b7);
37782
- s[12] = b12 ^ (~b14 & b16);
37783
- s[13] = b13 ^ (~b15 & b17);
37784
- s[22] = b22 ^ (~b24 & b26);
37785
- s[23] = b23 ^ (~b25 & b27);
37786
- s[32] = b32 ^ (~b34 & b36);
37787
- s[33] = b33 ^ (~b35 & b37);
37788
- s[42] = b42 ^ (~b44 & b46);
37789
- s[43] = b43 ^ (~b45 & b47);
37790
- s[4] = b4 ^ (~b6 & b8);
37791
- s[5] = b5 ^ (~b7 & b9);
37792
- s[14] = b14 ^ (~b16 & b18);
37793
- s[15] = b15 ^ (~b17 & b19);
37794
- s[24] = b24 ^ (~b26 & b28);
37795
- s[25] = b25 ^ (~b27 & b29);
37796
- s[34] = b34 ^ (~b36 & b38);
37797
- s[35] = b35 ^ (~b37 & b39);
37798
- s[44] = b44 ^ (~b46 & b48);
37799
- s[45] = b45 ^ (~b47 & b49);
37800
- s[6] = b6 ^ (~b8 & b0);
37801
- s[7] = b7 ^ (~b9 & b1);
37802
- s[16] = b16 ^ (~b18 & b10);
37803
- s[17] = b17 ^ (~b19 & b11);
37804
- s[26] = b26 ^ (~b28 & b20);
37805
- s[27] = b27 ^ (~b29 & b21);
37806
- s[36] = b36 ^ (~b38 & b30);
37807
- s[37] = b37 ^ (~b39 & b31);
37808
- s[46] = b46 ^ (~b48 & b40);
37809
- s[47] = b47 ^ (~b49 & b41);
37810
- s[8] = b8 ^ (~b0 & b2);
37811
- s[9] = b9 ^ (~b1 & b3);
37812
- s[18] = b18 ^ (~b10 & b12);
37813
- s[19] = b19 ^ (~b11 & b13);
37814
- s[28] = b28 ^ (~b20 & b22);
37815
- s[29] = b29 ^ (~b21 & b23);
37816
- s[38] = b38 ^ (~b30 & b32);
37817
- s[39] = b39 ^ (~b31 & b33);
37818
- s[48] = b48 ^ (~b40 & b42);
37819
- s[49] = b49 ^ (~b41 & b43);
37820
-
37821
- s[0] ^= RC[n];
37822
- s[1] ^= RC[n + 1];
37823
- }
37824
- };
37825
-
37826
- if (COMMON_JS) {
37827
- module.exports = methods;
37828
- } else {
37829
- for (i = 0; i < methodNames.length; ++i) {
37830
- root[methodNames[i]] = methods[methodNames[i]];
37831
- }
37832
- }
37833
- })();
37834
- } (sha3));
37835
- return sha3.exports;
37836
- }
37837
-
37838
- var sha3Exports = requireSha3();
37839
-
37840
- async function toEnsName(address) {
37841
- const reverseName = address.toLowerCase().replace(/^0x/, "") + ".addr.reverse";
37842
- const node = namehash(reverseName);
37843
- const endpoint = "https://cloudflare-eth.com";
37844
-
37845
- // Step 1: Get resolver address from ENS registry
37846
- const resolverRes = await fetch(endpoint, {
37847
- method: "POST",
37848
- headers: { "Content-Type": "application/json" },
37849
- body: JSON.stringify({
37850
- jsonrpc: "2.0",
37851
- id: 1,
37852
- method: "eth_call",
37853
- params: [
37854
- {
37855
- to: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
37856
- data: "0x0178b8bf" + node.slice(2).padStart(64, "0")
37857
- },
37858
- "latest"
37859
- ]
37860
- })
37861
- });
37862
-
37863
- const { result: resolverHex } = await resolverRes.json();
37864
- const resolverAddress = "0x" + resolverHex.slice(-40);
37865
- if (!/^0x[0-9a-f]{40}$/i.test(resolverAddress)) return null;
37866
-
37867
- // Step 2: Call resolver.name(node)
37868
- const nameRes = await fetch(endpoint, {
37869
- method: "POST",
37870
- headers: { "Content-Type": "application/json" },
37871
- body: JSON.stringify({
37872
- jsonrpc: "2.0",
37873
- id: 2,
37874
- method: "eth_call",
37875
- params: [
37876
- {
37877
- to: resolverAddress,
37878
- data: "0x691f3431" + node.slice(2)
37879
- },
37880
- "latest"
37881
- ]
37882
- })
37883
- });
37884
-
37885
- const { result: nameHex } = await nameRes.json();
37886
- if (!nameHex || nameHex === "0x") return null;
37887
-
37888
- // Decode hex ENS name
37889
- const hex = nameHex.slice(2);
37890
- let name = "";
37891
- for (let i = 0; i < hex.length; i += 2) {
37892
- const code = parseInt(hex.slice(i, i + 2), 16);
37893
- if (code === 0) break;
37894
- name += String.fromCharCode(code);
37895
- }
37896
-
37897
- return name || null;
37898
- }
37899
-
37900
- // ENS Namehash using js-sha3
37901
- function namehash(name) {
37902
- let node = "0000000000000000000000000000000000000000000000000000000000000000";
37903
- if (name) {
37904
- const labels = name.toLowerCase().split(".");
37905
- for (let i = labels.length - 1; i >= 0; i--) {
37906
- const labelSha = sha3Exports.sha3_256.array(labels[i]);
37907
- const combined = node + bytesToHex(labelSha);
37908
- node = sha3Exports.sha3_256.array(hexToBytes(combined));
37909
- node = bytesToHex(node);
37910
- }
37911
- }
37912
- return "0x" + node;
37913
- }
37914
-
37915
- // Helpers
37916
- function hexToBytes(hex) {
37917
- hex = hex.replace(/^0x/, "");
37918
- const bytes = new Uint8Array(hex.length / 2);
37919
- for (let i = 0; i < bytes.length; i++) {
37920
- bytes[i] = parseInt(hex.substr(i * 2, 2), 16);
37921
- }
37922
- return bytes;
37923
- }
37924
-
37925
- function bytesToHex(bytes) {
37926
- return Array.from(bytes).map(b => b.toString(16).padStart(2, "0")).join("");
37927
- }
37928
-
37929
37211
  async function FIREFLY(platform, contentType, identifier, start = 0, end = 10) {
37930
37212
  const API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
37931
37213
  if (!API_KEY) return `${SERVICE_API_KEY.Firefly}${ERROR_MESSAGES_FLAG.MISSING_KEY}`;
@@ -38012,7 +37294,13 @@
38012
37294
  endTimestamp = toTimestamp(endTimestamp);
38013
37295
  }
38014
37296
 
37297
+ if(!isAddress(address)){
37298
+ address = await fromEnsNameToAddress(address);
37299
+ }
38015
37300
 
37301
+ if(!address){
37302
+ return `${address}${ERROR_MESSAGES_FLAG.INVALID_PARAM}`
37303
+ }
38016
37304
 
38017
37305
  const hostname = BLOCKSCOUT_CHAINS_MAP[chain];
38018
37306
 
@@ -38224,12 +37512,15 @@
38224
37512
  };
38225
37513
 
38226
37514
  let url = '';
37515
+ const lowerCategory = (category || '').toLowerCase();
38227
37516
 
38228
- switch ((category || '').toLowerCase()) {
37517
+ switch (lowerCategory) {
38229
37518
  case 'price': {
38230
37519
  const token = param1;
38231
37520
  const vsCurrencies = param2;
38232
- if (!token || !vsCurrencies) return `${SERVICE_API_KEY.Coingecko}${ERROR_MESSAGES_FLAG.INVALID_PARAMS}`;
37521
+ if (!token || !vsCurrencies) {
37522
+ return `${SERVICE_API_KEY.Coingecko}${ERROR_MESSAGES_FLAG.INVALID_PARAM}`;
37523
+ }
38233
37524
  url = `https://api.coingecko.com/api/v3/simple/price?vs_currencies=${vsCurrencies}&ids=${token}`;
38234
37525
  break;
38235
37526
  }
@@ -38243,29 +37534,28 @@
38243
37534
  hyperliquid: 'hyperliquid',
38244
37535
  bitcoin: 'bitcoin-ecosystem',
38245
37536
  pump: 'pump-ecosystem',
37537
+ aiagents: 'ai-agents',
37538
+ meme: 'meme-token',
38246
37539
  };
38247
37540
 
38248
37541
  const key = param1?.toLowerCase();
38249
- const categoryVal = key ? ecosystemMap[key] : '';
38250
-
38251
- if (param1 && !categoryVal) {
38252
- return `${SERVICE_API_KEY.Coingecko}${ERROR_MESSAGES_FLAG.INVALID_PARAM}`;
38253
- }
38254
-
37542
+ const categoryVal = ecosystemMap[key] || '';
38255
37543
  const trend = param2 ? `&price_change_percentage=${param2}` : '';
37544
+
38256
37545
  url = `https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&include_tokens=top&page=${page}&per_page=${perPage}`;
37546
+ if (key && !categoryVal) return `${SERVICE_API_KEY.Coingecko}${ERROR_MESSAGES_FLAG.INVALID_PARAM}`;
38257
37547
  if (categoryVal) url += `&category=${categoryVal}`;
38258
37548
  if (trend) url += trend;
38259
37549
  break;
38260
37550
  }
38261
37551
 
38262
37552
  case 'stablecoins': {
38263
- const category = param1 === 'all' || !param1
37553
+ const category = !param1 || param1.toLowerCase() === 'all'
38264
37554
  ? 'stablecoins'
38265
- : param1?.toLowerCase();
38266
- const trend = param2 ? `&price_change_percentage=${param2}` : '';
37555
+ : param1.toLowerCase();
38267
37556
 
38268
- url = `https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&category=${category}&page=${page}&per_page=${perPage}${trend}`;
37557
+ const trend = param2 ? `&price_change_percentage=${param2}` : '';
37558
+ url = `https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&category=${category}&order=market_cap_desc&page=${page}&per_page=${perPage}${trend}`;
38269
37559
  break;
38270
37560
  }
38271
37561
 
@@ -38297,7 +37587,7 @@
38297
37587
  }
38298
37588
  }
38299
37589
 
38300
- if (category.toLowerCase() === 'price') {
37590
+ if (lowerCategory === 'price') {
38301
37591
  const output = {};
38302
37592
  for (const [token, prices] of Object.entries(json)) {
38303
37593
  for (const [currency, value] of Object.entries(prices)) {
@@ -38347,11 +37637,11 @@
38347
37637
  const ADDRESS_MAP = {};
38348
37638
 
38349
37639
  for (const input of INPUTS) {
38350
- if (/^0x[a-fA-F0-9]{40}$/.test(input)) {
37640
+ if (isAddress(input)) {
38351
37641
  ADDRESS_MAP[input.toLowerCase()] = null; // it's a direct address
38352
37642
  } else {
38353
37643
  try {
38354
- const resolved = await toEnsName(input); // ENS -> address
37644
+ const resolved = await fromEnsNameToAddress(input); // ENS -> address
38355
37645
  if (resolved) ADDRESS_MAP[resolved.toLowerCase()] = input;
38356
37646
  } catch {
38357
37647
  return `${input}${ERROR_MESSAGES_FLAG.INVALID_PARAM}`;
@@ -38443,12 +37733,6 @@
38443
37733
  }
38444
37734
  }
38445
37735
 
38446
-
38447
-
38448
-
38449
-
38450
-
38451
-
38452
37736
  async function FLVURL(token, vs_currencies) {
38453
37737
  return new Promise((resolve) => {
38454
37738
  setTimeout(() => {