@solana/web3.js 1.34.0 → 1.35.0

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/module.flow.js CHANGED
@@ -3146,6 +3146,19 @@ lastValidBlockHeight: number,...
3146
3146
  ...
3147
3147
  };
3148
3148
 
3149
+ /**
3150
+ * Split with seed transaction params
3151
+ */
3152
+ declare export type SplitStakeWithSeedParams = {
3153
+ stakePubkey: PublicKey,
3154
+ authorizedPubkey: PublicKey,
3155
+ splitStakePubkey: PublicKey,
3156
+ basePubkey: PublicKey,
3157
+ seed: string,
3158
+ lamports: number,
3159
+ ...
3160
+ };
3161
+
3149
3162
  /**
3150
3163
  * Withdraw stake instruction params
3151
3164
  */
@@ -3340,6 +3353,12 @@ lastValidBlockHeight: number,...
3340
3353
  */
3341
3354
  static split(params: SplitStakeParams): Transaction;
3342
3355
 
3356
+ /**
3357
+ * Generate a Transaction that splits Stake tokens into another account
3358
+ * derived from a base public key and seed
3359
+ */
3360
+ static splitWithSeed(params: SplitStakeWithSeedParams): Transaction;
3361
+
3343
3362
  /**
3344
3363
  * Generate a Transaction that merges Stake accounts.
3345
3364
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.34.0",
3
+ "version": "1.35.0",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
@@ -147,6 +147,18 @@ export type SplitStakeParams = {
147
147
  lamports: number;
148
148
  };
149
149
 
150
+ /**
151
+ * Split with seed transaction params
152
+ */
153
+ export type SplitStakeWithSeedParams = {
154
+ stakePubkey: PublicKey;
155
+ authorizedPubkey: PublicKey;
156
+ splitStakePubkey: PublicKey;
157
+ basePubkey: PublicKey;
158
+ seed: string;
159
+ lamports: number;
160
+ };
161
+
150
162
  /**
151
163
  * Withdraw stake instruction params
152
164
  */
@@ -706,25 +718,13 @@ export class StakeProgram {
706
718
  }
707
719
 
708
720
  /**
709
- * Generate a Transaction that splits Stake tokens into another stake account
721
+ * @internal
710
722
  */
711
- static split(params: SplitStakeParams): Transaction {
723
+ static splitInstruction(params: SplitStakeParams): TransactionInstruction {
712
724
  const {stakePubkey, authorizedPubkey, splitStakePubkey, lamports} = params;
713
-
714
- const transaction = new Transaction();
715
- transaction.add(
716
- SystemProgram.createAccount({
717
- fromPubkey: authorizedPubkey,
718
- newAccountPubkey: splitStakePubkey,
719
- lamports: 0,
720
- space: this.space,
721
- programId: this.programId,
722
- }),
723
- );
724
725
  const type = STAKE_INSTRUCTION_LAYOUTS.Split;
725
726
  const data = encodeData(type, {lamports});
726
-
727
- return transaction.add({
727
+ return new TransactionInstruction({
728
728
  keys: [
729
729
  {pubkey: stakePubkey, isSigner: false, isWritable: true},
730
730
  {pubkey: splitStakePubkey, isSigner: false, isWritable: true},
@@ -735,6 +735,56 @@ export class StakeProgram {
735
735
  });
736
736
  }
737
737
 
738
+ /**
739
+ * Generate a Transaction that splits Stake tokens into another stake account
740
+ */
741
+ static split(params: SplitStakeParams): Transaction {
742
+ const transaction = new Transaction();
743
+ transaction.add(
744
+ SystemProgram.createAccount({
745
+ fromPubkey: params.authorizedPubkey,
746
+ newAccountPubkey: params.splitStakePubkey,
747
+ lamports: 0,
748
+ space: this.space,
749
+ programId: this.programId,
750
+ }),
751
+ );
752
+ return transaction.add(this.splitInstruction(params));
753
+ }
754
+
755
+ /**
756
+ * Generate a Transaction that splits Stake tokens into another account
757
+ * derived from a base public key and seed
758
+ */
759
+ static splitWithSeed(params: SplitStakeWithSeedParams): Transaction {
760
+ const {
761
+ stakePubkey,
762
+ authorizedPubkey,
763
+ splitStakePubkey,
764
+ basePubkey,
765
+ seed,
766
+ lamports,
767
+ } = params;
768
+ const transaction = new Transaction();
769
+ transaction.add(
770
+ SystemProgram.allocate({
771
+ accountPubkey: splitStakePubkey,
772
+ basePubkey,
773
+ seed,
774
+ space: this.space,
775
+ programId: this.programId,
776
+ }),
777
+ );
778
+ return transaction.add(
779
+ this.splitInstruction({
780
+ stakePubkey,
781
+ authorizedPubkey,
782
+ splitStakePubkey,
783
+ lamports,
784
+ }),
785
+ );
786
+ }
787
+
738
788
  /**
739
789
  * Generate a Transaction that merges Stake accounts.
740
790
  */