diff --git a/app/lnd/config/.Rhistory b/app/lnd/config/.Rhistory deleted file mode 100644 index e69de29b..00000000 diff --git a/app/lnd/methods/index.js b/app/lnd/methods/index.js index 64b8aee6..7cd86e67 100644 --- a/app/lnd/methods/index.js +++ b/app/lnd/methods/index.js @@ -30,6 +30,9 @@ import * as networkController from './networkController' //TODO - DescribeGraph //TODO - GetNetworkInfo //TODO - QueryRoutes +//TODO - DecodePayReq +//TODO - SendPayment +//TODO - DeleteAllPayments diff --git a/app/lnd/methods/invoicesController.js b/app/lnd/methods/invoicesController.js index 68cc40dc..59102fef 100644 --- a/app/lnd/methods/invoicesController.js +++ b/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 diff --git a/app/lnd/methods/paymentsController.js b/app/lnd/methods/paymentsController.js index 4675c5be..d58bf63c 100644 --- a/app/lnd/methods/paymentsController.js +++ b/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] * @param {[type]} lnd [description] @@ -23,7 +57,7 @@ export function sendPaymentSync(lnd, { paymentRequest }) { */ export function listPayments(lnd) { return new Promise((resolve, reject) => { - + lnd.listPayments({}, (err, data) => { if (err) { reject(err) } @@ -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) + }) + }) +}