@ignitionfi/spl-stake-pool 1.1.15 → 1.1.17

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.
@@ -1447,6 +1447,7 @@ class StakePoolInstruction {
1447
1447
  { pubkey: params.wsolTransientAccount, isSigner: false, isWritable: true },
1448
1448
  { pubkey: params.programSigner, isSigner: false, isWritable: true },
1449
1449
  { pubkey: (_a = params.payer) !== null && _a !== void 0 ? _a : params.fundingAccount, isSigner: true, isWritable: true },
1450
+ { pubkey: params.userWallet, isSigner: false, isWritable: false },
1450
1451
  ];
1451
1452
  if (params.depositAuthority) {
1452
1453
  keys.push({
@@ -1836,13 +1837,11 @@ async function depositWsolWithSession(connection, stakePoolAddress, signerOrSess
1836
1837
  const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress);
1837
1838
  const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint);
1838
1839
  const stakePool = stakePoolAccount.account.data;
1839
- // stakePool.tokenProgramId
1840
1840
  const instructions = [];
1841
- // Create token account if not specified
1841
+ // The program handles ATA creation internally using funds from the user's deposit
1842
+ // This prevents rent drain attacks where paymaster pays for ATA and user reclaims rent
1842
1843
  if (!destinationTokenAccount) {
1843
- const associatedAddress = getAssociatedTokenAddressSync(stakePool.poolMint, userPubkey);
1844
- instructions.push(createAssociatedTokenAccountIdempotentInstruction(payer !== null && payer !== void 0 ? payer : signerOrSession, associatedAddress, userPubkey, stakePool.poolMint));
1845
- destinationTokenAccount = associatedAddress;
1844
+ destinationTokenAccount = getAssociatedTokenAddressSync(stakePool.poolMint, userPubkey);
1846
1845
  }
1847
1846
  const withdrawAuthority = await findWithdrawAuthorityProgramAddress(stakePoolProgramId, stakePoolAddress);
1848
1847
  const [programSigner] = PublicKey.findProgramAddressSync([Buffer.from('fogo_session_program_signer')], stakePoolProgramId);
@@ -1866,6 +1865,7 @@ async function depositWsolWithSession(connection, stakePoolAddress, signerOrSess
1866
1865
  tokenProgramId: stakePool.tokenProgramId,
1867
1866
  programSigner,
1868
1867
  payer,
1868
+ userWallet: userPubkey,
1869
1869
  }));
1870
1870
  return {
1871
1871
  instructions,