Skip to content

Commit

Permalink
[fix] fix the clippy error
Browse files Browse the repository at this point in the history
  • Loading branch information
vegetabledogdog committed May 20, 2024
1 parent 16bd077 commit b252b6d
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions crates/rooch-rpc-server/src/service/rpc_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use anyhow::Result;
use move_core_types::account_address::AccountAddress;
use move_core_types::identifier::Identifier;
use move_core_types::language_storage::StructTag;
use move_core_types::language_storage::{ModuleId, StructTag};
use moveos_types::access_path::AccessPath;
use moveos_types::function_return_value::AnnotatedFunctionResult;
use moveos_types::h256::H256;
Expand Down Expand Up @@ -79,13 +79,7 @@ impl RpcService {
function_call: FunctionCall,
) -> Result<AnnotatedFunctionResult> {
let module_id = function_call.function_id.module_id.clone();
if !self
.exists_module(
module_id.address().clone(),
Identifier::from(module_id.name()),
)
.await?
{
if !self.exists_module(module_id.clone()).await? {
return Err(anyhow::anyhow!("Module does not exist: {}", module_id));
}

Expand All @@ -108,13 +102,12 @@ impl RpcService {
Ok(resp.pop().flatten().is_some())
}

pub async fn exists_module(
&self,
address: AccountAddress,
module_name: Identifier,
) -> Result<bool> {
pub async fn exists_module(&self, module_id: ModuleId) -> Result<bool> {
let mut resp = self
.get_states(AccessPath::module(address, module_name))
.get_states(AccessPath::module(
*module_id.address(),
Identifier::from(module_id.name()),
))
.await?;
Ok(resp.pop().flatten().is_some())
}
Expand Down

0 comments on commit b252b6d

Please sign in to comment.