@indexing/jiti 0.0.59 → 0.0.62

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,6 +3,7 @@ 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");
6
7
  var $8zHUo$bs58 = require("bs58");
7
8
 
8
9
 
@@ -58,6 +59,9 @@ const $6bd2ca253e883278$var$PARTIAL_VM_TO_NETWORK_MAP = {
58
59
  FILECOIN: [
59
60
  "FILECOIN"
60
61
  ],
62
+ HYPERCORE: [
63
+ "HYPERCORE"
64
+ ],
61
65
  RIPPLE: [
62
66
  "RIPPLE"
63
67
  ],
@@ -1340,6 +1344,7 @@ const $3b9b8f5747dcca8e$export$722698bc663d0ac0 = {
1340
1344
 
1341
1345
 
1342
1346
  var $fc7ca671efecc378$require$Buffer = $8zHUo$buffer.Buffer;
1347
+
1343
1348
  const $fc7ca671efecc378$var$SYSTEM_PROGRAM = "11111111111111111111111111111111";
1344
1349
  const $fc7ca671efecc378$var$WSOL_MINT = "So11111111111111111111111111111111111111112";
1345
1350
  const $fc7ca671efecc378$var$SPL_TOKEN_PROGRAM = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
@@ -1764,6 +1769,79 @@ const $fc7ca671efecc378$export$a51565c56ceacb0a = {
1764
1769
  });
1765
1770
  }
1766
1771
  }
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
+ }
1767
1845
  transfers.push(...txTransfers.map((t)=>{
1768
1846
  delete t.fromTokenAccount;
1769
1847
  delete t.toTokenAccount;
@@ -3144,6 +3222,14 @@ const $9af31dbb692f94e3$var$filterValuesTemplate = {
3144
3222
  fv
3145
3223
  ] : fv).flat();
3146
3224
  break;
3225
+ case "HYPERCORE":
3226
+ for (const subblock of block.blocks){
3227
+ for (const evt of subblock.events || [])finalValues.add(evt[0]);
3228
+ for (const evt of subblock.misc_events || []){
3229
+ if (evt?.inner?.LedgerUpdate?.users?.length) for (const u of evt.inner.LedgerUpdate.users)finalValues.add(u);
3230
+ }
3231
+ }
3232
+ break;
3147
3233
  case "RIPPLE":
3148
3234
  for (const tx of block.transactions){
3149
3235
  finalValues.add(tx.Account);
@@ -10591,8 +10677,89 @@ const $9af31dbb692f94e3$var$filterValuesTemplate = {
10591
10677
  "957928",
10592
10678
  "969084"
10593
10679
  ]
10680
+ },
10681
+ {
10682
+ params: {},
10683
+ payload: "https://jiti.indexing.co/networks/hyper_core/8248362",
10684
+ output: [
10685
+ "0x010461c14e146ac35fe42271bdc1134ee31c703a",
10686
+ "0x04ec5ab4c6c6a00a3998033c4cd7b165f6973219",
10687
+ "0x060d01aa996003b3731a992462d7f0ba68bf3b04",
10688
+ "0x0acfdcf97909503c844e0ae437edd0ff9af6cfff",
10689
+ "0x0f7cadd1d0590f22428a92142d472b084166e4a9",
10690
+ "0x0facac3bd128fe6d799898a059d3634b877c7a0a",
10691
+ "0x104a389b5478769762b4adec39c2cfc6dfbdb23f",
10692
+ "0x162cc7c861ebd0c06b3d72319201150482518185",
10693
+ "0x1c1c270b573d55b68b3d14722b5d5d401511bed0",
10694
+ "0x1dd4af3383fce2ee4a40d9fb6766cbfcce2ddbce",
10695
+ "0x1f6a7765289433b2082e3a7c4ef436ca29a2bb52",
10696
+ "0x21b5eb0ca859383f7d8b6906cddb115e92e80913",
10697
+ "0x223537ac9a856c31f4043e86ced86bb29f06653e",
10698
+ "0x2396bc99feedc162af809314257571bb7ff07a36",
10699
+ "0x258a4b8a8447c61aabf1bef9bb14ee4d69efff03",
10700
+ "0x2de2ee8a0d7b963909ef6a7ba957b29670d37674",
10701
+ "0x31ca8395cf837de08b24da3f660e77761dfb974b",
10702
+ "0x38c01e5e7bd6c819b793e78806ff797a2caa065c",
10703
+ "0x38f96bba487a628d2a84afc3fe5c7d77eb07cb04",
10704
+ "0x3bcae23e8c380dab4732e9a159c0456f12d866f3",
10705
+ "0x3e6fa43f44bab9945e21c4a551c83c07d208ddba",
10706
+ "0x4334ff1dd9fa46667b718a6f8a489c3d0079b44b",
10707
+ "0x4499d449f7703b5af8a9ee963e60f7de2c9c088d",
10708
+ "0x4ef1c5ae65ab5b37629b7aa523e7e95e7da528e3",
10709
+ "0x524dc3bdc3c96652a27594996edbd718e7561e1e",
10710
+ "0x56667d7d8e0e5c529d96f6d92ff2ce2414c5910d",
10711
+ "0x57dd78cd36e76e2011e8f6dc25cabbaba994494b",
10712
+ "0x588a91f97c735db1c97fc1493112c520850c359b",
10713
+ "0x5fffee2555a15899ad656c1a80f1b35cd0b2c0c1",
10714
+ "0x66cb2f1043b06a2f84eb0b87ecda78cef7fe6938",
10715
+ "0x69523edb8337e624ea97a0c097ac5d3dede8e3d5",
10716
+ "0x727956612a8700627451204a3ae26268bd1a1525",
10717
+ "0x7717a7a245d9f950e586822b8c9b46863ed7bd7e",
10718
+ "0x7786498ffb58bedc6c392a4a40789be5c2da240d",
10719
+ "0x783d13f7d762775fea1de86e3382064ef75f0bfe",
10720
+ "0x79564f6ebb9bc877a98e66a5fc570af608d04d69",
10721
+ "0x7e698eea0709e4a0dbbd790fc493d60691801157",
10722
+ "0x852ce6f52d2e8b0e006c46ef25a90c0956d02790",
10723
+ "0x8d2ae039e33c35d489675ebf98a3fc06050dc449",
10724
+ "0x9808a818b1654cc95794431cdcd8c175cf13ffd1",
10725
+ "0xa3b27b153c95efe32ef9b7e81499e8d4dbd49b2f",
10726
+ "0xa55e490ab10f1e90b288a5f69c96f9e47547ae2e",
10727
+ "0xa880d6cc607a05ea617307ab3b0d335e8d8424ee",
10728
+ "0xa993ad31ef46873c0193448dbb2f04c0d3854731",
10729
+ "0xaf72ae447ad3dcdcdfbaa01bb9c7b3c37a031aaf",
10730
+ "0xb0cb7c120554f2a8edf792476ccec1aa6bee2e08",
10731
+ "0xb4321b142b2a03ce20fcab2007ff6990b9acba93",
10732
+ "0xb5b1c1132c1f87c0d62b48310b8118e540bc3068",
10733
+ "0xb8fc9614028221a4bcabaca9f017d3a0d4f68ee5",
10734
+ "0xba44973eb1898496f06f207a2392c547761ec49f",
10735
+ "0xbae920ca13b081155f2b5563e36acc7e92d7a494",
10736
+ "0xbf1935fe7ab6d0aa3ee8d3da47c2f80e215b2a1c",
10737
+ "0xc2c006c07c0d3562ad587a7ee44af2b8d074500d",
10738
+ "0xc799df4baa69044f59a3711f180a31e352829ba3",
10739
+ "0xc7f94fb3b3ba614b9b2bf80697ab5a31917005a2",
10740
+ "0xc926ddba8b7617dbc65712f20cf8e1b58b8598d3",
10741
+ "0xca5742f69ee46f28f2a8d424f73e923eb1a31498",
10742
+ "0xd02928c445d780ea954fe0b6f0be0f6cb9727678",
10743
+ "0xd3c1a0692c287e2f7aa521661e6104318adcbd11",
10744
+ "0xd4c1f7e8d876c4749228d515473d36f919583d1d",
10745
+ "0xdcac85ecae7148886029c20e661d848a4de99ce2",
10746
+ "0xe0e8c1d735698060477e79a8e4c20276fc2ec7a7",
10747
+ "0xe4bc157a3b6c6e228c706beba737d0dd76aee145",
10748
+ "0xe8de5d2ae47fa0a00d1de7a36b2a2d75b63a80f7",
10749
+ "0xe9acfdc9322f6f924f007016c082e6891a3c653c",
10750
+ "0xecb63caa47c7c4e77f60f1ce858cf28dc2b82b00",
10751
+ "0xee162a5a60829bd346f0c1ac3514b21fe5f4b290",
10752
+ "0xef56cd2121db6c4d33bd4c20099375d93e9649fe",
10753
+ "0xf0049562787db80369beefae889732d62fc732ae",
10754
+ "0xf0480a7892bc260658e82359f3c9374bc0a75444",
10755
+ "0xf27ebb91ea420f73b59b205ac7e0b77a90ec8f3c",
10756
+ "0xf36c562be0598b8ce109998b6aa2d53ffcd8316b",
10757
+ "0xf3c45922fecda2e46149eecb436f1bf914df3b09",
10758
+ "0xfbd4fd96c1f21de4afa7a5347d29ce168cb2a0a5",
10759
+ "0xfd36f39eecd1d0c99a0c4a15bf0a22bdfc2578eb"
10760
+ ]
10594
10761
  }
10595
- ].slice(0)
10762
+ ]
10596
10763
  };
10597
10764
  var $9af31dbb692f94e3$export$2e2bcd8739ae039 = $9af31dbb692f94e3$var$filterValuesTemplate;
10598
10765