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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
use crate::delta_ext::DeltaChangeSet;
use aptos_types::{
contract_event::ContractEvent,
transaction::{ChangeSet, TransactionOutput, TransactionStatus},
write_set::WriteSet,
};
pub struct ChangeSetExt {
delta_change_set: DeltaChangeSet,
change_set: ChangeSet,
}
impl ChangeSetExt {
pub fn new(delta_change_set: DeltaChangeSet, change_set: ChangeSet) -> Self {
ChangeSetExt {
delta_change_set,
change_set,
}
}
pub fn into_inner(self) -> (DeltaChangeSet, ChangeSet) {
(self.delta_change_set, self.change_set)
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct TransactionOutputExt {
delta_change_set: DeltaChangeSet,
output: TransactionOutput,
}
impl TransactionOutputExt {
pub fn new(delta_change_set: DeltaChangeSet, output: TransactionOutput) -> Self {
TransactionOutputExt {
delta_change_set,
output,
}
}
pub fn delta_change_set(&self) -> &DeltaChangeSet {
&self.delta_change_set
}
pub fn write_set(&self) -> &WriteSet {
self.output.write_set()
}
pub fn events(&self) -> &[ContractEvent] {
self.output.events()
}
pub fn gas_used(&self) -> u64 {
self.output.gas_used()
}
pub fn status(&self) -> &TransactionStatus {
self.output.status()
}
pub fn into(self) -> (DeltaChangeSet, TransactionOutput) {
(self.delta_change_set, self.output)
}
}
impl From<TransactionOutput> for TransactionOutputExt {
fn from(output: TransactionOutput) -> Self {
TransactionOutputExt {
delta_change_set: DeltaChangeSet::empty(),
output,
}
}
}