mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 11:01:01 +00:00
dry-run mode for init bridge command (#1690)
* `dry-run` mode for init bridge command * fix clippy
This commit is contained in:
committed by
Bastian Köcher
parent
02ef3a1a25
commit
9cea69349f
@@ -15,6 +15,7 @@
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use async_trait::async_trait;
|
||||
use codec::Encode;
|
||||
|
||||
use crate::{
|
||||
chains::{
|
||||
@@ -46,6 +47,9 @@ pub struct InitBridge {
|
||||
target: TargetConnectionParams,
|
||||
#[structopt(flatten)]
|
||||
target_sign: TargetSigningParams,
|
||||
/// Generates all required data, but does not submit extrinsic
|
||||
#[structopt(long)]
|
||||
dry_run: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, EnumString, EnumVariantNames)]
|
||||
@@ -77,6 +81,7 @@ where
|
||||
let source_client = data.source.into_client::<Self::Source>().await?;
|
||||
let target_client = data.target.into_client::<Self::Target>().await?;
|
||||
let target_sign = data.target_sign.to_keypair::<Self::Target>()?;
|
||||
let dry_run = data.dry_run;
|
||||
|
||||
let (spec_version, transaction_version) = target_client.simple_runtime_version().await?;
|
||||
substrate_relay_helper::finality::initialize::initialize::<Self::Engine, _, _, _>(
|
||||
@@ -90,11 +95,15 @@ where
|
||||
signer: target_sign,
|
||||
},
|
||||
move |transaction_nonce, initialization_data| {
|
||||
Ok(UnsignedTransaction::new(
|
||||
Self::encode_init_bridge(initialization_data).into(),
|
||||
transaction_nonce,
|
||||
))
|
||||
let call = Self::encode_init_bridge(initialization_data);
|
||||
log::info!(
|
||||
target: "bridge",
|
||||
"Initialize bridge call encoded as hex string: {:?}",
|
||||
format!("0x{}", hex::encode(call.encode()))
|
||||
);
|
||||
Ok(UnsignedTransaction::new(call.into(), transaction_nonce))
|
||||
},
|
||||
dry_run,
|
||||
)
|
||||
.await;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user