@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.
@@ -288,6 +288,7 @@ export declare class StakePoolInstruction {
288
288
  tokenProgramId: PublicKey;
289
289
  programId: PublicKey;
290
290
  payer?: PublicKey;
291
+ userWallet: PublicKey;
291
292
  lamportsIn: number;
292
293
  minimumPoolTokensOut: number;
293
294
  }): TransactionInstruction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ignitionfi/spl-stake-pool",
3
- "version": "1.1.15",
3
+ "version": "1.1.17",
4
4
  "description": "Ignition Stake Pool SDK for FOGO",
5
5
  "contributors": [
6
6
  "Anza Maintainers <maintainers@anza.xyz>",
package/src/index.ts CHANGED
@@ -323,25 +323,15 @@ export async function depositWsolWithSession(
323
323
  const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)
324
324
  const stakePool = stakePoolAccount.account.data
325
325
 
326
- // stakePool.tokenProgramId
327
-
328
326
  const instructions: TransactionInstruction[] = []
329
327
 
330
- // Create token account if not specified
328
+ // The program handles ATA creation internally using funds from the user's deposit
329
+ // This prevents rent drain attacks where paymaster pays for ATA and user reclaims rent
331
330
  if (!destinationTokenAccount) {
332
- const associatedAddress = getAssociatedTokenAddressSync(
331
+ destinationTokenAccount = getAssociatedTokenAddressSync(
333
332
  stakePool.poolMint,
334
333
  userPubkey,
335
334
  )
336
- instructions.push(
337
- createAssociatedTokenAccountIdempotentInstruction(
338
- payer ?? signerOrSession,
339
- associatedAddress,
340
- userPubkey,
341
- stakePool.poolMint,
342
- ),
343
- )
344
- destinationTokenAccount = associatedAddress
345
335
  }
346
336
 
347
337
  const withdrawAuthority = await findWithdrawAuthorityProgramAddress(
@@ -379,6 +369,7 @@ export async function depositWsolWithSession(
379
369
  tokenProgramId: stakePool.tokenProgramId,
380
370
  programSigner,
381
371
  payer,
372
+ userWallet: userPubkey,
382
373
  }),
383
374
  )
384
375
  return {
@@ -965,6 +965,7 @@ export class StakePoolInstruction {
965
965
  tokenProgramId: PublicKey
966
966
  programId: PublicKey
967
967
  payer?: PublicKey
968
+ userWallet: PublicKey
968
969
  lamportsIn: number
969
970
  minimumPoolTokensOut: number
970
971
  }): TransactionInstruction {
@@ -992,6 +993,7 @@ export class StakePoolInstruction {
992
993
  { pubkey: params.wsolTransientAccount, isSigner: false, isWritable: true },
993
994
  { pubkey: params.programSigner, isSigner: false, isWritable: true },
994
995
  { pubkey: params.payer ?? params.fundingAccount, isSigner: true, isWritable: true },
996
+ { pubkey: params.userWallet, isSigner: false, isWritable: false },
995
997
  ]
996
998
 
997
999
  if (params.depositAuthority) {