@asyncswap/eth-rpc 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/example.ts +5 -0
- package/package.json +2 -2
- package/src/engine-api.ts +150 -84
- package/src/eth-api.ts +50 -61
- package/src/index.ts +1 -0
- package/src/mev-api.ts +155 -0
- package/src/types/engine/payload.d.ts +8 -8
- package/src/types/mev/methods.d.ts +35 -0
- package/src/types/mev/types.d.ts +231 -0
package/README.md
CHANGED
|
@@ -36,3 +36,23 @@ const payload = engine.engine_getPayloadV1("0x1");
|
|
|
36
36
|
|
|
37
37
|
console.log(payload);
|
|
38
38
|
```
|
|
39
|
+
|
|
40
|
+
## Builtin flashbots MEV rpc methods
|
|
41
|
+
|
|
42
|
+
- [x] eth_sendBundle
|
|
43
|
+
- [x] mev_sendBundle
|
|
44
|
+
- [x] eth_callBundle
|
|
45
|
+
- [x] eth_cancelBundle
|
|
46
|
+
- [x] mev_simBundle
|
|
47
|
+
- [x] eth_sendPrivateTransaction
|
|
48
|
+
- [x] eth_sendPrivateRawTransaction
|
|
49
|
+
- [x] eth_cancelPrivateTransaction
|
|
50
|
+
- [x] flashbots_getFeeRefundTotalsByRecipient
|
|
51
|
+
- [x] flashbots_getFeeRefundsByRecipient
|
|
52
|
+
- [x] flashbots_getFeeRefundsByBundle
|
|
53
|
+
- [x] flashbots_getFeeRefundsByBlock
|
|
54
|
+
- [x] flashbots_setFeeRefundRecipient
|
|
55
|
+
- [x] buildernet_getDelayedRefunds
|
|
56
|
+
- [x] buildernet_getDelayedRefundTotalsByRecipient
|
|
57
|
+
- [x] flashbots_getMevRefundTotalByRecipient
|
|
58
|
+
- [x] flashbots_getMevRefundTotalBySender
|
package/example.ts
CHANGED
|
@@ -17,3 +17,8 @@ const engine = new EngineExecutionClient(engineUrl, process.env.JWT_TOKEN!);
|
|
|
17
17
|
const payload = engine.engine_getPayloadV1("0x1");
|
|
18
18
|
|
|
19
19
|
console.log(payload);
|
|
20
|
+
|
|
21
|
+
import { EthFlashbotsClient } from "./src";
|
|
22
|
+
|
|
23
|
+
const rpc = "https://relay.flashbots.net";
|
|
24
|
+
const client = new EthFlashbotsClient(rpc);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@asyncswap/eth-rpc",
|
|
3
3
|
"description": "A library for ethereum execution clients apis.",
|
|
4
4
|
"author": "Meek Msaki",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.4.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
@@ -41,6 +41,6 @@
|
|
|
41
41
|
"typescript": "^5"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@asyncswap/jsonrpc": "^0.
|
|
44
|
+
"@asyncswap/jsonrpc": "^0.4.0"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/src/engine-api.ts
CHANGED
|
@@ -1,147 +1,190 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JsonRpcClient } from "@asyncswap/jsonrpc";
|
|
2
2
|
|
|
3
3
|
export class EngineExecutionClient {
|
|
4
4
|
private client: JsonRpcClient;
|
|
5
|
+
private headers: Record<string, string>;
|
|
5
6
|
|
|
6
7
|
constructor(url: string, jwt_token: string) {
|
|
7
|
-
this.
|
|
8
|
+
this.headers = {
|
|
9
|
+
Authorization: `Bearer ${jwt_token}`,
|
|
10
|
+
};
|
|
11
|
+
this.client = new JsonRpcClient(url);
|
|
8
12
|
}
|
|
9
13
|
|
|
10
14
|
// eth/transaction
|
|
11
15
|
async eth_sendRawTransaction(transaction: Bytes): Promise<Hash32> {
|
|
12
|
-
return await this.client.call(
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
return await this.client.call(
|
|
17
|
+
EngineMethods.eth_sendRawTransaction,
|
|
18
|
+
[transaction],
|
|
19
|
+
this.headers,
|
|
20
|
+
);
|
|
15
21
|
}
|
|
16
22
|
// eth/state
|
|
17
23
|
async eth_getCode(
|
|
18
24
|
address: Address,
|
|
19
25
|
block: BlockNumberOrTagOrHash,
|
|
20
26
|
): Promise<Bytes> {
|
|
21
|
-
return await this.client.call(
|
|
27
|
+
return await this.client.call(
|
|
28
|
+
EngineMethods.eth_getCode,
|
|
29
|
+
[address, block],
|
|
30
|
+
this.headers,
|
|
31
|
+
);
|
|
22
32
|
}
|
|
23
33
|
async eth_getLogs(filter: Filter): Promise<FilterResults> {
|
|
24
|
-
return await this.client.call(
|
|
34
|
+
return await this.client.call(
|
|
35
|
+
EngineMethods.eth_getLogs,
|
|
36
|
+
[filter],
|
|
37
|
+
this.headers,
|
|
38
|
+
);
|
|
25
39
|
}
|
|
26
40
|
// eth/execute
|
|
27
41
|
async eth_call(
|
|
28
42
|
transaction: GenericTransaction,
|
|
29
43
|
block: BlockNumberOrTagOrHash,
|
|
30
44
|
): Promise<Bytes> {
|
|
31
|
-
return this.client.call(
|
|
45
|
+
return this.client.call(
|
|
46
|
+
EngineMethods.eth_call,
|
|
47
|
+
[transaction, block],
|
|
48
|
+
this.headers,
|
|
49
|
+
);
|
|
32
50
|
}
|
|
33
51
|
// eth/client
|
|
34
52
|
async eth_chainId(): Promise<Uint> {
|
|
35
|
-
return await this.client.call(EngineMethods.eth_chainId, []);
|
|
53
|
+
return await this.client.call(EngineMethods.eth_chainId, [], this.headers);
|
|
36
54
|
}
|
|
37
55
|
async eth_syncing(): Promise<SyncingStatus> {
|
|
38
|
-
return await this.client.call(EngineMethods.eth_syncing, []);
|
|
56
|
+
return await this.client.call(EngineMethods.eth_syncing, [], this.headers);
|
|
39
57
|
}
|
|
40
58
|
async eth_blockNumber(): Promise<Uint> {
|
|
41
|
-
return await this.client.call(
|
|
59
|
+
return await this.client.call(
|
|
60
|
+
EngineMethods.eth_blockNumber,
|
|
61
|
+
[],
|
|
62
|
+
this.headers,
|
|
63
|
+
);
|
|
42
64
|
}
|
|
43
65
|
// eth/block
|
|
44
66
|
async eth_getBlockByHash(
|
|
45
67
|
blockHash: Hash32,
|
|
46
68
|
hydratedTransactions: boolean,
|
|
47
69
|
): Promise<NotFound | Block> {
|
|
48
|
-
return await this.client.call(
|
|
49
|
-
|
|
50
|
-
hydratedTransactions,
|
|
51
|
-
|
|
70
|
+
return await this.client.call(
|
|
71
|
+
EngineMethods.eth_getBlockByHash,
|
|
72
|
+
[blockHash, hydratedTransactions],
|
|
73
|
+
this.headers,
|
|
74
|
+
);
|
|
52
75
|
}
|
|
53
76
|
async eth_getBlockByNumber(
|
|
54
77
|
block: BlockNumberOrTag,
|
|
55
78
|
hydratedTransactions: boolean,
|
|
56
79
|
): Promise<NotFound | Block> {
|
|
57
|
-
return await this.client.call(
|
|
58
|
-
|
|
59
|
-
hydratedTransactions,
|
|
60
|
-
|
|
80
|
+
return await this.client.call(
|
|
81
|
+
EngineMethods.eth_getBlockByNumber,
|
|
82
|
+
[block, hydratedTransactions],
|
|
83
|
+
this.headers,
|
|
84
|
+
);
|
|
61
85
|
}
|
|
62
86
|
// engine/blob
|
|
63
87
|
async engine_getBlobsV1(
|
|
64
88
|
blobedVersionedHashes: Hash32[],
|
|
65
89
|
): Promise<BlobAndProofV1[]> {
|
|
66
|
-
return await this.client.call(
|
|
67
|
-
|
|
68
|
-
|
|
90
|
+
return await this.client.call(
|
|
91
|
+
EngineMethods.engine_getBlobsV1,
|
|
92
|
+
[blobedVersionedHashes],
|
|
93
|
+
this.headers,
|
|
94
|
+
);
|
|
69
95
|
}
|
|
70
96
|
async engine_getBlobsV2(
|
|
71
97
|
blobedVersionedHashes: Hash32[],
|
|
72
98
|
): Promise<BlobAndProofV2[]> {
|
|
73
|
-
return await this.client.call(
|
|
74
|
-
|
|
75
|
-
|
|
99
|
+
return await this.client.call(
|
|
100
|
+
EngineMethods.engine_getBlobsV2,
|
|
101
|
+
[blobedVersionedHashes],
|
|
102
|
+
this.headers,
|
|
103
|
+
);
|
|
76
104
|
}
|
|
77
105
|
async engine_getBlobsV3(
|
|
78
106
|
blobedVersionedHashes: Hash32[],
|
|
79
107
|
): Promise<Array<BlobAndProofV2[] | null> | null> {
|
|
80
|
-
return await this.client.call(
|
|
81
|
-
|
|
82
|
-
|
|
108
|
+
return await this.client.call(
|
|
109
|
+
EngineMethods.engine_getBlobsV3,
|
|
110
|
+
[blobedVersionedHashes],
|
|
111
|
+
this.headers,
|
|
112
|
+
);
|
|
83
113
|
}
|
|
84
114
|
// engine/capabilities
|
|
85
115
|
async engine_exchangeCapabilities(
|
|
86
116
|
consensusClientMethods: string[],
|
|
87
117
|
): Promise<string[]> {
|
|
88
|
-
return await this.client.call(
|
|
89
|
-
|
|
90
|
-
|
|
118
|
+
return await this.client.call(
|
|
119
|
+
EngineMethods.engine_exchangeCapabilities,
|
|
120
|
+
[consensusClientMethods],
|
|
121
|
+
this.headers,
|
|
122
|
+
);
|
|
91
123
|
}
|
|
92
124
|
// engine/forkchoice
|
|
93
125
|
async engine_forkchoiceUpdatedV1(
|
|
94
126
|
forkchoiceState: ForkchoiceStateV1,
|
|
95
127
|
payloadAttribute: PayloadAttributesV1,
|
|
96
128
|
): Promise<ForkchoiceUpdatedResponseV1> {
|
|
97
|
-
return await this.client.call(
|
|
98
|
-
|
|
99
|
-
payloadAttribute,
|
|
100
|
-
|
|
129
|
+
return await this.client.call(
|
|
130
|
+
EngineMethods.engine_forkchoiceUpdatedV1,
|
|
131
|
+
[forkchoiceState, payloadAttribute],
|
|
132
|
+
this.headers,
|
|
133
|
+
);
|
|
101
134
|
}
|
|
102
135
|
async engine_forkchoiceUpdatedV2(
|
|
103
136
|
forkchoiceState: ForkchoiceStateV1,
|
|
104
137
|
payloadAttribute: PayloadAttributesV2,
|
|
105
138
|
): Promise<ForkchoiceUpdatedResponseV1> {
|
|
106
|
-
return await this.client.call(
|
|
107
|
-
|
|
108
|
-
payloadAttribute,
|
|
109
|
-
|
|
139
|
+
return await this.client.call(
|
|
140
|
+
EngineMethods.engine_forkchoiceUpdatedV2,
|
|
141
|
+
[forkchoiceState, payloadAttribute],
|
|
142
|
+
this.headers,
|
|
143
|
+
);
|
|
110
144
|
}
|
|
111
145
|
async engine_forkchoiceUpdatedV3(
|
|
112
146
|
forkchoiceState: ForkchoiceStateV1,
|
|
113
147
|
payloadAttribute: PayloadAttributesV3,
|
|
114
148
|
): Promise<ForkchoiceUpdatedResponseV1> {
|
|
115
|
-
return await this.client.call(
|
|
116
|
-
|
|
117
|
-
payloadAttribute,
|
|
118
|
-
|
|
149
|
+
return await this.client.call(
|
|
150
|
+
EngineMethods.engine_forkchoiceUpdatedV3,
|
|
151
|
+
[forkchoiceState, payloadAttribute],
|
|
152
|
+
this.headers,
|
|
153
|
+
);
|
|
119
154
|
}
|
|
120
155
|
// engine/payload
|
|
121
156
|
async engine_newPayloadV1(
|
|
122
157
|
executionPayload: ExecutionPayloadV1,
|
|
123
158
|
): Promise<PayloadStatusV1> {
|
|
124
|
-
return await this.client.call(
|
|
125
|
-
|
|
126
|
-
|
|
159
|
+
return await this.client.call(
|
|
160
|
+
EngineMethods.engine_newPayloadV1,
|
|
161
|
+
[executionPayload],
|
|
162
|
+
this.headers,
|
|
163
|
+
);
|
|
127
164
|
}
|
|
128
165
|
async engine_newPayloadV2(
|
|
129
166
|
executionPayload: ExecutionPayloadV1 | ExecutionPayloadV2,
|
|
130
167
|
): Promise<PayloadStatusNoInvalidBlockHash> {
|
|
131
|
-
return await this.client.call(
|
|
132
|
-
|
|
133
|
-
|
|
168
|
+
return await this.client.call(
|
|
169
|
+
EngineMethods.engine_newPayloadV2,
|
|
170
|
+
[executionPayload],
|
|
171
|
+
this.headers,
|
|
172
|
+
);
|
|
134
173
|
}
|
|
135
174
|
async engine_newPayloadV3(
|
|
136
175
|
executionPayload: ExecutionPayloadV3,
|
|
137
176
|
expectedBlobVersionedHashes: Hash32[],
|
|
138
177
|
rootOfTheParentBeaconBlock: Hash32,
|
|
139
178
|
): Promise<PayloadStatusNoInvalidBlockHash> {
|
|
140
|
-
return await this.client.call(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
179
|
+
return await this.client.call(
|
|
180
|
+
EngineMethods.engine_newPayloadV3,
|
|
181
|
+
[
|
|
182
|
+
executionPayload,
|
|
183
|
+
expectedBlobVersionedHashes,
|
|
184
|
+
rootOfTheParentBeaconBlock,
|
|
185
|
+
],
|
|
186
|
+
this.headers,
|
|
187
|
+
);
|
|
145
188
|
}
|
|
146
189
|
async engine_newPayloadV4(
|
|
147
190
|
executionPayload: ExecutionPayloadV3,
|
|
@@ -149,25 +192,33 @@ export class EngineExecutionClient {
|
|
|
149
192
|
rootOfTheParentBeaconBlock: Hash32,
|
|
150
193
|
executionRequests: Bytes[],
|
|
151
194
|
): Promise<PayloadStatusNoInvalidBlockHash> {
|
|
152
|
-
return await this.client.call(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
195
|
+
return await this.client.call(
|
|
196
|
+
EngineMethods.engine_newPayloadV4,
|
|
197
|
+
[
|
|
198
|
+
executionPayload,
|
|
199
|
+
expectedBlobVersionedHashes,
|
|
200
|
+
rootOfTheParentBeaconBlock,
|
|
201
|
+
executionRequests,
|
|
202
|
+
],
|
|
203
|
+
this.headers,
|
|
204
|
+
);
|
|
158
205
|
}
|
|
159
206
|
async engine_getPayloadV1(payloadId: Bytes8): Promise<ExecutionPayloadV1> {
|
|
160
|
-
return await this.client.call(
|
|
161
|
-
|
|
162
|
-
|
|
207
|
+
return await this.client.call(
|
|
208
|
+
EngineMethods.engine_getPayloadV1,
|
|
209
|
+
[payloadId],
|
|
210
|
+
this.headers,
|
|
211
|
+
);
|
|
163
212
|
}
|
|
164
213
|
async engine_getPayloadV2(payloadId: Bytes8): Promise<{
|
|
165
214
|
executionPayload: ExecutionPayloadV1 | ExecutionPayloadV2;
|
|
166
215
|
blockValue: Uint256;
|
|
167
216
|
}> {
|
|
168
|
-
return await this.client.call(
|
|
169
|
-
|
|
170
|
-
|
|
217
|
+
return await this.client.call(
|
|
218
|
+
EngineMethods.engine_getPayloadV2,
|
|
219
|
+
[payloadId],
|
|
220
|
+
this.headers,
|
|
221
|
+
);
|
|
171
222
|
}
|
|
172
223
|
async engine_getPayloadV3(payloadId: Bytes8): Promise<{
|
|
173
224
|
executionPayload: ExecutionPayloadV3;
|
|
@@ -175,9 +226,11 @@ export class EngineExecutionClient {
|
|
|
175
226
|
blobsBundle: BlobsBundleV1;
|
|
176
227
|
shouldOverrideBuilder: boolean;
|
|
177
228
|
}> {
|
|
178
|
-
return await this.client.call(
|
|
179
|
-
|
|
180
|
-
|
|
229
|
+
return await this.client.call(
|
|
230
|
+
EngineMethods.engine_getPayloadV3,
|
|
231
|
+
[payloadId],
|
|
232
|
+
this.headers,
|
|
233
|
+
);
|
|
181
234
|
}
|
|
182
235
|
async engine_getPayloadV4(payloadId: Bytes8): Promise<{
|
|
183
236
|
executionPayload: ExecutionPayloadV3;
|
|
@@ -186,9 +239,11 @@ export class EngineExecutionClient {
|
|
|
186
239
|
shouldOverrideBuilder: boolean;
|
|
187
240
|
executionRequests: Bytes[];
|
|
188
241
|
}> {
|
|
189
|
-
return await this.client.call(
|
|
190
|
-
|
|
191
|
-
|
|
242
|
+
return await this.client.call(
|
|
243
|
+
EngineMethods.engine_getPayloadV4,
|
|
244
|
+
[payloadId],
|
|
245
|
+
this.headers,
|
|
246
|
+
);
|
|
192
247
|
}
|
|
193
248
|
async engine_getPayloadV5(payloadId: Bytes8): Promise<{
|
|
194
249
|
executionPayload: ExecutionPayloadV3;
|
|
@@ -197,9 +252,11 @@ export class EngineExecutionClient {
|
|
|
197
252
|
shouldOverrideBuilder: boolean;
|
|
198
253
|
executionRequests: Bytes[];
|
|
199
254
|
}> {
|
|
200
|
-
return await this.client.call(
|
|
201
|
-
|
|
202
|
-
|
|
255
|
+
return await this.client.call(
|
|
256
|
+
EngineMethods.engine_getPayloadV5,
|
|
257
|
+
[payloadId],
|
|
258
|
+
this.headers,
|
|
259
|
+
);
|
|
203
260
|
}
|
|
204
261
|
async engine_getPayloadBodiesByHashV1(
|
|
205
262
|
arrayOfBlockHashes: Hash32[],
|
|
@@ -207,6 +264,7 @@ export class EngineExecutionClient {
|
|
|
207
264
|
return await this.client.call(
|
|
208
265
|
EngineMethods.engine_getPayloadBodiesByHashV1,
|
|
209
266
|
[arrayOfBlockHashes],
|
|
267
|
+
this.headers,
|
|
210
268
|
);
|
|
211
269
|
}
|
|
212
270
|
async engine_getPayloadBodiesByRangeV1(
|
|
@@ -216,6 +274,7 @@ export class EngineExecutionClient {
|
|
|
216
274
|
return await this.client.call(
|
|
217
275
|
EngineMethods.engine_getPayloadBodiesByRangeV1,
|
|
218
276
|
[startingBlockNumber, numberOfBlocksToReturn],
|
|
277
|
+
this.headers,
|
|
219
278
|
);
|
|
220
279
|
}
|
|
221
280
|
async engine_newPayloadV5(
|
|
@@ -224,12 +283,16 @@ export class EngineExecutionClient {
|
|
|
224
283
|
parentBeaconBlockRoot: Hash32,
|
|
225
284
|
executionRequests: Bytes[],
|
|
226
285
|
): Promise<PayloadStatusNoInvalidBlockHash> {
|
|
227
|
-
return await this.client.call(
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
286
|
+
return await this.client.call(
|
|
287
|
+
EngineMethods.engine_newPayloadV5,
|
|
288
|
+
[
|
|
289
|
+
executionPayload,
|
|
290
|
+
expectedBlobVersionedHashes,
|
|
291
|
+
parentBeaconBlockRoot,
|
|
292
|
+
executionRequests,
|
|
293
|
+
],
|
|
294
|
+
this.headers,
|
|
295
|
+
);
|
|
233
296
|
}
|
|
234
297
|
async engine_getPayloadV6(payloadId: Bytes8): Promise<{
|
|
235
298
|
executionPayload: ExecutionPayloadV4;
|
|
@@ -238,9 +301,11 @@ export class EngineExecutionClient {
|
|
|
238
301
|
shouldOverrideBuilder: boolean;
|
|
239
302
|
executionRequests: Bytes[];
|
|
240
303
|
}> {
|
|
241
|
-
return await this.client.call(
|
|
242
|
-
|
|
243
|
-
|
|
304
|
+
return await this.client.call(
|
|
305
|
+
EngineMethods.engine_getPayloadV6,
|
|
306
|
+
[payloadId],
|
|
307
|
+
this.headers,
|
|
308
|
+
);
|
|
244
309
|
}
|
|
245
310
|
// engine/transition-configuration
|
|
246
311
|
async engine_exchangeTransitionConfigurationV1(
|
|
@@ -249,6 +314,7 @@ export class EngineExecutionClient {
|
|
|
249
314
|
return await this.client.call(
|
|
250
315
|
EngineMethods.engine_exchangeTransitionConfigurationV1,
|
|
251
316
|
[consensusClientConfiguration],
|
|
317
|
+
this.headers,
|
|
252
318
|
);
|
|
253
319
|
}
|
|
254
320
|
}
|
package/src/eth-api.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JsonRpcClient } from "@asyncswap/jsonrpc";
|
|
2
2
|
|
|
3
3
|
export class EthExecutionClient {
|
|
4
|
-
|
|
4
|
+
rpc: JsonRpcClient;
|
|
5
5
|
|
|
6
6
|
constructor(url: string) {
|
|
7
|
-
this.
|
|
7
|
+
this.rpc = new JsonRpcClient(url);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
// eth/transaction
|
|
11
11
|
async eth_getTransactionByHash(
|
|
12
12
|
transactionHash: Hash32,
|
|
13
13
|
): Promise<NotFound | TransactionInfo> {
|
|
14
|
-
return await this.
|
|
14
|
+
return await this.rpc.call(EthMethods.eth_getTransactionByHash, [
|
|
15
15
|
transactionHash,
|
|
16
16
|
]);
|
|
17
17
|
}
|
|
@@ -19,7 +19,7 @@ export class EthExecutionClient {
|
|
|
19
19
|
blockHash: Hash32,
|
|
20
20
|
transactionIndex: Uint,
|
|
21
21
|
): Promise<NotFound | TransactionInfo> {
|
|
22
|
-
return await this.
|
|
22
|
+
return await this.rpc.call(
|
|
23
23
|
EthMethods.eth_getTransactionByBlockHashAndIndex,
|
|
24
24
|
[blockHash, transactionIndex],
|
|
25
25
|
);
|
|
@@ -27,19 +27,17 @@ export class EthExecutionClient {
|
|
|
27
27
|
async eth_getTransactionReceipt(
|
|
28
28
|
transactionHash: Hash32,
|
|
29
29
|
): Promise<NotFound | ReceiptInfo> {
|
|
30
|
-
return await this.
|
|
30
|
+
return await this.rpc.call(EthMethods.eth_getTransactionReceipt, [
|
|
31
31
|
transactionHash,
|
|
32
32
|
]);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
// eth/submit
|
|
36
36
|
async eth_sendTransaction(transaction: GenericTransaction): Promise<Hash32> {
|
|
37
|
-
return await this.
|
|
38
|
-
transaction,
|
|
39
|
-
]);
|
|
37
|
+
return await this.rpc.call(EthMethods.eth_sendTransaction, [transaction]);
|
|
40
38
|
}
|
|
41
39
|
async eth_sendRawTransaction(transaction: Bytes): Promise<Hash32> {
|
|
42
|
-
return await this.
|
|
40
|
+
return await this.rpc.call(EthMethods.eth_sendRawTransaction, [
|
|
43
41
|
transaction,
|
|
44
42
|
]);
|
|
45
43
|
}
|
|
@@ -48,14 +46,14 @@ export class EthExecutionClient {
|
|
|
48
46
|
address: Address,
|
|
49
47
|
block: BlockNumberOrTagOrHash,
|
|
50
48
|
): Promise<Uint> {
|
|
51
|
-
return await this.
|
|
49
|
+
return await this.rpc.call(EthMethods.eth_getBalance, [address, block]);
|
|
52
50
|
}
|
|
53
51
|
async eth_getStorageAt(
|
|
54
52
|
address: Address,
|
|
55
53
|
storageSlot: Bytes32,
|
|
56
54
|
block: BlockNumberOrTagOrHash,
|
|
57
55
|
): Promise<Bytes> {
|
|
58
|
-
return await this.
|
|
56
|
+
return await this.rpc.call(EthMethods.eth_getStorageAt, [
|
|
59
57
|
address,
|
|
60
58
|
storageSlot,
|
|
61
59
|
block,
|
|
@@ -65,7 +63,7 @@ export class EthExecutionClient {
|
|
|
65
63
|
address: Address,
|
|
66
64
|
block: BlockNumberOrTagOrHash,
|
|
67
65
|
): Promise<Uint> {
|
|
68
|
-
return await this.
|
|
66
|
+
return await this.rpc.call(EthMethods.eth_getTransactionCount, [
|
|
69
67
|
address,
|
|
70
68
|
block,
|
|
71
69
|
]);
|
|
@@ -74,14 +72,14 @@ export class EthExecutionClient {
|
|
|
74
72
|
address: Address,
|
|
75
73
|
block: BlockNumberOrTagOrHash,
|
|
76
74
|
): Promise<Bytes> {
|
|
77
|
-
return await this.
|
|
75
|
+
return await this.rpc.call(EthMethods.eth_getCode, [address, block]);
|
|
78
76
|
}
|
|
79
77
|
async eth_getProof(
|
|
80
78
|
address: Address,
|
|
81
79
|
storageKeys: Bytes32[],
|
|
82
80
|
block: BlockNumberOrTagOrHash,
|
|
83
81
|
): Promise<AccountProof> {
|
|
84
|
-
return await this.
|
|
82
|
+
return await this.rpc.call(EthMethods.eth_getProof, [
|
|
85
83
|
address,
|
|
86
84
|
storageKeys,
|
|
87
85
|
block,
|
|
@@ -89,56 +87,51 @@ export class EthExecutionClient {
|
|
|
89
87
|
}
|
|
90
88
|
// eth/sign
|
|
91
89
|
async eth_sign(address: Address, message: Bytes): Promise<Bytes65> {
|
|
92
|
-
return await this.
|
|
90
|
+
return await this.rpc.call(EthMethods.eth_sign, [address, message]);
|
|
93
91
|
}
|
|
94
92
|
async eth_signTransaction(transaction: GenericTransaction): Promise<Bytes> {
|
|
95
|
-
return await this.
|
|
96
|
-
transaction,
|
|
97
|
-
]);
|
|
93
|
+
return await this.rpc.call(EthMethods.eth_signTransaction, [transaction]);
|
|
98
94
|
}
|
|
99
95
|
// eth/filter
|
|
100
96
|
async eth_newFilter(filter: Filter): Promise<Uint> {
|
|
101
|
-
return await this.
|
|
97
|
+
return await this.rpc.call(EthMethods.eth_newFilter, [filter]);
|
|
102
98
|
}
|
|
103
99
|
async eth_newBlockFilter(): Promise<Uint> {
|
|
104
|
-
return await this.
|
|
100
|
+
return await this.rpc.call(EthMethods.eth_newBlockFilter, []);
|
|
105
101
|
}
|
|
106
102
|
async eth_newPendingTransactionFilter(): Promise<Uint> {
|
|
107
|
-
return await this.
|
|
108
|
-
EthMethods.eth_newPendingTransactionFilter,
|
|
109
|
-
[],
|
|
110
|
-
);
|
|
103
|
+
return await this.rpc.call(EthMethods.eth_newPendingTransactionFilter, []);
|
|
111
104
|
}
|
|
112
105
|
async eth_uninstallFilter(): Promise<Uint> {
|
|
113
|
-
return await this.
|
|
106
|
+
return await this.rpc.call(EthMethods.eth_uninstallFilter, []);
|
|
114
107
|
}
|
|
115
108
|
async eth_getFilterChanges(): Promise<FilterResults> {
|
|
116
|
-
return await this.
|
|
109
|
+
return await this.rpc.call(EthMethods.eth_getFilterChanges, []);
|
|
117
110
|
}
|
|
118
111
|
async eth_getFilterLogs(filterIdentifier: Uint): Promise<FilterResults> {
|
|
119
|
-
return await this.
|
|
112
|
+
return await this.rpc.call(EthMethods.eth_getFilterLogs, [
|
|
120
113
|
filterIdentifier,
|
|
121
114
|
]);
|
|
122
115
|
}
|
|
123
116
|
async eth_getLogs(filter: Filter): Promise<FilterResults> {
|
|
124
|
-
return await this.
|
|
117
|
+
return await this.rpc.call(EthMethods.eth_getLogs, [filter]);
|
|
125
118
|
}
|
|
126
119
|
// eth/feeMarket
|
|
127
120
|
async eth_gasPrice(): Promise<Uint> {
|
|
128
|
-
return await this.
|
|
121
|
+
return await this.rpc.call(EthMethods.eth_gasPrice, []);
|
|
129
122
|
}
|
|
130
123
|
async eth_blobBaseFee(): Promise<Uint> {
|
|
131
|
-
return await this.
|
|
124
|
+
return await this.rpc.call(EthMethods.eth_blobBaseFee, []);
|
|
132
125
|
}
|
|
133
126
|
async eth_maxPriorityFeePerGas(): Promise<Uint> {
|
|
134
|
-
return await this.
|
|
127
|
+
return await this.rpc.call(EthMethods.eth_maxPriorityFeePerGas, []);
|
|
135
128
|
}
|
|
136
129
|
async eth_feeHistory(
|
|
137
130
|
blockCount: Uint,
|
|
138
131
|
newestBlock: BlockNumberOrTag,
|
|
139
132
|
rewardPercentiles: number[],
|
|
140
133
|
): Promise<FeeHistoryResults> {
|
|
141
|
-
return await this.
|
|
134
|
+
return await this.rpc.call(EthMethods.eth_feeHistory, [
|
|
142
135
|
blockCount,
|
|
143
136
|
newestBlock,
|
|
144
137
|
rewardPercentiles,
|
|
@@ -149,13 +142,13 @@ export class EthExecutionClient {
|
|
|
149
142
|
transaction: GenericTransaction,
|
|
150
143
|
block: BlockNumberOrTagOrHash,
|
|
151
144
|
): Promise<Bytes> {
|
|
152
|
-
return this.
|
|
145
|
+
return this.rpc.call(EthMethods.eth_call, [transaction, block]);
|
|
153
146
|
}
|
|
154
147
|
async eth_estimateGas(
|
|
155
148
|
transaction: GenericTransaction,
|
|
156
149
|
block: BlockNumberOrTag,
|
|
157
150
|
): Promise<Uint> {
|
|
158
|
-
return await this.
|
|
151
|
+
return await this.rpc.call(EthMethods.eth_estimateGas, [
|
|
159
152
|
transaction,
|
|
160
153
|
block,
|
|
161
154
|
]);
|
|
@@ -164,7 +157,7 @@ export class EthExecutionClient {
|
|
|
164
157
|
transaction: GenericTransaction,
|
|
165
158
|
block: BlockNumberOrTag,
|
|
166
159
|
): Promise<AccessListResult> {
|
|
167
|
-
return await this.
|
|
160
|
+
return await this.rpc.call(EthMethods.eth_createAccessList, [
|
|
168
161
|
transaction,
|
|
169
162
|
block,
|
|
170
163
|
]);
|
|
@@ -173,36 +166,33 @@ export class EthExecutionClient {
|
|
|
173
166
|
payload: EthSimulatePayload,
|
|
174
167
|
blockTag: BlockNumberOrTagOrHash,
|
|
175
168
|
): Promise<EthSimulateResult> {
|
|
176
|
-
return await this.
|
|
177
|
-
payload,
|
|
178
|
-
blockTag,
|
|
179
|
-
]);
|
|
169
|
+
return await this.rpc.call(EthMethods.eth_simulateV1, [payload, blockTag]);
|
|
180
170
|
}
|
|
181
171
|
// eth/client
|
|
182
172
|
async eth_chainId(): Promise<Uint> {
|
|
183
|
-
return await this.
|
|
173
|
+
return await this.rpc.call(EthMethods.eth_chainId, []);
|
|
184
174
|
}
|
|
185
175
|
async eth_syncing(): Promise<SyncingStatus> {
|
|
186
|
-
return await this.
|
|
176
|
+
return await this.rpc.call(EthMethods.eth_syncing, []);
|
|
187
177
|
}
|
|
188
178
|
async eth_coinbase(): Promise<Address> {
|
|
189
|
-
return await this.
|
|
179
|
+
return await this.rpc.call(EthMethods.eth_coinbase, []);
|
|
190
180
|
}
|
|
191
181
|
async eth_accounts(): Promise<Addresses> {
|
|
192
|
-
return await this.
|
|
182
|
+
return await this.rpc.call(EthMethods.eth_accounts, []);
|
|
193
183
|
}
|
|
194
184
|
async eth_blockNumber(): Promise<Uint> {
|
|
195
|
-
return await this.
|
|
185
|
+
return await this.rpc.call(EthMethods.eth_blockNumber, []);
|
|
196
186
|
}
|
|
197
187
|
async net_version(): Promise<UintDecimal> {
|
|
198
|
-
return await this.
|
|
188
|
+
return await this.rpc.call(EthMethods.net_version, []);
|
|
199
189
|
}
|
|
200
190
|
// eth/block
|
|
201
191
|
async eth_getBlockByHash(
|
|
202
192
|
blockHash: Hash32,
|
|
203
193
|
hydratedTransactions: boolean,
|
|
204
194
|
): Promise<NotFound | Block> {
|
|
205
|
-
return await this.
|
|
195
|
+
return await this.rpc.call(EthMethods.eth_getBlockByHash, [
|
|
206
196
|
blockHash,
|
|
207
197
|
hydratedTransactions,
|
|
208
198
|
]);
|
|
@@ -211,7 +201,7 @@ export class EthExecutionClient {
|
|
|
211
201
|
block: BlockNumberOrTag,
|
|
212
202
|
hydratedTransactions: boolean,
|
|
213
203
|
): Promise<NotFound | Block> {
|
|
214
|
-
return await this.
|
|
204
|
+
return await this.rpc.call(EthMethods.eth_getBlockByNumber, [
|
|
215
205
|
block,
|
|
216
206
|
hydratedTransactions,
|
|
217
207
|
]);
|
|
@@ -219,15 +209,14 @@ export class EthExecutionClient {
|
|
|
219
209
|
async eth_getBlockTransactionCountByHash(
|
|
220
210
|
blockHash: Hash32,
|
|
221
211
|
): Promise<NotFound | Uint> {
|
|
222
|
-
return await this.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
);
|
|
212
|
+
return await this.rpc.call(EthMethods.eth_getBlockTransactionCountByHash, [
|
|
213
|
+
blockHash,
|
|
214
|
+
]);
|
|
226
215
|
}
|
|
227
216
|
async eth_getBlockTransactionCountByNumber(
|
|
228
217
|
block: BlockNumberOrTag,
|
|
229
218
|
): Promise<NotFound | Uint> {
|
|
230
|
-
return await this.
|
|
219
|
+
return await this.rpc.call(
|
|
231
220
|
EthMethods.eth_getBlockTransactionCountByNumber,
|
|
232
221
|
[block],
|
|
233
222
|
);
|
|
@@ -235,41 +224,41 @@ export class EthExecutionClient {
|
|
|
235
224
|
async eth_getUncleCountByBlockHash(
|
|
236
225
|
blockHash: Hash32,
|
|
237
226
|
): Promise<NotFound | Uint> {
|
|
238
|
-
return await this.
|
|
227
|
+
return await this.rpc.call(EthMethods.eth_getUncleCountByBlockHash, [
|
|
239
228
|
blockHash,
|
|
240
229
|
]);
|
|
241
230
|
}
|
|
242
231
|
async eth_getUncleCountByBlockNumber(
|
|
243
232
|
block: BlockNumberOrTag,
|
|
244
233
|
): Promise<NotFound | Uint> {
|
|
245
|
-
return await this.
|
|
234
|
+
return await this.rpc.call(EthMethods.eth_getUncleCountByBlockNumber, [
|
|
246
235
|
block,
|
|
247
236
|
]);
|
|
248
237
|
}
|
|
249
238
|
async eth_getBlockReceipts(
|
|
250
239
|
block: BlockNumberOrTagOrHash,
|
|
251
240
|
): Promise<NotFound | ReceiptInfo[]> {
|
|
252
|
-
return await this.
|
|
241
|
+
return await this.rpc.call(EthMethods.eth_getBlockReceipts, [block]);
|
|
253
242
|
}
|
|
254
243
|
// debug_*
|
|
255
244
|
async debug_getRawHeader(block: BlockNumberOrTag): Promise<Bytes> {
|
|
256
245
|
// RPL-encoded header
|
|
257
|
-
return await this.
|
|
246
|
+
return await this.rpc.call(DebugMethods.debug_getRawHeader, [block]);
|
|
258
247
|
}
|
|
259
248
|
async debug_getRawBlock(block: BlockNumberOrTag): Promise<Bytes> {
|
|
260
249
|
// RPL-encoded block
|
|
261
|
-
return await this.
|
|
250
|
+
return await this.rpc.call(DebugMethods.debug_getRawBlock, [block]);
|
|
262
251
|
}
|
|
263
252
|
async debug_getRawTransaction(transactionHash: Hash32): Promise<Bytes> {
|
|
264
253
|
// EIP-2718 binary-encoded transactions
|
|
265
|
-
return await this.
|
|
254
|
+
return await this.rpc.call(DebugMethods.debug_getRawTransaction, [
|
|
266
255
|
transactionHash,
|
|
267
256
|
]);
|
|
268
257
|
}
|
|
269
258
|
async debug_getRawReceipts(block: BlockNumberOrTag): Promise<Bytes[]> {
|
|
270
|
-
return await this.
|
|
259
|
+
return await this.rpc.call(DebugMethods.debug_getRawReceipts, [block]);
|
|
271
260
|
}
|
|
272
261
|
async debug_getBadBlocks(): Promise<BadBlock[]> {
|
|
273
|
-
return await this.
|
|
262
|
+
return await this.rpc.call(DebugMethods.debug_getBadBlocks, []);
|
|
274
263
|
}
|
|
275
264
|
}
|
package/src/index.ts
CHANGED
package/src/mev-api.ts
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { EthExecutionClient } from "./eth-api";
|
|
2
|
+
|
|
3
|
+
export class EthFlashbotsClient extends EthExecutionClient {
|
|
4
|
+
constructor(url: string) {
|
|
5
|
+
super(url);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
getFlashbotsHeader(
|
|
9
|
+
address: Address,
|
|
10
|
+
signature: Bytes32,
|
|
11
|
+
): Record<string, string> {
|
|
12
|
+
return {
|
|
13
|
+
"X-Flashbots-Signature": `${address}:${signature}`,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
async eth_sendBundle(
|
|
17
|
+
sendBundleParams: EthSendBundleParams,
|
|
18
|
+
signature?: Bytes32,
|
|
19
|
+
sender?: Address,
|
|
20
|
+
): Promise<EthSendBundleResult> {
|
|
21
|
+
if (signature && sender) {
|
|
22
|
+
return this.rpc.call(
|
|
23
|
+
FlashbotsMethods.eth_sendBundle,
|
|
24
|
+
[sendBundleParams],
|
|
25
|
+
this.getFlashbotsHeader(sender, signature),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
return await this.rpc.call(FlashbotsMethods.eth_sendBundle, [
|
|
29
|
+
sendBundleParams,
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
async eth_callBundle(
|
|
33
|
+
callBundleParams: EthCallBundleParams,
|
|
34
|
+
): Promise<EthCallBundleResult> {
|
|
35
|
+
return await this.rpc.call(FlashbotsMethods.eth_callBundle, [
|
|
36
|
+
callBundleParams,
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
async mev_sendBundle(
|
|
40
|
+
sendBundleParams: MevSendBundleParams,
|
|
41
|
+
): Promise<MevSendBundleResult> {
|
|
42
|
+
return await this.rpc.call(FlashbotsMethods.mev_sendBundle, [
|
|
43
|
+
sendBundleParams,
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
async mev_simBundle(
|
|
47
|
+
simBundleParams: MevSimBundleParams,
|
|
48
|
+
parentBlock?: { parentBlock: Hash32 },
|
|
49
|
+
): Promise<MevSimBundleResult> {
|
|
50
|
+
return await this.rpc.call(FlashbotsMethods.mev_simBundle, [
|
|
51
|
+
simBundleParams,
|
|
52
|
+
parentBlock,
|
|
53
|
+
]);
|
|
54
|
+
}
|
|
55
|
+
async eth_cancelBundle(
|
|
56
|
+
cancelParams: EthCancelBundleParams,
|
|
57
|
+
): Promise<EthCancelBundleResult> {
|
|
58
|
+
return await this.rpc.call(FlashbotsMethods.eth_cancelBundle, [
|
|
59
|
+
cancelParams,
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
async eth_sendPrivateTransaction(
|
|
63
|
+
sendPrivateTransactionParams: EthSendPrivateTransactionParams,
|
|
64
|
+
): Promise<EthSendPrivateTransactionResult> {
|
|
65
|
+
return await this.rpc.call(FlashbotsMethods.eth_sendPrivateTransaction, [
|
|
66
|
+
sendPrivateTransactionParams,
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
async eth_sendPrivateRawTransaction(
|
|
70
|
+
sendPrivateRawTransactionParams: EthSendPrivateRawTransactionParams,
|
|
71
|
+
): Promise<EthSendPrivateRawTransactionResult> {
|
|
72
|
+
return await this.rpc.call(FlashbotsMethods.eth_sendPrivateRawTransaction, [
|
|
73
|
+
sendPrivateRawTransactionParams,
|
|
74
|
+
]);
|
|
75
|
+
}
|
|
76
|
+
async eth_cancelPrivateTransaction(
|
|
77
|
+
cancelPrivateTransactionParams: EthCancelPrivateTransactioParams,
|
|
78
|
+
): Promise<EthCancelPrivateTransactionResult> {
|
|
79
|
+
return await this.rpc.call(FlashbotsMethods.eth_cancelPrivateTransaction, [
|
|
80
|
+
cancelPrivateTransactionParams,
|
|
81
|
+
]);
|
|
82
|
+
}
|
|
83
|
+
async flashbots_getFeeRefundTotalsByRecipient(
|
|
84
|
+
params: GetFeeRefundTotalsByRecipientParams,
|
|
85
|
+
): Promise<GetFeeRefundTotalsByRecipientResult> {
|
|
86
|
+
return await this.rpc.call(
|
|
87
|
+
FlashbotsMethods.flashbots_getFeeRefundTotalsByRecipient,
|
|
88
|
+
[params],
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
async flashbots_getFeeRefundsByRecipient(
|
|
92
|
+
params: GetFeeRefundsByRecipientParams,
|
|
93
|
+
): Promise<GetFeeRefundsByRecipientResult> {
|
|
94
|
+
return await this.rpc.call(
|
|
95
|
+
FlashbotsMethods.flashbots_getFeeRefundsByRecipient,
|
|
96
|
+
[params],
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
async flashbots_getFeeRefundsByBundle(
|
|
100
|
+
params: GetFeeRefundsByBundleParams,
|
|
101
|
+
): Promise<GetFeeRefundsByBundleResult> {
|
|
102
|
+
return await this.rpc.call(
|
|
103
|
+
FlashbotsMethods.flashbots_getFeeRefundsByBundle,
|
|
104
|
+
[params],
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
async flashbots_getFeeRefundsByBlock(
|
|
108
|
+
params: GetFeeRefundsByBlockParams,
|
|
109
|
+
): Promise<GetFeeRefundsByBlockResult> {
|
|
110
|
+
return await this.rpc.call(
|
|
111
|
+
FlashbotsMethods.flashbots_getFeeRefundsByBlock,
|
|
112
|
+
[params],
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
async flashbots_setFeeRefundRecipient(
|
|
116
|
+
user: Address,
|
|
117
|
+
delegate: Address,
|
|
118
|
+
): Promise<{ from: Address; to: Address }> {
|
|
119
|
+
return await this.rpc.call(
|
|
120
|
+
FlashbotsMethods.flashbots_setFeeRefundRecipient,
|
|
121
|
+
[user, delegate],
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
async buildernet_getDelayedRefunds(
|
|
125
|
+
params: GetDelayedRefundsParams,
|
|
126
|
+
): Promise<GetDelayedRefundsResult> {
|
|
127
|
+
return await this.rpc.call(FlashbotsMethods.buildernet_getDelayedRefunds, [
|
|
128
|
+
params,
|
|
129
|
+
]);
|
|
130
|
+
}
|
|
131
|
+
async buildernet_getDelayedRefundTotalsByRecipient(
|
|
132
|
+
params: GetDelayedRefundTotalsByRecipientParams,
|
|
133
|
+
): Promise<GetDelayedRefundTotalsByRecipientResult> {
|
|
134
|
+
return await this.rpc.call(
|
|
135
|
+
FlashbotsMethods.buildernet_getDelayedRefundTotalsByRecipient,
|
|
136
|
+
[params],
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
async flashbots_getMevRefundTotalByRecipient(
|
|
140
|
+
user: Address,
|
|
141
|
+
): Promise<{ total: Hex }> {
|
|
142
|
+
return await this.rpc.call(
|
|
143
|
+
FlashbotsMethods.flashbots_getMevRefundTotalByRecipient,
|
|
144
|
+
[user],
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
async flashbots_getMevRefundTotalBySender(
|
|
148
|
+
sender: Address,
|
|
149
|
+
): Promise<{ total: Hex }> {
|
|
150
|
+
return await this.rpc.call(
|
|
151
|
+
FlashbotsMethods.flashbots_getMevRefundTotalBySender,
|
|
152
|
+
[sender],
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -27,8 +27,8 @@ declare global {
|
|
|
27
27
|
export interface ExecutionPayloadV1 {
|
|
28
28
|
parentHash: Hash32;
|
|
29
29
|
feeRecipient: Address;
|
|
30
|
-
stateRoot:
|
|
31
|
-
receiptsRoot:
|
|
30
|
+
stateRoot: Bytes32;
|
|
31
|
+
receiptsRoot: Bytes32;
|
|
32
32
|
logsBloom: Bytes256;
|
|
33
33
|
prevRandao: Bytes32;
|
|
34
34
|
blockNumber: Uint64;
|
|
@@ -49,8 +49,8 @@ declare global {
|
|
|
49
49
|
export interface ExecutionPayloadV2 {
|
|
50
50
|
parentHash: Hash32;
|
|
51
51
|
feeRecipient: Address;
|
|
52
|
-
stateRoot:
|
|
53
|
-
receiptsRoot:
|
|
52
|
+
stateRoot: Bytes32;
|
|
53
|
+
receiptsRoot: Bytes32;
|
|
54
54
|
logsBloom: Bytes256;
|
|
55
55
|
prevRandao: Bytes32;
|
|
56
56
|
blockNumber: Uint64;
|
|
@@ -66,8 +66,8 @@ declare global {
|
|
|
66
66
|
export interface ExecutionPayloadV3 {
|
|
67
67
|
parentHash: Hash32;
|
|
68
68
|
feeRecipient: Address;
|
|
69
|
-
stateRoot:
|
|
70
|
-
receiptsRoot:
|
|
69
|
+
stateRoot: Bytes32;
|
|
70
|
+
receiptsRoot: Bytes32;
|
|
71
71
|
logsBloom: Bytes256;
|
|
72
72
|
prevRandao: Bytes32;
|
|
73
73
|
blockNumber: Uint64;
|
|
@@ -85,8 +85,8 @@ declare global {
|
|
|
85
85
|
export interface ExecutionPayloadV4 {
|
|
86
86
|
parentHash: Hash32;
|
|
87
87
|
feeRecipient: Address;
|
|
88
|
-
stateRoot:
|
|
89
|
-
receiptsRoot:
|
|
88
|
+
stateRoot: Bytes32;
|
|
89
|
+
receiptsRoot: Bytes32;
|
|
90
90
|
logsBloom: Bytes256;
|
|
91
91
|
prevRandao: Bytes32;
|
|
92
92
|
blockNumber: Uint64;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
export enum FlashbotsMethods {
|
|
3
|
+
eth_sendBundle = "eth_sendBundle",
|
|
4
|
+
mev_sendBundle = "mev_sendBundle",
|
|
5
|
+
eth_callBundle = "eth_callBundle",
|
|
6
|
+
eth_cancelBundle = "eth_cancelBundle",
|
|
7
|
+
mev_simBundle = "mev_simBundle",
|
|
8
|
+
eth_sendPrivateTransaction = "eth_sendPrivateTransaction",
|
|
9
|
+
eth_sendPrivateRawTransaction = "eth_sendPrivateRawTransaction",
|
|
10
|
+
eth_cancelPrivateTransaction = "eth_cancelPrivateTransaction",
|
|
11
|
+
|
|
12
|
+
flashbots_getFeeRefundTotalsByRecipient = "flashbots_getFeeRefundTotalsByRecipient",
|
|
13
|
+
flashbots_getFeeRefundsByRecipient = "flashbots_getFeeRefundsByRecipient",
|
|
14
|
+
flashbots_getFeeRefundsByBlock = "flashbots_getFeeRefundsByBlock",
|
|
15
|
+
flashbots_getFeeRefundsByBundle = "flashbots_getFeeRefundsByBundle",
|
|
16
|
+
flashbots_setFeeRefundRecipient = "flashbots_setFeeRefundRecipient",
|
|
17
|
+
buildernet_getDelayedRefunds = "buildernet_getDelayedRefunds",
|
|
18
|
+
buildernet_getDelayedRefundTotalsByRecipient = "buildernet_getDelayedRefundTotalsByRecipient",
|
|
19
|
+
flashbots_getMevRefundTotalByRecipient = "flashbots_getMevRefundTotalByRecipient",
|
|
20
|
+
flashbots_getMevRefundTotalBySender = "flashbots_getMevRefundTotalBySender",
|
|
21
|
+
}
|
|
22
|
+
export enum BuilderNetMethods {
|
|
23
|
+
eth_sendBundle = "eth_sendBundle",
|
|
24
|
+
eth_sendRawTransaction = "eth_sendRawTransaction",
|
|
25
|
+
buildernet_getFeeRefundTotalsByRecipient = "buildernet_getFeeRefundTotalsByRecipient",
|
|
26
|
+
buildernet_getFeeRefundsByRecipient = "buildernet_getFeeRefundsByRecipient",
|
|
27
|
+
buildernet_getFeeRefundsByBlock = "buildernet_getFeeRefundsByBlock",
|
|
28
|
+
buildernet_getFeeRefundsByBundle = "buildernet_getFeeRefundsByBundle",
|
|
29
|
+
buildernet_setFeeRefundRecipient = "buildernet_setFeeRefundRecipient",
|
|
30
|
+
buildernet_getDelayedRefunds = "buildernet_getDelayedRefunds",
|
|
31
|
+
buildernet_getDelayedRefundTotalsByRecipient = "buildernet_getDelayedRefundTotalsByRecipient",
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { };
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
export type GetDelayedRefundTotalsByRecipientParams = {
|
|
3
|
+
recipient: Address;
|
|
4
|
+
blockRangeFrom?: Hex;
|
|
5
|
+
blockRangeTo?: Hex;
|
|
6
|
+
};
|
|
7
|
+
export type GetDelayedRefundTotalsByRecipientResult = {
|
|
8
|
+
pending: Hex;
|
|
9
|
+
received: Hex;
|
|
10
|
+
indexedUpTo: Hex;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type GetDelayedRefundsParams = {
|
|
14
|
+
recipient: Address;
|
|
15
|
+
blockRangeFrom?: Hex;
|
|
16
|
+
blockRangeTo?: Hex;
|
|
17
|
+
cursor?: Hex;
|
|
18
|
+
hash?: Hash32;
|
|
19
|
+
};
|
|
20
|
+
export type GetDelayedRefundsResult = {
|
|
21
|
+
refunds: Refund[];
|
|
22
|
+
nextCursor: Hex;
|
|
23
|
+
indexedUpTo: Hex;
|
|
24
|
+
};
|
|
25
|
+
export type GetFeeRefundsByBlockParams = {
|
|
26
|
+
block_number: Hex;
|
|
27
|
+
};
|
|
28
|
+
export type GetFeeRefundsByBlockResult = unknown;
|
|
29
|
+
export type GetFeeRefundsByBundleParams = {
|
|
30
|
+
bundle_hash: Hex;
|
|
31
|
+
};
|
|
32
|
+
export type GetFeeRefundsByBundleResult = unknown;
|
|
33
|
+
export type GetFeeRefundsByRecipientParams = {
|
|
34
|
+
recipient: Address;
|
|
35
|
+
cursor?: Hex;
|
|
36
|
+
};
|
|
37
|
+
export type Refund = {
|
|
38
|
+
hash: Hex;
|
|
39
|
+
amount: Hex;
|
|
40
|
+
blockNumber: Hex;
|
|
41
|
+
status: "pending" | "received";
|
|
42
|
+
recipient: Address;
|
|
43
|
+
};
|
|
44
|
+
export type GetFeeRefundsByRecipientResult = {
|
|
45
|
+
refunds: Refund[];
|
|
46
|
+
cursor: string;
|
|
47
|
+
};
|
|
48
|
+
export type GetFeeRefundTotalsByRecipientParams = {
|
|
49
|
+
recipient: Address;
|
|
50
|
+
};
|
|
51
|
+
export type GetFeeRefundTotalsByRecipientResult = {
|
|
52
|
+
pending: Hex;
|
|
53
|
+
received: Hex;
|
|
54
|
+
maxBlockNumber: Hex;
|
|
55
|
+
};
|
|
56
|
+
export type EthCancelPrivateTransactioParams = {
|
|
57
|
+
txHash: Hex;
|
|
58
|
+
};
|
|
59
|
+
export type EthCancelPrivateTransactionResult = boolean;
|
|
60
|
+
|
|
61
|
+
export type EthSendPrivateRawTransactionParams = {
|
|
62
|
+
// String, raw signed transaction
|
|
63
|
+
tx: Hex;
|
|
64
|
+
preferences?: {
|
|
65
|
+
// Sends transactions to all registered block builders, sets MEV-Share revenue share to 50%
|
|
66
|
+
fast: boolean;
|
|
67
|
+
privacy?: {
|
|
68
|
+
hints?: BundleHints;
|
|
69
|
+
builders?: Builders[];
|
|
70
|
+
};
|
|
71
|
+
validity?: {
|
|
72
|
+
refund?: Array<{ address: Address; percent: number }>;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export type EthSendPrivateRawTransactionResult = Hash32;
|
|
77
|
+
|
|
78
|
+
export type EthSendPrivateTransactionParams = {
|
|
79
|
+
tx: Hex;
|
|
80
|
+
maxBlockNumber: Hex;
|
|
81
|
+
preferences?: {
|
|
82
|
+
// Sends transactions to all registered block builders, sets MEV-Share revenue share to 50%
|
|
83
|
+
fast: boolean;
|
|
84
|
+
privacy?: {
|
|
85
|
+
hints?: BundleHints;
|
|
86
|
+
builders?: Builders[];
|
|
87
|
+
};
|
|
88
|
+
validity?: {
|
|
89
|
+
refund?: Array<{ address: Address; percent: number }>;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
export type EthSendPrivateTransactionResult = Hash32;
|
|
94
|
+
export type EthCancelBundleParams = {
|
|
95
|
+
replacementUuid: string;
|
|
96
|
+
};
|
|
97
|
+
export type EthCancelBundleResult = unknown;
|
|
98
|
+
|
|
99
|
+
export type EthSendBundleParams = {
|
|
100
|
+
txs: Hex[];
|
|
101
|
+
blockNumber: Hex | "0x" | null; // 0x | null or missing field for next block only
|
|
102
|
+
// Replacing: send bundle with same replacementUuid to override previous one
|
|
103
|
+
// Canceling: send bundle with same replacementUuid and empty list of transactions to cancel
|
|
104
|
+
replacementUuid?: string;
|
|
105
|
+
revertingTxHashes?: Hex[];
|
|
106
|
+
minBlockNumber?: Hex;
|
|
107
|
+
maxBlockNumber?: Hex;
|
|
108
|
+
minFlashblockNumber?: Hex;
|
|
109
|
+
maxFlashblockNumber?: Hex;
|
|
110
|
+
minTimestamp?: number;
|
|
111
|
+
maxTimestamp?: number;
|
|
112
|
+
builders?: Builders[];
|
|
113
|
+
};
|
|
114
|
+
export type EthCallBundleParams = {
|
|
115
|
+
txs: Hex[];
|
|
116
|
+
blockNumber: Hex;
|
|
117
|
+
stateBlockNumber: string | "latest";
|
|
118
|
+
timestamp: number;
|
|
119
|
+
};
|
|
120
|
+
export type MevSendBundleParams = {
|
|
121
|
+
version: "v0.1";
|
|
122
|
+
inclusion: Inclusion;
|
|
123
|
+
body: BundleBody;
|
|
124
|
+
validity?: BundleValidity;
|
|
125
|
+
privacy?: BundlePrivacy;
|
|
126
|
+
};
|
|
127
|
+
export type MevSimBundleParams = {
|
|
128
|
+
version: "beta-1";
|
|
129
|
+
inclusion: Inclusion;
|
|
130
|
+
body: BundleBody;
|
|
131
|
+
validity: BundleValidity;
|
|
132
|
+
privacy?: BundlePrivacy;
|
|
133
|
+
metadata?: BundleMetadata;
|
|
134
|
+
simOptions?: BundleSimOptions;
|
|
135
|
+
};
|
|
136
|
+
export type Inclusion = {
|
|
137
|
+
block: string;
|
|
138
|
+
maxBlock?: string;
|
|
139
|
+
};
|
|
140
|
+
export type BundleBody = Array<
|
|
141
|
+
| { hash: string } // tx hash
|
|
142
|
+
| { tx: string; canRevert: boolean } // signed tx
|
|
143
|
+
| { bundle: MevSendBundleParams[] }
|
|
144
|
+
>;
|
|
145
|
+
export type BundleValidity = {
|
|
146
|
+
refund?: Array<{ bodyIdx: number; percent: number }>;
|
|
147
|
+
refundConfig?: Array<{ address: string; percent: number }>;
|
|
148
|
+
};
|
|
149
|
+
export type BundlePrivacy = {
|
|
150
|
+
hints?: BundleHints[];
|
|
151
|
+
builders?: Builders[];
|
|
152
|
+
};
|
|
153
|
+
export type BundleMetadata = { originId?: string };
|
|
154
|
+
export type BundleSimOptions = {
|
|
155
|
+
parentBlock?: number | string; // Block used for simulation state. Defaults to latest block.
|
|
156
|
+
blockNumber?: number; // default = parentBlock.number + 1
|
|
157
|
+
coinbase?: string; // default = parentBlock.coinbase
|
|
158
|
+
timestamp?: number; // default = parentBlock.timestamp + 12
|
|
159
|
+
gasLimit?: number; // default = parentBlock.gasLimit
|
|
160
|
+
baseFee?: bigint; // default = parentBlock.baseFeePerGas
|
|
161
|
+
timeout?: number; // default = 5 (defined in seconds)
|
|
162
|
+
};
|
|
163
|
+
export type EthSendBundleResult = { bundleHash: Hex; smart: boolean };
|
|
164
|
+
export type MevSendBundleResult = { bundleHash: Hex };
|
|
165
|
+
export type BundleHints =
|
|
166
|
+
| "calldata"
|
|
167
|
+
| "contract_address"
|
|
168
|
+
| "logs"
|
|
169
|
+
| "function_selector"
|
|
170
|
+
| "hash"
|
|
171
|
+
| "tx_hash";
|
|
172
|
+
|
|
173
|
+
export type EthCallBundleResult = {
|
|
174
|
+
bundleGasPrice: Uint;
|
|
175
|
+
bundleHash: Hash32;
|
|
176
|
+
coinbaseDiff: Uint;
|
|
177
|
+
ethSentToCoinbase: Uint;
|
|
178
|
+
gasFees: Uint;
|
|
179
|
+
results: Array<{
|
|
180
|
+
coinbaseDiff: Uint;
|
|
181
|
+
ethSentToCoinbase: Uint;
|
|
182
|
+
fromAddress: Address;
|
|
183
|
+
gasFees: Uint;
|
|
184
|
+
gasPrice: Uint;
|
|
185
|
+
gasUsed: number;
|
|
186
|
+
toAddress: Address;
|
|
187
|
+
txHash: Hash32;
|
|
188
|
+
value: Hex;
|
|
189
|
+
}>;
|
|
190
|
+
stateBlockNumber: number;
|
|
191
|
+
totalGasUsed: number;
|
|
192
|
+
};
|
|
193
|
+
export type MevSimBundleResult = {
|
|
194
|
+
success: boolean;
|
|
195
|
+
error?: string;
|
|
196
|
+
stateBlock: Hex;
|
|
197
|
+
mevGasPrice: Hex;
|
|
198
|
+
profit: Hex;
|
|
199
|
+
refundableValue: Hex;
|
|
200
|
+
gasUsed: Hex;
|
|
201
|
+
logs?: Array<{
|
|
202
|
+
txLogs?: Log[];
|
|
203
|
+
bundleLogs?: MevSimBundleResult[];
|
|
204
|
+
}>;
|
|
205
|
+
};
|
|
206
|
+
export type Builders =
|
|
207
|
+
| "default"
|
|
208
|
+
| "flashbots"
|
|
209
|
+
| "f1b.io"
|
|
210
|
+
| "rsync"
|
|
211
|
+
| "beaverbuild.org"
|
|
212
|
+
| "builder0x69"
|
|
213
|
+
| "Titan"
|
|
214
|
+
| "EigenPhi"
|
|
215
|
+
| "boba-builder"
|
|
216
|
+
| "Gambit"
|
|
217
|
+
| "payload"
|
|
218
|
+
| "Loki"
|
|
219
|
+
| "BuildAI"
|
|
220
|
+
| "JetBuilder"
|
|
221
|
+
| "tbuilder"
|
|
222
|
+
| "penguinbuild"
|
|
223
|
+
| "bobthebuilder"
|
|
224
|
+
| "BTCS"
|
|
225
|
+
| "bloXroute"
|
|
226
|
+
| "Blockbeelder"
|
|
227
|
+
| "Quasar"
|
|
228
|
+
| "Eureka";
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export { };
|