# @webbtc/webln-types

> Type definitions for WebLN

Latest version **3.0.0** (published 2023-12-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @webbtc/webln-types
pnpm add @webbtc/webln-types
yarn add @webbtc/webln-types
bun add @webbtc/webln-types
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2023-12-19 |
| First published | 2023-01-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | WebBTC |
| Maintainers | reneaaron, bumi, rolznz |
| Keywords | webbtc, webln, bitcoin, lightning |

## Links

- npm: https://www.npmjs.com/package/@webbtc/webln-types
- Repository: https://github.com/WebBTC/webln-types
- Homepage: https://github.com/WebBTC/webln-types#readme
- Issues: https://github.com/WebBTC/webln-types/issues
- Funding: lightning:hello@getalby.com
- npm.io page: https://npm.io/package/@webbtc/webln-types

## Recent versions

- 3.0.0 (latest) — 2023-12-19
- 2.1.0 — 2023-11-02
- 2.0.1 — 2023-08-29
- 2.0.0 — 2023-08-22
- 1.0.14 — 2023-08-08
- 1.0.13 — 2023-08-03
- 1.0.12 — 2023-06-17
- 1.0.11 — 2023-06-01
- 1.0.10 — 2023-01-22
- 1.0.9 — 2023-01-18
- 1.0.8 — 2023-01-18
- 1.0.7 — 2023-01-17
- 1.0.6 — 2023-01-17
- 1.0.5 — 2023-01-17
- 1.0.4 — 2023-01-17
- … 4 more at https://npm.io/package/@webbtc/webln-types/versions

## README

# webln-types

Type definitions for [WebLN](https://webbtc.dev/webln)

WebLN may be implemented by a lightning browser extension (e.g. [Alby](https://getalby.com/)) 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

   ```bash
   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:

```javascript
/// <reference types="@webbtc/webln-types" />
```

3.  Import types from `"@webbtc/webln-types"`

   ```typescript
   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](https://www.webln.guide/introduction/readme)

---
_Source: https://npm.io/package/@webbtc/webln-types · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
