@msaki/eth-rpc 0.1.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 ADDED
@@ -0,0 +1,24 @@
1
+ # eth-rpc
2
+
3
+ ## `@msaki/eth-rpc`
4
+
5
+ A minimal ethereum rpc client implementation.
6
+
7
+ ```sh
8
+ bun add @msaki/eth-rpc
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { EthExecutionClient } from '@msaki/eth-rpc';
15
+
16
+ const url = 'http://localhost:8545'
17
+ const eth = new EthExecutionClient(url);
18
+
19
+ const balance = await eth.eth_getBalance(
20
+ "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
21
+ "latest"
22
+ );
23
+ console.log('Balance:', balance);
24
+ ```
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=beacon-methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"beacon-methods.d.ts","sourceRoot":"","sources":["../src/beacon-methods.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=beacon-methods.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"beacon-methods.js","sourceRoot":"","sources":["../src/beacon-methods.ts"],"names":[],"mappings":""}
@@ -0,0 +1,47 @@
1
+ export type * as EthSchema from "./types";
2
+ import type { EthSchema } from ".";
3
+ export declare enum Methods {
4
+ eth_getTransactionByHash = "eth_getTransactionByHash",
5
+ eth_getTransactionByBlockHashAndIndex = "eth_getTransactionByBlockHashAndIndex",
6
+ eth_getTransactionReceipt = "eth_getTransactionReceipt",
7
+ eth_sendTransaction = "eth_sendTransaction",
8
+ eth_sendRawTransaction = "eth_sendRawTransaction",
9
+ eth_getBalance = "eth_getBalance",
10
+ eth_getStorageAt = "eth_getStorageAt",
11
+ eth_getTransactionCount = "eth_getTransactionCount",
12
+ eth_getCode = "eth_getCode",
13
+ eth_getProof = "eth_getProof",
14
+ eth_sign = "eth_sign",
15
+ eth_signTransaction = "eth_signTransaction",
16
+ eth_newFilter = "eth_newFilter",
17
+ eth_newBlockFilter = "eth_newBlockFilter",
18
+ eth_newPendingTransactionFilter = "eth_newPendingTransactionFilter",
19
+ eth_uninstallFilter = "eth_uninstallFilter",
20
+ eth_getFilterChanges = "eth_getFilterChanges",
21
+ eth_getFilterLogs = "eth_getFilterLogs",
22
+ eth_getLogs = "eth_getLogs"
23
+ }
24
+ export declare class EthExecutionClient {
25
+ private client;
26
+ constructor(url: string);
27
+ eth_getTransactionByHash(transactioHash: EthSchema.Hash32): Promise<EthSchema.NotFound | EthSchema.TransactionInfo>;
28
+ eth_getTransactionByBlockHashAndIndex(blockHash: EthSchema.Hash32, transactionIndex: EthSchema.Uint): Promise<EthSchema.NotFound | EthSchema.TransactionInfo>;
29
+ eth_getTransactionReceipt(transactionHash: EthSchema.Hash32): Promise<EthSchema.NotFound | EthSchema.ReceiptInfo>;
30
+ eth_sendTransaction(transaction: EthSchema.GenericTransaction): Promise<EthSchema.Hash32>;
31
+ eth_sendRawTransaction(transaction: EthSchema.Bytes): Promise<EthSchema.Hash32>;
32
+ eth_getBalance(address: EthSchema.Address, block: EthSchema.BlockNumberOrTagOrHash): Promise<EthSchema.Uint>;
33
+ eth_getStorageAt(address: EthSchema.Address, storageSlot: EthSchema.Bytes32, block: EthSchema.BlockNumberOrTagOrHash): Promise<EthSchema.Bytes>;
34
+ eth_getTransactionCount(address: EthSchema.Address, block: EthSchema.BlockNumberOrTagOrHash): Promise<EthSchema.Uint>;
35
+ eth_getCode(address: EthSchema.Address, block: EthSchema.BlockNumberOrTagOrHash): Promise<EthSchema.Bytes>;
36
+ eth_getProof(address: EthSchema.Address, storageKeys: EthSchema.Bytes32[], block: EthSchema.BlockNumberOrTagOrHash): Promise<EthSchema.AccountProof>;
37
+ eth_sign(address: EthSchema.Address, message: EthSchema.Bytes): Promise<EthSchema.Bytes65>;
38
+ eth_signTransaction(transaction: EthSchema.GenericTransaction): Promise<EthSchema.Bytes>;
39
+ eth_newFilter(filter: EthSchema.Filter): Promise<EthSchema.Uint>;
40
+ eth_newBlockFilter(): Promise<EthSchema.Uint>;
41
+ eth_newPendingTransactionFilter(): Promise<EthSchema.Uint>;
42
+ eth_uninstallFilter(): Promise<EthSchema.Uint>;
43
+ eth_getFilterChanges(): Promise<EthSchema.FilterResults>;
44
+ eth_getFilterLogs(filterIdentifier: EthSchema.Uint): Promise<EthSchema.FilterResults>;
45
+ eth_getLogs(filter: EthSchema.Filter): Promise<EthSchema.FilterResults>;
46
+ }
47
+ //# sourceMappingURL=eth-methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eth-methods.d.ts","sourceRoot":"","sources":["../src/eth-methods.ts"],"names":[],"mappings":"AACA,YAAY,KAAK,SAAS,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAEnC,oBAAY,OAAO;IAEjB,wBAAwB,6BAA6B;IACrD,qCAAqC,0CAA0C;IAC/E,yBAAyB,8BAA8B;IAEvD,mBAAmB,wBAAwB;IAC3C,sBAAsB,2BAA2B;IAEjD,cAAc,mBAAmB;IACjC,gBAAgB,qBAAqB;IACrC,uBAAuB,4BAA4B;IACnD,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAE7B,QAAQ,aAAa;IACrB,mBAAmB,wBAAwB;IAE3C,aAAa,kBAAkB;IAC/B,kBAAkB,uBAAuB;IACzC,+BAA+B,oCAAoC;IACnE,mBAAmB,wBAAwB;IAC3C,oBAAoB,yBAAyB;IAC7C,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;CAC5B;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAgB;gBAElB,GAAG,EAAE,MAAM;IAKjB,wBAAwB,CAC5B,cAAc,EAAE,SAAS,CAAC,MAAM,GAC/B,OAAO,CAAC,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,eAAe,CAAC;IAMp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O,EAAE,SAAS,CAAC,OAAO,EAC1B,OAAO,EAAE,SAAS,CAAC,KAAK,GACvB,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC;IAMvB,mBAAmB,CACvB,WAAW,EAAE,SAAS,CAAC,kBAAkB,GACxC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC;IAOrB,aAAa,CACjB,MAAM,EAAE,SAAS,CAAC,MAAM,GACvB,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;IAMpB,kBAAkB,IACrB,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;IAMpB,+BAA+B,IAClC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;IAMpB,mBAAmB,IACtB,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;IAMpB,oBAAoB,IACvB,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC;IAM7B,iBAAiB,CACrB,gBAAgB,EAAE,SAAS,CAAC,IAAI,GAC/B,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC;IAM7B,WAAW,CACf,MAAM,EAAE,SAAS,CAAC,MAAM,GACvB,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC;CAMpC"}
@@ -0,0 +1,97 @@
1
+ import { JsonRpcClient, initializeRpcClient } from "@msaki/jsonrpc";
2
+ export var Methods;
3
+ (function (Methods) {
4
+ // eth/transaction
5
+ Methods["eth_getTransactionByHash"] = "eth_getTransactionByHash";
6
+ Methods["eth_getTransactionByBlockHashAndIndex"] = "eth_getTransactionByBlockHashAndIndex";
7
+ Methods["eth_getTransactionReceipt"] = "eth_getTransactionReceipt";
8
+ // eth/submit
9
+ Methods["eth_sendTransaction"] = "eth_sendTransaction";
10
+ Methods["eth_sendRawTransaction"] = "eth_sendRawTransaction";
11
+ // eth/state
12
+ Methods["eth_getBalance"] = "eth_getBalance";
13
+ Methods["eth_getStorageAt"] = "eth_getStorageAt";
14
+ Methods["eth_getTransactionCount"] = "eth_getTransactionCount";
15
+ Methods["eth_getCode"] = "eth_getCode";
16
+ Methods["eth_getProof"] = "eth_getProof";
17
+ // eth/sign
18
+ Methods["eth_sign"] = "eth_sign";
19
+ Methods["eth_signTransaction"] = "eth_signTransaction";
20
+ // eth/filter
21
+ Methods["eth_newFilter"] = "eth_newFilter";
22
+ Methods["eth_newBlockFilter"] = "eth_newBlockFilter";
23
+ Methods["eth_newPendingTransactionFilter"] = "eth_newPendingTransactionFilter";
24
+ Methods["eth_uninstallFilter"] = "eth_uninstallFilter";
25
+ Methods["eth_getFilterChanges"] = "eth_getFilterChanges";
26
+ Methods["eth_getFilterLogs"] = "eth_getFilterLogs";
27
+ Methods["eth_getLogs"] = "eth_getLogs";
28
+ })(Methods || (Methods = {}));
29
+ export class EthExecutionClient {
30
+ client;
31
+ constructor(url) {
32
+ this.client = initializeRpcClient(url);
33
+ }
34
+ // eth/transaction
35
+ async eth_getTransactionByHash(transactioHash) {
36
+ return await this.client.call(Methods.eth_getTransactionByHash, [transactioHash]);
37
+ }
38
+ async eth_getTransactionByBlockHashAndIndex(blockHash, transactionIndex) {
39
+ return await this.client.call(Methods.eth_getTransactionByBlockHashAndIndex, [blockHash, transactionIndex]);
40
+ }
41
+ async eth_getTransactionReceipt(transactionHash) {
42
+ return await this.client.call(Methods.eth_getTransactionReceipt, [transactionHash]);
43
+ }
44
+ // eth/submit
45
+ async eth_sendTransaction(transaction) {
46
+ return await this.client.call(Methods.eth_sendTransaction, [transaction]);
47
+ }
48
+ async eth_sendRawTransaction(transaction) {
49
+ return await this.client.call(Methods.eth_sendRawTransaction, [transaction]);
50
+ }
51
+ // eth/state
52
+ async eth_getBalance(address, block) {
53
+ return await this.client.call(Methods.eth_getBalance, [address, block]);
54
+ }
55
+ async eth_getStorageAt(address, storageSlot, block) {
56
+ return await this.client.call(Methods.eth_getStorageAt, [address, storageSlot, block]);
57
+ }
58
+ async eth_getTransactionCount(address, block) {
59
+ return await this.client.call(Methods.eth_getTransactionCount, [address, block]);
60
+ }
61
+ async eth_getCode(address, block) {
62
+ return await this.client.call(Methods.eth_getCode, [address, block]);
63
+ }
64
+ async eth_getProof(address, storageKeys, block) {
65
+ return await this.client.call(Methods.eth_getProof, [address, storageKeys, block]);
66
+ }
67
+ // eth/sign
68
+ async eth_sign(address, message) {
69
+ return await this.client.call(Methods.eth_sign, [address, message]);
70
+ }
71
+ async eth_signTransaction(transaction) {
72
+ return await this.client.call(Methods.eth_signTransaction, [transaction]);
73
+ }
74
+ // eth/filter
75
+ async eth_newFilter(filter) {
76
+ return await this.client.call(Methods.eth_newFilter, [filter]);
77
+ }
78
+ async eth_newBlockFilter() {
79
+ return await this.client.call(Methods.eth_newBlockFilter, []);
80
+ }
81
+ async eth_newPendingTransactionFilter() {
82
+ return await this.client.call(Methods.eth_newPendingTransactionFilter, []);
83
+ }
84
+ async eth_uninstallFilter() {
85
+ return await this.client.call(Methods.eth_uninstallFilter, []);
86
+ }
87
+ async eth_getFilterChanges() {
88
+ return await this.client.call(Methods.eth_getFilterChanges, []);
89
+ }
90
+ async eth_getFilterLogs(filterIdentifier) {
91
+ return await this.client.call(Methods.eth_getFilterLogs, [filterIdentifier]);
92
+ }
93
+ async eth_getLogs(filter) {
94
+ return await this.client.call(Methods.eth_getLogs, [filter]);
95
+ }
96
+ }
97
+ //# sourceMappingURL=eth-methods.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eth-methods.js","sourceRoot":"","sources":["../src/eth-methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAIpE,MAAM,CAAN,IAAY,OAyBX;AAzBD,WAAY,OAAO;IACjB,kBAAkB;IAClB,gEAAqD,CAAA;IACrD,0FAA+E,CAAA;IAC/E,kEAAuD,CAAA;IACvD,aAAa;IACb,sDAA2C,CAAA;IAC3C,4DAAiD,CAAA;IACjD,YAAY;IACZ,4CAAiC,CAAA;IACjC,gDAAqC,CAAA;IACrC,8DAAmD,CAAA;IACnD,sCAA2B,CAAA;IAC3B,wC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 @@
1
+ export * from "./types";
2
+ export * from "./eth-methods";
3
+ export * from "./beacon-methods";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./types";
2
+ export * from "./eth-methods";
3
+ export * from "./beacon-methods";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,338 @@
1
+ export type Hex = `0x${string}`;
2
+ export type Address = `0x${string}`;
3
+ export type Addresses = Address[];
4
+ export type Byte = Hex;
5
+ export type Bytes = Hex;
6
+ export type Bytes32 = Hex;
7
+ export type Bytes8 = Hex;
8
+ export type Bytes48 = Hex;
9
+ export type Bytes96 = Hex;
10
+ export type Bytes256 = Hex;
11
+ export type Bytes65 = Hex;
12
+ export type Ratio = 0 | 1;
13
+ export type Uint = Hex;
14
+ export type Uint64 = Hex;
15
+ export type Uint256 = Hex;
16
+ export type UintDecimal = number;
17
+ export type Hash32 = Hex;
18
+ export type NotFound = null;
19
+ export type BlockTag = "earliest" | "finalized" | "safe" | "latest" | "pending";
20
+ export type BlockNumberOrTag = Hex | BlockTag;
21
+ export type BlockNumberOrTagOrHash = BlockNumberOrTag | Hex;
22
+ export interface Block {
23
+ hash: Hash32;
24
+ parentHash: Hash32;
25
+ sha3Uncles: Hash32;
26
+ miner: Address;
27
+ stateRoot: Hash32;
28
+ transactionsRoot: Hash32;
29
+ receiptsRoot: Hash32;
30
+ logsBloom: Bytes256;
31
+ number: Uint;
32
+ gasLimit: Uint;
33
+ gasUsed: Uint;
34
+ timestamp: Uint;
35
+ extraData: Bytes;
36
+ mixHash: Hash32;
37
+ nonce: Bytes8;
38
+ size: Uint;
39
+ transactions: Hash32[] | TransactionInfo[];
40
+ uncles: Hash32[];
41
+ requestedHash?: Hash32;
42
+ baseFeePerGas?: Uint;
43
+ withdrawalsRoot?: Hash32;
44
+ blobGasUsed?: Uint;
45
+ excessBlobGas?: Uint;
46
+ parentBeaconBlockRoot?: Hash32;
47
+ withdrawals?: Withdrawal[];
48
+ difficulty?: Uint;
49
+ }
50
+ export interface BadBlock {
51
+ block: Block;
52
+ hash: Hash32;
53
+ rlp: Bytes;
54
+ }
55
+ export interface AccessListEntry {
56
+ address: Address;
57
+ storageKeys: Hash32[];
58
+ }
59
+ export type TransactionUnsigned = TransactionLegacyUnsigned | Transaction2930Unsigned | Transaction1559Unsigned | Transaction4844Unsigned | Transaction7702Unsigned;
60
+ export interface TransactionLegacyUnsigned {
61
+ type: "0x0";
62
+ nonce: Uint;
63
+ to?: Address | null;
64
+ gas: Uint;
65
+ value: Uint;
66
+ input: Bytes;
67
+ gasPrice: Uint;
68
+ chainId?: Uint;
69
+ }
70
+ export interface Transaction2930Unsigned {
71
+ type: "0x1";
72
+ nonce: Uint;
73
+ to?: Address | null;
74
+ gas: Uint;
75
+ value: Uint;
76
+ input: Bytes;
77
+ gasPrice: Uint;
78
+ chainId: Uint;
79
+ accessList: AccessListEntry[];
80
+ }
81
+ export interface Transaction1559Unsigned {
82
+ type: "0x2";
83
+ nonce: Uint;
84
+ to?: Address | null;
85
+ gas: Uint;
86
+ value: Uint;
87
+ input: Bytes;
88
+ gasPrice: Uint;
89
+ maxFeePerGas: Uint;
90
+ maxPriorityFeePerGas: Uint;
91
+ accessList: AccessListEntry[];
92
+ chainId: Uint;
93
+ }
94
+ export interface Transaction4844Unsigned {
95
+ type: "0x3";
96
+ nonce: Uint;
97
+ to: Address;
98
+ gas: Uint;
99
+ value: Uint;
100
+ input: Bytes;
101
+ gasPrice?: Uint;
102
+ maxFeePerGas: Uint;
103
+ maxPriorityFeePerGas: Uint;
104
+ maxFeePerBlobGas: Uint;
105
+ accessList: AccessListEntry[];
106
+ blobVersionedHashes: Hash32[];
107
+ chainId: Uint;
108
+ }
109
+ export interface Transaction7702Unsigned {
110
+ type: "0x4";
111
+ nonce: Uint;
112
+ to: Address;
113
+ gas: Uint;
114
+ value: Uint;
115
+ input: Bytes;
116
+ maxPriorityFeePerGas: Uint;
117
+ maxFeePerGas: Uint;
118
+ gasPrice?: Uint;
119
+ accessList: AccessListEntry[];
120
+ chainId: Uint;
121
+ authorizationList: AuthorizationList;
122
+ }
123
+ export interface AuthorizationListEntry {
124
+ chainId: Uint;
125
+ nonce: Uint;
126
+ address: Address;
127
+ yParity: Byte;
128
+ r: Uint256;
129
+ s: Uint256;
130
+ }
131
+ export type AuthorizationList = AuthorizationListEntry[];
132
+ export type TransactionLegacySigned = {
133
+ v: Byte;
134
+ r: Uint;
135
+ s: Uint;
136
+ } & TransactionLegacyUnsigned;
137
+ export type Transaction2930Signed = {
138
+ yParity: Bytes;
139
+ r: Uint;
140
+ s: Uint;
141
+ v?: Byte;
142
+ } & Transaction2930Unsigned;
143
+ export type Transaction1559Signed = {
144
+ yParity: Bytes;
145
+ r: Uint;
146
+ s: Uint;
147
+ v?: Byte;
148
+ } & Transaction1559Unsigned;
149
+ export type Transaction4844Signed = {
150
+ yParity: Byte;
151
+ r: Uint;
152
+ s: Uint;
153
+ v?: Byte;
154
+ } & Transaction4844Unsigned;
155
+ export type Transaction7702Signed = {
156
+ yParity: Byte;
157
+ r: Uint;
158
+ s: Uint;
159
+ v?: Byte;
160
+ } & Transaction7702Unsigned;
161
+ export type TransactionSigned = TransactionLegacySigned | Transaction2930Signed | Transaction1559Signed | Transaction4844Signed | Transaction7702Signed;
162
+ export type TransactionInfo = {
163
+ blockHash: Hash32;
164
+ blockNumber: Uint;
165
+ from: Address;
166
+ hash: Hash32;
167
+ transactionIndex: Uint;
168
+ } & TransactionSigned;
169
+ export interface GenericTransaction {
170
+ type?: "0x0" | "0x1" | "0x2" | "0x3";
171
+ to?: Address | null;
172
+ from?: Address;
173
+ value?: Uint;
174
+ nonce?: Uint;
175
+ gas?: Uint;
176
+ input?: Bytes;
177
+ gasPrice?: Uint;
178
+ maxPriorityFeePerGas?: Uint;
179
+ maxFeePerGas?: Uint;
180
+ maxFeePerBlobGas?: Uint;
181
+ accessList?: AccessListEntry[];
182
+ blobVersionedHashes?: Hash32[];
183
+ blobs?: Bytes[];
184
+ chainId?: Uint;
185
+ authorizationList?: AuthorizationList;
186
+ }
187
+ export interface Withdrawal {
188
+ index: Uint64;
189
+ validatorIndex: Uint64;
190
+ address: Address;
191
+ amount: Uint256;
192
+ }
193
+ export interface AccountProof {
194
+ address: Address;
195
+ accountProof: Bytes;
196
+ balance: Uint256;
197
+ codeHash: Hash32;
198
+ nonce: Uint64;
199
+ storageHash: Hash32;
200
+ storageProof: StorageProof;
201
+ }
202
+ export interface StorageProof {
203
+ key: Bytes32;
204
+ value: Uint256;
205
+ proof: Bytes;
206
+ }
207
+ export interface Log {
208
+ transactionHash: Hash32;
209
+ removed?: boolean;
210
+ logIndex?: Uint;
211
+ transactionIndex?: Uint;
212
+ blockHash?: Hash32;
213
+ blockNumber?: Uint;
214
+ blockTimestamp?: Uint;
215
+ address?: Address;
216
+ data?: Bytes;
217
+ topics?: Bytes32[];
218
+ }
219
+ export interface ReceiptInfo {
220
+ type?: Byte;
221
+ transactionHash: Hash32;
222
+ transactionIndex: Uint;
223
+ blockHash: Byte;
224
+ blockNumber: Uint;
225
+ from: Address;
226
+ to?: Address | null;
227
+ cumulativeGasUsed: Uint;
228
+ gasUsed: Uint;
229
+ blobGasUsed?: Uint;
230
+ contractAddress?: Address | null;
231
+ logs: Log[];
232
+ logsBloom: Bytes256;
233
+ root?: Hash32;
234
+ status?: Uint;
235
+ effectiveGasPrice: Uint;
236
+ blobGasPrice?: Uint;
237
+ }
238
+ export type FilterResults = Hash32[] | Log[];
239
+ export type FilterTopic = Bytes32 | Bytes32[];
240
+ export type FilterTopics = FilterTopic | null;
241
+ export type Filter = FilterByBlockRange | FilterByBlockHash;
242
+ export interface FilterByBlockRange {
243
+ fromBlock?: Uint;
244
+ toBlock?: Uint;
245
+ address?: null | Address | Addresses;
246
+ topics?: FilterTopics;
247
+ }
248
+ export interface FilterByBlockHash {
249
+ blockHash: Hash32;
250
+ address?: Address | Addresses | null;
251
+ topics?: FilterTopics;
252
+ }
253
+ export interface EthSimulatePayload {
254
+ blockStateCalls: BlockStateCall[];
255
+ traceTransfers?: boolean;
256
+ validation?: boolean;
257
+ returnFullTransactions?: boolean;
258
+ }
259
+ export interface BlockStateCall {
260
+ blockOverrides?: BlockOverrides;
261
+ stateOverrides?: StateOverrides;
262
+ calls?: GenericCallTransaction[];
263
+ }
264
+ export interface BlockOverrides {
265
+ number?: Uint64;
266
+ prevRandao?: Uint256;
267
+ time?: Uint64;
268
+ gasLimit?: Uint64;
269
+ feeRecipient?: Address;
270
+ baseFeePerGas?: Uint256;
271
+ withdrawals?: Withdrawal[];
272
+ blobBaseFee?: Uint64;
273
+ }
274
+ export type StateOverrides = Record<Address, AccountOverride>;
275
+ export interface GenericCallTransaction {
276
+ type?: "0x0" | "0x1" | "0x2" | "0x3";
277
+ to?: Address | null;
278
+ from?: Address;
279
+ value?: Uint;
280
+ nonce?: Uint;
281
+ gas?: Uint;
282
+ input?: Bytes;
283
+ gasPrice?: Uint;
284
+ maxPriorityFeePerGas?: Uint;
285
+ maxFeePerGas?: Uint;
286
+ maxFeePerBlobGas?: Uint;
287
+ accessList?: AccessListEntry[];
288
+ blobVersionedHashes?: Hash32[];
289
+ authorizationList?: AuthorizationList;
290
+ }
291
+ export type AccountOverride = AccountOverrideState | AccountOverrideStateDiff;
292
+ export interface AccountOverrideState {
293
+ state: AccountStorage;
294
+ nonce?: Uint64;
295
+ balance?: Uint256;
296
+ code?: Bytes;
297
+ movePrecompileToAddress?: Address;
298
+ }
299
+ export interface AccountOverrideStateDiff {
300
+ stateDiff: AccountStorage;
301
+ nonce?: Uint64;
302
+ balance?: Uint256;
303
+ code?: Bytes;
304
+ movePrecompileToAddress?: Address;
305
+ }
306
+ export type AccountStorage = Record<Bytes32, Hash32>;
307
+ export type EthSimulateResult = EthSimulateBlockResultSingleSuccess[];
308
+ export type EthSimulateBlockResultSingleSuccess = {
309
+ calls: CallResults;
310
+ } & Block;
311
+ export type CallResults = CallResultFailure | CallResultSuccess;
312
+ export interface CallResultFailure {
313
+ status: "0x0";
314
+ returnData: Bytes;
315
+ gasUsed: Uint64;
316
+ error: EXECUTION_REVERTED_ERROR | VM_EXECUTION_ERROR;
317
+ }
318
+ export type EXECUTION_REVERTED_ERROR = {
319
+ code: -32000;
320
+ message: "execution reverted.";
321
+ };
322
+ export type VM_EXECUTION_ERROR = {
323
+ code: -32015;
324
+ message: "vm execution error.";
325
+ };
326
+ export interface CallResultSuccess {
327
+ status: "0x1";
328
+ returnData: Bytes;
329
+ gasUsed: Uint64;
330
+ logs: Log[];
331
+ }
332
+ export type SyncingStatus = Syncing | false;
333
+ export interface Syncing {
334
+ startingBlock?: Uint;
335
+ currentBlock?: Uint;
336
+ highestBlock?: Uint;
337
+ }
338
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,GAAG,GAAG,KAAK,MAAM,EAAE,CAAA;AAC/B,MAAM,MAAM,OAAO,GAAG,KAAK,MAAM,EAAE,CAAA;AACnC,MAAM,MAAM,SAAS,GAAG,OAAO,EAAE,CAAA;AACjC,MAAM,MAAM,IAAI,GAAG,GAAG,CAAA;AACtB,MAAM,MAAM,KAAK,GAAG,GAAG,CAAA;AACvB,MAAM,MAAM,OAAO,GAAG,GAAG,CAAA;AACzB,MAAM,MAAM,MAAM,GAAG,GAAG,CAAA;AACxB,MAAM,MAAM,OAAO,GAAG,GAAG,CAAA;A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AM,MAAM,iBAAiB,GAAG,mCAAmC,EAAE,CAAA;AAErE,MAAM,MAAM,mCAAmC,GAAG;IAChD,KAAK,EAAE,WAAW,CAAA;CACnB,GAAG,KAAK,CAAA;AACT,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG,iBAAiB,CAAA;AAC/D,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,KAAK,CAAA;IACb,UAAU,EAAE,KAAK,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,wBAAwB,GAAG,kBAAkB,CAAA;CACrD;AACD,MAAM,MAAM,wBAAwB,GAAG;IAAE,IAAI,EAAE,CAAC,KAAK,CAAC;IAAC,OAAO,EAAE,qBAAqB,CAAA;CAAE,CAAA;AACvF,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,CAAC,KAAK,CAAC;IAAC,OAAO,EAAE,qBAAqB,CAAA;CAAE,CAAA;AACjF,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,KAAK,CAAA;IACb,UAAU,EAAE,KAAK,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,GAAG,EAAE,CAAA;CACZ;AAGD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,KAAK,CAAA;AAC3C,MAAM,WAAW,OAAO;IACtB,aAAa,CAAC,EAAE,IAAI,CAAA;IACpB,YAAY,CAAC,EAAE,IAAI,CAAA;IACnB,YAAY,CAAC,EAAE,IAAI,CAAA;CACpB"}
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@msaki/eth-rpc",
3
+ "author": "Meek Msaki",
4
+ "version": "0.1.0",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.mjs",
9
+ "types": "dist/index.d.ts",
10
+ "files": [
11
+ "dist",
12
+ "src"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/mmsaki/libs.git",
17
+ "directory": "packages/eth-rpc"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public",
21
+ "directory": "dist"
22
+ },
23
+ "scripts": {
24
+ "build": "tsc -p tsconfig.json",
25
+ "publish": "bun run build && bun publish --access public",
26
+ "lint": "tsc"
27
+ },
28
+ "devDependencies": {
29
+ "@types/bun": "latest"
30
+ },
31
+ "peerDependencies": {
32
+ "typescript": "^5"
33
+ },
34
+ "dependencies": {
35
+ "@msaki/jsonrpc": "jsonrpc"
36
+ }
37
+ }
File without changes
@@ -0,0 +1,202 @@
1
+ import { JsonRpcClient, initializeRpcClient } from "@msaki/jsonrpc";
2
+ export type * as EthSchema from "./types";
3
+ import type { EthSchema } from ".";
4
+
5
+ export enum Methods {
6
+ // eth/transaction
7
+ eth_getTransactionByHash = "eth_getTransactionByHash",
8
+ eth_getTransactionByBlockHashAndIndex = "eth_getTransactionByBlockHashAndIndex",
9
+ eth_getTransactionReceipt = "eth_getTransactionReceipt",
10
+ // eth/submit
11
+ eth_sendTransaction = "eth_sendTransaction",
12
+ eth_sendRawTransaction = "eth_sendRawTransaction",
13
+ // eth/state
14
+ eth_getBalance = "eth_getBalance",
15
+ eth_getStorageAt = "eth_getStorageAt",
16
+ eth_getTransactionCount = "eth_getTransactionCount",
17
+ eth_getCode = "eth_getCode",
18
+ eth_getProof = "eth_getProof",
19
+ // eth/sign
20
+ eth_sign = "eth_sign",
21
+ eth_signTransaction = "eth_signTransaction",
22
+ // eth/filter
23
+ eth_newFilter = "eth_newFilter",
24
+ eth_newBlockFilter = "eth_newBlockFilter",
25
+ eth_newPendingTransactionFilter = "eth_newPendingTransactionFilter",
26
+ eth_uninstallFilter = "eth_uninstallFilter",
27
+ eth_getFilterChanges = "eth_getFilterChanges",
28
+ eth_getFilterLogs = "eth_getFilterLogs",
29
+ eth_getLogs = "eth_getLogs",
30
+ }
31
+
32
+ export class EthExecutionClient {
33
+ private client: JsonRpcClient;
34
+
35
+ constructor(url: string) {
36
+ this.client = initializeRpcClient(url)
37
+ }
38
+
39
+ // eth/transaction
40
+ async eth_getTransactionByHash(
41
+ transactioHash: EthSchema.Hash32
42
+ ): Promise<EthSchema.NotFound | EthSchema.TransactionInfo> {
43
+ return await this.client.call(
44
+ Methods.eth_getTransactionByHash,
45
+ [transactioHash]
46
+ );
47
+ }
48
+ async eth_getTransactionByBlockHashAndIndex(
49
+ blockHash: EthSchema.Hash32,
50
+ transactionIndex: EthSchema.Uint
51
+ ): Promise<EthSchema.NotFound | EthSchema.TransactionInfo> {
52
+ return await this.client.call(
53
+ Methods.eth_getTransactionByBlockHashAndIndex,
54
+ [blockHash, transactionIndex]
55
+ );
56
+ }
57
+ async eth_getTransactionReceipt(
58
+ transactionHash: EthSchema.Hash32,
59
+ ): Promise<EthSchema.NotFound | EthSchema.ReceiptInfo> {
60
+ return await this.client.call(
61
+ Methods.eth_getTransactionReceipt,
62
+ [transactionHash]
63
+ );
64
+ }
65
+
66
+ // eth/submit
67
+ async eth_sendTransaction(
68
+ transaction: EthSchema.GenericTransaction
69
+ ): Promise<EthSchema.Hash32> {
70
+ return await this.client.call(
71
+ Methods.eth_sendTransaction,
72
+ [transaction]
73
+ )
74
+ }
75
+ async eth_sendRawTransaction(
76
+ transaction: EthSchema.Bytes
77
+ ): Promise<EthSchema.Hash32> {
78
+ return await this.client.call(
79
+ Methods.eth_sendRawTransaction,
80
+ [transaction]
81
+ )
82
+ }
83
+ // eth/state
84
+ async eth_getBalance(
85
+ address: EthSchema.Address,
86
+ block: EthSchema.BlockNumberOrTagOrHash
87
+ ): Promise<EthSchema.Uint> {
88
+ return await this.client.call(
89
+ Methods.eth_getBalance,
90
+ [address, block]
91
+ )
92
+ }
93
+ async eth_getStorageAt(
94
+ address: EthSchema.Address,
95
+ storageSlot: EthSchema.Bytes32,
96
+ block: EthSchema.BlockNumberOrTagOrHash
97
+ ): Promise<EthSchema.Bytes> {
98
+ return await this.client.call(
99
+ Methods.eth_getStorageAt,
100
+ [address, storageSlot, block]
101
+ )
102
+ }
103
+ async eth_getTransactionCount(
104
+ address: EthSchema.Address,
105
+ block: EthSchema.BlockNumberOrTagOrHash
106
+ ): Promise<EthSchema.Uint> {
107
+ return await this.client.call(
108
+ Methods.eth_getTransactionCount,
109
+ [address, block]
110
+ )
111
+ }
112
+ async eth_getCode(
113
+ address: EthSchema.Address,
114
+ block: EthSchema.BlockNumberOrTagOrHash
115
+ ): Promise<EthSchema.Bytes> {
116
+ return await this.client.call(
117
+ Methods.eth_getCode,
118
+ [address, block]
119
+ )
120
+ }
121
+ async eth_getProof(
122
+ address: EthSchema.Address,
123
+ storageKeys: EthSchema.Bytes32[],
124
+ block: EthSchema.BlockNumberOrTagOrHash,
125
+ ): Promise<EthSchema.AccountProof> {
126
+ return await this.client.call(
127
+ Methods.eth_getProof,
128
+ [address, storageKeys, block]
129
+ )
130
+ }
131
+ // eth/sign
132
+ async eth_sign(
133
+ address: EthSchema.Address,
134
+ message: EthSchema.Bytes
135
+ ): Promise<EthSchema.Bytes65> {
136
+ return await this.client.call(
137
+ Methods.eth_sign,
138
+ [address, message]
139
+ )
140
+ }
141
+ async eth_signTransaction(
142
+ transaction: EthSchema.GenericTransaction
143
+ ): Promise<EthSchema.Bytes> {
144
+ return await this.client.call(
145
+ Methods.eth_signTransaction,
146
+ [transaction]
147
+ )
148
+ }
149
+ // eth/filter
150
+ async eth_newFilter(
151
+ filter: EthSchema.Filter
152
+ ): Promise<EthSchema.Uint> {
153
+ return await this.client.call(
154
+ Methods.eth_newFilter,
155
+ [filter],
156
+ )
157
+ }
158
+ async eth_newBlockFilter(
159
+ ): Promise<EthSchema.Uint> {
160
+ return await this.client.call(
161
+ Methods.eth_newBlockFilter,
162
+ [],
163
+ )
164
+ }
165
+ async eth_newPendingTransactionFilter(
166
+ ): Promise<EthSchema.Uint> {
167
+ return await this.client.call(
168
+ Methods.eth_newPendingTransactionFilter,
169
+ []
170
+ )
171
+ }
172
+ async eth_uninstallFilter(
173
+ ): Promise<EthSchema.Uint> {
174
+ return await this.client.call(
175
+ Methods.eth_uninstallFilter,
176
+ []
177
+ )
178
+ }
179
+ async eth_getFilterChanges(
180
+ ): Promise<EthSchema.FilterResults> {
181
+ return await this.client.call(
182
+ Methods.eth_getFilterChanges,
183
+ []
184
+ )
185
+ }
186
+ async eth_getFilterLogs(
187
+ filterIdentifier: EthSchema.Uint
188
+ ): Promise<EthSchema.FilterResults> {
189
+ return await this.client.call(
190
+ Methods.eth_getFilterLogs,
191
+ [filterIdentifier]
192
+ )
193
+ }
194
+ async eth_getLogs(
195
+ filter: EthSchema.Filter
196
+ ): Promise<EthSchema.FilterResults> {
197
+ return await this.client.call(
198
+ Methods.eth_getLogs,
199
+ [filter]
200
+ )
201
+ }
202
+ }
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export * from "./eth-methods";
3
+ export * from "./beacon-methods";
package/src/types.ts ADDED
@@ -0,0 +1,360 @@
1
+ // base.yaml
2
+ export type Hex = `0x${string}`
3
+ export type Address = `0x${string}`
4
+ export type Addresses = Address[]
5
+ export type Byte = Hex
6
+ export type Bytes = Hex
7
+ export type Bytes32 = Hex
8
+ export type Bytes8 = Hex
9
+ export type Bytes48 = Hex
10
+ export type Bytes96 = Hex
11
+ export type Bytes256 = Hex
12
+ export type Bytes65 = Hex
13
+ export type Ratio = 0 | 1
14
+ export type Uint = Hex
15
+ export type Uint64 = Hex
16
+ export type Uint256 = Hex
17
+ export type UintDecimal = number
18
+ export type Hash32 = Hex
19
+ export type NotFound = null
20
+
21
+ // block.yaml
22
+ export type BlockTag = "earliest" | "finalized" | "safe" | "latest" | "pending"
23
+ export type BlockNumberOrTag = Hex | BlockTag
24
+ export type BlockNumberOrTagOrHash = BlockNumberOrTag | Hex
25
+
26
+ export interface Block {
27
+ hash: Hash32
28
+ parentHash: Hash32
29
+ sha3Uncles: Hash32
30
+ miner: Address
31
+ stateRoot: Hash32
32
+ transactionsRoot: Hash32
33
+ receiptsRoot: Hash32
34
+ logsBloom: Bytes256
35
+ number: Uint
36
+ gasLimit: Uint
37
+ gasUsed: Uint
38
+ timestamp: Uint
39
+ extraData: Bytes
40
+ mixHash: Hash32
41
+ nonce: Bytes8
42
+ size: Uint
43
+ transactions: Hash32[] | TransactionInfo[]
44
+ uncles: Hash32[]
45
+ requestedHash?: Hash32
46
+ baseFeePerGas?: Uint
47
+ withdrawalsRoot?: Hash32
48
+ blobGasUsed?: Uint
49
+ excessBlobGas?: Uint
50
+ parentBeaconBlockRoot?: Hash32
51
+ withdrawals?: Withdrawal[]
52
+ difficulty?: Uint
53
+ }
54
+ export interface BadBlock {
55
+ block: Block
56
+ hash: Hash32
57
+ rlp: Bytes
58
+ }
59
+
60
+ // transaction.yaml
61
+ export interface AccessListEntry {
62
+ address: Address
63
+ storageKeys: Hash32[]
64
+ }
65
+ export type TransactionUnsigned = TransactionLegacyUnsigned
66
+ | Transaction2930Unsigned
67
+ | Transaction1559Unsigned
68
+ | Transaction4844Unsigned
69
+ | Transaction7702Unsigned
70
+
71
+ export interface TransactionLegacyUnsigned {
72
+ type: "0x0"
73
+ nonce: Uint
74
+ to?: Address | null
75
+ gas: Uint
76
+ value: Uint
77
+ input: Bytes
78
+ gasPrice: Uint
79
+ chainId?: Uint
80
+ }
81
+ export interface Transaction2930Unsigned {
82
+ type: "0x1"
83
+ nonce: Uint
84
+ to?: Address | null
85
+ gas: Uint
86
+ value: Uint
87
+ input: Bytes
88
+ gasPrice: Uint
89
+ chainId: Uint
90
+ accessList: AccessListEntry[]
91
+ }
92
+ export interface Transaction1559Unsigned {
93
+ type: "0x2"
94
+ nonce: Uint
95
+ to?: Address | null
96
+ gas: Uint
97
+ value: Uint
98
+ input: Bytes
99
+ gasPrice: Uint
100
+ maxFeePerGas: Uint
101
+ maxPriorityFeePerGas: Uint
102
+ accessList: AccessListEntry[]
103
+ chainId: Uint
104
+ }
105
+ export interface Transaction4844Unsigned {
106
+ type: "0x3"
107
+ nonce: Uint
108
+ to: Address
109
+ gas: Uint
110
+ value: Uint
111
+ input: Bytes
112
+ gasPrice?: Uint
113
+ maxFeePerGas: Uint
114
+ maxPriorityFeePerGas: Uint
115
+ maxFeePerBlobGas: Uint
116
+ accessList: AccessListEntry[]
117
+ blobVersionedHashes: Hash32[]
118
+ chainId: Uint
119
+ }
120
+ export interface Transaction7702Unsigned {
121
+ type: "0x4"
122
+ nonce: Uint
123
+ to: Address
124
+ gas: Uint
125
+ value: Uint
126
+ input: Bytes
127
+ maxPriorityFeePerGas: Uint
128
+ maxFeePerGas: Uint
129
+ gasPrice?: Uint
130
+ accessList: AccessListEntry[]
131
+ chainId: Uint
132
+ authorizationList: AuthorizationList
133
+ }
134
+ export interface AuthorizationListEntry {
135
+ chainId: Uint
136
+ nonce: Uint
137
+ address: Address
138
+ yParity: Byte
139
+ r: Uint256
140
+ s: Uint256
141
+ }
142
+ export type AuthorizationList = AuthorizationListEntry[]
143
+
144
+ export type TransactionLegacySigned = {
145
+ v: Byte
146
+ r: Uint
147
+ s: Uint
148
+ } & TransactionLegacyUnsigned
149
+ export type Transaction2930Signed = {
150
+ yParity: Bytes
151
+ r: Uint
152
+ s: Uint
153
+ v?: Byte
154
+ } & Transaction2930Unsigned
155
+ export type Transaction1559Signed = {
156
+ yParity: Bytes
157
+ r: Uint
158
+ s: Uint
159
+ v?: Byte
160
+ } & Transaction1559Unsigned
161
+ export type Transaction4844Signed = {
162
+ yParity: Byte
163
+ r: Uint
164
+ s: Uint
165
+ v?: Byte
166
+ } & Transaction4844Unsigned
167
+ export type Transaction7702Signed = {
168
+ yParity: Byte
169
+ r: Uint
170
+ s: Uint
171
+ v?: Byte
172
+ } & Transaction7702Unsigned
173
+ export type TransactionSigned = TransactionLegacySigned
174
+ | Transaction2930Signed
175
+ | Transaction1559Signed
176
+ | Transaction4844Signed
177
+ | Transaction7702Signed
178
+ export type TransactionInfo = {
179
+ blockHash: Hash32
180
+ blockNumber: Uint
181
+ from: Address
182
+ hash: Hash32
183
+ transactionIndex: Uint
184
+ } & TransactionSigned
185
+ export interface GenericTransaction {
186
+ type?: "0x0" | "0x1" | "0x2" | "0x3"
187
+ to?: Address | null
188
+ from?: Address
189
+ value?: Uint
190
+ nonce?: Uint
191
+ gas?: Uint
192
+ input?: Bytes
193
+ gasPrice?: Uint
194
+ maxPriorityFeePerGas?: Uint
195
+ maxFeePerGas?: Uint
196
+ maxFeePerBlobGas?: Uint
197
+ accessList?: AccessListEntry[]
198
+ blobVersionedHashes?: Hash32[]
199
+ blobs?: Bytes[]
200
+ chainId?: Uint
201
+ authorizationList?: AuthorizationList
202
+ }
203
+
204
+ // withdrawal.yaml
205
+ export interface Withdrawal {
206
+ index: Uint64
207
+ validatorIndex: Uint64
208
+ address: Address
209
+ amount: Uint256
210
+ }
211
+
212
+ // state.yaml
213
+ export interface AccountProof {
214
+ address: Address
215
+ accountProof: Bytes
216
+ balance: Uint256
217
+ codeHash: Hash32
218
+ nonce: Uint64
219
+ storageHash: Hash32
220
+ storageProof: StorageProof
221
+ }
222
+ export interface StorageProof {
223
+ key: Bytes32
224
+ value: Uint256
225
+ proof: Bytes
226
+ }
227
+
228
+ // receipt.yaml
229
+ export interface Log {
230
+ transactionHash: Hash32
231
+ removed?: boolean
232
+ logIndex?: Uint
233
+ transactionIndex?: Uint
234
+ blockHash?: Hash32
235
+ blockNumber?: Uint
236
+ blockTimestamp?: Uint
237
+ address?: Address
238
+ data?: Bytes
239
+ topics?: Bytes32[]
240
+ }
241
+ export interface ReceiptInfo {
242
+ type?: Byte
243
+ transactionHash: Hash32
244
+ transactionIndex: Uint
245
+ blockHash: Byte
246
+ blockNumber: Uint
247
+ from: Address
248
+ to?: Address | null
249
+ cumulativeGasUsed: Uint
250
+ gasUsed: Uint
251
+ blobGasUsed?: Uint
252
+ contractAddress?: Address | null
253
+ logs: Log[]
254
+ logsBloom: Bytes256
255
+ root?: Hash32
256
+ status?: Uint
257
+ effectiveGasPrice: Uint
258
+ blobGasPrice?: Uint
259
+ }
260
+
261
+ // filter.yaml
262
+ export type FilterResults = Hash32[] | Log[]
263
+ export type FilterTopic = Bytes32 | Bytes32[]
264
+ export type FilterTopics = FilterTopic | null
265
+ export type Filter = FilterByBlockRange | FilterByBlockHash
266
+ export interface FilterByBlockRange {
267
+ fromBlock?: Uint
268
+ toBlock?: Uint
269
+ address?: null | Address | Addresses
270
+ topics?: FilterTopics
271
+ }
272
+ export interface FilterByBlockHash {
273
+ blockHash: Hash32
274
+ address?: Address | Addresses | null
275
+ topics?: FilterTopics
276
+ }
277
+
278
+ // execute.yaml
279
+ export interface EthSimulatePayload {
280
+ blockStateCalls: BlockStateCall[]
281
+ traceTransfers?: boolean
282
+ validation?: boolean
283
+ returnFullTransactions?: boolean
284
+ }
285
+ export interface BlockStateCall {
286
+ blockOverrides?: BlockOverrides
287
+ stateOverrides?: StateOverrides
288
+ calls?: GenericCallTransaction[]
289
+ }
290
+ export interface BlockOverrides {
291
+ number?: Uint64
292
+ prevRandao?: Uint256
293
+ time?: Uint64
294
+ gasLimit?: Uint64
295
+ feeRecipient?: Address
296
+ baseFeePerGas?: Uint256
297
+ withdrawals?: Withdrawal[]
298
+ blobBaseFee?: Uint64
299
+ }
300
+ export type StateOverrides = Record<Address, AccountOverride>
301
+ export interface GenericCallTransaction {
302
+ type?: "0x0" | "0x1" | "0x2" | "0x3"
303
+ to?: Address | null
304
+ from?: Address
305
+ value?: Uint
306
+ nonce?: Uint
307
+ gas?: Uint
308
+ input?: Bytes
309
+ gasPrice?: Uint
310
+ maxPriorityFeePerGas?: Uint
311
+ maxFeePerGas?: Uint
312
+ maxFeePerBlobGas?: Uint
313
+ accessList?: AccessListEntry[]
314
+ blobVersionedHashes?: Hash32[]
315
+ authorizationList?: AuthorizationList
316
+ }
317
+ export type AccountOverride = AccountOverrideState | AccountOverrideStateDiff
318
+ export interface AccountOverrideState {
319
+ state: AccountStorage
320
+ nonce?: Uint64
321
+ balance?: Uint256
322
+ code?: Bytes
323
+ movePrecompileToAddress?: Address
324
+ }
325
+ export interface AccountOverrideStateDiff {
326
+ stateDiff: AccountStorage
327
+ nonce?: Uint64
328
+ balance?: Uint256
329
+ code?: Bytes
330
+ movePrecompileToAddress?: Address
331
+ }
332
+ export type AccountStorage = Record<Bytes32, Hash32>
333
+ export type EthSimulateResult = EthSimulateBlockResultSingleSuccess[]
334
+
335
+ export type EthSimulateBlockResultSingleSuccess = {
336
+ calls: CallResults
337
+ } & Block
338
+ export type CallResults = CallResultFailure | CallResultSuccess
339
+ export interface CallResultFailure {
340
+ status: "0x0"
341
+ returnData: Bytes
342
+ gasUsed: Uint64
343
+ error: EXECUTION_REVERTED_ERROR | VM_EXECUTION_ERROR
344
+ }
345
+ export type EXECUTION_REVERTED_ERROR = { code: -32000, message: "execution reverted." }
346
+ export type VM_EXECUTION_ERROR = { code: -32015, message: "vm execution error." }
347
+ export interface CallResultSuccess {
348
+ status: "0x1"
349
+ returnData: Bytes
350
+ gasUsed: Uint64
351
+ logs: Log[]
352
+ }
353
+
354
+ // client.yaml
355
+ export type SyncingStatus = Syncing | false
356
+ export interface Syncing {
357
+ startingBlock?: Uint
358
+ currentBlock?: Uint
359
+ highestBlock?: Uint
360
+ }