-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
175 lines (166 loc) · 5.26 KB
/
types.ts
File metadata and controls
175 lines (166 loc) · 5.26 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// types.ts - TypeScript types and interfaces for the queue-based Tracer API
/**
* Access list entry for EIP-2930 and later transaction types.
* Contains an address and the storage keys that will be accessed.
*/
export interface AccessListEntry {
addr: string;
storageKeys: string[];
}
/**
* Authorization tuple for EIP-7702 (Type 4) transactions.
* Contains the signature components for account authorization.
*/
export interface AuthorizationTuple {
chainId: number;
addr: string;
nonce: string;
v: number;
r: string;
s: string;
}
/**
* Full EVM transaction representation supporting all 5 transaction types (0-4).
* - Type 0: Legacy transactions
* - Type 1: EIP-2930 (access list) transactions
* - Type 2: EIP-1559 (dynamic fee) transactions
* - Type 3: EIP-4844 (blob) transactions
* - Type 4: EIP-7702 (account abstraction) transactions
*/
export interface EVMTransaction {
/** Transaction type discriminator (0=Legacy, 1=EIP-2930, 2=EIP-1559, 3=EIP-4844, 4=EIP-7702) */
type: 0 | 1 | 2 | 3 | 4;
/** Transaction hash (0x prefixed, 64 hex characters) */
transaction_hash: string;
/** Chain ID */
chain_id: number;
/** Transaction nonce */
nonce: string;
/** Gas limit for the transaction */
gas_limit: string;
/** Target address (empty for contract creation) */
to_address: string;
/** Sender address */
from_address: string;
/** Value in wei */
value: string;
/** Optional calldata (hex encoded) */
data?: string;
/** Gas price for Type 0 and 1 transactions */
gas_price?: string;
/** Max fee per gas for Type 2, 3, and 4 transactions */
max_fee_per_gas?: string;
/** Max priority fee per gas for Type 2, 3, and 4 transactions */
max_priority_fee_per_gas?: string;
/** Max fee per blob gas for Type 3 transactions */
max_fee_per_blob_gas?: string;
/** Blob versioned hashes for Type 3 transactions */
blob_versioned_hashes?: string[];
/** Authorization list for Type 4 transactions */
authorization_list?: AuthorizationTuple[];
/** Access list for Type 1, 2, 3, and 4 transactions */
access_list?: AccessListEntry[];
}
/**
* Block environment context from Revm, critical for accurate simulation.
* When provided, all fields are required to ensure accurate simulation.
*/
export interface BlockEnv {
/** Block number */
number: string;
/** Unix timestamp */
timestamp: string;
/** Coinbase/miner/validator address */
beneficiary: string;
/** Block gas limit */
gas_limit: string;
/** EIP-1559 base fee */
basefee: string;
/** Pre-merge difficulty */
difficulty: string;
/** Post-merge randomness (null for pre-merge chains) */
prevrandao: string | null;
/** EIP-4844 blob gas pricing (null for non-blob chains) */
blob_excess_gas_and_price: {
excess_blob_gas: string;
blob_gasprice: string;
} | null;
}
/**
* Transaction data for replay in the tracer.
* Simplified transaction representation for the main transaction being traced.
*/
export interface TransactionData {
/** Sender address */
from: string;
/** Target address (empty for contract creation) */
to: string;
/** Value in wei */
value: string;
/** Calldata (hex encoded) */
data: string;
/** Optional nonce */
nonce?: string;
/** Optional gas limit */
gas_limit?: string;
/** Optional transaction type (0-4) */
type?: number;
}
/**
* Trace request payload submitted to POST /api/queue.
* The dapp sends everything the tracer needs - the tracer fetches nothing.
*/
export interface TraceRequest {
/** RPC URL for the target chain (e.g., "https://rpc.sepolia.linea.build") */
rpc_url: string;
/** Callback URL to POST results to (may include query params like debug_trace_id) */
callback_url: string;
/** Chain ID for logging/context */
chain_id: number;
/** Transaction hash of the transaction being traced (0x prefixed, 64 hex characters) */
transaction_hash: string;
/** Block number to fork at (block N-1, state at END of that block) */
fork_block_number: number;
/** Transaction data for replay */
transaction: TransactionData;
/** Previous transactions in the block for multi-block simulation (Linea) */
previous_transactions?: EVMTransaction[];
/** Block environment context for accurate simulation (REQUIRED) */
block_env: BlockEnv;
}
/**
* Callback payload sent to the dapp after trace completion.
* Posted to the callback_url provided in the TraceRequest.
*/
export interface TraceCallbackPayload {
/** Whether the trace completed successfully */
success: boolean;
/** Trace output content (present if success=true) */
trace_content?: string;
/** Format of the trace content */
trace_format?: "ansi" | "plain" | "json";
/** Error message (present if success=false) */
error?: string;
/** Error code for categorization (present if success=false) */
error_code?: string;
/** Duration of the trace operation in milliseconds */
duration_ms?: number;
/** Additional metadata from the tracer */
tracer_metadata?: Record<string, unknown>;
}
/**
* Response returned immediately when a trace request is queued.
*/
export interface QueueResponse {
/** Status of the queue operation */
status: "queued";
/** Human-readable message */
message: string;
}
/**
* Error response for failed requests.
*/
export interface ErrorResponse {
/** Error message */
error: string;
}