Skip to content

Commit

Permalink
Rename ord wallet utxosord wallet outputs (ordinals#1148)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Jan 2, 2023
1 parent cfe6d9a commit 0921f8d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 27 deletions.
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

0 comments on commit 0921f8d

Please sign in to comment.