use crate::*;

/// set sudo key
pub async fn set_key(pair: Pair, client: &Client, new_key: AccountId) -> Result<(), subxt::Error> {
	let progress = client
		.tx()
		.sign_and_submit_then_watch(
			&runtime::tx().sudo().set_key(new_key.into()),
			&PairSigner::new(pair),
			BaseExtrinsicParamsBuilder::new(),
		)
		.await?;

	let _ = track_progress(progress).await?; // TODO
	Ok(())
}