@ignitionfi/spl-stake-pool 1.1.11 → 1.1.13
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 +18 -8
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.browser.esm.js +18 -8
- package/dist/index.browser.esm.js.map +1 -1
- package/dist/index.cjs.js +18 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +18 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +18 -8
- 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 +5 -2
- package/package.json +1 -1
- package/src/index.ts +14 -11
- package/src/instructions.ts +17 -6
package/dist/instructions.d.ts
CHANGED
|
@@ -158,7 +158,8 @@ export type WithdrawWsolWithSessionParams = {
|
|
|
158
158
|
solWithdrawAuthority?: PublicKey;
|
|
159
159
|
wsolMint: PublicKey;
|
|
160
160
|
programSigner: PublicKey;
|
|
161
|
-
|
|
161
|
+
poolTokensIn: number;
|
|
162
|
+
minimumLamportsOut: number;
|
|
162
163
|
};
|
|
163
164
|
/**
|
|
164
165
|
* Deposit SOL directly into the pool's reserve account. The output is a "pool" token
|
|
@@ -279,7 +280,7 @@ export declare class StakePoolInstruction {
|
|
|
279
280
|
/**
|
|
280
281
|
* Creates a transaction instruction to deposit WSOL into a stake pool.
|
|
281
282
|
*/
|
|
282
|
-
static depositWsolWithSession(params: DepositSolParams & {
|
|
283
|
+
static depositWsolWithSession(params: Omit<DepositSolParams, 'lamports'> & {
|
|
283
284
|
wsolMint: PublicKey;
|
|
284
285
|
wsolTokenAccount: PublicKey;
|
|
285
286
|
wsolTransientAccount: PublicKey;
|
|
@@ -287,6 +288,8 @@ export declare class StakePoolInstruction {
|
|
|
287
288
|
tokenProgramId: PublicKey;
|
|
288
289
|
programId: PublicKey;
|
|
289
290
|
payer?: PublicKey;
|
|
291
|
+
lamportsIn: number;
|
|
292
|
+
minimumPoolTokensOut: number;
|
|
290
293
|
}): TransactionInstruction;
|
|
291
294
|
/**
|
|
292
295
|
* Creates a transaction instruction to withdraw active stake from a stake pool.
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -295,6 +295,7 @@ export async function depositWsolWithSession(
|
|
|
295
295
|
signerOrSession: PublicKey,
|
|
296
296
|
userPubkey: PublicKey,
|
|
297
297
|
lamports: number,
|
|
298
|
+
minimumPoolTokensOut: number = 0,
|
|
298
299
|
destinationTokenAccount?: PublicKey,
|
|
299
300
|
referrerTokenAccount?: PublicKey,
|
|
300
301
|
depositAuthority?: PublicKey,
|
|
@@ -368,10 +369,10 @@ export async function depositWsolWithSession(
|
|
|
368
369
|
managerFeeAccount: stakePool.managerFeeAccount,
|
|
369
370
|
referralPoolAccount: referrerTokenAccount ?? destinationTokenAccount,
|
|
370
371
|
poolMint: stakePool.poolMint,
|
|
371
|
-
lamports,
|
|
372
|
+
lamportsIn: lamports,
|
|
373
|
+
minimumPoolTokensOut,
|
|
372
374
|
withdrawAuthority,
|
|
373
375
|
depositAuthority,
|
|
374
|
-
|
|
375
376
|
wsolMint: NATIVE_MINT,
|
|
376
377
|
wsolTokenAccount,
|
|
377
378
|
wsolTransientAccount,
|
|
@@ -833,6 +834,7 @@ export async function withdrawWsolWithSession(
|
|
|
833
834
|
signerOrSession: PublicKey,
|
|
834
835
|
userPubkey: PublicKey,
|
|
835
836
|
amount: number,
|
|
837
|
+
minimumLamportsOut: number = 0,
|
|
836
838
|
solWithdrawAuthority?: PublicKey,
|
|
837
839
|
) {
|
|
838
840
|
const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress)
|
|
@@ -855,14 +857,14 @@ export async function withdrawWsolWithSession(
|
|
|
855
857
|
const instructions: TransactionInstruction[] = []
|
|
856
858
|
const signers: Signer[] = []
|
|
857
859
|
|
|
858
|
-
instructions.push(
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
)
|
|
860
|
+
// instructions.push(
|
|
861
|
+
// createAssociatedTokenAccountIdempotentInstruction(
|
|
862
|
+
// signerOrSession,
|
|
863
|
+
// userWsolAccount,
|
|
864
|
+
// userPubkey,
|
|
865
|
+
// NATIVE_MINT,
|
|
866
|
+
// ),
|
|
867
|
+
// )
|
|
866
868
|
|
|
867
869
|
const [programSigner] = PublicKey.findProgramAddressSync(
|
|
868
870
|
[Buffer.from('fogo_session_program_signer')],
|
|
@@ -889,7 +891,8 @@ export async function withdrawWsolWithSession(
|
|
|
889
891
|
solWithdrawAuthority,
|
|
890
892
|
wsolMint: NATIVE_MINT,
|
|
891
893
|
programSigner,
|
|
892
|
-
poolTokens,
|
|
894
|
+
poolTokensIn: poolTokens,
|
|
895
|
+
minimumLamportsOut,
|
|
893
896
|
}),
|
|
894
897
|
)
|
|
895
898
|
|
package/src/instructions.ts
CHANGED
|
@@ -214,14 +214,16 @@ export const STAKE_POOL_INSTRUCTION_LAYOUTS: {
|
|
|
214
214
|
index: 27,
|
|
215
215
|
layout: BufferLayout.struct<any>([
|
|
216
216
|
BufferLayout.u8('instruction'),
|
|
217
|
-
BufferLayout.ns64('
|
|
217
|
+
BufferLayout.ns64('lamportsIn'),
|
|
218
|
+
BufferLayout.ns64('minimumPoolTokensOut'),
|
|
218
219
|
]),
|
|
219
220
|
},
|
|
220
221
|
WithdrawWsolWithSession: {
|
|
221
222
|
index: 28,
|
|
222
223
|
layout: BufferLayout.struct<any>([
|
|
223
224
|
BufferLayout.u8('instruction'),
|
|
224
|
-
BufferLayout.ns64('
|
|
225
|
+
BufferLayout.ns64('poolTokensIn'),
|
|
226
|
+
BufferLayout.ns64('minimumLamportsOut'),
|
|
225
227
|
]),
|
|
226
228
|
},
|
|
227
229
|
})
|
|
@@ -383,7 +385,8 @@ export type WithdrawWsolWithSessionParams = {
|
|
|
383
385
|
solWithdrawAuthority?: PublicKey
|
|
384
386
|
wsolMint: PublicKey
|
|
385
387
|
programSigner: PublicKey
|
|
386
|
-
|
|
388
|
+
poolTokensIn: number
|
|
389
|
+
minimumLamportsOut: number
|
|
387
390
|
}
|
|
388
391
|
|
|
389
392
|
/**
|
|
@@ -954,7 +957,7 @@ export class StakePoolInstruction {
|
|
|
954
957
|
/**
|
|
955
958
|
* Creates a transaction instruction to deposit WSOL into a stake pool.
|
|
956
959
|
*/
|
|
957
|
-
static depositWsolWithSession(params: DepositSolParams & {
|
|
960
|
+
static depositWsolWithSession(params: Omit<DepositSolParams, 'lamports'> & {
|
|
958
961
|
wsolMint: PublicKey
|
|
959
962
|
wsolTokenAccount: PublicKey
|
|
960
963
|
wsolTransientAccount: PublicKey
|
|
@@ -962,9 +965,14 @@ export class StakePoolInstruction {
|
|
|
962
965
|
tokenProgramId: PublicKey
|
|
963
966
|
programId: PublicKey
|
|
964
967
|
payer?: PublicKey
|
|
968
|
+
lamportsIn: number
|
|
969
|
+
minimumPoolTokensOut: number
|
|
965
970
|
}): TransactionInstruction {
|
|
966
971
|
const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DepositWsolWithSession
|
|
967
|
-
const data = encodeData(type, {
|
|
972
|
+
const data = encodeData(type, {
|
|
973
|
+
lamportsIn: params.lamportsIn,
|
|
974
|
+
minimumPoolTokensOut: params.minimumPoolTokensOut,
|
|
975
|
+
})
|
|
968
976
|
|
|
969
977
|
const keys = [
|
|
970
978
|
{ pubkey: params.stakePool, isSigner: false, isWritable: true },
|
|
@@ -1104,7 +1112,10 @@ export class StakePoolInstruction {
|
|
|
1104
1112
|
params: WithdrawWsolWithSessionParams,
|
|
1105
1113
|
): TransactionInstruction {
|
|
1106
1114
|
const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawWsolWithSession
|
|
1107
|
-
const data = encodeData(type, {
|
|
1115
|
+
const data = encodeData(type, {
|
|
1116
|
+
poolTokensIn: params.poolTokensIn,
|
|
1117
|
+
minimumLamportsOut: params.minimumLamportsOut,
|
|
1118
|
+
})
|
|
1108
1119
|
|
|
1109
1120
|
const keys = [
|
|
1110
1121
|
{ pubkey: params.stakePool, isSigner: false, isWritable: true },
|