From dc2e8bf3f30e35e82bdde190f3f56ad3a8f09cd4 Mon Sep 17 00:00:00 2001 From: zoeyTM Date: Wed, 27 Nov 2024 03:03:54 -0500 Subject: [PATCH 1/2] enable ignition UI for deployments via hardhat scripts --- packages/hardhat-plugin-ethers/src/ethers-ignition-helper.ts | 4 ++++ packages/hardhat-plugin-viem/src/viem-ignition-helper.ts | 4 ++++ packages/hardhat-plugin/src/helpers.ts | 1 + 3 files changed, 9 insertions(+) diff --git a/packages/hardhat-plugin-ethers/src/ethers-ignition-helper.ts b/packages/hardhat-plugin-ethers/src/ethers-ignition-helper.ts index 944ee05be..d3ed5d4f1 100644 --- a/packages/hardhat-plugin-ethers/src/ethers-ignition-helper.ts +++ b/packages/hardhat-plugin-ethers/src/ethers-ignition-helper.ts @@ -1,5 +1,6 @@ import { HardhatArtifactResolver, + PrettyEventHandler, errorDeploymentResultToExceptionMessage, resolveDeploymentId, } from "@nomicfoundation/hardhat-ignition/helpers"; @@ -134,10 +135,13 @@ export class EthersIgnitionHelper { deploymentId ); + const executionEventListener = new PrettyEventHandler(); + const result = await deploy({ config: resolvedConfig, provider: this._provider, deploymentDir, + executionEventListener, artifactResolver, ignitionModule, deploymentParameters: parameters, diff --git a/packages/hardhat-plugin-viem/src/viem-ignition-helper.ts b/packages/hardhat-plugin-viem/src/viem-ignition-helper.ts index 52c492aa1..89950f97f 100644 --- a/packages/hardhat-plugin-viem/src/viem-ignition-helper.ts +++ b/packages/hardhat-plugin-viem/src/viem-ignition-helper.ts @@ -2,6 +2,7 @@ import type { GetContractReturnType } from "@nomicfoundation/hardhat-viem/types" import { HardhatArtifactResolver, + PrettyEventHandler, errorDeploymentResultToExceptionMessage, resolveDeploymentId, } from "@nomicfoundation/hardhat-ignition/helpers"; @@ -124,10 +125,13 @@ export class ViemIgnitionHelper { deploymentId ); + const executionEventListener = new PrettyEventHandler(); + const result = await deploy({ config: resolvedConfig, provider: this._provider, deploymentDir, + executionEventListener, artifactResolver, ignitionModule, deploymentParameters: parameters, diff --git a/packages/hardhat-plugin/src/helpers.ts b/packages/hardhat-plugin/src/helpers.ts index 459acc79e..019c0e688 100644 --- a/packages/hardhat-plugin/src/helpers.ts +++ b/packages/hardhat-plugin/src/helpers.ts @@ -1,3 +1,4 @@ export { HardhatArtifactResolver } from "./hardhat-artifact-resolver"; export { errorDeploymentResultToExceptionMessage } from "./utils/error-deployment-result-to-exception-message"; export { resolveDeploymentId } from "./utils/resolve-deployment-id"; +export { PrettyEventHandler } from "./ui/pretty-event-handler"; From 8423f92718ee3396f8054caa18a2ce3d5f06b47e Mon Sep 17 00:00:00 2001 From: zoeyTM Date: Sun, 15 Dec 2024 05:57:11 -0500 Subject: [PATCH 2/2] add flag to toggle UI on for scripts --- .../hardhat-plugin-ethers/src/ethers-ignition-helper.ts | 7 ++++++- packages/hardhat-plugin-viem/src/viem-ignition-helper.ts | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/hardhat-plugin-ethers/src/ethers-ignition-helper.ts b/packages/hardhat-plugin-ethers/src/ethers-ignition-helper.ts index d3ed5d4f1..fef38dfc2 100644 --- a/packages/hardhat-plugin-ethers/src/ethers-ignition-helper.ts +++ b/packages/hardhat-plugin-ethers/src/ethers-ignition-helper.ts @@ -79,6 +79,7 @@ export class EthersIgnitionHelper { strategy, strategyConfig, deploymentId: givenDeploymentId = undefined, + displayUi = false, }: { parameters?: DeploymentParameters; config?: Partial; @@ -86,6 +87,7 @@ export class EthersIgnitionHelper { strategy?: StrategyT; strategyConfig?: StrategyConfig[StrategyT]; deploymentId?: string; + displayUi?: boolean; } = { parameters: {}, config: {}, @@ -93,6 +95,7 @@ export class EthersIgnitionHelper { strategy: undefined, strategyConfig: undefined, deploymentId: undefined, + displayUi: undefined, } ): Promise< IgnitionModuleResultsTToEthersContracts< @@ -135,7 +138,9 @@ export class EthersIgnitionHelper { deploymentId ); - const executionEventListener = new PrettyEventHandler(); + const executionEventListener = displayUi + ? new PrettyEventHandler() + : undefined; const result = await deploy({ config: resolvedConfig, diff --git a/packages/hardhat-plugin-viem/src/viem-ignition-helper.ts b/packages/hardhat-plugin-viem/src/viem-ignition-helper.ts index 89950f97f..239243381 100644 --- a/packages/hardhat-plugin-viem/src/viem-ignition-helper.ts +++ b/packages/hardhat-plugin-viem/src/viem-ignition-helper.ts @@ -72,6 +72,7 @@ export class ViemIgnitionHelper { strategy, strategyConfig, deploymentId: givenDeploymentId = undefined, + displayUi = false, }: { parameters?: DeploymentParameters; config?: Partial; @@ -79,6 +80,7 @@ export class ViemIgnitionHelper { strategy?: StrategyT; strategyConfig?: StrategyConfig[StrategyT]; deploymentId?: string; + displayUi?: boolean; } = { parameters: {}, config: {}, @@ -86,6 +88,7 @@ export class ViemIgnitionHelper { strategy: undefined, strategyConfig: undefined, deploymentId: undefined, + displayUi: undefined, } ): Promise< IgnitionModuleResultsToViemContracts @@ -125,7 +128,9 @@ export class ViemIgnitionHelper { deploymentId ); - const executionEventListener = new PrettyEventHandler(); + const executionEventListener = displayUi + ? new PrettyEventHandler() + : undefined; const result = await deploy({ config: resolvedConfig,