npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lnd-lib

v1.0.1

Published

Node wrapper lib for lnd rpc calls.

Downloads

2

Readme

lnd-lib

Greenkeeper badge

Installation

Install the package via npm:

npm install install lnd-lib --save 

Introduction

Draws heavily on https://github.com/lightningnetwork/lnd/blob/master/docs/grpc/javascript.md, and https://api.lightning.community/.

Usage

const lndLib = require('lnd-lib')
const Lightning = new lndLib.Lightning({certPath, macaroonPath, lndAddress, protoPath})
  • [certPath] Optional. Path to certificate. Defaults to ~/.lnd/tls.cert on Linux and ~/Library/Application Support/Lnd/tls.cert on Mac.

  • [macaroonPath] Optional. Macaroon Path. Defaults to ~/.lnd/admin.macaroon on Linux and ~/Library/Application Support/admin.macaroon on Mac.

  • [lndAddress] Optional. Lnd address. Defaults to localhost:10009.

  • [protoPath] Optional. Path to rpc.proto. Defaults to ./rpc.proto (included in this repo).

Methods

initialize

Fetches certificate, rpc.proto etc. and creates sets up an RPC connection to LND.

Lightning.initialize().then((resp)=>{
 	.... 
})

connect

Connects to another LND peer.

Lightning.connect({addr, pubKey, host, perm}).then((resp)=>{
 	.... 
})
  • [addr] Optional. TODO..

    (need to either have [addr] or [pubKey] and [host])

  • [pubKey] Optional. TODO..

  • [host] Optional. TODO..

  • [perm] Optional. TODO..

getInfo

Returns basic information related to the Lightning node.

Lightning.getInfo().then((resp)=>{
	.... 
})

walletBalance

Returns the wallet's balance (total utxos, confirmed and unconfirmed).

Lightning.walletBalance().then((resp)=>{
 	.... 
})

newAddress

Generates a new wallet address.

Lightning.newAddress(addressType).then((resp)=>{
 	.... 
})

[addressType]:

Either:

  • Lightning.addressType.p2wkh or

  • Lightning.addressType.np2wkh.

  • Defaults to Lightning.addressType.p2wkh

listPeers

Returns a list of all connected peers.

Lightning.listPeers().then((resp)=>{
	.... 
})

openChannel

Attempts to open a channel to an existing peer.

Lightning.openChannel(
  {
    nodePubkey,
    localFundingAmount, 
    pushSatoshis, 
    targetConf, 
    satoshisPerByte, 
    minHtlcMsat, 
    _private, 
    minHtlcMsat, 
    remoteCsvDelay
  },
  statusCallback
).then((resp)=>{
 	.... 
})
  • [nodePubkey] TODO

  • [localFundingAmount] TODO

  • [pushSatoshis] Optional. TODO

  • [targetConf] Optional. TODO

  • [satoshisPerByte] Optional. TODO

  • [_private] Optional. TODO

  • [minHtlcMsat] Optional. TODO

  • [remoteCsvDelay] Optional. TODO

  • [statusCallback] TODO

channelBalance

Returns the total channel balance for all open channels.

Lightning.channelBalance().then((resp)=>{
 	.... 
})

listChannels

Returns a list of all open channels.

Lightning.listChannels().then((resp)=>{
 	.... 
})

addInvoice

Adds a new invoice, expressing intent for a future payment.

Lightning.addInvoice({amt}).then((resp)=>{
 	.... 
})
  • [amt] TODO

decodePayReq

Decodes a payment request.

Lightning.decodePayReq({payReq}).then((resp)=>{
 	.... 
})
  • [payReq] TODO

sendPayment

Sends a payment over Lightning.

Lightning.sendPayment({payReq}).then((resp)=>{
 	.... 
})
  • [payReq] TODO

getChanInfo

Returns the latest authenticated state for a particular channel.

Lightning.getChanInfo({chanId}).then((resp)=>{
 	.... 
})
  • [chanId] TODO

closeChannel

Attempts to close an existing channel.

Lightning.closeChannel(
 {
    chanId, 
    channelPoint, 
    force, 
    targetConf, 
    satoshisPerByte
  }
).then((resp)=>{
 	.... 
})
  • [chanId] TODO

  • [channelPoint] TODO

  • [force] TODO

  • [targetConf] TODO

  • [satoshisPerByte] TODO

disconnect

Disconnects from an existing peer.

Lightning.disconnect({pubKey}).then((resp)=>{
 	.... 
})
  • [pubKey] TODO

TODO:

Implement remaining lightning functionality.