@solana/web3.js 1.33.1 → 1.34.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
@@ -29187,6 +29187,27 @@ var solanaWeb3 = (function (exports) {
29187
29187
  voteInit: new VoteInit(new PublicKey(voteInit.nodePubkey), new PublicKey(voteInit.authorizedVoter), new PublicKey(voteInit.authorizedWithdrawer), voteInit.commission)
29188
29188
  };
29189
29189
  }
29190
+ /**
29191
+ * Decode an authorize instruction and retrieve the instruction params.
29192
+ */
29193
+
29194
+
29195
+ static decodeAuthorize(instruction) {
29196
+ this.checkProgramId(instruction.programId);
29197
+ this.checkKeyLength(instruction.keys, 3);
29198
+ const {
29199
+ newAuthorized,
29200
+ voteAuthorizationType
29201
+ } = decodeData(VOTE_INSTRUCTION_LAYOUTS.Authorize, instruction.data);
29202
+ return {
29203
+ votePubkey: instruction.keys[0].pubkey,
29204
+ authorizedPubkey: instruction.keys[2].pubkey,
29205
+ newAuthorizedPubkey: new PublicKey(newAuthorized),
29206
+ voteAuthorizationType: {
29207
+ index: voteAuthorizationType
29208
+ }
29209
+ };
29210
+ }
29190
29211
  /**
29191
29212
  * Decode a withdraw instruction and retrieve the instruction params.
29192
29213
  */
@@ -29236,11 +29257,30 @@ var solanaWeb3 = (function (exports) {
29236
29257
  index: 0,
29237
29258
  layout: struct([u32('instruction'), voteInit()])
29238
29259
  },
29260
+ Authorize: {
29261
+ index: 1,
29262
+ layout: struct([u32('instruction'), publicKey('newAuthorized'), u32('voteAuthorizationType')])
29263
+ },
29239
29264
  Withdraw: {
29240
29265
  index: 3,
29241
29266
  layout: struct([u32('instruction'), ns64('lamports')])
29242
29267
  }
29243
29268
  });
29269
+ /**
29270
+ * VoteAuthorize type
29271
+ */
29272
+
29273
+ /**
29274
+ * An enumeration of valid VoteAuthorization layouts.
29275
+ */
29276
+ const VoteAuthorizationLayout = Object.freeze({
29277
+ Voter: {
29278
+ index: 0
29279
+ },
29280
+ Withdrawer: {
29281
+ index: 1
29282
+ }
29283
+ });
29244
29284
  /**
29245
29285
  * Factory class for transactions to interact with the Vote program
29246
29286
  */
@@ -29316,6 +29356,42 @@ var solanaWeb3 = (function (exports) {
29316
29356
  voteInit: params.voteInit
29317
29357
  }));
29318
29358
  }
29359
+ /**
29360
+ * Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account.
29361
+ */
29362
+
29363
+
29364
+ static authorize(params) {
29365
+ const {
29366
+ votePubkey,
29367
+ authorizedPubkey,
29368
+ newAuthorizedPubkey,
29369
+ voteAuthorizationType
29370
+ } = params;
29371
+ const type = VOTE_INSTRUCTION_LAYOUTS.Authorize;
29372
+ const data = encodeData(type, {
29373
+ newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()),
29374
+ voteAuthorizationType: voteAuthorizationType.index
29375
+ });
29376
+ const keys = [{
29377
+ pubkey: votePubkey,
29378
+ isSigner: false,
29379
+ isWritable: true
29380
+ }, {
29381
+ pubkey: SYSVAR_CLOCK_PUBKEY,
29382
+ isSigner: false,
29383
+ isWritable: false
29384
+ }, {
29385
+ pubkey: authorizedPubkey,
29386
+ isSigner: true,
29387
+ isWritable: false
29388
+ }];
29389
+ return new Transaction().add({
29390
+ keys,
29391
+ programId: this.programId,
29392
+ data
29393
+ });
29394
+ }
29319
29395
  /**
29320
29396
  * Generate a transaction to withdraw from a Vote account.
29321
29397
  */
@@ -29467,6 +29543,7 @@ var solanaWeb3 = (function (exports) {
29467
29543
  exports.VOTE_PROGRAM_ID = VOTE_PROGRAM_ID;
29468
29544
  exports.ValidatorInfo = ValidatorInfo;
29469
29545
  exports.VoteAccount = VoteAccount;
29546
+ exports.VoteAuthorizationLayout = VoteAuthorizationLayout;
29470
29547
  exports.VoteInit = VoteInit;
29471
29548
  exports.VoteInstruction = VoteInstruction;
29472
29549
  exports.VoteProgram = VoteProgram;