@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.iife.js CHANGED
@@ -12211,23 +12211,19 @@ var solanaWeb3 = (function (exports) {
12211
12211
  const accountCount = decodeLength(byteArray);
12212
12212
  let accountKeys = [];
12213
12213
  for (let i = 0; i < accountCount; i++) {
12214
- const account = byteArray.slice(0, PUBLIC_KEY_LENGTH);
12215
- byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
12214
+ const account = byteArray.splice(0, PUBLIC_KEY_LENGTH);
12216
12215
  accountKeys.push(new PublicKey(buffer.Buffer.from(account)));
12217
12216
  }
12218
- const recentBlockhash = byteArray.slice(0, PUBLIC_KEY_LENGTH);
12219
- byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
12217
+ const recentBlockhash = byteArray.splice(0, PUBLIC_KEY_LENGTH);
12220
12218
  const instructionCount = decodeLength(byteArray);
12221
12219
  let instructions = [];
12222
12220
  for (let i = 0; i < instructionCount; i++) {
12223
12221
  const programIdIndex = byteArray.shift();
12224
12222
  const accountCount = decodeLength(byteArray);
12225
- const accounts = byteArray.slice(0, accountCount);
12226
- byteArray = byteArray.slice(accountCount);
12223
+ const accounts = byteArray.splice(0, accountCount);
12227
12224
  const dataLength = decodeLength(byteArray);
12228
- const dataSlice = byteArray.slice(0, dataLength);
12225
+ const dataSlice = byteArray.splice(0, dataLength);
12229
12226
  const data = bs58$1.encode(buffer.Buffer.from(dataSlice));
12230
- byteArray = byteArray.slice(dataLength);
12231
12227
  instructions.push({
12232
12228
  programIdIndex,
12233
12229
  accounts,
@@ -13260,8 +13256,7 @@ var solanaWeb3 = (function (exports) {
13260
13256
  const signatureCount = decodeLength(byteArray);
13261
13257
  let signatures = [];
13262
13258
  for (let i = 0; i < signatureCount; i++) {
13263
- const signature = byteArray.slice(0, SIGNATURE_LENGTH_IN_BYTES);
13264
- byteArray = byteArray.slice(SIGNATURE_LENGTH_IN_BYTES);
13259
+ const signature = byteArray.splice(0, SIGNATURE_LENGTH_IN_BYTES);
13265
13260
  signatures.push(bs58$1.encode(buffer.Buffer.from(signature)));
13266
13261
  }
13267
13262
  return Transaction.populate(Message.from(byteArray), signatures);
@@ -22143,7 +22138,7 @@ var solanaWeb3 = (function (exports) {
22143
22138
  /**
22144
22139
  * Deregister an account notification callback
22145
22140
  *
22146
- * @param id client subscription id to deregister
22141
+ * @param clientSubscriptionId client subscription id to deregister
22147
22142
  */
22148
22143
  async removeAccountChangeListener(clientSubscriptionId) {
22149
22144
  await this._unsubscribeClientSubscription(clientSubscriptionId, 'account change');
@@ -22189,7 +22184,7 @@ var solanaWeb3 = (function (exports) {
22189
22184
  /**
22190
22185
  * Deregister an account notification callback
22191
22186
  *
22192
- * @param id client subscription id to deregister
22187
+ * @param clientSubscriptionId client subscription id to deregister
22193
22188
  */
22194
22189
  async removeProgramAccountChangeListener(clientSubscriptionId) {
22195
22190
  await this._unsubscribeClientSubscription(clientSubscriptionId, 'program account change');
@@ -22213,7 +22208,7 @@ var solanaWeb3 = (function (exports) {
22213
22208
  /**
22214
22209
  * Deregister a logs callback.
22215
22210
  *
22216
- * @param id client subscription id to deregister.
22211
+ * @param clientSubscriptionId client subscription id to deregister.
22217
22212
  */
22218
22213
  async removeOnLogsListener(clientSubscriptionId) {
22219
22214
  await this._unsubscribeClientSubscription(clientSubscriptionId, 'logs');
@@ -22258,7 +22253,7 @@ var solanaWeb3 = (function (exports) {
22258
22253
  /**
22259
22254
  * Deregister a slot notification callback
22260
22255
  *
22261
- * @param id client subscription id to deregister
22256
+ * @param clientSubscriptionId client subscription id to deregister
22262
22257
  */
22263
22258
  async removeSlotChangeListener(clientSubscriptionId) {
22264
22259
  await this._unsubscribeClientSubscription(clientSubscriptionId, 'slot change');
@@ -22293,7 +22288,7 @@ var solanaWeb3 = (function (exports) {
22293
22288
  /**
22294
22289
  * Deregister a slot update notification callback
22295
22290
  *
22296
- * @param id client subscription id to deregister
22291
+ * @param clientSubscriptionId client subscription id to deregister
22297
22292
  */
22298
22293
  async removeSlotUpdateListener(clientSubscriptionId) {
22299
22294
  await this._unsubscribeClientSubscription(clientSubscriptionId, 'slot update');
@@ -22443,7 +22438,7 @@ var solanaWeb3 = (function (exports) {
22443
22438
  /**
22444
22439
  * Deregister a signature notification callback
22445
22440
  *
22446
- * @param id client subscription id to deregister
22441
+ * @param clientSubscriptionId client subscription id to deregister
22447
22442
  */
22448
22443
  async removeSignatureListener(clientSubscriptionId) {
22449
22444
  await this._unsubscribeClientSubscription(clientSubscriptionId, 'signature result');
@@ -22477,7 +22472,7 @@ var solanaWeb3 = (function (exports) {
22477
22472
  /**
22478
22473
  * Deregister a root notification callback
22479
22474
  *
22480
- * @param id client subscription id to deregister
22475
+ * @param clientSubscriptionId client subscription id to deregister
22481
22476
  */
22482
22477
  async removeRootChangeListener(clientSubscriptionId) {
22483
22478
  await this._unsubscribeClientSubscription(clientSubscriptionId, 'root change');
@@ -25519,6 +25514,10 @@ var solanaWeb3 = (function (exports) {
25519
25514
  * Withdraw from vote account transaction params
25520
25515
  */
25521
25516
 
25517
+ /**
25518
+ * Update validator identity (node pubkey) vote account instruction params.
25519
+ */
25520
+
25522
25521
  /**
25523
25522
  * Vote Instruction class
25524
25523
  */
@@ -25665,6 +25664,10 @@ var solanaWeb3 = (function (exports) {
25665
25664
  index: 3,
25666
25665
  layout: struct([u32('instruction'), ns64('lamports')])
25667
25666
  },
25667
+ UpdateValidatorIdentity: {
25668
+ index: 4,
25669
+ layout: struct([u32('instruction')])
25670
+ },
25668
25671
  AuthorizeWithSeed: {
25669
25672
  index: 10,
25670
25673
  layout: struct([u32('instruction'), voteAuthorizeWithSeedArgs()])
@@ -25882,10 +25885,41 @@ var solanaWeb3 = (function (exports) {
25882
25885
  */
25883
25886
  static safeWithdraw(params, currentVoteAccountBalance, rentExemptMinimum) {
25884
25887
  if (params.lamports > currentVoteAccountBalance - rentExemptMinimum) {
25885
- throw new Error('Withdraw will leave vote account with insuffcient funds.');
25888
+ throw new Error('Withdraw will leave vote account with insufficient funds.');
25886
25889
  }
25887
25890
  return VoteProgram.withdraw(params);
25888
25891
  }
25892
+
25893
+ /**
25894
+ * Generate a transaction to update the validator identity (node pubkey) of a Vote account.
25895
+ */
25896
+ static updateValidatorIdentity(params) {
25897
+ const {
25898
+ votePubkey,
25899
+ authorizedWithdrawerPubkey,
25900
+ nodePubkey
25901
+ } = params;
25902
+ const type = VOTE_INSTRUCTION_LAYOUTS.UpdateValidatorIdentity;
25903
+ const data = encodeData(type);
25904
+ const keys = [{
25905
+ pubkey: votePubkey,
25906
+ isSigner: false,
25907
+ isWritable: true
25908
+ }, {
25909
+ pubkey: nodePubkey,
25910
+ isSigner: true,
25911
+ isWritable: false
25912
+ }, {
25913
+ pubkey: authorizedWithdrawerPubkey,
25914
+ isSigner: true,
25915
+ isWritable: false
25916
+ }];
25917
+ return new Transaction().add({
25918
+ keys,
25919
+ programId: this.programId,
25920
+ data
25921
+ });
25922
+ }
25889
25923
  }
25890
25924
  VoteProgram.programId = new PublicKey('Vote111111111111111111111111111111111111111');
25891
25925
  /**
@@ -25897,7 +25931,7 @@ var solanaWeb3 = (function (exports) {
25897
25931
  *
25898
25932
  * 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
25899
25933
  */
25900
- VoteProgram.space = 3731;
25934
+ VoteProgram.space = 3762;
25901
25935
 
25902
25936
  const VALIDATOR_INFO_KEY = new PublicKey('Va1idator1nfo111111111111111111111111111111');
25903
25937
 
@@ -25952,10 +25986,8 @@ var solanaWeb3 = (function (exports) {
25952
25986
  if (configKeyCount !== 2) return null;
25953
25987
  const configKeys = [];
25954
25988
  for (let i = 0; i < 2; i++) {
25955
- const publicKey = new PublicKey(byteArray.slice(0, PUBLIC_KEY_LENGTH));
25956
- byteArray = byteArray.slice(PUBLIC_KEY_LENGTH);
25957
- const isSigner = byteArray.slice(0, 1)[0] === 1;
25958
- byteArray = byteArray.slice(1);
25989
+ const publicKey = new PublicKey(byteArray.splice(0, PUBLIC_KEY_LENGTH));
25990
+ const isSigner = byteArray.splice(0, 1)[0] === 1;
25959
25991
  configKeys.push({
25960
25992
  publicKey,
25961
25993
  isSigner