@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/main.js CHANGED
@@ -1154,6 +1154,8 @@ const $f9ab50a3e879ac1c$export$b5fd4920e8b7d913 = {
1154
1154
 
1155
1155
 
1156
1156
  const $8deaea1ef39b6485$var$NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
1157
+ // zkSync Era wraps native ETH as an ERC-20 at this address; Transfer logs from it represent native ETH movements
1158
+ const $8deaea1ef39b6485$var$ZKSYNC_NATIVE_ETH = "0x000000000000000000000000000000000000800a";
1157
1159
  const $8deaea1ef39b6485$export$5beebc5708fabf3c = {
1158
1160
  match: (block)=>(0, $6bd2ca253e883278$export$ae001c77434c5340)(block) === "EVM",
1159
1161
  transform (block, _ctx) {
@@ -1164,10 +1166,39 @@ const $8deaea1ef39b6485$export$5beebc5708fabf3c = {
1164
1166
  if (!tx.receipt) continue;
1165
1167
  const timestamp = new Date(typedBlock.timestamp * 1000).toISOString();
1166
1168
  const transactionGasFee = BigInt(tx.receipt.gasUsed) * BigInt(tx.receipt.effectiveGasPrice);
1169
+ // check if this tx has zkSync native ETH Transfer logs (used to skip unreliable traces)
1170
+ const hasZkSyncEthLogs = tx.receipt.logs.some((log)=>log.address.toLowerCase() === $8deaea1ef39b6485$var$ZKSYNC_NATIVE_ETH);
1167
1171
  // track direct ETH transfers
1168
1172
  if (!TOKEN_TYPES.length || TOKEN_TYPES.includes("NATIVE")) {
1169
- // pull from traces, if available
1170
- if (Array.isArray(tx.traces)) for (const trace of tx.traces.filter((t)=>t.action)){
1173
+ // handle L1→L2 deposit transactions (OP Stack type 0x7e) as native mints
1174
+ if (tx.mint && BigInt(tx.mint) > 0n) transfers.push({
1175
+ amount: BigInt(tx.mint),
1176
+ blockNumber: tx.blockNumber,
1177
+ from: $8deaea1ef39b6485$var$NULL_ADDRESS,
1178
+ timestamp: timestamp,
1179
+ to: tx.to?.toLowerCase() || tx.from?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
1180
+ tokenType: "NATIVE",
1181
+ transactionGasFee: transactionGasFee,
1182
+ transactionHash: tx.hash
1183
+ });
1184
+ else if (hasZkSyncEthLogs) for (const log of tx.receipt.logs){
1185
+ if (log.address.toLowerCase() !== $8deaea1ef39b6485$var$ZKSYNC_NATIVE_ETH) continue;
1186
+ const txfer = (0, $da55be3e40667945$export$cf548b70626e2eb9)(log, [
1187
+ "Transfer(address indexed from, address indexed to, uint256 value)"
1188
+ ]);
1189
+ if (txfer) transfers.push({
1190
+ amount: txfer.decoded.value,
1191
+ blockNumber: tx.blockNumber,
1192
+ from: txfer.decoded.from?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
1193
+ index: log.logIndex,
1194
+ timestamp: timestamp,
1195
+ to: txfer.decoded.to?.toLowerCase() || $8deaea1ef39b6485$var$NULL_ADDRESS,
1196
+ tokenType: "NATIVE",
1197
+ transactionGasFee: transactionGasFee,
1198
+ transactionHash: tx.hash
1199
+ });
1200
+ }
1201
+ else if (Array.isArray(tx.traces)) for (const trace of tx.traces.filter((t)=>t.action)){
1171
1202
  const action = trace.action;
1172
1203
  if (!action?.value) continue;
1173
1204
  transfers.push({
@@ -1195,6 +1226,8 @@ const $8deaea1ef39b6485$export$5beebc5708fabf3c = {
1195
1226
  }
1196
1227
  // track ERC20 transfers
1197
1228
  if (!TOKEN_TYPES.length || TOKEN_TYPES.includes("TOKEN")) for (const log of tx.receipt.logs){
1229
+ // skip zkSync native ETH logs (already handled as NATIVE above)
1230
+ if (log.address.toLowerCase() === $8deaea1ef39b6485$var$ZKSYNC_NATIVE_ETH) continue;
1198
1231
  const txfer = (0, $da55be3e40667945$export$cf548b70626e2eb9)(log, [
1199
1232
  "Transfer(address indexed from, address indexed to, uint256 value)"
1200
1233
  ]);
@@ -1294,6 +1327,51 @@ const $8deaea1ef39b6485$export$5beebc5708fabf3c = {
1294
1327
  }
1295
1328
  ]
1296
1329
  },
1330
+ {
1331
+ params: {
1332
+ network: "BASE",
1333
+ walletAddress: "0xDa863f802Cc8CBA3C436bF801BD7785d9E7d4F36",
1334
+ tokenTypes: [
1335
+ "NATIVE"
1336
+ ]
1337
+ },
1338
+ payload: "https://jiti.indexing.co/networks/base/13170774",
1339
+ output: [
1340
+ {
1341
+ amount: 80000000000000000n,
1342
+ blockNumber: 13170774,
1343
+ from: "0x0000000000000000000000000000000000000000",
1344
+ timestamp: "2024-04-14T21:41:35.000Z",
1345
+ to: "0xda863f802cc8cba3c436bf801bd7785d9e7d4f36",
1346
+ tokenType: "NATIVE",
1347
+ transactionGasFee: 0n,
1348
+ transactionHash: "0xa3c7cbece45ff18b18e001c4bc096567c85526dad3453dba88791054a61fc444"
1349
+ }
1350
+ ]
1351
+ },
1352
+ {
1353
+ params: {
1354
+ network: "ZKSYNC",
1355
+ walletAddress: "0xf70da97812CB96aCDF810712Aa562db8dfA3dBEf",
1356
+ tokenTypes: [
1357
+ "NATIVE"
1358
+ ]
1359
+ },
1360
+ payload: "https://jiti.indexing.co/networks/zksync/55005000",
1361
+ output: [
1362
+ {
1363
+ amount: 1615028132795916n,
1364
+ blockNumber: 55005000,
1365
+ from: "0xebd1e414ebb98522cfd932104ba41fac10a4ef35",
1366
+ index: 4,
1367
+ timestamp: "2025-02-01T06:14:12.000Z",
1368
+ to: "0xf70da97812cb96acdf810712aa562db8dfa3dbef",
1369
+ tokenType: "NATIVE",
1370
+ transactionGasFee: 6389164250000n,
1371
+ transactionHash: "0xc0e1850d24af965e6a02836301a696e9f021b07fed765d8affe3bda1846d5700"
1372
+ }
1373
+ ]
1374
+ },
1297
1375
  {
1298
1376
  params: {
1299
1377
  network: "POLYGON",
@@ -1389,6 +1467,23 @@ const $2e46ec862e47c14f$export$400f08bfae9ee97f = {
1389
1467
  if (!Array.isArray(typedBlock.transactions)) return [];
1390
1468
  for (const typedTx of typedBlock.transactions || []){
1391
1469
  if (typedTx.TransactionType !== "Payment") continue;
1470
+ // Failed XRPL payments still burn Fee. Emit a fee-only transfer (to: null) so
1471
+ // callers account for the gas, and skip the payment amount that never landed.
1472
+ if (typedTx.metaData?.TransactionResult && typedTx.metaData.TransactionResult !== "tesSUCCESS") {
1473
+ transfers.push({
1474
+ amount: BigInt(typedTx.Fee ?? "0"),
1475
+ blockNumber: parseInt(typedBlock.ledger_index, 10),
1476
+ from: typedTx.Account ?? "UNKNOWN",
1477
+ memo: typedTx.DestinationTag,
1478
+ timestamp: typedBlock.close_time_iso || null,
1479
+ to: null,
1480
+ token: "XRP",
1481
+ tokenType: "NATIVE",
1482
+ transactionGasFee: BigInt(typedTx.Fee ?? "0"),
1483
+ transactionHash: typedTx.hash ?? ""
1484
+ });
1485
+ continue;
1486
+ }
1392
1487
  const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? "0";
1393
1488
  let tokenSymbol = "XRP";
1394
1489
  let tokenType = "NATIVE";
@@ -1437,6 +1532,45 @@ const $2e46ec862e47c14f$export$400f08bfae9ee97f = {
1437
1532
  transactionHash: "B32A6A5455777283212407FBD8CCA701505C654E5F4ADFFBE9D4D22F00889D87"
1438
1533
  }
1439
1534
  ]
1535
+ },
1536
+ // Failed XRPL payments emit ONLY a fee transfer (to: null) — the payment Amount
1537
+ // never reached the Destination, but the Fee was still burned.
1538
+ {
1539
+ params: {
1540
+ network: "RIPPLE"
1541
+ },
1542
+ payload: {
1543
+ _network: "RIPPLE",
1544
+ ledger_index: "100000000",
1545
+ close_time_iso: "2026-04-04T08:02:44Z",
1546
+ transactions: [
1547
+ {
1548
+ TransactionType: "Payment",
1549
+ Account: "rFAILFROMxxxxxxxxxxxxxxxxxxxxxxxxx",
1550
+ Destination: "rFAILTOxxxxxxxxxxxxxxxxxxxxxxxxxx",
1551
+ Amount: "1000000",
1552
+ Fee: "10",
1553
+ hash: "FAILEDXRPLTXHASH",
1554
+ metaData: {
1555
+ TransactionResult: "tecPATH_DRY"
1556
+ }
1557
+ }
1558
+ ]
1559
+ },
1560
+ output: [
1561
+ {
1562
+ amount: 10n,
1563
+ blockNumber: 100000000,
1564
+ from: "rFAILFROMxxxxxxxxxxxxxxxxxxxxxxxxx",
1565
+ memo: undefined,
1566
+ timestamp: "2026-04-04T08:02:44Z",
1567
+ to: null,
1568
+ token: "XRP",
1569
+ tokenType: "NATIVE",
1570
+ transactionGasFee: 10n,
1571
+ transactionHash: "FAILEDXRPLTXHASH"
1572
+ }
1573
+ ]
1440
1574
  }
1441
1575
  ]
1442
1576
  };
@@ -3173,6 +3307,23 @@ const $3478cd776d185339$export$681f497010b17679 = {
3173
3307
  let transfers = [];
3174
3308
  const typedBlock = block;
3175
3309
  for (const typedTx of typedBlock.transactions || []){
3310
+ // Failed txs still burn fee_charged — emit a fee transfer (to: null) so callers
3311
+ // can account for the gas, but skip the payment ops that never actually moved funds.
3312
+ if (!typedTx.successful) {
3313
+ transfers.push({
3314
+ amount: BigInt(typedTx.fee_charged),
3315
+ blockNumber: typedBlock.sequence,
3316
+ from: typedTx.source_account,
3317
+ memo: typedTx.memo,
3318
+ timestamp: typedTx.created_at,
3319
+ to: null,
3320
+ token: null,
3321
+ tokenType: "NATIVE",
3322
+ transactionGasFee: BigInt(typedTx.fee_charged),
3323
+ transactionHash: typedTx.hash
3324
+ });
3325
+ continue;
3326
+ }
3176
3327
  for (const op of typedTx.operations)if (op.type === "payment") transfers.push({
3177
3328
  amount: BigInt(op.amount.replace(".", "")),
3178
3329
  blockNumber: typedBlock.sequence,
@@ -3221,6 +3372,31 @@ const $3478cd776d185339$export$681f497010b17679 = {
3221
3372
  transactionHash: "c554aed41145304e03c0877c9de526cdcb8a8255c9bf156ff0dec202ab12e20d"
3222
3373
  }
3223
3374
  ]
3375
+ },
3376
+ // Failed Stellar txs emit ONLY a fee transfer (to: null), never the failed payment
3377
+ // operations. Ledger 61961851 / tx 9024ba4b... is the Mesh incident — the source
3378
+ // tried to send 1_000_000_000 stroops to GAGLH6..., the tx reverted, and the only
3379
+ // on-chain effect was the 100-stroop fee being charged.
3380
+ {
3381
+ params: {
3382
+ network: "STELLAR",
3383
+ transactionHash: "9024ba4b558b09042cb02afd1d46eea72597891691801375acee332273c5c26d"
3384
+ },
3385
+ payload: "https://jiti.indexing.co/networks/stellar/61961851",
3386
+ output: [
3387
+ {
3388
+ amount: 100n,
3389
+ blockNumber: 61961851,
3390
+ from: "GCP7I54JXTOZ4SJG4UARWJOMJ25JQXRHSHXQWDSV4TRVRJFDG67VUEXP",
3391
+ memo: undefined,
3392
+ timestamp: "2026-04-04T08:02:44Z",
3393
+ to: null,
3394
+ token: null,
3395
+ tokenType: "NATIVE",
3396
+ transactionGasFee: 100n,
3397
+ transactionHash: "9024ba4b558b09042cb02afd1d46eea72597891691801375acee332273c5c26d"
3398
+ }
3399
+ ]
3224
3400
  }
3225
3401
  ]
3226
3402
  };