diff --git a/client/src/client_sync/v17/wallet.rs b/client/src/client_sync/v17/wallet.rs index 7b12e08..bfcba55 100644 --- a/client/src/client_sync/v17/wallet.rs +++ b/client/src/client_sync/v17/wallet.rs @@ -191,8 +191,11 @@ macro_rules! impl_client_v17__getrawchangeaddress { macro_rules! impl_client_v17__getreceivedbyaddress { () => { impl Client { - pub fn get_received_by_address(&self) -> Result { - self.call("getreceivedbyaddress", &[]) + pub fn get_received_by_address( + &self, + address: &Address, + ) -> Result { + self.call("getreceivedbyaddress", &[address.to_string().into()]) } } }; @@ -406,7 +409,7 @@ macro_rules! impl_client_v17__sendtoaddress { macro_rules! impl_client_v17__signmessage { () => { impl Client { - pub fn sign_message(&self, address: Address, message: &str) -> Result { + pub fn sign_message(&self, address: &Address, message: &str) -> Result { self.call("signmessage", &[into_json(address)?, into_json(message)?]) } } diff --git a/integration_test/tests/wallet.rs b/integration_test/tests/wallet.rs index 1315320..d35298f 100644 --- a/integration_test/tests/wallet.rs +++ b/integration_test/tests/wallet.rs @@ -136,11 +136,24 @@ fn get_raw_change_address() { } #[test] -#[cfg(feature = "TODO")] fn get_received_by_address() { + let amount = Amount::from_sat(10_000); + let node = Node::new_with_default_wallet(); - let json = node.client.get_received_by_address().expect("getreceivedbyaddress"); - assert!(json.into_model().is_ok()); + node.fund_wallet(); + let address = node.client.new_address().expect("failed to create new address"); + + let _txid = node + .client + .send_to_address(&address, amount) + .expect("sendtoaddress") + .txid() + .unwrap(); + node.mine_a_block(); + + let json = node.client.get_received_by_address(&address).expect("getreceivedbyaddress"); + let model = json.into_model().expect("into_model failed"); + assert_eq!(model.0, amount); } #[test] diff --git a/types/src/v17/mod.rs b/types/src/v17/mod.rs index 76281a0..c9c9b1a 100644 --- a/types/src/v17/mod.rs +++ b/types/src/v17/mod.rs @@ -159,7 +159,7 @@ //! | getnewaddress | done | //! | getrawchangeaddress | done | //! | getreceivedbyaccount | omitted | -//! | getreceivedbyaddress | done (untested) | +//! | getreceivedbyaddress | done | //! | gettransaction | done | //! | getunconfirmedbalance | done (untested) | //! | getwalletinfo | done (untested) |