rename execution_rpc submodule to rpc

This commit is contained in:
Noah Citron 2022-08-21 12:27:19 -04:00
parent 5240385dcd
commit f3040377c9
3 changed files with 9 additions and 11 deletions

View File

@ -4,21 +4,21 @@ use eyre::Result;
use crate::consensus::types::ExecutionPayload; use crate::consensus::types::ExecutionPayload;
use super::proof::{encode_account, verify_proof}; use super::proof::{encode_account, verify_proof};
use super::execution_rpc::ExecutionRpc; use super::rpc::Rpc;
pub struct ExecutionClient { pub struct ExecutionClient {
execution_rpc: ExecutionRpc, rpc: Rpc,
} }
impl ExecutionClient { impl ExecutionClient {
pub fn new(rpc: &str) -> Self { pub fn new(rpc: &str) -> Self {
let execution_rpc = ExecutionRpc::new(rpc); let rpc = Rpc::new(rpc);
ExecutionClient { execution_rpc } ExecutionClient { rpc }
} }
pub async fn get_account(&self, address: &Address, payload: &ExecutionPayload) -> Result<Account> { pub async fn get_account(&self, address: &Address, payload: &ExecutionPayload) -> Result<Account> {
let proof = self let proof = self
.execution_rpc .rpc
.get_proof(&address, payload.block_number) .get_proof(&address, payload.block_number)
.await?; .await?;

View File

@ -3,5 +3,5 @@ pub mod types;
mod execution; mod execution;
pub use execution::*; pub use execution::*;
mod execution_rpc; mod rpc;
mod proof; mod proof;

View File

@ -4,15 +4,13 @@ use jsonrpsee::{core::client::ClientT, http_client::HttpClientBuilder, rpc_param
use super::types::Proof; use super::types::Proof;
pub struct ExecutionRpc { pub struct Rpc {
rpc: String, rpc: String,
} }
impl ExecutionRpc { impl Rpc {
pub fn new(rpc: &str) -> Self { pub fn new(rpc: &str) -> Self {
ExecutionRpc { Rpc { rpc: rpc.to_string() }
rpc: rpc.to_string(),
}
} }
pub async fn get_proof(&self, address: &Address, block: u64) -> Result<Proof> { pub async fn get_proof(&self, address: &Address, block: u64) -> Result<Proof> {