feat(rpc): ots_hasCode implementation (#3886)

Co-authored-by: Miguel Palhas <mpalhas@gmail.com>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Resende
2023-07-24 16:44:07 +01:00
committed by GitHub
parent cb0947d7cb
commit 3ff9be6d4f
2 changed files with 2 additions and 4 deletions

View File

@@ -193,9 +193,7 @@ where
let nonce = 1;
let block_hash = H256::default();
assert!(is_unimplemented(
OtterscanClient::has_code(client, address, None).await.err().unwrap()
));
OtterscanClient::has_code(client, address, None).await.unwrap();
OtterscanClient::get_api_level(client).await.unwrap();

View File

@@ -31,7 +31,7 @@ where
{
/// Handler for `ots_hasCode`
async fn has_code(&self, address: Address, block_number: Option<BlockId>) -> RpcResult<bool> {
Err(internal_rpc_err("unimplemented"))
self.eth.get_code(address, block_number).await.map(|code| !code.is_empty())
}
/// Handler for `ots_getApiLevel`