File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,10 @@ export type DescriptorPkType = "derivable" | "definite" | "string";
88
99export type ScriptContext = "tap" | "segwitv0" | "legacy" ;
1010
11+ export type SignPsbtInputResult = { Ecdsa : string [ ] } | { Schnorr : string [ ] } ;
12+
1113export type SignPsbtResult = {
12- [ inputIndex : number ] : [ pubkey : string ] [ ] ;
14+ [ inputIndex : number ] : SignPsbtInputResult ;
1315} ;
1416
1517declare module "./wasm/wasm_miniscript" {
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { getKey } from "@bitgo/utxo-lib/dist/src/testutil";
44
55import { DescriptorNode , formatNode } from "../js/ast" ;
66import { mockPsbtDefault } from "./psbtFromDescriptor.util" ;
7- import { Descriptor } from "../js" ;
7+ import { Descriptor , SignPsbtInputResult , SignPsbtResult } from "../js" ;
88import { toWrappedPsbt } from "./psbt.util" ;
99
1010function toKeyWithPath ( k : BIP32Interface , path = "*" ) : string {
@@ -59,12 +59,9 @@ function describeSignDescriptor(
5959 ) ,
6060 } ) ;
6161
62- function getSigResult ( keys : ( BIP32Interface | ECPairInterface ) [ ] ) {
63- return {
64- [ isTaproot ? "Schnorr" : "Ecdsa" ] : keys . map ( ( key ) =>
65- key . publicKey . subarray ( isTaproot ? 1 : 0 ) . toString ( "hex" ) ,
66- ) ,
67- } ;
62+ function getSigResult ( keys : ( BIP32Interface | ECPairInterface ) [ ] ) : SignPsbtInputResult {
63+ const pks = keys . map ( ( key ) => key . publicKey . subarray ( isTaproot ? 1 : 0 ) . toString ( "hex" ) ) ;
64+ return isTaproot ? { Schnorr : pks } : { Ecdsa : pks } ;
6865 }
6966
7067 signBip32 . forEach ( ( signSeq , i ) => {
@@ -100,7 +97,7 @@ function describeSignDescriptor(
10097 assert . deepStrictEqual ( wrappedPsbt . signWithPrv ( key . privateKey ) , {
10198 0 : getSigResult ( [ key ] ) ,
10299 1 : getSigResult ( [ key ] ) ,
103- } ) ;
100+ } satisfies SignPsbtResult ) ;
104101 } ) ;
105102 wrappedPsbt . finalize ( ) ;
106103 } ) ;
You can’t perform that action at this time.
0 commit comments