pub struct WebLN { /* private fields */ }
Expand description
WebLN instance
Implementations§
source§impl WebLN
impl WebLN
sourcepub async fn is_enabled(&self) -> Result<bool, Error>
pub async fn is_enabled(&self) -> Result<bool, Error>
Check if webln
is enabled without explicitly enabling it through webln.enable()
(which may cause a confirmation popup in some providers)
sourcepub async fn enable(&self) -> Result<(), Error>
pub async fn enable(&self) -> Result<(), Error>
To begin interacting with WebLN APIs you’ll first need to enable the provider.
Calling webln.enable()
will prompt the user for permission to use the WebLN capabilities of the browser.
After that you are free to call any of the other API methods.
sourcepub async fn get_info(&self) -> Result<GetInfoResponse, Error>
pub async fn get_info(&self) -> Result<GetInfoResponse, Error>
Get information about the connected node and what WebLN methods it supports.
sourcepub async fn keysend(
&self,
args: &KeysendArgs
) -> Result<SendPaymentResponse, Error>
pub async fn keysend( &self, args: &KeysendArgs ) -> Result<SendPaymentResponse, Error>
Request the user to send a keysend payment. This is a spontaneous payment that does not require an invoice and only needs a destination public key and and amount.
sourcepub async fn make_invoice(
&self,
args: &RequestInvoiceArgs
) -> Result<RequestInvoiceResponse, Error>
pub async fn make_invoice( &self, args: &RequestInvoiceArgs ) -> Result<RequestInvoiceResponse, Error>
Request that the user creates an invoice to be used by the web app
sourcepub async fn send_payment(
&self,
invoice: &str
) -> Result<SendPaymentResponse, Error>
pub async fn send_payment( &self, invoice: &str ) -> Result<SendPaymentResponse, Error>
Request that the user sends a payment for an invoice.
sourcepub async fn send_multi_payment<I, S>(
&self,
invoices: I
) -> Result<SendMultiPaymentResponse, Error>
pub async fn send_multi_payment<I, S>( &self, invoices: I ) -> Result<SendMultiPaymentResponse, Error>
Request that the user sends multiple payments.
sourcepub async fn send_payment_async(&self, invoice: &str) -> Result<(), Error>
pub async fn send_payment_async(&self, invoice: &str) -> Result<(), Error>
Request that the user sends a payment for an invoice. The payment will only be initiated and will not wait for a preimage to be returned. This is useful when paying HOLD Invoices. There is no guarantee that the payment will be successfully sent to the receiver. It’s up to the receiver to check whether or not the invoice has been paid.
sourcepub async fn sign_message(
&self,
message: &str
) -> Result<SignMessageResponse, Error>
pub async fn sign_message( &self, message: &str ) -> Result<SignMessageResponse, Error>
Request that the user signs an arbitrary string message.
sourcepub async fn get_balance(&self) -> Result<BalanceResponse, Error>
pub async fn get_balance(&self) -> Result<BalanceResponse, Error>
Fetch the balance of the current account.