Crates.io | webln-js |
lib.rs | webln-js |
version | 0.1.2 |
source | src |
created_at | 2024-01-20 14:51:41.850957 |
updated_at | 2024-01-20 15:26:26.761737 |
description | WebLN for WASM bindings |
homepage | https://github.com/shadowylab/webln |
repository | https://github.com/shadowylab/webln.git |
max_upload_size | |
id | 1106544 |
size | 20,008 |
npm i @shadowylab/webln
import { WebLN, loadWasmAsync } from '@shadowylab/webln';
async function webln() {
let webln = new WebLN();
// Check if WebLN is enabled
console.log(await webln.isEnabled());
// Enable WebLN
await webln.enable();
// Get info
let info = await webln.getInfo();
console.log(info.alias());
console.log(info.pubkey());
console.log(info.color());
console.log(info.methods());
// Pay invoice
await webln.sendPayment("bolt11-invoice");
// Send payment async (needed for HOLD invoices)
await webln.sendPaymentAsync("bolt11-invoice");
let response = await webln.getBalance();
console.log(response.balance);
}
This project is distributed under the MIT software license - see the LICENSE file for details
⚡ Tips: https://getalby.com/p/yuki
⚡ Lightning Address: yuki@getalby.com