@ignitionfi/spl-stake-pool 1.1.11 → 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 +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 +6 -3
- package/src/instructions.ts +17 -6
|
@@ -1083,14 +1083,16 @@ const STAKE_POOL_INSTRUCTION_LAYOUTS = Object.freeze({
|
|
|
1083
1083
|
index: 27,
|
|
1084
1084
|
layout: BufferLayout.struct([
|
|
1085
1085
|
BufferLayout.u8('instruction'),
|
|
1086
|
-
BufferLayout.ns64('
|
|
1086
|
+
BufferLayout.ns64('lamportsIn'),
|
|
1087
|
+
BufferLayout.ns64('minimumPoolTokensOut'),
|
|
1087
1088
|
]),
|
|
1088
1089
|
},
|
|
1089
1090
|
WithdrawWsolWithSession: {
|
|
1090
1091
|
index: 28,
|
|
1091
1092
|
layout: BufferLayout.struct([
|
|
1092
1093
|
BufferLayout.u8('instruction'),
|
|
1093
|
-
BufferLayout.ns64('
|
|
1094
|
+
BufferLayout.ns64('poolTokensIn'),
|
|
1095
|
+
BufferLayout.ns64('minimumLamportsOut'),
|
|
1094
1096
|
]),
|
|
1095
1097
|
},
|
|
1096
1098
|
});
|
|
@@ -1424,7 +1426,10 @@ class StakePoolInstruction {
|
|
|
1424
1426
|
static depositWsolWithSession(params) {
|
|
1425
1427
|
var _a;
|
|
1426
1428
|
const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DepositWsolWithSession;
|
|
1427
|
-
const data = encodeData(type, {
|
|
1429
|
+
const data = encodeData(type, {
|
|
1430
|
+
lamportsIn: params.lamportsIn,
|
|
1431
|
+
minimumPoolTokensOut: params.minimumPoolTokensOut,
|
|
1432
|
+
});
|
|
1428
1433
|
const keys = [
|
|
1429
1434
|
{ pubkey: params.stakePool, isSigner: false, isWritable: true },
|
|
1430
1435
|
{ pubkey: params.withdrawAuthority, isSigner: false, isWritable: false },
|
|
@@ -1523,7 +1528,10 @@ class StakePoolInstruction {
|
|
|
1523
1528
|
*/
|
|
1524
1529
|
static withdrawWsolWithSession(params) {
|
|
1525
1530
|
const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawWsolWithSession;
|
|
1526
|
-
const data = encodeData(type, {
|
|
1531
|
+
const data = encodeData(type, {
|
|
1532
|
+
poolTokensIn: params.poolTokensIn,
|
|
1533
|
+
minimumLamportsOut: params.minimumLamportsOut,
|
|
1534
|
+
});
|
|
1527
1535
|
const keys = [
|
|
1528
1536
|
{ pubkey: params.stakePool, isSigner: false, isWritable: true },
|
|
1529
1537
|
{ pubkey: params.withdrawAuthority, isSigner: false, isWritable: false },
|
|
@@ -1816,7 +1824,7 @@ async function depositStake(connection, stakePoolAddress, authorizedPubkey, vali
|
|
|
1816
1824
|
/**
|
|
1817
1825
|
* Creates instructions required to deposit sol to stake pool.
|
|
1818
1826
|
*/
|
|
1819
|
-
async function depositWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, lamports, destinationTokenAccount, referrerTokenAccount, depositAuthority, payer) {
|
|
1827
|
+
async function depositWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, lamports, minimumPoolTokensOut = 0, destinationTokenAccount, referrerTokenAccount, depositAuthority, payer) {
|
|
1820
1828
|
const wsolTokenAccount = getAssociatedTokenAddressSync(NATIVE_MINT, userPubkey);
|
|
1821
1829
|
const tokenAccountInfo = await connection.getTokenAccountBalance(wsolTokenAccount, 'confirmed');
|
|
1822
1830
|
const wsolBalance = tokenAccountInfo
|
|
@@ -1848,7 +1856,8 @@ async function depositWsolWithSession(connection, stakePoolAddress, signerOrSess
|
|
|
1848
1856
|
managerFeeAccount: stakePool.managerFeeAccount,
|
|
1849
1857
|
referralPoolAccount: referrerTokenAccount !== null && referrerTokenAccount !== void 0 ? referrerTokenAccount : destinationTokenAccount,
|
|
1850
1858
|
poolMint: stakePool.poolMint,
|
|
1851
|
-
lamports,
|
|
1859
|
+
lamportsIn: lamports,
|
|
1860
|
+
minimumPoolTokensOut,
|
|
1852
1861
|
withdrawAuthority,
|
|
1853
1862
|
depositAuthority,
|
|
1854
1863
|
wsolMint: NATIVE_MINT,
|
|
@@ -2120,7 +2129,7 @@ async function withdrawSol(connection, stakePoolAddress, tokenOwner, solReceiver
|
|
|
2120
2129
|
/**
|
|
2121
2130
|
* Creates instructions required to withdraw wSOL from a stake pool.
|
|
2122
2131
|
*/
|
|
2123
|
-
async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, solWithdrawAuthority) {
|
|
2132
|
+
async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, minimumLamportsOut = 0, solWithdrawAuthority) {
|
|
2124
2133
|
const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress);
|
|
2125
2134
|
const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint);
|
|
2126
2135
|
const stakePool = stakePoolAccount.account.data;
|
|
@@ -2151,7 +2160,8 @@ async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSes
|
|
|
2151
2160
|
solWithdrawAuthority,
|
|
2152
2161
|
wsolMint: NATIVE_MINT,
|
|
2153
2162
|
programSigner,
|
|
2154
|
-
poolTokens,
|
|
2163
|
+
poolTokensIn: poolTokens,
|
|
2164
|
+
minimumLamportsOut,
|
|
2155
2165
|
}));
|
|
2156
2166
|
return {
|
|
2157
2167
|
instructions,
|