Skip to content

Commit

Permalink
refactor: rename the warnings event
Browse files Browse the repository at this point in the history
  • Loading branch information
kanej committed Sep 19, 2023
1 parent 29cd477 commit 53d72f8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/internal/deployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export class Deployer {
}

if (reconciliationResult.missingExecutedFutures.length > 0) {
this._emitDeploymentWarningsEvent(
this._emitReconciliationWarningsEvent(
reconciliationResult.missingExecutedFutures
);
}
Expand Down Expand Up @@ -277,13 +277,13 @@ export class Deployer {
});
}

private _emitDeploymentWarningsEvent(warnings: string[]): void {
private _emitReconciliationWarningsEvent(warnings: string[]): void {
if (this._executionEventListener === undefined) {
return;
}

this._executionEventListener.deploymentWarnings({
type: ExecutionEventType.DEPLOYMENT_WARNINGS,
this._executionEventListener.reconciliationWarnings({
type: ExecutionEventType.RECONCILIATION_WARNINGS,
warnings,
});
}
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/types/execution-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export type ExecutionEvent =
| OnchainInteractionTimeoutEvent
| BatchInitializeEvent
| DeploymentStartEvent
| DeploymentWarningsEvent
| ReconciliationWarningsEvent
| BeginNextBatchEvent
| SetModuleIdEvent;

Expand Down Expand Up @@ -62,7 +62,7 @@ export enum ExecutionEventType {
ONCHAIN_INTERACTION_TIMEOUT = "ONCHAIN_INTERACTION_TIMEOUT",
BATCH_INITIALIZE = "BATCH_INITIALIZE",
DEPLOYMENT_START = "DEPLOYMENT_START",
DEPLOYMENT_WARNINGS = "DEPLOYMENT_WARNINGS",
RECONCILIATION_WARNINGS = "RECONCILIATION_WARNINGS",
BEGIN_NEXT_BATCH = "BEGIN_NEXT_BATCH",
DEPLOYMENT_COMPLETE = "DEPLOYMENT_COMPLETE",
SET_MODULE_ID = "SET_MODULE_ID",
Expand Down Expand Up @@ -119,12 +119,12 @@ export interface DeploymentCompleteEvent {
}

/**
* An event indicating that a deployment has warnings.
* An event indicating that a deployment has reconciliation warnings.
*
* @beta
*/
export interface DeploymentWarningsEvent {
type: ExecutionEventType.DEPLOYMENT_WARNINGS;
export interface ReconciliationWarningsEvent {
type: ExecutionEventType.RECONCILIATION_WARNINGS;
warnings: string[];
}

Expand Down Expand Up @@ -446,7 +446,7 @@ export interface ExecutionEventTypeMap {
[ExecutionEventType.DEPLOYMENT_START]: DeploymentStartEvent;
[ExecutionEventType.BEGIN_NEXT_BATCH]: BeginNextBatchEvent;
[ExecutionEventType.DEPLOYMENT_COMPLETE]: DeploymentCompleteEvent;
[ExecutionEventType.DEPLOYMENT_WARNINGS]: DeploymentWarningsEvent;
[ExecutionEventType.RECONCILIATION_WARNINGS]: ReconciliationWarningsEvent;
[ExecutionEventType.SET_MODULE_ID]: SetModuleIdEvent;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/hardhat-plugin/src/ui/UiEventHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
DeploymentResult,
DeploymentResultType,
DeploymentStartEvent,
DeploymentWarningsEvent,
ExecutionEventListener,
ExecutionEventResult,
ExecutionEventResultType,
Expand All @@ -23,6 +22,7 @@ import {
OnchainInteractionReplacedByUserEvent,
OnchainInteractionTimeoutEvent,
ReadEventArgExecutionStateInitializeEvent,
ReconciliationWarningsEvent,
RunStartEvent,
SendDataExecutionStateCompleteEvent,
SendDataExecutionStateInitializeEvent,
Expand Down Expand Up @@ -335,7 +335,7 @@ export class UiEventHandler implements ExecutionEventListener {
};
}

public deploymentWarnings(event: DeploymentWarningsEvent): void {
public reconciliationWarnings(event: ReconciliationWarningsEvent): void {
this.state = {
...this.state,
warnings: [...this.state.warnings, ...event.warnings],
Expand Down
10 changes: 7 additions & 3 deletions packages/hardhat-plugin/src/ui/VerboseEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
DeploymentExecutionStateCompleteEvent,
DeploymentExecutionStateInitializeEvent,
DeploymentStartEvent,
DeploymentWarningsEvent,
ExecutionEventListener,
ExecutionEventNetworkInteractionType,
ExecutionEventResultType,
Expand All @@ -18,6 +17,7 @@ import {
OnchainInteractionReplacedByUserEvent,
OnchainInteractionTimeoutEvent,
ReadEventArgExecutionStateInitializeEvent,
ReconciliationWarningsEvent,
RunStartEvent,
SendDataExecutionStateCompleteEvent,
SendDataExecutionStateInitializeEvent,
Expand Down Expand Up @@ -252,8 +252,12 @@ export class VerboseEventHandler implements ExecutionEventListener {
console.log(`Deployment complete`);
}

public deploymentWarnings(event: DeploymentWarningsEvent): void {
console.log(`Deployment produced warnings:\n${event.warnings.join(" -")}`);
public reconciliationWarnings(event: ReconciliationWarningsEvent): void {
console.log(
`Deployment produced reconciliation warnings:\n${event.warnings.join(
" -"
)}`
);
}

public setModuleId(event: SetModuleIdEvent): void {
Expand Down

0 comments on commit 53d72f8

Please sign in to comment.