pub struct Client { /* private fields */ }

Implementations§

source§

impl Client

source

pub fn new(keys: &Keys) -> Self

source

pub fn with_opts(keys: &Keys, opts: Options) -> Self

source

pub fn with_remote_signer(app_keys: &Keys, remote_signer: RemoteSigner) -> Self

Create a new NIP46 Client

source

pub fn with_remote_signer_and_opts( app_keys: &Keys, remote_signer: RemoteSigner, opts: Options ) -> Self

Create a new NIP46 Client with custom Options

source

pub fn update_difficulty(&self, difficulty: u8)

source

pub fn keys(&self) -> Keys

Get current Keys

source

pub fn start(&self)

Start a previously stopped client

source

pub fn stop(&self) -> Result<(), Error>

Stop the client

source

pub fn is_running(&self) -> bool

Check if RelayPool is running

source

pub fn shutdown(self) -> Result<(), Error>

Completely shutdown Client

source

pub fn clear_already_seen_events(&self)

Clear already seen events

source

pub fn notifications(&self) -> Receiver<RelayPoolNotification>

source

pub fn relays(&self) -> HashMap<Url, Relay>

Get relays

source

pub fn relay<U>(&self, url: U) -> Result<Relay, Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,

Get Relay

source

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

source

pub fn add_relay<U>( &self, url: U, proxy: Option<SocketAddr> ) -> Result<(), Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,

source

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>,

source

pub fn remove_relay<U>(&self, url: U) -> Result<(), Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,

source

pub fn connect_relay<U>(&self, url: U) -> Result<(), Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,

source

pub fn disconnect_relay<U>(&self, url: U) -> Result<(), Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,

source

pub fn connect(&self)

source

pub fn disconnect(&self) -> Result<(), Error>

source

pub fn subscribe(&self, filters: Vec<Filter>)

source

pub fn unsubscribe(&self)

source

pub fn get_events_of( &self, filters: Vec<Filter>, timeout: Option<Duration> ) -> Result<Vec<Event>, Error>

source

pub fn req_events_of(&self, filters: Vec<Filter>, timeout: Option<Duration>)

source

pub fn send_msg(&self, msg: ClientMessage) -> Result<(), Error>

source

pub fn send_msg_to<U>(&self, url: U, msg: ClientMessage) -> Result<(), Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,

source

pub fn send_event(&self, event: Event) -> Result<EventId, Error>

Send event

source

pub fn send_event_to<U>(&self, url: U, event: Event) -> Result<EventId, Error>where U: TryIntoUrl, Error: From<<U as TryIntoUrl>::Err>,

source

pub fn set_metadata(&self, metadata: Metadata) -> Result<EventId, Error>

source

pub fn publish_text_note<S>( &self, content: S, tags: &[Tag] ) -> Result<EventId, Error>where S: Into<String>,

source

pub fn set_contact_list(&self, list: Vec<Contact>) -> Result<EventId, Error>

source

pub fn get_contact_list( &self, timeout: Option<Duration> ) -> Result<Vec<Contact>, Error>

source

pub fn get_contact_list_public_keys( &self, timeout: Option<Duration> ) -> Result<Vec<XOnlyPublicKey>, Error>

source

pub fn get_contact_list_metadata( &self, timeout: Option<Duration> ) -> Result<HashMap<XOnlyPublicKey, Metadata>, Error>

source

pub fn send_direct_msg<S>( &self, receiver: XOnlyPublicKey, msg: S, reply: Option<EventId> ) -> Result<EventId, Error>where S: Into<String>,

source

pub fn repost_event( &self, event_id: EventId, public_key: XOnlyPublicKey ) -> Result<EventId, Error>

source

pub fn delete_event<S>( &self, event_id: EventId, reason: Option<S> ) -> Result<EventId, Error>where S: Into<String>,

source

pub fn like( &self, event_id: EventId, public_key: XOnlyPublicKey ) -> Result<EventId, Error>

source

pub fn dislike( &self, event_id: EventId, public_key: XOnlyPublicKey ) -> Result<EventId, Error>

source

pub fn reaction<S>( &self, event_id: EventId, public_key: XOnlyPublicKey, content: S ) -> Result<EventId, Error>where S: Into<String>,

source

pub fn new_channel(&self, metadata: Metadata) -> Result<EventId, Error>

source

pub fn set_channel_metadata( &self, channel_id: ChannelId, relay_url: Option<Url>, metadata: Metadata ) -> Result<EventId, Error>

source

pub fn send_channel_msg<S>( &self, channel_id: ChannelId, relay_url: Url, msg: S ) -> Result<EventId, Error>where S: Into<String>,

source

pub fn hide_channel_msg<S>( &self, message_id: EventId, reason: Option<S> ) -> Result<EventId, Error>where S: Into<String>,

source

pub fn mute_channel_user<S>( &self, pubkey: XOnlyPublicKey, reason: Option<S> ) -> Result<EventId, Error>where S: Into<String>,

source

pub fn auth<S>(&self, challenge: S, relay: Url) -> Result<EventId, Error>where S: Into<String>,

source

pub fn new_zap_receipt<S>( &self, bolt11: S, preimage: Option<S>, zap_request: Event ) -> Result<EventId, Error>where S: Into<String>,

source

pub fn file_metadata<S>( &self, description: S, metadata: FileMetadata ) -> Result<EventId, Error>where S: Into<String>,

source

pub fn get_channels( &self, timeout: Option<Duration> ) -> Result<Vec<Event>, Error>

source

pub fn get_entity_of<S>( &self, entity: S, timeout: Option<Duration> ) -> Result<Entity, Error>where S: Into<String>,

source

pub fn handle_notifications<F>(&self, func: F) -> Result<(), Error>where F: Fn(RelayPoolNotification) -> Result<bool>,

source§

impl Client

source

pub fn req_signer_public_key( &self, timeout: Option<Duration> ) -> Result<(), Error>

source

pub fn send_req_to_signer( &self, req: Request, timeout: Option<Duration> ) -> Result<Response, Error>

Trait Implementations§

source§

impl Clone for Client

source§

fn clone(&self) -> Client

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Client

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Client> for Client

source§

fn from(client: Client) -> Self

Converts to this type from the input type.

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more