@solana/web3.js 1.90.1 → 1.91.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.browser.cjs.js +55 -23
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +55 -23
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +55 -23
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +20 -8
- package/lib/index.esm.js +55 -23
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +55 -23
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +2 -2
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +55 -23
- package/lib/index.native.js.map +1 -1
- package/package.json +2 -3
- package/src/connection.ts +7 -7
- package/src/message/legacy.ts +4 -8
- package/src/programs/vote.ts +46 -3
- package/src/transaction/legacy.ts +1 -2
- package/src/validator-info.ts +2 -4
package/lib/index.browser.cjs.js
CHANGED
|
@@ -850,23 +850,19 @@ class Message {
|
|
|
850
850
|
const accountCount = decodeLength(byteArray);
|
|
851
851
|
let accountKeys = [];
|
|
852
852
|
for (let i = 0; i < accountCount; i++) {
|
|
853
|
-
const account = byteArray.
|
|
854
|
-
byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
|
|
853
|
+
const account = byteArray.splice(0, PUBLIC_KEY_LENGTH);
|
|
855
854
|
accountKeys.push(new PublicKey(buffer.Buffer.from(account)));
|
|
856
855
|
}
|
|
857
|
-
const recentBlockhash = byteArray.
|
|
858
|
-
byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
|
|
856
|
+
const recentBlockhash = byteArray.splice(0, PUBLIC_KEY_LENGTH);
|
|
859
857
|
const instructionCount = decodeLength(byteArray);
|
|
860
858
|
let instructions = [];
|
|
861
859
|
for (let i = 0; i < instructionCount; i++) {
|
|
862
860
|
const programIdIndex = byteArray.shift();
|
|
863
861
|
const accountCount = decodeLength(byteArray);
|
|
864
|
-
const accounts = byteArray.
|
|
865
|
-
byteArray = byteArray.slice(accountCount);
|
|
862
|
+
const accounts = byteArray.splice(0, accountCount);
|
|
866
863
|
const dataLength = decodeLength(byteArray);
|
|
867
|
-
const dataSlice = byteArray.
|
|
864
|
+
const dataSlice = byteArray.splice(0, dataLength);
|
|
868
865
|
const data = bs58__default.default.encode(buffer.Buffer.from(dataSlice));
|
|
869
|
-
byteArray = byteArray.slice(dataLength);
|
|
870
866
|
instructions.push({
|
|
871
867
|
programIdIndex,
|
|
872
868
|
accounts,
|
|
@@ -1899,8 +1895,7 @@ class Transaction {
|
|
|
1899
1895
|
const signatureCount = decodeLength(byteArray);
|
|
1900
1896
|
let signatures = [];
|
|
1901
1897
|
for (let i = 0; i < signatureCount; i++) {
|
|
1902
|
-
const signature = byteArray.
|
|
1903
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH_IN_BYTES);
|
|
1898
|
+
const signature = byteArray.splice(0, SIGNATURE_LENGTH_IN_BYTES);
|
|
1904
1899
|
signatures.push(bs58__default.default.encode(buffer.Buffer.from(signature)));
|
|
1905
1900
|
}
|
|
1906
1901
|
return Transaction.populate(Message.from(byteArray), signatures);
|
|
@@ -7701,7 +7696,7 @@ class Connection {
|
|
|
7701
7696
|
/**
|
|
7702
7697
|
* Deregister an account notification callback
|
|
7703
7698
|
*
|
|
7704
|
-
* @param
|
|
7699
|
+
* @param clientSubscriptionId client subscription id to deregister
|
|
7705
7700
|
*/
|
|
7706
7701
|
async removeAccountChangeListener(clientSubscriptionId) {
|
|
7707
7702
|
await this._unsubscribeClientSubscription(clientSubscriptionId, 'account change');
|
|
@@ -7747,7 +7742,7 @@ class Connection {
|
|
|
7747
7742
|
/**
|
|
7748
7743
|
* Deregister an account notification callback
|
|
7749
7744
|
*
|
|
7750
|
-
* @param
|
|
7745
|
+
* @param clientSubscriptionId client subscription id to deregister
|
|
7751
7746
|
*/
|
|
7752
7747
|
async removeProgramAccountChangeListener(clientSubscriptionId) {
|
|
7753
7748
|
await this._unsubscribeClientSubscription(clientSubscriptionId, 'program account change');
|
|
@@ -7771,7 +7766,7 @@ class Connection {
|
|
|
7771
7766
|
/**
|
|
7772
7767
|
* Deregister a logs callback.
|
|
7773
7768
|
*
|
|
7774
|
-
* @param
|
|
7769
|
+
* @param clientSubscriptionId client subscription id to deregister.
|
|
7775
7770
|
*/
|
|
7776
7771
|
async removeOnLogsListener(clientSubscriptionId) {
|
|
7777
7772
|
await this._unsubscribeClientSubscription(clientSubscriptionId, 'logs');
|
|
@@ -7816,7 +7811,7 @@ class Connection {
|
|
|
7816
7811
|
/**
|
|
7817
7812
|
* Deregister a slot notification callback
|
|
7818
7813
|
*
|
|
7819
|
-
* @param
|
|
7814
|
+
* @param clientSubscriptionId client subscription id to deregister
|
|
7820
7815
|
*/
|
|
7821
7816
|
async removeSlotChangeListener(clientSubscriptionId) {
|
|
7822
7817
|
await this._unsubscribeClientSubscription(clientSubscriptionId, 'slot change');
|
|
@@ -7851,7 +7846,7 @@ class Connection {
|
|
|
7851
7846
|
/**
|
|
7852
7847
|
* Deregister a slot update notification callback
|
|
7853
7848
|
*
|
|
7854
|
-
* @param
|
|
7849
|
+
* @param clientSubscriptionId client subscription id to deregister
|
|
7855
7850
|
*/
|
|
7856
7851
|
async removeSlotUpdateListener(clientSubscriptionId) {
|
|
7857
7852
|
await this._unsubscribeClientSubscription(clientSubscriptionId, 'slot update');
|
|
@@ -8001,7 +7996,7 @@ class Connection {
|
|
|
8001
7996
|
/**
|
|
8002
7997
|
* Deregister a signature notification callback
|
|
8003
7998
|
*
|
|
8004
|
-
* @param
|
|
7999
|
+
* @param clientSubscriptionId client subscription id to deregister
|
|
8005
8000
|
*/
|
|
8006
8001
|
async removeSignatureListener(clientSubscriptionId) {
|
|
8007
8002
|
await this._unsubscribeClientSubscription(clientSubscriptionId, 'signature result');
|
|
@@ -8035,7 +8030,7 @@ class Connection {
|
|
|
8035
8030
|
/**
|
|
8036
8031
|
* Deregister a root notification callback
|
|
8037
8032
|
*
|
|
8038
|
-
* @param
|
|
8033
|
+
* @param clientSubscriptionId client subscription id to deregister
|
|
8039
8034
|
*/
|
|
8040
8035
|
async removeRootChangeListener(clientSubscriptionId) {
|
|
8041
8036
|
await this._unsubscribeClientSubscription(clientSubscriptionId, 'root change');
|
|
@@ -9653,6 +9648,10 @@ class VoteInit {
|
|
|
9653
9648
|
* Withdraw from vote account transaction params
|
|
9654
9649
|
*/
|
|
9655
9650
|
|
|
9651
|
+
/**
|
|
9652
|
+
* Update validator identity (node pubkey) vote account instruction params.
|
|
9653
|
+
*/
|
|
9654
|
+
|
|
9656
9655
|
/**
|
|
9657
9656
|
* Vote Instruction class
|
|
9658
9657
|
*/
|
|
@@ -9799,6 +9798,10 @@ const VOTE_INSTRUCTION_LAYOUTS = Object.freeze({
|
|
|
9799
9798
|
index: 3,
|
|
9800
9799
|
layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), BufferLayout__namespace.ns64('lamports')])
|
|
9801
9800
|
},
|
|
9801
|
+
UpdateValidatorIdentity: {
|
|
9802
|
+
index: 4,
|
|
9803
|
+
layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction')])
|
|
9804
|
+
},
|
|
9802
9805
|
AuthorizeWithSeed: {
|
|
9803
9806
|
index: 10,
|
|
9804
9807
|
layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), voteAuthorizeWithSeedArgs()])
|
|
@@ -10016,10 +10019,41 @@ class VoteProgram {
|
|
|
10016
10019
|
*/
|
|
10017
10020
|
static safeWithdraw(params, currentVoteAccountBalance, rentExemptMinimum) {
|
|
10018
10021
|
if (params.lamports > currentVoteAccountBalance - rentExemptMinimum) {
|
|
10019
|
-
throw new Error('Withdraw will leave vote account with
|
|
10022
|
+
throw new Error('Withdraw will leave vote account with insufficient funds.');
|
|
10020
10023
|
}
|
|
10021
10024
|
return VoteProgram.withdraw(params);
|
|
10022
10025
|
}
|
|
10026
|
+
|
|
10027
|
+
/**
|
|
10028
|
+
* Generate a transaction to update the validator identity (node pubkey) of a Vote account.
|
|
10029
|
+
*/
|
|
10030
|
+
static updateValidatorIdentity(params) {
|
|
10031
|
+
const {
|
|
10032
|
+
votePubkey,
|
|
10033
|
+
authorizedWithdrawerPubkey,
|
|
10034
|
+
nodePubkey
|
|
10035
|
+
} = params;
|
|
10036
|
+
const type = VOTE_INSTRUCTION_LAYOUTS.UpdateValidatorIdentity;
|
|
10037
|
+
const data = encodeData(type);
|
|
10038
|
+
const keys = [{
|
|
10039
|
+
pubkey: votePubkey,
|
|
10040
|
+
isSigner: false,
|
|
10041
|
+
isWritable: true
|
|
10042
|
+
}, {
|
|
10043
|
+
pubkey: nodePubkey,
|
|
10044
|
+
isSigner: true,
|
|
10045
|
+
isWritable: false
|
|
10046
|
+
}, {
|
|
10047
|
+
pubkey: authorizedWithdrawerPubkey,
|
|
10048
|
+
isSigner: true,
|
|
10049
|
+
isWritable: false
|
|
10050
|
+
}];
|
|
10051
|
+
return new Transaction().add({
|
|
10052
|
+
keys,
|
|
10053
|
+
programId: this.programId,
|
|
10054
|
+
data
|
|
10055
|
+
});
|
|
10056
|
+
}
|
|
10023
10057
|
}
|
|
10024
10058
|
VoteProgram.programId = new PublicKey('Vote111111111111111111111111111111111111111');
|
|
10025
10059
|
/**
|
|
@@ -10031,7 +10065,7 @@ VoteProgram.programId = new PublicKey('Vote1111111111111111111111111111111111111
|
|
|
10031
10065
|
*
|
|
10032
10066
|
* KEEP IN SYNC WITH `VoteState::size_of()` in https://github.com/solana-labs/solana/blob/a474cb24b9238f5edcc982f65c0b37d4a1046f7e/sdk/program/src/vote/state/mod.rs#L340-L342
|
|
10033
10067
|
*/
|
|
10034
|
-
VoteProgram.space =
|
|
10068
|
+
VoteProgram.space = 3762;
|
|
10035
10069
|
|
|
10036
10070
|
const VALIDATOR_INFO_KEY = new PublicKey('Va1idator1nfo111111111111111111111111111111');
|
|
10037
10071
|
|
|
@@ -10086,10 +10120,8 @@ class ValidatorInfo {
|
|
|
10086
10120
|
if (configKeyCount !== 2) return null;
|
|
10087
10121
|
const configKeys = [];
|
|
10088
10122
|
for (let i = 0; i < 2; i++) {
|
|
10089
|
-
const publicKey = new PublicKey(byteArray.
|
|
10090
|
-
|
|
10091
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
10092
|
-
byteArray = byteArray.slice(1);
|
|
10123
|
+
const publicKey = new PublicKey(byteArray.splice(0, PUBLIC_KEY_LENGTH));
|
|
10124
|
+
const isSigner = byteArray.splice(0, 1)[0] === 1;
|
|
10093
10125
|
configKeys.push({
|
|
10094
10126
|
publicKey,
|
|
10095
10127
|
isSigner
|