-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
101 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use sui_json_rpc_types::{ | ||
SuiTransactionBlockEffects, SuiTransactionBlockEvents, SuiTransactionBlockResponse, | ||
}; | ||
use sui_types::digests::TransactionDigest; | ||
|
||
pub struct RetrievedTransaction { | ||
pub tx_digest: TransactionDigest, | ||
pub events: SuiTransactionBlockEvents, | ||
pub checkpoint: u64, | ||
pub timestamp_ms: u64, | ||
pub effects: SuiTransactionBlockEffects, | ||
} | ||
|
||
impl TryFrom<SuiTransactionBlockResponse> for RetrievedTransaction { | ||
type Error = anyhow::Error; | ||
fn try_from(response: SuiTransactionBlockResponse) -> Result<Self, Self::Error> { | ||
Ok(RetrievedTransaction { | ||
tx_digest: response.digest, | ||
events: response | ||
.events | ||
.ok_or(anyhow::anyhow!("missing events in responses"))?, | ||
checkpoint: response | ||
.checkpoint | ||
.ok_or(anyhow::anyhow!("missing checkpoint in responses"))?, | ||
timestamp_ms: response | ||
.timestamp_ms | ||
.ok_or(anyhow::anyhow!("missing timestamp_ms in responses"))?, | ||
effects: response | ||
.effects | ||
.ok_or(anyhow::anyhow!("missing effects in responses"))?, | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters