@@ -17,6 +17,7 @@ use aligned_sdk::communication::serialization::cbor_deserialize;
1717use aligned_sdk:: verification_layer;
1818use aligned_sdk:: verification_layer:: estimate_fee;
1919use aligned_sdk:: verification_layer:: get_chain_id;
20+ use aligned_sdk:: verification_layer:: get_last_max_fee;
2021use aligned_sdk:: verification_layer:: get_nonce_from_batcher;
2122use aligned_sdk:: verification_layer:: get_nonce_from_ethereum;
2223use aligned_sdk:: verification_layer:: { deposit_to_aligned, get_balance_in_aligned} ;
@@ -38,6 +39,7 @@ use transaction::eip2718::TypedTransaction;
3839use crate :: AlignedCommands :: DepositToBatcher ;
3940use crate :: AlignedCommands :: GetUserAmountOfQueuedProofs ;
4041use crate :: AlignedCommands :: GetUserBalance ;
42+ use crate :: AlignedCommands :: GetUserLastMaxFee ;
4143use crate :: AlignedCommands :: GetUserNonce ;
4244use crate :: AlignedCommands :: GetUserNonceFromEthereum ;
4345use crate :: AlignedCommands :: GetVkCommitment ;
@@ -77,6 +79,11 @@ pub enum AlignedCommands {
7779 name = "get-user-nonce-from-ethereum"
7880 ) ]
7981 GetUserNonceFromEthereum ( GetUserNonceFromEthereumArgs ) ,
82+ #[ clap(
83+ about = "Gets user current last max fee from the batcher. This is the max limit you can send in your next proof." ,
84+ name = "get-user-last-max-fee"
85+ ) ]
86+ GetUserLastMaxFee ( GetUserLastMaxFeeArgs ) ,
8087 #[ clap(
8188 about = "Gets the number of proofs a user has queued in the Batcher." ,
8289 name = "get-user-amount-of-queued-proofs"
@@ -267,6 +274,15 @@ pub struct GetUserNonceArgs {
267274 address : String ,
268275}
269276
277+ #[ derive( Parser , Debug ) ]
278+ #[ command( version, about, long_about = None ) ]
279+ pub struct GetUserLastMaxFeeArgs {
280+ #[ clap( flatten) ]
281+ network : NetworkArg ,
282+ #[ arg( name = "The user's Ethereum address" , required = true ) ]
283+ address : String ,
284+ }
285+
270286#[ derive( Parser , Debug ) ]
271287#[ command( version, about, long_about = None ) ]
272288pub struct GetUserNonceFromEthereumArgs {
@@ -801,6 +817,22 @@ async fn main() -> Result<(), AlignedError> {
801817 }
802818 }
803819 }
820+ GetUserLastMaxFee ( args) => {
821+ let address = H160 :: from_str ( & args. address ) . unwrap ( ) ;
822+ match get_last_max_fee ( args. network . into ( ) , address) . await {
823+ Ok ( last_max_fee) => {
824+ let last_max_fee_ether = ethers:: utils:: format_ether ( last_max_fee) ;
825+ info ! (
826+ "Last max fee for address {} is {}eth" ,
827+ address, last_max_fee_ether
828+ ) ;
829+ }
830+ Err ( e) => {
831+ error ! ( "Error while getting last max fee: {:?}" , e) ;
832+ return Ok ( ( ) ) ;
833+ }
834+ }
835+ }
804836 GetUserAmountOfQueuedProofs ( args) => {
805837 let address = H160 :: from_str ( & args. address ) . unwrap ( ) ;
806838 let network: Network = args. network . into ( ) ;
0 commit comments