tensor_eigen/args/
mod.rs

1use std::path::PathBuf;
2
3mod derive;
4mod eigen;
5mod fees;
6mod pool;
7mod whitelist;
8
9pub use derive::*;
10pub use eigen::*;
11pub use fees::*;
12pub use pool::*;
13pub use whitelist::*;
14
15use clap::{Args as ClapArgs, Parser, Subcommand};
16use solana_sdk::pubkey::Pubkey;
17
18use crate::commands::Id;
19
20#[derive(Parser)]
21#[clap(author, version, about)]
22pub struct Args {
23    #[clap(subcommand)]
24    pub command: Commands,
25}
26
27#[derive(Subcommand)]
28pub enum Commands {
29    Decode(DecodeArgs),
30
31    #[clap(subcommand)]
32    Derive(DeriveSubcommands),
33
34    Download(DownloadArgs),
35
36    Error(ErrorArgs),
37
38    #[clap(subcommand)]
39    Fees(FeesSubcommands),
40
41    Ids(IdArgs),
42
43    #[clap(subcommand)]
44    Pool(PoolSubcommands),
45
46    #[clap(subcommand, name = "self")]
47    Eigen(EigenSubcommands),
48
49    #[clap(subcommand)]
50    Whitelist(WhitelistSubcommands),
51}
52
53// Global options for read commands
54#[derive(ClapArgs)]
55pub struct ReadOptions {
56    /// RPC URL for the Solana cluster.
57    #[arg(short, long)]
58    pub rpc_url: Option<String>,
59}
60
61// Global options for write commands
62#[derive(ClapArgs)]
63pub struct WriteOptions {
64    /// Path to the keypair file.
65    #[arg(short, long)]
66    pub keypair_path: Option<PathBuf>,
67
68    /// RPC URL for the Solana cluster.
69    #[arg(short, long)]
70    pub rpc_url: Option<String>,
71}
72
73#[derive(ClapArgs)]
74pub struct DecodeArgs {
75    #[command(flatten)]
76    pub read_options: ReadOptions,
77
78    /// Address to decode.
79    pub address: Pubkey,
80
81    /// Print raw bytes.
82    #[arg(long)]
83    pub raw: bool,
84}
85
86#[derive(ClapArgs)]
87pub struct DownloadArgs {
88    #[clap(flatten)]
89    pub read_options: ReadOptions,
90
91    /// Address to download.
92    pub address: Pubkey,
93
94    /// Output directory.
95    pub output_dir: Option<PathBuf>,
96}
97
98#[derive(ClapArgs)]
99pub struct ErrorArgs {
100    /// Error code.
101    pub error_code: String,
102}
103
104#[derive(ClapArgs)]
105pub struct IdArgs {
106    /// ID name.
107    pub id: Option<Id>,
108
109    /// List all available IDs.
110    #[arg(long)]
111    pub list: bool,
112}