@glamsystems/glam-cli 0.1.32 → 0.1.34

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.
Files changed (2) hide show
  1. package/main.js +293 -57
  2. package/package.json +2 -2
package/main.js CHANGED
@@ -1677,6 +1677,11 @@ exports.STAKE_POOLS = sanctum_lst_list_1.LstList.filter((lst) => lst.pool.progra
1677
1677
  };
1678
1678
  });
1679
1679
  exports.STAKE_POOLS_MAP = new Map(exports.STAKE_POOLS.map((p) => [p.mint, p]));
1680
+ /**
1681
+ * Asset-Oracle mapping supported by the protocol. This map is a mirror of onchain mapping stored in `global_config` https://solscan.io/account/6avract7PxKqoq6hdmpAgGKgJWoJWdiXPPzzFZ62Hck6
1682
+ *
1683
+ * Note that we use functional prices for LSTs, and the oracle pubkey of a LST asset is the pool state.
1684
+ */
1680
1685
  exports.ASSETS_MAINNET = new Map([
1681
1686
  [
1682
1687
  // SOL
@@ -1727,7 +1732,7 @@ exports.ASSETS_MAINNET = new Map([
1727
1732
  },
1728
1733
  ],
1729
1734
  [
1730
- // USDC
1735
+ // USD Coin - USDC
1731
1736
  "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
1732
1737
  {
1733
1738
  decimals: 6,
@@ -1735,7 +1740,7 @@ exports.ASSETS_MAINNET = new Map([
1735
1740
  },
1736
1741
  ],
1737
1742
  [
1738
- // USDT
1743
+ // USDT - USDT
1739
1744
  "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
1740
1745
  {
1741
1746
  decimals: 6,
@@ -1743,7 +1748,7 @@ exports.ASSETS_MAINNET = new Map([
1743
1748
  },
1744
1749
  ],
1745
1750
  [
1746
- // USDY
1751
+ // Ondo US Dollar Yield - USDY
1747
1752
  "A1KLoBrKBde8Ty9qtNQUtq3C2ortoC3u7twggz7sEto6",
1748
1753
  {
1749
1754
  decimals: 6,
@@ -1751,7 +1756,7 @@ exports.ASSETS_MAINNET = new Map([
1751
1756
  },
1752
1757
  ],
1753
1758
  [
1754
- // USDG
1759
+ // Global Dollar - USDG
1755
1760
  "2u1tszSeqZ3qBWF3uNGPFc8TzMk2tdiwknnRMWGWjGWH",
1756
1761
  {
1757
1762
  decimals: 6,
@@ -1760,7 +1765,7 @@ exports.ASSETS_MAINNET = new Map([
1760
1765
  },
1761
1766
  ],
1762
1767
  [
1763
- // PYUSD
1768
+ // PayPal USD - PYUSD
1764
1769
  "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",
1765
1770
  {
1766
1771
  decimals: 6,
@@ -1792,41 +1797,6 @@ exports.ASSETS_MAINNET = new Map([
1792
1797
  oracle: new web3_js_1.PublicKey("7pT9mxKXyvfaZKeKy1oe2oV2K1RFtF7tPEJHUY3h2vVV"),
1793
1798
  },
1794
1799
  ],
1795
- [
1796
- // mSOL
1797
- "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",
1798
- {
1799
- decimals: 9,
1800
- oracle: new web3_js_1.PublicKey("8szGkuLTAux9XMgZ2vtY39jVSowEcpBfFfD8hXSEqdGC"),
1801
- },
1802
- ],
1803
- [
1804
- // jitoSOL
1805
- "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn",
1806
- {
1807
- decimals: 9,
1808
- oracle: new web3_js_1.PublicKey("Jito4APyf642JPZPx3hGc6WWJ8zPKtRbRs4P815Awbb"), // state
1809
- isLst: true,
1810
- },
1811
- ],
1812
- [
1813
- // bonkSOL
1814
- "BonK1YhkXEGLZzwtcvRTip3gAL9nCeQD7ppZBLXhtTs",
1815
- {
1816
- decimals: 9,
1817
- oracle: new web3_js_1.PublicKey("ArAQfbzsdotoKB5jJcZa3ajQrrPcWr2YQoDAEAiFxJAC"), // state
1818
- isLst: true,
1819
- },
1820
- ],
1821
- [
1822
- // dSOL
1823
- "Dso1bDeDjCQxTrWHqUUi63oBvV7Mdm6WaobLbQ7gnPQ",
1824
- {
1825
- decimals: 9,
1826
- oracle: new web3_js_1.PublicKey("9mhGNSPArRMHpLDMSmxAvuoizBqtBGqYdT8WGuqgxNdn"), // state
1827
- isLst: true,
1828
- },
1829
- ],
1830
1800
  [
1831
1801
  // GOOGLx
1832
1802
  "XsCPL9dNWBMvFtTmwcCA5v3xWPSMEBCszbQdiLLq6aN",
@@ -1867,7 +1837,264 @@ exports.ASSETS_MAINNET = new Map([
1867
1837
  aggIndex: 341,
1868
1838
  },
1869
1839
  ],
1840
+ [
1841
+ // Bonk - Bonk
1842
+ "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
1843
+ {
1844
+ decimals: 6,
1845
+ oracle: new web3_js_1.PublicKey("BERaNi6cpEresbq6HC1EQGaB1H1UjvEo4NGnmYSSJof4"),
1846
+ },
1847
+ ],
1848
+ [
1849
+ // Raydium - RAY
1850
+ "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R",
1851
+ {
1852
+ decimals: 6,
1853
+ oracle: new web3_js_1.PublicKey("6VXU2P9BJkuPkfA7FJVonBtAo1c2pGnHoV9rxsdZKZyb"),
1854
+ },
1855
+ ],
1856
+ [
1857
+ // Helium Network Token - HNT
1858
+ "hntyVP6YFm1Hg25TN9WGLqM12b8TQmcknKrdu1oxWux",
1859
+ {
1860
+ decimals: 8,
1861
+ oracle: new web3_js_1.PublicKey("AEPgc6qUTCT8AwdckPcGbJXtcM9bj8mGYAyHE4BscJtm"),
1862
+ },
1863
+ ],
1864
+ [
1865
+ // Kamino - KMNO
1866
+ "KMNo3nJsBXfcpJTVhZcXLW7RmTwTt4GVFE7suUBo9sS",
1867
+ {
1868
+ decimals: 6,
1869
+ oracle: new web3_js_1.PublicKey("6ua3DK1sHoYyNi15dsxy6RYwUcZPDDXfyChzaRMaheQF"),
1870
+ },
1871
+ ],
1872
+ [
1873
+ // Tensor - TNSR
1874
+ "TNSRxcUxoT9xBG3de7PiJyTDYu7kskLqcpddxnEJAS6",
1875
+ {
1876
+ decimals: 9,
1877
+ oracle: new web3_js_1.PublicKey("EX6r1GdfsgcUsY6cQ6YsToV4RGsb4HKpjrkokK2DrmsS"),
1878
+ },
1879
+ ],
1880
+ [
1881
+ // JITO - JTO
1882
+ "jtojtomepa8beP8AuQc6eXt5FriJwfFMwQx2v2f9mCL",
1883
+ {
1884
+ decimals: 9,
1885
+ oracle: new web3_js_1.PublicKey("CGCz4mB8NsDddCq6BZToRUDUuktzsAfpKYh6ATgyyCGF"),
1886
+ },
1887
+ ],
1888
+ [
1889
+ // Drift - DRIFT
1890
+ "DriFtupJYLTosbwoN8koMbEYSx54aFAVLddWsbksjwg7",
1891
+ {
1892
+ decimals: 6,
1893
+ oracle: new web3_js_1.PublicKey("5VJou4ufN2vE11zyZUaLsKLTXhyzCTgiq6QDsts2YnnD"),
1894
+ },
1895
+ ],
1896
+ [
1897
+ // Render Token - RENDER
1898
+ "rndrizKT3MK1iimdxRdWabcF7Zg7AR5T4nud4EkHBof",
1899
+ {
1900
+ decimals: 8,
1901
+ oracle: new web3_js_1.PublicKey("97EqsAGbTnShB7oYWAFFCVVAx8PWXgDYDhcpm99izNQ4"),
1902
+ },
1903
+ ],
1904
+ [
1905
+ // Wormhole Token - W
1906
+ "85VBFQZC9TZkfaptBWjvUw7YbZjy52A6mjtPGjstQAmQ",
1907
+ {
1908
+ decimals: 6,
1909
+ oracle: new web3_js_1.PublicKey("CsFUXiA5dM4eCKjVBBy8tXhXzDkDRNoYjU5rjpHyfNEZ"),
1910
+ },
1911
+ ],
1912
+ [
1913
+ // Pyth Network - PYTH
1914
+ "HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",
1915
+ {
1916
+ decimals: 6,
1917
+ oracle: new web3_js_1.PublicKey("6Sfx8ZAt6xaEgMXTahR6GrT7oYB6nFBMoVyCmMyHmeJV"),
1918
+ },
1919
+ ],
1920
+ [
1921
+ // dogwifhat - $WIF
1922
+ "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm",
1923
+ {
1924
+ decimals: 6,
1925
+ oracle: new web3_js_1.PublicKey("4QXWStoyEErTZFVsvKrvxuNa6QT8zpeA8jddZunSGvYE"),
1926
+ },
1927
+ ],
1928
+ [
1929
+ // Infinity - INF
1930
+ "5oVNBeEEQvYi1cX3ir8Dx5n1P7pdxydbGF2X4TxVusJm",
1931
+ {
1932
+ decimals: 9,
1933
+ oracle: new web3_js_1.PublicKey("B7RUYg2zF6UdUSHv2RmpnriPVJccYWojgFydNS1NY5F8"),
1934
+ },
1935
+ ],
1936
+ [
1937
+ // BlazeStake Staked SOL (bSOL) - bSOL
1938
+ "bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",
1939
+ {
1940
+ decimals: 9,
1941
+ oracle: new web3_js_1.PublicKey("BmDWPMsytWmYkh9n6o7m79eVshVYf2B5GVaqQ2EWKnGH"),
1942
+ },
1943
+ ],
1944
+ [
1945
+ // Popcat - POPCAT
1946
+ "7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr",
1947
+ {
1948
+ decimals: 9,
1949
+ oracle: new web3_js_1.PublicKey("C5fiAmQyjdfDR4EGepZqnEL3fJwMBav5yoAk6XyKMF6u"),
1950
+ },
1951
+ ],
1952
+ [
1953
+ // Cloud - CLOUD
1954
+ "CLoUDKc4Ane7HeQcPpE3YHnznRxhMimJ4MyaUqyHFzAu",
1955
+ {
1956
+ decimals: 9,
1957
+ oracle: new web3_js_1.PublicKey("9Ennia27iT83kNAk3JtRKxSMzuCzsVtT4MzuxpE7anME"),
1958
+ },
1959
+ ],
1960
+ [
1961
+ // Binance Staked SOL - BNSOL
1962
+ "BNso1VUJnh4zcfpZa6986Ea66P6TCp59hvtNJ8b1X85",
1963
+ {
1964
+ decimals: 9,
1965
+ oracle: new web3_js_1.PublicKey("8DmXTfhhtb9kTcpTVfb6Ygx8WhZ8wexGqcpxfn23zooe"),
1966
+ },
1967
+ ],
1968
+ [
1969
+ // MOTHER IGGY - MOTHER
1970
+ "3S8qX1MsMqRbiwKg2cQyx7nis1oHMgaCuc9c4VfvVdPN",
1971
+ {
1972
+ decimals: 6,
1973
+ oracle: new web3_js_1.PublicKey("469WQgfJ6AJ3eJ8FUcdhiZawf7yNChA3hseTSyhFatHZ"),
1974
+ },
1975
+ ],
1976
+ [
1977
+ // Magic Eden - ME
1978
+ "MEFNBXixkEbait3xn9bkm8WsJzXtVsaJEn4c8Sam21u",
1979
+ {
1980
+ decimals: 6,
1981
+ oracle: new web3_js_1.PublicKey("BboTg1yT114FQkqT6MM3P3G3CcCktuM2RePgU8Gr3K4A"),
1982
+ },
1983
+ ],
1984
+ [
1985
+ // META - META
1986
+ "METADDFL6wWMWEoKTFJwcThTbUmtarRJZjRpzUvkxhr",
1987
+ {
1988
+ decimals: 9,
1989
+ oracle: new web3_js_1.PublicKey("DwYF1yveo8XTF1oqfsqykj332rjSxAd7bR6Gu6i4iUET"),
1990
+ },
1991
+ ],
1992
+ [
1993
+ // Pudgy Penguins - PENGU
1994
+ "2zMMhcVQEXDtdE6vsFS7S7D5oUodfJHE8vd1gnBouauv",
1995
+ {
1996
+ decimals: 6,
1997
+ oracle: new web3_js_1.PublicKey("4A3KroGPjZxPAeBNF287V3NyRwV2q8iBi1vX7kHxTCh7"),
1998
+ },
1999
+ ],
2000
+ [
2001
+ // ai16z - ai16z
2002
+ "HeLp6NuQkmYB4pYWo2zYs22mESHXPQYzXbB8n4V98jwC",
2003
+ {
2004
+ decimals: 9,
2005
+ oracle: new web3_js_1.PublicKey("3BGheQVvYtBNpBKSUXSTjpyKQc3dh8iiwT91Aiq7KYCU"),
2006
+ programId: spl_token_1.TOKEN_2022_PROGRAM_ID,
2007
+ },
2008
+ ],
2009
+ [
2010
+ // OFFICIAL TRUMP - TRUMP
2011
+ "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN",
2012
+ {
2013
+ decimals: 6,
2014
+ oracle: new web3_js_1.PublicKey("FPQjZYvHRGy51guJ77p7n9u9b8eo1ktKRc2D2g5Vysth"),
2015
+ },
2016
+ ],
2017
+ [
2018
+ // Melania Meme - MELANIA
2019
+ "FUAfBo2jgks6gB4Z4LfZkqSZgzNucisEHqnNebaRxM1P",
2020
+ {
2021
+ decimals: 6,
2022
+ oracle: new web3_js_1.PublicKey("3RgNWYYcZCKf5uZfriK8ASUbGQErhH6YbpdvZQ7ZKDCf"),
2023
+ },
2024
+ ],
2025
+ [
2026
+ // AUSD - AUSD
2027
+ "AUSD1jCcCyPLybk1YnvPWsHQSrZ46dxwoMniN4N2UEB9",
2028
+ {
2029
+ decimals: 6,
2030
+ oracle: new web3_js_1.PublicKey("8FZhpiM8n3mpgvENWLcEvHsKB1bBhYBAyL4Ypr4gptLZ"),
2031
+ programId: spl_token_1.TOKEN_2022_PROGRAM_ID,
2032
+ },
2033
+ ],
2034
+ [
2035
+ // zBTC - zBTC
2036
+ "zBTCug3er3tLyffELcvDNrKkCymbPWysGcWihESYfLg",
2037
+ {
2038
+ decimals: 8,
2039
+ oracle: new web3_js_1.PublicKey("CN9QvvbGQzMnN8vJaSek2so4vFnTqgJDFrdJB8Y4tQfB"),
2040
+ },
2041
+ ],
2042
+ [
2043
+ // Fartcoin - Fartcoin
2044
+ "9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump",
2045
+ {
2046
+ decimals: 6,
2047
+ oracle: new web3_js_1.PublicKey("2sZomfWMDuQLcFak3nuharXorHrZ3hK8iaML6ZGSHtso"),
2048
+ },
2049
+ ],
2050
+ [
2051
+ // ZEUS - ZEUS
2052
+ "ZEUS1aR7aX8DFFJf5QjWj2ftDDdNTroMNGo8YoQm3Gq",
2053
+ {
2054
+ decimals: 6,
2055
+ oracle: new web3_js_1.PublicKey("8cH72H3vqYPArV9QvkYJkwzTdsdNPPgVPrusz9sMmgNN"),
2056
+ },
2057
+ ],
2058
+ [
2059
+ // Pump - PUMP
2060
+ "pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn",
2061
+ {
2062
+ decimals: 6,
2063
+ oracle: new web3_js_1.PublicKey("5r8RWTaRiMgr9Lph3FTUE3sGb1vymhpCrm83Bovjfcps"),
2064
+ programId: spl_token_1.TOKEN_2022_PROGRAM_ID,
2065
+ },
2066
+ ],
2067
+ [
2068
+ // EURC - EURC
2069
+ "HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",
2070
+ {
2071
+ decimals: 6,
2072
+ oracle: new web3_js_1.PublicKey("BkdSPLmw4W6twrJjAePw2bJAwDTBtxJ9t6LvNHfcBKg1"),
2073
+ },
2074
+ ],
2075
+ [
2076
+ // DeFi Development Corp Staked SOL - dfdvSOL
2077
+ "sctmB7GPi5L2Q5G9tUSzXvhZ4YiDMEGcRov9KfArQpx",
2078
+ {
2079
+ decimals: 9,
2080
+ oracle: new web3_js_1.PublicKey("EUQQD2fNN7h7su5TbWpUnf22zeGtF3RjEX2hgX2YPfLd"),
2081
+ },
2082
+ ],
2083
+ [
2084
+ // Syrup USDC - syrupUSDC
2085
+ "AvZZF1YaZDziPY2RCK4oJrRVrbN3mTD9NL24hPeaZeUj",
2086
+ {
2087
+ decimals: 6,
2088
+ oracle: new web3_js_1.PublicKey("GqqkoqHU5pqgTvL88xSCipH9txbPETyzvAvybQ3zRpzw"),
2089
+ },
2090
+ ],
1870
2091
  ]);
2092
+ exports.STAKE_POOLS.forEach((p) => {
2093
+ exports.ASSETS_MAINNET.set(p.mint, {
2094
+ decimals: p.decimals,
2095
+ oracle: new web3_js_1.PublicKey(p.poolState),
2096
+ });
2097
+ });
1871
2098
  exports.ASSETS_TESTS = new Map([]);
1872
2099
  exports.SOL_ORACLE = exports.ASSETS_MAINNET.get("So11111111111111111111111111111111111111112").oracle;
1873
2100
  exports.USDC_ORACLE = exports.ASSETS_MAINNET.get("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v").oracle;
@@ -6269,7 +6496,6 @@ class KaminoLendingClient {
6269
6496
  const vault = this.base.vaultPda;
6270
6497
  const userMetadata = this.getUserMetadataPda(vault);
6271
6498
  const lookupTable = new web3_js_1.PublicKey(0); // FIXME: create lookup table
6272
- // @ts-ignore
6273
6499
  const tx = await this.base.program.methods
6274
6500
  .kaminoLendingInitUserMetadata(lookupTable)
6275
6501
  .accounts({
@@ -6326,7 +6552,7 @@ class KaminoLendingClient {
6326
6552
  const obligationFarmAccount = await this.base.provider.connection.getAccountInfo(obligationFarm);
6327
6553
  if (!obligationFarmAccount) {
6328
6554
  preInstructions.push(await this.base.program.methods
6329
- .kaminoLendingInitObligationFarmsForReserve(0) // TODO: What does mode do?
6555
+ .kaminoLendingInitObligationFarmsForReserve(0) // 0 - collateral farm
6330
6556
  .accounts({
6331
6557
  glamState: this.base.statePda,
6332
6558
  glamSigner,
@@ -6364,7 +6590,8 @@ class KaminoLendingClient {
6364
6590
  postInstructions.push(...ixs); // farms must be refreshed after deposit
6365
6591
  }
6366
6592
  // If deposit asset is WSOL, wrap SOL first in case vault doesn't have enough wSOL
6367
- const userSourceLiquidity = this.base.getVaultAta(asset);
6593
+ const { tokenProgram } = await this.base.fetchMintAndTokenProgram(asset);
6594
+ const userSourceLiquidity = this.base.getVaultAta(asset, tokenProgram);
6368
6595
  if (asset.equals(constants_1.WSOL)) {
6369
6596
  const wrapSolIxs = await this.base.maybeWrapSol(amount);
6370
6597
  preInstructions.unshift(...wrapSolIxs);
@@ -6382,7 +6609,6 @@ class KaminoLendingClient {
6382
6609
  postInstructions.push(closeIx);
6383
6610
  }
6384
6611
  }
6385
- // @ts-ignore
6386
6612
  const tx = await this.base.program.methods
6387
6613
  .kaminoLendingDepositReserveLiquidityAndObligationCollateralV2(amount)
6388
6614
  .accounts({
@@ -6399,7 +6625,7 @@ class KaminoLendingClient {
6399
6625
  userSourceLiquidity,
6400
6626
  placeholderUserDestinationCollateral: constants_1.KAMINO_LENDING_PROGRAM,
6401
6627
  collateralTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
6402
- liquidityTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
6628
+ liquidityTokenProgram: tokenProgram,
6403
6629
  instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
6404
6630
  obligationFarmUserState: obligationFarm,
6405
6631
  reserveFarmState: depositReserve.farmCollateral,
@@ -6425,7 +6651,7 @@ class KaminoLendingClient {
6425
6651
  const obligationFarmAccount = await this.base.provider.connection.getAccountInfo(obligationFarm);
6426
6652
  if (!obligationFarmAccount) {
6427
6653
  preInstructions.push(await this.base.program.methods
6428
- .kaminoLendingInitObligationFarmsForReserve(0) // TODO: What does mode do?
6654
+ .kaminoLendingInitObligationFarmsForReserve(0) // 0 - collateral farm
6429
6655
  .accounts({
6430
6656
  glamState: this.base.statePda,
6431
6657
  glamSigner,
@@ -6463,8 +6689,9 @@ class KaminoLendingClient {
6463
6689
  postInstructions.push(...ixs); // farms must be refreshed after withdraw
6464
6690
  }
6465
6691
  // Create asset ATA in case it doesn't exist. Add it to the beginning of preInstructions
6466
- const userDestinationLiquidity = this.base.getVaultAta(asset);
6467
- const createAtaIx = (0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(glamSigner, userDestinationLiquidity, vault, asset);
6692
+ const { tokenProgram } = await this.base.fetchMintAndTokenProgram(asset);
6693
+ const userDestinationLiquidity = this.base.getVaultAta(asset, tokenProgram);
6694
+ const createAtaIx = (0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(glamSigner, userDestinationLiquidity, vault, asset, tokenProgram);
6468
6695
  preInstructions.unshift(createAtaIx);
6469
6696
  const withdrawIx = await this.base.program.methods
6470
6697
  .kaminoLendingWithdrawObligationCollateralAndRedeemReserveCollateralV2(amount)
@@ -6482,12 +6709,19 @@ class KaminoLendingClient {
6482
6709
  userDestinationLiquidity,
6483
6710
  placeholderUserDestinationCollateral: null,
6484
6711
  collateralTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
6485
- liquidityTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
6712
+ liquidityTokenProgram: tokenProgram,
6486
6713
  instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
6487
6714
  obligationFarmUserState: obligationFarm,
6488
6715
  reserveFarmState: withdrawReserve.farmCollateral,
6489
6716
  farmsProgram: constants_1.KAMINO_FARM_PROGRAM,
6490
6717
  })
6718
+ .remainingAccounts([
6719
+ {
6720
+ pubkey: web3_js_1.SystemProgram.programId,
6721
+ isSigner: false,
6722
+ isWritable: false,
6723
+ },
6724
+ ])
6491
6725
  .instruction();
6492
6726
  // The final instructions in the tx:
6493
6727
  // - refreshReserve * N
@@ -6514,7 +6748,7 @@ class KaminoLendingClient {
6514
6748
  const obligationFarmAccount = await this.base.provider.connection.getAccountInfo(obligationFarm);
6515
6749
  if (!obligationFarmAccount) {
6516
6750
  preInstructions.push(await this.base.program.methods
6517
- .kaminoLendingInitObligationFarmsForReserve(0) // TODO: What does mode do?
6751
+ .kaminoLendingInitObligationFarmsForReserve(1) // 1 - debt farm
6518
6752
  .accounts({
6519
6753
  glamState: this.base.statePda,
6520
6754
  glamSigner,
@@ -6557,8 +6791,9 @@ class KaminoLendingClient {
6557
6791
  }
6558
6792
  */
6559
6793
  // Create asset ATA in case it doesn't exist. Add it to the beginning of preInstructions
6560
- const userDestinationLiquidity = this.base.getVaultAta(asset);
6561
- const createAtaIx = (0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(glamSigner, userDestinationLiquidity, vault, asset);
6794
+ const { tokenProgram } = await this.base.fetchMintAndTokenProgram(asset);
6795
+ const userDestinationLiquidity = this.base.getVaultAta(asset, tokenProgram);
6796
+ const createAtaIx = (0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(glamSigner, userDestinationLiquidity, vault, asset, tokenProgram);
6562
6797
  preInstructions.unshift(createAtaIx);
6563
6798
  const borrowIx = await this.base.program.methods
6564
6799
  .kaminoLendingBorrowObligationLiquidityV2(amount)
@@ -6575,7 +6810,7 @@ class KaminoLendingClient {
6575
6810
  userDestinationLiquidity,
6576
6811
  referrerTokenState: null,
6577
6812
  instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
6578
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
6813
+ tokenProgram,
6579
6814
  obligationFarmUserState: obligationFarm,
6580
6815
  reserveFarmState: borrowReserve.farmDebt,
6581
6816
  farmsProgram: constants_1.KAMINO_FARM_PROGRAM,
@@ -6603,7 +6838,7 @@ class KaminoLendingClient {
6603
6838
  const obligationFarmAccount = await this.base.provider.connection.getAccountInfo(obligationFarm);
6604
6839
  if (!obligationFarmAccount) {
6605
6840
  preInstructions.push(await this.base.program.methods
6606
- .kaminoLendingInitObligationFarmsForReserve(0) // TODO: What does mode do?
6841
+ .kaminoLendingInitObligationFarmsForReserve(1) // 1 - debt farm
6607
6842
  .accounts({
6608
6843
  glamState: this.base.statePda,
6609
6844
  glamSigner,
@@ -6635,6 +6870,7 @@ class KaminoLendingClient {
6635
6870
  obligation,
6636
6871
  reserves: reservesInUse,
6637
6872
  }));
6873
+ const { tokenProgram } = await this.base.fetchMintAndTokenProgram(asset);
6638
6874
  const repayIx = await this.base.program.methods
6639
6875
  .kaminoLendingRepayObligationLiquidityV2(amount)
6640
6876
  .accounts({
@@ -6646,9 +6882,9 @@ class KaminoLendingClient {
6646
6882
  repayReserve: repayReserve.address,
6647
6883
  reserveLiquidityMint: asset,
6648
6884
  reserveDestinationLiquidity: repayReserve.liquiditySupplyVault,
6649
- userSourceLiquidity: this.base.getVaultAta(asset),
6885
+ userSourceLiquidity: this.base.getVaultAta(asset, tokenProgram),
6650
6886
  instructionSysvarAccount: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
6651
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
6887
+ tokenProgram,
6652
6888
  obligationFarmUserState: obligationFarm,
6653
6889
  reserveFarmState: repayReserve.farmDebt,
6654
6890
  farmsProgram: constants_1.KAMINO_FARM_PROGRAM,
@@ -10406,7 +10642,7 @@ program
10406
10642
  .hook("preSubcommand", async (thisCommand, actionCommand) => {
10407
10643
  await (0, idl_1.idlCheck)(glamClient);
10408
10644
  })
10409
- .version("0.1.32");
10645
+ .version("0.1.34");
10410
10646
  program
10411
10647
  .command("env")
10412
10648
  .description("Display current environment setup")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glamsystems/glam-cli",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "CLI for interacting with the GLAM Protocol",
5
5
  "main": "./main.js",
6
6
  "bin": {
@@ -21,7 +21,7 @@
21
21
  "node": ">=20.18.0"
22
22
  },
23
23
  "dependencies": {
24
- "@glamsystems/glam-sdk": "0.1.32",
24
+ "@glamsystems/glam-sdk": "0.1.34",
25
25
  "commander": "^11.1.0",
26
26
  "inquirer": "^8.2.6",
27
27
  "@switchboard-xyz/common": "^3.0.0"