@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.
package/lib/index.d.ts CHANGED
@@ -844,8 +844,8 @@ export class StakeProgram {
844
844
  * Max space of a Stake account
845
845
  *
846
846
  * This is generated from the solana-stake-program StakeState struct as
847
- * `StakeState::size_of()`:
848
- * https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeState.html
847
+ * `StakeStateV2::size_of()`:
848
+ * https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeStateV2.html
849
849
  */
850
850
  static space: number;
851
851
  /**
@@ -880,12 +880,12 @@ export class StakeProgram {
880
880
  /**
881
881
  * Generate a Transaction that splits Stake tokens into another stake account
882
882
  */
883
- static split(params: SplitStakeParams): Transaction;
883
+ static split(params: SplitStakeParams, rentExemptReserve: number): Transaction;
884
884
  /**
885
885
  * Generate a Transaction that splits Stake tokens into another account
886
886
  * derived from a base public key and seed
887
887
  */
888
- static splitWithSeed(params: SplitStakeWithSeedParams): Transaction;
888
+ static splitWithSeed(params: SplitStakeWithSeedParams, rentExemptReserve?: number): Transaction;
889
889
  /**
890
890
  * Generate a Transaction that merges Stake accounts.
891
891
  */
package/lib/index.esm.js CHANGED
@@ -10101,12 +10101,14 @@ class StakeProgram {
10101
10101
  /**
10102
10102
  * Generate a Transaction that splits Stake tokens into another stake account
10103
10103
  */
10104
- static split(params) {
10104
+ static split(params,
10105
+ // Compute the cost of allocating the new stake account in lamports
10106
+ rentExemptReserve) {
10105
10107
  const transaction = new Transaction();
10106
10108
  transaction.add(SystemProgram.createAccount({
10107
10109
  fromPubkey: params.authorizedPubkey,
10108
10110
  newAccountPubkey: params.splitStakePubkey,
10109
- lamports: 0,
10111
+ lamports: rentExemptReserve,
10110
10112
  space: this.space,
10111
10113
  programId: this.programId
10112
10114
  }));
@@ -10117,7 +10119,9 @@ class StakeProgram {
10117
10119
  * Generate a Transaction that splits Stake tokens into another account
10118
10120
  * derived from a base public key and seed
10119
10121
  */
10120
- static splitWithSeed(params) {
10122
+ static splitWithSeed(params,
10123
+ // If this stake account is new, compute the cost of allocating it in lamports
10124
+ rentExemptReserve) {
10121
10125
  const {
10122
10126
  stakePubkey,
10123
10127
  authorizedPubkey,
@@ -10134,6 +10138,13 @@ class StakeProgram {
10134
10138
  space: this.space,
10135
10139
  programId: this.programId
10136
10140
  }));
10141
+ if (rentExemptReserve && rentExemptReserve > 0) {
10142
+ transaction.add(SystemProgram.transfer({
10143
+ fromPubkey: params.authorizedPubkey,
10144
+ toPubkey: splitStakePubkey,
10145
+ lamports: rentExemptReserve
10146
+ }));
10147
+ }
10137
10148
  return transaction.add(this.splitInstruction({
10138
10149
  stakePubkey,
10139
10150
  authorizedPubkey,
@@ -10264,8 +10275,8 @@ StakeProgram.programId = new PublicKey('Stake11111111111111111111111111111111111
10264
10275
  * Max space of a Stake account
10265
10276
  *
10266
10277
  * This is generated from the solana-stake-program StakeState struct as
10267
- * `StakeState::size_of()`:
10268
- * https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeState.html
10278
+ * `StakeStateV2::size_of()`:
10279
+ * https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeStateV2.html
10269
10280
  */
10270
10281
  StakeProgram.space = 200;
10271
10282