Support nonced transactions in the CLI (#7624)
* Support nonced transactions in the CLI * Update nonce.rs
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
use crate::hash::Hash;
|
||||
use crate::instruction::{CompiledInstruction, Instruction, InstructionError};
|
||||
use crate::message::Message;
|
||||
use crate::nonce_instruction;
|
||||
use crate::pubkey::Pubkey;
|
||||
use crate::short_vec;
|
||||
use crate::signature::{KeypairUtil, Signature};
|
||||
@@ -94,6 +95,19 @@ impl Transaction {
|
||||
Self::new(signing_keypairs, message, recent_blockhash)
|
||||
}
|
||||
|
||||
pub fn new_signed_with_nonce<T: KeypairUtil>(
|
||||
mut instructions: Vec<Instruction>,
|
||||
payer: Option<&Pubkey>,
|
||||
signing_keypairs: &[&T],
|
||||
nonce_account_pubkey: &Pubkey,
|
||||
nonce_authority_pubkey: &Pubkey,
|
||||
nonce_hash: Hash,
|
||||
) -> Self {
|
||||
let nonce_ix = nonce_instruction::nonce(&nonce_account_pubkey, &nonce_authority_pubkey);
|
||||
instructions.insert(0, nonce_ix);
|
||||
Self::new_signed_with_payer(instructions, payer, signing_keypairs, nonce_hash)
|
||||
}
|
||||
|
||||
pub fn new_unsigned_instructions(instructions: Vec<Instruction>) -> Self {
|
||||
let message = Message::new(instructions);
|
||||
Self::new_unsigned(message)
|
||||
|
Reference in New Issue
Block a user