@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, createAssociatedTokenAccountIdempotentInstruction, NATIVE_MINT, getAccount, createApproveInstruction } from '@solana/spl-token';
|
|
1
|
+
import { TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, createAssociatedTokenAccountIdempotentInstruction, NATIVE_MINT, getAccount, createApproveInstruction } from '@solana/spl-token';
|
|
2
2
|
import { PublicKey, LAMPORTS_PER_SOL, StakeProgram, Keypair, SystemProgram, SYSVAR_RENT_PUBKEY, SYSVAR_CLOCK_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, STAKE_CONFIG_ID, TransactionInstruction, StakeAuthorizationLayout } from '@solana/web3.js';
|
|
3
3
|
import BN from 'bn.js';
|
|
4
4
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
@@ -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: ASSOCIATED_TOKEN_PROGRAM_ID, 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
|
-
//
|
|
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
|
-
|
|
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);
|
|
@@ -2143,14 +2142,7 @@ async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSes
|
|
|
2143
2142
|
const userWsolAccount = getAssociatedTokenAddressSync(NATIVE_MINT, userPubkey);
|
|
2144
2143
|
const instructions = [];
|
|
2145
2144
|
const signers = [];
|
|
2146
|
-
|
|
2147
|
-
// createAssociatedTokenAccountIdempotentInstruction(
|
|
2148
|
-
// signerOrSession,
|
|
2149
|
-
// userWsolAccount,
|
|
2150
|
-
// userPubkey,
|
|
2151
|
-
// NATIVE_MINT,
|
|
2152
|
-
// ),
|
|
2153
|
-
// )
|
|
2145
|
+
instructions.push(createAssociatedTokenAccountIdempotentInstruction(signerOrSession, userWsolAccount, userPubkey, NATIVE_MINT));
|
|
2154
2146
|
const [programSigner] = PublicKey.findProgramAddressSync([Buffer.from('fogo_session_program_signer')], stakePoolProgramId);
|
|
2155
2147
|
const withdrawAuthority = await findWithdrawAuthorityProgramAddress(stakePoolProgramId, stakePoolAddress);
|
|
2156
2148
|
instructions.push(StakePoolInstruction.withdrawWsolWithSession({
|