@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/dist/index.browser.cjs.js +5 -13
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.browser.esm.js +6 -14
- package/dist/index.browser.esm.js.map +1 -1
- package/dist/index.cjs.js +5 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +6 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +5 -13
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +11 -21
- package/src/instructions.ts +2 -1
package/package.json
CHANGED
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
|
-
//
|
|
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
|
-
|
|
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
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
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')],
|
package/src/instructions.ts
CHANGED
|
@@ -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) {
|