Simply include the -i / --interactive option to enter interactive mode. For example
$ forge script script/Deploy.s.sol --rpc-url <rpc_url> --broadcast --verify -vvvv --sender <wallet_address> -i 1
While running the script, you will now be prompted with a message similar to this
==========================
Chain 5
Estimated gas price: 3.00000002 gwei
Estimated total gas used for script: 3524127
Estimated amount required: 0.01057238107048254 ETH
==========================
###
Finding wallets for all the necessary addresses...
Enter private key:
As you can see, forge pauses before completing the deployment to ask for your private key. You can now check the estimated amount of ETH required for the transaction.
This is a life saver especially when deploying large contracts during periods of high on-chain activity where you may want to avoid accidentally spending a lot of money on transaction fees before you have a chance to agree to the estimate.
If you found this helpful, support my work by collecting an NFT of this piece!
