# @radartech/lnrpc

> typed gRPC client for lightningnetwork/lnd

Latest version **0.5.1-beta.1** (published 2019-02-07) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @radartech/lnrpc
pnpm add @radartech/lnrpc
yarn add @radartech/lnrpc
bun add @radartech/lnrpc
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.5.1-beta.1 |
| Published | 2019-02-07 |
| First published | 2019-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 8.* |
| Dependencies | 6 |
| Unpacked size | 293.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 43 |
| Author | RadarTech |
| Maintainers | ajcrowe, cavan-radar, ctebbe |
| Keywords | lnd, lightning network, grpc, client, bitcoin |

## Links

- npm: https://www.npmjs.com/package/@radartech/lnrpc
- Repository: https://github.com/RadarTech/lnrpc
- Homepage: https://github.com/RadarTech/lnrpc#readme
- Issues: https://github.com/RadarTech/lnrpc/issues
- npm.io page: https://npm.io/package/@radartech/lnrpc

## Dependencies (6)

- [grpc](https://npm.io/package/grpc.md) ^1.14.0-pre2
- [napa](https://npm.io/package/napa.md) ^3.0.0
- [pkg-dir](https://npm.io/package/pkg-dir.md) ^2.0.0
- [ts-protoc-gen](https://npm.io/package/ts-protoc-gen.md) ^0.8.0
- [@grpc/proto-loader](https://npm.io/package/@grpc/proto-loader.md) ^0.3.0
- [@types/google-protobuf](https://npm.io/package/@types/google-protobuf.md) ^3.2.7

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.5.1-beta.1 (latest) — 2019-02-07
- 0.5.1-beta.0 — 2019-01-31
- 0.5.1-beta — 2019-01-28

## README

## LNRPC

[![CircleCI](https://img.shields.io/circleci/project/github/RadarTech/lnrpc/master.svg?style=flat)](https://circleci.com/gh/RadarTech/lnrpc)
[![Known Vulnerabilities](https://snyk.io/test/github/RadarTech/lnrpc/badge.svg?targetFile=package.json)](https://snyk.io/test/github/RadarTech/lnrpc?targetFile=package.json)
[![NPM Version](https://img.shields.io/npm/v/@radartech/lnrpc.svg?style=flat)](https://www.npmjs.com/package/@radartech/lnrpc)
[![License](https://img.shields.io/github/license/radartech/lnrpc.svg?style=flat)](https://img.shields.io/github/license/radartech/lnrpc.svg?style=flat)

Maintained fork of [lnrpc](https://github.com/Matt-Jensen/lnrpc) adding support for generating typescript type definitions.

### Features
- Auto-generates [lnd/lnrpc](https://github.com/lightningnetwork/lnd/tree/master/lnrpc) client and typescript definitons based on target release tag
- Wraps requests in promises
- Easily setup SSL and Macaroons
- Instantiates all gRPC services
- uint64/int64 types cast to string

### Installation
```sh
npm install @radartech/lnrpc
# OR
yarn add @radartech/lnrpc
```

Install [lnd](https://github.com/lightningnetwork/lnd/blob/master/docs/INSTALL.md) before using this project and ensure you have an lnd instance running with `--no-macaroons`, unless you provide macaroon authentication to your lnrpc instance when created.

### Change LND gRPC release version
To change the gRPC definitions used for all auto-generated types and RPC methods edit the `config.lnd_release_tag` value in `package.json` to the desired [LND release tag](https://github.com/lightningnetwork/lnd/releases) and run the following:

```sh
npm run generate
# OR
yarn generate
```
Newly generated type definitions will be available in `./generated`.

### Usage

Connecting to an lnd instance at `localhost:10001`.

```typescript
import createLnRpc, {
  Invoice,
  InvoiceSubscription,
  WalletBalanceResponse
} from '@radartech/lnrpc';

(async function() {
  const lnRpcClient = await createLnRpc();

  // All requests are promisified and typed
  const balanceResponse: WalletBalanceResponse = await lnRpcClient.walletBalance();

  // ...and you're off!
  console.log(balanceResponse.confirmedBalance);

  // subscribe to LND server events
  const subscriber = await lnRpcClient.subscribeInvoices(<InvoiceSubscription>{});
  subscriber.on('data', (invoice: Invoice) => {
    console.log(invoice); // do something with invoice
  });
})();
```

### Options

```typescript
import createLnRpc from '@radartech/lnrpc';

(async function() {
  const lnRcpCustom = await createLnRpc({
    /*
     By default lnrpc connects to `localhost:10001`,
     however we can point to any host.
     */
    server: '173.239.209.2:3001',

    /*
     By default  lnrpc looks for your tls certificate at:
     `~/.lnd/tls.cert`, unless it detects you're using macOS and
     defaults to `~/Library/Application\ Support/Lnd/tls.cert`
     however you can configure your own SSL certificate path like:
     */
    tls: './path/to/tls.cert',

    /*
     You can also provide a TLS certificate directly as a string
     (Just make sure you don't commit this to git).
     Overwrites: `tls`
     */
    cert: process.env.MY_SSL_CERT,

    /*
     Optional path to configure macaroon authentication
     from LND generated macaroon file.
     */
    macaroonPath: './path/to/data/admin.macaroon',

    /*
     Optional way to configure macaroon authentication by
     passing a hex encoded string of your macaroon file
     */
    macaroon: process.env.MY_MACAROON_HEX,
  });
})();
```

### API Reference

[All lnrpc methods documentation can be found here](http://api.lightning.community).

### Contributors

To develop on the project please run:

```sh
git clone git@github.com:RadarTech/lnrpc.git && cd $_


npm install
npm start
# OR
yarn
yarn start
```

### License

This project is licensed under the MIT License.

---
_Source: https://npm.io/package/@radartech/lnrpc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
