@indexing/jiti 0.0.62 → 0.0.64

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,6 @@ 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 * as $hgUW1$process from "process";
7
6
  import $hgUW1$bs58 from "bs58";
8
7
 
9
8
 
@@ -1334,12 +1333,10 @@ const $f9f6601c9222cc8e$export$722698bc663d0ac0 = {
1334
1333
 
1335
1334
 
1336
1335
  var $64e1e522540ffc4e$require$Buffer = $hgUW1$Buffer;
1337
-
1338
1336
  const $64e1e522540ffc4e$var$SYSTEM_PROGRAM = "11111111111111111111111111111111";
1339
1337
  const $64e1e522540ffc4e$var$WSOL_MINT = "So11111111111111111111111111111111111111112";
1340
1338
  const $64e1e522540ffc4e$var$SPL_TOKEN_PROGRAM = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1341
1339
  const $64e1e522540ffc4e$var$SPL_TOKEN_2022_PROGRAM = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
1342
- const $64e1e522540ffc4e$var$ASSOCIATED_TOKEN_ACCOUNT_PROGRAM = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
1343
1340
  const $64e1e522540ffc4e$export$a51565c56ceacb0a = {
1344
1341
  match: (block)=>(0, $09654dffcb68affa$export$ae001c77434c5340)(block) === "SVM",
1345
1342
  transform (block) {
@@ -1398,12 +1395,12 @@ const $64e1e522540ffc4e$export$a51565c56ceacb0a = {
1398
1395
  $64e1e522540ffc4e$var$SPL_TOKEN_2022_PROGRAM
1399
1396
  ].includes(programId)) {
1400
1397
  // TRANSFER, TRANSFER CHECKED
1401
- if (instSig.startsWith("3,") && inst.accounts.length === 3 || instSig.startsWith("12,") && inst.accounts.length === 4) {
1398
+ if (instSig.startsWith("3,") && inst.accounts.length === 3 || instSig.startsWith("12,") && inst.accounts.length >= 4) {
1402
1399
  const amountData = $64e1e522540ffc4e$require$Buffer.from(instData).slice(1, 9);
1403
1400
  if (amountData.length < 8) continue;
1404
1401
  const amount = BigInt(amountData.readBigUInt64LE(0).toString());
1405
1402
  const fromIdx = inst.accounts[0];
1406
- const toIdx = inst.accounts[inst.accounts.length - 2];
1403
+ const toIdx = inst.accounts.length === 5 ? inst.accounts[4] : inst.accounts[inst.accounts.length - 2];
1407
1404
  let from = createdAccountsToOwner[allAccounts[fromIdx]];
1408
1405
  let to = createdAccountsToOwner[allAccounts[toIdx]];
1409
1406
  let mint;
@@ -1418,9 +1415,8 @@ const $64e1e522540ffc4e$export$a51565c56ceacb0a = {
1418
1415
  }
1419
1416
  if (from && to && mint) break;
1420
1417
  }
1421
- // @NOTE: should improve this - currently we assume unknown accounts belong to the signer
1422
- if (!from) from = signer;
1423
- if (!to) to = signer;
1418
+ if (!from) from = allAccounts[fromIdx] || signer;
1419
+ if (!to) to = allAccounts[toIdx] || signer;
1424
1420
  txTransfers.push({
1425
1421
  amount: amount,
1426
1422
  blockNumber: block.parentSlot + 1,
@@ -1759,79 +1755,6 @@ const $64e1e522540ffc4e$export$a51565c56ceacb0a = {
1759
1755
  });
1760
1756
  }
1761
1757
  }
1762
- // @NOTE: special case for thorough testing
1763
- if (typeof $hgUW1$process !== "undefined" && $hgUW1$process?.env?.IS_JITI_TEST === "true") {
1764
- const knownTxsToSkip = [
1765
- // Solscan agrees... pre/post are incorrect
1766
- "4cSa4KtnmymubYYcK7EYtbpMArLLfx3s54NsRg436JXFMmoUudZnUucg6pRWu7xe1qcajp7dhtsNitQpVnFs7fMY",
1767
- // this one is correct, but our check logic doesn't factor multiple token accounts
1768
- "26nHifh1U2gVHztuAF3XXorWn38vuNMyQS4PDMgSfSq6ptE4dT7JjgW4ZRUucWMcMuBBgHbiWYADf3dLUmzuseCX"
1769
- ];
1770
- if (knownTxsToSkip.includes(txHash)) continue;
1771
- const knownTokensToSkip = [
1772
- // these are examples of bad rounding in the pre/post balances based on the instructions (Solscan agrees)
1773
- // these are token specific
1774
- "4kbKgH7aax6wPXJn576N8eamcLKoxZ2WD1a5PF8s2jnA",
1775
- "4zD1Bp7u6PYLEoCM6wR8fVNqj6aJ2P4QLiPD2dBWd5wy",
1776
- "2avgL3YP48N1rcFXwxHNW2whSp6VqQkaZcoTdZ2NLnof",
1777
- "C4Zhp86cKdBq1RobpvBePMQL5VFgjD4Nnzfrv1aRC5Vt",
1778
- "nNMAeUPpqUaUXuZ1jqbUjuB8XPokh4pJHFTxySz6FMr",
1779
- "LLJNRnieVDXb3hz65MS3PWf3sZYDr3huVN2M7J6eMGF"
1780
- ];
1781
- const actualBalanceDiffs = {};
1782
- for(let i = 0; i < svmTx.meta.postBalances.length; i += 1){
1783
- const post = svmTx.meta.postBalances[i];
1784
- const pre = svmTx.meta.preBalances[i];
1785
- const account = allAccounts[i];
1786
- const key = `${account}-null`;
1787
- actualBalanceDiffs[key] = BigInt(post) - BigInt(pre);
1788
- }
1789
- for (const post of svmTx.meta.postTokenBalances){
1790
- const pre = svmTx.meta.preTokenBalances.find((ptb)=>ptb.mint === post.mint && ptb.owner === post.owner && ptb.accountIndex === post.accountIndex);
1791
- const key = `${post.owner}-${post.mint}`;
1792
- actualBalanceDiffs[key] = BigInt(post.uiTokenAmount.amount) - BigInt(pre?.uiTokenAmount.amount || 0);
1793
- }
1794
- for (const pre of svmTx.meta.preTokenBalances){
1795
- const key = `${pre.owner}-${pre.mint}`;
1796
- if (actualBalanceDiffs[key]) continue;
1797
- const post = svmTx.meta.postTokenBalances.find((ptb)=>ptb.mint === pre.mint && ptb.owner === pre.owner && ptb.accountIndex === pre.accountIndex);
1798
- actualBalanceDiffs[key] = BigInt(post?.uiTokenAmount.amount || 0) - BigInt(pre.uiTokenAmount.amount);
1799
- }
1800
- const computedBalanceDiffs = {};
1801
- for (const txfer of txTransfers){
1802
- const keyFrom = `${txfer.from}-${txfer.token || "null"}`;
1803
- const keyTo = `${txfer.to}-${txfer.token || "null"}`;
1804
- if (keyFrom === keyTo) continue;
1805
- if (!computedBalanceDiffs[keyFrom]) computedBalanceDiffs[keyFrom] = BigInt(0);
1806
- if (!computedBalanceDiffs[keyTo]) computedBalanceDiffs[keyTo] = BigInt(0);
1807
- computedBalanceDiffs[keyFrom] -= txfer.amount;
1808
- computedBalanceDiffs[keyTo] += txfer.amount;
1809
- }
1810
- for(const key in computedBalanceDiffs){
1811
- if ([
1812
- "null",
1813
- $64e1e522540ffc4e$var$WSOL_MINT
1814
- ].includes(key.split("-")[0])) continue;
1815
- if (computedBalanceDiffs[key] === BigInt(0)) continue;
1816
- if (computedBalanceDiffs[key] !== actualBalanceDiffs[key]) {
1817
- let token = key.split("-")[1];
1818
- if (knownTokensToSkip.includes(token)) continue;
1819
- if (token === "null") token = null;
1820
- const account = key.split("-")[0];
1821
- if (account === token) continue;
1822
- console.log({
1823
- transaction: `https://solscan.io/tx/${txHash}`,
1824
- account: account,
1825
- token: token,
1826
- computed: computedBalanceDiffs[key],
1827
- actual: actualBalanceDiffs[key],
1828
- diff: (actualBalanceDiffs[key] || BigInt(0)) - computedBalanceDiffs[key],
1829
- matchingTxfers: txTransfers.filter((m)=>m.token === token && (m.from === account || m.to === account) && m.from !== m.to)
1830
- });
1831
- throw new Error("mismatch on computed balance");
1832
- }
1833
- }
1834
- }
1835
1758
  transfers.push(...txTransfers.map((t)=>{
1836
1759
  delete t.fromTokenAccount;
1837
1760
  delete t.toTokenAccount;
@@ -2751,6 +2674,39 @@ const $64e1e522540ffc4e$export$a51565c56ceacb0a = {
2751
2674
  transactionHash: "2asCG9FQdkcbRiX56dCoUMByE871biTZmctv6DBo5EYMkJWCrJ4hNVBkrFGwjQCK2T6XPPeLkd8hWkji9WqjUxF6"
2752
2675
  }
2753
2676
  ]
2677
+ },
2678
+ {
2679
+ params: {
2680
+ network: "SOLANA",
2681
+ transactionHash: "4RA82Xf6otGz4PLaLYkLqMUQPnzgmQS3ZE5fN1zz2wMo1Vuew4CeCzAcStfCHSNGxE2P9StpUxiTe1kdn5B755WY"
2682
+ },
2683
+ payload: "https://jiti.indexing.co/networks/solana/387132087",
2684
+ output: [
2685
+ {
2686
+ amount: 106500n,
2687
+ blockNumber: 387132087,
2688
+ from: "2AQdpHJ2JpcEgPiATUXjQxA8QmafFegfQwSLWSprPicm",
2689
+ index: "0",
2690
+ timestamp: "2025-12-16T17:55:26.000Z",
2691
+ to: null,
2692
+ token: null,
2693
+ tokenType: "NATIVE",
2694
+ transactionGasFee: 106500n,
2695
+ transactionHash: "4RA82Xf6otGz4PLaLYkLqMUQPnzgmQS3ZE5fN1zz2wMo1Vuew4CeCzAcStfCHSNGxE2P9StpUxiTe1kdn5B755WY"
2696
+ },
2697
+ {
2698
+ amount: 1000000n,
2699
+ blockNumber: 387132087,
2700
+ from: "2AQdpHJ2JpcEgPiATUXjQxA8QmafFegfQwSLWSprPicm",
2701
+ index: "1",
2702
+ timestamp: "2025-12-16T17:55:26.000Z",
2703
+ to: "6uZakWzCdFF8H2Tk8WVHQdkkaLVLR9wLCrU8ikCj8uE3",
2704
+ token: "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",
2705
+ tokenType: "TOKEN",
2706
+ transactionGasFee: 106500n,
2707
+ transactionHash: "4RA82Xf6otGz4PLaLYkLqMUQPnzgmQS3ZE5fN1zz2wMo1Vuew4CeCzAcStfCHSNGxE2P9StpUxiTe1kdn5B755WY"
2708
+ }
2709
+ ]
2754
2710
  }
2755
2711
  ]
2756
2712
  };