|
@ -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] |
|
@ -23,7 +57,7 @@ export function sendPaymentSync(lnd, { paymentRequest }) { |
|
|
*/ |
|
|
*/ |
|
|
export function listPayments(lnd) { |
|
|
export function listPayments(lnd) { |
|
|
return new Promise((resolve, reject) => { |
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
|
|
|
|
lnd.listPayments({}, (err, data) => { |
|
|
lnd.listPayments({}, (err, data) => { |
|
|
if (err) { reject(err) } |
|
|
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) |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|