@solana/web3.js 1.90.0 → 1.90.1

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.
@@ -9408,12 +9408,14 @@ class StakeProgram {
9408
9408
  /**
9409
9409
  * Generate a Transaction that splits Stake tokens into another stake account
9410
9410
  */
9411
- static split(params) {
9411
+ static split(params,
9412
+ // Compute the cost of allocating the new stake account in lamports
9413
+ rentExemptReserve) {
9412
9414
  const transaction = new Transaction();
9413
9415
  transaction.add(SystemProgram.createAccount({
9414
9416
  fromPubkey: params.authorizedPubkey,
9415
9417
  newAccountPubkey: params.splitStakePubkey,
9416
- lamports: 0,
9418
+ lamports: rentExemptReserve,
9417
9419
  space: this.space,
9418
9420
  programId: this.programId
9419
9421
  }));
@@ -9424,7 +9426,9 @@ class StakeProgram {
9424
9426
  * Generate a Transaction that splits Stake tokens into another account
9425
9427
  * derived from a base public key and seed
9426
9428
  */
9427
- static splitWithSeed(params) {
9429
+ static splitWithSeed(params,
9430
+ // If this stake account is new, compute the cost of allocating it in lamports
9431
+ rentExemptReserve) {
9428
9432
  const {
9429
9433
  stakePubkey,
9430
9434
  authorizedPubkey,
@@ -9441,6 +9445,13 @@ class StakeProgram {
9441
9445
  space: this.space,
9442
9446
  programId: this.programId
9443
9447
  }));
9448
+ if (rentExemptReserve && rentExemptReserve > 0) {
9449
+ transaction.add(SystemProgram.transfer({
9450
+ fromPubkey: params.authorizedPubkey,
9451
+ toPubkey: splitStakePubkey,
9452
+ lamports: rentExemptReserve
9453
+ }));
9454
+ }
9444
9455
  return transaction.add(this.splitInstruction({
9445
9456
  stakePubkey,
9446
9457
  authorizedPubkey,
@@ -9571,8 +9582,8 @@ StakeProgram.programId = new PublicKey('Stake11111111111111111111111111111111111
9571
9582
  * Max space of a Stake account
9572
9583
  *
9573
9584
  * This is generated from the solana-stake-program StakeState struct as
9574
- * `StakeState::size_of()`:
9575
- * https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeState.html
9585
+ * `StakeStateV2::size_of()`:
9586
+ * https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeStateV2.html
9576
9587
  */
9577
9588
  StakeProgram.space = 200;
9578
9589