-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
add balance command #1047
add balance command #1047
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use super::*; | ||
|
||
pub(crate) fn run(options: Options) -> Result { | ||
println!( | ||
"{}", | ||
options | ||
.bitcoin_rpc_client()? | ||
.get_balances()? | ||
.mine | ||
.trusted | ||
.to_sat() | ||
); | ||
|
||
Ok(()) | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -688,3 +688,20 @@ fn inscribe_gif() { | |||||
), | ||||||
) | ||||||
} | ||||||
|
||||||
#[test] | ||||||
fn wallet_balance() { | ||||||
let rpc_server = test_bitcoincore_rpc::spawn_with(Network::Regtest, "ord"); | ||||||
|
||||||
CommandBuilder::new("--regtest wallet balance") | ||||||
.rpc_server(&rpc_server) | ||||||
.expected_stdout("0\n") | ||||||
.run(); | ||||||
|
||||||
let _ = &rpc_server.mine_blocks(1); | ||||||
|
||||||
CommandBuilder::new("--regtest wallet balance") | ||||||
.rpc_server(&rpc_server) | ||||||
.expected_stdout(format!("5000000000\n")) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this doesn't have any interpolations, format is unnecessary:
Suggested change
There's a just recipe for running some of the checks that run on ci, try bin/forbid is actually quite useful. It forbids the string There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah! I haven't used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No worries! just is kind of like make, but only for saving and running commands, and less weird. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, this is great. should be a lot easier to make sure im conforming to style, etc. for future PRs :) |
||||||
.run(); | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just do:
let _ =
is only needed when ignoring a type that has#[must_use]
on it, likeResult
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right you are