Skip to content

Commit 0924022

Browse files
committed
Merge branch 'fingerprints_methods'
2 parents bb9d2cf + 2fed242 commit 0924022

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

lwk_wasm/src/pset_details.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@ impl PsetDetails {
4747
.collect()
4848
}
4949

50+
#[wasm_bindgen(js_name = fingerprintsMissing)]
51+
pub fn fingerprints_missing(&self) -> Vec<String> {
52+
self.inner
53+
.fingerprints_missing()
54+
.iter()
55+
.map(ToString::to_string)
56+
.collect()
57+
}
58+
59+
#[wasm_bindgen(js_name = fingerprintsHas)]
60+
pub fn fingerprints_has(&self) -> Vec<String> {
61+
self.inner
62+
.fingerprints_has()
63+
.iter()
64+
.map(ToString::to_string)
65+
.collect()
66+
}
67+
5068
/// Return an element for every input that could possibly be a issuance or a reissuance
5169
#[wasm_bindgen(js_name = inputsIssuances)]
5270
pub fn inputs_issuances(&self) -> Vec<Issuance> {
@@ -91,7 +109,7 @@ fn convert(data: &[(elements::bitcoin::PublicKey, KeySource)]) -> JsValue {
91109
serde_wasm_bindgen::to_value(
92110
&data
93111
.iter()
94-
.map(|(a, b)| (a.to_string(), b.0.to_string())) // TODO include derivation path
112+
.map(|(a, b)| (a.to_string(), b.0.to_string(), b.1.to_string())) // TODO include derivation path
95113
.collect::<Vec<_>>(),
96114
)
97115
.expect("should map")
@@ -212,8 +230,8 @@ mod tests {
212230
let signatures = details.signatures();
213231
assert_eq!(signatures.len(), 1);
214232

215-
assert_eq!(format!("{:?}", signatures[0].has_signature()), "JsValue([[\"02ab89406d9cf32ff1819838136eecb65c07add8e8ef1cd2d6c64bab1d85606453\", \"6e055509\"]])");
216-
assert_eq!(format!("{:?}", signatures[0].missing_signature()), "JsValue([[\"03c1d0c7ddab5bd5bffbe0bf04a8a570eeabd9b6356358ecaacc242f658c7d5aad\", \"281e2239\"]])");
233+
assert_eq!(format!("{:?}", signatures[0].has_signature()), "JsValue([[\"02ab89406d9cf32ff1819838136eecb65c07add8e8ef1cd2d6c64bab1d85606453\", \"6e055509\", \"m/87'/1'/0'/0/0\"]])");
234+
assert_eq!(format!("{:?}", signatures[0].missing_signature()), "JsValue([[\"03c1d0c7ddab5bd5bffbe0bf04a8a570eeabd9b6356358ecaacc242f658c7d5aad\", \"281e2239\", \"m/87'/1'/0'/0/0\"]])");
217235

218236
let issuances = details.inputs_issuances();
219237
assert_eq!(issuances.len(), 1);

0 commit comments

Comments
 (0)