pub struct Client { /* private fields */ }
Implementations§
source§impl Client
impl Client
pub fn new(keys: &Keys) -> Self
pub fn with_opts(keys: &Keys, opts: Options) -> Self
sourcepub fn with_remote_signer(app_keys: &Keys, remote_signer: RemoteSigner) -> Self
pub fn with_remote_signer(app_keys: &Keys, remote_signer: RemoteSigner) -> Self
Create a new NIP46 Client
sourcepub fn with_remote_signer_and_opts(
app_keys: &Keys,
remote_signer: RemoteSigner,
opts: Options
) -> Self
pub fn with_remote_signer_and_opts( app_keys: &Keys, remote_signer: RemoteSigner, opts: Options ) -> Self
Create a new NIP46 Client with custom Options
pub fn update_difficulty(&self, difficulty: u8)
sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if RelayPool
is running
sourcepub fn clear_already_seen_events(&self)
pub fn clear_already_seen_events(&self)
Clear already seen events
pub fn notifications(&self) -> Receiver<RelayPoolNotification>
sourcepub fn relay<U>(&self, url: U) -> Result<Relay, Error>where
U: TryIntoUrl,
Error: From<<U as TryIntoUrl>::Err>,
pub fn relay<U>(&self, url: U) -> Result<Relay, Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,
Get Relay
sourcepub fn add_relays<U>(
&self,
relays: Vec<(U, Option<SocketAddr>)>
) -> Result<(), Error>where
U: TryIntoUrl,
Error: From<<U as TryIntoUrl>::Err>,
pub fn add_relays<U>( &self, relays: Vec<(U, Option<SocketAddr>)> ) -> Result<(), Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,
Add multiple relays
pub fn add_relay<U>( &self, url: U, proxy: Option<SocketAddr> ) -> Result<(), Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,
pub fn add_relay_with_opts<U>( &self, url: U, proxy: Option<SocketAddr>, opts: RelayOptions ) -> Result<(), Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,
pub fn remove_relay<U>(&self, url: U) -> Result<(), Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,
pub fn connect_relay<U>(&self, url: U) -> Result<(), Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,
pub fn disconnect_relay<U>(&self, url: U) -> Result<(), Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,
pub fn connect(&self)
pub fn disconnect(&self) -> Result<(), Error>
pub fn subscribe(&self, filters: Vec<Filter>)
pub fn unsubscribe(&self)
pub fn get_events_of( &self, filters: Vec<Filter>, timeout: Option<Duration> ) -> Result<Vec<Event>, Error>
pub fn req_events_of(&self, filters: Vec<Filter>, timeout: Option<Duration>)
pub fn send_msg(&self, msg: ClientMessage) -> Result<(), Error>
pub fn send_msg_to<U>(&self, url: U, msg: ClientMessage) -> Result<(), Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,
pub fn send_event_to<U>(&self, url: U, event: Event) -> Result<EventId, Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,
pub fn set_metadata(&self, metadata: Metadata) -> Result<EventId, Error>
pub fn publish_text_note<S>( &self, content: S, tags: &[Tag] ) -> Result<EventId, Error>where S: Into<String>,
pub fn add_recommended_relay<U>(&self, url: U) -> Result<EventId, Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,
pub fn set_contact_list(&self, list: Vec<Contact>) -> Result<EventId, Error>
pub fn get_contact_list( &self, timeout: Option<Duration> ) -> Result<Vec<Contact>, Error>
pub fn get_contact_list_public_keys( &self, timeout: Option<Duration> ) -> Result<Vec<XOnlyPublicKey>, Error>
pub fn get_contact_list_metadata( &self, timeout: Option<Duration> ) -> Result<HashMap<XOnlyPublicKey, Metadata>, Error>
pub fn send_direct_msg<S>( &self, receiver: XOnlyPublicKey, msg: S, reply: Option<EventId> ) -> Result<EventId, Error>where S: Into<String>,
pub fn repost_event( &self, event_id: EventId, public_key: XOnlyPublicKey ) -> Result<EventId, Error>
pub fn delete_event<S>( &self, event_id: EventId, reason: Option<S> ) -> Result<EventId, Error>where S: Into<String>,
pub fn like( &self, event_id: EventId, public_key: XOnlyPublicKey ) -> Result<EventId, Error>
pub fn dislike( &self, event_id: EventId, public_key: XOnlyPublicKey ) -> Result<EventId, Error>
pub fn reaction<S>( &self, event_id: EventId, public_key: XOnlyPublicKey, content: S ) -> Result<EventId, Error>where S: Into<String>,
pub fn new_channel(&self, metadata: Metadata) -> Result<EventId, Error>
pub fn set_channel_metadata( &self, channel_id: ChannelId, relay_url: Option<Url>, metadata: Metadata ) -> Result<EventId, Error>
pub fn send_channel_msg<S>( &self, channel_id: ChannelId, relay_url: Url, msg: S ) -> Result<EventId, Error>where S: Into<String>,
pub fn hide_channel_msg<S>( &self, message_id: EventId, reason: Option<S> ) -> Result<EventId, Error>where S: Into<String>,
pub fn mute_channel_user<S>( &self, pubkey: XOnlyPublicKey, reason: Option<S> ) -> Result<EventId, Error>where S: Into<String>,
sourcepub fn auth<S>(&self, challenge: S, relay: Url) -> Result<EventId, Error>where
S: Into<String>,
pub fn auth<S>(&self, challenge: S, relay: Url) -> Result<EventId, Error>where S: Into<String>,
Create an auth event
sourcepub fn new_zap_receipt<S>(
&self,
bolt11: S,
preimage: Option<S>,
zap_request: Event
) -> Result<EventId, Error>where
S: Into<String>,
pub fn new_zap_receipt<S>( &self, bolt11: S, preimage: Option<S>, zap_request: Event ) -> Result<EventId, Error>where S: Into<String>,
Create zap receipt event
sourcepub fn file_metadata<S>(
&self,
description: S,
metadata: FileMetadata
) -> Result<EventId, Error>where
S: Into<String>,
pub fn file_metadata<S>( &self, description: S, metadata: FileMetadata ) -> Result<EventId, Error>where S: Into<String>,
File metadata
pub fn get_channels( &self, timeout: Option<Duration> ) -> Result<Vec<Event>, Error>
pub fn get_entity_of<S>( &self, entity: S, timeout: Option<Duration> ) -> Result<Entity, Error>where S: Into<String>,
pub fn handle_notifications<F>(&self, func: F) -> Result<(), Error>where F: Fn(RelayPoolNotification) -> Result<bool>,
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more