Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put AddressInfo into api module #3933

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading