mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 07:31:02 +00:00
Extract minimal ethereum client (#359)
* relay-ethereum-client * use relay-ethereum-client from ethereum-poa-relay * cargo fmt --all * #![warn(missing_docs)] * EthereumRpcClient -> EthereumClient * make EthereumHeadersSyncPipeline private * return concrete type from crate::new * cleanup dependencies * *self -> self * remove trait Client * sort deps
This commit is contained in:
committed by
Bastian Köcher
parent
d614cdaba8
commit
ec34870eab
@@ -16,10 +16,7 @@
|
||||
|
||||
//! Substrate -> Ethereum synchronization.
|
||||
|
||||
use crate::ethereum_client::{
|
||||
EthereumConnectionParams, EthereumHighLevelRpc, EthereumRpcClient, EthereumSigningParams,
|
||||
};
|
||||
use crate::ethereum_types::Address;
|
||||
use crate::ethereum_client::EthereumHighLevelRpc;
|
||||
use crate::instances::BridgeInstance;
|
||||
use crate::rpc::SubstrateRpc;
|
||||
use crate::rpc_errors::RpcError;
|
||||
@@ -35,6 +32,10 @@ use headers_relay::{
|
||||
sync_loop::{SourceClient, TargetClient},
|
||||
sync_types::{SourceHeader, SubmittedHeaders},
|
||||
};
|
||||
use relay_ethereum_client::{
|
||||
types::Address, Client as EthereumClient, ConnectionParams as EthereumConnectionParams,
|
||||
SigningParams as EthereumSigningParams,
|
||||
};
|
||||
use relay_utils::metrics::MetricsParams;
|
||||
|
||||
use std::fmt::Debug;
|
||||
@@ -125,7 +126,7 @@ impl SourceClient<SubstrateHeadersSyncPipeline> for SubstrateHeadersSource {
|
||||
/// Ethereum client as Substrate headers target.
|
||||
struct EthereumHeadersTarget {
|
||||
/// Ethereum node client.
|
||||
client: EthereumRpcClient,
|
||||
client: EthereumClient,
|
||||
/// Bridge contract address.
|
||||
contract: Address,
|
||||
/// Ethereum signing params.
|
||||
@@ -133,7 +134,7 @@ struct EthereumHeadersTarget {
|
||||
}
|
||||
|
||||
impl EthereumHeadersTarget {
|
||||
fn new(client: EthereumRpcClient, contract: Address, sign_params: EthereumSigningParams) -> Self {
|
||||
fn new(client: EthereumClient, contract: Address, sign_params: EthereumSigningParams) -> Self {
|
||||
Self {
|
||||
client,
|
||||
contract,
|
||||
@@ -194,7 +195,7 @@ pub fn run(params: SubstrateSyncParams) -> Result<(), RpcError> {
|
||||
instance,
|
||||
} = params;
|
||||
|
||||
let eth_client = EthereumRpcClient::new(eth_params);
|
||||
let eth_client = EthereumClient::new(eth_params);
|
||||
let sub_client = async_std::task::block_on(async { SubstrateRpcClient::new(sub_params, instance).await })?;
|
||||
|
||||
let target = EthereumHeadersTarget::new(eth_client, eth_contract_address, eth_sign);
|
||||
|
||||
Reference in New Issue
Block a user