@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/main.js CHANGED
@@ -196,6 +196,9 @@ const $6bd2ca253e883278$var$PARTIAL_VM_TO_NETWORK_MAP = {
196
196
  TON: [
197
197
  "TON"
198
198
  ],
199
+ TRON: [
200
+ "TRON"
201
+ ],
199
202
  UTXO: [
200
203
  "BITCOIN",
201
204
  "BITCOIN_TESTNET",
@@ -4769,6 +4772,142 @@ const $cd430dd11c31e572$export$608f3f42810b9879 = {
4769
4772
 
4770
4773
 
4771
4774
 
4775
+
4776
+ const $3ac9986ae4227040$export$3cb99d88eca41d3b = {
4777
+ match: (block)=>(0, $6bd2ca253e883278$export$ae001c77434c5340)(block) === "TRON",
4778
+ transform (block, _ctx = {
4779
+ params: {}
4780
+ }) {
4781
+ // Reuse the full EVM extraction — native TRX + TRC-20 (Transfer logs ride on the
4782
+ // receipts the eth-compat path already fetches).
4783
+ const evmTransfers = (0, $8deaea1ef39b6485$export$5beebc5708fabf3c).transform(block, _ctx);
4784
+ const trc10 = block._trc10 || [];
4785
+ if (!trc10.length) return evmTransfers;
4786
+ const trc10ByHash = new Map(trc10.map((t)=>[
4787
+ t.hash,
4788
+ t
4789
+ ]));
4790
+ const relabeled = new Set();
4791
+ // Relabel the phantom NATIVE that eth-compat produced for each TRC-10 tx (amount
4792
+ // → tx.value) into the real TOKEN row, keeping the EVM-computed block / timestamp
4793
+ // / gas fee and taking the authoritative asset id + amount + owner/to from the
4794
+ // native data.
4795
+ const transfers = evmTransfers.map((t)=>{
4796
+ const match = t.tokenType === "NATIVE" ? trc10ByHash.get(t.transactionHash) : undefined;
4797
+ if (!match) return t;
4798
+ relabeled.add(match.hash);
4799
+ return {
4800
+ ...t,
4801
+ tokenType: "TOKEN",
4802
+ token: match.token,
4803
+ amount: BigInt(match.amount),
4804
+ from: match.from,
4805
+ to: match.to
4806
+ };
4807
+ });
4808
+ // Defensive: a TRC-10 tx that left no phantom NATIVE to relabel (a positive-amount
4809
+ // asset transfer always sets tx.value, so this should not happen — but never drop
4810
+ // a real transfer). Emit it directly, borrowing block/timestamp/fee from any EVM
4811
+ // row on the same tx, else the block header.
4812
+ const evmByHash = new Map(evmTransfers.map((t)=>[
4813
+ t.transactionHash,
4814
+ t
4815
+ ]));
4816
+ const typedBlock = block;
4817
+ for (const m of trc10){
4818
+ if (relabeled.has(m.hash)) continue;
4819
+ const ref = evmByHash.get(m.hash);
4820
+ transfers.push({
4821
+ amount: BigInt(m.amount),
4822
+ blockNumber: ref?.blockNumber ?? Number(typedBlock.number),
4823
+ from: m.from,
4824
+ timestamp: ref?.timestamp ?? new Date(typedBlock.timestamp * 1000).toISOString(),
4825
+ to: m.to,
4826
+ token: m.token,
4827
+ tokenType: "TOKEN",
4828
+ transactionGasFee: ref?.transactionGasFee ?? 0n,
4829
+ transactionHash: m.hash
4830
+ });
4831
+ }
4832
+ return transfers;
4833
+ },
4834
+ tests: [
4835
+ {
4836
+ // Synthetic TRON block: a native TRX transfer and a TRC-10 transfer. The TRC-10
4837
+ // arrives EVM-shaped (its amount in `tx.value`, empty logs) so EVM emits a
4838
+ // phantom NATIVE; the `_trc10` supplement (asset id 1005168, à la Mircea's
4839
+ // Pay.bi repro) relabels it to a TOKEN, while the genuine native TRX is untouched.
4840
+ params: {
4841
+ network: "TRON"
4842
+ },
4843
+ payload: {
4844
+ _network: "TRON",
4845
+ number: 84058381,
4846
+ timestamp: 1782844609,
4847
+ transactions: [
4848
+ {
4849
+ hash: "native-trx-hash",
4850
+ blockNumber: 84058381,
4851
+ from: "0x1111111111111111111111111111111111111111",
4852
+ to: "0x2222222222222222222222222222222222222222",
4853
+ value: "1000000",
4854
+ receipt: {
4855
+ gasUsed: "0",
4856
+ logs: []
4857
+ }
4858
+ },
4859
+ {
4860
+ hash: "trc10-hash",
4861
+ blockNumber: 84058381,
4862
+ from: "0x3333333333333333333333333333333333333333",
4863
+ to: "0x4444444444444444444444444444444444444444",
4864
+ // eth-compat mapped the TRC-10 amount into value; asset id is gone here.
4865
+ value: "4444444444",
4866
+ receipt: {
4867
+ gasUsed: "0",
4868
+ logs: []
4869
+ }
4870
+ }
4871
+ ],
4872
+ _trc10: [
4873
+ {
4874
+ hash: "trc10-hash",
4875
+ token: "1005168",
4876
+ amount: "4444444444",
4877
+ from: "0x3333333333333333333333333333333333333333",
4878
+ to: "0x4444444444444444444444444444444444444444"
4879
+ }
4880
+ ]
4881
+ },
4882
+ output: [
4883
+ {
4884
+ amount: 1000000n,
4885
+ blockNumber: 84058381,
4886
+ from: "0x1111111111111111111111111111111111111111",
4887
+ timestamp: "2026-06-30T18:36:49.000Z",
4888
+ to: "0x2222222222222222222222222222222222222222",
4889
+ tokenType: "NATIVE",
4890
+ transactionGasFee: 0n,
4891
+ transactionHash: "native-trx-hash"
4892
+ },
4893
+ {
4894
+ amount: 4444444444n,
4895
+ blockNumber: 84058381,
4896
+ from: "0x3333333333333333333333333333333333333333",
4897
+ timestamp: "2026-06-30T18:36:49.000Z",
4898
+ to: "0x4444444444444444444444444444444444444444",
4899
+ token: "1005168",
4900
+ tokenType: "TOKEN",
4901
+ transactionGasFee: 0n,
4902
+ transactionHash: "trc10-hash"
4903
+ }
4904
+ ]
4905
+ }
4906
+ ]
4907
+ };
4908
+
4909
+
4910
+
4772
4911
  const $990c4f660694d8bc$export$4f5322cf4718bd30 = {
4773
4912
  match: (block)=>(0, $6bd2ca253e883278$export$ae001c77434c5340)(block) === "UTXO",
4774
4913
  transform (block) {
@@ -4852,6 +4991,7 @@ const $7dd402f6ad0dab6a$var$SUB_TEMPLATES = [
4852
4991
  (0, $11a2c5b0fd56c033$export$bc6c7ab7e0727dd7),
4853
4992
  (0, $3b9b8f5747dcca8e$export$722698bc663d0ac0),
4854
4993
  (0, $cd430dd11c31e572$export$608f3f42810b9879),
4994
+ (0, $3ac9986ae4227040$export$3cb99d88eca41d3b),
4855
4995
  (0, $990c4f660694d8bc$export$4f5322cf4718bd30)
4856
4996
  ];
4857
4997
  const $7dd402f6ad0dab6a$var$UNIVERSAL_SUB_TEMPLATES = [
@@ -12677,6 +12817,9 @@ var $4828ba704a8a504f$exports = {};
12677
12817
  // Samples: 3
12678
12818
 
12679
12819
 
12820
+ var $1683c098f2192b9f$exports = {};
12821
+
12822
+
12680
12823
  var $4a8e5fd52443a474$exports = {};
12681
12824
  // Auto-generated by scripts/generate-block-types.ts
12682
12825
  // Generated: 2026-03-17
@@ -12705,6 +12848,7 @@ $parcel$exportWildcard($b4b970cc11bce2a5$exports, $2c47a7d2c09ba685$exports);
12705
12848
  $parcel$exportWildcard($b4b970cc11bce2a5$exports, $de65544ccdf7550c$exports);
12706
12849
  $parcel$exportWildcard($b4b970cc11bce2a5$exports, $bfa1637983c7bdd8$exports);
12707
12850
  $parcel$exportWildcard($b4b970cc11bce2a5$exports, $4828ba704a8a504f$exports);
12851
+ $parcel$exportWildcard($b4b970cc11bce2a5$exports, $1683c098f2192b9f$exports);
12708
12852
  $parcel$exportWildcard($b4b970cc11bce2a5$exports, $4a8e5fd52443a474$exports);
12709
12853
 
12710
12854