@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
|
@@ -1104,14 +1104,16 @@ const STAKE_POOL_INSTRUCTION_LAYOUTS = Object.freeze({
|
|
|
1104
1104
|
index: 27,
|
|
1105
1105
|
layout: BufferLayout__namespace.struct([
|
|
1106
1106
|
BufferLayout__namespace.u8('instruction'),
|
|
1107
|
-
BufferLayout__namespace.ns64('
|
|
1107
|
+
BufferLayout__namespace.ns64('lamportsIn'),
|
|
1108
|
+
BufferLayout__namespace.ns64('minimumPoolTokensOut'),
|
|
1108
1109
|
]),
|
|
1109
1110
|
},
|
|
1110
1111
|
WithdrawWsolWithSession: {
|
|
1111
1112
|
index: 28,
|
|
1112
1113
|
layout: BufferLayout__namespace.struct([
|
|
1113
1114
|
BufferLayout__namespace.u8('instruction'),
|
|
1114
|
-
BufferLayout__namespace.ns64('
|
|
1115
|
+
BufferLayout__namespace.ns64('poolTokensIn'),
|
|
1116
|
+
BufferLayout__namespace.ns64('minimumLamportsOut'),
|
|
1115
1117
|
]),
|
|
1116
1118
|
},
|
|
1117
1119
|
});
|
|
@@ -1445,7 +1447,10 @@ class StakePoolInstruction {
|
|
|
1445
1447
|
static depositWsolWithSession(params) {
|
|
1446
1448
|
var _a;
|
|
1447
1449
|
const type = STAKE_POOL_INSTRUCTION_LAYOUTS.DepositWsolWithSession;
|
|
1448
|
-
const data = encodeData(type, {
|
|
1450
|
+
const data = encodeData(type, {
|
|
1451
|
+
lamportsIn: params.lamportsIn,
|
|
1452
|
+
minimumPoolTokensOut: params.minimumPoolTokensOut,
|
|
1453
|
+
});
|
|
1449
1454
|
const keys = [
|
|
1450
1455
|
{ pubkey: params.stakePool, isSigner: false, isWritable: true },
|
|
1451
1456
|
{ pubkey: params.withdrawAuthority, isSigner: false, isWritable: false },
|
|
@@ -1544,7 +1549,10 @@ class StakePoolInstruction {
|
|
|
1544
1549
|
*/
|
|
1545
1550
|
static withdrawWsolWithSession(params) {
|
|
1546
1551
|
const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawWsolWithSession;
|
|
1547
|
-
const data = encodeData(type, {
|
|
1552
|
+
const data = encodeData(type, {
|
|
1553
|
+
poolTokensIn: params.poolTokensIn,
|
|
1554
|
+
minimumLamportsOut: params.minimumLamportsOut,
|
|
1555
|
+
});
|
|
1548
1556
|
const keys = [
|
|
1549
1557
|
{ pubkey: params.stakePool, isSigner: false, isWritable: true },
|
|
1550
1558
|
{ pubkey: params.withdrawAuthority, isSigner: false, isWritable: false },
|
|
@@ -1837,7 +1845,7 @@ async function depositStake(connection, stakePoolAddress, authorizedPubkey, vali
|
|
|
1837
1845
|
/**
|
|
1838
1846
|
* Creates instructions required to deposit sol to stake pool.
|
|
1839
1847
|
*/
|
|
1840
|
-
async function depositWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, lamports, destinationTokenAccount, referrerTokenAccount, depositAuthority, payer) {
|
|
1848
|
+
async function depositWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, lamports, minimumPoolTokensOut = 0, destinationTokenAccount, referrerTokenAccount, depositAuthority, payer) {
|
|
1841
1849
|
const wsolTokenAccount = splToken.getAssociatedTokenAddressSync(splToken.NATIVE_MINT, userPubkey);
|
|
1842
1850
|
const tokenAccountInfo = await connection.getTokenAccountBalance(wsolTokenAccount, 'confirmed');
|
|
1843
1851
|
const wsolBalance = tokenAccountInfo
|
|
@@ -1869,7 +1877,8 @@ async function depositWsolWithSession(connection, stakePoolAddress, signerOrSess
|
|
|
1869
1877
|
managerFeeAccount: stakePool.managerFeeAccount,
|
|
1870
1878
|
referralPoolAccount: referrerTokenAccount !== null && referrerTokenAccount !== void 0 ? referrerTokenAccount : destinationTokenAccount,
|
|
1871
1879
|
poolMint: stakePool.poolMint,
|
|
1872
|
-
lamports,
|
|
1880
|
+
lamportsIn: lamports,
|
|
1881
|
+
minimumPoolTokensOut,
|
|
1873
1882
|
withdrawAuthority,
|
|
1874
1883
|
depositAuthority,
|
|
1875
1884
|
wsolMint: splToken.NATIVE_MINT,
|
|
@@ -2141,7 +2150,7 @@ async function withdrawSol(connection, stakePoolAddress, tokenOwner, solReceiver
|
|
|
2141
2150
|
/**
|
|
2142
2151
|
* Creates instructions required to withdraw wSOL from a stake pool.
|
|
2143
2152
|
*/
|
|
2144
|
-
async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, solWithdrawAuthority) {
|
|
2153
|
+
async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, minimumLamportsOut = 0, solWithdrawAuthority) {
|
|
2145
2154
|
const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress);
|
|
2146
2155
|
const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint);
|
|
2147
2156
|
const stakePool = stakePoolAccount.account.data;
|
|
@@ -2172,7 +2181,8 @@ async function withdrawWsolWithSession(connection, stakePoolAddress, signerOrSes
|
|
|
2172
2181
|
solWithdrawAuthority,
|
|
2173
2182
|
wsolMint: splToken.NATIVE_MINT,
|
|
2174
2183
|
programSigner,
|
|
2175
|
-
poolTokens,
|
|
2184
|
+
poolTokensIn: poolTokens,
|
|
2185
|
+
minimumLamportsOut,
|
|
2176
2186
|
}));
|
|
2177
2187
|
return {
|
|
2178
2188
|
instructions,
|