diff --git a/crates/sui-json-rpc/src/coin_api.rs b/crates/sui-json-rpc/src/coin_api.rs index aeda2cb6dcb38..43a880f525513 100644 --- a/crates/sui-json-rpc/src/coin_api.rs +++ b/crates/sui-json-rpc/src/coin_api.rs @@ -276,9 +276,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) { @@ -290,7 +288,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()) @@ -1401,8 +1399,8 @@ mod tests { .expect_find_publish_txn_digest() .return_once(move |_| Ok(transaction_digest)); mock_state - .expect_get_executed_transaction_and_effects() - .return_once(move |_, _| Ok((create_fake_transaction(), transaction_effects))); + .expect_multi_get() + .return_once(move |_, _, _| Ok((vec![], vec![Some(transaction_effects)], vec![]))); let coin_read_api = CoinReadApi::new_for_tests(Arc::new(mock_state), None); let response = coin_read_api.get_total_supply(coin_name.clone()).await; @@ -1410,9 +1408,9 @@ mod tests { assert!(response.is_err()); let error_result = response.unwrap_err(); let error_object: ErrorObjectOwned = error_result.into(); - let expected = expect!["-32602"]; + let expected = expect!["-32000"]; expected.assert_eq(&error_object.code().to_string()); - let expected = expect!["Cannot find object [0x2::coin::TreasuryCap<0xf::test_coin::TEST_COIN>] from [0x000000000000000000000000000000000000000000000000000000000000000f] package event."]; + let expected = expect!["task 1 panicked"]; expected.assert_eq(error_object.message()); }