@@ -11,8 +11,8 @@ use aligned_sdk::core::{
1111 types:: { AlignedVerificationData , Network , ProvingSystemId , VerificationData } ,
1212} ;
1313use aligned_sdk:: sdk:: get_chain_id;
14+ use aligned_sdk:: sdk:: get_first_nonce_in_queue_from_batcher;
1415use aligned_sdk:: sdk:: get_nonce_from_batcher;
15- use aligned_sdk:: sdk:: get_nonce_from_ethereum;
1616use aligned_sdk:: sdk:: { deposit_to_aligned, get_balance_in_aligned} ;
1717use aligned_sdk:: sdk:: { get_vk_commitment, is_proof_verified, save_response, submit_multiple} ;
1818use clap:: Parser ;
@@ -29,7 +29,7 @@ use transaction::eip2718::TypedTransaction;
2929
3030use crate :: AlignedCommands :: DepositToBatcher ;
3131use crate :: AlignedCommands :: GetUserBalance ;
32- use crate :: AlignedCommands :: GetUserFirstNonce ;
32+ use crate :: AlignedCommands :: GetUserFirstNonceInBatcherQueue ;
3333use crate :: AlignedCommands :: GetUserNonce ;
3434use crate :: AlignedCommands :: GetVkCommitment ;
3535use crate :: AlignedCommands :: Submit ;
@@ -61,10 +61,10 @@ pub enum AlignedCommands {
6161 #[ clap( about = "Get user nonce from the batcher" , name = "get-user-nonce" ) ]
6262 GetUserNonce ( GetUserNonceArgs ) ,
6363 #[ clap(
64- about = "Get the first user nonce from ethereum " ,
65- name = "get-user-first-nonce"
64+ about = "Returns the nonce of the proof with the lowest nonce inside the batcher queue for a given address. Useful when your proofs are stuck in the batcher due to a low fee and you need to bump them. " ,
65+ name = "get-user-first-nonce-in-batcher-queue "
6666 ) ]
67- GetUserFirstNonce ( GetUserFirstNonceArgs ) ,
67+ GetUserFirstNonceInBatcherQueue ( GetUserFirstNonceInBatcherQueueArgs ) ,
6868}
6969
7070#[ derive( Parser , Debug ) ]
@@ -227,25 +227,19 @@ pub struct GetUserNonceArgs {
227227
228228#[ derive( Parser , Debug ) ]
229229#[ command( version, about, long_about = None ) ]
230- pub struct GetUserFirstNonceArgs {
231- #[ arg(
232- name = "Ethereum RPC provider address" ,
233- long = "rpc_url" ,
234- default_value = "http://localhost:8545"
235- ) ]
236- eth_rpc_url : String ,
230+ pub struct GetUserFirstNonceInBatcherQueueArgs {
237231 #[ arg(
238232 name = "The user's Ethereum address" ,
239233 long = "user_addr" ,
240234 required = true
241235 ) ]
242236 address : String ,
243237 #[ arg(
244- name = "The working network's name " ,
245- long = "network " ,
246- default_value = "devnet "
238+ name = "Batcher connection address " ,
239+ long = "batcher_url " ,
240+ default_value = "ws://localhost:8080 "
247241 ) ]
248- network : NetworkArg ,
242+ batcher_url : String ,
249243}
250244
251245#[ derive( Debug , Clone , ValueEnum , Copy ) ]
@@ -558,13 +552,14 @@ async fn main() -> Result<(), AlignedError> {
558552 }
559553 }
560554 }
561- GetUserFirstNonce ( args) => {
555+ GetUserFirstNonceInBatcherQueue ( args) => {
562556 let address = H160 :: from_str ( & args. address ) . unwrap ( ) ;
563- let network = args. network . into ( ) ;
564- match get_nonce_from_ethereum ( & args. eth_rpc_url , address, network) . await {
557+ match get_first_nonce_in_queue_from_batcher ( & args. batcher_url , address) . await {
565558 Ok ( nonce) => {
566- let first_nonce = nonce + 1 ;
567- info ! ( "Nonce for address {} is {}" , address, first_nonce) ;
559+ info ! (
560+ "First nonce in batcher queue for address {} is {}" ,
561+ address, nonce
562+ ) ;
568563 }
569564 Err ( e) => {
570565 error ! ( "Error while getting nonce: {:?}" , e) ;
0 commit comments