@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.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
|
@@ -9326,6 +9326,27 @@ class VoteInstruction {
|
|
|
9326
9326
|
voteInit: new VoteInit(new PublicKey(voteInit.nodePubkey), new PublicKey(voteInit.authorizedVoter), new PublicKey(voteInit.authorizedWithdrawer), voteInit.commission)
|
|
9327
9327
|
};
|
|
9328
9328
|
}
|
|
9329
|
+
/**
|
|
9330
|
+
* Decode an authorize instruction and retrieve the instruction params.
|
|
9331
|
+
*/
|
|
9332
|
+
|
|
9333
|
+
|
|
9334
|
+
static decodeAuthorize(instruction) {
|
|
9335
|
+
this.checkProgramId(instruction.programId);
|
|
9336
|
+
this.checkKeyLength(instruction.keys, 3);
|
|
9337
|
+
const {
|
|
9338
|
+
newAuthorized,
|
|
9339
|
+
voteAuthorizationType
|
|
9340
|
+
} = decodeData(VOTE_INSTRUCTION_LAYOUTS.Authorize, instruction.data);
|
|
9341
|
+
return {
|
|
9342
|
+
votePubkey: instruction.keys[0].pubkey,
|
|
9343
|
+
authorizedPubkey: instruction.keys[2].pubkey,
|
|
9344
|
+
newAuthorizedPubkey: new PublicKey(newAuthorized),
|
|
9345
|
+
voteAuthorizationType: {
|
|
9346
|
+
index: voteAuthorizationType
|
|
9347
|
+
}
|
|
9348
|
+
};
|
|
9349
|
+
}
|
|
9329
9350
|
/**
|
|
9330
9351
|
* Decode a withdraw instruction and retrieve the instruction params.
|
|
9331
9352
|
*/
|
|
@@ -9375,11 +9396,30 @@ const VOTE_INSTRUCTION_LAYOUTS = Object.freeze({
|
|
|
9375
9396
|
index: 0,
|
|
9376
9397
|
layout: BufferLayout.struct([BufferLayout.u32('instruction'), voteInit()])
|
|
9377
9398
|
},
|
|
9399
|
+
Authorize: {
|
|
9400
|
+
index: 1,
|
|
9401
|
+
layout: BufferLayout.struct([BufferLayout.u32('instruction'), publicKey('newAuthorized'), BufferLayout.u32('voteAuthorizationType')])
|
|
9402
|
+
},
|
|
9378
9403
|
Withdraw: {
|
|
9379
9404
|
index: 3,
|
|
9380
9405
|
layout: BufferLayout.struct([BufferLayout.u32('instruction'), BufferLayout.ns64('lamports')])
|
|
9381
9406
|
}
|
|
9382
9407
|
});
|
|
9408
|
+
/**
|
|
9409
|
+
* VoteAuthorize type
|
|
9410
|
+
*/
|
|
9411
|
+
|
|
9412
|
+
/**
|
|
9413
|
+
* An enumeration of valid VoteAuthorization layouts.
|
|
9414
|
+
*/
|
|
9415
|
+
const VoteAuthorizationLayout = Object.freeze({
|
|
9416
|
+
Voter: {
|
|
9417
|
+
index: 0
|
|
9418
|
+
},
|
|
9419
|
+
Withdrawer: {
|
|
9420
|
+
index: 1
|
|
9421
|
+
}
|
|
9422
|
+
});
|
|
9383
9423
|
/**
|
|
9384
9424
|
* Factory class for transactions to interact with the Vote program
|
|
9385
9425
|
*/
|
|
@@ -9455,6 +9495,42 @@ class VoteProgram {
|
|
|
9455
9495
|
voteInit: params.voteInit
|
|
9456
9496
|
}));
|
|
9457
9497
|
}
|
|
9498
|
+
/**
|
|
9499
|
+
* Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account.
|
|
9500
|
+
*/
|
|
9501
|
+
|
|
9502
|
+
|
|
9503
|
+
static authorize(params) {
|
|
9504
|
+
const {
|
|
9505
|
+
votePubkey,
|
|
9506
|
+
authorizedPubkey,
|
|
9507
|
+
newAuthorizedPubkey,
|
|
9508
|
+
voteAuthorizationType
|
|
9509
|
+
} = params;
|
|
9510
|
+
const type = VOTE_INSTRUCTION_LAYOUTS.Authorize;
|
|
9511
|
+
const data = encodeData(type, {
|
|
9512
|
+
newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()),
|
|
9513
|
+
voteAuthorizationType: voteAuthorizationType.index
|
|
9514
|
+
});
|
|
9515
|
+
const keys = [{
|
|
9516
|
+
pubkey: votePubkey,
|
|
9517
|
+
isSigner: false,
|
|
9518
|
+
isWritable: true
|
|
9519
|
+
}, {
|
|
9520
|
+
pubkey: SYSVAR_CLOCK_PUBKEY,
|
|
9521
|
+
isSigner: false,
|
|
9522
|
+
isWritable: false
|
|
9523
|
+
}, {
|
|
9524
|
+
pubkey: authorizedPubkey,
|
|
9525
|
+
isSigner: true,
|
|
9526
|
+
isWritable: false
|
|
9527
|
+
}];
|
|
9528
|
+
return new Transaction().add({
|
|
9529
|
+
keys,
|
|
9530
|
+
programId: this.programId,
|
|
9531
|
+
data
|
|
9532
|
+
});
|
|
9533
|
+
}
|
|
9458
9534
|
/**
|
|
9459
9535
|
* Generate a transaction to withdraw from a Vote account.
|
|
9460
9536
|
*/
|
|
@@ -9558,5 +9634,5 @@ function clusterApiUrl(cluster, tls) {
|
|
|
9558
9634
|
|
|
9559
9635
|
const LAMPORTS_PER_SOL = 1000000000;
|
|
9560
9636
|
|
|
9561
|
-
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 };
|
|
9637
|
+
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 };
|
|
9562
9638
|
//# sourceMappingURL=index.browser.esm.js.map
|