@ignitionfi/spl-stake-pool 1.1.18 → 1.1.20
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 +13 -3
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.browser.esm.js +13 -3
- package/dist/index.browser.esm.js.map +1 -1
- package/dist/index.cjs.js +13 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +13 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +13 -3
- 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/dist/instructions.d.ts +4 -2
- package/package.json +1 -1
- package/src/index.ts +5 -8
- package/src/instructions.ts +13 -3
|
@@ -1447,7 +1447,6 @@ 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 },
|
|
1451
1450
|
{ pubkey: params.userWallet, isSigner: false, isWritable: false },
|
|
1452
1451
|
];
|
|
1453
1452
|
if (params.depositAuthority) {
|
|
@@ -1457,6 +1456,8 @@ class StakePoolInstruction {
|
|
|
1457
1456
|
isWritable: false,
|
|
1458
1457
|
});
|
|
1459
1458
|
}
|
|
1459
|
+
// Associated Token Program must be last - only needed in transaction for CPI routing
|
|
1460
|
+
keys.push({ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false });
|
|
1460
1461
|
return new TransactionInstruction({
|
|
1461
1462
|
programId: params.programId,
|
|
1462
1463
|
keys,
|
|
@@ -1529,6 +1530,7 @@ class StakePoolInstruction {
|
|
|
1529
1530
|
* Creates a transaction instruction to withdraw WSOL from a stake pool using a session.
|
|
1530
1531
|
*/
|
|
1531
1532
|
static withdrawWsolWithSession(params) {
|
|
1533
|
+
var _a;
|
|
1532
1534
|
const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawWsolWithSession;
|
|
1533
1535
|
const data = encodeData(type, {
|
|
1534
1536
|
poolTokensIn: params.poolTokensIn,
|
|
@@ -1549,6 +1551,9 @@ class StakePoolInstruction {
|
|
|
1549
1551
|
{ pubkey: params.tokenProgramId, isSigner: false, isWritable: false },
|
|
1550
1552
|
{ pubkey: params.wsolMint, isSigner: false, isWritable: false },
|
|
1551
1553
|
{ pubkey: params.programSigner, isSigner: false, isWritable: true },
|
|
1554
|
+
{ pubkey: (_a = params.payer) !== null && _a !== void 0 ? _a : params.userTransferAuthority, isSigner: true, isWritable: true },
|
|
1555
|
+
{ pubkey: params.userWallet, isSigner: false, isWritable: false },
|
|
1556
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
1552
1557
|
];
|
|
1553
1558
|
if (params.solWithdrawAuthority) {
|
|
1554
1559
|
keys.push({
|
|
@@ -1557,6 +1562,8 @@ class StakePoolInstruction {
|
|
|
1557
1562
|
isWritable: false,
|
|
1558
1563
|
});
|
|
1559
1564
|
}
|
|
1565
|
+
// Associated Token Program must be last - only needed in transaction for CPI routing
|
|
1566
|
+
keys.push({ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false });
|
|
1560
1567
|
return new TransactionInstruction({
|
|
1561
1568
|
programId: params.programId,
|
|
1562
1569
|
keys,
|
|
@@ -2130,7 +2137,7 @@ async function withdrawSol(connection, stakePoolAddress, tokenOwner, solReceiver
|
|
|
2130
2137
|
/**
|
|
2131
2138
|
* Creates instructions required to withdraw wSOL from a stake pool.
|
|
2132
2139
|
*/
|
|
2133
|
-
async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, minimumLamportsOut = 0, solWithdrawAuthority) {
|
|
2140
|
+
async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, minimumLamportsOut = 0, solWithdrawAuthority, payer) {
|
|
2134
2141
|
const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress);
|
|
2135
2142
|
const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint);
|
|
2136
2143
|
const stakePool = stakePoolAccount.account.data;
|
|
@@ -2144,7 +2151,8 @@ async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSes
|
|
|
2144
2151
|
const userWsolAccount = getAssociatedTokenAddressSync(NATIVE_MINT, userPubkey);
|
|
2145
2152
|
const instructions = [];
|
|
2146
2153
|
const signers = [];
|
|
2147
|
-
|
|
2154
|
+
// The program handles wSOL ATA creation internally
|
|
2155
|
+
// This prevents rent drain attacks where paymaster pays for ATA and user reclaims rent
|
|
2148
2156
|
const [programSigner] = PublicKey.findProgramAddressSync([Buffer.from('fogo_session_program_signer')], stakePoolProgramId);
|
|
2149
2157
|
const withdrawAuthority = await findWithdrawAuthorityProgramAddress(stakePoolProgramId, stakePoolAddress);
|
|
2150
2158
|
instructions.push(StakePoolInstruction.withdrawWsolWithSession({
|
|
@@ -2161,6 +2169,8 @@ async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSes
|
|
|
2161
2169
|
solWithdrawAuthority,
|
|
2162
2170
|
wsolMint: NATIVE_MINT,
|
|
2163
2171
|
programSigner,
|
|
2172
|
+
userWallet: userPubkey,
|
|
2173
|
+
payer,
|
|
2164
2174
|
poolTokensIn: poolTokens,
|
|
2165
2175
|
minimumLamportsOut,
|
|
2166
2176
|
}));
|