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

Remove inscriptions subcommand struct #1151

Merged
merged 3 commits into from
Jan 2, 2023
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
4 changes: 2 additions & 2 deletions src/subcommand/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(crate) enum Wallet {
#[clap(about = "Create an inscription")]
Inscribe(inscribe::Inscribe),
#[clap(about = "List wallet inscriptions")]
Inscriptions(inscriptions::Inscriptions),
Inscriptions,
#[clap(about = "Generate a receive address")]
Receive,
#[clap(about = "List wallet satoshis")]
Expand All @@ -39,7 +39,7 @@ impl Wallet {
Self::Balance => balance::run(options),
Self::Create => create::run(options),
Self::Inscribe(inscribe) => inscribe.run(options),
Self::Inscriptions(inscriptions) => inscriptions.run(options),
Self::Inscriptions => inscriptions::run(options),
Self::Receive => receive::run(options),
Self::Sats(sats) => sats.run(options),
Self::Send(send) => send.run(options),
Expand Down
25 changes: 10 additions & 15 deletions src/subcommand/wallet/inscriptions.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
use super::*;

#[derive(Debug, Parser)]
pub(crate) struct Inscriptions {}
pub(crate) fn run(options: Options) -> Result {
let index = Index::open(&options)?;
index.update()?;

impl Inscriptions {
pub(crate) fn run(self, options: Options) -> Result {
let index = Index::open(&options)?;
index.update()?;
let inscriptions = index.get_inscriptions(None)?;
let utxos = list_utxos(&options)?;

let inscriptions = index.get_inscriptions(None)?;
let utxos = list_utxos(&options)?;

for (satpoint, inscription_id) in inscriptions {
if utxos.contains_key(&satpoint.outpoint) {
println!("{}\t{}", inscription_id, satpoint);
}
for (satpoint, inscription_id) in inscriptions {
if utxos.contains_key(&satpoint.outpoint) {
println!("{}\t{}", inscription_id, satpoint);
}

Ok(())
}

Ok(())
}