@@ -36,7 +36,9 @@ proc registerDefaultFrontend*(engine: RpcVerificationEngine) =
3636
3737 latest.number.uint64
3838
39- engine.frontend.eth_getBalance = proc (address: Address , quantityTag: BlockTag ): Future [UInt256 ] {.async .} =
39+ engine.frontend.eth_getBalance = proc (
40+ address: Address , quantityTag: BlockTag
41+ ): Future [UInt256 ] {.async .} =
4042 let
4143 header = (await engine.getHeader (quantityTag)).valueOr:
4244 raise newException (ValueError , error)
@@ -45,16 +47,22 @@ proc registerDefaultFrontend*(engine: RpcVerificationEngine) =
4547
4648 account.balance
4749
48- engine.frontend.eth_getStorageAt = proc (address: Address , slot: UInt256 , quantityTag: BlockTag ): Future [FixedBytes [32 ]] {.async .} =
50+ engine.frontend.eth_getStorageAt = proc (
51+ address: Address , slot: UInt256 , quantityTag: BlockTag
52+ ): Future [FixedBytes [32 ]] {.async .} =
4953 let
5054 header = (await engine.getHeader (quantityTag)).valueOr:
5155 raise newException (ValueError , error)
52- storage = (await engine.getStorageAt (address, slot, header.number, header.stateRoot)).valueOr:
56+ storage = (
57+ await engine.getStorageAt (address, slot, header.number, header.stateRoot)
58+ ).valueOr:
5359 raise newException (ValueError , error)
5460
5561 storage.to (Bytes32 )
5662
57- engine.frontend.eth_getTransactionCount = proc (address: Address , quantityTag: BlockTag ): Future [Quantity ] {.async .} =
63+ engine.frontend.eth_getTransactionCount = proc (
64+ address: Address , quantityTag: BlockTag
65+ ): Future [Quantity ] {.async .} =
5866 let
5967 header = (await engine.getHeader (quantityTag)).valueOr:
6068 raise newException (ValueError , error)
@@ -63,7 +71,9 @@ proc registerDefaultFrontend*(engine: RpcVerificationEngine) =
6371
6472 Quantity (account.nonce)
6573
66- engine.frontend.eth_getCode = proc (address: Address , quantityTag: BlockTag ): Future [seq [byte ]] {.async .} =
74+ engine.frontend.eth_getCode = proc (
75+ address: Address , quantityTag: BlockTag
76+ ): Future [seq [byte ]] {.async .} =
6777 let
6878 header = (await engine.getHeader (quantityTag)).valueOr:
6979 raise newException (ValueError , error)
@@ -72,39 +82,53 @@ proc registerDefaultFrontend*(engine: RpcVerificationEngine) =
7282
7383 code
7484
75- engine.frontend.eth_getBlockByHash = proc (blockHash: Hash32 , fullTransactions: bool ): Future [BlockObject ] {.async .} =
85+ engine.frontend.eth_getBlockByHash = proc (
86+ blockHash: Hash32 , fullTransactions: bool
87+ ): Future [BlockObject ] {.async .} =
7688 (await engine.getBlock (blockHash, fullTransactions)).valueOr:
7789 raise newException (ValueError , error)
7890
79- engine.frontend.eth_getBlockByNumber = proc (blockTag: BlockTag , fullTransactions: bool ): Future [BlockObject ] {.async .} =
91+ engine.frontend.eth_getBlockByNumber = proc (
92+ blockTag: BlockTag , fullTransactions: bool
93+ ): Future [BlockObject ] {.async .} =
8094 (await engine.getBlock (blockTag, fullTransactions)).valueOr:
8195 raise newException (ValueError , error)
8296
83- engine.frontend.eth_getUncleCountByBlockNumber = proc (blockTag: BlockTag ): Future [Quantity ] {.async .} =
97+ engine.frontend.eth_getUncleCountByBlockNumber = proc (
98+ blockTag: BlockTag
99+ ): Future [Quantity ] {.async .} =
84100 let blk = (await engine.getBlock (blockTag, false )).valueOr:
85101 raise newException (ValueError , error)
86102
87103 Quantity (blk.uncles.len ())
88104
89- engine.frontend.eth_getUncleCountByBlockHash = proc (blockHash: Hash32 ): Future [Quantity ] {.async .} =
105+ engine.frontend.eth_getUncleCountByBlockHash = proc (
106+ blockHash: Hash32
107+ ): Future [Quantity ] {.async .} =
90108 let blk = (await engine.getBlock (blockHash, false )).valueOr:
91109 raise newException (ValueError , error)
92110
93111 Quantity (blk.uncles.len ())
94112
95- engine.frontend.eth_getBlockTransactionCountByNumber = proc (blockTag: BlockTag ): Future [Quantity ] {.async .} =
113+ engine.frontend.eth_getBlockTransactionCountByNumber = proc (
114+ blockTag: BlockTag
115+ ): Future [Quantity ] {.async .} =
96116 let blk = (await engine.getBlock (blockTag, true )).valueOr:
97117 raise newException (ValueError , error)
98118
99119 Quantity (blk.transactions.len)
100120
101- engine.frontend.eth_getBlockTransactionCountByHash = proc (blockHash: Hash32 ): Future [Quantity ] {.async .} =
121+ engine.frontend.eth_getBlockTransactionCountByHash = proc (
122+ blockHash: Hash32
123+ ): Future [Quantity ] {.async .} =
102124 let blk = (await engine.getBlock (blockHash, true )).valueOr:
103125 raise newException (ValueError , error)
104126
105127 Quantity (blk.transactions.len)
106128
107- engine.frontend.eth_getTransactionByBlockNumberAndIndex = proc (blockTag: BlockTag , index: Quantity ): Future [TransactionObject ] {.async .} =
129+ engine.frontend.eth_getTransactionByBlockNumberAndIndex = proc (
130+ blockTag: BlockTag , index: Quantity
131+ ): Future [TransactionObject ] {.async .} =
108132 let blk = (await engine.getBlock (blockTag, true )).valueOr:
109133 raise newException (ValueError , error)
110134
@@ -116,7 +140,9 @@ proc registerDefaultFrontend*(engine: RpcVerificationEngine) =
116140
117141 x.tx
118142
119- engine.frontend.eth_getTransactionByBlockHashAndIndex = proc (blockHash: Hash32 , index: Quantity ): Future [TransactionObject ] {.async .} =
143+ engine.frontend.eth_getTransactionByBlockHashAndIndex = proc (
144+ blockHash: Hash32 , index: Quantity
145+ ): Future [TransactionObject ] {.async .} =
120146 let blk = (await engine.getBlock (blockHash, true )).valueOr:
121147 raise newException (ValueError , error)
122148
@@ -128,13 +154,14 @@ proc registerDefaultFrontend*(engine: RpcVerificationEngine) =
128154
129155 x.tx
130156
131- engine.frontend.eth_call = proc (tx: TransactionArgs , blockTag: BlockTag , optimisticStateFetch: bool = true ): Future [seq [byte ]] {.async .} =
157+ engine.frontend.eth_call = proc (
158+ tx: TransactionArgs , blockTag: BlockTag , optimisticStateFetch: bool = true
159+ ): Future [seq [byte ]] {.async .} =
132160 if tx.to.isNone ():
133161 raise newException (ValueError , " to address is required" )
134162
135- let
136- header = (await engine.getHeader (blockTag)).valueOr:
137- raise newException (ValueError , error)
163+ let header = (await engine.getHeader (blockTag)).valueOr:
164+ raise newException (ValueError , error)
138165
139166 # Start fetching code to get it in the code cache
140167 discard engine.getCode (tx.to.get (), header.number, header.stateRoot)
@@ -157,13 +184,14 @@ proc registerDefaultFrontend*(engine: RpcVerificationEngine) =
157184
158185 return callResult.output
159186
160- engine.frontend.eth_createAccessList = proc (tx: TransactionArgs , blockTag: BlockTag , optimisticStateFetch: bool = true ): Future [AccessListResult ] {.async .} =
187+ engine.frontend.eth_createAccessList = proc (
188+ tx: TransactionArgs , blockTag: BlockTag , optimisticStateFetch: bool = true
189+ ): Future [AccessListResult ] {.async .} =
161190 if tx.to.isNone ():
162191 raise newException (ValueError , " to address is required" )
163192
164- let
165- header = (await engine.getHeader (blockTag)).valueOr:
166- raise newException (ValueError , error)
193+ let header = (await engine.getHeader (blockTag)).valueOr:
194+ raise newException (ValueError , error)
167195
168196 # Start fetching code to get it in the code cache
169197 discard engine.getCode (tx.to.get (), header.number, header.stateRoot)
@@ -182,13 +210,14 @@ proc registerDefaultFrontend*(engine: RpcVerificationEngine) =
182210 return
183211 AccessListResult (accessList: accessList, error: error, gasUsed: gasUsed.Quantity )
184212
185- engine.frontend.eth_estimateGas = proc (tx: TransactionArgs , blockTag: BlockTag , optimisticStateFetch: bool = true ): Future [Quantity ] {.async .} =
213+ engine.frontend.eth_estimateGas = proc (
214+ tx: TransactionArgs , blockTag: BlockTag , optimisticStateFetch: bool = true
215+ ): Future [Quantity ] {.async .} =
186216 if tx.to.isNone ():
187217 raise newException (ValueError , " to address is required" )
188218
189- let
190- header = (await engine.getHeader (blockTag)).valueOr:
191- raise newException (ValueError , error)
219+ let header = (await engine.getHeader (blockTag)).valueOr:
220+ raise newException (ValueError , error)
192221
193222 # Start fetching code to get it in the code cache
194223 discard engine.getCode (tx.to.get (), header.number, header.stateRoot)
@@ -204,7 +233,9 @@ proc registerDefaultFrontend*(engine: RpcVerificationEngine) =
204233
205234 return gasEstimate.Quantity
206235
207- engine.frontend.eth_getTransactionByHash = proc (txHash: Hash32 ): Future [TransactionObject ] {.async .} =
236+ engine.frontend.eth_getTransactionByHash = proc (
237+ txHash: Hash32
238+ ): Future [TransactionObject ] {.async .} =
208239 let tx =
209240 try :
210241 await engine.backend.eth_getTransactionByHash (txHash)
@@ -223,12 +254,16 @@ proc registerDefaultFrontend*(engine: RpcVerificationEngine) =
223254
224255 return tx
225256
226- engine.frontend.eth_getBlockReceipts = proc (blockTag: BlockTag ): Future [Opt [seq [ReceiptObject ]]] {.async .} =
257+ engine.frontend.eth_getBlockReceipts = proc (
258+ blockTag: BlockTag
259+ ): Future [Opt [seq [ReceiptObject ]]] {.async .} =
227260 let rxs = (await engine.getReceipts (blockTag)).valueOr:
228261 raise newException (ValueError , error)
229262 return Opt .some (rxs)
230263
231- engine.frontend.eth_getTransactionReceipt = proc (txHash: Hash32 ): Future [ReceiptObject ] {.async .} =
264+ engine.frontend.eth_getTransactionReceipt = proc (
265+ txHash: Hash32
266+ ): Future [ReceiptObject ] {.async .} =
232267 let
233268 rx =
234269 try :
@@ -244,11 +279,15 @@ proc registerDefaultFrontend*(engine: RpcVerificationEngine) =
244279
245280 raise newException (ValueError , " receipt couldn't be verified" )
246281
247- engine.frontend.eth_getLogs = proc (filterOptions: FilterOptions ): Future [seq [LogObject ]] {.async .} =
282+ engine.frontend.eth_getLogs = proc (
283+ filterOptions: FilterOptions
284+ ): Future [seq [LogObject ]] {.async .} =
248285 (await engine.getLogs (filterOptions)).valueOr:
249286 raise newException (ValueError , error)
250287
251- engine.frontend.eth_newFilter = proc (filterOptions: FilterOptions ): Future [string ] {.async .} =
288+ engine.frontend.eth_newFilter = proc (
289+ filterOptions: FilterOptions
290+ ): Future [string ] {.async .} =
252291 if engine.filterStore.len >= MAX_FILTERS :
253292 raise newException (ValueError , " FilterStore already full" )
254293
@@ -283,14 +322,18 @@ proc registerDefaultFrontend*(engine: RpcVerificationEngine) =
283322
284323 return false
285324
286- engine.frontend.eth_getFilterLogs = proc (filterId: string ): Future [seq [LogObject ]] {.async .} =
325+ engine.frontend.eth_getFilterLogs = proc (
326+ filterId: string
327+ ): Future [seq [LogObject ]] {.async .} =
287328 if filterId notin engine.filterStore:
288329 raise newException (ValueError , " Filter doesn't exist" )
289330
290331 (await engine.getLogs (engine.filterStore[filterId].filter)).valueOr:
291332 raise newException (ValueError , error)
292333
293- engine.frontend.eth_getFilterChanges = proc (filterId: string ): Future [seq [LogObject ]] {.async .} =
334+ engine.frontend.eth_getFilterChanges = proc (
335+ filterId: string
336+ ): Future [seq [LogObject ]] {.async .} =
294337 if filterId notin engine.filterStore:
295338 raise newException (ValueError , " Filter doesn't exist" )
296339
0 commit comments