@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/module.js CHANGED
@@ -3,7 +3,7 @@ import {sha256 as $hgUW1$sha256, keccak256 as $hgUW1$keccak256, decodeEventLog a
3
3
  import $hgUW1$tronweb from "tronweb";
4
4
  import {decodeTxRaw as $hgUW1$decodeTxRaw, Registry as $hgUW1$Registry} from "@cosmjs/proto-signing";
5
5
  import {defaultRegistryTypes as $hgUW1$defaultRegistryTypes} from "@cosmjs/stargate";
6
- import {Address as $hgUW1$Address, Cell as $hgUW1$Cell} from "@ton/core";
6
+ import {Address as $hgUW1$Address, Cell as $hgUW1$Cell, beginCell as $hgUW1$beginCell} from "@ton/core";
7
7
  import $hgUW1$bs58 from "bs58";
8
8
 
9
9
 
@@ -2165,11 +2165,17 @@ const $07b3982e2fc4c8b2$export$400f08bfae9ee97f = {
2165
2165
  const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? "0";
2166
2166
  let tokenSymbol = "XRP";
2167
2167
  let tokenType = "NATIVE";
2168
+ // An issued currency is uniquely identified by (currency, issuer) — two "USD"
2169
+ // IOUs from different issuers are distinct tokens. Emit the token id as
2170
+ // `<currency>.<issuer>` so consumers can match by issuer; native XRP has no
2171
+ // issuer and keeps the bare "XRP" symbol.
2172
+ let issuer;
2168
2173
  let parsedAmount;
2169
2174
  // Only issued currencies carry an explicit scale; native XRP stays in integer drops.
2170
2175
  let decimals;
2171
2176
  if (typeof deliveredOrAmount === "object") {
2172
2177
  tokenSymbol = $07b3982e2fc4c8b2$var$decodeXrplCurrency(deliveredOrAmount.currency);
2178
+ issuer = deliveredOrAmount.issuer;
2173
2179
  tokenType = "TOKEN";
2174
2180
  const scaled = $07b3982e2fc4c8b2$var$xrplIssuedValueToAmount(deliveredOrAmount.value);
2175
2181
  parsedAmount = scaled.amount;
@@ -2185,7 +2191,7 @@ const $07b3982e2fc4c8b2$export$400f08bfae9ee97f = {
2185
2191
  memo: typedTx.DestinationTag,
2186
2192
  timestamp: typedBlock.close_time_iso || null,
2187
2193
  to: typedTx.Destination ?? "UNKNOWN",
2188
- token: tokenSymbol,
2194
+ token: issuer ? `${tokenSymbol}.${issuer}` : tokenSymbol,
2189
2195
  tokenType: tokenType,
2190
2196
  transactionGasFee: BigInt(typedTx.Fee ?? "0"),
2191
2197
  transactionHash: typedTx.hash ?? ""
@@ -2293,7 +2299,7 @@ const $07b3982e2fc4c8b2$export$400f08bfae9ee97f = {
2293
2299
  memo: undefined,
2294
2300
  timestamp: "2026-01-01T00:00:00Z",
2295
2301
  to: "rBITXTOxxxxxxxxxxxxxxxxxxxxxxxxxxx",
2296
- token: "BITx",
2302
+ token: "BITx.rBitcoiNXev8VoVxV7pwoQx1sSfonVP9i3",
2297
2303
  tokenType: "TOKEN",
2298
2304
  transactionGasFee: 12n,
2299
2305
  transactionHash: "BITXSMALLHASH"
@@ -2336,7 +2342,7 @@ const $07b3982e2fc4c8b2$export$400f08bfae9ee97f = {
2336
2342
  memo: undefined,
2337
2343
  timestamp: "2026-01-01T00:00:00Z",
2338
2344
  to: "rUSDTOxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
2339
- token: "USD",
2345
+ token: "USD.rIssuerxxxxxxxxxxxxxxxxxxxxxxxxxxx",
2340
2346
  tokenType: "TOKEN",
2341
2347
  transactionGasFee: 15n,
2342
2348
  transactionHash: "USDWHOLEHASH"
@@ -2379,7 +2385,7 @@ const $07b3982e2fc4c8b2$export$400f08bfae9ee97f = {
2379
2385
  memo: undefined,
2380
2386
  timestamp: "2026-01-01T00:00:00Z",
2381
2387
  to: "rMAGTOxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
2382
- token: "MAG",
2388
+ token: "MAG.rXmagwMmnFtVet3uL26Q2iwk287SRvVMJ",
2383
2389
  tokenType: "TOKEN",
2384
2390
  transactionGasFee: 10n,
2385
2391
  transactionHash: "MAGSCIHASH"
@@ -4491,6 +4497,30 @@ function $e97546fe39f2692a$var$decodeJettonInternalTransfer(body) {
4491
4497
  return null;
4492
4498
  }
4493
4499
  }
4500
+ // Other TEP-74 jetton messages whose `in_msg.value` is only forwarded gas or a
4501
+ // refund — never a user-facing TON transfer. Emitting a native transfer for
4502
+ // these surfaces phantom TON hops around every jetton send:
4503
+ // 0x0f8a7ea5 transfer — owner → own jetton wallet (attached gas)
4504
+ // 0x7362d09c transfer_notification — jetton wallet → owner (forwarded gas)
4505
+ // 0xd53276db excesses — jetton wallet → response addr (gas refund)
4506
+ // `internal_transfer` (0x178d4519) is handled above as the jetton TOKEN row.
4507
+ const $e97546fe39f2692a$var$JETTON_GAS_ONLY_OPS = new Set([
4508
+ 0x0f8a7ea5,
4509
+ 0x7362d09c,
4510
+ 0xd53276db
4511
+ ]);
4512
+ // True when the message body carries one of the jetton gas-only op-codes above.
4513
+ // Reads only the 32-bit op-code; returns false for text comments, empty/non-BoC
4514
+ // bodies, or any other op — which fall through to the native path.
4515
+ function $e97546fe39f2692a$var$isJettonGasOnlyMessage(body) {
4516
+ if (!body) return false;
4517
+ try {
4518
+ const slice = (0, $hgUW1$Cell).fromBoc($e97546fe39f2692a$require$Buffer.from(body, "base64"))[0].beginParse();
4519
+ return $e97546fe39f2692a$var$JETTON_GAS_ONLY_OPS.has(slice.loadUint(32));
4520
+ } catch {
4521
+ return false;
4522
+ }
4523
+ }
4494
4524
  const $e97546fe39f2692a$export$608f3f42810b9879 = {
4495
4525
  match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "TON",
4496
4526
  transform (block) {
@@ -4534,6 +4564,11 @@ const $e97546fe39f2692a$export$608f3f42810b9879 = {
4534
4564
  });
4535
4565
  continue;
4536
4566
  }
4567
+ // A jetton send's own gas hops (transfer / transfer_notification /
4568
+ // excesses) carry `in_msg.value` as forwarded gas, not a real TON
4569
+ // transfer — skip them so they don't surface as phantom native transfers
4570
+ // alongside the jetton `internal_transfer` row emitted above.
4571
+ if ($e97546fe39f2692a$var$isJettonGasOnlyMessage(inMsg.msg_data?.body)) continue;
4537
4572
  const inValue = BigInt(inMsg.value || "0");
4538
4573
  if (inValue > 0n) transfers.push({
4539
4574
  blockNumber: blockNumber,
@@ -4593,6 +4628,123 @@ const $e97546fe39f2692a$export$608f3f42810b9879 = {
4593
4628
  transactionGasFee: 233386n
4594
4629
  }
4595
4630
  ]
4631
+ },
4632
+ {
4633
+ // Jetton gas hops must not surface as native transfers. Synthetic block
4634
+ // (inline payload, no network) with four txs: a genuine native transfer,
4635
+ // an `excesses` (0xd53276db), a `transfer_notification` (0x7362d09c), and a
4636
+ // jetton `internal_transfer` (0x178d4519). Only the native and the jetton
4637
+ // rows survive; the two gas-only ops are dropped despite carrying value.
4638
+ params: {
4639
+ network: "TON"
4640
+ },
4641
+ payload: {
4642
+ _network: "TON",
4643
+ seqno: 76697922,
4644
+ shards: [
4645
+ {
4646
+ transactions: [
4647
+ {
4648
+ address: {
4649
+ account_address: "EQrecipient_native"
4650
+ },
4651
+ utime: 1782844609,
4652
+ fee: "100",
4653
+ transaction_id: {
4654
+ hash: "native-hash"
4655
+ },
4656
+ in_msg: {
4657
+ value: "1000000000",
4658
+ source: {
4659
+ account_address: "EQsender_native"
4660
+ },
4661
+ msg_data: {}
4662
+ }
4663
+ },
4664
+ {
4665
+ address: {
4666
+ account_address: "EQsubject"
4667
+ },
4668
+ utime: 1782844609,
4669
+ fee: "100",
4670
+ transaction_id: {
4671
+ hash: "excesses-hash"
4672
+ },
4673
+ in_msg: {
4674
+ value: "49490794",
4675
+ source: {
4676
+ account_address: "EQjetton_wallet"
4677
+ },
4678
+ msg_data: {
4679
+ body: (0, $hgUW1$beginCell)().storeUint(0xd53276db, 32).storeUint(0, 64).endCell().toBoc().toString("base64")
4680
+ }
4681
+ }
4682
+ },
4683
+ {
4684
+ address: {
4685
+ account_address: "EQowner"
4686
+ },
4687
+ utime: 1782844609,
4688
+ fee: "100",
4689
+ transaction_id: {
4690
+ hash: "notification-hash"
4691
+ },
4692
+ in_msg: {
4693
+ value: "49490794",
4694
+ source: {
4695
+ account_address: "EQowner_jetton_wallet"
4696
+ },
4697
+ msg_data: {
4698
+ body: (0, $hgUW1$beginCell)().storeUint(0x7362d09c, 32).storeUint(0, 64).endCell().toBoc().toString("base64")
4699
+ }
4700
+ }
4701
+ },
4702
+ {
4703
+ address: {
4704
+ account_address: "EQrecipient_jetton_wallet"
4705
+ },
4706
+ utime: 1782844609,
4707
+ fee: "200",
4708
+ transaction_id: {
4709
+ hash: "jetton-hash"
4710
+ },
4711
+ in_msg: {
4712
+ value: "49740664",
4713
+ source: {
4714
+ account_address: "EQsender_jetton_wallet"
4715
+ },
4716
+ msg_data: {
4717
+ body: (0, $hgUW1$beginCell)().storeUint(0x178d4519, 32).storeUint(0, 64).storeCoins(2800000000n).storeAddress(null).endCell().toBoc().toString("base64")
4718
+ }
4719
+ }
4720
+ }
4721
+ ]
4722
+ }
4723
+ ]
4724
+ },
4725
+ output: [
4726
+ {
4727
+ blockNumber: 76697922,
4728
+ from: "EQsender_native",
4729
+ to: "EQrecipient_native",
4730
+ amount: 1000000000n,
4731
+ token: "TON",
4732
+ tokenType: "NATIVE",
4733
+ timestamp: "2026-06-30T18:36:49.000Z",
4734
+ transactionHash: "native-hash",
4735
+ transactionGasFee: 100n
4736
+ },
4737
+ {
4738
+ blockNumber: 76697922,
4739
+ from: "EQsender_jetton_wallet",
4740
+ to: "EQrecipient_jetton_wallet",
4741
+ amount: 2800000000n,
4742
+ tokenType: "TOKEN",
4743
+ timestamp: "2026-06-30T18:36:49.000Z",
4744
+ transactionHash: "jetton-hash",
4745
+ transactionGasFee: 200n
4746
+ }
4747
+ ]
4596
4748
  }
4597
4749
  ]
4598
4750
  };