-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): allowed fee-assets query (#1816)
## Summary Adds `astria-cli sequencer fee-assets get` query command, getting all allowed fee-assets ## Background The astria CLI should have a query command for all abci query paths, the PR is part of an effort to accomplish this. It also enables more robust smoke-tests. ## Changes - Adds allowed fee assets query subcommand. ## Testing Manually runs the command against local, Dawn and mainnet. ## Changelogs Changelogs updated. ## Related Issues Link any issues that are related, prefer full GitHub links. closes #1815
- Loading branch information
1 parent
3830a3d
commit 471ee91
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
use astria_sequencer_client::{ | ||
HttpClient, | ||
SequencerClientExt as _, | ||
}; | ||
use clap::Subcommand; | ||
use color_eyre::eyre::{ | ||
self, | ||
WrapErr as _, | ||
}; | ||
|
||
#[derive(Debug, clap::Args)] | ||
pub(super) struct Command { | ||
#[command(subcommand)] | ||
command: SubCommand, | ||
} | ||
|
||
impl Command { | ||
pub(super) async fn run(self) -> eyre::Result<()> { | ||
let SubCommand::Get(get) = self.command; | ||
get.run().await | ||
} | ||
} | ||
|
||
#[derive(Debug, Subcommand)] | ||
enum SubCommand { | ||
/// Get the balance of a Sequencer account | ||
Get(Get), | ||
} | ||
|
||
#[derive(clap::Args, Debug)] | ||
struct Get { | ||
/// The url of the Sequencer node | ||
#[arg( | ||
long, | ||
env = "SEQUENCER_URL", | ||
default_value = crate::DEFAULT_SEQUENCER_RPC | ||
)] | ||
sequencer_url: String, | ||
} | ||
|
||
impl Get { | ||
async fn run(self) -> eyre::Result<()> { | ||
let sequencer_client = HttpClient::new(self.sequencer_url.as_str()) | ||
.wrap_err("failed constructing http sequencer client")?; | ||
|
||
let res = sequencer_client | ||
.get_allowed_fee_assets() | ||
.await | ||
.wrap_err("failed to get fee assets")?; | ||
|
||
println!("Allowed fee assets:"); | ||
for asset in res.fee_assets { | ||
println!(" {asset}"); | ||
} | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters