This commit is contained in:
Derrick Hammer 2023-03-24 10:59:16 -04:00
parent 64eddcaa33
commit 18742dcd1c
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
7 changed files with 13 additions and 40 deletions

View File

@ -1,6 +1,4 @@
use serde::Serialize;
use std::sync::Arc;
use wasm_bindgen::JsValue;
use crate::types::{ChainConfig, Forks};
use crate::utils::bytes_serialize;

View File

@ -2,9 +2,7 @@ use figment::{
providers::{Format, Serialized, Toml},
Figment,
};
use serde::de::Error;
use serde::{Deserialize, Deserializer};
use std::sync::Arc;
use std::{path::PathBuf, process::exit};
use wasm_bindgen::JsValue;
@ -44,8 +42,6 @@ impl<'de> Deserialize<'de> for JsonString {
}
}
struct JsValueWrapper(JsValue);
impl Config {
pub fn from_file(config_path: &PathBuf, network: &str, cli_config: &CliConfig) -> Self {
let base_config = match network {

View File

@ -1,8 +1,6 @@
use common::utils::hex_str_to_bytes;
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use strum::{Display, EnumIter};
use wasm_bindgen::JsValue;
use crate::base::BaseConfig;
use crate::types::{ChainConfig, Fork, Forks};

View File

@ -2,7 +2,6 @@ pub mod nimbus_rpc;
use async_trait::async_trait;
use eyre::Result;
use std::sync::Arc;
use crate::types::{BeaconBlock, Bootstrap, FinalityUpdate, OptimisticUpdate, Update};

View File

@ -1,24 +1,17 @@
use std::cmp;
use std::collections::HashMap;
use std::fmt::{Display, Formatter, Result as FmtResult};
use std::sync::Arc;
use async_trait::async_trait;
use eyre::{Result, WrapErr};
use js_sys::{Function, Map, Promise};
use serde::de::DeserializeOwned;
use eyre::Result;
use js_sys::Promise;
use serde::Deserialize;
use serde_json::from_str as from_json_str;
use serde_wasm_bindgen::to_value;
use wasm_bindgen::closure::Closure;
use wasm_bindgen::{JsCast, JsValue};
use wasm_bindgen::JsValue;
use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen_futures::JsFuture;
use crate::constants::MAX_REQUEST_LIGHT_CLIENT_UPDATES;
use crate::types::*;
use web_sys;
use super::ConsensusRpc;
@ -179,11 +172,9 @@ impl NimbusRpc {
js_params.set(&JsValue::from_str("method"), &JsValue::from_str("GET"));
js_params.set(&JsValue::from_str("path"), &JsValue::from_str(&path));
let result = unsafe {
let js_future = JsFuture::from(consensus_rpc_handler(JsValue::from(js_params)));
let result = js_future.await?;
result
};
let js_future = JsFuture::from(consensus_rpc_handler(JsValue::from(js_params)));
let result = js_future.await?;
let json = result.as_string().unwrap();
let response: T = serde_json::from_str(&json).map_err(|e| RpcError::new(e.to_string()))?;

View File

@ -1,13 +1,9 @@
use std::error::Error;
use std::fmt::{Debug, Display, Formatter};
use std::str::FromStr;
use std::sync::Arc;
use async_trait::async_trait;
use ethers::prelude::{Address, Http};
use ethers::providers::{
HttpRateLimitRetryPolicy, JsonRpcClient, Middleware, Provider, ProviderError, RetryClient,
};
use ethers::prelude::Address;
use ethers::providers::{JsonRpcClient, Middleware, Provider, ProviderError};
use ethers::types::transaction::eip2718::TypedTransaction;
use ethers::types::transaction::eip2930::AccessList;
use ethers::types::{
@ -18,15 +14,14 @@ use eyre::Result;
use serde::de::DeserializeOwned;
use serde::Serialize;
use serde_json::to_value;
use wasm_bindgen::closure::Closure;
use wasm_bindgen::{JsCast, JsValue};
use wasm_bindgen::JsValue;
use crate::types::CallOpts;
use common::errors::RpcError;
use super::ExecutionRpc;
use js_sys::{Function, Promise};
use js_sys::Promise;
use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen_futures::JsFuture;
@ -109,11 +104,8 @@ impl JsonRpcClient for LumeProvider {
let json_str = serde_json::to_string(&js_params).unwrap();
let js_value = JsValue::from_str(&json_str);
let result = unsafe {
let js_future = JsFuture::from(consensus_rpc_handler(js_value));
let result = js_future.await?;
result
};
let js_future = JsFuture::from(consensus_rpc_handler(js_value));
let result = js_future.await?;
let json = result.as_string().unwrap();
let response: R =
@ -126,7 +118,7 @@ impl JsonRpcClient for LumeProvider {
#[async_trait(?Send)]
impl ExecutionRpc for HttpRpc {
fn new() -> Result<Self> {
let mut client = LumeProvider::new();
let client = LumeProvider::new();
let provider = Provider::new(client);
Ok(HttpRpc { provider })

View File

@ -2,7 +2,6 @@ extern crate console_error_panic_hook;
extern crate web_sys;
use std::str::FromStr;
use std::sync::Arc;
use common::types::BlockTag;
use ethers::types::{Address, Filter, H256};