@indexing/jiti 0.1.21 → 0.1.22

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
@@ -178,6 +178,9 @@ const $09654dffcb68affa$var$PARTIAL_VM_TO_NETWORK_MAP = {
178
178
  TON: [
179
179
  "TON"
180
180
  ],
181
+ TRON: [
182
+ "TRON"
183
+ ],
181
184
  UTXO: [
182
185
  "BITCOIN",
183
186
  "BITCOIN_TESTNET",
@@ -4751,6 +4754,142 @@ const $e97546fe39f2692a$export$608f3f42810b9879 = {
4751
4754
 
4752
4755
 
4753
4756
 
4757
+
4758
+ const $7de02413bc6a8204$export$3cb99d88eca41d3b = {
4759
+ match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "TRON",
4760
+ transform (block, _ctx = {
4761
+ params: {}
4762
+ }) {
4763
+ // Reuse the full EVM extraction — native TRX + TRC-20 (Transfer logs ride on the
4764
+ // receipts the eth-compat path already fetches).
4765
+ const evmTransfers = (0, $5ec62a2088d070a8$export$5beebc5708fabf3c).transform(block, _ctx);
4766
+ const trc10 = block._trc10 || [];
4767
+ if (!trc10.length) return evmTransfers;
4768
+ const trc10ByHash = new Map(trc10.map((t)=>[
4769
+ t.hash,
4770
+ t
4771
+ ]));
4772
+ const relabeled = new Set();
4773
+ // Relabel the phantom NATIVE that eth-compat produced for each TRC-10 tx (amount
4774
+ // → tx.value) into the real TOKEN row, keeping the EVM-computed block / timestamp
4775
+ // / gas fee and taking the authoritative asset id + amount + owner/to from the
4776
+ // native data.
4777
+ const transfers = evmTransfers.map((t)=>{
4778
+ const match = t.tokenType === "NATIVE" ? trc10ByHash.get(t.transactionHash) : undefined;
4779
+ if (!match) return t;
4780
+ relabeled.add(match.hash);
4781
+ return {
4782
+ ...t,
4783
+ tokenType: "TOKEN",
4784
+ token: match.token,
4785
+ amount: BigInt(match.amount),
4786
+ from: match.from,
4787
+ to: match.to
4788
+ };
4789
+ });
4790
+ // Defensive: a TRC-10 tx that left no phantom NATIVE to relabel (a positive-amount
4791
+ // asset transfer always sets tx.value, so this should not happen — but never drop
4792
+ // a real transfer). Emit it directly, borrowing block/timestamp/fee from any EVM
4793
+ // row on the same tx, else the block header.
4794
+ const evmByHash = new Map(evmTransfers.map((t)=>[
4795
+ t.transactionHash,
4796
+ t
4797
+ ]));
4798
+ const typedBlock = block;
4799
+ for (const m of trc10){
4800
+ if (relabeled.has(m.hash)) continue;
4801
+ const ref = evmByHash.get(m.hash);
4802
+ transfers.push({
4803
+ amount: BigInt(m.amount),
4804
+ blockNumber: ref?.blockNumber ?? Number(typedBlock.number),
4805
+ from: m.from,
4806
+ timestamp: ref?.timestamp ?? new Date(typedBlock.timestamp * 1000).toISOString(),
4807
+ to: m.to,
4808
+ token: m.token,
4809
+ tokenType: "TOKEN",
4810
+ transactionGasFee: ref?.transactionGasFee ?? 0n,
4811
+ transactionHash: m.hash
4812
+ });
4813
+ }
4814
+ return transfers;
4815
+ },
4816
+ tests: [
4817
+ {
4818
+ // Synthetic TRON block: a native TRX transfer and a TRC-10 transfer. The TRC-10
4819
+ // arrives EVM-shaped (its amount in `tx.value`, empty logs) so EVM emits a
4820
+ // phantom NATIVE; the `_trc10` supplement (asset id 1005168, à la Mircea's
4821
+ // Pay.bi repro) relabels it to a TOKEN, while the genuine native TRX is untouched.
4822
+ params: {
4823
+ network: "TRON"
4824
+ },
4825
+ payload: {
4826
+ _network: "TRON",
4827
+ number: 84058381,
4828
+ timestamp: 1782844609,
4829
+ transactions: [
4830
+ {
4831
+ hash: "native-trx-hash",
4832
+ blockNumber: 84058381,
4833
+ from: "0x1111111111111111111111111111111111111111",
4834
+ to: "0x2222222222222222222222222222222222222222",
4835
+ value: "1000000",
4836
+ receipt: {
4837
+ gasUsed: "0",
4838
+ logs: []
4839
+ }
4840
+ },
4841
+ {
4842
+ hash: "trc10-hash",
4843
+ blockNumber: 84058381,
4844
+ from: "0x3333333333333333333333333333333333333333",
4845
+ to: "0x4444444444444444444444444444444444444444",
4846
+ // eth-compat mapped the TRC-10 amount into value; asset id is gone here.
4847
+ value: "4444444444",
4848
+ receipt: {
4849
+ gasUsed: "0",
4850
+ logs: []
4851
+ }
4852
+ }
4853
+ ],
4854
+ _trc10: [
4855
+ {
4856
+ hash: "trc10-hash",
4857
+ token: "1005168",
4858
+ amount: "4444444444",
4859
+ from: "0x3333333333333333333333333333333333333333",
4860
+ to: "0x4444444444444444444444444444444444444444"
4861
+ }
4862
+ ]
4863
+ },
4864
+ output: [
4865
+ {
4866
+ amount: 1000000n,
4867
+ blockNumber: 84058381,
4868
+ from: "0x1111111111111111111111111111111111111111",
4869
+ timestamp: "2026-06-30T18:36:49.000Z",
4870
+ to: "0x2222222222222222222222222222222222222222",
4871
+ tokenType: "NATIVE",
4872
+ transactionGasFee: 0n,
4873
+ transactionHash: "native-trx-hash"
4874
+ },
4875
+ {
4876
+ amount: 4444444444n,
4877
+ blockNumber: 84058381,
4878
+ from: "0x3333333333333333333333333333333333333333",
4879
+ timestamp: "2026-06-30T18:36:49.000Z",
4880
+ to: "0x4444444444444444444444444444444444444444",
4881
+ token: "1005168",
4882
+ tokenType: "TOKEN",
4883
+ transactionGasFee: 0n,
4884
+ transactionHash: "trc10-hash"
4885
+ }
4886
+ ]
4887
+ }
4888
+ ]
4889
+ };
4890
+
4891
+
4892
+
4754
4893
  const $532fac82d96b89f2$export$4f5322cf4718bd30 = {
4755
4894
  match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "UTXO",
4756
4895
  transform (block) {
@@ -4834,6 +4973,7 @@ const $0ab1acc1eff391f6$var$SUB_TEMPLATES = [
4834
4973
  (0, $13c3ff41f568666f$export$bc6c7ab7e0727dd7),
4835
4974
  (0, $f9f6601c9222cc8e$export$722698bc663d0ac0),
4836
4975
  (0, $e97546fe39f2692a$export$608f3f42810b9879),
4976
+ (0, $7de02413bc6a8204$export$3cb99d88eca41d3b),
4837
4977
  (0, $532fac82d96b89f2$export$4f5322cf4718bd30)
4838
4978
  ];
4839
4979
  const $0ab1acc1eff391f6$var$UNIVERSAL_SUB_TEMPLATES = [
@@ -12659,6 +12799,9 @@ var $f3761421850600fb$exports = {};
12659
12799
  // Samples: 3
12660
12800
 
12661
12801
 
12802
+ var $ff207d45a6836c21$exports = {};
12803
+
12804
+
12662
12805
  var $e64a550a52a9d690$exports = {};
12663
12806
  // Auto-generated by scripts/generate-block-types.ts
12664
12807
  // Generated: 2026-03-17
@@ -12687,6 +12830,7 @@ $parcel$exportWildcard($a4e0e4b4a62175c4$exports, $e964f2aee2d00bfe$exports);
12687
12830
  $parcel$exportWildcard($a4e0e4b4a62175c4$exports, $bb1ffb53a3b14860$exports);
12688
12831
  $parcel$exportWildcard($a4e0e4b4a62175c4$exports, $480b559416e5cd89$exports);
12689
12832
  $parcel$exportWildcard($a4e0e4b4a62175c4$exports, $f3761421850600fb$exports);
12833
+ $parcel$exportWildcard($a4e0e4b4a62175c4$exports, $ff207d45a6836c21$exports);
12690
12834
  $parcel$exportWildcard($a4e0e4b4a62175c4$exports, $e64a550a52a9d690$exports);
12691
12835
 
12692
12836