(module: &mut RpcModule<Context>)
| 81 | } |
| 82 | |
| 83 | pub(crate) fn eth_get_balance_by_block(module: &mut RpcModule<Context>) -> Result<()> { |
| 84 | module.register_async_method( |
| 85 | "eth_getBalanceByBlock", |
| 86 | move |params, blockchain| async move { |
| 87 | let mut seq = params.sequence(); |
| 88 | let account = seq.next::<Account>()?; |
| 89 | let block = seq.next::<String>()?.clone(); |
| 90 | let block_number = blockchain |
| 91 | .lock() |
| 92 | .await |
| 93 | .parse_block_number(&block) |
| 94 | .map_err(|e| JsonRpseeError::Custom(e.to_string()))?; |
| 95 | |
| 96 | let balance = blockchain |
| 97 | .lock() |
| 98 | .await |
| 99 | .accounts |
| 100 | .get_account_balance_by_block(&account, &block_number) |
| 101 | .map_err(|e| Error::Custom(e.to_string()))?; |
| 102 | |
| 103 | Ok(to_hex(balance)) |
| 104 | }, |
| 105 | )?; |
| 106 | |
| 107 | Ok(()) |
| 108 | } |
| 109 | |
| 110 | pub(crate) fn eth_send_transaction(module: &mut RpcModule<Context>) -> Result<()> { |
| 111 | module.register_async_method( |
no test coverage detected