diff options
| author | Adam Soltys <[email protected]> | 2018-02-12 19:35:34 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2018-02-12 19:35:34 -0800 |
| commit | d41cd218ff1ebab07f2bf8e84ffa0ca7deeb1a04 (patch) | |
| tree | a4de7e44acd90bd0f55a856917008aff4793473d /index.js | |
| parent | cbf91f53e6c97cdb76c293c46813fbc9a74f47e5 (diff) | |
| download | coinos-server-d41cd218ff1ebab07f2bf8e84ffa0ca7deeb1a04.tar.gz coinos-server-d41cd218ff1ebab07f2bf8e84ffa0ca7deeb1a04.zip | |
generate lightning deposit address on user create
Diffstat (limited to 'index.js')
| -rw-r--r-- | index.js | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -20,7 +20,6 @@ const l = console.log ;(async () => { const app = express() - const db = await require('./db.js') app.enable('trust proxy') app.use(bodyParser.urlencoded({ extended: true })) app.use(bodyParser.json()) @@ -32,10 +31,9 @@ const l = console.log const restClient = ba.restfulClient(process.env.BITCOINAVERAGE_PUBLIC, process.env.BITCOINAVERAGE_SECRET) const lnrpc = await require('lnrpc')({ server: 'localhost:10001' }) const adminMacaroon = fs.readFileSync('/home/adam/.lnd.testa/admin.macaroon') - - const meta = new grpc.Metadata() meta.add('macaroon', adminMacaroon.toString('hex')) + lnrpc.meta = meta const invoices = lnrpc.subscribeInvoices({}, meta) invoices.on('data', msg => { @@ -44,6 +42,8 @@ const l = console.log ds.event.emit('invoices', msg) }) + const db = await require('./db.js')(lnrpc) + app.get('/balance', async (req, res) => { res.json(await lnrpc.walletBalance({witness_only: true}, meta)) }) |
