webln-types
Type definitions for WebLN
WebLN may be implemented by a lightning browser extension (e.g. Alby) therefore WebLN can already be called directly from the browser if the user has the extension installed. This package simply adds type definitions to make it easier to integrate WebLN into web applications that are written in Typescript.
Quick Start
- Install package
npm install @webbtc/webln-types --save-dev
- Import
"@webbtc/webln-types"
import { GetInfoResponse } from "@webbtc/webln-types";
if (window.webln) {
(async () => {
await window.webln.enable();
const info: GetInfoResponse = await window.webln.getInfo();
console.log("Your node pubkey is", info.node.pubkey);
})();
} else {
console.warn("WebLN not enabled");
}
Adding WebLN to your application
Read the WebLN Guide