@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.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ export declare function withdrawSol(connection: Connection, stakePoolAddress: Pu
|
|
|
86
86
|
/**
|
|
87
87
|
* Creates instructions required to withdraw wSOL from a stake pool.
|
|
88
88
|
*/
|
|
89
|
-
export declare function withdrawWsolWithSession(connection: Connection, stakePoolAddress: PublicKey, signerOrSession: PublicKey, userPubkey: PublicKey, amount: number, minimumLamportsOut?: number, solWithdrawAuthority?: PublicKey): Promise<{
|
|
89
|
+
export declare function withdrawWsolWithSession(connection: Connection, stakePoolAddress: PublicKey, signerOrSession: PublicKey, userPubkey: PublicKey, amount: number, minimumLamportsOut?: number, solWithdrawAuthority?: PublicKey, payer?: PublicKey): Promise<{
|
|
90
90
|
instructions: TransactionInstruction[];
|
|
91
91
|
signers: Signer[];
|
|
92
92
|
}>;
|
package/dist/index.esm.js
CHANGED
|
@@ -1530,6 +1530,7 @@ class StakePoolInstruction {
|
|
|
1530
1530
|
* Creates a transaction instruction to withdraw WSOL from a stake pool using a session.
|
|
1531
1531
|
*/
|
|
1532
1532
|
static withdrawWsolWithSession(params) {
|
|
1533
|
+
var _a;
|
|
1533
1534
|
const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawWsolWithSession;
|
|
1534
1535
|
const data = encodeData(type, {
|
|
1535
1536
|
poolTokensIn: params.poolTokensIn,
|
|
@@ -1550,6 +1551,9 @@ class StakePoolInstruction {
|
|
|
1550
1551
|
{ pubkey: params.tokenProgramId, isSigner: false, isWritable: false },
|
|
1551
1552
|
{ pubkey: params.wsolMint, isSigner: false, isWritable: false },
|
|
1552
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 },
|
|
1553
1557
|
];
|
|
1554
1558
|
if (params.solWithdrawAuthority) {
|
|
1555
1559
|
keys.push({
|
|
@@ -1558,6 +1562,8 @@ class StakePoolInstruction {
|
|
|
1558
1562
|
isWritable: false,
|
|
1559
1563
|
});
|
|
1560
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 });
|
|
1561
1567
|
return new TransactionInstruction({
|
|
1562
1568
|
programId: params.programId,
|
|
1563
1569
|
keys,
|
|
@@ -2131,7 +2137,7 @@ async function withdrawSol(connection, stakePoolAddress, tokenOwner, solReceiver
|
|
|
2131
2137
|
/**
|
|
2132
2138
|
* Creates instructions required to withdraw wSOL from a stake pool.
|
|
2133
2139
|
*/
|
|
2134
|
-
async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, minimumLamportsOut = 0, solWithdrawAuthority) {
|
|
2140
|
+
async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, minimumLamportsOut = 0, solWithdrawAuthority, payer) {
|
|
2135
2141
|
const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress);
|
|
2136
2142
|
const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint);
|
|
2137
2143
|
const stakePool = stakePoolAccount.account.data;
|
|
@@ -2145,7 +2151,8 @@ async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSes
|
|
|
2145
2151
|
const userWsolAccount = getAssociatedTokenAddressSync(NATIVE_MINT, userPubkey);
|
|
2146
2152
|
const instructions = [];
|
|
2147
2153
|
const signers = [];
|
|
2148
|
-
|
|
2154
|
+
// The program handles wSOL ATA creation internally
|
|
2155
|
+
// This prevents rent drain attacks where paymaster pays for ATA and user reclaims rent
|
|
2149
2156
|
const [programSigner] = PublicKey.findProgramAddressSync([Buffer.from('fogo_session_program_signer')], stakePoolProgramId);
|
|
2150
2157
|
const withdrawAuthority = await findWithdrawAuthorityProgramAddress(stakePoolProgramId, stakePoolAddress);
|
|
2151
2158
|
instructions.push(StakePoolInstruction.withdrawWsolWithSession({
|
|
@@ -2162,6 +2169,8 @@ async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSes
|
|
|
2162
2169
|
solWithdrawAuthority,
|
|
2163
2170
|
wsolMint: NATIVE_MINT,
|
|
2164
2171
|
programSigner,
|
|
2172
|
+
userWallet: userPubkey,
|
|
2173
|
+
payer,
|
|
2165
2174
|
poolTokensIn: poolTokens,
|
|
2166
2175
|
minimumLamportsOut,
|
|
2167
2176
|
}));
|