Skip to content

Latest commit

 

History

History
77 lines (66 loc) · 1.73 KB

README.md

File metadata and controls

77 lines (66 loc) · 1.73 KB

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,
  decodelnurl,
  decipherAES,
  getDomain
} from 'js-lnurl/lib/helpers'
// or
import {findlnurl} from 'js-lnurl/lib/helpers/findlnurl'
import {decodelnurl} from 'js-lnurl/lib/helpers/decodelnurl'
import {decipherAES} from 'js-lnurl/lib/helpers/decipherAES'
import {getDomain} from 'js-lnurl/lib/helpers/getDomain'

// see src/helpers/*.ts

How to build

Do this before publishing to npm:

yarn
make