Skip to content

Commit 859ec74

Browse files
committed
Implement importaddress method and test
1 parent b1f1461 commit 859ec74

File tree

15 files changed

+53
-0
lines changed

15 files changed

+53
-0
lines changed

client/src/client_sync/v17/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ crate::impl_client_v17__get_received_by_address!();
126126
crate::impl_client_v17__get_transaction!();
127127
crate::impl_client_v17__get_unconfirmed_balance!();
128128
crate::impl_client_v17__get_wallet_info!();
129+
crate::impl_client_v17__import_address!();
129130
crate::impl_client_v17__import_privkey!();
130131
crate::impl_client_v17__list_address_groupings!();
131132
crate::impl_client_v17__list_labels!();

client/src/client_sync/v17/wallet.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,22 @@ macro_rules! impl_client_v17__get_wallet_info {
269269
};
270270
}
271271

272+
/// Implements Bitcoin Core JSON-RPC API method `importaddress`.
273+
#[macro_export]
274+
macro_rules! impl_client_v17__import_address {
275+
() => {
276+
impl Client {
277+
pub fn import_address(&self, address: &Address) -> Result<()> {
278+
match self.call("importaddress", &[into_json(address)?]) {
279+
Ok(serde_json::Value::Null) => Ok(()),
280+
Ok(res) => Err(Error::Returned(res.to_string())),
281+
Err(err) => Err(err.into()),
282+
}
283+
}
284+
}
285+
};
286+
}
287+
272288
/// Implements Bitcoin Core JSON-RPC API method `importprivkey`.
273289
#[macro_export]
274290
macro_rules! impl_client_v17__import_privkey {

client/src/client_sync/v18/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ crate::impl_client_v18__get_received_by_label!();
141141
crate::impl_client_v17__get_transaction!();
142142
crate::impl_client_v17__get_unconfirmed_balance!();
143143
crate::impl_client_v17__get_wallet_info!();
144+
crate::impl_client_v17__import_address!();
144145
crate::impl_client_v17__import_privkey!();
145146
crate::impl_client_v17__list_address_groupings!();
146147
crate::impl_client_v17__list_labels!();

client/src/client_sync/v19/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ crate::impl_client_v17__get_received_by_address!();
137137
crate::impl_client_v17__get_transaction!();
138138
crate::impl_client_v17__get_unconfirmed_balance!();
139139
crate::impl_client_v17__get_wallet_info!();
140+
crate::impl_client_v17__import_address!();
140141
crate::impl_client_v17__import_privkey!();
141142
crate::impl_client_v17__list_address_groupings!();
142143
crate::impl_client_v18__list_received_by_label!();

client/src/client_sync/v20/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ crate::impl_client_v17__get_received_by_address!();
134134
crate::impl_client_v17__get_transaction!();
135135
crate::impl_client_v17__get_unconfirmed_balance!();
136136
crate::impl_client_v17__get_wallet_info!();
137+
crate::impl_client_v17__import_address!();
137138
crate::impl_client_v17__import_privkey!();
138139
crate::impl_client_v17__list_address_groupings!();
139140
crate::impl_client_v17__list_labels!();

client/src/client_sync/v21/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ crate::impl_client_v17__get_received_by_address!();
136136
crate::impl_client_v17__get_transaction!();
137137
crate::impl_client_v17__get_unconfirmed_balance!();
138138
crate::impl_client_v17__get_wallet_info!();
139+
crate::impl_client_v17__import_address!();
139140
crate::impl_client_v17__import_privkey!();
140141
crate::impl_client_v17__list_address_groupings!();
141142
crate::impl_client_v17__list_labels!();

client/src/client_sync/v22/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ crate::impl_client_v17__get_received_by_address!();
136136
crate::impl_client_v17__get_transaction!();
137137
crate::impl_client_v17__get_unconfirmed_balance!();
138138
crate::impl_client_v17__get_wallet_info!();
139+
crate::impl_client_v17__import_address!();
139140
crate::impl_client_v17__import_privkey!();
140141
crate::impl_client_v17__list_address_groupings!();
141142
crate::impl_client_v18__list_received_by_label!();

client/src/client_sync/v23/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ crate::impl_client_v17__get_received_by_address!();
138138
crate::impl_client_v17__get_transaction!();
139139
crate::impl_client_v17__get_unconfirmed_balance!();
140140
crate::impl_client_v17__get_wallet_info!();
141+
crate::impl_client_v17__import_address!();
141142
crate::impl_client_v17__import_privkey!();
142143
crate::impl_client_v17__list_address_groupings!();
143144
crate::impl_client_v18__list_received_by_label!();

client/src/client_sync/v24/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ crate::impl_client_v17__get_received_by_address!();
135135
crate::impl_client_v17__get_transaction!();
136136
crate::impl_client_v17__get_unconfirmed_balance!();
137137
crate::impl_client_v17__get_wallet_info!();
138+
crate::impl_client_v17__import_address!();
138139
crate::impl_client_v17__import_privkey!();
139140
crate::impl_client_v17__list_address_groupings!();
140141
crate::impl_client_v18__list_received_by_label!();

client/src/client_sync/v25/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ crate::impl_client_v17__get_received_by_address!();
135135
crate::impl_client_v17__get_transaction!();
136136
crate::impl_client_v17__get_unconfirmed_balance!();
137137
crate::impl_client_v17__get_wallet_info!();
138+
crate::impl_client_v17__import_address!();
138139
crate::impl_client_v17__import_privkey!();
139140
crate::impl_client_v17__list_address_groupings!();
140141
crate::impl_client_v18__list_received_by_label!();

0 commit comments

Comments
 (0)