diff options
| author | Adam Soltys <[email protected]> | 2018-02-07 22:39:37 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2018-02-07 22:39:37 -0800 |
| commit | ebd061cf34aff30033511f9f1ec10ac21d1dcd94 (patch) | |
| tree | c2540e93df53707cad4a8874b836b367b9407e44 /index.js | |
| parent | cf5a62c26205fa2e9e36d788d4bfb7ec9f96cc66 (diff) | |
| download | coinos-server-ebd061cf34aff30033511f9f1ec10ac21d1dcd94.tar.gz coinos-server-ebd061cf34aff30033511f9f1ec10ac21d1dcd94.zip | |
sendPayment endpoint
Diffstat (limited to 'index.js')
| -rw-r--r-- | index.js | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -30,7 +30,7 @@ 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/data/core_test/admin.macaroon'); + const adminMacaroon = fs.readFileSync('/home/adam/.lnd.testa/admin.macaroon'); const meta = new grpc.Metadata(); meta.add('macaroon', adminMacaroon.toString('hex')); @@ -38,6 +38,18 @@ const l = console.log res.json(await lnrpc.walletBalance({witness_only: true}, meta)) }) + app.post('/sendPayment', async (req, res) => { + let payments = lnrpc.sendPayment(meta, {}) + payments.on('data', msg => l(msg)) + payments.write({ + payment_request: req.body.payreq + }) + }) + + app.get('/addinvoice', async (req, res) => { + res.json(await lnrpc.walletBalance({witness_only: true}, meta)) + }) + let fetchRates (fetchRates = () => { restClient.tickerGlobalPerSymbol('BTCCAD', (data) => { |
