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
use async_trait;
use crateWallet;
use crateWalletResult;
/// Feature identifier for the standard disconnect feature.
///
/// This constant is used to identify the disconnect feature in the wallet's
/// feature list. Wallets that implement the `WalletStandardDisconnect` trait
/// should include this identifier in their feature list.
pub const STANDARD_DISCONNECT: &str = "standard:disconnect";
/// Trait for wallets that support disconnecting.
///
/// This trait defines a method for disconnecting from a wallet, which revokes
/// the app's authorization to use the wallet's accounts. After disconnecting,
/// the app will need to connect again to use the wallet.
///
/// # Example Implementation
///
/// ```rust,ignore
/// #[async_trait(?Send)]
/// impl WalletStandardDisconnect for MyWallet {
/// async fn disconnect(&mut self) -> WalletResult<()> {
/// // Clear the current account
/// self.current_account = None;
///
/// // Optionally, perform any cleanup or notify the wallet's backend
/// self.notify_backend_of_disconnect().await?;
///
/// Ok(())
/// }
/// }
/// ```