@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.
@@ -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, payer, validatorComparator) {
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 new stake account to receive the withdrawal
23488
- const stakeReceiver = Keypair.generate();
23489
- signers.push(stakeReceiver);
23490
- stakeAccountPubkeys.push(stakeReceiver.publicKey);
23491
- // Create the stake account that will receive the split stake
23492
- instructions.push(SystemProgram.createAccount({
23493
- fromPubkey: payer !== null && payer !== void 0 ? payer : userPubkey,
23494
- newAccountPubkey: stakeReceiver.publicKey,
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: stakeReceiver.publicKey,
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: solToLamports(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
  }