@ignitionfi/spl-stake-pool 1.1.10 → 1.1.12
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 +20 -9
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.browser.esm.js +20 -9
- package/dist/index.browser.esm.js.map +1 -1
- package/dist/index.cjs.js +20 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +20 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +20 -9
- 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 +10 -8
- package/src/instructions.ts +17 -6
package/dist/index.iife.js
CHANGED
|
@@ -22285,14 +22285,16 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
22285
22285
|
index: 27,
|
|
22286
22286
|
layout: LayoutExports$1.struct([
|
|
22287
22287
|
LayoutExports$1.u8('instruction'),
|
|
22288
|
-
LayoutExports$1.ns64('
|
|
22288
|
+
LayoutExports$1.ns64('lamportsIn'),
|
|
22289
|
+
LayoutExports$1.ns64('minimumPoolTokensOut'),
|
|
22289
22290
|
]),
|
|
22290
22291
|
},
|
|
22291
22292
|
WithdrawWsolWithSession: {
|
|
22292
22293
|
index: 28,
|
|
22293
22294
|
layout: LayoutExports$1.struct([
|
|
22294
22295
|
LayoutExports$1.u8('instruction'),
|
|
22295
|
-
LayoutExports$1.ns64('
|
|
22296
|
+
LayoutExports$1.ns64('poolTokensIn'),
|
|
22297
|
+
LayoutExports$1.ns64('minimumLamportsOut'),
|
|
22296
22298
|
]),
|
|
22297
22299
|
},
|
|
22298
22300
|
});
|
|
@@ -22626,7 +22628,10 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
22626
22628
|
static depositWsolWithSession(params) {
|
|
22627
22629
|
var _a;
|
|
22628
22630
|
const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DepositWsolWithSession;
|
|
22629
|
-
const data = encodeData(type, {
|
|
22631
|
+
const data = encodeData(type, {
|
|
22632
|
+
lamportsIn: params.lamportsIn,
|
|
22633
|
+
minimumPoolTokensOut: params.minimumPoolTokensOut,
|
|
22634
|
+
});
|
|
22630
22635
|
const keys = [
|
|
22631
22636
|
{ pubkey: params.stakePool, isSigner: false, isWritable: true },
|
|
22632
22637
|
{ pubkey: params.withdrawAuthority, isSigner: false, isWritable: false },
|
|
@@ -22725,7 +22730,10 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
22725
22730
|
*/
|
|
22726
22731
|
static withdrawWsolWithSession(params) {
|
|
22727
22732
|
const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawWsolWithSession;
|
|
22728
|
-
const data = encodeData(type, {
|
|
22733
|
+
const data = encodeData(type, {
|
|
22734
|
+
poolTokensIn: params.poolTokensIn,
|
|
22735
|
+
minimumLamportsOut: params.minimumLamportsOut,
|
|
22736
|
+
});
|
|
22729
22737
|
const keys = [
|
|
22730
22738
|
{ pubkey: params.stakePool, isSigner: false, isWritable: true },
|
|
22731
22739
|
{ pubkey: params.withdrawAuthority, isSigner: false, isWritable: false },
|
|
@@ -23018,7 +23026,7 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
23018
23026
|
/**
|
|
23019
23027
|
* Creates instructions required to deposit sol to stake pool.
|
|
23020
23028
|
*/
|
|
23021
|
-
async function depositWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, lamports, destinationTokenAccount, referrerTokenAccount, depositAuthority, payer) {
|
|
23029
|
+
async function depositWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, lamports, minimumPoolTokensOut = 0, destinationTokenAccount, referrerTokenAccount, depositAuthority, payer) {
|
|
23022
23030
|
const wsolTokenAccount = getAssociatedTokenAddressSync(NATIVE_MINT, userPubkey);
|
|
23023
23031
|
const tokenAccountInfo = await connection.getTokenAccountBalance(wsolTokenAccount, 'confirmed');
|
|
23024
23032
|
const wsolBalance = tokenAccountInfo
|
|
@@ -23030,11 +23038,12 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
23030
23038
|
const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress);
|
|
23031
23039
|
const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint);
|
|
23032
23040
|
const stakePool = stakePoolAccount.account.data;
|
|
23041
|
+
// stakePool.tokenProgramId
|
|
23033
23042
|
const instructions = [];
|
|
23034
23043
|
// Create token account if not specified
|
|
23035
23044
|
if (!destinationTokenAccount) {
|
|
23036
23045
|
const associatedAddress = getAssociatedTokenAddressSync(stakePool.poolMint, userPubkey);
|
|
23037
|
-
instructions.push(createAssociatedTokenAccountIdempotentInstruction(signerOrSession, associatedAddress, userPubkey, stakePool.poolMint));
|
|
23046
|
+
instructions.push(createAssociatedTokenAccountIdempotentInstruction(payer !== null && payer !== void 0 ? payer : signerOrSession, associatedAddress, userPubkey, stakePool.poolMint));
|
|
23038
23047
|
destinationTokenAccount = associatedAddress;
|
|
23039
23048
|
}
|
|
23040
23049
|
const withdrawAuthority = await findWithdrawAuthorityProgramAddress(stakePoolProgramId, stakePoolAddress);
|
|
@@ -23049,7 +23058,8 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
23049
23058
|
managerFeeAccount: stakePool.managerFeeAccount,
|
|
23050
23059
|
referralPoolAccount: referrerTokenAccount !== null && referrerTokenAccount !== void 0 ? referrerTokenAccount : destinationTokenAccount,
|
|
23051
23060
|
poolMint: stakePool.poolMint,
|
|
23052
|
-
lamports,
|
|
23061
|
+
lamportsIn: lamports,
|
|
23062
|
+
minimumPoolTokensOut,
|
|
23053
23063
|
withdrawAuthority,
|
|
23054
23064
|
depositAuthority,
|
|
23055
23065
|
wsolMint: NATIVE_MINT,
|
|
@@ -23321,7 +23331,7 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
23321
23331
|
/**
|
|
23322
23332
|
* Creates instructions required to withdraw wSOL from a stake pool.
|
|
23323
23333
|
*/
|
|
23324
|
-
async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, solWithdrawAuthority) {
|
|
23334
|
+
async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, minimumLamportsOut = 0, solWithdrawAuthority) {
|
|
23325
23335
|
const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress);
|
|
23326
23336
|
const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint);
|
|
23327
23337
|
const stakePool = stakePoolAccount.account.data;
|
|
@@ -23352,7 +23362,8 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
23352
23362
|
solWithdrawAuthority,
|
|
23353
23363
|
wsolMint: NATIVE_MINT,
|
|
23354
23364
|
programSigner,
|
|
23355
|
-
poolTokens,
|
|
23365
|
+
poolTokensIn: poolTokens,
|
|
23366
|
+
minimumLamportsOut,
|
|
23356
23367
|
}));
|
|
23357
23368
|
return {
|
|
23358
23369
|
instructions,
|