@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.browser.esm.js +77 -1
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +77 -0
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +42 -1
- package/lib/index.esm.js +77 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +77 -0
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/module.flow.js +57 -1
- package/package.json +1 -1
- package/src/vote-program.ts +97 -1
package/lib/index.browser.esm.js
CHANGED
|
@@ -9299,6 +9299,27 @@ class VoteInstruction {
|
|
|
9299
9299
|
voteInit: new VoteInit(new PublicKey(voteInit.nodePubkey), new PublicKey(voteInit.authorizedVoter), new PublicKey(voteInit.authorizedWithdrawer), voteInit.commission)
|
|
9300
9300
|
};
|
|
9301
9301
|
}
|
|
9302
|
+
/**
|
|
9303
|
+
* Decode an authorize instruction and retrieve the instruction params.
|
|
9304
|
+
*/
|
|
9305
|
+
|
|
9306
|
+
|
|
9307
|
+
static decodeAuthorize(instruction) {
|
|
9308
|
+
this.checkProgramId(instruction.programId);
|
|
9309
|
+
this.checkKeyLength(instruction.keys, 3);
|
|
9310
|
+
const {
|
|
9311
|
+
newAuthorized,
|
|
9312
|
+
voteAuthorizationType
|
|
9313
|
+
} = decodeData(VOTE_INSTRUCTION_LAYOUTS.Authorize, instruction.data);
|
|
9314
|
+
return {
|
|
9315
|
+
votePubkey: instruction.keys[0].pubkey,
|
|
9316
|
+
authorizedPubkey: instruction.keys[2].pubkey,
|
|
9317
|
+
newAuthorizedPubkey: new PublicKey(newAuthorized),
|
|
9318
|
+
voteAuthorizationType: {
|
|
9319
|
+
index: voteAuthorizationType
|
|
9320
|
+
}
|
|
9321
|
+
};
|
|
9322
|
+
}
|
|
9302
9323
|
/**
|
|
9303
9324
|
* Decode a withdraw instruction and retrieve the instruction params.
|
|
9304
9325
|
*/
|
|
@@ -9348,11 +9369,30 @@ const VOTE_INSTRUCTION_LAYOUTS = Object.freeze({
|
|
|
9348
9369
|
index: 0,
|
|
9349
9370
|
layout: BufferLayout.struct([BufferLayout.u32('instruction'), voteInit()])
|
|
9350
9371
|
},
|
|
9372
|
+
Authorize: {
|
|
9373
|
+
index: 1,
|
|
9374
|
+
layout: BufferLayout.struct([BufferLayout.u32('instruction'), publicKey('newAuthorized'), BufferLayout.u32('voteAuthorizationType')])
|
|
9375
|
+
},
|
|
9351
9376
|
Withdraw: {
|
|
9352
9377
|
index: 3,
|
|
9353
9378
|
layout: BufferLayout.struct([BufferLayout.u32('instruction'), BufferLayout.ns64('lamports')])
|
|
9354
9379
|
}
|
|
9355
9380
|
});
|
|
9381
|
+
/**
|
|
9382
|
+
* VoteAuthorize type
|
|
9383
|
+
*/
|
|
9384
|
+
|
|
9385
|
+
/**
|
|
9386
|
+
* An enumeration of valid VoteAuthorization layouts.
|
|
9387
|
+
*/
|
|
9388
|
+
const VoteAuthorizationLayout = Object.freeze({
|
|
9389
|
+
Voter: {
|
|
9390
|
+
index: 0
|
|
9391
|
+
},
|
|
9392
|
+
Withdrawer: {
|
|
9393
|
+
index: 1
|
|
9394
|
+
}
|
|
9395
|
+
});
|
|
9356
9396
|
/**
|
|
9357
9397
|
* Factory class for transactions to interact with the Vote program
|
|
9358
9398
|
*/
|
|
@@ -9428,6 +9468,42 @@ class VoteProgram {
|
|
|
9428
9468
|
voteInit: params.voteInit
|
|
9429
9469
|
}));
|
|
9430
9470
|
}
|
|
9471
|
+
/**
|
|
9472
|
+
* Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account.
|
|
9473
|
+
*/
|
|
9474
|
+
|
|
9475
|
+
|
|
9476
|
+
static authorize(params) {
|
|
9477
|
+
const {
|
|
9478
|
+
votePubkey,
|
|
9479
|
+
authorizedPubkey,
|
|
9480
|
+
newAuthorizedPubkey,
|
|
9481
|
+
voteAuthorizationType
|
|
9482
|
+
} = params;
|
|
9483
|
+
const type = VOTE_INSTRUCTION_LAYOUTS.Authorize;
|
|
9484
|
+
const data = encodeData(type, {
|
|
9485
|
+
newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()),
|
|
9486
|
+
voteAuthorizationType: voteAuthorizationType.index
|
|
9487
|
+
});
|
|
9488
|
+
const keys = [{
|
|
9489
|
+
pubkey: votePubkey,
|
|
9490
|
+
isSigner: false,
|
|
9491
|
+
isWritable: true
|
|
9492
|
+
}, {
|
|
9493
|
+
pubkey: SYSVAR_CLOCK_PUBKEY,
|
|
9494
|
+
isSigner: false,
|
|
9495
|
+
isWritable: false
|
|
9496
|
+
}, {
|
|
9497
|
+
pubkey: authorizedPubkey,
|
|
9498
|
+
isSigner: true,
|
|
9499
|
+
isWritable: false
|
|
9500
|
+
}];
|
|
9501
|
+
return new Transaction().add({
|
|
9502
|
+
keys,
|
|
9503
|
+
programId: this.programId,
|
|
9504
|
+
data
|
|
9505
|
+
});
|
|
9506
|
+
}
|
|
9431
9507
|
/**
|
|
9432
9508
|
* Generate a transaction to withdraw from a Vote account.
|
|
9433
9509
|
*/
|
|
@@ -9531,5 +9607,5 @@ function clusterApiUrl(cluster, tls) {
|
|
|
9531
9607
|
|
|
9532
9608
|
const LAMPORTS_PER_SOL = 1000000000;
|
|
9533
9609
|
|
|
9534
|
-
export { Account, Authorized, BLOCKHASH_CACHE_TIMEOUT_MS, BPF_LOADER_DEPRECATED_PROGRAM_ID, BPF_LOADER_PROGRAM_ID, BpfLoader, Connection, Ed25519Program, Enum, EpochSchedule, FeeCalculatorLayout, Keypair, LAMPORTS_PER_SOL, Loader, Lockup, MAX_SEED_LENGTH, Message, NONCE_ACCOUNT_LENGTH, NonceAccount, PACKET_DATA_SIZE, PublicKey, SOLANA_SCHEMA, STAKE_CONFIG_ID, STAKE_INSTRUCTION_LAYOUTS, SYSTEM_INSTRUCTION_LAYOUTS, SYSVAR_CLOCK_PUBKEY, SYSVAR_EPOCH_SCHEDULE_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_REWARDS_PUBKEY, SYSVAR_SLOT_HASHES_PUBKEY, SYSVAR_SLOT_HISTORY_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, Secp256k1Program, SendTransactionError, StakeAuthorizationLayout, StakeInstruction, StakeProgram, Struct, SystemInstruction, SystemProgram, Transaction, TransactionInstruction, VALIDATOR_INFO_KEY, VOTE_PROGRAM_ID, ValidatorInfo, VoteAccount, VoteInit, VoteInstruction, VoteProgram, clusterApiUrl, sendAndConfirmRawTransaction, sendAndConfirmTransaction };
|
|
9610
|
+
export { Account, Authorized, BLOCKHASH_CACHE_TIMEOUT_MS, BPF_LOADER_DEPRECATED_PROGRAM_ID, BPF_LOADER_PROGRAM_ID, BpfLoader, Connection, Ed25519Program, Enum, EpochSchedule, FeeCalculatorLayout, Keypair, LAMPORTS_PER_SOL, Loader, Lockup, MAX_SEED_LENGTH, Message, NONCE_ACCOUNT_LENGTH, NonceAccount, PACKET_DATA_SIZE, PublicKey, SOLANA_SCHEMA, STAKE_CONFIG_ID, STAKE_INSTRUCTION_LAYOUTS, SYSTEM_INSTRUCTION_LAYOUTS, SYSVAR_CLOCK_PUBKEY, SYSVAR_EPOCH_SCHEDULE_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_REWARDS_PUBKEY, SYSVAR_SLOT_HASHES_PUBKEY, SYSVAR_SLOT_HISTORY_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, Secp256k1Program, SendTransactionError, StakeAuthorizationLayout, StakeInstruction, StakeProgram, Struct, SystemInstruction, SystemProgram, Transaction, TransactionInstruction, VALIDATOR_INFO_KEY, VOTE_PROGRAM_ID, ValidatorInfo, VoteAccount, VoteAuthorizationLayout, VoteInit, VoteInstruction, VoteProgram, clusterApiUrl, sendAndConfirmRawTransaction, sendAndConfirmTransaction };
|
|
9535
9611
|
//# sourceMappingURL=index.browser.esm.js.map
|