@ignitionfi/spl-stake-pool 1.1.14 → 1.1.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ignitionfi/spl-stake-pool",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
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(
@@ -857,14 +847,14 @@ export async function withdrawWsolWithSession(
857
847
  const instructions: TransactionInstruction[] = []
858
848
  const signers: Signer[] = []
859
849
 
860
- // instructions.push(
861
- // createAssociatedTokenAccountIdempotentInstruction(
862
- // signerOrSession,
863
- // userWsolAccount,
864
- // userPubkey,
865
- // NATIVE_MINT,
866
- // ),
867
- // )
850
+ instructions.push(
851
+ createAssociatedTokenAccountIdempotentInstruction(
852
+ signerOrSession,
853
+ userWsolAccount,
854
+ userPubkey,
855
+ NATIVE_MINT,
856
+ ),
857
+ )
868
858
 
869
859
  const [programSigner] = PublicKey.findProgramAddressSync(
870
860
  [Buffer.from('fogo_session_program_signer')],
@@ -1,5 +1,5 @@
1
1
  import * as BufferLayout from '@solana/buffer-layout'
2
- import { TOKEN_PROGRAM_ID } from '@solana/spl-token'
2
+ import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '@solana/spl-token'
3
3
  import {
4
4
  PublicKey,
5
5
  STAKE_CONFIG_ID,
@@ -992,6 +992,7 @@ export class StakePoolInstruction {
992
992
  { pubkey: params.wsolTransientAccount, isSigner: false, isWritable: true },
993
993
  { pubkey: params.programSigner, isSigner: false, isWritable: true },
994
994
  { pubkey: params.payer ?? params.fundingAccount, isSigner: true, isWritable: true },
995
+ { pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
995
996
  ]
996
997
 
997
998
  if (params.depositAuthority) {