Skip to content

Commit

Permalink
refactor: remove NewEpoch event
Browse files Browse the repository at this point in the history
  • Loading branch information
0xyaco committed Sep 5, 2024
1 parent f86f2cb commit 373d810
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions packages/automated-dispute/src/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@ import { Address, Log } from "viem";
import { Dispute, DisputeStatus, Request, RequestId, Response } from "./prophet.js";

export type EboEventName =
| "NewEpoch"
| "RequestCreated"
| "ResponseProposed"
| "ResponseDisputed"
| "DisputeStatusChanged"
| "DisputeEscalated"
| "RequestFinalized";

export interface NewEpoch {
epoch: bigint;
epochBlockNumber: bigint;
}

export interface ResponseProposed {
requestId: string;
responseId: string;
Expand Down Expand Up @@ -56,21 +50,19 @@ export interface RequestFinalized {
blockNumber: bigint;
}

export type EboEventData<E extends EboEventName> = E extends "NewEpoch"
? NewEpoch
: E extends "RequestCreated"
? RequestCreated
: E extends "ResponseProposed"
? ResponseProposed
: E extends "ResponseDisputed"
? ResponseDisputed
: E extends "DisputeStatusChanged"
? DisputeStatusChanged
: E extends "DisputeEscalated"
? DisputeEscalated
: E extends "RequestFinalized"
? RequestFinalized
: never;
export type EboEventData<E extends EboEventName> = E extends "RequestCreated"
? RequestCreated
: E extends "ResponseProposed"
? ResponseProposed
: E extends "ResponseDisputed"
? ResponseDisputed
: E extends "DisputeStatusChanged"
? DisputeStatusChanged
: E extends "DisputeEscalated"
? DisputeEscalated
: E extends "RequestFinalized"
? RequestFinalized
: never;

export type EboEvent<T extends EboEventName> = {
name: T;
Expand Down

0 comments on commit 373d810

Please sign in to comment.