cli_parser.rs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. use clap::{AppSettings, Parser, Subcommand};
  2. #[derive(Subcommand)]
  3. pub enum CliDrkSubCommands {
  4. /// Say hello to the RPC
  5. Hello {},
  6. /// Show what features the cashier supports
  7. Features {},
  8. /// Wallet operations
  9. Wallet {
  10. /// Initialize a new wallet
  11. #[clap(long)]
  12. create: bool,
  13. /// Generate wallet keypair
  14. #[clap(long)]
  15. keygen: bool,
  16. /// Get wallet address
  17. #[clap(long)]
  18. address: bool,
  19. /// Get wallet balances
  20. #[clap(long)]
  21. balances: bool,
  22. },
  23. /// Get hexidecimal ID for token symbol
  24. Id {
  25. /// Which network to use (bitcoin/solana/...)
  26. #[clap(long)]
  27. network: String,
  28. /// Which token to query (btc/sol/usdc/...)
  29. #[clap(parse(try_from_str))]
  30. token: String,
  31. },
  32. /// Withdraw Dark tokens for clear tokens
  33. Withdraw {
  34. /// Which network to use (bitcoin/solana/...)
  35. #[clap(long)]
  36. network: String,
  37. /// Which token to receive (btc/sol/usdc/...)
  38. #[clap(parse(try_from_str))]
  39. token_sym: String,
  40. /// Recipient address
  41. #[clap(parse(try_from_str))]
  42. address: String,
  43. /// Amount to withdraw
  44. #[clap(parse(try_from_str))]
  45. amount: u64,
  46. },
  47. /// Transfer Dark tokens to address
  48. Transfer {
  49. /// Which network to use (bitcoin/solana/...)
  50. #[clap(long)]
  51. network: String,
  52. /// Which token to transfer (btc/sol/usdc/...)
  53. #[clap(parse(try_from_str))]
  54. token_sym: String,
  55. /// Recipient address
  56. #[clap(parse(try_from_str))]
  57. address: String,
  58. /// Amount to transfer
  59. #[clap(parse(try_from_str))]
  60. amount: u64,
  61. },
  62. /// Deposit clear tokens for Dark tokens
  63. Deposit {
  64. /// Which network to use (bitcoin/solana/...)
  65. #[clap(long)]
  66. network: String,
  67. /// Which token to deposit (btc/sol/usdc/...)
  68. #[clap(parse(try_from_str))]
  69. token_sym: String,
  70. },
  71. }
  72. /// Drk cli
  73. #[derive(Parser)]
  74. #[clap(name = "drk")]
  75. #[clap(author, version, about)]
  76. #[clap(global_setting(AppSettings::PropagateVersion))]
  77. #[clap(global_setting(AppSettings::UseLongFormatForHelpSubcommand))]
  78. #[clap(setting(AppSettings::SubcommandRequiredElseHelp))]
  79. pub struct CliDrk {
  80. /// Sets a custom config file
  81. #[clap(short, long)]
  82. pub config: Option<String>,
  83. /// Increase verbosity
  84. #[clap(short, long)]
  85. pub verbose: bool,
  86. /// Show event trace
  87. #[clap(short, long)]
  88. pub trace: bool,
  89. #[clap(subcommand)]
  90. pub command: Option<CliDrkSubCommands>,
  91. }
  92. /// Gatewayd cli
  93. #[derive(Parser)]
  94. #[clap(name = "gatewayd")]
  95. pub struct CliGatewayd {
  96. /// Sets a custom config file
  97. #[clap(short, long)]
  98. pub config: Option<String>,
  99. /// Increase verbosity
  100. #[clap(short, long)]
  101. pub verbose: bool,
  102. /// Show event trace
  103. #[clap(short, long)]
  104. pub trace: bool,
  105. }
  106. /// Darkfid cli
  107. #[derive(Parser)]
  108. #[clap(name = "darkfid")]
  109. pub struct CliDarkfid {
  110. /// Sets a custom config file
  111. #[clap(short, long)]
  112. pub config: Option<String>,
  113. /// Local cashier public key
  114. #[clap(long)]
  115. pub cashier: Option<String>,
  116. /// Increase verbosity
  117. #[clap(short, long)]
  118. pub verbose: bool,
  119. /// Show event trace
  120. #[clap(short, long)]
  121. pub trace: bool,
  122. /// Refresh the wallet and slabstore
  123. #[clap(short, long)]
  124. pub refresh: bool,
  125. }
  126. /// Cashierd cli
  127. #[derive(Parser)]
  128. #[clap(name = "cashierd")]
  129. pub struct CliCashierd {
  130. /// Sets a custom config file
  131. #[clap(short, long)]
  132. pub config: Option<String>,
  133. /// Get Cashier Public key
  134. #[clap(short, long)]
  135. pub address: bool,
  136. /// Increase verbosity
  137. #[clap(short, long)]
  138. pub verbose: bool,
  139. /// Show event trace
  140. #[clap(short, long)]
  141. pub trace: bool,
  142. /// Refresh the wallet and slabstore
  143. #[clap(short, long)]
  144. pub refresh: bool,
  145. }