@indexing/jiti 0.0.52 → 0.0.53

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/main.js CHANGED
@@ -1,18 +1,14 @@
1
- var $8zHUo$tronweb = require("tronweb");
1
+ var $8zHUo$viem = require("viem");
2
2
  var $8zHUo$buffer = require("buffer");
3
+ var $8zHUo$tronweb = require("tronweb");
3
4
  var $8zHUo$cosmjsprotosigning = require("@cosmjs/proto-signing");
4
5
  var $8zHUo$cosmjsstargate = require("@cosmjs/stargate");
5
- var $8zHUo$viem = require("viem");
6
6
 
7
7
 
8
8
  function $parcel$export(e, n, v, s) {
9
9
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
10
10
  }
11
11
 
12
- function $parcel$interopDefault(a) {
13
- return a && a.__esModule ? a.default : a;
14
- }
15
-
16
12
  function $parcel$exportWildcard(dest, source) {
17
13
  Object.keys(source).forEach(function(key) {
18
14
  if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {
@@ -30,12 +26,18 @@ function $parcel$exportWildcard(dest, source) {
30
26
  return dest;
31
27
  }
32
28
 
29
+ function $parcel$interopDefault(a) {
30
+ return a && a.__esModule ? a.default : a;
31
+ }
32
+
33
+ $parcel$export(module.exports, "utils", () => $882b6d93070905b3$export$eab97d15b1788b8d);
33
34
  $parcel$export(module.exports, "templates", () => $882b6d93070905b3$export$a8fc3402335b0b04);
34
35
  $parcel$export(module.exports, "getAllTemplates", () => $882b6d93070905b3$export$cceb5167b935aafb);
35
36
  $parcel$export(module.exports, "getTemplateByKey", () => $882b6d93070905b3$export$a07bfd14bbc36e4b);
36
- $parcel$export(module.exports, "utils", () => $d7167569386d0d4c$exports);
37
- $parcel$export(module.exports, "types", () => $faefaad95e5fcca0$exports);
37
+ var $d7167569386d0d4c$exports = {};
38
+ var $b8691f253b6baa6e$exports = {};
38
39
 
40
+ $parcel$export($b8691f253b6baa6e$exports, "blockToTimestamp", () => $b8691f253b6baa6e$export$ec64f6024312bb14);
39
41
  var $6bd2ca253e883278$exports = {};
40
42
 
41
43
  $parcel$export($6bd2ca253e883278$exports, "blockToVM", () => $6bd2ca253e883278$export$ae001c77434c5340);
@@ -87,7 +89,8 @@ const $6bd2ca253e883278$var$PARTIAL_VM_TO_NETWORK_MAP = {
87
89
  "BITCOIN",
88
90
  "BITCOIN_TESTNET",
89
91
  "DOGECOIN",
90
- "LITECOIN"
92
+ "LITECOIN",
93
+ "ZCASH"
91
94
  ]
92
95
  };
93
96
  const $6bd2ca253e883278$var$PARTIAL_NETWORK_TO_VM_MAP = Object.entries($6bd2ca253e883278$var$PARTIAL_VM_TO_NETWORK_MAP).map(([vm, networks])=>networks.map((n)=>({
@@ -106,6 +109,357 @@ function $6bd2ca253e883278$export$ae001c77434c5340(block) {
106
109
  }
107
110
 
108
111
 
112
+ function $b8691f253b6baa6e$export$ec64f6024312bb14(block) {
113
+ const vm = (0, $6bd2ca253e883278$export$ae001c77434c5340)(block);
114
+ switch(vm){
115
+ case "APTOS":
116
+ return new Date(parseInt(block.transactions[0].timestamp, 10) / 1000);
117
+ case "CARDANO":
118
+ return new Date(block.timestamp * 1000);
119
+ case "COSMOS":
120
+ return new Date(block.block.header.time);
121
+ case "EVM":
122
+ return new Date(block.timestamp * 1000);
123
+ case "FILECOIN":
124
+ return new Date(block.Blocks[0].Timestamp * 1000);
125
+ case "RIPPLE":
126
+ return new Date(block.close_time_iso);
127
+ case "STARKNET":
128
+ return new Date(block.timestamp * 1000);
129
+ case "STELLAR":
130
+ return new Date(block.transactions[0].created_at);
131
+ case "SUBSTRATE":
132
+ {
133
+ const timestampExtrinsic = block.extrinsics.find((ex)=>ex.method === "timestamp.set");
134
+ return new Date(Number(timestampExtrinsic.args[0].toString().replace(/,/g, "")));
135
+ }
136
+ case "SUI":
137
+ return new Date(parseInt(block.timestamp, 10));
138
+ case "SVM":
139
+ return new Date(block.blockTime * 1000);
140
+ case "TON":
141
+ return new Date(block.shards?.[0]?.gen_utime * 1000);
142
+ case "UTXO":
143
+ return new Date(block.time * 1000);
144
+ }
145
+ return null;
146
+ }
147
+
148
+
149
+
150
+ var $596a656635c74d50$exports = {};
151
+
152
+ $parcel$export($596a656635c74d50$exports, "evmAddressToChecksum", () => $596a656635c74d50$export$db81f9ea057ab646);
153
+
154
+ function $596a656635c74d50$export$db81f9ea057ab646(address) {
155
+ if (!address || !/^(0x)?[0-9a-f]{40}$/i.test(address)) return null;
156
+ const stripAddress = address.slice(2).toLowerCase();
157
+ const keccakHash = (0, $8zHUo$viem.keccak256)(stripAddress);
158
+ let checksumAddress = "0x";
159
+ for(let i = 0; i < stripAddress.length; i++)checksumAddress += parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i];
160
+ return checksumAddress;
161
+ }
162
+
163
+
164
+ var $e5566e47593dc3e2$exports = {};
165
+
166
+ $parcel$export($e5566e47593dc3e2$exports, "evmChainToId", () => $e5566e47593dc3e2$export$f93b8abed77a4120);
167
+ const $e5566e47593dc3e2$var$CHAIN_ID = {
168
+ ARBITRUM: 42161,
169
+ AVALANCHE: 43114,
170
+ BASE: 8453,
171
+ BASE_SEPOLIA: 84532,
172
+ BERACHAIN_BARTIO: 80084,
173
+ BLAST: 81457,
174
+ BSC: 56,
175
+ CELO: 42220,
176
+ CYBER: 7560,
177
+ DEGEN: 666666666,
178
+ ETHEREUM: 1,
179
+ ETH_HOLESKY: 17000,
180
+ ETH_SEPOLIA: 11155111,
181
+ FRAXTAL: 252,
182
+ FRAXTAL_SEPOLIA: 2522,
183
+ FUSE: 122,
184
+ GNOSIS: 100,
185
+ GOLD: 4653,
186
+ HAM: 5112,
187
+ HEMI_TESTNET: 743111,
188
+ LINEA: 59144,
189
+ LINEA_SEPOLIA: 59141,
190
+ LISK_SEPOLIA: 4202,
191
+ LYRA: 957,
192
+ LYRA_SEPOLIA: 901,
193
+ MODE: 34443,
194
+ MODE_SEPOLIA: 919,
195
+ NEON: 245022934,
196
+ OASIS_SAPPHIRE: 23294,
197
+ OPTIMISM: 10,
198
+ OP_SEPOLIA: 11155420,
199
+ ORDERLY: 291,
200
+ ORDERLY_SEPOLIA: 4460,
201
+ PGN_SEPOLIA: 58008,
202
+ POLYGON: 137,
203
+ POLYGON_AMOY: 80002,
204
+ POLYGON_ZKEVM: 1101,
205
+ PUBLIC_GOODS_NETWORK: 424,
206
+ SCROLL: 534352,
207
+ SCROLL_SEPOLIA: 534351,
208
+ STACK: 78225,
209
+ SYNDICATE_FRAME_CHAIN: 5101,
210
+ TRON: 728126428,
211
+ ZER0: 543210,
212
+ ZK_LINK: 810180,
213
+ ZORA: 7777777,
214
+ ZORA_SEPOLIA: 999999999
215
+ };
216
+ function $e5566e47593dc3e2$export$f93b8abed77a4120(chain) {
217
+ return $e5566e47593dc3e2$var$CHAIN_ID[chain?.toUpperCase()];
218
+ }
219
+
220
+
221
+ var $da55be3e40667945$exports = {};
222
+
223
+ $parcel$export($da55be3e40667945$exports, "evmDecodeLog", () => $da55be3e40667945$export$18467e329ea485c9);
224
+ $parcel$export($da55be3e40667945$exports, "evmDecodeLogWithMetadata", () => $da55be3e40667945$export$cf548b70626e2eb9);
225
+
226
+ var $f7a3fb164436c9c3$exports = {};
227
+
228
+ $parcel$export($f7a3fb164436c9c3$exports, "evmMethodSignatureToHex", () => $f7a3fb164436c9c3$export$49d5c9473f8f70f2);
229
+
230
+ function $f7a3fb164436c9c3$export$49d5c9473f8f70f2(sig) {
231
+ const [method, rest] = sig.split("(");
232
+ const params = rest.split(")")[0].split(",").map((p)=>p.trim());
233
+ const topic0 = (0, $8zHUo$viem.keccak256)(`${method.split(" ").pop()}(${params.map((p)=>p.split(" ")[0]).join(",")})`);
234
+ return topic0;
235
+ }
236
+
237
+
238
+ function $da55be3e40667945$export$18467e329ea485c9(log, signatures) {
239
+ if (Array.isArray(signatures)) {
240
+ for (const sig of signatures){
241
+ const decoded = $da55be3e40667945$export$18467e329ea485c9(log, sig);
242
+ if (decoded) return decoded;
243
+ }
244
+ return null;
245
+ }
246
+ if (typeof signatures !== "string" && Array.isArray(signatures.addresses) && signatures.addresses.length) {
247
+ const addresses = signatures.addresses.map((a)=>a?.toLowerCase());
248
+ if (!addresses.includes(log.address.toLowerCase())) return null;
249
+ }
250
+ let sig = (typeof signatures === "string" ? signatures : signatures.signature).trim();
251
+ if (!sig.startsWith("event ")) sig = "event " + sig;
252
+ const topic0 = typeof signatures !== "string" && signatures.topic0 ? signatures.topic0 : (0, $f7a3fb164436c9c3$export$49d5c9473f8f70f2)(sig);
253
+ if ((sig.match(/ indexed /g)?.length || 0) === log.topics.length - 1) {
254
+ if (log.topics[0] === topic0) try {
255
+ const result = (0, $8zHUo$viem.decodeEventLog)({
256
+ abi: (0, $8zHUo$viem.parseAbi)([
257
+ sig
258
+ ]),
259
+ data: log.data,
260
+ topics: log.topics
261
+ });
262
+ return result.args;
263
+ } catch (e) {
264
+ // ignore this
265
+ }
266
+ }
267
+ return null;
268
+ }
269
+ function $da55be3e40667945$export$cf548b70626e2eb9(log, signatures) {
270
+ for (const sig of [
271
+ signatures
272
+ ].flat()){
273
+ const decoded = $da55be3e40667945$export$18467e329ea485c9(log, sig);
274
+ if (decoded) return {
275
+ decoded: decoded,
276
+ metadata: {
277
+ name: (typeof sig === "string" ? sig : sig.signature).split("(")[0]
278
+ }
279
+ };
280
+ }
281
+ return null;
282
+ }
283
+
284
+
285
+
286
+ var $414c83047563e72e$exports = {};
287
+
288
+ $parcel$export($414c83047563e72e$exports, "normalizeEVMBlock", () => $414c83047563e72e$export$685b7dc2197cd06c);
289
+
290
+ function $414c83047563e72e$export$685b7dc2197cd06c(rawBlock) {
291
+ for (const k of [
292
+ "baseFeePerGas",
293
+ "gasLimit",
294
+ "gasUsed",
295
+ "number",
296
+ "size",
297
+ "timestamp"
298
+ ])if (typeof rawBlock[k] === "string") rawBlock[k] = parseInt(rawBlock[k]);
299
+ for (const k of [
300
+ "difficulty",
301
+ "totalDifficulty"
302
+ ])if (typeof rawBlock[k] === "string") rawBlock[k] = BigInt(rawBlock[k]).toString();
303
+ for (const k of [
304
+ "miner"
305
+ ])rawBlock[k] = (0, $596a656635c74d50$export$db81f9ea057ab646)(rawBlock[k]);
306
+ rawBlock.transactions = (rawBlock.transactions || []).map((tx)=>{
307
+ for (const k of [
308
+ "blockNumber",
309
+ "cumulativeGasUsed",
310
+ "effectiveGasPrice",
311
+ "gas",
312
+ "gasUsed",
313
+ "nonce",
314
+ "status",
315
+ "transactionIndex"
316
+ ]){
317
+ if (typeof tx[k] === "string") tx[k] = parseInt(tx[k]);
318
+ if (typeof tx.receipt[k] === "string") tx.receipt[k] = parseInt(tx.receipt[k]);
319
+ }
320
+ for (const k of [
321
+ "gasPrice",
322
+ "maxFeePerGas",
323
+ "maxPriorityFeePerGas",
324
+ "value"
325
+ ]){
326
+ if (typeof tx[k] === "string") tx[k] = BigInt(tx[k]).toString();
327
+ if (typeof tx.receipt[k] === "string") tx.receipt[k] = BigInt(tx.receipt[k]).toString();
328
+ }
329
+ for (const k of [
330
+ "from",
331
+ "to"
332
+ ])if (typeof tx[k] === "string") tx[k] = (0, $596a656635c74d50$export$db81f9ea057ab646)(tx[k]);
333
+ for (const k of [
334
+ "contractAddress"
335
+ ])if (typeof tx.receipt[k] === "string") tx.receipt[k] = (0, $596a656635c74d50$export$db81f9ea057ab646)(tx.receipt[k]);
336
+ tx.type = parseInt(tx.type);
337
+ tx.receipt["status"] = Boolean(tx.receipt["status"]);
338
+ tx.receipt["logs"] = tx.receipt["logs"]?.map((log)=>{
339
+ for (const k of [
340
+ "blockNumber",
341
+ "logIndex",
342
+ "transactionIndex"
343
+ ])if (typeof log[k] === "string") log[k] = parseInt(log[k]);
344
+ log["address"] = (0, $596a656635c74d50$export$db81f9ea057ab646)(log["address"]);
345
+ return log;
346
+ });
347
+ return tx;
348
+ });
349
+ return rawBlock;
350
+ }
351
+
352
+
353
+ var $7fd98ef3967673b0$exports = {};
354
+
355
+ $parcel$export($7fd98ef3967673b0$exports, "snapchainTimestampFromMsg", () => $7fd98ef3967673b0$export$f69db31cc49f73fd);
356
+ $parcel$export($7fd98ef3967673b0$exports, "snapchainParseEvent", () => $7fd98ef3967673b0$export$146821f89c094be4);
357
+
358
+ var $7fd98ef3967673b0$require$Buffer = $8zHUo$buffer.Buffer;
359
+ function $7fd98ef3967673b0$var$getValueFromObject(obj, path) {
360
+ if (!obj || !path || !path.length) return undefined;
361
+ const parts = path.replace(/\.\./g, ".__dot__").split(".");
362
+ if (parts[0].startsWith("__dot__")) parts[0] = parts[0].replace(/__dot__/, ".");
363
+ if (parts.length === 1) return obj[parts[0]];
364
+ return $7fd98ef3967673b0$var$getValueFromObject(obj[parts[0]], parts.slice(1).join("."));
365
+ }
366
+ function $7fd98ef3967673b0$export$f69db31cc49f73fd(msg) {
367
+ return new Date(parseInt(msg.timestamp || msg.data?.timestamp) * 1000 + 1609459200000);
368
+ }
369
+ function $7fd98ef3967673b0$export$146821f89c094be4(evt) {
370
+ if (!evt?.data?.type) return null;
371
+ const data = evt.data;
372
+ const processed = {
373
+ fid: data.fid,
374
+ signer: evt.signer,
375
+ timestamp: $7fd98ef3967673b0$export$f69db31cc49f73fd(data).toISOString()
376
+ };
377
+ switch(data.type){
378
+ case "MESSAGE_TYPE_CAST_ADD":
379
+ processed._dataType = "cast";
380
+ processed.hash = evt.hash;
381
+ processed.embeds = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_add_body.embeds");
382
+ processed.parentCastUrl = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_add_body.parent_url");
383
+ processed.parentCastFid = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_add_body.parent_cast_id.fid");
384
+ processed.parentCastHash = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_add_body.parent_cast_id.hash");
385
+ processed.text = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_add_body.text");
386
+ processed.mentions = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_add_body.mentions");
387
+ processed.mentionsPositions = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_add_body.mentions_positions");
388
+ processed.deletedAt = "";
389
+ break;
390
+ case "MESSAGE_TYPE_CAST_REMOVE":
391
+ processed._dataType = "cast";
392
+ processed.hash = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_remove_body.target_hash");
393
+ if (typeof processed.hash === "string" && !processed.hash?.startsWith("0x")) processed.hash = "0x" + $7fd98ef3967673b0$require$Buffer.from(processed.hash, "base64").toString("hex");
394
+ processed.deletedAt = processed.timestamp;
395
+ break;
396
+ case "MESSAGE_TYPE_REACTION_ADD":
397
+ case "MESSAGE_TYPE_REACTION_REMOVE":
398
+ processed._dataType = "reaction";
399
+ processed.targetCastFid = $7fd98ef3967673b0$var$getValueFromObject(data, "reaction_body.target_cast_id.fid");
400
+ processed.targetCastHash = $7fd98ef3967673b0$var$getValueFromObject(data, "reaction_body.target_cast_id.hash");
401
+ processed.type = $7fd98ef3967673b0$var$getValueFromObject(data, "reaction_body.type")?.split("_TYPE_").pop().toLowerCase();
402
+ if (data.type === "MESSAGE_TYPE_REACTION_REMOVE") processed.deletedAt = processed.timestamp;
403
+ else processed.deletedAt = "";
404
+ break;
405
+ case "MESSAGE_TYPE_LINK_ADD":
406
+ case "MESSAGE_TYPE_LINK_REMOVE":
407
+ processed._dataType = "link";
408
+ processed.target_fid = $7fd98ef3967673b0$var$getValueFromObject(data, "link_body.target_fid");
409
+ processed.type = $7fd98ef3967673b0$var$getValueFromObject(data, "link_body.type");
410
+ if (data.type === "MESSAGE_TYPE_LINK_REMOVE") processed.deletedAt = processed.timestamp;
411
+ else processed.deletedAt = "";
412
+ break;
413
+ case "MESSAGE_TYPE_VERIFICATION_ADD_ETH_ADDRESS":
414
+ processed._dataType = "verification";
415
+ processed.address = $7fd98ef3967673b0$var$getValueFromObject(data, "verification_add_address_body.address");
416
+ if (processed.address?.startsWith("0x")) processed.address = processed.address.toLowerCase();
417
+ processed.deletedAt = "";
418
+ break;
419
+ case "MESSAGE_TYPE_VERIFICATION_REMOVE":
420
+ processed._dataType = "verification";
421
+ processed.address = $7fd98ef3967673b0$var$getValueFromObject(data, "verification_remove_body.address");
422
+ if (processed.address?.startsWith("0x")) processed.address = processed.address.toLowerCase();
423
+ processed.deletedAt = processed.timestamp;
424
+ break;
425
+ case "MESSAGE_TYPE_USER_DATA_ADD":
426
+ {
427
+ processed._dataType = "user_data";
428
+ let key = $7fd98ef3967673b0$var$getValueFromObject(data, "user_data_body.type");
429
+ if (typeof key === "string") {
430
+ key = key.trim().split("_").pop().toLowerCase();
431
+ processed.data = {
432
+ [key]: $7fd98ef3967673b0$var$getValueFromObject(data, "user_data_body.value")
433
+ };
434
+ }
435
+ break;
436
+ }
437
+ case "MESSAGE_TYPE_USERNAME_PROOF":
438
+ return null;
439
+ default:
440
+ return null;
441
+ }
442
+ for(const k in processed){
443
+ if (processed[k] === null || processed[k] === undefined) delete processed[k];
444
+ if (k === "deletedAt" && processed[k] === "") processed[k] = null;
445
+ if ((k.endsWith("Hash") || k === "hash") && processed[k] && !processed[k].startsWith("0x")) processed[k] = "0x" + $7fd98ef3967673b0$require$Buffer.from(processed[k], "base64").toString("hex");
446
+ }
447
+ return processed;
448
+ }
449
+
450
+
451
+ $parcel$exportWildcard($d7167569386d0d4c$exports, $b8691f253b6baa6e$exports);
452
+ $parcel$exportWildcard($d7167569386d0d4c$exports, $6bd2ca253e883278$exports);
453
+ $parcel$exportWildcard($d7167569386d0d4c$exports, $596a656635c74d50$exports);
454
+ $parcel$exportWildcard($d7167569386d0d4c$exports, $e5566e47593dc3e2$exports);
455
+ $parcel$exportWildcard($d7167569386d0d4c$exports, $da55be3e40667945$exports);
456
+ $parcel$exportWildcard($d7167569386d0d4c$exports, $f7a3fb164436c9c3$exports);
457
+ $parcel$exportWildcard($d7167569386d0d4c$exports, $414c83047563e72e$exports);
458
+ $parcel$exportWildcard($d7167569386d0d4c$exports, $7fd98ef3967673b0$exports);
459
+
460
+
461
+
462
+
109
463
 
110
464
  const $25d5bdd23cba31eb$export$ace043a4f2efe476 = {
111
465
  match: (block)=>(0, $6bd2ca253e883278$export$ae001c77434c5340)(block) === "APTOS",
@@ -379,437 +733,84 @@ const $60d24c82dc5feb2e$export$893111d8d332e195 = {
379
733
  timestamp: "+057068-01-19T05:23:20.000Z",
380
734
  to: "addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund",
381
735
  token: null,
382
- tokenType: "NATIVE",
383
- transactionGasFee: 174257n,
384
- transactionHash: "261c42ba9124f55d8e169ebb692cd3759d796a54369acb316ee449b546e79309"
385
- }
386
- ]
387
- }
388
- ]
389
- };
390
-
391
-
392
-
393
-
394
-
395
-
396
-
397
- var $f9ab50a3e879ac1c$require$Buffer = $8zHUo$buffer.Buffer;
398
- const $f9ab50a3e879ac1c$export$b5fd4920e8b7d913 = {
399
- match: (block)=>(0, $6bd2ca253e883278$export$ae001c77434c5340)(block) === "COSMOS",
400
- transform (block) {
401
- let transfers = [];
402
- const typedBlock = block;
403
- const blockNumber = Number(typedBlock.block.header.height);
404
- const blockTimestamp = new Date(typedBlock.block.header.time).toISOString();
405
- for (const txRaw of typedBlock.block.data.txs || []){
406
- let decoded;
407
- try {
408
- decoded = (0, $8zHUo$cosmjsprotosigning.decodeTxRaw)(new Uint8Array($f9ab50a3e879ac1c$require$Buffer.from(txRaw, "base64")));
409
- } catch (e) {
410
- continue;
411
- }
412
- const txHash = (0, $8zHUo$viem.sha256)(new Uint8Array($f9ab50a3e879ac1c$require$Buffer.from(txRaw, "base64")));
413
- const transactionGasFee = BigInt(decoded.authInfo.fee?.amount?.[0]?.amount || "0");
414
- const registry = new (0, $8zHUo$cosmjsprotosigning.Registry)((0, $8zHUo$cosmjsstargate.defaultRegistryTypes));
415
- for (const message of decoded.body.messages)if ([
416
- "/ibc.applications.transfer.v1.MsgTransfer",
417
- "/cosmos.bank.v1beta1.MsgSend"
418
- ].includes(message.typeUrl)) {
419
- const decodedMsg = registry.decode(message);
420
- transfers.push({
421
- blockNumber: blockNumber,
422
- from: decodedMsg.sender,
423
- to: decodedMsg.receiver,
424
- amount: BigInt(decodedMsg.token?.amount || 0),
425
- token: decodedMsg.token?.denom,
426
- tokenType: "NATIVE",
427
- timestamp: blockTimestamp,
428
- transactionHash: txHash.slice(2).toUpperCase(),
429
- transactionGasFee: transactionGasFee
430
- });
431
- }
432
- }
433
- return transfers;
434
- },
435
- tests: [
436
- {
437
- params: {
438
- network: "COSMOS",
439
- walletAddress: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
440
- contractAddress: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013"
441
- },
442
- payload: "https://jiti.indexing.co/networks/cosmos/24419691",
443
- output: [
444
- {
445
- blockNumber: 24419691,
446
- from: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
447
- to: "noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv",
448
- amount: 500000n,
449
- token: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013",
450
- tokenType: "NATIVE",
451
- timestamp: "2025-02-14T21:48:22.809Z",
452
- transactionHash: "963D4D7BB59C1280F58A7ECA2F1934E2AA005109A989193C815C7B98EDCD7445",
453
- transactionGasFee: 4860n
454
- }
455
- ]
456
- }
457
- ]
458
- };
459
-
460
-
461
- var $d7167569386d0d4c$exports = {};
462
- var $b8691f253b6baa6e$exports = {};
463
-
464
- $parcel$export($b8691f253b6baa6e$exports, "blockToTimestamp", () => $b8691f253b6baa6e$export$ec64f6024312bb14);
465
-
466
- function $b8691f253b6baa6e$export$ec64f6024312bb14(block) {
467
- const vm = (0, $6bd2ca253e883278$export$ae001c77434c5340)(block);
468
- switch(vm){
469
- case "APTOS":
470
- return new Date(parseInt(block.transactions[0].timestamp, 10) / 1000);
471
- case "CARDANO":
472
- return new Date(block.timestamp * 1000);
473
- case "COSMOS":
474
- return new Date(block.block.header.time);
475
- case "EVM":
476
- return new Date(block.timestamp * 1000);
477
- case "FILECOIN":
478
- return new Date(block.Blocks[0].Timestamp * 1000);
479
- case "RIPPLE":
480
- return new Date(block.close_time_iso);
481
- case "STARKNET":
482
- return new Date(block.timestamp * 1000);
483
- case "STELLAR":
484
- return new Date(block.transactions[0].created_at);
485
- case "SUBSTRATE":
486
- {
487
- const timestampExtrinsic = block.extrinsics.find((ex)=>ex.method === "timestamp.set");
488
- return new Date(Number(timestampExtrinsic.args[0].toString().replace(/,/g, "")));
489
- }
490
- case "SUI":
491
- return new Date(parseInt(block.timestamp, 10));
492
- case "SVM":
493
- return new Date(block.blockTime * 1000);
494
- case "TON":
495
- return new Date(block.shards?.[0]?.gen_utime * 1000);
496
- case "UTXO":
497
- return new Date(block.time * 1000);
498
- }
499
- return null;
500
- }
501
-
502
-
503
-
504
- var $596a656635c74d50$exports = {};
505
-
506
- $parcel$export($596a656635c74d50$exports, "evmAddressToChecksum", () => $596a656635c74d50$export$db81f9ea057ab646);
507
-
508
- function $596a656635c74d50$export$db81f9ea057ab646(address) {
509
- if (!address || !/^(0x)?[0-9a-f]{40}$/i.test(address)) return null;
510
- const stripAddress = address.slice(2).toLowerCase();
511
- const keccakHash = (0, $8zHUo$viem.keccak256)(stripAddress);
512
- let checksumAddress = "0x";
513
- for(let i = 0; i < stripAddress.length; i++)checksumAddress += parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i];
514
- return checksumAddress;
515
- }
516
-
517
-
518
- var $e5566e47593dc3e2$exports = {};
519
-
520
- $parcel$export($e5566e47593dc3e2$exports, "evmChainToId", () => $e5566e47593dc3e2$export$f93b8abed77a4120);
521
- const $e5566e47593dc3e2$var$CHAIN_ID = {
522
- ARBITRUM: 42161,
523
- AVALANCHE: 43114,
524
- BASE: 8453,
525
- BASE_SEPOLIA: 84532,
526
- BERACHAIN_BARTIO: 80084,
527
- BLAST: 81457,
528
- BSC: 56,
529
- CELO: 42220,
530
- CYBER: 7560,
531
- DEGEN: 666666666,
532
- ETHEREUM: 1,
533
- ETH_HOLESKY: 17000,
534
- ETH_SEPOLIA: 11155111,
535
- FRAXTAL: 252,
536
- FRAXTAL_SEPOLIA: 2522,
537
- FUSE: 122,
538
- GNOSIS: 100,
539
- GOLD: 4653,
540
- HAM: 5112,
541
- HEMI_TESTNET: 743111,
542
- LINEA: 59144,
543
- LINEA_SEPOLIA: 59141,
544
- LISK_SEPOLIA: 4202,
545
- LYRA: 957,
546
- LYRA_SEPOLIA: 901,
547
- MODE: 34443,
548
- MODE_SEPOLIA: 919,
549
- NEON: 245022934,
550
- OASIS_SAPPHIRE: 23294,
551
- OPTIMISM: 10,
552
- OP_SEPOLIA: 11155420,
553
- ORDERLY: 291,
554
- ORDERLY_SEPOLIA: 4460,
555
- PGN_SEPOLIA: 58008,
556
- POLYGON: 137,
557
- POLYGON_AMOY: 80002,
558
- POLYGON_ZKEVM: 1101,
559
- PUBLIC_GOODS_NETWORK: 424,
560
- SCROLL: 534352,
561
- SCROLL_SEPOLIA: 534351,
562
- STACK: 78225,
563
- SYNDICATE_FRAME_CHAIN: 5101,
564
- TRON: 728126428,
565
- ZER0: 543210,
566
- ZK_LINK: 810180,
567
- ZORA: 7777777,
568
- ZORA_SEPOLIA: 999999999
569
- };
570
- function $e5566e47593dc3e2$export$f93b8abed77a4120(chain) {
571
- return $e5566e47593dc3e2$var$CHAIN_ID[chain?.toUpperCase()];
572
- }
573
-
574
-
575
- var $da55be3e40667945$exports = {};
576
-
577
- $parcel$export($da55be3e40667945$exports, "evmDecodeLog", () => $da55be3e40667945$export$18467e329ea485c9);
578
- $parcel$export($da55be3e40667945$exports, "evmDecodeLogWithMetadata", () => $da55be3e40667945$export$cf548b70626e2eb9);
579
-
580
- var $f7a3fb164436c9c3$exports = {};
581
-
582
- $parcel$export($f7a3fb164436c9c3$exports, "evmMethodSignatureToHex", () => $f7a3fb164436c9c3$export$49d5c9473f8f70f2);
583
-
584
- function $f7a3fb164436c9c3$export$49d5c9473f8f70f2(sig) {
585
- const [method, rest] = sig.split("(");
586
- const params = rest.split(")")[0].split(",").map((p)=>p.trim());
587
- const topic0 = (0, $8zHUo$viem.keccak256)(`${method.split(" ").pop()}(${params.map((p)=>p.split(" ")[0]).join(",")})`);
588
- return topic0;
589
- }
590
-
591
-
592
- function $da55be3e40667945$export$18467e329ea485c9(log, signatures) {
593
- if (Array.isArray(signatures)) {
594
- for (const sig of signatures){
595
- const decoded = $da55be3e40667945$export$18467e329ea485c9(log, sig);
596
- if (decoded) return decoded;
597
- }
598
- return null;
599
- }
600
- if (typeof signatures !== "string" && Array.isArray(signatures.addresses) && signatures.addresses.length) {
601
- const addresses = signatures.addresses.map((a)=>a?.toLowerCase());
602
- if (!addresses.includes(log.address.toLowerCase())) return null;
603
- }
604
- let sig = (typeof signatures === "string" ? signatures : signatures.signature).trim();
605
- if (!sig.startsWith("event ")) sig = "event " + sig;
606
- const topic0 = typeof signatures !== "string" && signatures.topic0 ? signatures.topic0 : (0, $f7a3fb164436c9c3$export$49d5c9473f8f70f2)(sig);
607
- if ((sig.match(/ indexed /g)?.length || 0) === log.topics.length - 1) {
608
- if (log.topics[0] === topic0) try {
609
- const result = (0, $8zHUo$viem.decodeEventLog)({
610
- abi: (0, $8zHUo$viem.parseAbi)([
611
- sig
612
- ]),
613
- data: log.data,
614
- topics: log.topics
615
- });
616
- return result.args;
617
- } catch (e) {
618
- // ignore this
736
+ tokenType: "NATIVE",
737
+ transactionGasFee: 174257n,
738
+ transactionHash: "261c42ba9124f55d8e169ebb692cd3759d796a54369acb316ee449b546e79309"
739
+ }
740
+ ]
619
741
  }
620
- }
621
- return null;
622
- }
623
- function $da55be3e40667945$export$cf548b70626e2eb9(log, signatures) {
624
- for (const sig of [
625
- signatures
626
- ].flat()){
627
- const decoded = $da55be3e40667945$export$18467e329ea485c9(log, sig);
628
- if (decoded) return {
629
- decoded: decoded,
630
- metadata: {
631
- name: (typeof sig === "string" ? sig : sig.signature).split("(")[0]
632
- }
633
- };
634
- }
635
- return null;
636
- }
637
-
638
-
742
+ ]
743
+ };
639
744
 
640
- var $414c83047563e72e$exports = {};
641
745
 
642
- $parcel$export($414c83047563e72e$exports, "normalizeEVMBlock", () => $414c83047563e72e$export$685b7dc2197cd06c);
643
746
 
644
- function $414c83047563e72e$export$685b7dc2197cd06c(rawBlock) {
645
- for (const k of [
646
- "baseFeePerGas",
647
- "gasLimit",
648
- "gasUsed",
649
- "number",
650
- "size",
651
- "timestamp"
652
- ])if (typeof rawBlock[k] === "string") rawBlock[k] = parseInt(rawBlock[k]);
653
- for (const k of [
654
- "difficulty",
655
- "totalDifficulty"
656
- ])if (typeof rawBlock[k] === "string") rawBlock[k] = BigInt(rawBlock[k]).toString();
657
- for (const k of [
658
- "miner"
659
- ])rawBlock[k] = (0, $596a656635c74d50$export$db81f9ea057ab646)(rawBlock[k]);
660
- rawBlock.transactions = (rawBlock.transactions || []).map((tx)=>{
661
- for (const k of [
662
- "blockNumber",
663
- "cumulativeGasUsed",
664
- "effectiveGasPrice",
665
- "gas",
666
- "gasUsed",
667
- "nonce",
668
- "status",
669
- "transactionIndex"
670
- ]){
671
- if (typeof tx[k] === "string") tx[k] = parseInt(tx[k]);
672
- if (typeof tx.receipt[k] === "string") tx.receipt[k] = parseInt(tx.receipt[k]);
673
- }
674
- for (const k of [
675
- "gasPrice",
676
- "maxFeePerGas",
677
- "maxPriorityFeePerGas",
678
- "value"
679
- ]){
680
- if (typeof tx[k] === "string") tx[k] = BigInt(tx[k]).toString();
681
- if (typeof tx.receipt[k] === "string") tx.receipt[k] = BigInt(tx.receipt[k]).toString();
682
- }
683
- for (const k of [
684
- "from",
685
- "to"
686
- ])if (typeof tx[k] === "string") tx[k] = (0, $596a656635c74d50$export$db81f9ea057ab646)(tx[k]);
687
- for (const k of [
688
- "contractAddress"
689
- ])if (typeof tx.receipt[k] === "string") tx.receipt[k] = (0, $596a656635c74d50$export$db81f9ea057ab646)(tx.receipt[k]);
690
- tx.type = parseInt(tx.type);
691
- tx.receipt["status"] = Boolean(tx.receipt["status"]);
692
- tx.receipt["logs"] = tx.receipt["logs"]?.map((log)=>{
693
- for (const k of [
694
- "blockNumber",
695
- "logIndex",
696
- "transactionIndex"
697
- ])if (typeof log[k] === "string") log[k] = parseInt(log[k]);
698
- log["address"] = (0, $596a656635c74d50$export$db81f9ea057ab646)(log["address"]);
699
- return log;
700
- });
701
- return tx;
702
- });
703
- return rawBlock;
704
- }
705
747
 
706
748
 
707
- var $7fd98ef3967673b0$exports = {};
708
749
 
709
- $parcel$export($7fd98ef3967673b0$exports, "snapchainTimestampFromMsg", () => $7fd98ef3967673b0$export$f69db31cc49f73fd);
710
- $parcel$export($7fd98ef3967673b0$exports, "snapchainParseEvent", () => $7fd98ef3967673b0$export$146821f89c094be4);
711
750
 
712
- var $7fd98ef3967673b0$require$Buffer = $8zHUo$buffer.Buffer;
713
- function $7fd98ef3967673b0$var$getValueFromObject(obj, path) {
714
- if (!obj || !path || !path.length) return undefined;
715
- const parts = path.replace(/\.\./g, ".__dot__").split(".");
716
- if (parts[0].startsWith("__dot__")) parts[0] = parts[0].replace(/__dot__/, ".");
717
- if (parts.length === 1) return obj[parts[0]];
718
- return $7fd98ef3967673b0$var$getValueFromObject(obj[parts[0]], parts.slice(1).join("."));
719
- }
720
- function $7fd98ef3967673b0$export$f69db31cc49f73fd(msg) {
721
- return new Date(parseInt(msg.timestamp || msg.data?.timestamp) * 1000 + 1609459200000);
722
- }
723
- function $7fd98ef3967673b0$export$146821f89c094be4(evt) {
724
- if (!evt?.data?.type) return null;
725
- const data = evt.data;
726
- const processed = {
727
- fid: data.fid,
728
- signer: evt.signer,
729
- timestamp: $7fd98ef3967673b0$export$f69db31cc49f73fd(data).toISOString()
730
- };
731
- switch(data.type){
732
- case "MESSAGE_TYPE_CAST_ADD":
733
- processed._dataType = "cast";
734
- processed.hash = evt.hash;
735
- processed.embeds = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_add_body.embeds");
736
- processed.parentCastUrl = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_add_body.parent_url");
737
- processed.parentCastFid = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_add_body.parent_cast_id.fid");
738
- processed.parentCastHash = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_add_body.parent_cast_id.hash");
739
- processed.text = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_add_body.text");
740
- processed.mentions = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_add_body.mentions");
741
- processed.mentionsPositions = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_add_body.mentions_positions");
742
- processed.deletedAt = "";
743
- break;
744
- case "MESSAGE_TYPE_CAST_REMOVE":
745
- processed._dataType = "cast";
746
- processed.hash = $7fd98ef3967673b0$var$getValueFromObject(data, "cast_remove_body.target_hash");
747
- if (typeof processed.hash === "string" && !processed.hash?.startsWith("0x")) processed.hash = "0x" + $7fd98ef3967673b0$require$Buffer.from(processed.hash, "base64").toString("hex");
748
- processed.deletedAt = processed.timestamp;
749
- break;
750
- case "MESSAGE_TYPE_REACTION_ADD":
751
- case "MESSAGE_TYPE_REACTION_REMOVE":
752
- processed._dataType = "reaction";
753
- processed.targetCastFid = $7fd98ef3967673b0$var$getValueFromObject(data, "reaction_body.target_cast_id.fid");
754
- processed.targetCastHash = $7fd98ef3967673b0$var$getValueFromObject(data, "reaction_body.target_cast_id.hash");
755
- processed.type = $7fd98ef3967673b0$var$getValueFromObject(data, "reaction_body.type")?.split("_TYPE_").pop().toLowerCase();
756
- if (data.type === "MESSAGE_TYPE_REACTION_REMOVE") processed.deletedAt = processed.timestamp;
757
- else processed.deletedAt = "";
758
- break;
759
- case "MESSAGE_TYPE_LINK_ADD":
760
- case "MESSAGE_TYPE_LINK_REMOVE":
761
- processed._dataType = "link";
762
- processed.target_fid = $7fd98ef3967673b0$var$getValueFromObject(data, "link_body.target_fid");
763
- processed.type = $7fd98ef3967673b0$var$getValueFromObject(data, "link_body.type");
764
- if (data.type === "MESSAGE_TYPE_LINK_REMOVE") processed.deletedAt = processed.timestamp;
765
- else processed.deletedAt = "";
766
- break;
767
- case "MESSAGE_TYPE_VERIFICATION_ADD_ETH_ADDRESS":
768
- processed._dataType = "verification";
769
- processed.address = $7fd98ef3967673b0$var$getValueFromObject(data, "verification_add_address_body.address");
770
- if (processed.address?.startsWith("0x")) processed.address = processed.address.toLowerCase();
771
- processed.deletedAt = "";
772
- break;
773
- case "MESSAGE_TYPE_VERIFICATION_REMOVE":
774
- processed._dataType = "verification";
775
- processed.address = $7fd98ef3967673b0$var$getValueFromObject(data, "verification_remove_body.address");
776
- if (processed.address?.startsWith("0x")) processed.address = processed.address.toLowerCase();
777
- processed.deletedAt = processed.timestamp;
778
- break;
779
- case "MESSAGE_TYPE_USER_DATA_ADD":
780
- {
781
- processed._dataType = "user_data";
782
- let key = $7fd98ef3967673b0$var$getValueFromObject(data, "user_data_body.type");
783
- if (typeof key === "string") {
784
- key = key.trim().split("_").pop().toLowerCase();
785
- processed.data = {
786
- [key]: $7fd98ef3967673b0$var$getValueFromObject(data, "user_data_body.value")
787
- };
788
- }
789
- break;
751
+ var $f9ab50a3e879ac1c$require$Buffer = $8zHUo$buffer.Buffer;
752
+ const $f9ab50a3e879ac1c$export$b5fd4920e8b7d913 = {
753
+ match: (block)=>(0, $6bd2ca253e883278$export$ae001c77434c5340)(block) === "COSMOS",
754
+ transform (block) {
755
+ let transfers = [];
756
+ const typedBlock = block;
757
+ const blockNumber = Number(typedBlock.block.header.height);
758
+ const blockTimestamp = new Date(typedBlock.block.header.time).toISOString();
759
+ for (const txRaw of typedBlock.block.data.txs || []){
760
+ let decoded;
761
+ try {
762
+ decoded = (0, $8zHUo$cosmjsprotosigning.decodeTxRaw)(new Uint8Array($f9ab50a3e879ac1c$require$Buffer.from(txRaw, "base64")));
763
+ } catch (e) {
764
+ continue;
790
765
  }
791
- case "MESSAGE_TYPE_USERNAME_PROOF":
792
- return null;
793
- default:
794
- return null;
795
- }
796
- for(const k in processed){
797
- if (processed[k] === null || processed[k] === undefined) delete processed[k];
798
- if (k === "deletedAt" && processed[k] === "") processed[k] = null;
799
- if ((k.endsWith("Hash") || k === "hash") && processed[k] && !processed[k].startsWith("0x")) processed[k] = "0x" + $7fd98ef3967673b0$require$Buffer.from(processed[k], "base64").toString("hex");
800
- }
801
- return processed;
802
- }
803
-
766
+ const txHash = (0, $8zHUo$viem.sha256)(new Uint8Array($f9ab50a3e879ac1c$require$Buffer.from(txRaw, "base64")));
767
+ const transactionGasFee = BigInt(decoded.authInfo.fee?.amount?.[0]?.amount || "0");
768
+ const registry = new (0, $8zHUo$cosmjsprotosigning.Registry)((0, $8zHUo$cosmjsstargate.defaultRegistryTypes));
769
+ for (const message of decoded.body.messages)if ([
770
+ "/ibc.applications.transfer.v1.MsgTransfer",
771
+ "/cosmos.bank.v1beta1.MsgSend"
772
+ ].includes(message.typeUrl)) {
773
+ const decodedMsg = registry.decode(message);
774
+ transfers.push({
775
+ blockNumber: blockNumber,
776
+ from: decodedMsg.sender,
777
+ to: decodedMsg.receiver,
778
+ amount: BigInt(decodedMsg.token?.amount || 0),
779
+ token: decodedMsg.token?.denom,
780
+ tokenType: "NATIVE",
781
+ timestamp: blockTimestamp,
782
+ transactionHash: txHash.slice(2).toUpperCase(),
783
+ transactionGasFee: transactionGasFee
784
+ });
785
+ }
786
+ }
787
+ return transfers;
788
+ },
789
+ tests: [
790
+ {
791
+ params: {
792
+ network: "COSMOS",
793
+ walletAddress: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
794
+ contractAddress: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013"
795
+ },
796
+ payload: "https://jiti.indexing.co/networks/cosmos/24419691",
797
+ output: [
798
+ {
799
+ blockNumber: 24419691,
800
+ from: "cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz",
801
+ to: "noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv",
802
+ amount: 500000n,
803
+ token: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013",
804
+ tokenType: "NATIVE",
805
+ timestamp: "2025-02-14T21:48:22.809Z",
806
+ transactionHash: "963D4D7BB59C1280F58A7ECA2F1934E2AA005109A989193C815C7B98EDCD7445",
807
+ transactionGasFee: 4860n
808
+ }
809
+ ]
810
+ }
811
+ ]
812
+ };
804
813
 
805
- $parcel$exportWildcard($d7167569386d0d4c$exports, $b8691f253b6baa6e$exports);
806
- $parcel$exportWildcard($d7167569386d0d4c$exports, $6bd2ca253e883278$exports);
807
- $parcel$exportWildcard($d7167569386d0d4c$exports, $596a656635c74d50$exports);
808
- $parcel$exportWildcard($d7167569386d0d4c$exports, $e5566e47593dc3e2$exports);
809
- $parcel$exportWildcard($d7167569386d0d4c$exports, $da55be3e40667945$exports);
810
- $parcel$exportWildcard($d7167569386d0d4c$exports, $f7a3fb164436c9c3$exports);
811
- $parcel$exportWildcard($d7167569386d0d4c$exports, $414c83047563e72e$exports);
812
- $parcel$exportWildcard($d7167569386d0d4c$exports, $7fd98ef3967673b0$exports);
813
814
 
814
815
 
815
816
 
@@ -9550,10 +9551,9 @@ const $48f9879a44dd1195$export$a8fc3402335b0b04 = [
9550
9551
  ];
9551
9552
 
9552
9553
 
9553
-
9554
- var $faefaad95e5fcca0$exports = {};
9555
-
9556
-
9554
+ const $882b6d93070905b3$export$eab97d15b1788b8d = {
9555
+ ...$d7167569386d0d4c$exports
9556
+ };
9557
9557
  const $882b6d93070905b3$export$a8fc3402335b0b04 = (0, $48f9879a44dd1195$export$a8fc3402335b0b04).reduce((a, b)=>({
9558
9558
  ...a,
9559
9559
  [b.key]: Object.assign({}, b)