@asyncswap/eth-rpc 0.4.2 → 0.4.3
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/CHANGELOG.md +10 -2
- package/README.md +11 -2
- package/example.ts +4 -2
- package/package.json +2 -2
- package/src/engine-api.ts +25 -308
- package/src/eth-api.ts +21 -252
- package/src/mev-api.ts +23 -150
- package/src/types/debug/methods.d.ts +7 -7
- package/src/types/engine/methods.d.ts +115 -33
- package/src/types/eth/methods.d.ts +96 -43
- package/src/types/mev/methods.d.ts +70 -19
- package/CLAUDE.md +0 -111
package/src/eth-api.ts
CHANGED
|
@@ -1,264 +1,33 @@
|
|
|
1
1
|
import { JsonRpcClient } from "@asyncswap/jsonrpc";
|
|
2
2
|
|
|
3
|
+
export type EthRpcMethods<
|
|
4
|
+
T extends Record<string, { params: unknown[]; result: unknown }>,
|
|
5
|
+
> = {
|
|
6
|
+
[K in keyof T]: (...params: T[K]["params"]) => Promise<T[K]["result"]>;
|
|
7
|
+
};
|
|
8
|
+
|
|
3
9
|
export class EthExecutionClient {
|
|
4
10
|
rpc: JsonRpcClient;
|
|
11
|
+
headers: Record<string, string> = {};
|
|
5
12
|
|
|
6
13
|
constructor(url: string) {
|
|
7
14
|
this.rpc = new JsonRpcClient(url);
|
|
8
|
-
}
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
]);
|
|
17
|
-
}
|
|
18
|
-
async eth_getTransactionByBlockHashAndIndex(
|
|
19
|
-
blockHash: Hash32,
|
|
20
|
-
transactionIndex: Uint,
|
|
21
|
-
): Promise<NotFound | TransactionInfo> {
|
|
22
|
-
return await this.rpc.call(
|
|
23
|
-
EthMethods.eth_getTransactionByBlockHashAndIndex,
|
|
24
|
-
[blockHash, transactionIndex],
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
async eth_getTransactionReceipt(
|
|
28
|
-
transactionHash: Hash32,
|
|
29
|
-
): Promise<NotFound | ReceiptInfo> {
|
|
30
|
-
return await this.rpc.call(EthMethods.eth_getTransactionReceipt, [
|
|
31
|
-
transactionHash,
|
|
32
|
-
]);
|
|
16
|
+
return new Proxy(this, {
|
|
17
|
+
get: (_, method: string) => {
|
|
18
|
+
return (...params: unknown[]) =>
|
|
19
|
+
this.rpc.call(this.rpc.buildRequest(method, params), this.headers);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
33
22
|
}
|
|
34
23
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return
|
|
41
|
-
transaction,
|
|
42
|
-
]);
|
|
43
|
-
}
|
|
44
|
-
// eth/state
|
|
45
|
-
async eth_getBalance(
|
|
46
|
-
address: Address,
|
|
47
|
-
block: BlockNumberOrTagOrHash,
|
|
48
|
-
): Promise<Uint> {
|
|
49
|
-
return await this.rpc.call(EthMethods.eth_getBalance, [address, block]);
|
|
50
|
-
}
|
|
51
|
-
async eth_getStorageAt(
|
|
52
|
-
address: Address,
|
|
53
|
-
storageSlot: Bytes32,
|
|
54
|
-
block: BlockNumberOrTagOrHash,
|
|
55
|
-
): Promise<Bytes> {
|
|
56
|
-
return await this.rpc.call(EthMethods.eth_getStorageAt, [
|
|
57
|
-
address,
|
|
58
|
-
storageSlot,
|
|
59
|
-
block,
|
|
60
|
-
]);
|
|
61
|
-
}
|
|
62
|
-
async eth_getTransactionCount(
|
|
63
|
-
address: Address,
|
|
64
|
-
block: BlockNumberOrTagOrHash,
|
|
65
|
-
): Promise<Uint> {
|
|
66
|
-
return await this.rpc.call(EthMethods.eth_getTransactionCount, [
|
|
67
|
-
address,
|
|
68
|
-
block,
|
|
69
|
-
]);
|
|
70
|
-
}
|
|
71
|
-
async eth_getCode(
|
|
72
|
-
address: Address,
|
|
73
|
-
block: BlockNumberOrTagOrHash,
|
|
74
|
-
): Promise<Bytes> {
|
|
75
|
-
return await this.rpc.call(EthMethods.eth_getCode, [address, block]);
|
|
76
|
-
}
|
|
77
|
-
async eth_getProof(
|
|
78
|
-
address: Address,
|
|
79
|
-
storageKeys: Bytes32[],
|
|
80
|
-
block: BlockNumberOrTagOrHash,
|
|
81
|
-
): Promise<AccountProof> {
|
|
82
|
-
return await this.rpc.call(EthMethods.eth_getProof, [
|
|
83
|
-
address,
|
|
84
|
-
storageKeys,
|
|
85
|
-
block,
|
|
86
|
-
]);
|
|
87
|
-
}
|
|
88
|
-
// eth/sign
|
|
89
|
-
async eth_sign(address: Address, message: Bytes): Promise<Bytes65> {
|
|
90
|
-
return await this.rpc.call(EthMethods.eth_sign, [address, message]);
|
|
91
|
-
}
|
|
92
|
-
async eth_signTransaction(transaction: GenericTransaction): Promise<Bytes> {
|
|
93
|
-
return await this.rpc.call(EthMethods.eth_signTransaction, [transaction]);
|
|
94
|
-
}
|
|
95
|
-
// eth/filter
|
|
96
|
-
async eth_newFilter(filter: Filter): Promise<Uint> {
|
|
97
|
-
return await this.rpc.call(EthMethods.eth_newFilter, [filter]);
|
|
98
|
-
}
|
|
99
|
-
async eth_newBlockFilter(): Promise<Uint> {
|
|
100
|
-
return await this.rpc.call(EthMethods.eth_newBlockFilter, []);
|
|
101
|
-
}
|
|
102
|
-
async eth_newPendingTransactionFilter(): Promise<Uint> {
|
|
103
|
-
return await this.rpc.call(EthMethods.eth_newPendingTransactionFilter, []);
|
|
104
|
-
}
|
|
105
|
-
async eth_uninstallFilter(): Promise<Uint> {
|
|
106
|
-
return await this.rpc.call(EthMethods.eth_uninstallFilter, []);
|
|
107
|
-
}
|
|
108
|
-
async eth_getFilterChanges(): Promise<FilterResults> {
|
|
109
|
-
return await this.rpc.call(EthMethods.eth_getFilterChanges, []);
|
|
110
|
-
}
|
|
111
|
-
async eth_getFilterLogs(filterIdentifier: Uint): Promise<FilterResults> {
|
|
112
|
-
return await this.rpc.call(EthMethods.eth_getFilterLogs, [
|
|
113
|
-
filterIdentifier,
|
|
114
|
-
]);
|
|
115
|
-
}
|
|
116
|
-
async eth_getLogs(filter: Filter): Promise<FilterResults> {
|
|
117
|
-
return await this.rpc.call(EthMethods.eth_getLogs, [filter]);
|
|
118
|
-
}
|
|
119
|
-
// eth/feeMarket
|
|
120
|
-
async eth_gasPrice(): Promise<Uint> {
|
|
121
|
-
return await this.rpc.call(EthMethods.eth_gasPrice, []);
|
|
122
|
-
}
|
|
123
|
-
async eth_blobBaseFee(): Promise<Uint> {
|
|
124
|
-
return await this.rpc.call(EthMethods.eth_blobBaseFee, []);
|
|
125
|
-
}
|
|
126
|
-
async eth_maxPriorityFeePerGas(): Promise<Uint> {
|
|
127
|
-
return await this.rpc.call(EthMethods.eth_maxPriorityFeePerGas, []);
|
|
128
|
-
}
|
|
129
|
-
async eth_feeHistory(
|
|
130
|
-
blockCount: Uint,
|
|
131
|
-
newestBlock: BlockNumberOrTag,
|
|
132
|
-
rewardPercentiles: number[],
|
|
133
|
-
): Promise<FeeHistoryResults> {
|
|
134
|
-
return await this.rpc.call(EthMethods.eth_feeHistory, [
|
|
135
|
-
blockCount,
|
|
136
|
-
newestBlock,
|
|
137
|
-
rewardPercentiles,
|
|
138
|
-
]);
|
|
139
|
-
}
|
|
140
|
-
// eth/execute
|
|
141
|
-
async eth_call(
|
|
142
|
-
transaction: GenericTransaction,
|
|
143
|
-
block: BlockNumberOrTagOrHash,
|
|
144
|
-
): Promise<Bytes> {
|
|
145
|
-
return this.rpc.call(EthMethods.eth_call, [transaction, block]);
|
|
146
|
-
}
|
|
147
|
-
async eth_estimateGas(
|
|
148
|
-
transaction: GenericTransaction,
|
|
149
|
-
block: BlockNumberOrTag,
|
|
150
|
-
): Promise<Uint> {
|
|
151
|
-
return await this.rpc.call(EthMethods.eth_estimateGas, [
|
|
152
|
-
transaction,
|
|
153
|
-
block,
|
|
154
|
-
]);
|
|
155
|
-
}
|
|
156
|
-
async eth_createAccessList(
|
|
157
|
-
transaction: GenericTransaction,
|
|
158
|
-
block: BlockNumberOrTag,
|
|
159
|
-
): Promise<AccessListResult> {
|
|
160
|
-
return await this.rpc.call(EthMethods.eth_createAccessList, [
|
|
161
|
-
transaction,
|
|
162
|
-
block,
|
|
163
|
-
]);
|
|
164
|
-
}
|
|
165
|
-
async eth_simulateV1(
|
|
166
|
-
payload: EthSimulatePayload,
|
|
167
|
-
blockTag: BlockNumberOrTagOrHash,
|
|
168
|
-
): Promise<EthSimulateResult> {
|
|
169
|
-
return await this.rpc.call(EthMethods.eth_simulateV1, [payload, blockTag]);
|
|
170
|
-
}
|
|
171
|
-
// eth/client
|
|
172
|
-
async eth_chainId(): Promise<Uint> {
|
|
173
|
-
return await this.rpc.call(EthMethods.eth_chainId, []);
|
|
174
|
-
}
|
|
175
|
-
async eth_syncing(): Promise<SyncingStatus> {
|
|
176
|
-
return await this.rpc.call(EthMethods.eth_syncing, []);
|
|
177
|
-
}
|
|
178
|
-
async eth_coinbase(): Promise<Address> {
|
|
179
|
-
return await this.rpc.call(EthMethods.eth_coinbase, []);
|
|
180
|
-
}
|
|
181
|
-
async eth_accounts(): Promise<Addresses> {
|
|
182
|
-
return await this.rpc.call(EthMethods.eth_accounts, []);
|
|
183
|
-
}
|
|
184
|
-
async eth_blockNumber(): Promise<Uint> {
|
|
185
|
-
return await this.rpc.call(EthMethods.eth_blockNumber, []);
|
|
186
|
-
}
|
|
187
|
-
async net_version(): Promise<UintDecimal> {
|
|
188
|
-
return await this.rpc.call(EthMethods.net_version, []);
|
|
189
|
-
}
|
|
190
|
-
// eth/block
|
|
191
|
-
async eth_getBlockByHash(
|
|
192
|
-
blockHash: Hash32,
|
|
193
|
-
hydratedTransactions: boolean,
|
|
194
|
-
): Promise<NotFound | Block> {
|
|
195
|
-
return await this.rpc.call(EthMethods.eth_getBlockByHash, [
|
|
196
|
-
blockHash,
|
|
197
|
-
hydratedTransactions,
|
|
198
|
-
]);
|
|
199
|
-
}
|
|
200
|
-
async eth_getBlockByNumber(
|
|
201
|
-
block: BlockNumberOrTag,
|
|
202
|
-
hydratedTransactions: boolean,
|
|
203
|
-
): Promise<NotFound | Block> {
|
|
204
|
-
return await this.rpc.call(EthMethods.eth_getBlockByNumber, [
|
|
205
|
-
block,
|
|
206
|
-
hydratedTransactions,
|
|
207
|
-
]);
|
|
208
|
-
}
|
|
209
|
-
async eth_getBlockTransactionCountByHash(
|
|
210
|
-
blockHash: Hash32,
|
|
211
|
-
): Promise<NotFound | Uint> {
|
|
212
|
-
return await this.rpc.call(EthMethods.eth_getBlockTransactionCountByHash, [
|
|
213
|
-
blockHash,
|
|
214
|
-
]);
|
|
215
|
-
}
|
|
216
|
-
async eth_getBlockTransactionCountByNumber(
|
|
217
|
-
block: BlockNumberOrTag,
|
|
218
|
-
): Promise<NotFound | Uint> {
|
|
219
|
-
return await this.rpc.call(
|
|
220
|
-
EthMethods.eth_getBlockTransactionCountByNumber,
|
|
221
|
-
[block],
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
async eth_getUncleCountByBlockHash(
|
|
225
|
-
blockHash: Hash32,
|
|
226
|
-
): Promise<NotFound | Uint> {
|
|
227
|
-
return await this.rpc.call(EthMethods.eth_getUncleCountByBlockHash, [
|
|
228
|
-
blockHash,
|
|
229
|
-
]);
|
|
230
|
-
}
|
|
231
|
-
async eth_getUncleCountByBlockNumber(
|
|
232
|
-
block: BlockNumberOrTag,
|
|
233
|
-
): Promise<NotFound | Uint> {
|
|
234
|
-
return await this.rpc.call(EthMethods.eth_getUncleCountByBlockNumber, [
|
|
235
|
-
block,
|
|
236
|
-
]);
|
|
237
|
-
}
|
|
238
|
-
async eth_getBlockReceipts(
|
|
239
|
-
block: BlockNumberOrTagOrHash,
|
|
240
|
-
): Promise<NotFound | ReceiptInfo[]> {
|
|
241
|
-
return await this.rpc.call(EthMethods.eth_getBlockReceipts, [block]);
|
|
242
|
-
}
|
|
243
|
-
// debug_*
|
|
244
|
-
async debug_getRawHeader(block: BlockNumberOrTag): Promise<Bytes> {
|
|
245
|
-
// RPL-encoded header
|
|
246
|
-
return await this.rpc.call(DebugMethods.debug_getRawHeader, [block]);
|
|
247
|
-
}
|
|
248
|
-
async debug_getRawBlock(block: BlockNumberOrTag): Promise<Bytes> {
|
|
249
|
-
// RPL-encoded block
|
|
250
|
-
return await this.rpc.call(DebugMethods.debug_getRawBlock, [block]);
|
|
251
|
-
}
|
|
252
|
-
async debug_getRawTransaction(transactionHash: Hash32): Promise<Bytes> {
|
|
253
|
-
// EIP-2718 binary-encoded transactions
|
|
254
|
-
return await this.rpc.call(DebugMethods.debug_getRawTransaction, [
|
|
255
|
-
transactionHash,
|
|
256
|
-
]);
|
|
257
|
-
}
|
|
258
|
-
async debug_getRawReceipts(block: BlockNumberOrTag): Promise<Bytes[]> {
|
|
259
|
-
return await this.rpc.call(DebugMethods.debug_getRawReceipts, [block]);
|
|
260
|
-
}
|
|
261
|
-
async debug_getBadBlocks(): Promise<BadBlock[]> {
|
|
262
|
-
return await this.rpc.call(DebugMethods.debug_getBadBlocks, []);
|
|
24
|
+
setAuth(headers: Record<string, string>) {
|
|
25
|
+
this.headers = {
|
|
26
|
+
...this.headers,
|
|
27
|
+
...headers,
|
|
28
|
+
};
|
|
29
|
+
return this;
|
|
263
30
|
}
|
|
264
31
|
}
|
|
32
|
+
|
|
33
|
+
export interface EthExecutionClient extends EthRpcMethods<EthMethodsSpec> { }
|
package/src/mev-api.ts
CHANGED
|
@@ -1,155 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JsonRpcClient } from "@asyncswap/jsonrpc";
|
|
2
|
+
|
|
3
|
+
export type FlashbotsRpcMethods<
|
|
4
|
+
T extends Record<string, { params: unknown[]; result: unknown }>,
|
|
5
|
+
> = {
|
|
6
|
+
[M in keyof T]: (...params: T[M]["params"]) => Promise<T[M]["result"]>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export class FlashbotsClient {
|
|
10
|
+
rpc: JsonRpcClient;
|
|
11
|
+
private headers: Record<string, string> = {};
|
|
2
12
|
|
|
3
|
-
export class EthFlashbotsClient extends EthExecutionClient {
|
|
4
13
|
constructor(url: string) {
|
|
5
|
-
|
|
6
|
-
}
|
|
14
|
+
this.rpc = new JsonRpcClient(url);
|
|
7
15
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
);
|
|
16
|
+
return new Proxy(this, {
|
|
17
|
+
get: (_, method: string) => {
|
|
18
|
+
return (...params: unknown[]) =>
|
|
19
|
+
this.rpc.call(this.rpc.buildRequest(method, params), this.headers);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
154
22
|
}
|
|
23
|
+
|
|
24
|
+
// "X-Flashbots-Signature": `${sender}:${signature}`,
|
|
155
25
|
}
|
|
26
|
+
|
|
27
|
+
export interface FlashbotsClient
|
|
28
|
+
extends FlashbotsRpcMethods<FlashbotsMethodsSpec> { }
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare global {
|
|
2
|
-
export
|
|
3
|
-
debug_getRawHeader
|
|
4
|
-
debug_getRawBlock
|
|
5
|
-
debug_getRawTransaction
|
|
6
|
-
debug_getRawReceipts
|
|
7
|
-
debug_getBadBlocks
|
|
8
|
-
}
|
|
2
|
+
export type DebugMethods = {
|
|
3
|
+
debug_getRawHeader: { params: [BlockNumberOrTag]; result: Bytes };
|
|
4
|
+
debug_getRawBlock: { params: [BlockNumberOrTag]; result: Bytes };
|
|
5
|
+
debug_getRawTransaction: { params: [Hash32]; result: Bytes };
|
|
6
|
+
debug_getRawReceipts: { params: [BlockNumberOrTag]; result: Bytes[] };
|
|
7
|
+
debug_getBadBlocks: { params: []; result: BadBlock[] };
|
|
8
|
+
};
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export { };
|
|
@@ -1,42 +1,124 @@
|
|
|
1
1
|
declare global {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
export type EngineMethodsSpec = {
|
|
3
|
+
eth_blockNumber: { params: []; result: Uint };
|
|
4
|
+
eth_call: {
|
|
5
|
+
params: [GenericTransaction, BlockNumberOrTagOrHash];
|
|
6
|
+
result: Bytes;
|
|
7
|
+
};
|
|
8
|
+
eth_chainId: { params: []; result: Uint };
|
|
9
|
+
eth_getCode: { params: [Address, BlockNumberOrTagOrHash]; result: Bytes };
|
|
10
|
+
eth_getBlockByHash: { params: [Hash32, boolean]; result: NotFound | Block };
|
|
11
|
+
eth_getBlockByNumber: {
|
|
12
|
+
params: [BlockNumberOrTag, boolean];
|
|
13
|
+
result: NotFound | Block;
|
|
14
|
+
};
|
|
15
|
+
eth_getLogs: { params: [Filter]; result: FilterResults };
|
|
16
|
+
eth_sendRawTransaction: { params: [Bytes]; result: Hash32 };
|
|
17
|
+
eth_syncing: { params: []; result: SyncingStatus };
|
|
13
18
|
// engine/blob
|
|
14
|
-
engine_getBlobsV1
|
|
15
|
-
engine_getBlobsV2
|
|
16
|
-
engine_getBlobsV3
|
|
19
|
+
engine_getBlobsV1: { params: [Hash32[]]; result: BlobAndProofV1[] };
|
|
20
|
+
engine_getBlobsV2: { params: [Hash32[]]; result: BlobAndProofV2[] };
|
|
21
|
+
engine_getBlobsV3: {
|
|
22
|
+
params: [Hash32[]];
|
|
23
|
+
result: Array<BlobAndProofV2[] | null> | null;
|
|
24
|
+
};
|
|
17
25
|
// engine/capabilities
|
|
18
|
-
engine_exchangeCapabilities
|
|
26
|
+
engine_exchangeCapabilities: { params: [string[]]; result: string[] };
|
|
19
27
|
// engine/forkchoice
|
|
20
|
-
engine_forkchoiceUpdatedV1
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
engine_forkchoiceUpdatedV1: {
|
|
29
|
+
params: [ForkchoiceStateV1, PayloadAttributesV1];
|
|
30
|
+
result: ForkchoiceUpdatedResponseV1;
|
|
31
|
+
};
|
|
32
|
+
engine_forkchoiceUpdatedV2: {
|
|
33
|
+
params: [ForkchoiceStateV1, PayloadAttributesV2];
|
|
34
|
+
result: ForkchoiceUpdatedResponseV1;
|
|
35
|
+
};
|
|
36
|
+
engine_forkchoiceUpdatedV3: {
|
|
37
|
+
params: [ForkchoiceStateV1, PayloadAttributesV3];
|
|
38
|
+
result: ForkchoiceUpdatedResponseV1;
|
|
39
|
+
};
|
|
23
40
|
// engine/payload
|
|
24
|
-
engine_newPayloadV1
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
engine_newPayloadV1: {
|
|
42
|
+
params: [ExecutionPayloadV1];
|
|
43
|
+
result: PayloadStatusV1;
|
|
44
|
+
};
|
|
45
|
+
engine_newPayloadV2: {
|
|
46
|
+
params: [ExecutionPayloadV1 | ExecutionPayloadV2];
|
|
47
|
+
result: PayloadStatusNoInvalidBlockHash;
|
|
48
|
+
};
|
|
49
|
+
engine_newPayloadV3: {
|
|
50
|
+
params: [ExecutionPayloadV3, Hash32[], Hash32];
|
|
51
|
+
result: PayloadStatusNoInvalidBlockHash;
|
|
52
|
+
};
|
|
53
|
+
engine_newPayloadV4: {
|
|
54
|
+
params: [ExecutionPayloadV3, Hash32[], Hash32, Bytes[]];
|
|
55
|
+
result: PayloadStatusNoInvalidBlockHash;
|
|
56
|
+
};
|
|
57
|
+
engine_getPayloadV1: { params: [Bytes8]; result: ExecutionPayloadV1 };
|
|
58
|
+
engine_getPayloadV2: {
|
|
59
|
+
params: [Bytes8];
|
|
60
|
+
result: {
|
|
61
|
+
executionPayload: ExecutionPayloadV1 | ExecutionPayloadV2;
|
|
62
|
+
blockValue: Uint256;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
engine_getPayloadV3: {
|
|
66
|
+
params: [Bytes8];
|
|
67
|
+
result: {
|
|
68
|
+
executionPayload: ExecutionPayloadV3;
|
|
69
|
+
blockValue: Uint256;
|
|
70
|
+
blobsBundle: BlobsBundleV1;
|
|
71
|
+
shouldOverrideBuilder: boolean;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
engine_getPayloadV4: {
|
|
75
|
+
params: [Bytes8];
|
|
76
|
+
result: {
|
|
77
|
+
executionPayload: ExecutionPayloadV3;
|
|
78
|
+
blockValue: Uint256;
|
|
79
|
+
blobsBundle: BlobsBundleV1;
|
|
80
|
+
shouldOverrideBuilder: boolean;
|
|
81
|
+
executionRequests: Bytes[];
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
engine_getPayloadV5: {
|
|
85
|
+
params: [Bytes8];
|
|
86
|
+
result: {
|
|
87
|
+
executionPayload: ExecutionPayloadV3;
|
|
88
|
+
blockValue: Uint256;
|
|
89
|
+
blobsBundle: BlobsBundleV2;
|
|
90
|
+
shouldOverrideBuilder: boolean;
|
|
91
|
+
executionRequests: Bytes[];
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
engine_getPayloadBodiesByHashV1: {
|
|
95
|
+
params: [Hash32[]];
|
|
96
|
+
result: ExecutionPayloadBodyV1[];
|
|
97
|
+
};
|
|
98
|
+
engine_getPayloadBodiesByRangeV1: {
|
|
99
|
+
params: [Uint64, Uint64];
|
|
100
|
+
result: ExecutionPayloadBodyV1[];
|
|
101
|
+
};
|
|
102
|
+
engine_newPayloadV5: {
|
|
103
|
+
params: [ExecutionPayloadV4, Hash32[], Hash32, Bytes[]];
|
|
104
|
+
result: PayloadStatusNoInvalidBlockHash;
|
|
105
|
+
};
|
|
106
|
+
engine_getPayloadV6: {
|
|
107
|
+
params: [Bytes8];
|
|
108
|
+
result: {
|
|
109
|
+
executionPayload: ExecutionPayloadV4;
|
|
110
|
+
blockValue: Uint256;
|
|
111
|
+
blobsBundle: BlobsBundleV2;
|
|
112
|
+
shouldOverrideBuilder: boolean;
|
|
113
|
+
executionRequests: Bytes[];
|
|
114
|
+
};
|
|
115
|
+
};
|
|
37
116
|
// engine/transition-configuration
|
|
38
|
-
engine_exchangeTransitionConfigurationV1
|
|
39
|
-
|
|
117
|
+
engine_exchangeTransitionConfigurationV1: {
|
|
118
|
+
params: [TransitionConfigurationV1];
|
|
119
|
+
result: TransitionConfigurationV1;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
40
122
|
}
|
|
41
123
|
|
|
42
124
|
export { };
|