@@ -107,6 +107,49 @@ async def coroutine(self) -> Dict[str, Any]:
107
107
)
108
108
return dict (mapcat (dict .items , concat (batches )))
109
109
110
+ def contract_query (self , request_signature : list , return_signature : tuple ):
111
+ self .calls .append (Call (self .multicall_address , request_signature , (return_signature )))
112
+
113
+ def get_base_fee (self , return_signature : tuple = ('base_fee' , None )):
114
+ signature = ['getBasefee()(uint256)' ]
115
+ self .contract_query (signature , return_signature )
116
+
117
+ def get_block_hash (self , block_number : int , return_signature : tuple = ('block_hash' , None )):
118
+ signature = ['getBlockHash(uint256)(bytes32)' , int ]
119
+ self .contract_query (signature , return_signature )
120
+
121
+ def get_block_number (self , return_signature : tuple = ('block_number' , None )):
122
+ signature = ['getBlockNumber()(uint256)' ]
123
+ self .contract_query (signature , return_signature )
124
+
125
+ def get_chain_id (self , return_signature : tuple = ('chain_id' , None )):
126
+ signature = ['getChainId()(uint256)' ]
127
+ self .contract_query (signature , return_signature )
128
+
129
+ def get_block_coinbase (self , return_signature : tuple = ('coinbase' , None )):
130
+ signature = ['getCurrentBlockCoinbase()(address)' ]
131
+ self .contract_query (signature , return_signature )
132
+
133
+ def get_block_difficulty (self , return_signature : tuple = ('difficulty' , None )):
134
+ signature = ['getCurrentBlockDifficulty()(address)' ]
135
+ self .contract_query (signature , return_signature )
136
+
137
+ def get_block_gas_limit (self , return_signature : tuple = ('gas_limit' , None )):
138
+ signature = ['getCurrentBlockGasLimit()(uint256)' ]
139
+ self .contract_query (signature , return_signature )
140
+
141
+ def get_block_timestamp (self , return_signature : tuple = ('timestamp' , None )):
142
+ signature = ['getCurrentBlockTimestamp()(uint256)' ]
143
+ self .contract_query (signature , return_signature )
144
+
145
+ def get_eth_balance (self , address : AnyAddress , return_signature : tuple = ('eth_balance' , None )):
146
+ signature = ['getEthBalance(address)(uint256)' , address ]
147
+ self .contract_query (signature , return_signature )
148
+
149
+ def get_last_block_hash (self , return_signature : tuple = ('last_block_hash' , None )):
150
+ signature = ['getLastBlockHash()(bytes32)' ]
151
+ self .contract_query (signature , return_signature )
152
+
110
153
async def fetch_outputs (
111
154
self , calls : List [Call ], ConnErr_retries : int = 0 , id : str = ""
112
155
) -> List [CallResponse ]:
0 commit comments