smart_wallet/events.rs
1//! Events emitted.
2#![deny(missing_docs)]
3
4use crate::*;
5
6/// Emitted when a [SmartWallet] is created.
7#[event]
8pub struct WalletCreateEvent {
9 /// The [SmartWallet].
10 #[index]
11 pub smart_wallet: Pubkey,
12 /// The owners of the created [SmartWallet].
13 pub owners: Vec<Pubkey>,
14 /// The [SmartWallet::threshold] at the time of creation.
15 pub threshold: u64,
16 /// The [SmartWallet::minimum_delay] at the time of creation.
17 pub minimum_delay: i64,
18 /// The Unix timestamp when the event was emitted.
19 pub timestamp: i64,
20}
21
22/// Emitted when the owners of a [SmartWallet] are changed.
23#[event]
24pub struct WalletSetOwnersEvent {
25 /// The [SmartWallet].
26 #[index]
27 pub smart_wallet: Pubkey,
28 /// The new owners of the [SmartWallet].
29 pub owners: Vec<Pubkey>,
30 /// The Unix timestamp when the event was emitted.
31 pub timestamp: i64,
32}
33
34/// Emitted when the threshold of a [SmartWallet] is changed.
35#[event]
36pub struct WalletChangeThresholdEvent {
37 /// The [SmartWallet].
38 #[index]
39 pub smart_wallet: Pubkey,
40 /// The new [SmartWallet::threshold].
41 pub threshold: u64,
42 /// The Unix timestamp when the event was emitted.
43 pub timestamp: i64,
44}
45
46/// Emitted when a [Transaction] is proposed.
47#[event]
48pub struct TransactionCreateEvent {
49 /// The [SmartWallet].
50 #[index]
51 pub smart_wallet: Pubkey,
52 /// The [Transaction].
53 #[index]
54 pub transaction: Pubkey,
55 /// The owner which proposed the transaction.
56 pub proposer: Pubkey,
57 /// Instructions associated with the [Transaction].
58 pub instructions: Vec<TXInstruction>,
59 /// The [Transaction::eta].
60 pub eta: i64,
61 /// The Unix timestamp when the event was emitted.
62 pub timestamp: i64,
63}
64
65/// Emitted when a [Transaction] is approved.
66#[event]
67pub struct TransactionApproveEvent {
68 /// The [SmartWallet].
69 #[index]
70 pub smart_wallet: Pubkey,
71 /// The [Transaction].
72 #[index]
73 pub transaction: Pubkey,
74 /// The owner which approved the transaction.
75 pub owner: Pubkey,
76 /// The Unix timestamp when the event was emitted.
77 pub timestamp: i64,
78}
79
80/// Emitted when a [Transaction] is unapproved.
81#[event]
82pub struct TransactionUnapproveEvent {
83 /// The [SmartWallet].
84 #[index]
85 pub smart_wallet: Pubkey,
86 /// The [Transaction].
87 #[index]
88 pub transaction: Pubkey,
89 /// The owner that unapproved the transaction.
90 pub owner: Pubkey,
91 /// The Unix timestamp when the event was emitted.
92 pub timestamp: i64,
93}
94
95/// Emitted when a [Transaction] is executed.
96#[event]
97pub struct TransactionExecuteEvent {
98 /// The [SmartWallet].
99 #[index]
100 pub smart_wallet: Pubkey,
101 /// The [Transaction] executed.
102 #[index]
103 pub transaction: Pubkey,
104 /// The owner that executed the transaction.
105 pub executor: Pubkey,
106 /// The Unix timestamp when the event was emitted.
107 pub timestamp: i64,
108}