@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.cjs.js CHANGED
@@ -10133,12 +10133,14 @@ class StakeProgram {
10133
10133
  /**
10134
10134
  * Generate a Transaction that splits Stake tokens into another stake account
10135
10135
  */
10136
- static split(params) {
10136
+ static split(params,
10137
+ // Compute the cost of allocating the new stake account in lamports
10138
+ rentExemptReserve) {
10137
10139
  const transaction = new Transaction();
10138
10140
  transaction.add(SystemProgram.createAccount({
10139
10141
  fromPubkey: params.authorizedPubkey,
10140
10142
  newAccountPubkey: params.splitStakePubkey,
10141
- lamports: 0,
10143
+ lamports: rentExemptReserve,
10142
10144
  space: this.space,
10143
10145
  programId: this.programId
10144
10146
  }));
@@ -10149,7 +10151,9 @@ class StakeProgram {
10149
10151
  * Generate a Transaction that splits Stake tokens into another account
10150
10152
  * derived from a base public key and seed
10151
10153
  */
10152
- static splitWithSeed(params) {
10154
+ static splitWithSeed(params,
10155
+ // If this stake account is new, compute the cost of allocating it in lamports
10156
+ rentExemptReserve) {
10153
10157
  const {
10154
10158
  stakePubkey,
10155
10159
  authorizedPubkey,
@@ -10166,6 +10170,13 @@ class StakeProgram {
10166
10170
  space: this.space,
10167
10171
  programId: this.programId
10168
10172
  }));
10173
+ if (rentExemptReserve && rentExemptReserve > 0) {
10174
+ transaction.add(SystemProgram.transfer({
10175
+ fromPubkey: params.authorizedPubkey,
10176
+ toPubkey: splitStakePubkey,
10177
+ lamports: rentExemptReserve
10178
+ }));
10179
+ }
10169
10180
  return transaction.add(this.splitInstruction({
10170
10181
  stakePubkey,
10171
10182
  authorizedPubkey,
@@ -10296,8 +10307,8 @@ StakeProgram.programId = new PublicKey('Stake11111111111111111111111111111111111
10296
10307
  * Max space of a Stake account
10297
10308
  *
10298
10309
  * This is generated from the solana-stake-program StakeState struct as
10299
- * `StakeState::size_of()`:
10300
- * https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeState.html
10310
+ * `StakeStateV2::size_of()`:
10311
+ * https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeStateV2.html
10301
10312
  */
10302
10313
  StakeProgram.space = 200;
10303
10314