@indexing/jiti 0.0.62 → 0.0.63

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
@@ -3,7 +3,6 @@ var $8zHUo$viem = require("viem");
3
3
  var $8zHUo$tronweb = require("tronweb");
4
4
  var $8zHUo$cosmjsprotosigning = require("@cosmjs/proto-signing");
5
5
  var $8zHUo$cosmjsstargate = require("@cosmjs/stargate");
6
- var $8zHUo$process = require("process");
7
6
  var $8zHUo$bs58 = require("bs58");
8
7
 
9
8
 
@@ -1344,12 +1343,10 @@ const $3b9b8f5747dcca8e$export$722698bc663d0ac0 = {
1344
1343
 
1345
1344
 
1346
1345
  var $fc7ca671efecc378$require$Buffer = $8zHUo$buffer.Buffer;
1347
-
1348
1346
  const $fc7ca671efecc378$var$SYSTEM_PROGRAM = "11111111111111111111111111111111";
1349
1347
  const $fc7ca671efecc378$var$WSOL_MINT = "So11111111111111111111111111111111111111112";
1350
1348
  const $fc7ca671efecc378$var$SPL_TOKEN_PROGRAM = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1351
1349
  const $fc7ca671efecc378$var$SPL_TOKEN_2022_PROGRAM = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
1352
- const $fc7ca671efecc378$var$ASSOCIATED_TOKEN_ACCOUNT_PROGRAM = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
1353
1350
  const $fc7ca671efecc378$export$a51565c56ceacb0a = {
1354
1351
  match: (block)=>(0, $6bd2ca253e883278$export$ae001c77434c5340)(block) === "SVM",
1355
1352
  transform (block) {
@@ -1408,12 +1405,12 @@ const $fc7ca671efecc378$export$a51565c56ceacb0a = {
1408
1405
  $fc7ca671efecc378$var$SPL_TOKEN_2022_PROGRAM
1409
1406
  ].includes(programId)) {
1410
1407
  // TRANSFER, TRANSFER CHECKED
1411
- if (instSig.startsWith("3,") && inst.accounts.length === 3 || instSig.startsWith("12,") && inst.accounts.length === 4) {
1408
+ if (instSig.startsWith("3,") && inst.accounts.length === 3 || instSig.startsWith("12,") && inst.accounts.length >= 4) {
1412
1409
  const amountData = $fc7ca671efecc378$require$Buffer.from(instData).slice(1, 9);
1413
1410
  if (amountData.length < 8) continue;
1414
1411
  const amount = BigInt(amountData.readBigUInt64LE(0).toString());
1415
1412
  const fromIdx = inst.accounts[0];
1416
- const toIdx = inst.accounts[inst.accounts.length - 2];
1413
+ const toIdx = inst.accounts.length === 5 ? inst.accounts[4] : inst.accounts[inst.accounts.length - 2];
1417
1414
  let from = createdAccountsToOwner[allAccounts[fromIdx]];
1418
1415
  let to = createdAccountsToOwner[allAccounts[toIdx]];
1419
1416
  let mint;
@@ -1428,9 +1425,8 @@ const $fc7ca671efecc378$export$a51565c56ceacb0a = {
1428
1425
  }
1429
1426
  if (from && to && mint) break;
1430
1427
  }
1431
- // @NOTE: should improve this - currently we assume unknown accounts belong to the signer
1432
- if (!from) from = signer;
1433
- if (!to) to = signer;
1428
+ if (!from) from = allAccounts[fromIdx] || signer;
1429
+ if (!to) to = allAccounts[toIdx] || signer;
1434
1430
  txTransfers.push({
1435
1431
  amount: amount,
1436
1432
  blockNumber: block.parentSlot + 1,
@@ -1769,79 +1765,6 @@ const $fc7ca671efecc378$export$a51565c56ceacb0a = {
1769
1765
  });
1770
1766
  }
1771
1767
  }
1772
- // @NOTE: special case for thorough testing
1773
- if (typeof $8zHUo$process !== "undefined" && $8zHUo$process?.env?.IS_JITI_TEST === "true") {
1774
- const knownTxsToSkip = [
1775
- // Solscan agrees... pre/post are incorrect
1776
- "4cSa4KtnmymubYYcK7EYtbpMArLLfx3s54NsRg436JXFMmoUudZnUucg6pRWu7xe1qcajp7dhtsNitQpVnFs7fMY",
1777
- // this one is correct, but our check logic doesn't factor multiple token accounts
1778
- "26nHifh1U2gVHztuAF3XXorWn38vuNMyQS4PDMgSfSq6ptE4dT7JjgW4ZRUucWMcMuBBgHbiWYADf3dLUmzuseCX"
1779
- ];
1780
- if (knownTxsToSkip.includes(txHash)) continue;
1781
- const knownTokensToSkip = [
1782
- // these are examples of bad rounding in the pre/post balances based on the instructions (Solscan agrees)
1783
- // these are token specific
1784
- "4kbKgH7aax6wPXJn576N8eamcLKoxZ2WD1a5PF8s2jnA",
1785
- "4zD1Bp7u6PYLEoCM6wR8fVNqj6aJ2P4QLiPD2dBWd5wy",
1786
- "2avgL3YP48N1rcFXwxHNW2whSp6VqQkaZcoTdZ2NLnof",
1787
- "C4Zhp86cKdBq1RobpvBePMQL5VFgjD4Nnzfrv1aRC5Vt",
1788
- "nNMAeUPpqUaUXuZ1jqbUjuB8XPokh4pJHFTxySz6FMr",
1789
- "LLJNRnieVDXb3hz65MS3PWf3sZYDr3huVN2M7J6eMGF"
1790
- ];
1791
- const actualBalanceDiffs = {};
1792
- for(let i = 0; i < svmTx.meta.postBalances.length; i += 1){
1793
- const post = svmTx.meta.postBalances[i];
1794
- const pre = svmTx.meta.preBalances[i];
1795
- const account = allAccounts[i];
1796
- const key = `${account}-null`;
1797
- actualBalanceDiffs[key] = BigInt(post) - BigInt(pre);
1798
- }
1799
- for (const post of svmTx.meta.postTokenBalances){
1800
- const pre = svmTx.meta.preTokenBalances.find((ptb)=>ptb.mint === post.mint && ptb.owner === post.owner && ptb.accountIndex === post.accountIndex);
1801
- const key = `${post.owner}-${post.mint}`;
1802
- actualBalanceDiffs[key] = BigInt(post.uiTokenAmount.amount) - BigInt(pre?.uiTokenAmount.amount || 0);
1803
- }
1804
- for (const pre of svmTx.meta.preTokenBalances){
1805
- const key = `${pre.owner}-${pre.mint}`;
1806
- if (actualBalanceDiffs[key]) continue;
1807
- const post = svmTx.meta.postTokenBalances.find((ptb)=>ptb.mint === pre.mint && ptb.owner === pre.owner && ptb.accountIndex === pre.accountIndex);
1808
- actualBalanceDiffs[key] = BigInt(post?.uiTokenAmount.amount || 0) - BigInt(pre.uiTokenAmount.amount);
1809
- }
1810
- const computedBalanceDiffs = {};
1811
- for (const txfer of txTransfers){
1812
- const keyFrom = `${txfer.from}-${txfer.token || "null"}`;
1813
- const keyTo = `${txfer.to}-${txfer.token || "null"}`;
1814
- if (keyFrom === keyTo) continue;
1815
- if (!computedBalanceDiffs[keyFrom]) computedBalanceDiffs[keyFrom] = BigInt(0);
1816
- if (!computedBalanceDiffs[keyTo]) computedBalanceDiffs[keyTo] = BigInt(0);
1817
- computedBalanceDiffs[keyFrom] -= txfer.amount;
1818
- computedBalanceDiffs[keyTo] += txfer.amount;
1819
- }
1820
- for(const key in computedBalanceDiffs){
1821
- if ([
1822
- "null",
1823
- $fc7ca671efecc378$var$WSOL_MINT
1824
- ].includes(key.split("-")[0])) continue;
1825
- if (computedBalanceDiffs[key] === BigInt(0)) continue;
1826
- if (computedBalanceDiffs[key] !== actualBalanceDiffs[key]) {
1827
- let token = key.split("-")[1];
1828
- if (knownTokensToSkip.includes(token)) continue;
1829
- if (token === "null") token = null;
1830
- const account = key.split("-")[0];
1831
- if (account === token) continue;
1832
- console.log({
1833
- transaction: `https://solscan.io/tx/${txHash}`,
1834
- account: account,
1835
- token: token,
1836
- computed: computedBalanceDiffs[key],
1837
- actual: actualBalanceDiffs[key],
1838
- diff: (actualBalanceDiffs[key] || BigInt(0)) - computedBalanceDiffs[key],
1839
- matchingTxfers: txTransfers.filter((m)=>m.token === token && (m.from === account || m.to === account) && m.from !== m.to)
1840
- });
1841
- throw new Error("mismatch on computed balance");
1842
- }
1843
- }
1844
- }
1845
1768
  transfers.push(...txTransfers.map((t)=>{
1846
1769
  delete t.fromTokenAccount;
1847
1770
  delete t.toTokenAccount;
@@ -2761,6 +2684,39 @@ const $fc7ca671efecc378$export$a51565c56ceacb0a = {
2761
2684
  transactionHash: "2asCG9FQdkcbRiX56dCoUMByE871biTZmctv6DBo5EYMkJWCrJ4hNVBkrFGwjQCK2T6XPPeLkd8hWkji9WqjUxF6"
2762
2685
  }
2763
2686
  ]
2687
+ },
2688
+ {
2689
+ params: {
2690
+ network: "SOLANA",
2691
+ transactionHash: "4RA82Xf6otGz4PLaLYkLqMUQPnzgmQS3ZE5fN1zz2wMo1Vuew4CeCzAcStfCHSNGxE2P9StpUxiTe1kdn5B755WY"
2692
+ },
2693
+ payload: "https://jiti.indexing.co/networks/solana/387132087",
2694
+ output: [
2695
+ {
2696
+ amount: 106500n,
2697
+ blockNumber: 387132087,
2698
+ from: "2AQdpHJ2JpcEgPiATUXjQxA8QmafFegfQwSLWSprPicm",
2699
+ index: "0",
2700
+ timestamp: "2025-12-16T17:55:26.000Z",
2701
+ to: null,
2702
+ token: null,
2703
+ tokenType: "NATIVE",
2704
+ transactionGasFee: 106500n,
2705
+ transactionHash: "4RA82Xf6otGz4PLaLYkLqMUQPnzgmQS3ZE5fN1zz2wMo1Vuew4CeCzAcStfCHSNGxE2P9StpUxiTe1kdn5B755WY"
2706
+ },
2707
+ {
2708
+ amount: 1000000n,
2709
+ blockNumber: 387132087,
2710
+ from: "2AQdpHJ2JpcEgPiATUXjQxA8QmafFegfQwSLWSprPicm",
2711
+ index: "1",
2712
+ timestamp: "2025-12-16T17:55:26.000Z",
2713
+ to: "6uZakWzCdFF8H2Tk8WVHQdkkaLVLR9wLCrU8ikCj8uE3",
2714
+ token: "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",
2715
+ tokenType: "TOKEN",
2716
+ transactionGasFee: 106500n,
2717
+ transactionHash: "4RA82Xf6otGz4PLaLYkLqMUQPnzgmQS3ZE5fN1zz2wMo1Vuew4CeCzAcStfCHSNGxE2P9StpUxiTe1kdn5B755WY"
2718
+ }
2719
+ ]
2764
2720
  }
2765
2721
  ]
2766
2722
  };