Skip to content

Commit ecd8391

Browse files
committed
sdk: remove Client::state
Signed-off-by: Yuki Kishimoto <[email protected]>
1 parent 6e9cb59 commit ecd8391

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
* pool: remove `Relay` constructors ([Yuki Kishimoto])
5252
* pool: change `RelayPool::new` signature ([Yuki Kishimoto])
5353
* sdk: change `Client::fetch_metadata` output ([Yuki Kishimoto])
54+
* sdk: remove `Client::state` ([Yuki Kishimoto])
5455

5556
### Changed
5657

crates/nostr-sdk/src/client/mod.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use std::time::Duration;
1212

1313
use nostr::prelude::*;
1414
use nostr_database::prelude::*;
15-
use nostr_relay_pool::__private::SharedState;
1615
use nostr_relay_pool::prelude::*;
1716
use tokio::sync::broadcast;
1817

@@ -97,11 +96,6 @@ impl Client {
9796
}
9897
}
9998

100-
#[inline]
101-
fn state(&self) -> &SharedState {
102-
self.pool.state()
103-
}
104-
10599
/// Update minimum POW difficulty for received events
106100
///
107101
/// Events with a POW lower than the current value will be ignored to prevent resources exhaustion.
@@ -116,13 +110,13 @@ impl Client {
116110
/// <https://github.com/nostr-protocol/nips/blob/master/42.md>
117111
#[inline]
118112
pub fn automatic_authentication(&self, enable: bool) {
119-
self.state().automatic_authentication(enable);
113+
self.pool.state().automatic_authentication(enable);
120114
}
121115

122116
/// Check if signer is configured
123117
#[inline]
124118
pub async fn has_signer(&self) -> bool {
125-
self.state().has_signer().await
119+
self.pool.state().has_signer().await
126120
}
127121

128122
/// Get current nostr signer
@@ -132,7 +126,7 @@ impl Client {
132126
/// Returns an error if the signer isn't set.
133127
#[inline]
134128
pub async fn signer(&self) -> Result<Arc<dyn NostrSigner>, Error> {
135-
Ok(self.state().signer().await?)
129+
Ok(self.pool.state().signer().await?)
136130
}
137131

138132
/// Set nostr signer
@@ -141,13 +135,13 @@ impl Client {
141135
where
142136
T: IntoNostrSigner,
143137
{
144-
self.state().set_signer(signer).await;
138+
self.pool.state().set_signer(signer).await;
145139
}
146140

147141
/// Unset nostr signer
148142
#[inline]
149143
pub async fn unset_signer(&self) {
150-
self.state().unset_signer().await;
144+
self.pool.state().unset_signer().await;
151145
}
152146

153147
/// Get [`RelayPool`]

0 commit comments

Comments
 (0)