@ignitionfi/spl-stake-pool 1.1.11 → 1.1.13

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/index.d.ts CHANGED
@@ -56,7 +56,7 @@ export declare function depositStake(connection: Connection, stakePoolAddress: P
56
56
  /**
57
57
  * Creates instructions required to deposit sol to stake pool.
58
58
  */
59
- export declare function depositWsolWithSession(connection: Connection, stakePoolAddress: PublicKey, signerOrSession: PublicKey, userPubkey: PublicKey, lamports: number, destinationTokenAccount?: PublicKey, referrerTokenAccount?: PublicKey, depositAuthority?: PublicKey, payer?: PublicKey): Promise<{
59
+ export declare function depositWsolWithSession(connection: Connection, stakePoolAddress: PublicKey, signerOrSession: PublicKey, userPubkey: PublicKey, lamports: number, minimumPoolTokensOut?: number, destinationTokenAccount?: PublicKey, referrerTokenAccount?: PublicKey, depositAuthority?: PublicKey, payer?: PublicKey): Promise<{
60
60
  instructions: TransactionInstruction[];
61
61
  signers: never[];
62
62
  }>;
@@ -86,7 +86,7 @@ export declare function withdrawSol(connection: Connection, stakePoolAddress: Pu
86
86
  /**
87
87
  * Creates instructions required to withdraw wSOL from a stake pool.
88
88
  */
89
- export declare function withdrawWsolWithSession(connection: Connection, stakePoolAddress: PublicKey, signerOrSession: PublicKey, userPubkey: PublicKey, amount: number, solWithdrawAuthority?: PublicKey): Promise<{
89
+ export declare function withdrawWsolWithSession(connection: Connection, stakePoolAddress: PublicKey, signerOrSession: PublicKey, userPubkey: PublicKey, amount: number, minimumLamportsOut?: number, solWithdrawAuthority?: PublicKey): Promise<{
90
90
  instructions: TransactionInstruction[];
91
91
  signers: Signer[];
92
92
  }>;
package/dist/index.esm.js CHANGED
@@ -1083,14 +1083,16 @@ const STAKE_POOL_INSTRUCTION_LAYOUTS = Object.freeze({
1083
1083
  index: 27,
1084
1084
  layout: BufferLayout.struct([
1085
1085
  BufferLayout.u8('instruction'),
1086
- BufferLayout.ns64('lamports'),
1086
+ BufferLayout.ns64('lamportsIn'),
1087
+ BufferLayout.ns64('minimumPoolTokensOut'),
1087
1088
  ]),
1088
1089
  },
1089
1090
  WithdrawWsolWithSession: {
1090
1091
  index: 28,
1091
1092
  layout: BufferLayout.struct([
1092
1093
  BufferLayout.u8('instruction'),
1093
- BufferLayout.ns64('poolTokens'),
1094
+ BufferLayout.ns64('poolTokensIn'),
1095
+ BufferLayout.ns64('minimumLamportsOut'),
1094
1096
  ]),
1095
1097
  },
1096
1098
  });
@@ -1424,7 +1426,10 @@ class StakePoolInstruction {
1424
1426
  static depositWsolWithSession(params) {
1425
1427
  var _a;
1426
1428
  const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DepositWsolWithSession;
1427
- const data = encodeData(type, { lamports: params.lamports });
1429
+ const data = encodeData(type, {
1430
+ lamportsIn: params.lamportsIn,
1431
+ minimumPoolTokensOut: params.minimumPoolTokensOut,
1432
+ });
1428
1433
  const keys = [
1429
1434
  { pubkey: params.stakePool, isSigner: false, isWritable: true },
1430
1435
  { pubkey: params.withdrawAuthority, isSigner: false, isWritable: false },
@@ -1523,7 +1528,10 @@ class StakePoolInstruction {
1523
1528
  */
1524
1529
  static withdrawWsolWithSession(params) {
1525
1530
  const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawWsolWithSession;
1526
- const data = encodeData(type, { poolTokens: params.poolTokens });
1531
+ const data = encodeData(type, {
1532
+ poolTokensIn: params.poolTokensIn,
1533
+ minimumLamportsOut: params.minimumLamportsOut,
1534
+ });
1527
1535
  const keys = [
1528
1536
  { pubkey: params.stakePool, isSigner: false, isWritable: true },
1529
1537
  { pubkey: params.withdrawAuthority, isSigner: false, isWritable: false },
@@ -1816,7 +1824,7 @@ async function depositStake(connection, stakePoolAddress, authorizedPubkey, vali
1816
1824
  /**
1817
1825
  * Creates instructions required to deposit sol to stake pool.
1818
1826
  */
1819
- async function depositWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, lamports, destinationTokenAccount, referrerTokenAccount, depositAuthority, payer) {
1827
+ async function depositWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, lamports, minimumPoolTokensOut = 0, destinationTokenAccount, referrerTokenAccount, depositAuthority, payer) {
1820
1828
  const wsolTokenAccount = getAssociatedTokenAddressSync(NATIVE_MINT, userPubkey);
1821
1829
  const tokenAccountInfo = await connection.getTokenAccountBalance(wsolTokenAccount, 'confirmed');
1822
1830
  const wsolBalance = tokenAccountInfo
@@ -1848,7 +1856,8 @@ async function depositWsolWithSession(connection, stakePoolAddress, signerOrSess
1848
1856
  managerFeeAccount: stakePool.managerFeeAccount,
1849
1857
  referralPoolAccount: referrerTokenAccount !== null && referrerTokenAccount !== void 0 ? referrerTokenAccount : destinationTokenAccount,
1850
1858
  poolMint: stakePool.poolMint,
1851
- lamports,
1859
+ lamportsIn: lamports,
1860
+ minimumPoolTokensOut,
1852
1861
  withdrawAuthority,
1853
1862
  depositAuthority,
1854
1863
  wsolMint: NATIVE_MINT,
@@ -2120,7 +2129,7 @@ async function withdrawSol(connection, stakePoolAddress, tokenOwner, solReceiver
2120
2129
  /**
2121
2130
  * Creates instructions required to withdraw wSOL from a stake pool.
2122
2131
  */
2123
- async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, solWithdrawAuthority) {
2132
+ async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, minimumLamportsOut = 0, solWithdrawAuthority) {
2124
2133
  const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress);
2125
2134
  const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint);
2126
2135
  const stakePool = stakePoolAccount.account.data;
@@ -2151,7 +2160,8 @@ async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSes
2151
2160
  solWithdrawAuthority,
2152
2161
  wsolMint: NATIVE_MINT,
2153
2162
  programSigner,
2154
- poolTokens,
2163
+ poolTokensIn: poolTokens,
2164
+ minimumLamportsOut,
2155
2165
  }));
2156
2166
  return {
2157
2167
  instructions,