@indexing/jiti 0.1.19 → 0.1.21

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
@@ -2183,11 +2183,17 @@ const $2e46ec862e47c14f$export$400f08bfae9ee97f = {
2183
2183
  const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? "0";
2184
2184
  let tokenSymbol = "XRP";
2185
2185
  let tokenType = "NATIVE";
2186
+ // An issued currency is uniquely identified by (currency, issuer) — two "USD"
2187
+ // IOUs from different issuers are distinct tokens. Emit the token id as
2188
+ // `<currency>.<issuer>` so consumers can match by issuer; native XRP has no
2189
+ // issuer and keeps the bare "XRP" symbol.
2190
+ let issuer;
2186
2191
  let parsedAmount;
2187
2192
  // Only issued currencies carry an explicit scale; native XRP stays in integer drops.
2188
2193
  let decimals;
2189
2194
  if (typeof deliveredOrAmount === "object") {
2190
2195
  tokenSymbol = $2e46ec862e47c14f$var$decodeXrplCurrency(deliveredOrAmount.currency);
2196
+ issuer = deliveredOrAmount.issuer;
2191
2197
  tokenType = "TOKEN";
2192
2198
  const scaled = $2e46ec862e47c14f$var$xrplIssuedValueToAmount(deliveredOrAmount.value);
2193
2199
  parsedAmount = scaled.amount;
@@ -2203,7 +2209,7 @@ const $2e46ec862e47c14f$export$400f08bfae9ee97f = {
2203
2209
  memo: typedTx.DestinationTag,
2204
2210
  timestamp: typedBlock.close_time_iso || null,
2205
2211
  to: typedTx.Destination ?? "UNKNOWN",
2206
- token: tokenSymbol,
2212
+ token: issuer ? `${tokenSymbol}.${issuer}` : tokenSymbol,
2207
2213
  tokenType: tokenType,
2208
2214
  transactionGasFee: BigInt(typedTx.Fee ?? "0"),
2209
2215
  transactionHash: typedTx.hash ?? ""
@@ -2311,7 +2317,7 @@ const $2e46ec862e47c14f$export$400f08bfae9ee97f = {
2311
2317
  memo: undefined,
2312
2318
  timestamp: "2026-01-01T00:00:00Z",
2313
2319
  to: "rBITXTOxxxxxxxxxxxxxxxxxxxxxxxxxxx",
2314
- token: "BITx",
2320
+ token: "BITx.rBitcoiNXev8VoVxV7pwoQx1sSfonVP9i3",
2315
2321
  tokenType: "TOKEN",
2316
2322
  transactionGasFee: 12n,
2317
2323
  transactionHash: "BITXSMALLHASH"
@@ -2354,7 +2360,7 @@ const $2e46ec862e47c14f$export$400f08bfae9ee97f = {
2354
2360
  memo: undefined,
2355
2361
  timestamp: "2026-01-01T00:00:00Z",
2356
2362
  to: "rUSDTOxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
2357
- token: "USD",
2363
+ token: "USD.rIssuerxxxxxxxxxxxxxxxxxxxxxxxxxxx",
2358
2364
  tokenType: "TOKEN",
2359
2365
  transactionGasFee: 15n,
2360
2366
  transactionHash: "USDWHOLEHASH"
@@ -2397,7 +2403,7 @@ const $2e46ec862e47c14f$export$400f08bfae9ee97f = {
2397
2403
  memo: undefined,
2398
2404
  timestamp: "2026-01-01T00:00:00Z",
2399
2405
  to: "rMAGTOxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
2400
- token: "MAG",
2406
+ token: "MAG.rXmagwMmnFtVet3uL26Q2iwk287SRvVMJ",
2401
2407
  tokenType: "TOKEN",
2402
2408
  transactionGasFee: 10n,
2403
2409
  transactionHash: "MAGSCIHASH"
@@ -4509,6 +4515,30 @@ function $cd430dd11c31e572$var$decodeJettonInternalTransfer(body) {
4509
4515
  return null;
4510
4516
  }
4511
4517
  }
4518
+ // Other TEP-74 jetton messages whose `in_msg.value` is only forwarded gas or a
4519
+ // refund — never a user-facing TON transfer. Emitting a native transfer for
4520
+ // these surfaces phantom TON hops around every jetton send:
4521
+ // 0x0f8a7ea5 transfer — owner → own jetton wallet (attached gas)
4522
+ // 0x7362d09c transfer_notification — jetton wallet → owner (forwarded gas)
4523
+ // 0xd53276db excesses — jetton wallet → response addr (gas refund)
4524
+ // `internal_transfer` (0x178d4519) is handled above as the jetton TOKEN row.
4525
+ const $cd430dd11c31e572$var$JETTON_GAS_ONLY_OPS = new Set([
4526
+ 0x0f8a7ea5,
4527
+ 0x7362d09c,
4528
+ 0xd53276db
4529
+ ]);
4530
+ // True when the message body carries one of the jetton gas-only op-codes above.
4531
+ // Reads only the 32-bit op-code; returns false for text comments, empty/non-BoC
4532
+ // bodies, or any other op — which fall through to the native path.
4533
+ function $cd430dd11c31e572$var$isJettonGasOnlyMessage(body) {
4534
+ if (!body) return false;
4535
+ try {
4536
+ const slice = (0, $8zHUo$toncore.Cell).fromBoc($cd430dd11c31e572$require$Buffer.from(body, "base64"))[0].beginParse();
4537
+ return $cd430dd11c31e572$var$JETTON_GAS_ONLY_OPS.has(slice.loadUint(32));
4538
+ } catch {
4539
+ return false;
4540
+ }
4541
+ }
4512
4542
  const $cd430dd11c31e572$export$608f3f42810b9879 = {
4513
4543
  match: (block)=>(0, $6bd2ca253e883278$export$ae001c77434c5340)(block) === "TON",
4514
4544
  transform (block) {
@@ -4552,6 +4582,11 @@ const $cd430dd11c31e572$export$608f3f42810b9879 = {
4552
4582
  });
4553
4583
  continue;
4554
4584
  }
4585
+ // A jetton send's own gas hops (transfer / transfer_notification /
4586
+ // excesses) carry `in_msg.value` as forwarded gas, not a real TON
4587
+ // transfer — skip them so they don't surface as phantom native transfers
4588
+ // alongside the jetton `internal_transfer` row emitted above.
4589
+ if ($cd430dd11c31e572$var$isJettonGasOnlyMessage(inMsg.msg_data?.body)) continue;
4555
4590
  const inValue = BigInt(inMsg.value || "0");
4556
4591
  if (inValue > 0n) transfers.push({
4557
4592
  blockNumber: blockNumber,
@@ -4611,6 +4646,123 @@ const $cd430dd11c31e572$export$608f3f42810b9879 = {
4611
4646
  transactionGasFee: 233386n
4612
4647
  }
4613
4648
  ]
4649
+ },
4650
+ {
4651
+ // Jetton gas hops must not surface as native transfers. Synthetic block
4652
+ // (inline payload, no network) with four txs: a genuine native transfer,
4653
+ // an `excesses` (0xd53276db), a `transfer_notification` (0x7362d09c), and a
4654
+ // jetton `internal_transfer` (0x178d4519). Only the native and the jetton
4655
+ // rows survive; the two gas-only ops are dropped despite carrying value.
4656
+ params: {
4657
+ network: "TON"
4658
+ },
4659
+ payload: {
4660
+ _network: "TON",
4661
+ seqno: 76697922,
4662
+ shards: [
4663
+ {
4664
+ transactions: [
4665
+ {
4666
+ address: {
4667
+ account_address: "EQrecipient_native"
4668
+ },
4669
+ utime: 1782844609,
4670
+ fee: "100",
4671
+ transaction_id: {
4672
+ hash: "native-hash"
4673
+ },
4674
+ in_msg: {
4675
+ value: "1000000000",
4676
+ source: {
4677
+ account_address: "EQsender_native"
4678
+ },
4679
+ msg_data: {}
4680
+ }
4681
+ },
4682
+ {
4683
+ address: {
4684
+ account_address: "EQsubject"
4685
+ },
4686
+ utime: 1782844609,
4687
+ fee: "100",
4688
+ transaction_id: {
4689
+ hash: "excesses-hash"
4690
+ },
4691
+ in_msg: {
4692
+ value: "49490794",
4693
+ source: {
4694
+ account_address: "EQjetton_wallet"
4695
+ },
4696
+ msg_data: {
4697
+ body: (0, $8zHUo$toncore.beginCell)().storeUint(0xd53276db, 32).storeUint(0, 64).endCell().toBoc().toString("base64")
4698
+ }
4699
+ }
4700
+ },
4701
+ {
4702
+ address: {
4703
+ account_address: "EQowner"
4704
+ },
4705
+ utime: 1782844609,
4706
+ fee: "100",
4707
+ transaction_id: {
4708
+ hash: "notification-hash"
4709
+ },
4710
+ in_msg: {
4711
+ value: "49490794",
4712
+ source: {
4713
+ account_address: "EQowner_jetton_wallet"
4714
+ },
4715
+ msg_data: {
4716
+ body: (0, $8zHUo$toncore.beginCell)().storeUint(0x7362d09c, 32).storeUint(0, 64).endCell().toBoc().toString("base64")
4717
+ }
4718
+ }
4719
+ },
4720
+ {
4721
+ address: {
4722
+ account_address: "EQrecipient_jetton_wallet"
4723
+ },
4724
+ utime: 1782844609,
4725
+ fee: "200",
4726
+ transaction_id: {
4727
+ hash: "jetton-hash"
4728
+ },
4729
+ in_msg: {
4730
+ value: "49740664",
4731
+ source: {
4732
+ account_address: "EQsender_jetton_wallet"
4733
+ },
4734
+ msg_data: {
4735
+ body: (0, $8zHUo$toncore.beginCell)().storeUint(0x178d4519, 32).storeUint(0, 64).storeCoins(2800000000n).storeAddress(null).endCell().toBoc().toString("base64")
4736
+ }
4737
+ }
4738
+ }
4739
+ ]
4740
+ }
4741
+ ]
4742
+ },
4743
+ output: [
4744
+ {
4745
+ blockNumber: 76697922,
4746
+ from: "EQsender_native",
4747
+ to: "EQrecipient_native",
4748
+ amount: 1000000000n,
4749
+ token: "TON",
4750
+ tokenType: "NATIVE",
4751
+ timestamp: "2026-06-30T18:36:49.000Z",
4752
+ transactionHash: "native-hash",
4753
+ transactionGasFee: 100n
4754
+ },
4755
+ {
4756
+ blockNumber: 76697922,
4757
+ from: "EQsender_jetton_wallet",
4758
+ to: "EQrecipient_jetton_wallet",
4759
+ amount: 2800000000n,
4760
+ tokenType: "TOKEN",
4761
+ timestamp: "2026-06-30T18:36:49.000Z",
4762
+ transactionHash: "jetton-hash",
4763
+ transactionGasFee: 200n
4764
+ }
4765
+ ]
4614
4766
  }
4615
4767
  ]
4616
4768
  };