@msaki/eth-rpc 0.2.0 → 0.2.2
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 +15 -1
- package/dist/beacon-api.d.ts +2 -0
- package/dist/beacon-api.d.ts.map +1 -0
- package/dist/beacon-api.js +1 -0
- package/dist/beacon-api.js.map +1 -0
- package/dist/debug-api.d.ts +10 -0
- package/dist/debug-api.d.ts.map +1 -0
- package/dist/debug-api.js +28 -0
- package/dist/debug-api.js.map +1 -0
- package/dist/engine-api.d.ts +61 -0
- package/dist/engine-api.d.ts.map +1 -0
- package/dist/engine-api.js +163 -0
- package/dist/engine-api.js.map +1 -0
- package/dist/{eth-methods.d.ts → eth-api.d.ts} +6 -43
- package/dist/eth-api.d.ts.map +1 -0
- package/dist/eth-api.js +204 -0
- package/dist/eth-api.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +15 -2
- package/src/engine-api.ts +254 -0
- package/src/eth-api.ts +275 -0
- package/src/index.ts +2 -2
- package/src/types/debug/methods.d.ts +11 -0
- package/src/types/engine/blob.d.ts +12 -0
- package/src/types/{forkchoice.d.ts → engine/forkchoice.d.ts} +0 -8
- package/src/types/engine/methods.d.ts +42 -0
- package/src/types/{engine.d.ts → engine/payload.d.ts} +0 -6
- package/src/types/engine/transition-configuration.d.ts +10 -0
- package/src/types/eth/methods.d.ts +55 -0
- package/dist/beacon-methods.d.ts +0 -2
- package/dist/beacon-methods.d.ts.map +0 -1
- package/dist/beacon-methods.js +0 -1
- package/dist/beacon-methods.js.map +0 -1
- package/dist/engine/index.d.ts +0 -2
- package/dist/engine/index.d.ts.map +0 -1
- package/dist/engine/index.js +0 -1
- package/dist/engine/index.js.map +0 -1
- package/dist/eth-methods.d.ts.map +0 -1
- package/dist/eth-methods.js +0 -230
- package/dist/eth-methods.js.map +0 -1
- package/src/beacon-methods.ts +0 -0
- package/src/engine/index.ts +0 -0
- package/src/eth-methods.ts +0 -295
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@msaki/eth-rpc",
|
|
3
|
+
"description": "A library for ethereum execution clients apis.",
|
|
3
4
|
"author": "Meek Msaki",
|
|
4
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.2",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"type": "module",
|
|
7
8
|
"main": "dist/index.js",
|
|
@@ -11,11 +12,23 @@
|
|
|
11
12
|
"dist",
|
|
12
13
|
"src"
|
|
13
14
|
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"eth",
|
|
17
|
+
"rpc",
|
|
18
|
+
"ethereum",
|
|
19
|
+
"engine-api",
|
|
20
|
+
"execution-apis",
|
|
21
|
+
"consensus"
|
|
22
|
+
],
|
|
23
|
+
"homepage": "https://github.com/mmsaki/eth-libs/tree/main/packages/eth-rpc",
|
|
14
24
|
"repository": {
|
|
15
25
|
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/mmsaki/libs.git",
|
|
26
|
+
"url": "git+https://github.com/mmsaki/eth-libs.git",
|
|
17
27
|
"directory": "packages/eth-rpc"
|
|
18
28
|
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/mmsaki/eth-libs/issues"
|
|
31
|
+
},
|
|
19
32
|
"publishConfig": {
|
|
20
33
|
"access": "public",
|
|
21
34
|
"directory": "dist"
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { initializeRpcClient, JsonRpcClient } from "@msaki/jsonrpc";
|
|
2
|
+
|
|
3
|
+
export class EngineExecutionClient {
|
|
4
|
+
private client: JsonRpcClient;
|
|
5
|
+
|
|
6
|
+
constructor(url: string, jwt_token: string) {
|
|
7
|
+
this.client = initializeRpcClient(url, jwt_token);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// eth/transaction
|
|
11
|
+
async eth_sendRawTransaction(transaction: Bytes): Promise<Hash32> {
|
|
12
|
+
return await this.client.call(EngineMethods.eth_sendRawTransaction, [
|
|
13
|
+
transaction,
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
16
|
+
// eth/state
|
|
17
|
+
async eth_getCode(
|
|
18
|
+
address: Address,
|
|
19
|
+
block: BlockNumberOrTagOrHash,
|
|
20
|
+
): Promise<Bytes> {
|
|
21
|
+
return await this.client.call(EngineMethods.eth_getCode, [address, block]);
|
|
22
|
+
}
|
|
23
|
+
async eth_getLogs(filter: Filter): Promise<FilterResults> {
|
|
24
|
+
return await this.client.call(EngineMethods.eth_getLogs, [filter]);
|
|
25
|
+
}
|
|
26
|
+
// eth/execute
|
|
27
|
+
async eth_call(
|
|
28
|
+
transaction: GenericTransaction,
|
|
29
|
+
block: BlockNumberOrTagOrHash,
|
|
30
|
+
): Promise<Bytes> {
|
|
31
|
+
return this.client.call(EngineMethods.eth_call, [transaction, block]);
|
|
32
|
+
}
|
|
33
|
+
// eth/client
|
|
34
|
+
async eth_chainId(): Promise<Uint> {
|
|
35
|
+
return await this.client.call(EngineMethods.eth_chainId, []);
|
|
36
|
+
}
|
|
37
|
+
async eth_syncing(): Promise<SyncingStatus> {
|
|
38
|
+
return await this.client.call(EngineMethods.eth_syncing, []);
|
|
39
|
+
}
|
|
40
|
+
async eth_blockNumber(): Promise<Uint> {
|
|
41
|
+
return await this.client.call(EngineMethods.eth_blockNumber, []);
|
|
42
|
+
}
|
|
43
|
+
// eth/block
|
|
44
|
+
async eth_getBlockByHash(
|
|
45
|
+
blockHash: Hash32,
|
|
46
|
+
hydratedTransactions: boolean,
|
|
47
|
+
): Promise<NotFound | Block> {
|
|
48
|
+
return await this.client.call(EngineMethods.eth_getBlockByHash, [
|
|
49
|
+
blockHash,
|
|
50
|
+
hydratedTransactions,
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
async eth_getBlockByNumber(
|
|
54
|
+
block: BlockNumberOrTag,
|
|
55
|
+
hydratedTransactions: boolean,
|
|
56
|
+
): Promise<NotFound | Block> {
|
|
57
|
+
return await this.client.call(EngineMethods.eth_getBlockByNumber, [
|
|
58
|
+
block,
|
|
59
|
+
hydratedTransactions,
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
// engine/blob
|
|
63
|
+
async engine_getBlobsV1(
|
|
64
|
+
blobedVersionedHashes: Hash32[],
|
|
65
|
+
): Promise<BlobAndProofV1[]> {
|
|
66
|
+
return await this.client.call(EngineMethods.engine_getBlobsV1, [
|
|
67
|
+
blobedVersionedHashes,
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
async engine_getBlobsV2(
|
|
71
|
+
blobedVersionedHashes: Hash32[],
|
|
72
|
+
): Promise<BlobAndProofV2[]> {
|
|
73
|
+
return await this.client.call(EngineMethods.engine_getBlobsV2, [
|
|
74
|
+
blobedVersionedHashes,
|
|
75
|
+
]);
|
|
76
|
+
}
|
|
77
|
+
async engine_getBlobsV3(
|
|
78
|
+
blobedVersionedHashes: Hash32[],
|
|
79
|
+
): Promise<Array<BlobAndProofV2[] | null> | null> {
|
|
80
|
+
return await this.client.call(EngineMethods.engine_getBlobsV2, [
|
|
81
|
+
blobedVersionedHashes,
|
|
82
|
+
]);
|
|
83
|
+
}
|
|
84
|
+
// engine/capabilities
|
|
85
|
+
async engine_exchangeCapabilities(
|
|
86
|
+
consensusClientMethods: string[],
|
|
87
|
+
): Promise<string[]> {
|
|
88
|
+
return await this.client.call(EngineMethods.engine_exchangeCapabilities, [
|
|
89
|
+
consensusClientMethods,
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
92
|
+
// engine/forkchoice
|
|
93
|
+
async engine_forkchoiceUpdatedV1(
|
|
94
|
+
forkchoiceState: ForkchoiceStateV1,
|
|
95
|
+
payloadAttribute: PayloadAttributesV1,
|
|
96
|
+
): Promise<ForkchoiceUpdatedResponseV1> {
|
|
97
|
+
return await this.client.call(EngineMethods.engine_forkchoiceUpdatedV1, [
|
|
98
|
+
forkchoiceState,
|
|
99
|
+
payloadAttribute,
|
|
100
|
+
]);
|
|
101
|
+
}
|
|
102
|
+
async engine_forkchoiceUpdatedV2(
|
|
103
|
+
forkchoiceState: ForkchoiceStateV1,
|
|
104
|
+
payloadAttribute: PayloadAttributesV2,
|
|
105
|
+
): Promise<ForkchoiceUpdatedResponseV1> {
|
|
106
|
+
return await this.client.call(EngineMethods.engine_forkchoiceUpdatedV2, [
|
|
107
|
+
forkchoiceState,
|
|
108
|
+
payloadAttribute,
|
|
109
|
+
]);
|
|
110
|
+
}
|
|
111
|
+
async engine_forkchoiceUpdatedV3(
|
|
112
|
+
forkchoiceState: ForkchoiceStateV1,
|
|
113
|
+
payloadAttribute: PayloadAttributesV3,
|
|
114
|
+
): Promise<ForkchoiceUpdatedResponseV1> {
|
|
115
|
+
return await this.client.call(EngineMethods.engine_forkchoiceUpdatedV3, [
|
|
116
|
+
forkchoiceState,
|
|
117
|
+
payloadAttribute,
|
|
118
|
+
]);
|
|
119
|
+
}
|
|
120
|
+
// engine/payload
|
|
121
|
+
async engine_newPayloadV1(
|
|
122
|
+
executionPayload: ExecutionPayloadV1,
|
|
123
|
+
): Promise<PayloadStatusV1> {
|
|
124
|
+
return await this.client.call(EngineMethods.engine_newPayloadV1, [
|
|
125
|
+
executionPayload,
|
|
126
|
+
]);
|
|
127
|
+
}
|
|
128
|
+
async engine_newPayloadV2(
|
|
129
|
+
executionPayload: ExecutionPayloadV1 | ExecutionPayloadV2,
|
|
130
|
+
): Promise<PayloadStatusNoInvalidBlockHash> {
|
|
131
|
+
return await this.client.call(EngineMethods.engine_newPayloadV2, [
|
|
132
|
+
executionPayload,
|
|
133
|
+
]);
|
|
134
|
+
}
|
|
135
|
+
async engine_newPayloadV3(
|
|
136
|
+
executionPayload: ExecutionPayloadV3,
|
|
137
|
+
expectedBlobVersionedHashes: Hash32[],
|
|
138
|
+
rootOfTheParentBeaconBlock: Hash32,
|
|
139
|
+
): Promise<PayloadStatusNoInvalidBlockHash> {
|
|
140
|
+
return await this.client.call(EngineMethods.engine_newPayloadV3, [
|
|
141
|
+
executionPayload,
|
|
142
|
+
expectedBlobVersionedHashes,
|
|
143
|
+
rootOfTheParentBeaconBlock,
|
|
144
|
+
]);
|
|
145
|
+
}
|
|
146
|
+
async engine_newPayloadV4(
|
|
147
|
+
executionPayload: ExecutionPayloadV3,
|
|
148
|
+
expectedBlobVersionedHashes: Hash32[],
|
|
149
|
+
rootOfTheParentBeaconBlock: Hash32,
|
|
150
|
+
executionRequests: Bytes[],
|
|
151
|
+
): Promise<PayloadStatusNoInvalidBlockHash> {
|
|
152
|
+
return await this.client.call(EngineMethods.engine_newPayloadV4, [
|
|
153
|
+
executionPayload,
|
|
154
|
+
expectedBlobVersionedHashes,
|
|
155
|
+
rootOfTheParentBeaconBlock,
|
|
156
|
+
executionRequests,
|
|
157
|
+
]);
|
|
158
|
+
}
|
|
159
|
+
async engine_getPayloadV1(payloadId: Bytes8): Promise<ExecutionPayloadV1> {
|
|
160
|
+
return await this.client.call(EngineMethods.engine_getPayloadV1, [
|
|
161
|
+
payloadId,
|
|
162
|
+
]);
|
|
163
|
+
}
|
|
164
|
+
async engine_getPayloadV2(payloadId: Bytes8): Promise<{
|
|
165
|
+
executionPayload: ExecutionPayloadV1 | ExecutionPayloadV2;
|
|
166
|
+
blockValue: Uint256;
|
|
167
|
+
}> {
|
|
168
|
+
return await this.client.call(EngineMethods.engine_getPayloadV2, [
|
|
169
|
+
payloadId,
|
|
170
|
+
]);
|
|
171
|
+
}
|
|
172
|
+
async engine_getPayloadV3(payloadId: Bytes8): Promise<{
|
|
173
|
+
executionPayload: ExecutionPayloadV3;
|
|
174
|
+
blockValue: Uint256;
|
|
175
|
+
blobsBundle: BlobsBundleV1;
|
|
176
|
+
shouldOverrideBuilder: boolean;
|
|
177
|
+
}> {
|
|
178
|
+
return await this.client.call(EngineMethods.engine_getPayloadV3, [
|
|
179
|
+
payloadId,
|
|
180
|
+
]);
|
|
181
|
+
}
|
|
182
|
+
async engine_getPayloadV4(payloadId: Bytes8): Promise<{
|
|
183
|
+
executionPayload: ExecutionPayloadV3;
|
|
184
|
+
blockValue: Uint256;
|
|
185
|
+
blobsBundle: BlobsBundleV1;
|
|
186
|
+
shouldOverrideBuilder: boolean;
|
|
187
|
+
executionRequests: Bytes[];
|
|
188
|
+
}> {
|
|
189
|
+
return await this.client.call(EngineMethods.engine_getPayloadV4, [
|
|
190
|
+
payloadId,
|
|
191
|
+
]);
|
|
192
|
+
}
|
|
193
|
+
async engine_getPayloadV5(payloadId: Bytes8): Promise<{
|
|
194
|
+
executionPayload: ExecutionPayloadV3;
|
|
195
|
+
blockValue: Uint256;
|
|
196
|
+
blobsBundle: BlobsBundleV2;
|
|
197
|
+
shouldOverrideBuilder: boolean;
|
|
198
|
+
executionRequests: Bytes[];
|
|
199
|
+
}> {
|
|
200
|
+
return await this.client.call(EngineMethods.engine_getPayloadV5, [
|
|
201
|
+
payloadId,
|
|
202
|
+
]);
|
|
203
|
+
}
|
|
204
|
+
async engine_getPayloadBodiesByHashV1(
|
|
205
|
+
arrayOfBlockHashes: Hash32[],
|
|
206
|
+
): Promise<ExecutionPayloadBodyV1[]> {
|
|
207
|
+
return await this.client.call(
|
|
208
|
+
EngineMethods.engine_getPayloadBodiesByHashV1,
|
|
209
|
+
[arrayOfBlockHashes],
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
async engine_getPayloadBodiesByRangeV1(
|
|
213
|
+
startingBlockNumber: Uint64,
|
|
214
|
+
numberOfBlocksToReturn: Uint64,
|
|
215
|
+
): Promise<ExecutionPayloadBodyV1[]> {
|
|
216
|
+
return await this.client.call(
|
|
217
|
+
EngineMethods.engine_getPayloadBodiesByRangeV1,
|
|
218
|
+
[startingBlockNumber, numberOfBlocksToReturn],
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
async engine_newPayloadV5(
|
|
222
|
+
executionPayload: ExecutionPayloadV4,
|
|
223
|
+
expectedBlobVersionedHashes: Hash32[],
|
|
224
|
+
parentBeaconBlockRoot: Hash32,
|
|
225
|
+
executionRequests: Bytes[],
|
|
226
|
+
): Promise<PayloadStatusNoInvalidBlockHash> {
|
|
227
|
+
return await this.client.call(EngineMethods.engine_newPayloadV5, [
|
|
228
|
+
executionPayload,
|
|
229
|
+
expectedBlobVersionedHashes,
|
|
230
|
+
parentBeaconBlockRoot,
|
|
231
|
+
executionRequests,
|
|
232
|
+
]);
|
|
233
|
+
}
|
|
234
|
+
async engine_getPayloadV6(payloadId: Bytes8): Promise<{
|
|
235
|
+
executionPayload: ExecutionPayloadV4;
|
|
236
|
+
blockValue: Uint256;
|
|
237
|
+
blobsBundle: BlobsBundleV2;
|
|
238
|
+
shouldOverrideBuilder: boolean;
|
|
239
|
+
executionRequests: Bytes[];
|
|
240
|
+
}> {
|
|
241
|
+
return await this.client.call(EngineMethods.engine_getPayloadV6, [
|
|
242
|
+
payloadId,
|
|
243
|
+
]);
|
|
244
|
+
}
|
|
245
|
+
// engine/transition-configuration
|
|
246
|
+
async engine_exchangeTransitionConfigurationV1(
|
|
247
|
+
consensusClientConfiguration: TransitionConfigurationV1,
|
|
248
|
+
): Promise<TransitionConfigurationV1> {
|
|
249
|
+
return await this.client.call(
|
|
250
|
+
EngineMethods.engine_exchangeTransitionConfigurationV1,
|
|
251
|
+
[consensusClientConfiguration],
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
}
|
package/src/eth-api.ts
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { initializeRpcClient, JsonRpcClient } from "@msaki/jsonrpc";
|
|
2
|
+
|
|
3
|
+
export class EthExecutionClient {
|
|
4
|
+
private client: JsonRpcClient;
|
|
5
|
+
|
|
6
|
+
constructor(url: string) {
|
|
7
|
+
this.client = initializeRpcClient(url);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// eth/transaction
|
|
11
|
+
async eth_getTransactionByHash(
|
|
12
|
+
transactioHash: Hash32,
|
|
13
|
+
): Promise<NotFound | TransactionInfo> {
|
|
14
|
+
return await this.client.call(EthMethods.eth_getTransactionByHash, [
|
|
15
|
+
transactioHash,
|
|
16
|
+
]);
|
|
17
|
+
}
|
|
18
|
+
async eth_getTransactionByBlockHashAndIndex(
|
|
19
|
+
blockHash: Hash32,
|
|
20
|
+
transactionIndex: Uint,
|
|
21
|
+
): Promise<NotFound | TransactionInfo> {
|
|
22
|
+
return await this.client.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.client.call(EthMethods.eth_getTransactionReceipt, [
|
|
31
|
+
transactionHash,
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// eth/submit
|
|
36
|
+
async eth_sendTransaction(transaction: GenericTransaction): Promise<Hash32> {
|
|
37
|
+
return await this.client.call(EthMethods.eth_sendTransaction, [
|
|
38
|
+
transaction,
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
async eth_sendRawTransaction(transaction: Bytes): Promise<Hash32> {
|
|
42
|
+
return await this.client.call(EthMethods.eth_sendRawTransaction, [
|
|
43
|
+
transaction,
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
// eth/state
|
|
47
|
+
async eth_getBalance(
|
|
48
|
+
address: Address,
|
|
49
|
+
block: BlockNumberOrTagOrHash,
|
|
50
|
+
): Promise<Uint> {
|
|
51
|
+
return await this.client.call(EthMethods.eth_getBalance, [address, block]);
|
|
52
|
+
}
|
|
53
|
+
async eth_getStorageAt(
|
|
54
|
+
address: Address,
|
|
55
|
+
storageSlot: Bytes32,
|
|
56
|
+
block: BlockNumberOrTagOrHash,
|
|
57
|
+
): Promise<Bytes> {
|
|
58
|
+
return await this.client.call(EthMethods.eth_getStorageAt, [
|
|
59
|
+
address,
|
|
60
|
+
storageSlot,
|
|
61
|
+
block,
|
|
62
|
+
]);
|
|
63
|
+
}
|
|
64
|
+
async eth_getTransactionCount(
|
|
65
|
+
address: Address,
|
|
66
|
+
block: BlockNumberOrTagOrHash,
|
|
67
|
+
): Promise<Uint> {
|
|
68
|
+
return await this.client.call(EthMethods.eth_getTransactionCount, [
|
|
69
|
+
address,
|
|
70
|
+
block,
|
|
71
|
+
]);
|
|
72
|
+
}
|
|
73
|
+
async eth_getCode(
|
|
74
|
+
address: Address,
|
|
75
|
+
block: BlockNumberOrTagOrHash,
|
|
76
|
+
): Promise<Bytes> {
|
|
77
|
+
return await this.client.call(EthMethods.eth_getCode, [address, block]);
|
|
78
|
+
}
|
|
79
|
+
async eth_getProof(
|
|
80
|
+
address: Address,
|
|
81
|
+
storageKeys: Bytes32[],
|
|
82
|
+
block: BlockNumberOrTagOrHash,
|
|
83
|
+
): Promise<AccountProof> {
|
|
84
|
+
return await this.client.call(EthMethods.eth_getProof, [
|
|
85
|
+
address,
|
|
86
|
+
storageKeys,
|
|
87
|
+
block,
|
|
88
|
+
]);
|
|
89
|
+
}
|
|
90
|
+
// eth/sign
|
|
91
|
+
async eth_sign(address: Address, message: Bytes): Promise<Bytes65> {
|
|
92
|
+
return await this.client.call(EthMethods.eth_sign, [address, message]);
|
|
93
|
+
}
|
|
94
|
+
async eth_signTransaction(transaction: GenericTransaction): Promise<Bytes> {
|
|
95
|
+
return await this.client.call(EthMethods.eth_signTransaction, [
|
|
96
|
+
transaction,
|
|
97
|
+
]);
|
|
98
|
+
}
|
|
99
|
+
// eth/filter
|
|
100
|
+
async eth_newFilter(filter: Filter): Promise<Uint> {
|
|
101
|
+
return await this.client.call(EthMethods.eth_newFilter, [filter]);
|
|
102
|
+
}
|
|
103
|
+
async eth_newBlockFilter(): Promise<Uint> {
|
|
104
|
+
return await this.client.call(EthMethods.eth_newBlockFilter, []);
|
|
105
|
+
}
|
|
106
|
+
async eth_newPendingTransactionFilter(): Promise<Uint> {
|
|
107
|
+
return await this.client.call(
|
|
108
|
+
EthMethods.eth_newPendingTransactionFilter,
|
|
109
|
+
[],
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
async eth_uninstallFilter(): Promise<Uint> {
|
|
113
|
+
return await this.client.call(EthMethods.eth_uninstallFilter, []);
|
|
114
|
+
}
|
|
115
|
+
async eth_getFilterChanges(): Promise<FilterResults> {
|
|
116
|
+
return await this.client.call(EthMethods.eth_getFilterChanges, []);
|
|
117
|
+
}
|
|
118
|
+
async eth_getFilterLogs(filterIdentifier: Uint): Promise<FilterResults> {
|
|
119
|
+
return await this.client.call(EthMethods.eth_getFilterLogs, [
|
|
120
|
+
filterIdentifier,
|
|
121
|
+
]);
|
|
122
|
+
}
|
|
123
|
+
async eth_getLogs(filter: Filter): Promise<FilterResults> {
|
|
124
|
+
return await this.client.call(EthMethods.eth_getLogs, [filter]);
|
|
125
|
+
}
|
|
126
|
+
// eth/feeMarket
|
|
127
|
+
async eth_gasPrice(): Promise<Uint> {
|
|
128
|
+
return await this.client.call(EthMethods.eth_gasPrice, []);
|
|
129
|
+
}
|
|
130
|
+
async eth_blobBaseFee(): Promise<Uint> {
|
|
131
|
+
return await this.client.call(EthMethods.eth_blobBaseFee, []);
|
|
132
|
+
}
|
|
133
|
+
async eth_maxPriorityFeePerGas(): Promise<Uint> {
|
|
134
|
+
return await this.client.call(EthMethods.eth_maxPriorityFeePerGas, []);
|
|
135
|
+
}
|
|
136
|
+
async eth_feeHistory(
|
|
137
|
+
blockCount: Uint,
|
|
138
|
+
newestBlock: BlockNumberOrTag,
|
|
139
|
+
rewardPercentiles: number[],
|
|
140
|
+
): Promise<FeeHistoryResults> {
|
|
141
|
+
return await this.client.call(EthMethods.eth_feeHistory, [
|
|
142
|
+
blockCount,
|
|
143
|
+
newestBlock,
|
|
144
|
+
rewardPercentiles,
|
|
145
|
+
]);
|
|
146
|
+
}
|
|
147
|
+
// eth/execute
|
|
148
|
+
async eth_call(
|
|
149
|
+
transaction: GenericTransaction,
|
|
150
|
+
block: BlockNumberOrTagOrHash,
|
|
151
|
+
): Promise<Bytes> {
|
|
152
|
+
return this.client.call(EthMethods.eth_call, [transaction, block]);
|
|
153
|
+
}
|
|
154
|
+
async eth_estimateGas(
|
|
155
|
+
transaction: GenericTransaction,
|
|
156
|
+
block: BlockNumberOrTag,
|
|
157
|
+
): Promise<Uint> {
|
|
158
|
+
return await this.client.call(EthMethods.eth_estimateGas, [
|
|
159
|
+
transaction,
|
|
160
|
+
block,
|
|
161
|
+
]);
|
|
162
|
+
}
|
|
163
|
+
async eth_createAccessList(
|
|
164
|
+
transaction: GenericTransaction,
|
|
165
|
+
block: BlockNumberOrTag,
|
|
166
|
+
): Promise<AccessListResult> {
|
|
167
|
+
return await this.client.call(EthMethods.eth_createAccessList, [
|
|
168
|
+
transaction,
|
|
169
|
+
block,
|
|
170
|
+
]);
|
|
171
|
+
}
|
|
172
|
+
async eth_simulateV1(
|
|
173
|
+
payload: EthSimulatePayload,
|
|
174
|
+
blockTag: BlockNumberOrTagOrHash,
|
|
175
|
+
): Promise<EthSimulateResult> {
|
|
176
|
+
return await this.client.call(EthMethods.eth_simulateV1, [
|
|
177
|
+
payload,
|
|
178
|
+
blockTag,
|
|
179
|
+
]);
|
|
180
|
+
}
|
|
181
|
+
// eth/client
|
|
182
|
+
async eth_chainId(): Promise<Uint> {
|
|
183
|
+
return await this.client.call(EthMethods.eth_chainId, []);
|
|
184
|
+
}
|
|
185
|
+
async eth_syncing(): Promise<SyncingStatus> {
|
|
186
|
+
return await this.client.call(EthMethods.eth_syncing, []);
|
|
187
|
+
}
|
|
188
|
+
async eth_coinbase(): Promise<Address> {
|
|
189
|
+
return await this.client.call(EthMethods.eth_coinbase, []);
|
|
190
|
+
}
|
|
191
|
+
async eth_accounts(): Promise<Addresses> {
|
|
192
|
+
return await this.client.call(EthMethods.eth_accounts, []);
|
|
193
|
+
}
|
|
194
|
+
async eth_blockNumber(): Promise<Uint> {
|
|
195
|
+
return await this.client.call(EthMethods.eth_blockNumber, []);
|
|
196
|
+
}
|
|
197
|
+
async net_version(): Promise<UintDecimal> {
|
|
198
|
+
return await this.client.call(EthMethods.net_version, []);
|
|
199
|
+
}
|
|
200
|
+
// eth/block
|
|
201
|
+
async eth_getBlockByHash(
|
|
202
|
+
blockHash: Hash32,
|
|
203
|
+
hydratedTransactions: boolean,
|
|
204
|
+
): Promise<NotFound | Block> {
|
|
205
|
+
return await this.client.call(EthMethods.eth_getBlockByHash, [
|
|
206
|
+
blockHash,
|
|
207
|
+
hydratedTransactions,
|
|
208
|
+
]);
|
|
209
|
+
}
|
|
210
|
+
async eth_getBlockByNumber(
|
|
211
|
+
block: BlockNumberOrTag,
|
|
212
|
+
hydratedTransactions: boolean,
|
|
213
|
+
): Promise<NotFound | Block> {
|
|
214
|
+
return await this.client.call(EthMethods.eth_getBlockByNumber, [
|
|
215
|
+
block,
|
|
216
|
+
hydratedTransactions,
|
|
217
|
+
]);
|
|
218
|
+
}
|
|
219
|
+
async eth_getBlockTransactionCountByHash(
|
|
220
|
+
blockHash: Hash32,
|
|
221
|
+
): Promise<NotFound | Uint> {
|
|
222
|
+
return await this.client.call(
|
|
223
|
+
EthMethods.eth_getBlockTransactionCountByHash,
|
|
224
|
+
[blockHash],
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
async eth_getBlockTransactionCountByNumber(
|
|
228
|
+
block: BlockNumberOrTag,
|
|
229
|
+
): Promise<NotFound | Uint> {
|
|
230
|
+
return await this.client.call(
|
|
231
|
+
EthMethods.eth_getBlockTransactionCountByNumber,
|
|
232
|
+
[block],
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
async eth_getUncleCountByBlockHash(
|
|
236
|
+
blockHash: Hash32,
|
|
237
|
+
): Promise<NotFound | Uint> {
|
|
238
|
+
return await this.client.call(EthMethods.eth_getUncleCountByBlockHash, [
|
|
239
|
+
blockHash,
|
|
240
|
+
]);
|
|
241
|
+
}
|
|
242
|
+
async eth_getUncleCountByBlockNumber(
|
|
243
|
+
block: BlockNumberOrTag,
|
|
244
|
+
): Promise<NotFound | Uint> {
|
|
245
|
+
return await this.client.call(EthMethods.eth_getUncleCountByBlockNumber, [
|
|
246
|
+
block,
|
|
247
|
+
]);
|
|
248
|
+
}
|
|
249
|
+
async eth_getBlockReceipts(
|
|
250
|
+
block: BlockNumberOrTagOrHash,
|
|
251
|
+
): Promise<NotFound | ReceiptInfo> {
|
|
252
|
+
return await this.client.call(EthMethods.eth_getBlockReceipts, [block]);
|
|
253
|
+
}
|
|
254
|
+
// debug_*
|
|
255
|
+
async debug_getRawHeader(block: BlockNumberOrTag): Promise<Bytes> {
|
|
256
|
+
// RPL-encoded header
|
|
257
|
+
return await this.client.call(DebugMethods.debug_getRawHeader, [block]);
|
|
258
|
+
}
|
|
259
|
+
async debug_getRawBlock(block: BlockNumberOrTag): Promise<Bytes> {
|
|
260
|
+
// RPL-encoded block
|
|
261
|
+
return await this.client.call(DebugMethods.debug_getRawBlock, [block]);
|
|
262
|
+
}
|
|
263
|
+
async debug_getRawTransaction(transactionHash: Hash32): Promise<Bytes> {
|
|
264
|
+
// EIP-2718 binary-encoded trnasactions
|
|
265
|
+
return await this.client.call(DebugMethods.debug_getRawTransaction, [
|
|
266
|
+
transactionHash,
|
|
267
|
+
]);
|
|
268
|
+
}
|
|
269
|
+
async debug_getRawReceipts(block: BlockNumberOrTag): Promise<Bytes[]> {
|
|
270
|
+
return await this.client.call(DebugMethods.debug_getRawReceipts, [block]);
|
|
271
|
+
}
|
|
272
|
+
async debug_getBadBlocks(): Promise<BadBlock[]> {
|
|
273
|
+
return await this.client.call(DebugMethods.debug_getBadBlocks, []);
|
|
274
|
+
}
|
|
275
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./eth-
|
|
1
|
+
export * from "./engine-api";
|
|
2
|
+
export * from "./eth-api";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
export enum DebugMethods {
|
|
3
|
+
debug_getRawHeader = "debug_getRawHeader",
|
|
4
|
+
debug_getRawBlock = "debug_getRawBlock",
|
|
5
|
+
debug_getRawTransaction = "debug_getRawTransaction",
|
|
6
|
+
debug_getRawReceipts = "debug_getRawReceipts",
|
|
7
|
+
debug_getBadBlocks = "debug_getBadBlocks",
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { };
|
|
@@ -27,14 +27,6 @@ declare global {
|
|
|
27
27
|
withdrawals: WithdrawalV1[];
|
|
28
28
|
parentBeaconBlockRoot: Hash32;
|
|
29
29
|
}
|
|
30
|
-
export interface BlobAndProofV1 {
|
|
31
|
-
blob: Bytes;
|
|
32
|
-
proof: Bytes48;
|
|
33
|
-
}
|
|
34
|
-
export interface BlobAndProofV2 {
|
|
35
|
-
blob: Bytes;
|
|
36
|
-
proofs: Bytes48[];
|
|
37
|
-
}
|
|
38
30
|
}
|
|
39
31
|
|
|
40
32
|
export { };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
export enum EngineMethods {
|
|
3
|
+
// eth_methods
|
|
4
|
+
eth_blockNumber = "eth_blockNumber",
|
|
5
|
+
eth_call = "eth_call",
|
|
6
|
+
eth_chainId = "eth_chainId",
|
|
7
|
+
eth_getCode = "eth_getCode",
|
|
8
|
+
eth_getBlockByHash = "eth_getBlockByHash",
|
|
9
|
+
eth_getBlockByNumber = "eth_getBlockByNumber",
|
|
10
|
+
eth_getLogs = "eth_getLogs",
|
|
11
|
+
eth_sendRawTransaction = "eth_sendRawTransaction",
|
|
12
|
+
eth_syncing = "eth_syncing",
|
|
13
|
+
// engine/blob
|
|
14
|
+
engine_getBlobsV1 = "engine_getBlobsV1",
|
|
15
|
+
engine_getBlobsV2 = "engine_getBlobsV2",
|
|
16
|
+
engine_getBlobsV3 = "engine_getBlobsV3",
|
|
17
|
+
// engine/capabilities
|
|
18
|
+
engine_exchangeCapabilities = "engine_exchangeCapabilities",
|
|
19
|
+
// engine/forkchoice
|
|
20
|
+
engine_forkchoiceUpdatedV1 = "engine_forkchoiceUpdatedV1",
|
|
21
|
+
engine_forkchoiceUpdatedV2 = "engine_forkchoiceUpdatedV2",
|
|
22
|
+
engine_forkchoiceUpdatedV3 = "engine_forkchoiceUpdatedV3",
|
|
23
|
+
// engine/payload
|
|
24
|
+
engine_newPayloadV1 = "engine_newPayloadV1",
|
|
25
|
+
engine_newPayloadV2 = "engine_newPayloadV2",
|
|
26
|
+
engine_newPayloadV3 = "engine_newPayloadV3",
|
|
27
|
+
engine_newPayloadV4 = "engine_newPayloadV4",
|
|
28
|
+
engine_getPayloadV1 = "engine_getPayloadV1",
|
|
29
|
+
engine_getPayloadV2 = "engine_getPayloadV2",
|
|
30
|
+
engine_getPayloadV3 = "engine_getPayloadV3",
|
|
31
|
+
engine_getPayloadV4 = "engine_getPayloadV4",
|
|
32
|
+
engine_getPayloadV5 = "engine_getPayloadV5",
|
|
33
|
+
engine_getPayloadBodiesByHashV1 = "engine_getPayloadBodiesByHashV1",
|
|
34
|
+
engine_getPayloadBodiesByRangeV1 = "engine_getPayloadBodiesByRangeV1",
|
|
35
|
+
engine_newPayloadV5 = "engine_newPayloadV5",
|
|
36
|
+
engine_getPayloadV6 = "engine_getPayloadV6",
|
|
37
|
+
// engine/transition-configuration
|
|
38
|
+
engine_exchangeTransitionConfigurationV1 = "engine_exchangeTransitionConfigurationV1",
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { };
|