|
1 | | -#![cfg(all(test, feature = "integration"))] |
2 | 1 |
|
3 | 2 | extern crate elements; |
4 | 3 |
|
5 | | -extern crate bitcoin; |
6 | 4 | extern crate elementsd; |
7 | 5 | extern crate rand; |
8 | 6 |
|
9 | | -use crate::setup; |
| 7 | +use crate::{setup, Call}; |
10 | 8 |
|
11 | | -use bitcoin::hashes::hex::ToHex; |
12 | | -use bitcoin::{Address, Amount}; |
13 | | -use elements::bitcoin::hashes::hex::FromHex; |
| 9 | +use elements::bitcoin::{self, Address, Amount}; |
| 10 | +use elements::bitcoin::hashes::hex::{FromHex, ToHex}; |
14 | 11 | use elements::bitcoin::hashes::Hash; |
15 | 12 | use elements::encode::{deserialize, serialize}; |
16 | 13 | use elements::pset::PartiallySignedTransaction; |
@@ -162,56 +159,6 @@ fn psbt_rtt(elementsd: &ElementsD, base64: &str) { |
162 | 159 | } |
163 | 160 | } |
164 | 161 |
|
165 | | -impl Call for ElementsD { |
166 | | - fn call(&self, cmd: &str, args: &[Value]) -> Value { |
167 | | - self.client().call::<Value>(cmd, args).unwrap() |
168 | | - } |
169 | | - |
170 | | - fn decode_psbt(&self, psbt: &str) -> Option<Value> { |
171 | | - self.client() |
172 | | - .call::<Value>("decodepsbt", &[psbt.into()]) |
173 | | - .ok() |
174 | | - } |
175 | | - |
176 | | - fn get_new_address(&self) -> String { |
177 | | - self.call("getnewaddress", &[]) |
178 | | - .as_str() |
179 | | - .unwrap() |
180 | | - .to_string() |
181 | | - } |
182 | | - |
183 | | - fn generate(&self, blocks: u32) { |
184 | | - let address = self.get_new_address(); |
185 | | - let _value = self.call("generatetoaddress", &[blocks.into(), address.into()]); |
186 | | - } |
187 | | - |
188 | | - |
189 | | - fn expected_next(&self, base64: &str) -> String { |
190 | | - let value = self.call("analyzepsbt", &[base64.into()]); |
191 | | - value.get("next").unwrap().as_str().unwrap().to_string() |
192 | | - } |
193 | | - |
194 | | - fn wallet_process_psbt(&self, base64: &str) -> String { |
195 | | - let value = self.call("walletprocesspsbt", &[base64.into()]); |
196 | | - value.get("psbt").unwrap().as_str().unwrap().to_string() |
197 | | - } |
198 | | - |
199 | | - fn finalize_psbt(&self, base64: &str) -> String { |
200 | | - let value = self.call("finalizepsbt", &[base64.into()]); |
201 | | - value.get("hex").unwrap().as_str().unwrap().to_string() |
202 | | - } |
203 | | - |
204 | | - fn get_balances(&self) -> Value { |
205 | | - self.call("getbalances", &[]) |
206 | | - } |
207 | | - |
208 | | - fn test_mempool_accept(&self, hex: &str) -> bool { |
209 | | - let result = self.call("testmempoolaccept", &[json!([hex])]); |
210 | | - let allowed = result.get(0).unwrap().get("allowed"); |
211 | | - allowed.unwrap().as_bool().unwrap() |
212 | | - } |
213 | | -} |
214 | | - |
215 | 162 | fn psbt_from_base64(base64: &str) -> PartiallySignedTransaction { |
216 | 163 | let bytes = base64::decode(&base64).unwrap(); |
217 | 164 | deserialize(&bytes).unwrap() |
|
0 commit comments