pub fn authorize_nonce_account(
nonce_address: &Address,
authorized_address: &Address,
new_authority: &Address,
) -> InstructionAvailable on crate feature
bincode only.Expand description
Change the authority of a durable transaction nonce account.
This function produces an Instruction which must be submitted in a
Transaction or invoked to take effect, containing a serialized
SystemInstruction::AuthorizeNonceAccount.
This constructor creates a SystemInstruction::AuthorizeNonceAccount
instruction.
§Required signers
The authorized_address signer must sign the transaction.
§Examples
use solana_rpc_client::rpc_client::RpcClient;
use solana_address::Address;
use solana_sdk::{
signature::{Keypair, Signer},
transaction::Transaction,
};
use solana_system_interface::instruction;
use anyhow::Result;
fn authorize_nonce_account_tx(
client: &RpcClient,
nonce_account_address: &Address,
authorized_account: &Keypair,
new_authority_address: &Address,
) -> Result<()> {
let instr = instruction::authorize_nonce_account(
nonce_account_address,
&authorized_account.pubkey(),
new_authority_address,
);
let mut tx = Transaction::new_with_payer(&[instr], Some(&authorized_account.pubkey()));
let blockhash = client.get_latest_blockhash()?;
tx.try_sign(&[authorized_account], blockhash)?;
client.send_and_confirm_transaction(&tx)?;
Ok(())
}