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

Rename ord wallet utxosord wallet outputs #1148

Merged
merged 5 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
8 changes: 4 additions & 4 deletions src/subcommand/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ mod balance;
pub(crate) mod create;
pub(crate) mod inscribe;
mod inscriptions;
mod outputs;
mod receive;
mod sats;
mod send;
mod transaction_builder;
mod transactions;
mod utxos;

#[derive(Debug, Parser)]
pub(crate) enum Wallet {
Expand All @@ -29,8 +29,8 @@ pub(crate) enum Wallet {
Send(send::Send),
#[clap(about = "See wallet transactions")]
Transactions(transactions::Transactions),
#[clap(about = "List wallet UTXOs")]
Utxos(utxos::Utxos),
#[clap(about = "List wallet outputs")]
Outputs,
}

impl Wallet {
Expand All @@ -44,7 +44,7 @@ impl Wallet {
Self::Sats(sats) => sats.run(options),
Self::Send(send) => send.run(options),
Self::Transactions(transactions) => transactions.run(options),
Self::Utxos(utxos) => utxos.run(options),
Self::Outputs => outputs::run(options),
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions src/subcommand/wallet/outputs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use super::*;

pub(crate) fn run(options: Options) -> Result {
let outputs = options
.bitcoin_rpc_client_for_wallet_command("ord wallet outputs")?
.list_unspent(None, None, None, None, None)?
.iter()
.map(|output| (OutPoint::new(output.txid, output.vout), output.amount))
.collect::<Vec<(OutPoint, Amount)>>();

for (outpoint, amount) in outputs {
println!("{outpoint}\t{}", amount.to_sat());
}

Ok(())
}
21 changes: 0 additions & 21 deletions src/subcommand/wallet/utxos.rs

This file was deleted.

4 changes: 2 additions & 2 deletions tests/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,14 +631,14 @@ fn receive() {
}

#[test]
fn utxos() {
fn outputs() {
let rpc_server = test_bitcoincore_rpc::spawn();

let coinbase_tx = &rpc_server.mine_blocks_with_subsidy(1, 1_000_000)[0].txdata[0];
let outpoint = OutPoint::new(coinbase_tx.txid(), 0);
let amount = coinbase_tx.output[0].value;

CommandBuilder::new("wallet utxos")
CommandBuilder::new("wallet outputs")
.rpc_server(&rpc_server)
.expected_stdout(format!("{outpoint}\t{amount}\n"))
.run();
Expand Down