File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
modules/utxo-staking/src/coreDao Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 1- import { createCoreDaoOpReturnOutputScript , OpReturnParams } from './opReturn' ;
21import { Descriptor } from '@bitgo/wasm-miniscript' ;
32
3+ import { createCoreDaoOpReturnOutputScript , OpReturnParams } from './opReturn' ;
4+
45/**
56 * Create the staking outputs for a CoreDAO staking transaction. This is the ordering
67 * in which to add into the transaction.
@@ -12,20 +13,19 @@ import { Descriptor } from '@bitgo/wasm-miniscript';
1213export function createStakingOutputs (
1314 stakingParams : {
1415 amount : bigint ;
15- descriptor : string ;
16+ descriptor : Descriptor ;
1617 index ?: number ;
1718 } ,
1819 opReturnParams : OpReturnParams
1920) : { script : Buffer ; amount : bigint } [ ] {
20- const descriptor = Descriptor . fromString (
21- stakingParams . descriptor ,
22- stakingParams . index === undefined ? 'definite' : 'derivable'
23- ) ;
21+ if ( stakingParams . descriptor . hasWildcard ( ) && stakingParams . index === undefined ) {
22+ throw new Error ( 'Cannot create staking outputs with a wildcard descriptor and no derivation index' ) ;
23+ }
2424
2525 const outputScript = Buffer . from (
2626 stakingParams . index === undefined
27- ? descriptor . scriptPubkey ( )
28- : descriptor . atDerivationIndex ( stakingParams . index ) . scriptPubkey ( )
27+ ? stakingParams . descriptor . scriptPubkey ( )
28+ : stakingParams . descriptor . atDerivationIndex ( stakingParams . index ) . scriptPubkey ( )
2929 ) ;
3030 const opReturnScript = createCoreDaoOpReturnOutputScript ( opReturnParams ) ;
3131
You can’t perform that action at this time.
0 commit comments