Registry / payments / lnd-rest-client

lnd-rest-client

JSON →
library0.0.9jsnpmunverified

A Node.js client library wrapping the entire LND (Lightning Network Daemon) REST API for programmatic interaction with Lightning Network nodes. Version 0.0.9 is the latest stable release, with an active development cadence on GitHub. It supports multiple macaroon authentication levels (admin, readonly, invoice, base) and provides full TypeScript typings. Differentiating itself from other LND clients like ln-service or lnd-grpc, this library focuses exclusively on REST, offering a simple, promise-based interface without gRPC complexity.

npm install lnd-rest-client
INSTALL
IMPORT
SIG · LND-REST-CLIENT
L
lnd-rest-client
paymentsjavascriptv0.0.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LndRestClient
import { LndRestClient } from 'lnd-rest-client'
const LndRestClient = require('lnd-rest-client')
The package is ESM-first and ships TypeScript definitions. Use named import. CommonJS require() may work but is not recommended.
LndRestClient
import LndRestClient from 'lnd-rest-client'
import { default as LndRestClient } from 'lnd-rest-client'
Default import is also supported, but named import is more idiomatic.
types
import type { LndRestClientOptions } from 'lnd-rest-client'
import { LndRestClientOptions } from 'lnd-rest-client' (if only using as type)
For type-only imports, use the type keyword to avoid runtime errors. Types are exported from the package.

Creates an LND REST client with macaroon authentication and fetches node info.

import { LndRestClient } from 'lnd-rest-client'; const client = new LndRestClient('https://localhost:8080', { admin: process.env.ADMIN_MACAROON ?? '', readonly: process.env.READ_ONLY_MACAROON ?? '', }); async function getInfo() { try { const info = await client.getInfo(); console.log('Node alias:', info.alias); } catch (error) { console.error('Error:', error); } } getInfo();
Debug
Known issues
breakingVersion 0.x may have breaking changes without notice.
fix
Pin to a specific version and test upgrades thoroughly.
affects: >=0.0.1
gotchaThis package uses node-fetch internally and is not designed for browsers.
fix
Use in Node.js environments only. For browser, consider a different LND client.
affects: >=0.0.1
deprecatedThe package is in early development; API stability is not guaranteed.
fix
Monitor the repository for changes and update code accordingly.
affects: >=0.0.1
gotchaMacaroon authentication requires providing at least one macaroon string.
fix
Ensure environment variables for macaroons are set, or pass empty strings for unused permission levels.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: fetch is not a function
Node-fetch version incompatibility with newer Node.js versions or bundling issues.
fix
Upgrade to Node.js >=18 or install node-fetch@2 explicitly as a dependency.
Cannot find module 'lnd-rest-client'
Package not installed or import path incorrect.
fix
Run 'npm install lnd-rest-client' and use correct import: import { LndRestClient } from 'lnd-rest-client'
Error: self-signed certificate in certificate chain
LND uses a self-signed certificate by default, and node-fetch rejects it.
fix
Set NODE_TLS_REJECT_UNAUTHORIZED=0 environment variable (not recommended for production) or provide a trusted certificate.
Upgrade
Version history
0.0.9latest on npm
Audit
Dependencies
node-fetchrequiredHTTP client for making REST API calls to LND
Agent activity
21 hits · last 30 days
node
18
Amazon
1
Resources
lnd-rest-client — npm install lnd-rest-client · libregistry