@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.esm.js
CHANGED
|
@@ -822,23 +822,19 @@ class Message {
|
|
|
822
822
|
const accountCount = decodeLength(byteArray);
|
|
823
823
|
let accountKeys = [];
|
|
824
824
|
for (let i = 0; i < accountCount; i++) {
|
|
825
|
-
const account = byteArray.
|
|
826
|
-
byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
|
|
825
|
+
const account = byteArray.splice(0, PUBLIC_KEY_LENGTH);
|
|
827
826
|
accountKeys.push(new PublicKey(Buffer.from(account)));
|
|
828
827
|
}
|
|
829
|
-
const recentBlockhash = byteArray.
|
|
830
|
-
byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
|
|
828
|
+
const recentBlockhash = byteArray.splice(0, PUBLIC_KEY_LENGTH);
|
|
831
829
|
const instructionCount = decodeLength(byteArray);
|
|
832
830
|
let instructions = [];
|
|
833
831
|
for (let i = 0; i < instructionCount; i++) {
|
|
834
832
|
const programIdIndex = byteArray.shift();
|
|
835
833
|
const accountCount = decodeLength(byteArray);
|
|
836
|
-
const accounts = byteArray.
|
|
837
|
-
byteArray = byteArray.slice(accountCount);
|
|
834
|
+
const accounts = byteArray.splice(0, accountCount);
|
|
838
835
|
const dataLength = decodeLength(byteArray);
|
|
839
|
-
const dataSlice = byteArray.
|
|
836
|
+
const dataSlice = byteArray.splice(0, dataLength);
|
|
840
837
|
const data = bs58.encode(Buffer.from(dataSlice));
|
|
841
|
-
byteArray = byteArray.slice(dataLength);
|
|
842
838
|
instructions.push({
|
|
843
839
|
programIdIndex,
|
|
844
840
|
accounts,
|
|
@@ -1871,8 +1867,7 @@ class Transaction {
|
|
|
1871
1867
|
const signatureCount = decodeLength(byteArray);
|
|
1872
1868
|
let signatures = [];
|
|
1873
1869
|
for (let i = 0; i < signatureCount; i++) {
|
|
1874
|
-
const signature = byteArray.
|
|
1875
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH_IN_BYTES);
|
|
1870
|
+
const signature = byteArray.splice(0, SIGNATURE_LENGTH_IN_BYTES);
|
|
1876
1871
|
signatures.push(bs58.encode(Buffer.from(signature)));
|
|
1877
1872
|
}
|
|
1878
1873
|
return Transaction.populate(Message.from(byteArray), signatures);
|
|
@@ -7673,7 +7668,7 @@ class Connection {
|
|
|
7673
7668
|
/**
|
|
7674
7669
|
* Deregister an account notification callback
|
|
7675
7670
|
*
|
|
7676
|
-
* @param
|
|
7671
|
+
* @param clientSubscriptionId client subscription id to deregister
|
|
7677
7672
|
*/
|
|
7678
7673
|
async removeAccountChangeListener(clientSubscriptionId) {
|
|
7679
7674
|
await this._unsubscribeClientSubscription(clientSubscriptionId, 'account change');
|
|
@@ -7719,7 +7714,7 @@ class Connection {
|
|
|
7719
7714
|
/**
|
|
7720
7715
|
* Deregister an account notification callback
|
|
7721
7716
|
*
|
|
7722
|
-
* @param
|
|
7717
|
+
* @param clientSubscriptionId client subscription id to deregister
|
|
7723
7718
|
*/
|
|
7724
7719
|
async removeProgramAccountChangeListener(clientSubscriptionId) {
|
|
7725
7720
|
await this._unsubscribeClientSubscription(clientSubscriptionId, 'program account change');
|
|
@@ -7743,7 +7738,7 @@ class Connection {
|
|
|
7743
7738
|
/**
|
|
7744
7739
|
* Deregister a logs callback.
|
|
7745
7740
|
*
|
|
7746
|
-
* @param
|
|
7741
|
+
* @param clientSubscriptionId client subscription id to deregister.
|
|
7747
7742
|
*/
|
|
7748
7743
|
async removeOnLogsListener(clientSubscriptionId) {
|
|
7749
7744
|
await this._unsubscribeClientSubscription(clientSubscriptionId, 'logs');
|
|
@@ -7788,7 +7783,7 @@ class Connection {
|
|
|
7788
7783
|
/**
|
|
7789
7784
|
* Deregister a slot notification callback
|
|
7790
7785
|
*
|
|
7791
|
-
* @param
|
|
7786
|
+
* @param clientSubscriptionId client subscription id to deregister
|
|
7792
7787
|
*/
|
|
7793
7788
|
async removeSlotChangeListener(clientSubscriptionId) {
|
|
7794
7789
|
await this._unsubscribeClientSubscription(clientSubscriptionId, 'slot change');
|
|
@@ -7823,7 +7818,7 @@ class Connection {
|
|
|
7823
7818
|
/**
|
|
7824
7819
|
* Deregister a slot update notification callback
|
|
7825
7820
|
*
|
|
7826
|
-
* @param
|
|
7821
|
+
* @param clientSubscriptionId client subscription id to deregister
|
|
7827
7822
|
*/
|
|
7828
7823
|
async removeSlotUpdateListener(clientSubscriptionId) {
|
|
7829
7824
|
await this._unsubscribeClientSubscription(clientSubscriptionId, 'slot update');
|
|
@@ -7973,7 +7968,7 @@ class Connection {
|
|
|
7973
7968
|
/**
|
|
7974
7969
|
* Deregister a signature notification callback
|
|
7975
7970
|
*
|
|
7976
|
-
* @param
|
|
7971
|
+
* @param clientSubscriptionId client subscription id to deregister
|
|
7977
7972
|
*/
|
|
7978
7973
|
async removeSignatureListener(clientSubscriptionId) {
|
|
7979
7974
|
await this._unsubscribeClientSubscription(clientSubscriptionId, 'signature result');
|
|
@@ -8007,7 +8002,7 @@ class Connection {
|
|
|
8007
8002
|
/**
|
|
8008
8003
|
* Deregister a root notification callback
|
|
8009
8004
|
*
|
|
8010
|
-
* @param
|
|
8005
|
+
* @param clientSubscriptionId client subscription id to deregister
|
|
8011
8006
|
*/
|
|
8012
8007
|
async removeRootChangeListener(clientSubscriptionId) {
|
|
8013
8008
|
await this._unsubscribeClientSubscription(clientSubscriptionId, 'root change');
|
|
@@ -9625,6 +9620,10 @@ class VoteInit {
|
|
|
9625
9620
|
* Withdraw from vote account transaction params
|
|
9626
9621
|
*/
|
|
9627
9622
|
|
|
9623
|
+
/**
|
|
9624
|
+
* Update validator identity (node pubkey) vote account instruction params.
|
|
9625
|
+
*/
|
|
9626
|
+
|
|
9628
9627
|
/**
|
|
9629
9628
|
* Vote Instruction class
|
|
9630
9629
|
*/
|
|
@@ -9771,6 +9770,10 @@ const VOTE_INSTRUCTION_LAYOUTS = Object.freeze({
|
|
|
9771
9770
|
index: 3,
|
|
9772
9771
|
layout: BufferLayout.struct([BufferLayout.u32('instruction'), BufferLayout.ns64('lamports')])
|
|
9773
9772
|
},
|
|
9773
|
+
UpdateValidatorIdentity: {
|
|
9774
|
+
index: 4,
|
|
9775
|
+
layout: BufferLayout.struct([BufferLayout.u32('instruction')])
|
|
9776
|
+
},
|
|
9774
9777
|
AuthorizeWithSeed: {
|
|
9775
9778
|
index: 10,
|
|
9776
9779
|
layout: BufferLayout.struct([BufferLayout.u32('instruction'), voteAuthorizeWithSeedArgs()])
|
|
@@ -9988,10 +9991,41 @@ class VoteProgram {
|
|
|
9988
9991
|
*/
|
|
9989
9992
|
static safeWithdraw(params, currentVoteAccountBalance, rentExemptMinimum) {
|
|
9990
9993
|
if (params.lamports > currentVoteAccountBalance - rentExemptMinimum) {
|
|
9991
|
-
throw new Error('Withdraw will leave vote account with
|
|
9994
|
+
throw new Error('Withdraw will leave vote account with insufficient funds.');
|
|
9992
9995
|
}
|
|
9993
9996
|
return VoteProgram.withdraw(params);
|
|
9994
9997
|
}
|
|
9998
|
+
|
|
9999
|
+
/**
|
|
10000
|
+
* Generate a transaction to update the validator identity (node pubkey) of a Vote account.
|
|
10001
|
+
*/
|
|
10002
|
+
static updateValidatorIdentity(params) {
|
|
10003
|
+
const {
|
|
10004
|
+
votePubkey,
|
|
10005
|
+
authorizedWithdrawerPubkey,
|
|
10006
|
+
nodePubkey
|
|
10007
|
+
} = params;
|
|
10008
|
+
const type = VOTE_INSTRUCTION_LAYOUTS.UpdateValidatorIdentity;
|
|
10009
|
+
const data = encodeData(type);
|
|
10010
|
+
const keys = [{
|
|
10011
|
+
pubkey: votePubkey,
|
|
10012
|
+
isSigner: false,
|
|
10013
|
+
isWritable: true
|
|
10014
|
+
}, {
|
|
10015
|
+
pubkey: nodePubkey,
|
|
10016
|
+
isSigner: true,
|
|
10017
|
+
isWritable: false
|
|
10018
|
+
}, {
|
|
10019
|
+
pubkey: authorizedWithdrawerPubkey,
|
|
10020
|
+
isSigner: true,
|
|
10021
|
+
isWritable: false
|
|
10022
|
+
}];
|
|
10023
|
+
return new Transaction().add({
|
|
10024
|
+
keys,
|
|
10025
|
+
programId: this.programId,
|
|
10026
|
+
data
|
|
10027
|
+
});
|
|
10028
|
+
}
|
|
9995
10029
|
}
|
|
9996
10030
|
VoteProgram.programId = new PublicKey('Vote111111111111111111111111111111111111111');
|
|
9997
10031
|
/**
|
|
@@ -10003,7 +10037,7 @@ VoteProgram.programId = new PublicKey('Vote1111111111111111111111111111111111111
|
|
|
10003
10037
|
*
|
|
10004
10038
|
* 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
|
|
10005
10039
|
*/
|
|
10006
|
-
VoteProgram.space =
|
|
10040
|
+
VoteProgram.space = 3762;
|
|
10007
10041
|
|
|
10008
10042
|
const VALIDATOR_INFO_KEY = new PublicKey('Va1idator1nfo111111111111111111111111111111');
|
|
10009
10043
|
|
|
@@ -10058,10 +10092,8 @@ class ValidatorInfo {
|
|
|
10058
10092
|
if (configKeyCount !== 2) return null;
|
|
10059
10093
|
const configKeys = [];
|
|
10060
10094
|
for (let i = 0; i < 2; i++) {
|
|
10061
|
-
const publicKey = new PublicKey(byteArray.
|
|
10062
|
-
|
|
10063
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
10064
|
-
byteArray = byteArray.slice(1);
|
|
10095
|
+
const publicKey = new PublicKey(byteArray.splice(0, PUBLIC_KEY_LENGTH));
|
|
10096
|
+
const isSigner = byteArray.splice(0, 1)[0] === 1;
|
|
10065
10097
|
configKeys.push({
|
|
10066
10098
|
publicKey,
|
|
10067
10099
|
isSigner
|