@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
|
@@ -1468,7 +1468,6 @@ class StakePoolInstruction {
|
|
|
1468
1468
|
{ pubkey: params.wsolTransientAccount, isSigner: false, isWritable: true },
|
|
1469
1469
|
{ pubkey: params.programSigner, isSigner: false, isWritable: true },
|
|
1470
1470
|
{ pubkey: (_a = params.payer) !== null && _a !== void 0 ? _a : params.fundingAccount, isSigner: true, isWritable: true },
|
|
1471
|
-
{ pubkey: splToken.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
1472
1471
|
{ pubkey: params.userWallet, isSigner: false, isWritable: false },
|
|
1473
1472
|
];
|
|
1474
1473
|
if (params.depositAuthority) {
|
|
@@ -1478,6 +1477,8 @@ class StakePoolInstruction {
|
|
|
1478
1477
|
isWritable: false,
|
|
1479
1478
|
});
|
|
1480
1479
|
}
|
|
1480
|
+
// Associated Token Program must be last - only needed in transaction for CPI routing
|
|
1481
|
+
keys.push({ pubkey: splToken.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false });
|
|
1481
1482
|
return new web3_js.TransactionInstruction({
|
|
1482
1483
|
programId: params.programId,
|
|
1483
1484
|
keys,
|
|
@@ -1550,6 +1551,7 @@ class StakePoolInstruction {
|
|
|
1550
1551
|
* Creates a transaction instruction to withdraw WSOL from a stake pool using a session.
|
|
1551
1552
|
*/
|
|
1552
1553
|
static withdrawWsolWithSession(params) {
|
|
1554
|
+
var _a;
|
|
1553
1555
|
const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawWsolWithSession;
|
|
1554
1556
|
const data = encodeData(type, {
|
|
1555
1557
|
poolTokensIn: params.poolTokensIn,
|
|
@@ -1570,6 +1572,9 @@ class StakePoolInstruction {
|
|
|
1570
1572
|
{ pubkey: params.tokenProgramId, isSigner: false, isWritable: false },
|
|
1571
1573
|
{ pubkey: params.wsolMint, isSigner: false, isWritable: false },
|
|
1572
1574
|
{ pubkey: params.programSigner, isSigner: false, isWritable: true },
|
|
1575
|
+
{ pubkey: (_a = params.payer) !== null && _a !== void 0 ? _a : params.userTransferAuthority, isSigner: true, isWritable: true },
|
|
1576
|
+
{ pubkey: params.userWallet, isSigner: false, isWritable: false },
|
|
1577
|
+
{ pubkey: web3_js.SystemProgram.programId, isSigner: false, isWritable: false },
|
|
1573
1578
|
];
|
|
1574
1579
|
if (params.solWithdrawAuthority) {
|
|
1575
1580
|
keys.push({
|
|
@@ -1578,6 +1583,8 @@ class StakePoolInstruction {
|
|
|
1578
1583
|
isWritable: false,
|
|
1579
1584
|
});
|
|
1580
1585
|
}
|
|
1586
|
+
// Associated Token Program must be last - only needed in transaction for CPI routing
|
|
1587
|
+
keys.push({ pubkey: splToken.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false });
|
|
1581
1588
|
return new web3_js.TransactionInstruction({
|
|
1582
1589
|
programId: params.programId,
|
|
1583
1590
|
keys,
|
|
@@ -2151,7 +2158,7 @@ async function withdrawSol(connection, stakePoolAddress, tokenOwner, solReceiver
|
|
|
2151
2158
|
/**
|
|
2152
2159
|
* Creates instructions required to withdraw wSOL from a stake pool.
|
|
2153
2160
|
*/
|
|
2154
|
-
async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, minimumLamportsOut = 0, solWithdrawAuthority) {
|
|
2161
|
+
async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, minimumLamportsOut = 0, solWithdrawAuthority, payer) {
|
|
2155
2162
|
const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress);
|
|
2156
2163
|
const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint);
|
|
2157
2164
|
const stakePool = stakePoolAccount.account.data;
|
|
@@ -2165,7 +2172,8 @@ async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSes
|
|
|
2165
2172
|
const userWsolAccount = splToken.getAssociatedTokenAddressSync(splToken.NATIVE_MINT, userPubkey);
|
|
2166
2173
|
const instructions = [];
|
|
2167
2174
|
const signers = [];
|
|
2168
|
-
|
|
2175
|
+
// The program handles wSOL ATA creation internally
|
|
2176
|
+
// This prevents rent drain attacks where paymaster pays for ATA and user reclaims rent
|
|
2169
2177
|
const [programSigner] = web3_js.PublicKey.findProgramAddressSync([Buffer.from('fogo_session_program_signer')], stakePoolProgramId);
|
|
2170
2178
|
const withdrawAuthority = await findWithdrawAuthorityProgramAddress(stakePoolProgramId, stakePoolAddress);
|
|
2171
2179
|
instructions.push(StakePoolInstruction.withdrawWsolWithSession({
|
|
@@ -2182,6 +2190,8 @@ async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSes
|
|
|
2182
2190
|
solWithdrawAuthority,
|
|
2183
2191
|
wsolMint: splToken.NATIVE_MINT,
|
|
2184
2192
|
programSigner,
|
|
2193
|
+
userWallet: userPubkey,
|
|
2194
|
+
payer,
|
|
2185
2195
|
poolTokensIn: poolTokens,
|
|
2186
2196
|
minimumLamportsOut,
|
|
2187
2197
|
}));
|