3.0.0 • Published 5 months ago

@webbtc/webln-types v3.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

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

  1. Install package

    npm install @webbtc/webln-types --save-dev # or yarn add @webbtc/webln-types --dev
  2. Create webln-types.d.ts in your src directory with the following contents to ensure the types are picked up by the Typescript compiler:

/// <reference types="@webbtc/webln-types" />
  1. Import types from "@webbtc/webln-types"

    import type { 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

3.0.0

5 months ago

1.0.14

10 months ago

2.1.0

7 months ago

2.0.1

9 months ago

1.0.13

10 months ago

2.0.0

9 months ago

1.0.11

12 months ago

1.0.12

11 months ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago