@@ -3,13 +3,15 @@ import * as fs from 'fs/promises';
3
3
4
4
import yargs from 'yargs' ;
5
5
import * as utxolib from '@bitgo/utxo-lib' ;
6
- import { Descriptor } from '@bitgo/wasm-miniscript' ;
6
+ import * as WasmMiniscript from '@bitgo/wasm-miniscript' ;
7
7
8
8
import { cmdPsbt } from '../src/commands' ;
9
9
import { formatTreeNoColor , getFixtureString } from './fixtures' ;
10
10
import { getKeyTriple } from './bip32.util' ;
11
11
import { TxParser } from '../src/TxParser' ;
12
12
13
+ utxolib . initializeMiniscript ( WasmMiniscript ) ;
14
+
13
15
async function runPsbtCommand ( args : string [ ] ) {
14
16
return cmdPsbt . builder ( yargs ( [ ] ) ) . strict ( ) . exitProcess ( false ) . parse ( args ) ;
15
17
}
@@ -30,15 +32,15 @@ function multi(n: number, xpubs: string[], path: string) {
30
32
return 'multi(' + n + ',' + xpubs . map ( ( xpub ) => xpub + path ) . join ( ',' ) + ')' ;
31
33
}
32
34
33
- function getAddressFromDescriptor ( descriptor : Descriptor , network : utxolib . Network ) {
35
+ function getAddressFromDescriptor ( descriptor : WasmMiniscript . Descriptor , network : utxolib . Network ) {
34
36
return utxolib . address . fromOutputScript ( Buffer . from ( descriptor . scriptPubkey ( ) ) , network ) ;
35
37
}
36
38
37
39
describe ( 'cmdPsbt commands' , function ( ) {
38
40
const keys = getKeyTriple ( 'cmdPsbt' ) ;
39
41
const xpubs = keys . map ( ( k ) => k . neutered ( ) . toBase58 ( ) ) ;
40
42
const descriptorString = `wsh(${ multi ( 2 , xpubs , '/*' ) } )` ;
41
- const descriptor = Descriptor . fromString ( descriptorString , 'derivable' ) ;
43
+ const descriptor = WasmMiniscript . Descriptor . fromString ( descriptorString , 'derivable' ) ;
42
44
43
45
it ( 'creates empty psbt' , async function ( ) {
44
46
await fs . rm ( '/tmp/test.psbt' , { force : true } ) ;
0 commit comments