From 295e735c28eb4338fea04de9e3f3fcae6ef5cf2f Mon Sep 17 00:00:00 2001 From: Xun Li Date: Thu, 10 Oct 2024 13:48:05 -0700 Subject: [PATCH] [RPC] Fix coin metadata api inefficiency --- crates/sui-json-rpc/src/coin_api.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/sui-json-rpc/src/coin_api.rs b/crates/sui-json-rpc/src/coin_api.rs index 99d7613d7ce61..fb4128bec2bd2 100644 --- a/crates/sui-json-rpc/src/coin_api.rs +++ b/crates/sui-json-rpc/src/coin_api.rs @@ -255,9 +255,7 @@ async fn find_package_object_id( spawn_monitored_task!(async move { let publish_txn_digest = state.find_publish_txn_digest(package_id)?; - let (_, effect) = state - .get_executed_transaction_and_effects(publish_txn_digest, kv_store) - .await?; + let effect = kv_store.get_fx_by_tx_digest(publish_txn_digest).await?; for ((id, _, _), _) in effect.created() { if let Ok(object_read) = state.get_object_read(&id) { @@ -269,7 +267,7 @@ async fn find_package_object_id( } } Err(SuiRpcInputError::GenericNotFound(format!( - "Cannot find object [{}] from [{}] package event.", + "Cannot find object with type [{}] from [{}] package created objects.", object_struct_tag, package_id, )) .into())