Skip to content

Commit 36d9dbd

Browse files
Amends the private get checkpoints function in account to return the output wrapped within a result object.
1 parent 2587286 commit 36d9dbd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/sui-rosetta/src/account.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use crate::types::{
1818
};
1919
use crate::{OnlineServerContext, SuiEnv};
2020
use std::time::Duration;
21+
use sui_sdk::error::SuiRpcResult;
2122
use sui_types::messages_checkpoint::CheckpointSequenceNumber;
2223

2324
/// Get an array of all AccountBalances for an AccountIdentifier and the BlockIdentifier
@@ -34,10 +35,10 @@ pub async fn balance(
3435
let mut retry_attempts = 5;
3536
while retry_attempts > 0 {
3637
let balances_first = get_balances(&ctx, &request, address, currencies.clone()).await?;
37-
let checkpoint1 = get_checkpoint(&ctx).await;
38-
let mut checkpoint2 = get_checkpoint(&ctx).await;
38+
let checkpoint1 = get_checkpoint(&ctx).await.unwrap();
39+
let mut checkpoint2 = get_checkpoint(&ctx).await.unwrap();
3940
while checkpoint2 <= checkpoint1 {
40-
checkpoint2 = get_checkpoint(&ctx).await;
41+
checkpoint2 = get_checkpoint(&ctx).await.unwrap();
4142
tokio::time::sleep(Duration::from_secs(1)).await;
4243
}
4344
let balances_second = get_balances(&ctx, &request, address, currencies.clone()).await?;
@@ -61,12 +62,11 @@ pub async fn balance(
6162
Err(Error::RetryExhausted(String::from("retry")))
6263
}
6364

64-
async fn get_checkpoint(ctx: &OnlineServerContext) -> CheckpointSequenceNumber {
65+
async fn get_checkpoint(ctx: &OnlineServerContext) -> SuiRpcResult<CheckpointSequenceNumber> {
6566
ctx.client
6667
.read_api()
6768
.get_latest_checkpoint_sequence_number()
6869
.await
69-
.unwrap()
7070
}
7171

7272
async fn get_balances(

0 commit comments

Comments
 (0)