@ignitionfi/spl-stake-pool 1.1.19 → 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 +11 -2
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.browser.esm.js +11 -2
- package/dist/index.browser.esm.js.map +1 -1
- package/dist/index.cjs.js +11 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +11 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +11 -2
- 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 +3 -1
- package/package.json +1 -1
- package/src/index.ts +5 -8
- package/src/instructions.ts +9 -1
package/dist/index.iife.js
CHANGED
|
@@ -22732,6 +22732,7 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
22732
22732
|
* Creates a transaction instruction to withdraw WSOL from a stake pool using a session.
|
|
22733
22733
|
*/
|
|
22734
22734
|
static withdrawWsolWithSession(params) {
|
|
22735
|
+
var _a;
|
|
22735
22736
|
const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawWsolWithSession;
|
|
22736
22737
|
const data = encodeData(type, {
|
|
22737
22738
|
poolTokensIn: params.poolTokensIn,
|
|
@@ -22752,6 +22753,9 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
22752
22753
|
{ pubkey: params.tokenProgramId, isSigner: false, isWritable: false },
|
|
22753
22754
|
{ pubkey: params.wsolMint, isSigner: false, isWritable: false },
|
|
22754
22755
|
{ pubkey: params.programSigner, isSigner: false, isWritable: true },
|
|
22756
|
+
{ pubkey: (_a = params.payer) !== null && _a !== void 0 ? _a : params.userTransferAuthority, isSigner: true, isWritable: true },
|
|
22757
|
+
{ pubkey: params.userWallet, isSigner: false, isWritable: false },
|
|
22758
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
22755
22759
|
];
|
|
22756
22760
|
if (params.solWithdrawAuthority) {
|
|
22757
22761
|
keys.push({
|
|
@@ -22760,6 +22764,8 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
22760
22764
|
isWritable: false,
|
|
22761
22765
|
});
|
|
22762
22766
|
}
|
|
22767
|
+
// Associated Token Program must be last - only needed in transaction for CPI routing
|
|
22768
|
+
keys.push({ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false });
|
|
22763
22769
|
return new TransactionInstruction({
|
|
22764
22770
|
programId: params.programId,
|
|
22765
22771
|
keys,
|
|
@@ -23333,7 +23339,7 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
23333
23339
|
/**
|
|
23334
23340
|
* Creates instructions required to withdraw wSOL from a stake pool.
|
|
23335
23341
|
*/
|
|
23336
|
-
async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, minimumLamportsOut = 0, solWithdrawAuthority) {
|
|
23342
|
+
async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, minimumLamportsOut = 0, solWithdrawAuthority, payer) {
|
|
23337
23343
|
const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress);
|
|
23338
23344
|
const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint);
|
|
23339
23345
|
const stakePool = stakePoolAccount.account.data;
|
|
@@ -23347,7 +23353,8 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
23347
23353
|
const userWsolAccount = getAssociatedTokenAddressSync(NATIVE_MINT, userPubkey);
|
|
23348
23354
|
const instructions = [];
|
|
23349
23355
|
const signers = [];
|
|
23350
|
-
|
|
23356
|
+
// The program handles wSOL ATA creation internally
|
|
23357
|
+
// This prevents rent drain attacks where paymaster pays for ATA and user reclaims rent
|
|
23351
23358
|
const [programSigner] = PublicKey.findProgramAddressSync([Buffer.from('fogo_session_program_signer')], stakePoolProgramId);
|
|
23352
23359
|
const withdrawAuthority = await findWithdrawAuthorityProgramAddress(stakePoolProgramId, stakePoolAddress);
|
|
23353
23360
|
instructions.push(StakePoolInstruction.withdrawWsolWithSession({
|
|
@@ -23364,6 +23371,8 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
23364
23371
|
solWithdrawAuthority,
|
|
23365
23372
|
wsolMint: NATIVE_MINT,
|
|
23366
23373
|
programSigner,
|
|
23374
|
+
userWallet: userPubkey,
|
|
23375
|
+
payer,
|
|
23367
23376
|
poolTokensIn: poolTokens,
|
|
23368
23377
|
minimumLamportsOut,
|
|
23369
23378
|
}));
|