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

Use Address and Amount types #46

Merged
merged 2 commits into from May 8, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions client/src/client.rs
Expand Up @@ -543,15 +543,15 @@ pub trait RpcApi: Sized {
&self,
label: Option<&str>,
address_type: Option<json::AddressType>,
) -> Result<String> {
) -> Result<Address> {
self.call("getnewaddress", &[opt_into_json(label)?, opt_into_json(address_type)?])
}

/// Mine `block_num` blocks and pay coinbase to `address`
///
/// Returns hashes of the generated blocks
fn generate_to_address(&self, block_num: u64, address: &str) -> Result<Vec<sha256d::Hash>> {
self.call("generatetoaddress", &[block_num.into(), address.into()])
fn generate_to_address(&self, block_num: u64, address: &Address) -> Result<Vec<sha256d::Hash>> {
self.call("generatetoaddress", &[block_num.into(), address.to_string().into()])
}

/// Mine up to block_num blocks immediately (before the RPC call returns)
Expand Down
3 changes: 2 additions & 1 deletion json/src/lib.rs
Expand Up @@ -352,7 +352,8 @@ pub struct ListReceivedByAddressResult {
#[serde(rename = "involvesWatchonly")]
pub involved_watch_only: bool,
pub address: Address,
pub amount: u64,
#[serde(deserialize_with = "deserialize_amount")]
pub amount: Amount,
pub confirmations: u32,
pub label: String,
pub txids: Vec<sha256d::Hash>,
Expand Down