CLI: Relay Messages (#858)

* Relay Messages.

* Fix docs.

* Fix copyright date.

* copyright increment

Co-authored-by: adoerr <0xad@gmx.net>
This commit is contained in:
Tomasz Drwięga
2021-04-02 21:24:01 +02:00
committed by Bastian Köcher
parent 025a9cad59
commit da3f94d99f
4 changed files with 103 additions and 126 deletions
@@ -1,4 +1,4 @@
// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
// This file is part of Parity Bridges Common.
// Parity Bridges Common is free software: you can redistribute it and/or modify
@@ -44,63 +44,6 @@ use sp_runtime::{traits::IdentifyAccount, MultiSigner};
use sp_version::RuntimeVersion;
use std::fmt::Debug;
async fn run_relay_messages(command: cli::RelayMessages) -> Result<(), String> {
match command {
cli::RelayMessages::MillauToRialto {
source,
source_sign,
target,
target_sign,
prometheus_params,
lane,
} => {
type Source = Millau;
type Target = Rialto;
let source_client = source_chain_client::<Source>(source).await?;
let source_sign = Source::source_signing_params(source_sign)?;
let target_client = target_chain_client::<Target>(target).await?;
let target_sign = Target::target_signing_params(target_sign)?;
millau_messages_to_rialto::run(
source_client,
source_sign,
target_client,
target_sign,
lane.into(),
prometheus_params.into(),
)
.await
}
cli::RelayMessages::RialtoToMillau {
source,
source_sign,
target,
target_sign,
prometheus_params,
lane,
} => {
type Source = Rialto;
type Target = Millau;
let source_client = source_chain_client::<Source>(source).await?;
let source_sign = Source::source_signing_params(source_sign)?;
let target_client = target_chain_client::<Target>(target).await?;
let target_sign = Target::target_signing_params(target_sign)?;
rialto_messages_to_millau::run(
source_client,
source_sign,
target_client,
target_sign,
lane.into(),
prometheus_params.into(),
)
.await
}
}
}
async fn run_send_message(command: cli::SendMessage) -> Result<(), String> {
match command {
cli::SendMessage::MillauToRialto {