diff --git a/crates/parser/src/v2.rs b/crates/parser/src/v2.rs index a24c20e60..f0b3530ba 100644 --- a/crates/parser/src/v2.rs +++ b/crates/parser/src/v2.rs @@ -1,20 +1,20 @@ use crate::error::ParserError; +use alloy::network::{Network, TransactionBuilder}; use alloy::primitives::Address; use alloy::providers::Provider; -use alloy::rpc::types::TransactionRequest; use alloy::sol_types::SolCall; use rainlang_bindings::IParserPragmaV1::*; use rainlang_bindings::IParserV2::*; use rainlang_dispair::DISPaiR; -async fn eth_call( +async fn eth_call>( provider: &P, to: Address, call: C, ) -> Result { - let tx = TransactionRequest::default() - .to(to) - .input(call.abi_encode().into()); + let tx = N::TransactionRequest::default() + .with_to(to) + .with_input(call.abi_encode()); let bytes = provider.call(tx).await?; Ok(C::abi_decode_returns(&bytes)?) } @@ -23,7 +23,7 @@ async fn eth_call( #[cfg(not(target_family = "wasm"))] pub trait Parser2 { /// Call Parser contract to parse the provided rainlang text. - fn parse_text( + fn parse_text + Sync>( &self, text: &str, provider: &P, @@ -36,21 +36,21 @@ pub trait Parser2 { /// Call Parser contract to parse the provided data. /// The provided data must contain valid UTF-8 encoding of valid rainlang text. - fn parse( + fn parse + Sync>( &self, data: Vec, provider: &P, ) -> impl std::future::Future> + Send; /// Call Parser contract to parse the provided rainlang text and provide the pragma. - fn parse_pragma( + fn parse_pragma + Sync>( &self, data: Vec, provider: &P, ) -> impl std::future::Future> + Send; /// Call Parser contract to parse the provided rainlang text and return the pragma addresses. - fn parse_pragma_text( + fn parse_pragma_text + Sync>( &self, text: &str, provider: &P, @@ -70,7 +70,7 @@ pub trait Parser2 { /// Trait for interacting with the on-chain Rainlang parser contract. #[cfg(target_family = "wasm")] pub trait Parser2 { - fn parse_text( + fn parse_text>( &self, text: &str, provider: &P, @@ -81,19 +81,19 @@ pub trait Parser2 { self.parse(text.as_bytes().to_vec(), provider) } - fn parse( + fn parse>( &self, data: Vec, provider: &P, ) -> impl std::future::Future>; - fn parse_pragma( + fn parse_pragma>( &self, data: Vec, provider: &P, ) -> impl std::future::Future>; - fn parse_pragma_text( + fn parse_pragma_text>( &self, text: &str, provider: &P, @@ -146,7 +146,7 @@ impl ParserV2 { #[cfg(not(target_family = "wasm"))] impl Parser2 for ParserV2 { - async fn parse( + async fn parse + Sync>( &self, data: Vec, provider: &P, @@ -160,7 +160,7 @@ impl Parser2 for ParserV2 { Ok(parse2Return { bytecode }) } - async fn parse_pragma( + async fn parse_pragma + Sync>( &self, data: Vec, provider: &P, @@ -177,7 +177,7 @@ impl Parser2 for ParserV2 { #[cfg(target_family = "wasm")] impl Parser2 for ParserV2 { - async fn parse( + async fn parse>( &self, data: Vec, provider: &P, @@ -191,7 +191,7 @@ impl Parser2 for ParserV2 { Ok(parse2Return { bytecode }) } - async fn parse_pragma( + async fn parse_pragma>( &self, data: Vec, provider: &P,