Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@webbtc/webln-types

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webbtc/webln-types

Type definitions for WebLN

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3K
decreased by-33.52%
Maintainers
3
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 22 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc