Skip to content

Commit

Permalink
feat(cli): allowed fee-assets query (#1816)
Browse files Browse the repository at this point in the history
## 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
quasystaty1 authored Nov 19, 2024
1 parent 3830a3d commit 471ee91
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/astria-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add `fee-assets` subcommand to `sequencer` CLI [#1816](https://github.com/astriaorg/astria/pull/1816).

### Fixed

- Fixed ICS20 withdrawal source when using channel with more than one
Expand Down
58 changes: 58 additions & 0 deletions crates/astria-cli/src/sequencer/fee_assets.rs
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(())
}
}
4 changes: 4 additions & 0 deletions crates/astria-cli/src/sequencer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod block_height;
mod bridge_account;
mod bridge_lock;
mod bridge_sudo_change;
mod fee_assets;
mod ics20_withdrawal;
mod init_bridge_account;
mod sign;
Expand Down Expand Up @@ -39,6 +40,7 @@ impl Command {
SubCommand::Sign(sign) => sign.run(),
SubCommand::BridgeSudoChange(bridge_sudo_change) => bridge_sudo_change.run().await,
SubCommand::BridgeAccount(bridge_account) => bridge_account.run().await,
SubCommand::FeeAssets(fee_assets) => fee_assets.run().await,
}
}
}
Expand Down Expand Up @@ -80,4 +82,6 @@ enum SubCommand {
BridgeSudoChange(bridge_sudo_change::Command),
/// Commands for interacting with the bridge account
BridgeAccount(bridge_account::Command),
/// Command for interacting with allowed fee assets
FeeAssets(fee_assets::Command),
}

0 comments on commit 471ee91

Please sign in to comment.