diff --git a/Cargo.lock b/Cargo.lock index 1d40a217..d52b51d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1329,9 +1329,9 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.20.3" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "affdc52f7596ccb2d7645231fc6163bb314630c989b64998f3699a28b4d5d4dc" +checksum = "9579d0ca9fb30da026bac2f0f7d9576ec93489aeb7cd4971dd5b4617d82c79b2" dependencies = [ "jsonrpsee-core", "jsonrpsee-http-client", @@ -1340,9 +1340,9 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.20.3" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2327ba8df2fdbd5e897e2b5ed25ce7f299d345b9736b6828814c3dbd1fd47b" +checksum = "776d009e2f591b78c038e0d053a796f94575d66ca4e77dd84bfc5e81419e436c" dependencies = [ "anyhow", "async-trait", @@ -1359,9 +1359,9 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.20.3" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f80c17f62c7653ce767e3d7288b793dfec920f97067ceb189ebdd3570f2bc20" +checksum = "78b7de9f3219d95985eb77fd03194d7c1b56c19bce1abfcc9d07462574b15572" dependencies = [ "async-trait", "hyper", @@ -1379,16 +1379,15 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.20.3" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be0be325642e850ed0bdff426674d2e66b2b7117c9be23a7caef68a2902b7d9" +checksum = "3266dfb045c9174b24c77c2dfe0084914bb23a6b2597d70c9dc6018392e1cd1b" dependencies = [ "anyhow", "beef", "serde", "serde_json", "thiserror", - "tracing", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 958b37db..447e36e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,7 +64,7 @@ hmac = { version = "0.12.1" } sha2 = { version = "0.10.8" } strum = { version = "0.25.0", features = ["derive"] } strum_macros = "0.25" -jsonrpsee = { version = "0.20.3", features = ["http-client"] } +jsonrpsee = { version = "0.21.0", features = ["http-client"] } tiny-keccak = { version = "2.0.2", features = ["keccak"] } itoa = { version = "1.0.10" } curve25519-dalek = { version = "4.1.1" } diff --git a/blockchain/src/solana/client.rs b/blockchain/src/solana/client.rs index a78072e4..dc32ab91 100644 --- a/blockchain/src/solana/client.rs +++ b/blockchain/src/solana/client.rs @@ -264,7 +264,7 @@ impl ChainProvider for SolanaClient { "rewards": false }), ]; - let block: Result = + let block: Result = self.client.request("getBlock", params).await; match block { Ok(block) => { @@ -276,7 +276,7 @@ impl ChainProvider for SolanaClient { Ok(transactions) } Err(err) => match err { - jsonrpsee::core::Error::Call(err) => { + jsonrpsee::core::ClientError::Call(err) => { let errors = [ MISSING_SLOT_ERROR, NOT_AVAILABLE_SLOT_ERROR, diff --git a/name_resolver/src/ens_provider/contract.rs b/name_resolver/src/ens_provider/contract.rs index 1a8cdc6d..9a50a034 100644 --- a/name_resolver/src/ens_provider/contract.rs +++ b/name_resolver/src/ens_provider/contract.rs @@ -1,5 +1,6 @@ use super::namehash::namehash; -use jsonrpsee::core::{client::ClientT, Error}; +use jsonrpsee::core::client::ClientT; +use jsonrpsee::core::ClientError; use jsonrpsee::http_client::HttpClient; use primitives::keccak::keccak256; use serde_json::json; @@ -10,34 +11,43 @@ pub struct Contract { } impl Contract { - pub async fn resolver(&self, name: &str) -> Result { + pub async fn resolver(&self, name: &str) -> Result { let hash = namehash(name); let data = encode_resolver(hash); let response = self.eth_call(&self.registry, data).await?; let result = response.unwrap_or_default().to_string().replace('\"', ""); if result.is_empty() { - return Err(Error::Custom(String::from("no resolver set"))); + return Err(ClientError::Custom("no resolver set".into())); } let addr = self.extract_address(&result); Ok(addr) } - pub async fn addr(&self, _resolver: &str, _name: &str, _coin_id: u32) -> Result { + pub async fn addr( + &self, + _resolver: &str, + _name: &str, + _coin_id: u32, + ) -> Result { todo!() } - pub async fn legacy_addr(&self, resolver: &str, name: &str) -> Result { + pub async fn legacy_addr(&self, resolver: &str, name: &str) -> Result { let hash = namehash(name); let data = encode_legacy_addr(hash); let response = self.eth_call(resolver, data).await?; let result = response.unwrap_or_default().to_string().replace('\"', ""); if result.is_empty() { - return Err(Error::Custom(String::from("no address"))); + return Err(ClientError::Custom("no address".into())); } Ok(self.extract_address(&result)) } - async fn eth_call(&self, to: &str, data: Vec) -> Result, Error> { + async fn eth_call( + &self, + to: &str, + data: Vec, + ) -> Result, ClientError> { let parmas = json!({ "to": to, "data": format!("0x{}", hex::encode(data)) diff --git a/name_resolver/src/ens_provider/provider.rs b/name_resolver/src/ens_provider/provider.rs index e86a337a..c11c1e22 100644 --- a/name_resolver/src/ens_provider/provider.rs +++ b/name_resolver/src/ens_provider/provider.rs @@ -1,5 +1,5 @@ use super::contract::Contract; -use jsonrpsee::core::Error; +use jsonrpsee::core::ClientError; use jsonrpsee::http_client::HttpClientBuilder; use primitives::Chain; @@ -20,10 +20,10 @@ impl Provider { } } - pub async fn resolve_name(&self, name: &str, _chain: Chain) -> Result { + pub async fn resolve_name(&self, name: &str, _chain: Chain) -> Result { let resolver = self.contract.resolver(name).await?; if resolver.is_empty() { - return Err(Error::Custom(String::from("no resolver set"))); + return Err(ClientError::Custom(String::from("no resolver set"))); } // TODO: support other chain lookup // TODO: support recursive parent lookup @@ -32,7 +32,7 @@ impl Provider { Ok(addr) } - pub async fn get_address(&self, _resolver: &str, _chain: Chain) -> Result { + pub async fn get_address(&self, _resolver: &str, _chain: Chain) -> Result { todo!() } }