@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/instructions.d.ts
CHANGED
|
@@ -155,11 +155,13 @@ export type WithdrawWsolWithSessionParams = {
|
|
|
155
155
|
managerFeeAccount: PublicKey;
|
|
156
156
|
poolMint: PublicKey;
|
|
157
157
|
tokenProgramId: PublicKey;
|
|
158
|
-
solWithdrawAuthority?: PublicKey;
|
|
159
158
|
wsolMint: PublicKey;
|
|
160
159
|
programSigner: PublicKey;
|
|
160
|
+
userWallet: PublicKey;
|
|
161
161
|
poolTokensIn: number;
|
|
162
162
|
minimumLamportsOut: number;
|
|
163
|
+
payer?: PublicKey;
|
|
164
|
+
solWithdrawAuthority?: PublicKey;
|
|
163
165
|
};
|
|
164
166
|
/**
|
|
165
167
|
* Deposit SOL directly into the pool's reserve account. The output is a "pool" token
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -827,6 +827,7 @@ export async function withdrawWsolWithSession(
|
|
|
827
827
|
amount: number,
|
|
828
828
|
minimumLamportsOut: number = 0,
|
|
829
829
|
solWithdrawAuthority?: PublicKey,
|
|
830
|
+
payer?: PublicKey,
|
|
830
831
|
) {
|
|
831
832
|
const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress)
|
|
832
833
|
const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)
|
|
@@ -848,14 +849,8 @@ export async function withdrawWsolWithSession(
|
|
|
848
849
|
const instructions: TransactionInstruction[] = []
|
|
849
850
|
const signers: Signer[] = []
|
|
850
851
|
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
signerOrSession,
|
|
854
|
-
userWsolAccount,
|
|
855
|
-
userPubkey,
|
|
856
|
-
NATIVE_MINT,
|
|
857
|
-
),
|
|
858
|
-
)
|
|
852
|
+
// The program handles wSOL ATA creation internally
|
|
853
|
+
// This prevents rent drain attacks where paymaster pays for ATA and user reclaims rent
|
|
859
854
|
|
|
860
855
|
const [programSigner] = PublicKey.findProgramAddressSync(
|
|
861
856
|
[Buffer.from('fogo_session_program_signer')],
|
|
@@ -882,6 +877,8 @@ export async function withdrawWsolWithSession(
|
|
|
882
877
|
solWithdrawAuthority,
|
|
883
878
|
wsolMint: NATIVE_MINT,
|
|
884
879
|
programSigner,
|
|
880
|
+
userWallet: userPubkey,
|
|
881
|
+
payer,
|
|
885
882
|
poolTokensIn: poolTokens,
|
|
886
883
|
minimumLamportsOut,
|
|
887
884
|
}),
|
package/src/instructions.ts
CHANGED
|
@@ -382,11 +382,13 @@ export type WithdrawWsolWithSessionParams = {
|
|
|
382
382
|
managerFeeAccount: PublicKey
|
|
383
383
|
poolMint: PublicKey
|
|
384
384
|
tokenProgramId: PublicKey
|
|
385
|
-
solWithdrawAuthority?: PublicKey
|
|
386
385
|
wsolMint: PublicKey
|
|
387
386
|
programSigner: PublicKey
|
|
387
|
+
userWallet: PublicKey
|
|
388
388
|
poolTokensIn: number
|
|
389
389
|
minimumLamportsOut: number
|
|
390
|
+
payer?: PublicKey
|
|
391
|
+
solWithdrawAuthority?: PublicKey
|
|
390
392
|
}
|
|
391
393
|
|
|
392
394
|
/**
|
|
@@ -1138,6 +1140,9 @@ export class StakePoolInstruction {
|
|
|
1138
1140
|
|
|
1139
1141
|
{ pubkey: params.wsolMint, isSigner: false, isWritable: false },
|
|
1140
1142
|
{ pubkey: params.programSigner, isSigner: false, isWritable: true },
|
|
1143
|
+
{ pubkey: params.payer ?? params.userTransferAuthority, isSigner: true, isWritable: true },
|
|
1144
|
+
{ pubkey: params.userWallet, isSigner: false, isWritable: false },
|
|
1145
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
1141
1146
|
]
|
|
1142
1147
|
|
|
1143
1148
|
if (params.solWithdrawAuthority) {
|
|
@@ -1148,6 +1153,9 @@ export class StakePoolInstruction {
|
|
|
1148
1153
|
})
|
|
1149
1154
|
}
|
|
1150
1155
|
|
|
1156
|
+
// Associated Token Program must be last - only needed in transaction for CPI routing
|
|
1157
|
+
keys.push({ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false })
|
|
1158
|
+
|
|
1151
1159
|
return new TransactionInstruction({
|
|
1152
1160
|
programId: params.programId,
|
|
1153
1161
|
keys,
|