Skip to content

Commit

Permalink
js: remove RelayPool
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Kishimoto <[email protected]>
  • Loading branch information
yukibtc committed Dec 1, 2024
1 parent 39994be commit ae8bf5d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 444 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
* ffi: drop support for `i686-linux-android` target ([Yuki Kishimoto])
* ffi: remove `MockRelay` ([Yuki Kishimoto])
* ffi: remove `RawEvent` and `RawEventRecord` ([Yuki Kishimoto])
* ffi: remove `RelayPool` ([Yuki Kishimoto])
* bindings: remove `RelayPool` ([Yuki Kishimoto])

### Deprecated

Expand Down
17 changes: 10 additions & 7 deletions bindings/nostr-sdk-js/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ use crate::database::{JsEvents, JsNostrDatabase};
use crate::duration::JsDuration;
use crate::error::{into_err, Result};
use crate::pool::output::{JsOutput, JsReconciliationOutput, JsSendEventOutput, JsSubscribeOutput};
use crate::pool::JsRelayPool;
use crate::protocol::event::{JsEvent, JsEventBuilder, JsTag};
use crate::protocol::key::JsPublicKey;
use crate::protocol::message::{JsClientMessage, JsRelayMessage};
use crate::protocol::nips::nip59::JsUnwrappedGift;
use crate::protocol::types::{JsFilter, JsMetadata};
use crate::relay::filtering::JsRelayFiltering;
use crate::relay::options::{JsSubscribeAutoCloseOptions, JsSyncOptions};
use crate::relay::options::{JsRelayOptions, JsSubscribeAutoCloseOptions, JsSyncOptions};
use crate::relay::{JsRelay, JsRelayArray};
use crate::signer::JsNostrSigner;

Expand Down Expand Up @@ -92,11 +91,6 @@ impl JsClient {
Ok(self.inner.signer().await.map_err(into_err)?.into())
}

#[wasm_bindgen(getter)]
pub fn pool(&self) -> JsRelayPool {
self.inner.pool().clone().into()
}

#[wasm_bindgen(getter)]
pub fn database(&self) -> JsNostrDatabase {
self.inner.database().clone().into()
Expand Down Expand Up @@ -148,6 +142,15 @@ impl JsClient {
self.inner.add_relay(url).await.map_err(into_err)
}

#[wasm_bindgen(js_name = addRelayWithOpts)]
pub async fn add_relay_with_opts(&self, url: &str, opts: &JsRelayOptions) -> Result<bool> {
self.inner
.pool()
.add_relay(url, opts.deref().clone())
.await
.map_err(into_err)
}

/// Add discovery relay
///
/// If relay already exists, this method automatically add the `DISCOVERY` flag to it and return `false`.
Expand Down
Loading

0 comments on commit ae8bf5d

Please sign in to comment.