@solana/web3.js 1.34.0 → 1.36.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 +65 -30
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +65 -30
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +26 -3
- package/lib/index.esm.js +65 -30
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +65 -30
- 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 +30 -3
- package/package.json +2 -2
- package/src/connection.ts +31 -28
- package/src/stake-program.ts +65 -15
package/lib/index.iife.js
CHANGED
|
@@ -19851,13 +19851,13 @@ var solanaWeb3 = (function (exports) {
|
|
|
19851
19851
|
const SimulatedTransactionResponseStruct = jsonRpcResultAndContext(type({
|
|
19852
19852
|
err: nullable(union([type({}), string()])),
|
|
19853
19853
|
logs: nullable(array(string())),
|
|
19854
|
-
accounts: optional(nullable(array(type({
|
|
19854
|
+
accounts: optional(nullable(array(nullable(type({
|
|
19855
19855
|
executable: boolean(),
|
|
19856
19856
|
owner: string(),
|
|
19857
19857
|
lamports: number(),
|
|
19858
19858
|
data: array(string()),
|
|
19859
19859
|
rentEpoch: optional(number())
|
|
19860
|
-
})))),
|
|
19860
|
+
}))))),
|
|
19861
19861
|
unitsConsumed: optional(number())
|
|
19862
19862
|
}));
|
|
19863
19863
|
|
|
@@ -21000,35 +21000,32 @@ var solanaWeb3 = (function (exports) {
|
|
|
21000
21000
|
}
|
|
21001
21001
|
}
|
|
21002
21002
|
/**
|
|
21003
|
-
* Fetch all the account info for multiple accounts specified by an array of public keys
|
|
21003
|
+
* Fetch all the account info for multiple accounts specified by an array of public keys, return with context
|
|
21004
21004
|
*/
|
|
21005
21005
|
|
|
21006
21006
|
|
|
21007
|
-
async
|
|
21007
|
+
async getMultipleAccountsInfoAndContext(publicKeys, commitment) {
|
|
21008
21008
|
const keys = publicKeys.map(key => key.toBase58());
|
|
21009
|
-
let commitment;
|
|
21010
|
-
let encoding = 'base64';
|
|
21011
|
-
|
|
21012
|
-
if (configOrCommitment) {
|
|
21013
|
-
if (typeof configOrCommitment === 'string') {
|
|
21014
|
-
commitment = configOrCommitment;
|
|
21015
|
-
encoding = 'base64';
|
|
21016
|
-
} else {
|
|
21017
|
-
commitment = configOrCommitment.commitment;
|
|
21018
|
-
encoding = configOrCommitment.encoding || 'base64';
|
|
21019
|
-
}
|
|
21020
|
-
}
|
|
21021
21009
|
|
|
21022
|
-
const args = this._buildArgs([keys], commitment,
|
|
21010
|
+
const args = this._buildArgs([keys], commitment, 'base64');
|
|
21023
21011
|
|
|
21024
21012
|
const unsafeRes = await this._rpcRequest('getMultipleAccounts', args);
|
|
21025
|
-
const res = create(unsafeRes, jsonRpcResultAndContext(array(nullable(
|
|
21013
|
+
const res = create(unsafeRes, jsonRpcResultAndContext(array(nullable(AccountInfoResult))));
|
|
21026
21014
|
|
|
21027
21015
|
if ('error' in res) {
|
|
21028
21016
|
throw new Error('failed to get info for accounts ' + keys + ': ' + res.error.message);
|
|
21029
21017
|
}
|
|
21030
21018
|
|
|
21031
|
-
return res.result
|
|
21019
|
+
return res.result;
|
|
21020
|
+
}
|
|
21021
|
+
/**
|
|
21022
|
+
* Fetch all the account info for multiple accounts specified by an array of public keys
|
|
21023
|
+
*/
|
|
21024
|
+
|
|
21025
|
+
|
|
21026
|
+
async getMultipleAccountsInfo(publicKeys, commitment) {
|
|
21027
|
+
const res = await this.getMultipleAccountsInfoAndContext(publicKeys, commitment);
|
|
21028
|
+
return res.value;
|
|
21032
21029
|
}
|
|
21033
21030
|
/**
|
|
21034
21031
|
* Returns epoch activation information for a stake account that has been delegated
|
|
@@ -23756,30 +23753,22 @@ var solanaWeb3 = (function (exports) {
|
|
|
23756
23753
|
});
|
|
23757
23754
|
}
|
|
23758
23755
|
/**
|
|
23759
|
-
*
|
|
23756
|
+
* @internal
|
|
23760
23757
|
*/
|
|
23761
23758
|
|
|
23762
23759
|
|
|
23763
|
-
static
|
|
23760
|
+
static splitInstruction(params) {
|
|
23764
23761
|
const {
|
|
23765
23762
|
stakePubkey,
|
|
23766
23763
|
authorizedPubkey,
|
|
23767
23764
|
splitStakePubkey,
|
|
23768
23765
|
lamports
|
|
23769
23766
|
} = params;
|
|
23770
|
-
const transaction = new Transaction();
|
|
23771
|
-
transaction.add(SystemProgram.createAccount({
|
|
23772
|
-
fromPubkey: authorizedPubkey,
|
|
23773
|
-
newAccountPubkey: splitStakePubkey,
|
|
23774
|
-
lamports: 0,
|
|
23775
|
-
space: this.space,
|
|
23776
|
-
programId: this.programId
|
|
23777
|
-
}));
|
|
23778
23767
|
const type = STAKE_INSTRUCTION_LAYOUTS.Split;
|
|
23779
23768
|
const data = encodeData(type, {
|
|
23780
23769
|
lamports
|
|
23781
23770
|
});
|
|
23782
|
-
return
|
|
23771
|
+
return new TransactionInstruction({
|
|
23783
23772
|
keys: [{
|
|
23784
23773
|
pubkey: stakePubkey,
|
|
23785
23774
|
isSigner: false,
|
|
@@ -23797,6 +23786,52 @@ var solanaWeb3 = (function (exports) {
|
|
|
23797
23786
|
data
|
|
23798
23787
|
});
|
|
23799
23788
|
}
|
|
23789
|
+
/**
|
|
23790
|
+
* Generate a Transaction that splits Stake tokens into another stake account
|
|
23791
|
+
*/
|
|
23792
|
+
|
|
23793
|
+
|
|
23794
|
+
static split(params) {
|
|
23795
|
+
const transaction = new Transaction();
|
|
23796
|
+
transaction.add(SystemProgram.createAccount({
|
|
23797
|
+
fromPubkey: params.authorizedPubkey,
|
|
23798
|
+
newAccountPubkey: params.splitStakePubkey,
|
|
23799
|
+
lamports: 0,
|
|
23800
|
+
space: this.space,
|
|
23801
|
+
programId: this.programId
|
|
23802
|
+
}));
|
|
23803
|
+
return transaction.add(this.splitInstruction(params));
|
|
23804
|
+
}
|
|
23805
|
+
/**
|
|
23806
|
+
* Generate a Transaction that splits Stake tokens into another account
|
|
23807
|
+
* derived from a base public key and seed
|
|
23808
|
+
*/
|
|
23809
|
+
|
|
23810
|
+
|
|
23811
|
+
static splitWithSeed(params) {
|
|
23812
|
+
const {
|
|
23813
|
+
stakePubkey,
|
|
23814
|
+
authorizedPubkey,
|
|
23815
|
+
splitStakePubkey,
|
|
23816
|
+
basePubkey,
|
|
23817
|
+
seed,
|
|
23818
|
+
lamports
|
|
23819
|
+
} = params;
|
|
23820
|
+
const transaction = new Transaction();
|
|
23821
|
+
transaction.add(SystemProgram.allocate({
|
|
23822
|
+
accountPubkey: splitStakePubkey,
|
|
23823
|
+
basePubkey,
|
|
23824
|
+
seed,
|
|
23825
|
+
space: this.space,
|
|
23826
|
+
programId: this.programId
|
|
23827
|
+
}));
|
|
23828
|
+
return transaction.add(this.splitInstruction({
|
|
23829
|
+
stakePubkey,
|
|
23830
|
+
authorizedPubkey,
|
|
23831
|
+
splitStakePubkey,
|
|
23832
|
+
lamports
|
|
23833
|
+
}));
|
|
23834
|
+
}
|
|
23800
23835
|
/**
|
|
23801
23836
|
* Generate a Transaction that merges Stake accounts.
|
|
23802
23837
|
*/
|