diff --git a/crates/sui-graphql-client/src/lib.rs b/crates/sui-graphql-client/src/lib.rs index dec94cbdf..0919550db 100644 --- a/crates/sui-graphql-client/src/lib.rs +++ b/crates/sui-graphql-client/src/lib.rs @@ -81,9 +81,9 @@ use streams::stream_paginated_query; use sui_types::types::framework::Coin; use sui_types::types::Address; +use sui_types::types::CheckpointDigest; use sui_types::types::CheckpointSequenceNumber; use sui_types::types::CheckpointSummary; -use sui_types::types::Digest; use sui_types::types::Event; use sui_types::types::MovePackage; use sui_types::types::Object; @@ -483,7 +483,10 @@ impl Client { /// The total number of transaction blocks in the network by the end of the provided /// checkpoint digest. - pub async fn total_transaction_blocks_by_digest(&self, digest: Digest) -> Result> { + pub async fn total_transaction_blocks_by_digest( + &self, + digest: CheckpointDigest, + ) -> Result> { self.internal_total_transaction_blocks(Some(digest.to_string()), None) .await } @@ -643,7 +646,7 @@ impl Client { /// provided, it will use the last known checkpoint id. pub async fn checkpoint( &self, - digest: Option, + digest: Option, seq_num: Option, ) -> Result> { if digest.is_some() && seq_num.is_some() { @@ -1434,7 +1437,10 @@ impl Client { // =========================================================================== /// Get a transaction by its digest. - pub async fn transaction(&self, digest: Digest) -> Result> { + pub async fn transaction( + &self, + digest: TransactionDigest, + ) -> Result> { let operation = TransactionBlockQuery::build(TransactionBlockArgs { digest: digest.to_string(), }); @@ -2147,9 +2153,8 @@ mod tests { .unwrap(); let digest = chckp.digest(); - let total_transaction_blocks_by_digest = client - .total_transaction_blocks_by_digest(digest.into()) - .await; + let total_transaction_blocks_by_digest = + client.total_transaction_blocks_by_digest(digest).await; assert!(total_transaction_blocks_by_digest.is_ok()); assert_eq!( total_transaction_blocks_by_digest.unwrap().unwrap(), diff --git a/crates/sui-transaction-builder/src/lib.rs b/crates/sui-transaction-builder/src/lib.rs index 281e812bc..ab7a288d3 100644 --- a/crates/sui-transaction-builder/src/lib.rs +++ b/crates/sui-transaction-builder/src/lib.rs @@ -500,7 +500,7 @@ mod tests { use crate::Function; use crate::Serialized; use crate::TransactionBuilder; - use sui_types::types::Digest; + use sui_types::types::TransactionDigest; /// Type corresponding to the output of `sui move build --dump-bytecode-as-base64` #[derive(serde::Deserialize, Debug)] @@ -580,7 +580,7 @@ mod tests { .unwrap() .sent; let tx_digest = coins.first().unwrap().transfer_tx_digest; - wait_for_tx(client, tx_digest.into()).await; + wait_for_tx(client, tx_digest).await; let gas = coins.last().unwrap().id; // TODO when we have tx resolution, we can just pass an ObjectId @@ -595,7 +595,7 @@ mod tests { /// Wait for the transaction to be finalized and indexed. This queries the GraphQL server until /// it retrieves the requested transaction. - async fn wait_for_tx(client: &Client, digest: Digest) { + async fn wait_for_tx(client: &Client, digest: TransactionDigest) { while client.transaction(digest).await.unwrap().is_none() { tokio::time::sleep(tokio::time::Duration::from_millis(100)).await; } @@ -605,7 +605,7 @@ mod tests { /// transaction was successfully executed. async fn wait_for_tx_and_check_effects_status_success( client: &Client, - digest: Digest, + digest: TransactionDigest, effects: Result, sui_graphql_client::error::Error>, ) { assert!(effects.is_ok(), "Execution failed. Effects: {:?}", effects); @@ -675,7 +675,7 @@ mod tests { let sig = pk.sign_transaction(&tx).unwrap(); let effects = client.execute_tx(vec![sig], &tx).await; - wait_for_tx_and_check_effects_status_success(&client, tx.digest().into(), effects).await; + wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; // check that recipient has 1 coin let recipient_coins = client @@ -704,7 +704,7 @@ mod tests { let tx = tx.finish().unwrap(); let sig = pk.sign_transaction(&tx).unwrap(); let effects = client.execute_tx(vec![sig], &tx).await; - wait_for_tx_and_check_effects_status_success(&client, tx.digest().into(), effects).await; + wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; } #[tokio::test] @@ -724,7 +724,7 @@ mod tests { let sig = pk.sign_transaction(&tx).unwrap(); let effects = client.execute_tx(vec![sig], &tx).await; - wait_for_tx_and_check_effects_status_success(&client, tx.digest().into(), effects).await; + wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; // check that recipient has 1 coin let recipient_coins = client @@ -756,7 +756,7 @@ mod tests { // wait for the transaction to be finalized loop { - let tx_digest = client.transaction(tx.digest().into()).await.unwrap(); + let tx_digest = client.transaction(tx.digest()).await.unwrap(); if tx_digest.is_some() { break; } @@ -790,7 +790,7 @@ mod tests { let sig = pk.sign_transaction(&tx).unwrap(); let effects = client.execute_tx(vec![sig], &tx).await; - wait_for_tx_and_check_effects_status_success(&client, tx.digest().into(), effects).await; + wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; // check that there are two coins let coins_after = client @@ -813,7 +813,7 @@ mod tests { let sig = pk.sign_transaction(&tx).unwrap(); let effects = client.execute_tx(vec![sig], &tx).await; - wait_for_tx_and_check_effects_status_success(&client, tx.digest().into(), effects).await; + wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; } #[tokio::test] @@ -829,7 +829,7 @@ mod tests { let tx = tx.finish().unwrap(); let sig = pk.sign_transaction(&tx).unwrap(); let effects = client.execute_tx(vec![sig], &tx).await; - wait_for_tx_and_check_effects_status_success(&client, tx.digest().into(), effects).await; + wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; } #[tokio::test] @@ -868,7 +868,7 @@ mod tests { _ => panic!("Expected V2 effects"), } } - wait_for_tx_and_check_effects_status_success(&client, tx.digest().into(), effects).await; + wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; let mut tx = TransactionBuilder::new(); let mut upgrade_cap = None; @@ -939,6 +939,6 @@ mod tests { let tx = tx.finish().unwrap(); let sig = pk.sign_transaction(&tx).unwrap(); let effects = client.execute_tx(vec![sig], &tx).await; - wait_for_tx_and_check_effects_status_success(&client, tx.digest().into(), effects).await; + wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; } }