Skip to content

Commit

Permalink
Adding types seismic provider for easy function call (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
phexyz authored Feb 19, 2025
1 parent 2450e6d commit e3a52e3
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions crates/provider/src/layers/seismic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ use alloy_transport::{Transport, TransportErrorKind, TransportResult};
use seismic_enclave::{ecdh_decrypt, ecdh_encrypt, rand, Keypair, PublicKey, Secp256k1};
use std::marker::PhantomData;

/// Creates a new provider with seismic and wallet capabilities
pub fn create_seismic_provider(
wallet: EthereumWallet,
url: reqwest::Url,
) -> FillProvider<
/// Seismic provider
pub type SeismicSignedProvider = FillProvider<
JoinFill<Identity, NonceFiller>,
SeismicProvider<
FillProvider<
Expand All @@ -35,7 +32,27 @@ pub fn create_seismic_provider(
>,
alloy_transport_http::Http<alloy_transport_http::Client>,
Ethereum,
> {
>;

/// Seismic unsigned provider
pub type SeismicUnsignedProvider = FillProvider<
JoinFill<Identity, NonceFiller>,
SeismicProvider<
FillProvider<
JoinFill<<Ethereum as RecommendedFillers>::RecommendedFillers, Identity>,
RootProvider<alloy_transport_http::Http<alloy_transport_http::Client>, Ethereum>,
alloy_transport_http::Http<alloy_transport_http::Client>,
Ethereum,
>,
alloy_transport_http::Http<alloy_transport_http::Client>,
Ethereum,
>,
alloy_transport_http::Http<alloy_transport_http::Client>,
Ethereum,
>;

/// Creates a new provider with seismic and wallet capabilities
pub fn create_seismic_provider(wallet: EthereumWallet, url: reqwest::Url) -> SeismicSignedProvider {
// Create wallet layer with recommended fillers
let wallet_layer =
JoinFill::new(Ethereum::recommended_fillers(), WalletFiller::new(wallet.clone()));
Expand All @@ -53,24 +70,8 @@ pub fn create_seismic_provider(
.on_http(url)
}

/// Creates a new provider with seismic and wallet capabilities
pub fn create_seismic_provider_without_wallet(
url: reqwest::Url,
) -> FillProvider<
JoinFill<Identity, NonceFiller>,
SeismicProvider<
FillProvider<
JoinFill<<Ethereum as RecommendedFillers>::RecommendedFillers, Identity>,
RootProvider<alloy_transport_http::Http<alloy_transport_http::Client>, Ethereum>,
alloy_transport_http::Http<alloy_transport_http::Client>,
Ethereum,
>,
alloy_transport_http::Http<alloy_transport_http::Client>,
Ethereum,
>,
alloy_transport_http::Http<alloy_transport_http::Client>,
Ethereum,
> {
/// Creates a new provider with seismic capabilities
pub fn create_seismic_provider_without_wallet(url: reqwest::Url) -> SeismicUnsignedProvider {
// Create wallet layer with recommended fillers
let wallet_layer = JoinFill::new(Ethereum::recommended_fillers(), Identity);
let nonce_layer: JoinFill<Identity, NonceFiller<SimpleNonceManager>> =
Expand Down

0 comments on commit e3a52e3

Please sign in to comment.