Browse Source

All endpoints implemented except SubscribeInvoices (Streaming/push)

renovate/lint-staged-8.x
João Almeida 8 years ago
parent
commit
1f080e0eca
  1. 0
      app/lnd/config/.Rhistory
  2. 3
      app/lnd/methods/index.js
  3. 17
      app/lnd/methods/invoicesController.js
  4. 46
      app/lnd/methods/paymentsController.js

0
app/lnd/config/.Rhistory

3
app/lnd/methods/index.js

@ -30,6 +30,9 @@ import * as networkController from './networkController'
//TODO - DescribeGraph //TODO - DescribeGraph
//TODO - GetNetworkInfo //TODO - GetNetworkInfo
//TODO - QueryRoutes //TODO - QueryRoutes
//TODO - DecodePayReq
//TODO - SendPayment
//TODO - DeleteAllPayments

17
app/lnd/methods/invoicesController.js

@ -49,4 +49,21 @@ export function getInvoice(payreq) {
}) })
} }
/**
* [lookupInvoice description]
* @param {[type]} lnd [description]
* @param {[type]} rhash [description]
* @return {[type]} [description]
*/
export function lookupInvoice(lnd, { rhash }) {
return new Prommise ((resolve, reject) => {
lnd.lookupInvoice({r_hash: rhash}, (err, data) => {
if(err) { reject (err) }
resolve(data)
})
})
}
//TODO - SubscribeInvoice //TODO - SubscribeInvoice

46
app/lnd/methods/paymentsController.js

@ -16,6 +16,40 @@ export function sendPaymentSync(lnd, { paymentRequest }) {
} }
/**
* [sendPayment description]
* @param {[type]} lnd [description]
* @param {[type]} paymentRequest [description]
* @return {[type]} [description]
*/
export function sendPayment(lnd, { paymentRequest }) {
return new Promise((resolve, reject) => {
lnd.sendPayment({ payment_request: paymentRequest }, (err, data) => {
if (err) { reject(err) }
resolve(data)
})
})
}
/**
* [decodePayReq description]
* @param {[type]} lnd [description]
* @param {[type]} payReq [description]
* @return {[type]} [description]
*/
export function decodePayReq(lnd, { payReq }) {
return new Promise((resolve, reject) => {
lnd.decodePayReq({ pay_req: payReq}, (err, data) => {
if (err) { reject(err) }
resolve(data)
})
})
}
/** /**
* [listPayments description] * [listPayments description]
* @param {[type]} lnd [description] * @param {[type]} lnd [description]
@ -31,3 +65,15 @@ export function listPayments(lnd) {
}) })
}) })
} }
export function deleteAllPayments(lnd) {
return new Promise((resolve, reject) => {
lnd.deleteAllPayments({}, (err, data) => {
if(err) { reject(err) }
resolve(data)
})
})
}

Loading…
Cancel
Save