Skip to content

Commit ca1c430

Browse files
fix: change taproot descriptor output format to array
Change Tr descriptor output from object to array format to match test fixtures. Internal key and tap tree are now returned as array elements. Issue: BTC-1829
1 parent 6cf9ffb commit ca1c430

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

packages/wasm-miniscript/src/try_into_js_value.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,7 @@ impl<Pk: MiniscriptKey + TryIntoJsValue> TryIntoJsValue for WshInner<Pk> {
208208

209209
impl<Pk: MiniscriptKey + TryIntoJsValue> TryIntoJsValue for Tr<Pk> {
210210
fn try_to_js_value(&self) -> Result<JsValue, JsError> {
211-
js_obj!(
212-
"internalKey" => self.internal_key(),
213-
"tree" => self.tap_tree()
214-
)
211+
Ok(js_arr!(self.internal_key(), self.tap_tree()))
215212
}
216213
}
217214

packages/wasm-miniscript/test/fixtures/58.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"descriptor": "tr(50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0,multi_a(2,xpub661MyMwAqRbcFXS2qwsTkaFc7PEpwDXWgY1Hx2MS7XywhW24sTjQzxiUgnGNW5v6DsW9Z8JcAqf8a22v21jDSA3DwLbbpt2ra3WbP83QNvP/0/0,xpub661MyMwAqRbcGfiaWcoeKLerFu3qRfy6zSYAwnmxSKW8JSauRajFsAsRHs2pV4q5rxkb4ynx4Bm8t54McTCp8V27s7XsdpD8T4s56etpjro/0/0,xpub661MyMwAqRbcH4HzWiCwmYajy1SXZngxHvpYDNEX4xjrDAneAm6rnpPuPPXcBRsSgxupDBmH2tzPHkikNrnLbsvTHemPFHSFbZxonZcCwFi/0/0))#82q34xv2",
33
"ast": {
4-
"Tr": {
5-
"internalKey": {
4+
"Tr": [
5+
{
66
"Single": "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0"
77
},
8-
"tree": {
8+
{
99
"MultiA": [
1010
2,
1111
{
@@ -19,6 +19,6 @@
1919
}
2020
]
2121
}
22-
}
22+
]
2323
}
2424
}

0 commit comments

Comments
 (0)