-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblock-trace.type.ts
109 lines (95 loc) · 2.82 KB
/
block-trace.type.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
export type BalanceChange = {
readonly sendBbefore: string;
readonly sendBafter: string;
readonly recvBbefore: string;
readonly recvBafter: string;
};
export type GasRange = readonly [number, number];
export type TraceItemResult<T extends boolean> = {
readonly success: T;
readonly data: string;
};
export type TraceItemLog = {
readonly data: string;
readonly topics: string[];
readonly op: 'LOG0' | 'LOG1' | 'LOG2' | 'LOG3' | 'LOG4';
};
export type TraceItemSelfDestruct = {
readonly beneficiary: string;
readonly value: string;
readonly op: 'SELFDESTRUCT';
readonly balanceChange: BalanceChange;
};
export type TraceItemCallInfo = {
readonly op: 'CALL' | 'DELEGATECALL' | 'CREATE' | 'CREATE2';
readonly address: string;
readonly data: string;
readonly value: string;
readonly gas: string;
readonly gasRange: GasRange;
readonly items: readonly TraceItem[] | null;
readonly result: TraceItemResult<boolean> | null;
readonly balanceChange: unknown;
};
export type TraceItemSuccessfulCallInfo = TraceItemCallInfo & {
readonly result: TraceItemResult<true>;
readonly balanceChange: BalanceChange;
};
export type TraceItemFailedCallInfo = TraceItemCallInfo & {
readonly result: TraceItemResult<false> | null;
readonly balanceChange: null;
readonly items: null;
readonly exception: string;
};
export type TraceItem = TraceItemSuccessfulCallInfo | TraceItemFailedCallInfo | TraceItemLog | TraceItemSelfDestruct;
export type TransactionBase = {
readonly gasUsed: number;
readonly gasLimit: number;
readonly gasPrice: string;
readonly fee: string;
readonly origin: string;
readonly nonce: number;
readonly sigS: string;
readonly sigR: string;
readonly sigV: string;
readonly gasRange: GasRange;
readonly txType: number;
readonly gasTipCap: string;
readonly gasFeeCap: string;
readonly txnFeeSavings: string;
};
export type TransactionTrace = TransactionBase & {
readonly txHash: string;
readonly item: TraceItemSuccessfulCallInfo | TraceItemFailedCallInfo;
};
export type BlockReward = {
readonly beneficiary: string;
readonly reward: string;
};
export type BlockBase = {
readonly timestamp: number;
readonly difficulty: number;
};
export type BlockHeader = {
readonly gasUsed: number;
readonly gasLimit: number;
readonly baseFeePerGas: string;
readonly sha3Uncles: string;
readonly extraData: string;
readonly mixHash: string;
readonly nonce: number;
readonly logsBloom: string;
readonly stateRoot: string;
readonly transactionsRoot: string;
readonly receiptsRoot: string;
};
export type BlockTrace = {
readonly header: BlockBase &
BlockHeader & {
readonly blockHash: string;
readonly parentBlockHash: string;
readonly blockNumber: number;
};
readonly rewards: readonly BlockReward[];
readonly txs: readonly TransactionTrace[];
};