1use std::time::Duration;
8
9use nostr_relay_pool::monitor::Monitor;
10use nostr_relay_pool::{ConnectionMode, RelayOptions};
11
12pub const DEFAULT_TIMEOUT: Duration = Duration::from_secs(60);
14
15#[derive(Debug, Clone)]
17pub struct NostrWalletConnectOptions {
18 pub(super) relay: RelayOptions,
19 pub(super) timeout: Duration,
20 pub(super) monitor: Option<Monitor>,
21}
22
23impl Default for NostrWalletConnectOptions {
24 fn default() -> Self {
25 Self {
26 relay: RelayOptions::default(),
27 timeout: DEFAULT_TIMEOUT,
28 monitor: None,
29 }
30 }
31}
32
33impl NostrWalletConnectOptions {
34 #[inline]
36 pub fn new() -> Self {
37 Self::default()
38 }
39
40 #[deprecated(
42 since = "0.43.0",
43 note = "Use `NostrWalletConnectOptions::relay` instead"
44 )]
45 pub fn connection_mode(self, mode: ConnectionMode) -> Self {
46 Self {
47 relay: self.relay.connection_mode(mode),
48 ..self
49 }
50 }
51
52 #[inline]
54 pub fn timeout(mut self, timeout: Duration) -> Self {
55 self.timeout = timeout;
56 self
57 }
58
59 #[inline]
61 pub fn monitor(mut self, monitor: Monitor) -> Self {
62 self.monitor = Some(monitor);
63 self
64 }
65
66 pub fn relay(self, opts: RelayOptions) -> Self {
68 Self {
69 relay: opts,
70 ..self
71 }
72 }
73}