1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#![forbid(unsafe_code)]
mod account_resource;
mod auto_validate;
pub mod command;
mod governance;
pub mod json_rpc;
pub mod keys;
mod owner;
mod print;
mod validate_transaction;
mod validator_config;
mod validator_set;
mod network_checker;
#[cfg(any(test, feature = "testing"))]
pub mod test_helper;
use diem_client::views::VMStatusView;
use diem_types::account_address::AccountAddress;
use serde::Serialize;
#[derive(Debug, PartialEq, Eq, Serialize)]
pub struct TransactionContext {
pub address: AccountAddress,
pub sequence_number: u64,
pub execution_result: Option<VMStatusView>,
}
impl TransactionContext {
pub fn new(address: AccountAddress, sequence_number: u64) -> TransactionContext {
TransactionContext::new_with_validation(address, sequence_number, None)
}
pub fn new_with_validation(
address: AccountAddress,
sequence_number: u64,
execution_result: Option<VMStatusView>,
) -> TransactionContext {
TransactionContext {
address,
sequence_number,
execution_result,
}
}
}