@solana/web3.js 1.90.1 → 1.91.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.d.ts CHANGED
@@ -1274,6 +1274,14 @@ type WithdrawFromVoteAccountParams = {
1274
1274
  lamports: number;
1275
1275
  toPubkey: PublicKey;
1276
1276
  };
1277
+ /**
1278
+ * Update validator identity (node pubkey) vote account instruction params.
1279
+ */
1280
+ type UpdateValidatorIdentityParams = {
1281
+ votePubkey: PublicKey;
1282
+ authorizedWithdrawerPubkey: PublicKey;
1283
+ nodePubkey: PublicKey;
1284
+ };
1277
1285
  /**
1278
1286
  * Vote Instruction class
1279
1287
  */
@@ -1302,7 +1310,7 @@ export class VoteInstruction {
1302
1310
  /**
1303
1311
  * An enumeration of valid VoteInstructionType's
1304
1312
  */
1305
- type VoteInstructionType = 'Authorize' | 'AuthorizeWithSeed' | 'InitializeAccount' | 'Withdraw';
1313
+ type VoteInstructionType = 'Authorize' | 'AuthorizeWithSeed' | 'InitializeAccount' | 'Withdraw' | 'UpdateValidatorIdentity';
1306
1314
  /**
1307
1315
  * VoteAuthorize type
1308
1316
  */
@@ -1369,6 +1377,10 @@ export class VoteProgram {
1369
1377
  * `withdraw` method directly.
1370
1378
  */
1371
1379
  static safeWithdraw(params: WithdrawFromVoteAccountParams, currentVoteAccountBalance: number, rentExemptMinimum: number): Transaction;
1380
+ /**
1381
+ * Generate a transaction to update the validator identity (node pubkey) of a Vote account.
1382
+ */
1383
+ static updateValidatorIdentity(params: UpdateValidatorIdentityParams): Transaction;
1372
1384
  }
1373
1385
 
1374
1386
  /**
@@ -3611,7 +3623,7 @@ export class Connection {
3611
3623
  /**
3612
3624
  * Deregister an account notification callback
3613
3625
  *
3614
- * @param id client subscription id to deregister
3626
+ * @param clientSubscriptionId client subscription id to deregister
3615
3627
  */
3616
3628
  removeAccountChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
3617
3629
  /**
@@ -3628,7 +3640,7 @@ export class Connection {
3628
3640
  /**
3629
3641
  * Deregister an account notification callback
3630
3642
  *
3631
- * @param id client subscription id to deregister
3643
+ * @param clientSubscriptionId client subscription id to deregister
3632
3644
  */
3633
3645
  removeProgramAccountChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
3634
3646
  /**
@@ -3638,7 +3650,7 @@ export class Connection {
3638
3650
  /**
3639
3651
  * Deregister a logs callback.
3640
3652
  *
3641
- * @param id client subscription id to deregister.
3653
+ * @param clientSubscriptionId client subscription id to deregister.
3642
3654
  */
3643
3655
  removeOnLogsListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
3644
3656
  /**
@@ -3651,7 +3663,7 @@ export class Connection {
3651
3663
  /**
3652
3664
  * Deregister a slot notification callback
3653
3665
  *
3654
- * @param id client subscription id to deregister
3666
+ * @param clientSubscriptionId client subscription id to deregister
3655
3667
  */
3656
3668
  removeSlotChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
3657
3669
  /**
@@ -3665,7 +3677,7 @@ export class Connection {
3665
3677
  /**
3666
3678
  * Deregister a slot update notification callback
3667
3679
  *
3668
- * @param id client subscription id to deregister
3680
+ * @param clientSubscriptionId client subscription id to deregister
3669
3681
  */
3670
3682
  removeSlotUpdateListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
3671
3683
  _buildArgs(args: Array<any>, override?: Commitment, encoding?: 'jsonParsed' | 'base64', extra?: any): Array<any>;
@@ -3692,7 +3704,7 @@ export class Connection {
3692
3704
  /**
3693
3705
  * Deregister a signature notification callback
3694
3706
  *
3695
- * @param id client subscription id to deregister
3707
+ * @param clientSubscriptionId client subscription id to deregister
3696
3708
  */
3697
3709
  removeSignatureListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
3698
3710
  /**
@@ -3705,7 +3717,7 @@ export class Connection {
3705
3717
  /**
3706
3718
  * Deregister a root notification callback
3707
3719
  *
3708
- * @param id client subscription id to deregister
3720
+ * @param clientSubscriptionId client subscription id to deregister
3709
3721
  */
3710
3722
  removeRootChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
3711
3723
  }
package/lib/index.esm.js CHANGED
@@ -8366,7 +8366,7 @@ class Connection {
8366
8366
  /**
8367
8367
  * Deregister an account notification callback
8368
8368
  *
8369
- * @param id client subscription id to deregister
8369
+ * @param clientSubscriptionId client subscription id to deregister
8370
8370
  */
8371
8371
  async removeAccountChangeListener(clientSubscriptionId) {
8372
8372
  await this._unsubscribeClientSubscription(clientSubscriptionId, 'account change');
@@ -8412,7 +8412,7 @@ class Connection {
8412
8412
  /**
8413
8413
  * Deregister an account notification callback
8414
8414
  *
8415
- * @param id client subscription id to deregister
8415
+ * @param clientSubscriptionId client subscription id to deregister
8416
8416
  */
8417
8417
  async removeProgramAccountChangeListener(clientSubscriptionId) {
8418
8418
  await this._unsubscribeClientSubscription(clientSubscriptionId, 'program account change');
@@ -8436,7 +8436,7 @@ class Connection {
8436
8436
  /**
8437
8437
  * Deregister a logs callback.
8438
8438
  *
8439
- * @param id client subscription id to deregister.
8439
+ * @param clientSubscriptionId client subscription id to deregister.
8440
8440
  */
8441
8441
  async removeOnLogsListener(clientSubscriptionId) {
8442
8442
  await this._unsubscribeClientSubscription(clientSubscriptionId, 'logs');
@@ -8481,7 +8481,7 @@ class Connection {
8481
8481
  /**
8482
8482
  * Deregister a slot notification callback
8483
8483
  *
8484
- * @param id client subscription id to deregister
8484
+ * @param clientSubscriptionId client subscription id to deregister
8485
8485
  */
8486
8486
  async removeSlotChangeListener(clientSubscriptionId) {
8487
8487
  await this._unsubscribeClientSubscription(clientSubscriptionId, 'slot change');
@@ -8516,7 +8516,7 @@ class Connection {
8516
8516
  /**
8517
8517
  * Deregister a slot update notification callback
8518
8518
  *
8519
- * @param id client subscription id to deregister
8519
+ * @param clientSubscriptionId client subscription id to deregister
8520
8520
  */
8521
8521
  async removeSlotUpdateListener(clientSubscriptionId) {
8522
8522
  await this._unsubscribeClientSubscription(clientSubscriptionId, 'slot update');
@@ -8666,7 +8666,7 @@ class Connection {
8666
8666
  /**
8667
8667
  * Deregister a signature notification callback
8668
8668
  *
8669
- * @param id client subscription id to deregister
8669
+ * @param clientSubscriptionId client subscription id to deregister
8670
8670
  */
8671
8671
  async removeSignatureListener(clientSubscriptionId) {
8672
8672
  await this._unsubscribeClientSubscription(clientSubscriptionId, 'signature result');
@@ -8700,7 +8700,7 @@ class Connection {
8700
8700
  /**
8701
8701
  * Deregister a root notification callback
8702
8702
  *
8703
- * @param id client subscription id to deregister
8703
+ * @param clientSubscriptionId client subscription id to deregister
8704
8704
  */
8705
8705
  async removeRootChangeListener(clientSubscriptionId) {
8706
8706
  await this._unsubscribeClientSubscription(clientSubscriptionId, 'root change');
@@ -10318,6 +10318,10 @@ class VoteInit {
10318
10318
  * Withdraw from vote account transaction params
10319
10319
  */
10320
10320
 
10321
+ /**
10322
+ * Update validator identity (node pubkey) vote account instruction params.
10323
+ */
10324
+
10321
10325
  /**
10322
10326
  * Vote Instruction class
10323
10327
  */
@@ -10464,6 +10468,10 @@ const VOTE_INSTRUCTION_LAYOUTS = Object.freeze({
10464
10468
  index: 3,
10465
10469
  layout: BufferLayout.struct([BufferLayout.u32('instruction'), BufferLayout.ns64('lamports')])
10466
10470
  },
10471
+ UpdateValidatorIdentity: {
10472
+ index: 4,
10473
+ layout: BufferLayout.struct([BufferLayout.u32('instruction')])
10474
+ },
10467
10475
  AuthorizeWithSeed: {
10468
10476
  index: 10,
10469
10477
  layout: BufferLayout.struct([BufferLayout.u32('instruction'), voteAuthorizeWithSeedArgs()])
@@ -10681,10 +10689,41 @@ class VoteProgram {
10681
10689
  */
10682
10690
  static safeWithdraw(params, currentVoteAccountBalance, rentExemptMinimum) {
10683
10691
  if (params.lamports > currentVoteAccountBalance - rentExemptMinimum) {
10684
- throw new Error('Withdraw will leave vote account with insuffcient funds.');
10692
+ throw new Error('Withdraw will leave vote account with insufficient funds.');
10685
10693
  }
10686
10694
  return VoteProgram.withdraw(params);
10687
10695
  }
10696
+
10697
+ /**
10698
+ * Generate a transaction to update the validator identity (node pubkey) of a Vote account.
10699
+ */
10700
+ static updateValidatorIdentity(params) {
10701
+ const {
10702
+ votePubkey,
10703
+ authorizedWithdrawerPubkey,
10704
+ nodePubkey
10705
+ } = params;
10706
+ const type = VOTE_INSTRUCTION_LAYOUTS.UpdateValidatorIdentity;
10707
+ const data = encodeData(type);
10708
+ const keys = [{
10709
+ pubkey: votePubkey,
10710
+ isSigner: false,
10711
+ isWritable: true
10712
+ }, {
10713
+ pubkey: nodePubkey,
10714
+ isSigner: true,
10715
+ isWritable: false
10716
+ }, {
10717
+ pubkey: authorizedWithdrawerPubkey,
10718
+ isSigner: true,
10719
+ isWritable: false
10720
+ }];
10721
+ return new Transaction().add({
10722
+ keys,
10723
+ programId: this.programId,
10724
+ data
10725
+ });
10726
+ }
10688
10727
  }
10689
10728
  VoteProgram.programId = new PublicKey('Vote111111111111111111111111111111111111111');
10690
10729
  /**
@@ -10696,7 +10735,7 @@ VoteProgram.programId = new PublicKey('Vote1111111111111111111111111111111111111
10696
10735
  *
10697
10736
  * 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
10698
10737
  */
10699
- VoteProgram.space = 3731;
10738
+ VoteProgram.space = 3762;
10700
10739
 
10701
10740
  const VALIDATOR_INFO_KEY = new PublicKey('Va1idator1nfo111111111111111111111111111111');
10702
10741