@solana/web3.js 1.33.0 → 1.34.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.iife.js CHANGED
@@ -29160,6 +29160,27 @@ var solanaWeb3 = (function (exports) {
29160
29160
  voteInit: new VoteInit(new PublicKey(voteInit.nodePubkey), new PublicKey(voteInit.authorizedVoter), new PublicKey(voteInit.authorizedWithdrawer), voteInit.commission)
29161
29161
  };
29162
29162
  }
29163
+ /**
29164
+ * Decode an authorize instruction and retrieve the instruction params.
29165
+ */
29166
+
29167
+
29168
+ static decodeAuthorize(instruction) {
29169
+ this.checkProgramId(instruction.programId);
29170
+ this.checkKeyLength(instruction.keys, 3);
29171
+ const {
29172
+ newAuthorized,
29173
+ voteAuthorizationType
29174
+ } = decodeData(VOTE_INSTRUCTION_LAYOUTS.Authorize, instruction.data);
29175
+ return {
29176
+ votePubkey: instruction.keys[0].pubkey,
29177
+ authorizedPubkey: instruction.keys[2].pubkey,
29178
+ newAuthorizedPubkey: new PublicKey(newAuthorized),
29179
+ voteAuthorizationType: {
29180
+ index: voteAuthorizationType
29181
+ }
29182
+ };
29183
+ }
29163
29184
  /**
29164
29185
  * Decode a withdraw instruction and retrieve the instruction params.
29165
29186
  */
@@ -29209,11 +29230,30 @@ var solanaWeb3 = (function (exports) {
29209
29230
  index: 0,
29210
29231
  layout: struct([u32('instruction'), voteInit()])
29211
29232
  },
29233
+ Authorize: {
29234
+ index: 1,
29235
+ layout: struct([u32('instruction'), publicKey('newAuthorized'), u32('voteAuthorizationType')])
29236
+ },
29212
29237
  Withdraw: {
29213
29238
  index: 3,
29214
29239
  layout: struct([u32('instruction'), ns64('lamports')])
29215
29240
  }
29216
29241
  });
29242
+ /**
29243
+ * VoteAuthorize type
29244
+ */
29245
+
29246
+ /**
29247
+ * An enumeration of valid VoteAuthorization layouts.
29248
+ */
29249
+ const VoteAuthorizationLayout = Object.freeze({
29250
+ Voter: {
29251
+ index: 0
29252
+ },
29253
+ Withdrawer: {
29254
+ index: 1
29255
+ }
29256
+ });
29217
29257
  /**
29218
29258
  * Factory class for transactions to interact with the Vote program
29219
29259
  */
@@ -29289,6 +29329,42 @@ var solanaWeb3 = (function (exports) {
29289
29329
  voteInit: params.voteInit
29290
29330
  }));
29291
29331
  }
29332
+ /**
29333
+ * Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account.
29334
+ */
29335
+
29336
+
29337
+ static authorize(params) {
29338
+ const {
29339
+ votePubkey,
29340
+ authorizedPubkey,
29341
+ newAuthorizedPubkey,
29342
+ voteAuthorizationType
29343
+ } = params;
29344
+ const type = VOTE_INSTRUCTION_LAYOUTS.Authorize;
29345
+ const data = encodeData(type, {
29346
+ newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()),
29347
+ voteAuthorizationType: voteAuthorizationType.index
29348
+ });
29349
+ const keys = [{
29350
+ pubkey: votePubkey,
29351
+ isSigner: false,
29352
+ isWritable: true
29353
+ }, {
29354
+ pubkey: SYSVAR_CLOCK_PUBKEY,
29355
+ isSigner: false,
29356
+ isWritable: false
29357
+ }, {
29358
+ pubkey: authorizedPubkey,
29359
+ isSigner: true,
29360
+ isWritable: false
29361
+ }];
29362
+ return new Transaction().add({
29363
+ keys,
29364
+ programId: this.programId,
29365
+ data
29366
+ });
29367
+ }
29292
29368
  /**
29293
29369
  * Generate a transaction to withdraw from a Vote account.
29294
29370
  */
@@ -29440,6 +29516,7 @@ var solanaWeb3 = (function (exports) {
29440
29516
  exports.VOTE_PROGRAM_ID = VOTE_PROGRAM_ID;
29441
29517
  exports.ValidatorInfo = ValidatorInfo;
29442
29518
  exports.VoteAccount = VoteAccount;
29519
+ exports.VoteAuthorizationLayout = VoteAuthorizationLayout;
29443
29520
  exports.VoteInit = VoteInit;
29444
29521
  exports.VoteInstruction = VoteInstruction;
29445
29522
  exports.VoteProgram = VoteProgram;