@@ -60,6 +60,14 @@ export class DkgCreateCommand extends IronfishCommand {
60
60
dependsOn : [ 'server' ] ,
61
61
allowNo : true ,
62
62
} ) ,
63
+ minSigners : Flags . integer ( {
64
+ description : 'Minimum signers required to sign a transaction' ,
65
+ exclusive : [ 'sessionId' ] ,
66
+ } ) ,
67
+ totalParticipants : Flags . integer ( {
68
+ description : 'The total number of participants for the multisig account' ,
69
+ exclusive : [ 'sessionId' ] ,
70
+ } ) ,
63
71
}
64
72
65
73
async start ( ) : Promise < void > {
@@ -123,7 +131,12 @@ export class DkgCreateCommand extends IronfishCommand {
123
131
124
132
const { totalParticipants, minSigners } = await ui . retryStep (
125
133
async ( ) => {
126
- return this . getDkgConfig ( multisigClient , ! ! ledger )
134
+ return this . getDkgConfig (
135
+ multisigClient ,
136
+ ! ! ledger ,
137
+ flags . minSigners ,
138
+ flags . totalParticipants ,
139
+ )
127
140
} ,
128
141
this . logger ,
129
142
true ,
@@ -263,6 +276,8 @@ export class DkgCreateCommand extends IronfishCommand {
263
276
async getDkgConfig (
264
277
multisigClient : MultisigClient | null ,
265
278
ledger : boolean ,
279
+ minSigners ?: number ,
280
+ totalParticipants ?: number ,
266
281
) : Promise < { totalParticipants : number ; minSigners : number } > {
267
282
if ( multisigClient ?. sessionId ) {
268
283
let totalParticipants = 0
@@ -285,11 +300,13 @@ export class DkgCreateCommand extends IronfishCommand {
285
300
return { totalParticipants, minSigners }
286
301
}
287
302
288
- const totalParticipants = await ui . inputNumberPrompt (
289
- this . logger ,
290
- 'Enter the total number of participants' ,
291
- { required : true , integer : true } ,
292
- )
303
+ if ( ! totalParticipants ) {
304
+ totalParticipants = await ui . inputNumberPrompt (
305
+ this . logger ,
306
+ 'Enter the total number of participants' ,
307
+ { required : true , integer : true } ,
308
+ )
309
+ }
293
310
294
311
if ( totalParticipants < 2 ) {
295
312
throw new Error ( 'Total number of participants must be at least 2' )
@@ -299,11 +316,13 @@ export class DkgCreateCommand extends IronfishCommand {
299
316
throw new Error ( 'DKG with Ledger supports a maximum of 4 participants' )
300
317
}
301
318
302
- const minSigners = await ui . inputNumberPrompt (
303
- this . logger ,
304
- 'Enter the number of minimum signers' ,
305
- { required : true , integer : true } ,
306
- )
319
+ if ( ! minSigners ) {
320
+ minSigners = await ui . inputNumberPrompt (
321
+ this . logger ,
322
+ 'Enter the number of minimum signers' ,
323
+ { required : true , integer : true } ,
324
+ )
325
+ }
307
326
308
327
if ( minSigners < 2 || minSigners > totalParticipants ) {
309
328
throw new Error (
0 commit comments