{"id":15077742,"url":"https://github.com/ln-zap/node-lnd-grpc","last_synced_at":"2025-10-05T11:31:53.474Z","repository":{"id":38808710,"uuid":"168527678","full_name":"LN-Zap/node-lnd-grpc","owner":"LN-Zap","description":"Zap Wallet - Easy to use async gRPC wrapper for lnd ⚡️","archived":true,"fork":false,"pushed_at":"2023-02-16T22:50:31.000Z","size":2169,"stargazers_count":43,"open_issues_count":16,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-28T04:54:29.037Z","etag":null,"topics":["zapwallet"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LN-Zap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-31T13:14:38.000Z","updated_at":"2025-09-01T06:45:06.000Z","dependencies_parsed_at":"2024-06-18T22:48:29.387Z","dependency_job_id":"d1e224e5-6fd5-47e6-a21d-ed9b442f2a7a","html_url":"https://github.com/LN-Zap/node-lnd-grpc","commit_stats":{"total_commits":344,"total_committers":13,"mean_commits":26.46153846153846,"dds":0.3023255813953488,"last_synced_commit":"5a1b74ea02cf5201c951373d4c7db8c6fa54954d"},"previous_names":[],"tags_count":87,"template":false,"template_full_name":null,"purl":"pkg:github/LN-Zap/node-lnd-grpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LN-Zap%2Fnode-lnd-grpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LN-Zap%2Fnode-lnd-grpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LN-Zap%2Fnode-lnd-grpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LN-Zap%2Fnode-lnd-grpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LN-Zap","download_url":"https://codeload.github.com/LN-Zap/node-lnd-grpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LN-Zap%2Fnode-lnd-grpc/sbom","scorecard":{"id":81620,"data":{"date":"2025-08-11","repo":{"name":"github.com/LN-Zap/node-lnd-grpc","commit":"5a1b74ea02cf5201c951373d4c7db8c6fa54954d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.4,"checks":[{"name":"Code-Review","score":1,"reason":"Found 3/16 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 21 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"26 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-7v5v-9h63-cj86","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-8hc4-vh64-cxmj","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-g954-5hwp-pp24","Warn: Project is vulnerable to: GHSA-h755-8qp9-cq85","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-pq67-2wwv-3xjx","Warn: Project is vulnerable to: GHSA-8cj5-5rvv-wf4v","Warn: Project is vulnerable to: GHSA-w5p7-h5w8-2hfq","Warn: Project is vulnerable to: GHSA-6jrj-vc65-c983","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-15T05:59:20.258Z","repository_id":38808710,"created_at":"2025-08-15T05:59:20.258Z","updated_at":"2025-08-15T05:59:20.258Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278445959,"owners_count":25988081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["zapwallet"],"created_at":"2024-09-25T04:31:25.997Z","updated_at":"2025-10-05T11:31:52.881Z","avatar_url":"https://github.com/LN-Zap.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lnd-grpc\n\n[![](https://img.shields.io/badge/project-LND-blue.svg?style=flat-square)](https://github.com/lightningnetwork/lnd)\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n[![Dependency Status](https://david-dm.org/LN-Zap/node-lnd-grpc.svg?style=flat-square)](https://david-dm.org/LN-Zap/node-lnd-grpc)\n[![Build Status](https://travis-ci.org/LN-Zap/node-lnd-grpc.svg?branch=master)](https://travis-ci.org/LN-Zap/node-lnd-grpc)\n\n\u003e Easy to use gRPC wrapper for lnd. ⚡️\n\nThis package provides and easy to use gRPC wrapper for lnd.\n\n- Supports all lnd versions\n- Supports all lnd gRPC sub services\n- Automatic async/promise support\n- Automatic lnd version detection\n- [lndconnect](https://github.com/LN-Zap/node-lndconnect) support\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\nInstall via npm:\n\n```\nnpm install lnd-grpc --save\n```\n\nThen import in your code:\n\n```js\nimport LndGrpc from 'lnd-grpc'\n```\n\n## Usage\n\n### Initialize\n\nCreate a new instance of the service using the `LndGrpc` constructor:\n\n```js\nimport LndGrpc from 'lnd-grpc'\n\nconst grpc = new LndGrpc(options)\n```\n\nThe constructor accepts the following options:\n\n- **lndconnectUri** {[string]}:  \n  An [lndconnect uri](https://github.com/LN-Zap/node-lndconnect) that encodes the lnd connection details (host, cert, and macaroon). If `lndconnectUri` is set it will override the `host`, `cert`, and `macaroon` properties (below)\n\n- **host** {[string]}:  \n  Hostname and port of lnd gRPC. (extracted from `lndconnectUri` if provided)\n\n- **cert** {[string]}:  \n  TLS certificate of the lnd node. This can be a path to the TLS cert or PEM ended cert data. (extracted from `lndconnectUri` if provided)\n\n- **macaroon** {[string]}:  \n  Macaroon for the lnd node. This can be a path to the macaroon file or hex encoded macaroon data. (extracted from `lndconnectUri` if provided)\n\n- **waitForCert** {[boolean|number]}:  \n  Time (ms) to wait for TLS certificate before aborting connection attempt.\n\n  This is useful in the case where you can not guarantee that the TLS certificate exists at the time when you attempt to establish the connection.\n\n  Set to `true` to use the default of 10 seconds.\n\n- **waitForMacaroon** {[boolean|number]}:  \n  Time (ms) to wait for macaroon before aborting connection attempt.\n\n  This is useful in the case where you are connecting to a local node where a wallet does not already exist. After calling lnd's `initWallet` method to create a new wallet, it can take some time for lnd to initialize and create the wallet's macaroons.\n\n  Set to `true` to use the default of 10 seconds.\n\n- **version** {[string]}:  \n  If you know which version of lnd you are connecting to in advance you can specify that here.\n\n  By default, we use the latest proto files available when connecting to lnd. As soon as the wallet is unlocked, we call lnd's `getInfo` method in order to determine which version of lnd is running. If needed, we will reconnect using a more appropriate proto version.\n\n- **protoDir** {[string]}:  \n  Custom path to rpc proto files. [advanced](#advanced-settings)\n\n- **grpcOptions** {[Object]}:  \n  Custom gRPC options. [advanced](#advanced-settings)\n\n**Minimal example:**\n\n```js\nnew LndGrpc({\n  host: 'localhost:10009',\n  cert: '~/.lnd/tls.cert',\n  macaroon: '~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon',\n})\n```\n\n**Complete example:**\n\n```js\nnew LndGrpc({\n  host: 'localhost:10009',\n  cert: '~/.lnd/tls.cert',\n  macaroon: '~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon',\n  version: '0.6.0-beta',\n  waitForMacaroon: 30 * 1000, // 30 seconds\n  waitForCert: true,\n  protoDir: '~/path/to/proto/files', // useful when running in electron environment, for example\n})\n```\n\n### Connect\n\nAfter initializing a new `LndGrpc` instance, call its `connect` method to establish a connection to lnd.\n\n```js\nconst grpc = new LndGrpc({ host, cert, macaroon })\nawait grpc.connect()\n\nconsole.log(grpc.state) // active|locked\n```\n\nAfter establishing a connection you can access all available lnd gRPC interfaces under the `services` property.\n\n### Unlock \u0026 Activate\n\nIf the wallet state was determined to be `locked` when the connection was established you must first unlock the wallet and then activate the Lightning service in order to access methods on the Lightnig service or any other grpc subservice that requires the node to be unlocked.\n\n```js\nconst { WalletUnlocker } = grpc.services\nif (grpc.state === 'locked') {\n  await WalletUnlocker.unlockWallet({ wallet_password: Buffer.from('your wallet password') })\n  await grpc.activateLightning()\n\n  console.log(grpc.state) // active\n}\n```\n\n### Disconnect\n\nDisconnect from all gRPC services. It's important to disconnect from the lnd node once you have finished using it. This will free up any open handles that could prevent your application from properly closing.\n\n```js\nawait grpc.disconnect()\n```\n\n### Complete Example\n\n```js\nimport LndGrpc from 'lnd-grpc'\n\nconst grpc = new LndGrpc({\n  host: 'localhost:10009',\n  cert: '~/.lnd/tls.cert',\n  macaroon: '~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon',\n  waitForCert: true,\n  waitForMacaroon: true,\n})\n\n// Establish a connection.\nawait grpc.connect()\n\n// Do something cool if we detect that the wallet is locked.\ngrpc.on(`locked`, () =\u003e console.log('wallet locked!'))\n\n// Do something cool when the wallet gets unlocked.\ngrpc.on(`active`, () =\u003e console.log('wallet unlocked!'))\n\n// Do something cool when the connection gets disconnected.\ngrpc.on(`disconnected`, () =\u003e console.log('disconnected from lnd!'))\n\n// Check if the wallet is locked and unlock if needed.\nif (grpc.state === 'locked') {\n  const { WalletUnlocker } = grpc.services\n  await WalletUnlocker.unlockWallet({\n    wallet_password: Buffer.from('mypassword'),\n  })\n  // After unlocking the wallet, activate the Lightning service and all of it's subservices.\n  await WalletUnlocker.activateLightning()\n}\n\n// Make some api calls...\nconst { Lightning, Autopilot, Invoices } = grpc.services\n// Fetch current balance.\nconst balance = await Lightning.walletBalance()\n// Enable autopilot.\nconst modifyStatusRes = await Autopilot.modifyStatus({ enable: true })\n// Cancel an invoice.\nconst cancelInvoiceRes = await Invoices.cancelInvoice({\n  payment_hash: '3bba3a6cdbd601dbf096784115f45d314c0f51ffb69ae6d338e229cb825afbe1',\n})\n\n// Disconnect from all services.\nawait grpc.disconnect()\n```\n\n### States\n\nThe grpc service will be in one of the following states at all times.\n\n**ready**\n\nThe `ready` state is the initial state of all new lnd-grpc service instances and indicates that a connection has not yet been established.\n\n**locked**\n\nThe `locked` state indicates that a connection has been established and the node was last known to be in a locked state.\n\n**active**\n\nThe `active` state indicates that a connection has been established and the node was last known to be in an active (unlocked) state.\n\n### Events\n\n**locked**\n\nThe `locked` event is emitted when it has been determined that the wallet is locked and the `WalletUnlocker` interface is active.\n\n**active**\n\nThe `active` event is emitted when it has been determined that the wallet is unlocked and the `Lightning` interface is active.\n\n**disconnected**\n\nThe `disconnected` event is emitted after calling `disconnect`, once the connection has been fully closed.\n\n### Helpers\n\n**is**\n\nChecks wether the service is in a given state.\n\nExample:\n\n```js\nassert(grpc.is('active')) // test wether the service state is active.\n```\n\n**can**\n\nChecks wether the service can carry out a given state transition.\n\nExample:\n\n```js\nassert(grpc.can('activateLightning')) // test wether the service can activate the lightning service\n```\n\n**waitForState**\n\nWait for the service to enter a particular state.\n\nExample:\n\n```js\nawait grpc.waitForState('active')\nconsole.log(grpc.state) // active\n```\n\n### Advanced settings\n\n**gRPC Options**\nx\nUnder the hood we use the [`grpc-js`](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js) library for the gRPC handling. By default we use the following options to control its behaviour.\n\n```js\n{\n  keepCase: true,\n  longs: Number,\n  enums: String,\n  defaults: true,\n  oneofs: true,\n}\n```\n\n(Note: when dealing with channel IDs and other fields that can exceed JavaScript's Number.MAX_SAFE_INTEGER, loss of precision can occur. This can be avoided by using `longs: String` on the above gRPC options and dealing with `String`s instead of `Number`s.)\n\nThese settings can be overridden by passing `grpcOptions` to the constructor. Custom settings will be merged in with the above defaults.\n\n```js\nnew LndGrpc({\n  host: 'localhost:10009',\n  grpcOptions: {\n    keepCase: false,\n  },\n})\n```\n\n**gRPC Proto Files**\n\nThis repository hosts a copy of the lnd gRPC proto files for all official lnd releases. We attempt to select the most appropriate version of these files when connecting by calling lnd's `getInfo` method and parsing the version string.\n\nIn some situations you may want to load these files from an alternate location - such as in an Electron environment where you may need to bundle up the proto files as additional package resources for distribution. You can tell us to read the proto files from an alternate location by passing the `protoDir` option to the constructor.\n\n### Testing\n\nRun the tests suite:\n\n```bash\n  npm test\n```\n\nRun with debugging output on:\n\n```bash\nDEBUG=lnrpc* npm test\n```\n\n## Maintainers\n\n[@Tom Kirkpatrick (mrfelton)](https://github.com/mrfelton).\n\n## Contribute\n\nFeel free to dive in! [Open an issue](https://github.com/LN-Zap/node-lnd-grpc/issues/new) or submit PRs.\n\nlnd-grpc follows the [Contributor Covenant](http://contributor-covenant.org/version/1/3/0/) Code of Conduct.\n\n## License\n\n[MIT](LICENSE) © Tom Kirkpatrick\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fln-zap%2Fnode-lnd-grpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fln-zap%2Fnode-lnd-grpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fln-zap%2Fnode-lnd-grpc/lists"}