mirror of
https://github.com/serai-dex/serai.git
synced 2025-03-12 09:26:51 +00:00
Remove async-trait from monero-rpc
This commit is contained in:
parent
875c669a7a
commit
6b270bc6aa
5 changed files with 742 additions and 665 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -4949,7 +4949,6 @@ dependencies = [
|
||||||
name = "monero-rpc"
|
name = "monero-rpc"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
|
||||||
"curve25519-dalek",
|
"curve25519-dalek",
|
||||||
"hex",
|
"hex",
|
||||||
"monero-address",
|
"monero-address",
|
||||||
|
@ -5013,7 +5012,6 @@ dependencies = [
|
||||||
name = "monero-simple-request-rpc"
|
name = "monero-simple-request-rpc"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
|
||||||
"digest_auth",
|
"digest_auth",
|
||||||
"hex",
|
"hex",
|
||||||
"monero-address",
|
"monero-address",
|
||||||
|
|
|
@ -18,7 +18,6 @@ workspace = true
|
||||||
[dependencies]
|
[dependencies]
|
||||||
std-shims = { path = "../../../common/std-shims", version = "^0.1.1", default-features = false }
|
std-shims = { path = "../../../common/std-shims", version = "^0.1.1", default-features = false }
|
||||||
|
|
||||||
async-trait = { version = "0.1", default-features = false }
|
|
||||||
thiserror = { version = "1", default-features = false, optional = true }
|
thiserror = { version = "1", default-features = false, optional = true }
|
||||||
|
|
||||||
zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] }
|
zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] }
|
||||||
|
|
|
@ -16,8 +16,6 @@ rustdoc-args = ["--cfg", "docsrs"]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = { version = "0.1", default-features = false }
|
|
||||||
|
|
||||||
hex = { version = "0.4", default-features = false, features = ["alloc"] }
|
hex = { version = "0.4", default-features = false, features = ["alloc"] }
|
||||||
digest_auth = { version = "0.3", default-features = false }
|
digest_auth = { version = "0.3", default-features = false }
|
||||||
simple-request = { path = "../../../../common/request", version = "0.1", default-features = false, features = ["tls"] }
|
simple-request = { path = "../../../../common/request", version = "0.1", default-features = false, features = ["tls"] }
|
||||||
|
|
|
@ -2,10 +2,9 @@
|
||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
|
use core::future::Future;
|
||||||
use std::{sync::Arc, io::Read, time::Duration};
|
use std::{sync::Arc, io::Read, time::Duration};
|
||||||
|
|
||||||
use async_trait::async_trait;
|
|
||||||
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
use digest_auth::{WwwAuthenticateHeader, AuthContext};
|
use digest_auth::{WwwAuthenticateHeader, AuthContext};
|
||||||
|
@ -280,11 +279,16 @@ impl SimpleRequestRpc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
|
||||||
impl Rpc for SimpleRequestRpc {
|
impl Rpc for SimpleRequestRpc {
|
||||||
async fn post(&self, route: &str, body: Vec<u8>) -> Result<Vec<u8>, RpcError> {
|
fn post(
|
||||||
tokio::time::timeout(self.request_timeout, self.inner_post(route, body))
|
&self,
|
||||||
.await
|
route: &str,
|
||||||
.map_err(|e| RpcError::ConnectionError(format!("{e:?}")))?
|
body: Vec<u8>,
|
||||||
|
) -> impl Send + Future<Output = Result<Vec<u8>, RpcError>> {
|
||||||
|
async move {
|
||||||
|
tokio::time::timeout(self.request_timeout, self.inner_post(route, body))
|
||||||
|
.await
|
||||||
|
.map_err(|e| RpcError::ConnectionError(format!("{e:?}")))?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue