1 个不稳定版本
0.1.2 | 2024年1月20日 |
---|---|
0.1.1 |
|
0.1.0 |
|
#101 in #wasm-bindings
43KB
867 代码行
WebLN - Lightning Web 标准
入门
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);
}
许可证
本项目遵循 MIT 软件许可证 - 请参阅 LICENSE 文件以获取详细信息
捐赠
⚡ 小费: https://getalby.com/p/yuki
⚡ Lightning 地址: [email protected]
依赖项
~15MB
~223K SLoC