hardhat/builtin-tasks/task-names#TASK_NODE_GET_PROVIDER TypeScript Examples
The following examples show how to use
hardhat/builtin-tasks/task-names#TASK_NODE_GET_PROVIDER.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.ts From hardhat-deploy with MIT License | 6 votes |
subtask(TASK_NODE_GET_PROVIDER).setAction(
async (args, hre, runSuper): Promise<EthereumProvider> => {
const provider = await runSuper(args);
if (!nodeTaskArgs.noReset) {
await deploymentsManager.deletePreviousDeployments('localhost');
}
if (nodeTaskArgs.noDeploy) {
// console.log('skip');
return provider;
}
// console.log('enabling logging');
await enableProviderLogging(provider, false);
const networkName = getNetworkName(hre.network);
if (networkName !== hre.network.name) {
console.log(`copying ${networkName}'s deployment to localhost...`);
// copy existing deployment from specified netwotk into localhost deployment folder
fs.copy(
path.join(hre.config.paths.deployments, networkName),
path.join(hre.config.paths.deployments, 'localhost')
);
}
nodeTaskArgs.log = !nodeTaskArgs.silent;
delete nodeTaskArgs.silent;
nodeTaskArgs.pendingtx = false;
await hre.run(TASK_DEPLOY_MAIN, {
...nodeTaskArgs,
watch: false,
reset: false,
});
await enableProviderLogging(provider, true);
return provider;
}
);