@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/lib/index.browser.esm.js +49 -11
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +49 -11
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +16 -0
- package/lib/index.esm.js +49 -11
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +49 -11
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/module.flow.js +19 -0
- package/package.json +1 -1
- package/src/stake-program.ts +65 -15
package/lib/index.browser.esm.js
CHANGED
|
@@ -8729,30 +8729,22 @@ class StakeProgram {
|
|
|
8729
8729
|
});
|
|
8730
8730
|
}
|
|
8731
8731
|
/**
|
|
8732
|
-
*
|
|
8732
|
+
* @internal
|
|
8733
8733
|
*/
|
|
8734
8734
|
|
|
8735
8735
|
|
|
8736
|
-
static
|
|
8736
|
+
static splitInstruction(params) {
|
|
8737
8737
|
const {
|
|
8738
8738
|
stakePubkey,
|
|
8739
8739
|
authorizedPubkey,
|
|
8740
8740
|
splitStakePubkey,
|
|
8741
8741
|
lamports
|
|
8742
8742
|
} = params;
|
|
8743
|
-
const transaction = new Transaction();
|
|
8744
|
-
transaction.add(SystemProgram.createAccount({
|
|
8745
|
-
fromPubkey: authorizedPubkey,
|
|
8746
|
-
newAccountPubkey: splitStakePubkey,
|
|
8747
|
-
lamports: 0,
|
|
8748
|
-
space: this.space,
|
|
8749
|
-
programId: this.programId
|
|
8750
|
-
}));
|
|
8751
8743
|
const type = STAKE_INSTRUCTION_LAYOUTS.Split;
|
|
8752
8744
|
const data = encodeData(type, {
|
|
8753
8745
|
lamports
|
|
8754
8746
|
});
|
|
8755
|
-
return
|
|
8747
|
+
return new TransactionInstruction({
|
|
8756
8748
|
keys: [{
|
|
8757
8749
|
pubkey: stakePubkey,
|
|
8758
8750
|
isSigner: false,
|
|
@@ -8770,6 +8762,52 @@ class StakeProgram {
|
|
|
8770
8762
|
data
|
|
8771
8763
|
});
|
|
8772
8764
|
}
|
|
8765
|
+
/**
|
|
8766
|
+
* Generate a Transaction that splits Stake tokens into another stake account
|
|
8767
|
+
*/
|
|
8768
|
+
|
|
8769
|
+
|
|
8770
|
+
static split(params) {
|
|
8771
|
+
const transaction = new Transaction();
|
|
8772
|
+
transaction.add(SystemProgram.createAccount({
|
|
8773
|
+
fromPubkey: params.authorizedPubkey,
|
|
8774
|
+
newAccountPubkey: params.splitStakePubkey,
|
|
8775
|
+
lamports: 0,
|
|
8776
|
+
space: this.space,
|
|
8777
|
+
programId: this.programId
|
|
8778
|
+
}));
|
|
8779
|
+
return transaction.add(this.splitInstruction(params));
|
|
8780
|
+
}
|
|
8781
|
+
/**
|
|
8782
|
+
* Generate a Transaction that splits Stake tokens into another account
|
|
8783
|
+
* derived from a base public key and seed
|
|
8784
|
+
*/
|
|
8785
|
+
|
|
8786
|
+
|
|
8787
|
+
static splitWithSeed(params) {
|
|
8788
|
+
const {
|
|
8789
|
+
stakePubkey,
|
|
8790
|
+
authorizedPubkey,
|
|
8791
|
+
splitStakePubkey,
|
|
8792
|
+
basePubkey,
|
|
8793
|
+
seed,
|
|
8794
|
+
lamports
|
|
8795
|
+
} = params;
|
|
8796
|
+
const transaction = new Transaction();
|
|
8797
|
+
transaction.add(SystemProgram.allocate({
|
|
8798
|
+
accountPubkey: splitStakePubkey,
|
|
8799
|
+
basePubkey,
|
|
8800
|
+
seed,
|
|
8801
|
+
space: this.space,
|
|
8802
|
+
programId: this.programId
|
|
8803
|
+
}));
|
|
8804
|
+
return transaction.add(this.splitInstruction({
|
|
8805
|
+
stakePubkey,
|
|
8806
|
+
authorizedPubkey,
|
|
8807
|
+
splitStakePubkey,
|
|
8808
|
+
lamports
|
|
8809
|
+
}));
|
|
8810
|
+
}
|
|
8773
8811
|
/**
|
|
8774
8812
|
* Generate a Transaction that merges Stake accounts.
|
|
8775
8813
|
*/
|