@@ -538,33 +538,33 @@ async fn main() -> Result<(), AlignedError> {
538538 let chain_id = get_chain_id ( eth_rpc_url. as_str ( ) ) . await ?;
539539 wallet = wallet. with_chain_id ( chain_id) ;
540540
541+ let used_network: Network = submit_args. network . clone ( ) . into ( ) ;
542+
541543 let nonce = match & submit_args. nonce {
542544 Some ( nonce) => U256 :: from_dec_str ( nonce) . map_err ( |_| SubmitError :: InvalidNonce ) ?,
543- None => {
544- get_nonce_from_batcher ( submit_args. network . clone ( ) . into ( ) , wallet. address ( ) )
545- . await
546- . map_err ( |e| match e {
547- aligned_sdk:: common:: errors:: GetNonceError :: EthRpcError ( e) => {
548- SubmitError :: GetNonceError ( e)
549- }
550- aligned_sdk:: common:: errors:: GetNonceError :: ConnectionFailed ( e) => {
551- SubmitError :: GenericError ( e)
552- }
553- aligned_sdk:: common:: errors:: GetNonceError :: InvalidRequest ( e) => {
554- SubmitError :: GenericError ( e)
555- }
556- aligned_sdk:: common:: errors:: GetNonceError :: SerializationError ( e) => {
557- SubmitError :: GenericError ( e)
558- }
559- aligned_sdk:: common:: errors:: GetNonceError :: ProtocolMismatch {
560- current,
561- expected,
562- } => SubmitError :: ProtocolVersionMismatch { current, expected } ,
563- aligned_sdk:: common:: errors:: GetNonceError :: UnexpectedResponse ( e) => {
564- SubmitError :: UnexpectedBatcherResponse ( e)
565- }
566- } ) ?
567- }
545+ None => get_nonce_from_batcher ( & used_network, wallet. address ( ) )
546+ . await
547+ . map_err ( |e| match e {
548+ aligned_sdk:: common:: errors:: GetNonceError :: EthRpcError ( e) => {
549+ SubmitError :: GetNonceError ( e)
550+ }
551+ aligned_sdk:: common:: errors:: GetNonceError :: ConnectionFailed ( e) => {
552+ SubmitError :: GenericError ( e)
553+ }
554+ aligned_sdk:: common:: errors:: GetNonceError :: InvalidRequest ( e) => {
555+ SubmitError :: GenericError ( e)
556+ }
557+ aligned_sdk:: common:: errors:: GetNonceError :: SerializationError ( e) => {
558+ SubmitError :: GenericError ( e)
559+ }
560+ aligned_sdk:: common:: errors:: GetNonceError :: ProtocolMismatch {
561+ current,
562+ expected,
563+ } => SubmitError :: ProtocolVersionMismatch { current, expected } ,
564+ aligned_sdk:: common:: errors:: GetNonceError :: UnexpectedResponse ( e) => {
565+ SubmitError :: UnexpectedBatcherResponse ( e)
566+ }
567+ } ) ?,
568568 } ;
569569
570570 warn ! ( "Nonce: {nonce}" ) ;
@@ -584,7 +584,7 @@ async fn main() -> Result<(), AlignedError> {
584584 info ! ( "Submitting proofs to the Aligned batcher..." ) ;
585585
586586 let aligned_verification_data_vec = submit_multiple (
587- submit_args . network . clone ( ) . into ( ) ,
587+ & used_network ,
588588 & verification_data_arr,
589589 max_fee_wei,
590590 wallet. clone ( ) ,
@@ -622,7 +622,7 @@ async fn main() -> Result<(), AlignedError> {
622622 }
623623
624624 for batch_merkle_root in unique_batch_merkle_roots {
625- let base_url = match submit_args . network . clone ( ) . into ( ) {
625+ let base_url = match used_network {
626626 // Note: in case the explorer address changes for other networks, we should add an arm to this
627627 // match with that network since the default URL used here is the mainnet one
628628 Network :: Holesky => "https://holesky.explorer.alignedlayer.com/batches/0x" ,
@@ -650,7 +650,7 @@ async fn main() -> Result<(), AlignedError> {
650650 info ! ( "Verifying response data matches sent proof data..." ) ;
651651 let response = verification_layer:: is_proof_verified (
652652 & aligned_verification_data,
653- verify_inclusion_args. network . into ( ) ,
653+ & ( verify_inclusion_args. network . into ( ) ) ,
654654 & verify_inclusion_args. eth_rpc_url ,
655655 )
656656 . await ?;
@@ -758,7 +758,7 @@ async fn main() -> Result<(), AlignedError> {
758758 }
759759 GetUserNonce ( args) => {
760760 let address = H160 :: from_str ( & args. address ) . unwrap ( ) ;
761- match get_nonce_from_batcher ( args. network . into ( ) , address) . await {
761+ match get_nonce_from_batcher ( & args. network . into ( ) , address) . await {
762762 Ok ( nonce) => {
763763 info ! ( "Nonce for address {} is {}" , address, nonce) ;
764764 }
@@ -771,7 +771,7 @@ async fn main() -> Result<(), AlignedError> {
771771 GetUserNonceFromEthereum ( args) => {
772772 let address = H160 :: from_str ( & args. address ) . unwrap ( ) ;
773773 let network = args. network . into ( ) ;
774- match get_nonce_from_ethereum ( & args. eth_rpc_url , address, network) . await {
774+ match get_nonce_from_ethereum ( & args. eth_rpc_url , address, & network) . await {
775775 Ok ( nonce) => {
776776 info ! (
777777 "Nonce for address {} in BatcherPaymentService contract is {}" ,
@@ -788,8 +788,8 @@ async fn main() -> Result<(), AlignedError> {
788788 let address = H160 :: from_str ( & args. address ) . unwrap ( ) ;
789789 let network: Network = args. network . into ( ) ;
790790 let Ok ( ( ethereum_nonce, batcher_nonce) ) = future:: try_join (
791- get_nonce_from_ethereum ( & args. eth_rpc_url , address, network. clone ( ) ) ,
792- get_nonce_from_batcher ( network, address) ,
791+ get_nonce_from_ethereum ( & args. eth_rpc_url , address, & network) ,
792+ get_nonce_from_batcher ( & network, address) ,
793793 )
794794 . await
795795 . map_err ( |e| error ! ( "Error while getting nonce: {:?}" , e) ) else {
0 commit comments