Skip to content

Commit

Permalink
Put AddressInfo into api module
Browse files Browse the repository at this point in the history
  • Loading branch information
raphjaph committed Sep 4, 2024
1 parent 839322b commit e04e484
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,11 @@ pub struct SatInscriptions {
pub more: bool,
pub page: u64,
}

#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct AddressInfo {
pub outputs: Vec<OutPoint>,
pub inscriptions: Vec<InscriptionId>,
pub sat_balance: u64,
pub runes_balances: Vec<(SpacedRune, Decimal, Option<char>)>,
}
9 changes: 1 addition & 8 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,6 @@ pub struct Server {
)]
pub(crate) polling_interval: humantime::Duration,
}
#[derive(Serialize)]
struct AddressResponse {
outputs: Vec<OutPoint>,
inscriptions: Vec<InscriptionId>,
sat_balance: u64,
runes_balances: Vec<(SpacedRune, Decimal, Option<char>)>,
}

impl Server {
pub fn run(self, settings: Settings, index: Arc<Index>, handle: Handle) -> SubcommandResult {
Expand Down Expand Up @@ -842,7 +835,7 @@ impl Server {
let runes_balances = index.get_aggregated_rune_balances_for_outputs(&outputs)?;

Ok(if accept_json {
Json(AddressResponse {
Json(api::AddressInfo {
sat_balance,
outputs,
inscriptions,
Expand Down

0 comments on commit e04e484

Please sign in to comment.