Skip to content
Snippets Groups Projects
Forked from clients / Rust / Ğcli-v2s
95 commits behind the upstream repository.
sudo.rs 417 B
use crate::*;

use sp_core::{crypto::AccountId32, sr25519::Pair};
use subxt::tx::{BaseExtrinsicParamsBuilder, PairSigner};

pub async fn set_key(
	pair: Pair,
	client: &Client,
	new_key: AccountId32,
) -> Result<TxProgress, subxt::Error> {
	client
		.tx()
		.sign_and_submit_then_watch(
			&runtime::tx().sudo().set_key(new_key.into()),
			&PairSigner::new(pair),
			BaseExtrinsicParamsBuilder::new(),
		)
		.await
}