@ignitionfi/spl-stake-pool 1.1.21 → 1.1.22
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 -13
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.browser.esm.js +18 -13
- package/dist/index.browser.esm.js.map +1 -1
- package/dist/index.cjs.js +18 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.esm.js +18 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +18 -13
- 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/package.json +1 -1
- package/src/index.ts +22 -13
package/dist/index.iife.js
CHANGED
|
@@ -23425,7 +23425,7 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
23425
23425
|
* Creates instructions required to withdraw stake from a stake pool using a Fogo session.
|
|
23426
23426
|
* The withdrawn stake account will be authorized to the user's wallet.
|
|
23427
23427
|
*/
|
|
23428
|
-
async function withdrawStakeWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, useReserve = false, voteAccountAddress, minimumLamportsOut = 0,
|
|
23428
|
+
async function withdrawStakeWithSession(connection, stakePoolAddress, signerOrSession, userPubkey, amount, payer, useReserve = false, voteAccountAddress, minimumLamportsOut = 0, validatorComparator) {
|
|
23429
23429
|
const stakePoolAccount = await getStakePoolAccount(connection, stakePoolAddress);
|
|
23430
23430
|
const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint);
|
|
23431
23431
|
const stakePool = stakePoolAccount.account.data;
|
|
@@ -23475,7 +23475,6 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
23475
23475
|
withdrawAccounts.push(...(await prepareWithdrawAccounts(connection, stakePool, stakePoolAddress, poolAmount, validatorComparator, poolTokenAccount.equals(stakePool.managerFeeAccount))));
|
|
23476
23476
|
}
|
|
23477
23477
|
const instructions = [];
|
|
23478
|
-
const signers = [];
|
|
23479
23478
|
const stakeAccountPubkeys = [];
|
|
23480
23479
|
// Max 5 accounts to prevent an error: "Transaction too large"
|
|
23481
23480
|
const maxWithdrawAccounts = 5;
|
|
@@ -23484,14 +23483,21 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
23484
23483
|
if (i >= maxWithdrawAccounts) {
|
|
23485
23484
|
break;
|
|
23486
23485
|
}
|
|
23487
|
-
// Create a
|
|
23488
|
-
|
|
23489
|
-
|
|
23490
|
-
|
|
23491
|
-
|
|
23492
|
-
|
|
23493
|
-
|
|
23494
|
-
|
|
23486
|
+
// Create a deterministic stake account address using a seed
|
|
23487
|
+
// This avoids needing the new account to sign (required for sessions)
|
|
23488
|
+
// We use payer as base so only payer needs to sign (payer = basePubkey)
|
|
23489
|
+
// The seed includes timestamp + random component to ensure uniqueness
|
|
23490
|
+
const uniqueId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
23491
|
+
const seed = `ws:${uniqueId}:${i}`.slice(0, 32); // Seed max 32 chars
|
|
23492
|
+
const stakeReceiverPubkey = await PublicKey.createWithSeed(payer, seed, StakeProgram.programId);
|
|
23493
|
+
stakeAccountPubkeys.push(stakeReceiverPubkey);
|
|
23494
|
+
// Create the stake account using createAccountWithSeed
|
|
23495
|
+
// Since basePubkey === fromPubkey (both are payer), only payer needs to sign
|
|
23496
|
+
instructions.push(SystemProgram.createAccountWithSeed({
|
|
23497
|
+
fromPubkey: payer,
|
|
23498
|
+
newAccountPubkey: stakeReceiverPubkey,
|
|
23499
|
+
basePubkey: payer,
|
|
23500
|
+
seed,
|
|
23495
23501
|
lamports: stakeAccountRentExemption,
|
|
23496
23502
|
space: StakeProgram.space,
|
|
23497
23503
|
programId: StakeProgram.programId,
|
|
@@ -23503,7 +23509,7 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
23503
23509
|
validatorList: stakePool.validatorList,
|
|
23504
23510
|
withdrawAuthority,
|
|
23505
23511
|
stakeToSplit: withdrawAccount.stakeAddress,
|
|
23506
|
-
stakeToReceive:
|
|
23512
|
+
stakeToReceive: stakeReceiverPubkey,
|
|
23507
23513
|
sessionSigner: signerOrSession,
|
|
23508
23514
|
burnFromPool: poolTokenAccount,
|
|
23509
23515
|
managerFeeAccount: stakePool.managerFeeAccount,
|
|
@@ -23511,13 +23517,12 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
23511
23517
|
tokenProgramId: stakePool.tokenProgramId,
|
|
23512
23518
|
programSigner,
|
|
23513
23519
|
poolTokensIn: withdrawAccount.poolAmount.toNumber(),
|
|
23514
|
-
minimumLamportsOut
|
|
23520
|
+
minimumLamportsOut,
|
|
23515
23521
|
}));
|
|
23516
23522
|
i++;
|
|
23517
23523
|
}
|
|
23518
23524
|
return {
|
|
23519
23525
|
instructions,
|
|
23520
|
-
signers,
|
|
23521
23526
|
stakeAccountPubkeys,
|
|
23522
23527
|
};
|
|
23523
23528
|
}
|