1 | const netRpc = {
|
2 | listening: {
|
3 | aliasSection: 'net',
|
4 | description: 'Returns true if client is actively listening for network connections. Otherwise false.',
|
5 | params: [],
|
6 | type: 'bool'
|
7 | },
|
8 | peerCount: {
|
9 | aliasSection: 'net',
|
10 | description: 'Returns number of peers connected to node.',
|
11 | params: [],
|
12 | type: 'Text'
|
13 | },
|
14 | version: {
|
15 | aliasSection: 'net',
|
16 | description: 'Returns protocol version.',
|
17 | params: [],
|
18 | type: 'Text'
|
19 | }
|
20 | };
|
21 | const web3Rpc = {
|
22 | clientVersion: {
|
23 | aliasSection: 'web3',
|
24 | description: 'Returns current client version.',
|
25 | params: [],
|
26 | type: 'Text'
|
27 | },
|
28 | sha3: {
|
29 | aliasSection: 'web3',
|
30 | description: 'Returns sha3 of the given data',
|
31 | params: [{ name: 'data', type: 'Bytes' }],
|
32 | type: 'H256'
|
33 | }
|
34 | };
|
35 | export const rpc = {
|
36 | ...netRpc,
|
37 | ...web3Rpc,
|
38 | accounts: {
|
39 | description: 'Returns accounts list.',
|
40 | params: [],
|
41 | type: 'Vec<H160>'
|
42 | },
|
43 | blockNumber: {
|
44 | description: 'Returns the blockNumber',
|
45 | params: [],
|
46 | type: 'U256'
|
47 | },
|
48 | call: {
|
49 | description: 'Call contract, returning the output data.',
|
50 | params: [
|
51 | {
|
52 | name: 'request',
|
53 | type: 'EthCallRequest'
|
54 | },
|
55 | {
|
56 | isHistoric: true,
|
57 | isOptional: true,
|
58 | name: 'number',
|
59 | type: 'BlockNumber'
|
60 | }
|
61 | ],
|
62 | type: 'Bytes'
|
63 | },
|
64 | chainId: {
|
65 | description: 'Returns the chain ID used for transaction signing at the current best block. None is returned if not available.',
|
66 | params: [],
|
67 | type: 'U64'
|
68 | },
|
69 | coinbase: {
|
70 | description: 'Returns block author.',
|
71 | params: [],
|
72 | type: 'H160'
|
73 | },
|
74 | estimateGas: {
|
75 | description: 'Estimate gas needed for execution of given contract.',
|
76 | params: [
|
77 | {
|
78 | name: 'request',
|
79 | type: 'EthCallRequest'
|
80 | },
|
81 | {
|
82 | isHistoric: true,
|
83 | isOptional: true,
|
84 | name: 'number',
|
85 | type: 'BlockNumber'
|
86 | }
|
87 | ],
|
88 | type: 'U256'
|
89 | },
|
90 | feeHistory: {
|
91 | description: 'Returns fee history for given block count & reward percentiles',
|
92 | params: [
|
93 | {
|
94 | name: 'blockCount',
|
95 | type: 'U256'
|
96 | },
|
97 | {
|
98 | name: 'newestBlock',
|
99 | type: 'BlockNumber'
|
100 | },
|
101 | {
|
102 | name: 'rewardPercentiles',
|
103 | type: 'Option<Vec<f64>>'
|
104 | }
|
105 | ],
|
106 | type: 'EthFeeHistory'
|
107 | },
|
108 | gasPrice: {
|
109 | description: 'Returns current gas price.',
|
110 | params: [],
|
111 | type: 'U256'
|
112 | },
|
113 | getBalance: {
|
114 | description: 'Returns balance of the given account.',
|
115 | params: [
|
116 | {
|
117 | name: 'address',
|
118 | type: 'H160'
|
119 | },
|
120 | {
|
121 | isHistoric: true,
|
122 | isOptional: true,
|
123 | name: 'number',
|
124 | type: 'BlockNumber'
|
125 | }
|
126 | ],
|
127 | type: 'U256'
|
128 | },
|
129 | getBlockByHash: {
|
130 | description: 'Returns block with given hash.',
|
131 | params: [
|
132 | {
|
133 | name: 'hash',
|
134 | type: 'H256'
|
135 | },
|
136 | {
|
137 | name: 'full',
|
138 | type: 'bool'
|
139 | }
|
140 | ],
|
141 | type: 'Option<EthRichBlock>'
|
142 | },
|
143 | getBlockByNumber: {
|
144 | description: 'Returns block with given number.',
|
145 | params: [
|
146 | {
|
147 | name: 'block',
|
148 | type: 'BlockNumber'
|
149 | },
|
150 | { name: 'full', type: 'bool' }
|
151 | ],
|
152 | type: 'Option<EthRichBlock>'
|
153 | },
|
154 | getBlockTransactionCountByHash: {
|
155 | description: 'Returns the number of transactions in a block with given hash.',
|
156 | params: [
|
157 | {
|
158 | name: 'hash',
|
159 | type: 'H256'
|
160 | }
|
161 | ],
|
162 | type: 'U256'
|
163 | },
|
164 | getBlockTransactionCountByNumber: {
|
165 | description: 'Returns the number of transactions in a block with given block number.',
|
166 | params: [
|
167 | {
|
168 | name: 'block',
|
169 | type: 'BlockNumber'
|
170 | }
|
171 | ],
|
172 | type: 'U256'
|
173 | },
|
174 | getCode: {
|
175 | description: 'Returns the code at given address at given time (block number).',
|
176 | params: [
|
177 | {
|
178 | name: 'address',
|
179 | type: 'H160'
|
180 | },
|
181 | {
|
182 | isHistoric: true,
|
183 | isOptional: true,
|
184 | name: 'number',
|
185 | type: 'BlockNumber'
|
186 | }
|
187 | ],
|
188 | type: 'Bytes'
|
189 | },
|
190 | getFilterChanges: {
|
191 | description: 'Returns filter changes since last poll.',
|
192 | params: [
|
193 | {
|
194 | name: 'index',
|
195 | type: 'U256'
|
196 | }
|
197 | ],
|
198 | type: 'EthFilterChanges'
|
199 | },
|
200 | getFilterLogs: {
|
201 | description: 'Returns all logs matching given filter (in a range \'from\' - \'to\').',
|
202 | params: [
|
203 | {
|
204 | name: 'index',
|
205 | type: 'U256'
|
206 | }
|
207 | ],
|
208 | type: 'Vec<EthLog>'
|
209 | },
|
210 | getLogs: {
|
211 | description: 'Returns logs matching given filter object.',
|
212 | params: [
|
213 | {
|
214 | name: 'filter',
|
215 | type: 'EthFilter'
|
216 | }
|
217 | ],
|
218 | type: 'Vec<EthLog>'
|
219 | },
|
220 | getProof: {
|
221 | description: 'Returns proof for account and storage.',
|
222 | params: [
|
223 | {
|
224 | name: 'address',
|
225 | type: 'H160'
|
226 | },
|
227 | {
|
228 | name: 'storageKeys',
|
229 | type: 'Vec<H256>'
|
230 | },
|
231 | {
|
232 | name: 'number',
|
233 | type: 'BlockNumber'
|
234 | }
|
235 | ],
|
236 | type: 'EthAccount'
|
237 | },
|
238 | getStorageAt: {
|
239 | description: 'Returns content of the storage at given address.',
|
240 | params: [
|
241 | {
|
242 | name: 'address',
|
243 | type: 'H160'
|
244 | },
|
245 | {
|
246 | name: 'index',
|
247 | type: 'U256'
|
248 | },
|
249 | {
|
250 | isHistoric: true,
|
251 | isOptional: true,
|
252 | name: 'number',
|
253 | type: 'BlockNumber'
|
254 | }
|
255 | ],
|
256 | type: 'H256'
|
257 | },
|
258 | getTransactionByBlockHashAndIndex: {
|
259 | description: 'Returns transaction at given block hash and index.',
|
260 | params: [
|
261 | {
|
262 | name: 'hash',
|
263 | type: 'H256'
|
264 | },
|
265 | {
|
266 | name: 'index',
|
267 | type: 'U256'
|
268 | }
|
269 | ],
|
270 | type: 'EthTransaction'
|
271 | },
|
272 | getTransactionByBlockNumberAndIndex: {
|
273 | description: 'Returns transaction by given block number and index.',
|
274 | params: [
|
275 | {
|
276 | name: 'number',
|
277 | type: 'BlockNumber'
|
278 | },
|
279 | {
|
280 | name: 'index',
|
281 | type: 'U256'
|
282 | }
|
283 | ],
|
284 | type: 'EthTransaction'
|
285 | },
|
286 | getTransactionByHash: {
|
287 | description: 'Get transaction by its hash.',
|
288 | params: [
|
289 | {
|
290 | name: 'hash',
|
291 | type: 'H256'
|
292 | }
|
293 | ],
|
294 | type: 'EthTransaction'
|
295 | },
|
296 | getTransactionCount: {
|
297 | description: 'Returns the number of transactions sent from given address at given time (block number).',
|
298 | params: [
|
299 | {
|
300 | name: 'address',
|
301 | type: 'H160'
|
302 | },
|
303 | {
|
304 | isHistoric: true,
|
305 | isOptional: true,
|
306 | name: 'number',
|
307 | type: 'BlockNumber'
|
308 | }
|
309 | ],
|
310 | type: 'U256'
|
311 | },
|
312 | getTransactionReceipt: {
|
313 | description: 'Returns transaction receipt by transaction hash.',
|
314 | params: [
|
315 | {
|
316 | name: 'hash',
|
317 | type: 'H256'
|
318 | }
|
319 | ],
|
320 | type: 'EthReceipt'
|
321 | },
|
322 | getUncleByBlockHashAndIndex: {
|
323 | description: 'Returns an uncles at given block and index.',
|
324 | params: [
|
325 | {
|
326 | name: 'hash',
|
327 | type: 'H256'
|
328 | },
|
329 | {
|
330 | name: 'index',
|
331 | type: 'U256'
|
332 | }
|
333 | ],
|
334 | type: 'EthRichBlock'
|
335 | },
|
336 | getUncleByBlockNumberAndIndex: {
|
337 | description: 'Returns an uncles at given block and index.',
|
338 | params: [
|
339 | {
|
340 | name: 'number',
|
341 | type: 'BlockNumber'
|
342 | },
|
343 | {
|
344 | name: 'index',
|
345 | type: 'U256'
|
346 | }
|
347 | ],
|
348 | type: 'EthRichBlock'
|
349 | },
|
350 | getUncleCountByBlockHash: {
|
351 | description: 'Returns the number of uncles in a block with given hash.',
|
352 | params: [
|
353 | {
|
354 | name: 'hash',
|
355 | type: 'H256'
|
356 | }
|
357 | ],
|
358 | type: 'U256'
|
359 | },
|
360 | getUncleCountByBlockNumber: {
|
361 | description: 'Returns the number of uncles in a block with given block number.',
|
362 | params: [
|
363 | {
|
364 | name: 'number',
|
365 | type: 'BlockNumber'
|
366 | }
|
367 | ],
|
368 | type: 'U256'
|
369 | },
|
370 | getWork: {
|
371 | description: 'Returns the hash of the current block, the seedHash, and the boundary condition to be met.',
|
372 | params: [],
|
373 | type: 'EthWork'
|
374 | },
|
375 | hashrate: {
|
376 | description: 'Returns the number of hashes per second that the node is mining with.',
|
377 | params: [],
|
378 | type: 'U256'
|
379 | },
|
380 | maxPriorityFeePerGas: {
|
381 | description: 'Returns max priority fee per gas',
|
382 | params: [],
|
383 | type: 'U256'
|
384 | },
|
385 | mining: {
|
386 | description: 'Returns true if client is actively mining new blocks.',
|
387 | params: [],
|
388 | type: 'bool'
|
389 | },
|
390 | newBlockFilter: {
|
391 | description: 'Returns id of new block filter.',
|
392 | params: [],
|
393 | type: 'U256'
|
394 | },
|
395 | newFilter: {
|
396 | description: 'Returns id of new filter.',
|
397 | params: [
|
398 | {
|
399 | name: 'filter',
|
400 | type: 'EthFilter'
|
401 | }
|
402 | ],
|
403 | type: 'U256'
|
404 | },
|
405 | newPendingTransactionFilter: {
|
406 | description: 'Returns id of new block filter.',
|
407 | params: [],
|
408 | type: 'U256'
|
409 | },
|
410 | protocolVersion: {
|
411 | description: 'Returns protocol version encoded as a string (quotes are necessary).',
|
412 | params: [],
|
413 | type: 'u64'
|
414 | },
|
415 | sendRawTransaction: {
|
416 | description: 'Sends signed transaction, returning its hash.',
|
417 | params: [
|
418 | {
|
419 | name: 'bytes',
|
420 | type: 'Bytes'
|
421 | }
|
422 | ],
|
423 | type: 'H256'
|
424 | },
|
425 | sendTransaction: {
|
426 | description: 'Sends transaction; will block waiting for signer to return the transaction hash',
|
427 | params: [
|
428 | {
|
429 | name: 'tx',
|
430 | type: 'EthTransactionRequest'
|
431 | }
|
432 | ],
|
433 | type: 'H256'
|
434 | },
|
435 | submitHashrate: {
|
436 | description: 'Used for submitting mining hashrate.',
|
437 | params: [
|
438 | {
|
439 | name: 'index',
|
440 | type: 'U256'
|
441 | },
|
442 | {
|
443 | name: 'hash',
|
444 | type: 'H256'
|
445 | }
|
446 | ],
|
447 | type: 'bool'
|
448 | },
|
449 | submitWork: {
|
450 | description: 'Used for submitting a proof-of-work solution.',
|
451 | params: [
|
452 | {
|
453 | name: 'nonce',
|
454 | type: 'H64'
|
455 | },
|
456 | {
|
457 | name: 'headerHash',
|
458 | type: 'H256'
|
459 | },
|
460 | {
|
461 | name: 'mixDigest',
|
462 | type: 'H256'
|
463 | }
|
464 | ],
|
465 | type: 'bool'
|
466 | },
|
467 | subscribe: {
|
468 | description: 'Subscribe to Eth subscription.',
|
469 | params: [
|
470 | { name: 'kind', type: 'EthSubKind' },
|
471 | {
|
472 | isOptional: true,
|
473 | name: 'params',
|
474 | type: 'EthSubParams'
|
475 | }
|
476 | ],
|
477 | pubsub: [
|
478 | 'subscription',
|
479 | 'subscribe',
|
480 | 'unsubscribe'
|
481 | ],
|
482 | type: 'Null'
|
483 | },
|
484 | syncing: {
|
485 | description: 'Returns an object with data about the sync status or false.',
|
486 | params: [],
|
487 | type: 'EthSyncStatus'
|
488 | },
|
489 | uninstallFilter: {
|
490 | description: 'Uninstalls filter.',
|
491 | params: [
|
492 | {
|
493 | name: 'index',
|
494 | type: 'U256'
|
495 | }
|
496 | ],
|
497 | type: 'bool'
|
498 | }
|
499 | };
|