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