1
- import inquirer from 'inquirer'
2
1
import fs from 'fs'
3
2
import PQueue from 'p-queue'
4
3
import yargs , { Argv } from 'yargs'
@@ -10,6 +9,7 @@ import { NonceManager } from '@ethersproject/experimental'
10
9
import { logger } from '../logging'
11
10
import { sendTransaction } from '../network'
12
11
import { loadEnv , CLIArgs , CLIEnvironment } from '../env'
12
+ import { confirm } from '../helpers'
13
13
14
14
const { getAddress } = utils
15
15
@@ -66,20 +66,6 @@ interface AirdropRecipient {
66
66
txHash ?: string
67
67
}
68
68
69
- const sure = async ( message = 'Are you sure?' ) : Promise < boolean > => {
70
- // Warn about changing ownership
71
- const res = await inquirer . prompt ( {
72
- name : 'confirm' ,
73
- type : 'confirm' ,
74
- message,
75
- } )
76
- if ( ! res . confirm ) {
77
- logger . info ( 'Cancelled' )
78
- return false
79
- }
80
- return true
81
- }
82
-
83
69
const getDisperseContract = ( chainID : number , provider ) => {
84
70
return new Contract ( DISPERSE_CONTRACT_ADDRESS [ chainID ] , DISPERSE_CONTRACT_ABI , provider )
85
71
}
@@ -193,10 +179,8 @@ export const airdrop = async (cli: CLIEnvironment, cliArgs: CLIArgs): Promise<vo
193
179
}
194
180
195
181
// Confirmation
196
- logger . info ( 'Are you sure you want to proceed with the distribution?' )
197
- if ( ! ( await sure ( ) ) ) {
198
- process . exit ( 1 )
199
- }
182
+ const sure = await confirm ( 'Are you sure you want to proceed with the distribution?' )
183
+ if ( ! sure ) return
200
184
201
185
// Approve
202
186
logger . info ( '## Token approval' )
0 commit comments