howmuch_rs/cli/
mod.rs

1use clap::{Parser, Subcommand};
2
3pub const DEFAULT_SOURCE_NETWORK_GATEWAY_URL: &str = "https://alpha4-2.starknet.io/feeder_gateway";
4pub const DEFAULT_DESTINATION_NETWORK_GATEWAY_URL: &str =
5    "https://alpha-mainnet.starknet.io/feeder_gateway";
6
7/// How much ?
8#[derive(Parser)]
9#[command(author, version, about, long_about = None)]
10pub struct Cli {
11    /// List of supported commands.
12    #[command(subcommand)]
13    pub command: Commands,
14}
15
16/// List of supported commands.
17#[derive(Subcommand)]
18pub enum Commands {
19    /// Ethereum related subcommands
20    #[command(about = "Fees related subcommands")]
21    Fees(FeesCommands),
22}
23
24/// Fees related commands.
25#[derive(Parser, Debug)]
26pub struct FeesCommands {
27    /// Ethereum related subcommands.
28    #[command(subcommand)]
29    pub command: FeesSubCommands,
30}
31
32/// Fees related subcommands.
33#[derive(Subcommand, Debug)]
34pub enum FeesSubCommands {
35    /// Estimate fee from a network to another.
36    EstimateOnNetwork {
37        /// The transaction hash on the source network.
38        #[arg(short, long, value_name = "TX_HASH")]
39        tx_hash: String,
40        /// The source network gateway URL.
41        /// If not provided, the default is goerli 2 testnet.
42        #[arg(long, value_name = "SOURCE_NETWORK_GATEWAY_URL", default_value = DEFAULT_SOURCE_NETWORK_GATEWAY_URL)]
43        source_network_gateway_url: String,
44        /// The destination network gateway URL.
45        /// If not provided, the default is mainnet.
46        /// If the same as the source network, it will be ignored.
47        #[arg(long, value_name = "DESTINATION_NETWORK_GATEWAY_URL", default_value = DEFAULT_DESTINATION_NETWORK_GATEWAY_URL)]
48        destination_network_gateway_url: String,
49        /// The source block number.
50        /// If not provided, the default is the latest block.
51        #[arg(long, value_name = "SOURCE_BLOCK_NUMBER")]
52        source_block_number: Option<u32>,
53        /// The destination block number.
54        /// If not provided, the default is the latest block.
55        #[arg(long, value_name = "DESTINATION_BLOCK_NUMBER")]
56        destination_block_number: Option<u32>,
57    },
58}