@ignitionfi/spl-stake-pool 1.1.18 → 1.1.20

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.
@@ -22649,7 +22649,6 @@ var solanaStakePool = (function (exports, node_buffer) {
22649
22649
  { pubkey: params.wsolTransientAccount, isSigner: false, isWritable: true },
22650
22650
  { pubkey: params.programSigner, isSigner: false, isWritable: true },
22651
22651
  { pubkey: (_a = params.payer) !== null && _a !== void 0 ? _a : params.fundingAccount, isSigner: true, isWritable: true },
22652
- { pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
22653
22652
  { pubkey: params.userWallet, isSigner: false, isWritable: false },
22654
22653
  ];
22655
22654
  if (params.depositAuthority) {
@@ -22659,6 +22658,8 @@ var solanaStakePool = (function (exports, node_buffer) {
22659
22658
  isWritable: false,
22660
22659
  });
22661
22660
  }
22661
+ // Associated Token Program must be last - only needed in transaction for CPI routing
22662
+ keys.push({ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false });
22662
22663
  return new TransactionInstruction({
22663
22664
  programId: params.programId,
22664
22665
  keys,
@@ -22731,6 +22732,7 @@ var solanaStakePool = (function (exports, node_buffer) {
22731
22732
  * Creates a transaction instruction to withdraw WSOL from a stake pool using a session.
22732
22733
  */
22733
22734
  static withdrawWsolWithSession(params) {
22735
+ var _a;
22734
22736
  const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawWsolWithSession;
22735
22737
  const data = encodeData(type, {
22736
22738
  poolTokensIn: params.poolTokensIn,
@@ -22751,6 +22753,9 @@ var solanaStakePool = (function (exports, node_buffer) {
22751
22753
  { pubkey: params.tokenProgramId, isSigner: false, isWritable: false },
22752
22754
  { pubkey: params.wsolMint, isSigner: false, isWritable: false },
22753
22755
  { pubkey: params.programSigner, isSigner: false, isWritable: true },
22756
+ { pubkey: (_a = params.payer) !== null && _a !== void 0 ? _a : params.userTransferAuthority, isSigner: true, isWritable: true },
22757
+ { pubkey: params.userWallet, isSigner: false, isWritable: false },
22758
+ { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
22754
22759
  ];
22755
22760
  if (params.solWithdrawAuthority) {
22756
22761
  keys.push({
@@ -22759,6 +22764,8 @@ var solanaStakePool = (function (exports, node_buffer) {
22759
22764
  isWritable: false,
22760
22765
  });
22761
22766
  }
22767
+ // Associated Token Program must be last - only needed in transaction for CPI routing
22768
+ keys.push({ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false });
22762
22769
  return new TransactionInstruction({
22763
22770
  programId: params.programId,
22764
22771
  keys,
@@ -23332,7 +23339,7 @@ var solanaStakePool = (function (exports, node_buffer) {
23332
23339
  /**
23333
23340
  * Creates instructions required to withdraw wSOL from a stake pool.
23334
23341
  */
23335
- async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, minimumLamportsOut = 0, solWithdrawAuthority) {
23342
+ async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, minimumLamportsOut = 0, solWithdrawAuthority, payer) {
23336
23343
  const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress);
23337
23344
  const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint);
23338
23345
  const stakePool = stakePoolAccount.account.data;
@@ -23346,7 +23353,8 @@ var solanaStakePool = (function (exports, node_buffer) {
23346
23353
  const userWsolAccount = getAssociatedTokenAddressSync(NATIVE_MINT, userPubkey);
23347
23354
  const instructions = [];
23348
23355
  const signers = [];
23349
- instructions.push(createAssociatedTokenAccountIdempotentInstruction(signerOrSession, userWsolAccount, userPubkey, NATIVE_MINT));
23356
+ // The program handles wSOL ATA creation internally
23357
+ // This prevents rent drain attacks where paymaster pays for ATA and user reclaims rent
23350
23358
  const [programSigner] = PublicKey.findProgramAddressSync([Buffer.from('fogo_session_program_signer')], stakePoolProgramId);
23351
23359
  const withdrawAuthority = await findWithdrawAuthorityProgramAddress(stakePoolProgramId, stakePoolAddress);
23352
23360
  instructions.push(StakePoolInstruction.withdrawWsolWithSession({
@@ -23363,6 +23371,8 @@ var solanaStakePool = (function (exports, node_buffer) {
23363
23371
  solWithdrawAuthority,
23364
23372
  wsolMint: NATIVE_MINT,
23365
23373
  programSigner,
23374
+ userWallet: userPubkey,
23375
+ payer,
23366
23376
  poolTokensIn: poolTokens,
23367
23377
  minimumLamportsOut,
23368
23378
  }));