Skip to content

Commit 5a06504

Browse files
committed
get it working
1 parent 3ef90c5 commit 5a06504

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ alloy-sol-macro = "0.8.15"
1717
alloy-sol-types = "0.8.15"
1818
alloy = { version = "0.8.1", features = [
1919
"json-rpc",
20+
"rpc-client",
2021
"rpc-types",
21-
"rpc-types-eth",
2222
] }
2323
anyhow = "1.0"
2424
bincode = "1.3.3"

src/eth.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::{Message, Request as KiRequest};
2-
pub use alloy::rpc::client::Authorization;
32
pub use alloy::rpc::json_rpc::ErrorPayload;
43
pub use alloy::rpc::types::eth::pubsub::SubscriptionResult;
54
pub use alloy::rpc::types::pubsub::Params;
@@ -8,6 +7,7 @@ pub use alloy::rpc::types::{
87
Block, BlockId, BlockNumberOrTag, FeeHistory, Filter, FilterBlockOption, Log, Transaction,
98
TransactionReceipt,
109
};
10+
pub use alloy::transports::Authorization as AlloyAuthorization;
1111
pub use alloy_primitives::{Address, BlockHash, BlockNumber, Bytes, TxHash, U128, U256, U64, U8};
1212
use serde::{Deserialize, Serialize};
1313
use std::collections::{HashMap, HashSet};
@@ -220,6 +220,23 @@ pub struct ProviderConfig {
220220
pub provider: NodeOrRpcUrl,
221221
}
222222

223+
#[derive(Clone, Debug, Deserialize, Serialize, Hash, Eq, PartialEq)]
224+
pub enum Authorization {
225+
Basic(String),
226+
Bearer(String),
227+
Raw(String),
228+
}
229+
230+
impl From<Authorization> for AlloyAuthorization {
231+
fn from(auth: Authorization) -> AlloyAuthorization {
232+
match auth {
233+
Authorization::Basic(value) => AlloyAuthorization::Basic(value),
234+
Authorization::Bearer(value) => AlloyAuthorization::Bearer(value),
235+
Authorization::Raw(value) => AlloyAuthorization::Raw(value),
236+
}
237+
}
238+
}
239+
223240
#[derive(Clone, Debug, Serialize, Hash, Eq, PartialEq)]
224241
pub enum NodeOrRpcUrl {
225242
Node {
@@ -242,7 +259,7 @@ impl std::cmp::PartialEq<str> for NodeOrRpcUrl {
242259
}
243260

244261
impl<'de> Deserialize<'de> for NodeOrRpcUrl {
245-
fn deserialize<D>(serde::deserializer: D) -> Result<Self, D::Error>
262+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
246263
where
247264
D: serde::Deserializer<'de>,
248265
{
@@ -257,10 +274,9 @@ impl<'de> Deserialize<'de> for NodeOrRpcUrl {
257274
}
258275

259276
#[derive(Deserialize)]
260-
#[serde(tag = "type")]
261277
enum Helper {
262278
Node {
263-
kns_update: crate::core::KnsUpdate,
279+
kns_update: crate::net::KnsUpdate,
264280
use_as_provider: bool,
265281
},
266282
RpcUrl(RpcUrlHelper),

0 commit comments

Comments
 (0)