@kontor/kontor-sdk 1.0.0-alpha.7 → 1.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -55,28 +55,25 @@ export async function signReveal<
|
|
|
55
55
|
for (let i = 0; i < params.parcipantScripts.length; i++) {
|
|
56
56
|
const { commit_tap_leaf_script } = params.parcipantScripts[i]!;
|
|
57
57
|
|
|
58
|
-
// 1. Raw tapscript from compose (no version byte)
|
|
59
58
|
const scriptBytes = hex.decode(commit_tap_leaf_script.script);
|
|
60
|
-
|
|
61
|
-
// 2. Control block from compose (contains version + internal key + path)
|
|
62
59
|
const controlBlockBytes = hex.decode(commit_tap_leaf_script.controlBlock);
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
60
|
+
const leafVersion = commit_tap_leaf_script.leafVersion;
|
|
61
|
+
|
|
62
|
+
// scure expects script || leafVersion as one buffer
|
|
63
|
+
const scriptWithVersion = u.concatBytes(
|
|
64
|
+
scriptBytes,
|
|
65
|
+
new Uint8Array([leafVersion ?? 0xc0]), // default 0xc0 if needed
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const controlBlockStruct = TaprootControlBlock.decode(controlBlockBytes);
|
|
69
|
+
|
|
70
|
+
tx.updateInput(
|
|
71
|
+
i,
|
|
72
|
+
{
|
|
73
|
+
tapLeafScript: [[controlBlockStruct, scriptWithVersion]],
|
|
74
|
+
},
|
|
75
|
+
true,
|
|
76
|
+
);
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
const signInputs = Array.from(
|
|
@@ -112,18 +109,23 @@ export async function signReveal<
|
|
|
112
109
|
|
|
113
110
|
// this is technically unnecessary as scure/btc-signer
|
|
114
111
|
// will product this witness by default
|
|
115
|
-
for (let i = 0; i < params.parcipantScripts.length; i++) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
112
|
+
// for (let i = 0; i < params.parcipantScripts.length; i++) {
|
|
113
|
+
// const input = signedTx.getInput(i);
|
|
114
|
+
// const p = params.parcipantScripts[i]!;
|
|
115
|
+
// console.log({ input, tapscriptsig: input.tapScriptSig });
|
|
116
|
+
//
|
|
117
|
+
// signedTx.updateInput(i, {
|
|
118
|
+
// finalScriptWitness: [
|
|
119
|
+
// input.tapScriptSig![0]![1],
|
|
120
|
+
// hex.decode(p.commit_tap_leaf_script.script),
|
|
121
|
+
// hex.decode(p.commit_tap_leaf_script.controlBlock),
|
|
122
|
+
// ],
|
|
123
|
+
// });
|
|
124
|
+
//
|
|
125
|
+
// delete input.tapScriptSig;
|
|
126
|
+
// delete input.tapKeySig;
|
|
127
|
+
// delete input.tapLeafScript;
|
|
128
|
+
// }
|
|
127
129
|
|
|
128
130
|
return signedTx;
|
|
129
131
|
}
|