@msaki/eth-rpc 0.1.1 → 0.2.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/src/types.ts DELETED
@@ -1,368 +0,0 @@
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 =
66
- | TransactionLegacyUnsigned
67
- | Transaction2930Unsigned
68
- | Transaction1559Unsigned
69
- | Transaction4844Unsigned
70
- | Transaction7702Unsigned;
71
-
72
- export interface TransactionLegacyUnsigned {
73
- type: "0x0";
74
- nonce: Uint;
75
- to?: Address | null;
76
- gas: Uint;
77
- value: Uint;
78
- input: Bytes;
79
- gasPrice: Uint;
80
- chainId?: Uint;
81
- }
82
- export interface Transaction2930Unsigned {
83
- type: "0x1";
84
- nonce: Uint;
85
- to?: Address | null;
86
- gas: Uint;
87
- value: Uint;
88
- input: Bytes;
89
- gasPrice: Uint;
90
- chainId: Uint;
91
- accessList: AccessListEntry[];
92
- }
93
- export interface Transaction1559Unsigned {
94
- type: "0x2";
95
- nonce: Uint;
96
- to?: Address | null;
97
- gas: Uint;
98
- value: Uint;
99
- input: Bytes;
100
- gasPrice: Uint;
101
- maxFeePerGas: Uint;
102
- maxPriorityFeePerGas: Uint;
103
- accessList: AccessListEntry[];
104
- chainId: Uint;
105
- }
106
- export interface Transaction4844Unsigned {
107
- type: "0x3";
108
- nonce: Uint;
109
- to: Address;
110
- gas: Uint;
111
- value: Uint;
112
- input: Bytes;
113
- gasPrice?: Uint;
114
- maxFeePerGas: Uint;
115
- maxPriorityFeePerGas: Uint;
116
- maxFeePerBlobGas: Uint;
117
- accessList: AccessListEntry[];
118
- blobVersionedHashes: Hash32[];
119
- chainId: Uint;
120
- }
121
- export interface Transaction7702Unsigned {
122
- type: "0x4";
123
- nonce: Uint;
124
- to: Address;
125
- gas: Uint;
126
- value: Uint;
127
- input: Bytes;
128
- maxPriorityFeePerGas: Uint;
129
- maxFeePerGas: Uint;
130
- gasPrice?: Uint;
131
- accessList: AccessListEntry[];
132
- chainId: Uint;
133
- authorizationList: AuthorizationList;
134
- }
135
- export interface AuthorizationListEntry {
136
- chainId: Uint;
137
- nonce: Uint;
138
- address: Address;
139
- yParity: Byte;
140
- r: Uint256;
141
- s: Uint256;
142
- }
143
- export type AuthorizationList = AuthorizationListEntry[];
144
-
145
- export type TransactionLegacySigned = {
146
- v: Byte;
147
- r: Uint;
148
- s: Uint;
149
- } & TransactionLegacyUnsigned;
150
- export type Transaction2930Signed = {
151
- yParity: Bytes;
152
- r: Uint;
153
- s: Uint;
154
- v?: Byte;
155
- } & Transaction2930Unsigned;
156
- export type Transaction1559Signed = {
157
- yParity: Bytes;
158
- r: Uint;
159
- s: Uint;
160
- v?: Byte;
161
- } & Transaction1559Unsigned;
162
- export type Transaction4844Signed = {
163
- yParity: Byte;
164
- r: Uint;
165
- s: Uint;
166
- v?: Byte;
167
- } & Transaction4844Unsigned;
168
- export type Transaction7702Signed = {
169
- yParity: Byte;
170
- r: Uint;
171
- s: Uint;
172
- v?: Byte;
173
- } & Transaction7702Unsigned;
174
- export type TransactionSigned =
175
- | TransactionLegacySigned
176
- | Transaction2930Signed
177
- | Transaction1559Signed
178
- | Transaction4844Signed
179
- | Transaction7702Signed;
180
- export type TransactionInfo = {
181
- blockHash: Hash32;
182
- blockNumber: Uint;
183
- from: Address;
184
- hash: Hash32;
185
- transactionIndex: Uint;
186
- } & TransactionSigned;
187
- export interface GenericTransaction {
188
- type?: "0x0" | "0x1" | "0x2" | "0x3";
189
- to?: Address | null;
190
- from?: Address;
191
- value?: Uint;
192
- nonce?: Uint;
193
- gas?: Uint;
194
- input?: Bytes;
195
- gasPrice?: Uint;
196
- maxPriorityFeePerGas?: Uint;
197
- maxFeePerGas?: Uint;
198
- maxFeePerBlobGas?: Uint;
199
- accessList?: AccessListEntry[];
200
- blobVersionedHashes?: Hash32[];
201
- blobs?: Bytes[];
202
- chainId?: Uint;
203
- authorizationList?: AuthorizationList;
204
- }
205
-
206
- // withdrawal.yaml
207
- export interface Withdrawal {
208
- index: Uint64;
209
- validatorIndex: Uint64;
210
- address: Address;
211
- amount: Uint256;
212
- }
213
-
214
- // state.yaml
215
- export interface AccountProof {
216
- address: Address;
217
- accountProof: Bytes;
218
- balance: Uint256;
219
- codeHash: Hash32;
220
- nonce: Uint64;
221
- storageHash: Hash32;
222
- storageProof: StorageProof;
223
- }
224
- export interface StorageProof {
225
- key: Bytes32;
226
- value: Uint256;
227
- proof: Bytes;
228
- }
229
-
230
- // receipt.yaml
231
- export interface Log {
232
- transactionHash: Hash32;
233
- removed?: boolean;
234
- logIndex?: Uint;
235
- transactionIndex?: Uint;
236
- blockHash?: Hash32;
237
- blockNumber?: Uint;
238
- blockTimestamp?: Uint;
239
- address?: Address;
240
- data?: Bytes;
241
- topics?: Bytes32[];
242
- }
243
- export interface ReceiptInfo {
244
- type?: Byte;
245
- transactionHash: Hash32;
246
- transactionIndex: Uint;
247
- blockHash: Byte;
248
- blockNumber: Uint;
249
- from: Address;
250
- to?: Address | null;
251
- cumulativeGasUsed: Uint;
252
- gasUsed: Uint;
253
- blobGasUsed?: Uint;
254
- contractAddress?: Address | null;
255
- logs: Log[];
256
- logsBloom: Bytes256;
257
- root?: Hash32;
258
- status?: Uint;
259
- effectiveGasPrice: Uint;
260
- blobGasPrice?: Uint;
261
- }
262
-
263
- // filter.yaml
264
- export type FilterResults = Hash32[] | Log[];
265
- export type FilterTopic = Bytes32 | Bytes32[];
266
- export type FilterTopics = FilterTopic | null;
267
- export type Filter = FilterByBlockRange | FilterByBlockHash;
268
- export interface FilterByBlockRange {
269
- fromBlock?: Uint;
270
- toBlock?: Uint;
271
- address?: null | Address | Addresses;
272
- topics?: FilterTopics;
273
- }
274
- export interface FilterByBlockHash {
275
- blockHash: Hash32;
276
- address?: Address | Addresses | null;
277
- topics?: FilterTopics;
278
- }
279
-
280
- // execute.yaml
281
- export interface EthSimulatePayload {
282
- blockStateCalls: BlockStateCall[];
283
- traceTransfers?: boolean;
284
- validation?: boolean;
285
- returnFullTransactions?: boolean;
286
- }
287
- export interface BlockStateCall {
288
- blockOverrides?: BlockOverrides;
289
- stateOverrides?: StateOverrides;
290
- calls?: GenericCallTransaction[];
291
- }
292
- export interface BlockOverrides {
293
- number?: Uint64;
294
- prevRandao?: Uint256;
295
- time?: Uint64;
296
- gasLimit?: Uint64;
297
- feeRecipient?: Address;
298
- baseFeePerGas?: Uint256;
299
- withdrawals?: Withdrawal[];
300
- blobBaseFee?: Uint64;
301
- }
302
- export type StateOverrides = Record<Address, AccountOverride>;
303
- export interface GenericCallTransaction {
304
- type?: "0x0" | "0x1" | "0x2" | "0x3";
305
- to?: Address | null;
306
- from?: Address;
307
- value?: Uint;
308
- nonce?: Uint;
309
- gas?: Uint;
310
- input?: Bytes;
311
- gasPrice?: Uint;
312
- maxPriorityFeePerGas?: Uint;
313
- maxFeePerGas?: Uint;
314
- maxFeePerBlobGas?: Uint;
315
- accessList?: AccessListEntry[];
316
- blobVersionedHashes?: Hash32[];
317
- authorizationList?: AuthorizationList;
318
- }
319
- export type AccountOverride = AccountOverrideState | AccountOverrideStateDiff;
320
- export interface AccountOverrideState {
321
- state: AccountStorage;
322
- nonce?: Uint64;
323
- balance?: Uint256;
324
- code?: Bytes;
325
- movePrecompileToAddress?: Address;
326
- }
327
- export interface AccountOverrideStateDiff {
328
- stateDiff: AccountStorage;
329
- nonce?: Uint64;
330
- balance?: Uint256;
331
- code?: Bytes;
332
- movePrecompileToAddress?: Address;
333
- }
334
- export type AccountStorage = Record<Bytes32, Hash32>;
335
- export type EthSimulateResult = EthSimulateBlockResultSingleSuccess[];
336
-
337
- export type EthSimulateBlockResultSingleSuccess = {
338
- calls: CallResults;
339
- } & Block;
340
- export type CallResults = CallResultFailure | CallResultSuccess;
341
- export interface CallResultFailure {
342
- status: "0x0";
343
- returnData: Bytes;
344
- gasUsed: Uint64;
345
- error: EXECUTION_REVERTED_ERROR | VM_EXECUTION_ERROR;
346
- }
347
- export type EXECUTION_REVERTED_ERROR = {
348
- code: -32000;
349
- message: "execution reverted.";
350
- };
351
- export type VM_EXECUTION_ERROR = {
352
- code: -32015;
353
- message: "vm execution error.";
354
- };
355
- export interface CallResultSuccess {
356
- status: "0x1";
357
- returnData: Bytes;
358
- gasUsed: Uint64;
359
- logs: Log[];
360
- }
361
-
362
- // client.yaml
363
- export type SyncingStatus = Syncing | false;
364
- export interface Syncing {
365
- startingBlock?: Uint;
366
- currentBlock?: Uint;
367
- highestBlock?: Uint;
368
- }