@indexing/jiti 0.1.4 → 0.1.6

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
@@ -1145,6 +1145,8 @@ const $8d6646508fb2fa58$export$b5fd4920e8b7d913 = {
1145
1145
 
1146
1146
 
1147
1147
  const $5ec62a2088d070a8$var$NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
1148
+ // zkSync Era wraps native ETH as an ERC-20 at this address; Transfer logs from it represent native ETH movements
1149
+ const $5ec62a2088d070a8$var$ZKSYNC_NATIVE_ETH = "0x000000000000000000000000000000000000800a";
1148
1150
  const $5ec62a2088d070a8$export$5beebc5708fabf3c = {
1149
1151
  match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "EVM",
1150
1152
  transform (block, _ctx) {
@@ -1155,10 +1157,39 @@ const $5ec62a2088d070a8$export$5beebc5708fabf3c = {
1155
1157
  if (!tx.receipt) continue;
1156
1158
  const timestamp = new Date(typedBlock.timestamp * 1000).toISOString();
1157
1159
  const transactionGasFee = BigInt(tx.receipt.gasUsed) * BigInt(tx.receipt.effectiveGasPrice);
1160
+ // check if this tx has zkSync native ETH Transfer logs (used to skip unreliable traces)
1161
+ const hasZkSyncEthLogs = tx.receipt.logs.some((log)=>log.address.toLowerCase() === $5ec62a2088d070a8$var$ZKSYNC_NATIVE_ETH);
1158
1162
  // track direct ETH transfers
1159
1163
  if (!TOKEN_TYPES.length || TOKEN_TYPES.includes("NATIVE")) {
1160
- // pull from traces, if available
1161
- if (Array.isArray(tx.traces)) for (const trace of tx.traces.filter((t)=>t.action)){
1164
+ // handle L1→L2 deposit transactions (OP Stack type 0x7e) as native mints
1165
+ if (tx.mint && BigInt(tx.mint) > 0n) transfers.push({
1166
+ amount: BigInt(tx.mint),
1167
+ blockNumber: tx.blockNumber,
1168
+ from: $5ec62a2088d070a8$var$NULL_ADDRESS,
1169
+ timestamp: timestamp,
1170
+ to: tx.to?.toLowerCase() || tx.from?.toLowerCase() || $5ec62a2088d070a8$var$NULL_ADDRESS,
1171
+ tokenType: "NATIVE",
1172
+ transactionGasFee: transactionGasFee,
1173
+ transactionHash: tx.hash
1174
+ });
1175
+ else if (hasZkSyncEthLogs) for (const log of tx.receipt.logs){
1176
+ if (log.address.toLowerCase() !== $5ec62a2088d070a8$var$ZKSYNC_NATIVE_ETH) continue;
1177
+ const txfer = (0, $cfa23334cbdf9391$export$cf548b70626e2eb9)(log, [
1178
+ "Transfer(address indexed from, address indexed to, uint256 value)"
1179
+ ]);
1180
+ if (txfer) transfers.push({
1181
+ amount: txfer.decoded.value,
1182
+ blockNumber: tx.blockNumber,
1183
+ from: txfer.decoded.from?.toLowerCase() || $5ec62a2088d070a8$var$NULL_ADDRESS,
1184
+ index: log.logIndex,
1185
+ timestamp: timestamp,
1186
+ to: txfer.decoded.to?.toLowerCase() || $5ec62a2088d070a8$var$NULL_ADDRESS,
1187
+ tokenType: "NATIVE",
1188
+ transactionGasFee: transactionGasFee,
1189
+ transactionHash: tx.hash
1190
+ });
1191
+ }
1192
+ else if (Array.isArray(tx.traces)) for (const trace of tx.traces.filter((t)=>t.action)){
1162
1193
  const action = trace.action;
1163
1194
  if (!action?.value) continue;
1164
1195
  transfers.push({
@@ -1186,6 +1217,8 @@ const $5ec62a2088d070a8$export$5beebc5708fabf3c = {
1186
1217
  }
1187
1218
  // track ERC20 transfers
1188
1219
  if (!TOKEN_TYPES.length || TOKEN_TYPES.includes("TOKEN")) for (const log of tx.receipt.logs){
1220
+ // skip zkSync native ETH logs (already handled as NATIVE above)
1221
+ if (log.address.toLowerCase() === $5ec62a2088d070a8$var$ZKSYNC_NATIVE_ETH) continue;
1189
1222
  const txfer = (0, $cfa23334cbdf9391$export$cf548b70626e2eb9)(log, [
1190
1223
  "Transfer(address indexed from, address indexed to, uint256 value)"
1191
1224
  ]);
@@ -1285,6 +1318,51 @@ const $5ec62a2088d070a8$export$5beebc5708fabf3c = {
1285
1318
  }
1286
1319
  ]
1287
1320
  },
1321
+ {
1322
+ params: {
1323
+ network: "BASE",
1324
+ walletAddress: "0xDa863f802Cc8CBA3C436bF801BD7785d9E7d4F36",
1325
+ tokenTypes: [
1326
+ "NATIVE"
1327
+ ]
1328
+ },
1329
+ payload: "https://jiti.indexing.co/networks/base/13170774",
1330
+ output: [
1331
+ {
1332
+ amount: 80000000000000000n,
1333
+ blockNumber: 13170774,
1334
+ from: "0x0000000000000000000000000000000000000000",
1335
+ timestamp: "2024-04-14T21:41:35.000Z",
1336
+ to: "0xda863f802cc8cba3c436bf801bd7785d9e7d4f36",
1337
+ tokenType: "NATIVE",
1338
+ transactionGasFee: 0n,
1339
+ transactionHash: "0xa3c7cbece45ff18b18e001c4bc096567c85526dad3453dba88791054a61fc444"
1340
+ }
1341
+ ]
1342
+ },
1343
+ {
1344
+ params: {
1345
+ network: "ZKSYNC",
1346
+ walletAddress: "0xf70da97812CB96aCDF810712Aa562db8dfA3dBEf",
1347
+ tokenTypes: [
1348
+ "NATIVE"
1349
+ ]
1350
+ },
1351
+ payload: "https://jiti.indexing.co/networks/zksync/55005000",
1352
+ output: [
1353
+ {
1354
+ amount: 1615028132795916n,
1355
+ blockNumber: 55005000,
1356
+ from: "0xebd1e414ebb98522cfd932104ba41fac10a4ef35",
1357
+ index: 4,
1358
+ timestamp: "2025-02-01T06:14:12.000Z",
1359
+ to: "0xf70da97812cb96acdf810712aa562db8dfa3dbef",
1360
+ tokenType: "NATIVE",
1361
+ transactionGasFee: 6389164250000n,
1362
+ transactionHash: "0xc0e1850d24af965e6a02836301a696e9f021b07fed765d8affe3bda1846d5700"
1363
+ }
1364
+ ]
1365
+ },
1288
1366
  {
1289
1367
  params: {
1290
1368
  network: "POLYGON",
@@ -1380,6 +1458,23 @@ const $07b3982e2fc4c8b2$export$400f08bfae9ee97f = {
1380
1458
  if (!Array.isArray(typedBlock.transactions)) return [];
1381
1459
  for (const typedTx of typedBlock.transactions || []){
1382
1460
  if (typedTx.TransactionType !== "Payment") continue;
1461
+ // Failed XRPL payments still burn Fee. Emit a fee-only transfer (to: null) so
1462
+ // callers account for the gas, and skip the payment amount that never landed.
1463
+ if (typedTx.metaData?.TransactionResult && typedTx.metaData.TransactionResult !== "tesSUCCESS") {
1464
+ transfers.push({
1465
+ amount: BigInt(typedTx.Fee ?? "0"),
1466
+ blockNumber: parseInt(typedBlock.ledger_index, 10),
1467
+ from: typedTx.Account ?? "UNKNOWN",
1468
+ memo: typedTx.DestinationTag,
1469
+ timestamp: typedBlock.close_time_iso || null,
1470
+ to: null,
1471
+ token: "XRP",
1472
+ tokenType: "NATIVE",
1473
+ transactionGasFee: BigInt(typedTx.Fee ?? "0"),
1474
+ transactionHash: typedTx.hash ?? ""
1475
+ });
1476
+ continue;
1477
+ }
1383
1478
  const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? "0";
1384
1479
  let tokenSymbol = "XRP";
1385
1480
  let tokenType = "NATIVE";
@@ -1428,6 +1523,45 @@ const $07b3982e2fc4c8b2$export$400f08bfae9ee97f = {
1428
1523
  transactionHash: "B32A6A5455777283212407FBD8CCA701505C654E5F4ADFFBE9D4D22F00889D87"
1429
1524
  }
1430
1525
  ]
1526
+ },
1527
+ // Failed XRPL payments emit ONLY a fee transfer (to: null) — the payment Amount
1528
+ // never reached the Destination, but the Fee was still burned.
1529
+ {
1530
+ params: {
1531
+ network: "RIPPLE"
1532
+ },
1533
+ payload: {
1534
+ _network: "RIPPLE",
1535
+ ledger_index: "100000000",
1536
+ close_time_iso: "2026-04-04T08:02:44Z",
1537
+ transactions: [
1538
+ {
1539
+ TransactionType: "Payment",
1540
+ Account: "rFAILFROMxxxxxxxxxxxxxxxxxxxxxxxxx",
1541
+ Destination: "rFAILTOxxxxxxxxxxxxxxxxxxxxxxxxxx",
1542
+ Amount: "1000000",
1543
+ Fee: "10",
1544
+ hash: "FAILEDXRPLTXHASH",
1545
+ metaData: {
1546
+ TransactionResult: "tecPATH_DRY"
1547
+ }
1548
+ }
1549
+ ]
1550
+ },
1551
+ output: [
1552
+ {
1553
+ amount: 10n,
1554
+ blockNumber: 100000000,
1555
+ from: "rFAILFROMxxxxxxxxxxxxxxxxxxxxxxxxx",
1556
+ memo: undefined,
1557
+ timestamp: "2026-04-04T08:02:44Z",
1558
+ to: null,
1559
+ token: "XRP",
1560
+ tokenType: "NATIVE",
1561
+ transactionGasFee: 10n,
1562
+ transactionHash: "FAILEDXRPLTXHASH"
1563
+ }
1564
+ ]
1431
1565
  }
1432
1566
  ]
1433
1567
  };
@@ -3164,6 +3298,23 @@ const $725699ccb951d76d$export$681f497010b17679 = {
3164
3298
  let transfers = [];
3165
3299
  const typedBlock = block;
3166
3300
  for (const typedTx of typedBlock.transactions || []){
3301
+ // Failed txs still burn fee_charged — emit a fee transfer (to: null) so callers
3302
+ // can account for the gas, but skip the payment ops that never actually moved funds.
3303
+ if (!typedTx.successful) {
3304
+ transfers.push({
3305
+ amount: BigInt(typedTx.fee_charged),
3306
+ blockNumber: typedBlock.sequence,
3307
+ from: typedTx.source_account,
3308
+ memo: typedTx.memo,
3309
+ timestamp: typedTx.created_at,
3310
+ to: null,
3311
+ token: null,
3312
+ tokenType: "NATIVE",
3313
+ transactionGasFee: BigInt(typedTx.fee_charged),
3314
+ transactionHash: typedTx.hash
3315
+ });
3316
+ continue;
3317
+ }
3167
3318
  for (const op of typedTx.operations)if (op.type === "payment") transfers.push({
3168
3319
  amount: BigInt(op.amount.replace(".", "")),
3169
3320
  blockNumber: typedBlock.sequence,
@@ -3212,6 +3363,31 @@ const $725699ccb951d76d$export$681f497010b17679 = {
3212
3363
  transactionHash: "c554aed41145304e03c0877c9de526cdcb8a8255c9bf156ff0dec202ab12e20d"
3213
3364
  }
3214
3365
  ]
3366
+ },
3367
+ // Failed Stellar txs emit ONLY a fee transfer (to: null), never the failed payment
3368
+ // operations. Ledger 61961851 / tx 9024ba4b... is the Mesh incident — the source
3369
+ // tried to send 1_000_000_000 stroops to GAGLH6..., the tx reverted, and the only
3370
+ // on-chain effect was the 100-stroop fee being charged.
3371
+ {
3372
+ params: {
3373
+ network: "STELLAR",
3374
+ transactionHash: "9024ba4b558b09042cb02afd1d46eea72597891691801375acee332273c5c26d"
3375
+ },
3376
+ payload: "https://jiti.indexing.co/networks/stellar/61961851",
3377
+ output: [
3378
+ {
3379
+ amount: 100n,
3380
+ blockNumber: 61961851,
3381
+ from: "GCP7I54JXTOZ4SJG4UARWJOMJ25JQXRHSHXQWDSV4TRVRJFDG67VUEXP",
3382
+ memo: undefined,
3383
+ timestamp: "2026-04-04T08:02:44Z",
3384
+ to: null,
3385
+ token: null,
3386
+ tokenType: "NATIVE",
3387
+ transactionGasFee: 100n,
3388
+ transactionHash: "9024ba4b558b09042cb02afd1d46eea72597891691801375acee332273c5c26d"
3389
+ }
3390
+ ]
3215
3391
  }
3216
3392
  ]
3217
3393
  };