1
1
from .client import Client
2
+ from typing import Union
2
3
3
4
4
5
class Proxies (Client ):
@@ -11,3 +12,62 @@ def get_most_recent_block(self):
11
12
self .build_url ()
12
13
req = self .connect ()
13
14
return req ['result' ]
15
+
16
+ def get_block_by_number (self , block_number : Union [str , int ]):
17
+ self .url_dict [self .ACTION ] = 'eth_getBlockByNumber'
18
+ self .url_dict [self .TAG ] = block_number if type (block_number ) is str else hex (block_number )
19
+ self .url_dict [self .BOOLEAN ] = 'true'
20
+ self .build_url ()
21
+ req = self .connect ()
22
+ return req ['result' ]
23
+
24
+ def get_uncle_by_blocknumber_index (self ,
25
+ block_number : Union [str , int ],
26
+ index : Union [str , int ]):
27
+ self .url_dict [self .ACTION ] = 'eth_getUncleByBlockNumberAndIndex'
28
+ self .url_dict [self .TAG ] = block_number if type (block_number ) is str else hex (block_number )
29
+ self .url_dict [self .INDEX ] = index if type (index ) is str else hex (index )
30
+ self .build_url ()
31
+ req = self .connect ()
32
+ return req ['result' ]
33
+
34
+ def get_block_transaction_count_by_number (self , block_number : Union [str , int ]):
35
+ self .url_dict [self .ACTION ] = 'eth_getBlockTransactionCountByNumber'
36
+ self .url_dict [self .TAG ] = block_number if type (block_number ) is str else hex (block_number )
37
+ self .build_url ()
38
+ req = self .connect ()
39
+ return req ['result' ]
40
+
41
+ def get_transaction_by_hash (self , tx_hash : str ):
42
+ self .url_dict [self .ACTION ] = 'eth_getTransactionByHash'
43
+ self .url_dict [self .TXHASH ] = tx_hash
44
+ self .build_url ()
45
+ req = self .connect ()
46
+ return req ['result' ]
47
+
48
+ def get_transaction_by_blocknumber_index (self ,
49
+ block_number : Union [str , int ],
50
+ index : Union [str , int ]):
51
+ self .url_dict [self .ACTION ] = 'eth_getTransactionByBlockNumberAndIndex'
52
+ self .url_dict [self .TAG ] = block_number if type (block_number ) is str else hex (block_number )
53
+ self .url_dict [self .INDEX ] = index if type (index ) is str else hex (index )
54
+ self .build_url ()
55
+ req = self .connect ()
56
+ return req ['result' ]
57
+
58
+ def get_transaction_count (self , address : str ):
59
+ self .url_dict [self .ACTION ] = 'eth_getTransactionCount'
60
+ self .url_dict [self .ADDRESS ] = address
61
+ self .url_dict [self .TAG ] = 'latest'
62
+ self .build_url ()
63
+ req = self .connect ()
64
+ return req ['result' ]
65
+
66
+ def get_transaction_receipt (self , tx_hash : str ):
67
+ self .url_dict [self .ACTION ] = 'eth_getTransactionReceipt'
68
+ self .url_dict [self .TXHASH ] = tx_hash
69
+ self .build_url ()
70
+ req = self .connect ()
71
+ return req ['result' ]
72
+
73
+
0 commit comments