Registry / payments / lnd-async

lnd-async

JSON →
library4.2.2jsnpmunverified

lnd-async is a JavaScript client library for connecting to LND (Lightning Network Daemon) via gRPC with native promise support. Version 4.2.2 supports LND 0.17.0-beta. It wraps all gRPC callbacks into promises, simplifying async usage. Key differentiators: built-in macaroon authentication, support for base64-encoded credentials, long integer treatment (defaults to strings to avoid data loss), and access to multiple LND services (Lightning, Invoices, etc.). It has a moderate release cadence with updates following LND releases.

npm install lnd-async
INSTALL
IMPORT
SIG · LND-ASYNC
L
lnd-async
paymentsjavascriptv4.2.2
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.

default
const lnd = require('lnd-async'); let client = await lnd.connect();
import lnd from 'lnd-async';
This package is CJS-only; ESM import not supported. Use require().
connect
const { connect } = require('lnd-async'); let client = await connect();
import { connect } from 'lnd-async';
Named export available via destructuring require, not ES import.
Lightning service
await client.getInfo({});
Default service is Lightning; methods like getInfo, connectPeer are directly on client.

Connects to LND using default localhost port, fetches node info, and prints key details.

const lnd = require('lnd-async'); async function main() { try { const client = await lnd.connect({ lndHost: 'localhost', lndPort: 10009, certPath: '/path/to/tls.cert', macaroonPath: '/path/to/admin.macaroon', }); const info = await client.getInfo({}); console.log('Node alias:', info.alias); console.log('Identity pubkey:', info.identity_pubkey); console.log('Block height:', info.block_height); } catch (err) { console.error('Connection error:', err.message); } } main();
Debug
Known issues
breakingVersion 4.x dropped support for Node < 10. The minimum engine is node >= 10.0.0.
fix
Upgrade Node.js to version 10 or later, or use lnd-async@3.x.
affects: <4.0.0
breakingThe 'longsAsNumbers' option defaults to false in v4. Long integers are returned as strings to prevent data loss for 64-bit values.
fix
If you need numbers, set longsAsNumbers: true, but be aware of potential precision loss beyond 2^53-1.
affects: >=4.0.0
breakingThe library no longer automatically installs grpc; it must be installed separately as a peer dependency.
fix
Run 'npm install grpc' in your project.
affects: >=4.0.0
gotchaBase64-encoded macaroon or cert strings can cause silent authentication failures if whitespace or newlines are present. Ensure exact encoding.
fix
Use base64 -w 0 command (no line wrapping). For cert, the base64 string must be decoded to the binary cert internally.
affects: *
Errors
Common errors & fixes
Error: 12 UNIMPLEMENTED: unknown service lnrpc.Lightning
LND version mismatch or gRPC proto definition outdated.
fix
Ensure lnd-async version matches your LND API version. For LND 0.17.0-beta, use lnd-async^4.2.2.
Error: Cannot find module 'grpc'
Missing peer dependency grpc.
fix
Run 'npm install grpc' in your project directory.
TypeError: lnd.connect is not a function
Incorrect import style; using ES import instead of CommonJS require.
fix
Use const lnd = require('lnd-async'); instead of import lnd from 'lnd-async';.
Upgrade
Version history
4.2.2latest on npm
Audit
Dependencies
grpcrequiredRequired for gRPC communication with LND
protobufjsoptionalUsed for protobuf message serialization (peer dependency of grpc)
Agent activity
24 hits · last 30 days
node
22
Resources
lnd-async — npm install lnd-async · libregistry