Skip to content

Commit

Permalink
Fix digests
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-mysten committed Dec 12, 2024
1 parent b3537da commit 33c411f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
14 changes: 10 additions & 4 deletions crates/sui-graphql-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Option<u64>> {
pub async fn total_transaction_blocks_by_digest(
&self,
digest: CheckpointDigest,
) -> Result<Option<u64>> {
self.internal_total_transaction_blocks(Some(digest.to_string()), None)
.await
}
Expand Down Expand Up @@ -643,7 +646,7 @@ impl Client {
/// provided, it will use the last known checkpoint id.
pub async fn checkpoint(
&self,
digest: Option<Digest>,
digest: Option<CheckpointDigest>,
seq_num: Option<u64>,
) -> Result<Option<CheckpointSummary>> {
if digest.is_some() && seq_num.is_some() {
Expand Down Expand Up @@ -1434,7 +1437,10 @@ impl Client {
// ===========================================================================

/// Get a transaction by its digest.
pub async fn transaction(&self, digest: Digest) -> Result<Option<SignedTransaction>> {
pub async fn transaction(
&self,
digest: TransactionDigest,
) -> Result<Option<SignedTransaction>> {
let operation = TransactionBlockQuery::build(TransactionBlockArgs {
digest: digest.to_string(),
});
Expand Down
5 changes: 3 additions & 2 deletions crates/sui-transaction-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ mod tests {
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)]
Expand Down Expand Up @@ -595,7 +596,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;
}
Expand All @@ -605,7 +606,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<Option<TransactionEffects>, sui_graphql_client::error::Error>,
) {
assert!(effects.is_ok(), "Execution failed. Effects: {:?}", effects);
Expand Down

0 comments on commit 33c411f

Please sign in to comment.