Skip to content

Commit 8dd2de0

Browse files
committed
minor refactoring
1 parent fc390ef commit 8dd2de0

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

src/server/schemas/event.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
11
import { BigNumber } from "ethers";
22

3-
export type ContractEventV5 = {
4-
eventName: string;
5-
args: Record<string, any>;
6-
address: string;
7-
topic: string[];
8-
data: string;
9-
blockNumber: bigint;
10-
transactionHash: string;
11-
transactionIndex: number;
12-
blockHash: string;
13-
logIndex: number;
14-
removed: boolean;
15-
};
16-
173
export type ContractEventV4 = {
184
eventName: string;
195
data: Record<string, any>;
206
transaction: {
21-
blockNumber: bigint;
7+
blockNumber: number;
228
blockHash: string;
239
transactionIndex: number;
2410
removed: boolean;
@@ -28,15 +14,31 @@ export type ContractEventV4 = {
2814
transactionHash: string;
2915
logIndex: number;
3016
event: string;
31-
eventSignature: string | undefined;
17+
eventSignature?: string;
3218
};
3319
};
3420

21+
export type ContractEventV5 = {
22+
eventName: string;
23+
args: Record<string, any>;
24+
address: string;
25+
topic: string[];
26+
data: string;
27+
blockNumber: bigint;
28+
transactionHash: string;
29+
transactionIndex: number;
30+
blockHash: string;
31+
logIndex: number;
32+
removed: boolean;
33+
};
34+
3535
/**
3636
* Mapping of events v5 response to v4 for backward compatiblity.
3737
* Clients may be using this api and dont want to break things.
3838
*/
39-
export function toContractEventV4Schema(eventV5: ContractEventV5) {
39+
export function toContractEventV4Schema(
40+
eventV5: ContractEventV5,
41+
): ContractEventV4 {
4042
const eventName = eventV5.eventName;
4143

4244
// backwards compatibility of BigInt(v5) to BigNumber(v4)

0 commit comments

Comments
 (0)