/js-lnurl

tools for adding lnurl support in a wallet

Primary LanguageTypeScriptMIT LicenseMIT

js-lnurl

Tools for adding lnurl support in JavaScript wallet interfaces.

Example

import { getParams } from 'js-lnurl'

getParams("LNURL1...")
  .then(params => {
    switch (params.tag) {
      case 'withdrawRequest':
        // tag: string
        // k1: string
        // callback: string
        // domain: string
        // minWithdrawable: number
        // maxWithdrawable: number
        // defaultDescription: string
        break
      case 'payRequest':
        // tag: string
        // callback: string
        // domain: string
        // minSendable: number
        // maxSendable: number
        // metadata: string
        // decodedMetadata: string[][]
        // commentAllowed?: number
        break
      case 'login':
        // tag: string
        // k1: string
        // callback: string
        // domain: string
        break
      case 'channelRequest':
        // params.tag: string
        // params.callback: string
        // params.domain: string
        // params.k1: string
        // params.uri: string
        break
    }
  })

Other included helpers

import { findlnurl, decipherAES, getDomain }

// see ./helpers.js

How to build

Do this before publishing to npm:

yarn
make