|
@ -60,16 +60,16 @@ export default function(lnd, event, msg, data) { |
|
|
case 'createInvoice': |
|
|
case 'createInvoice': |
|
|
// Invoice looks like { r_hash: Buffer, payment_request: '' }
|
|
|
// Invoice looks like { r_hash: Buffer, payment_request: '' }
|
|
|
// { memo, value } = data
|
|
|
// { memo, value } = data
|
|
|
createInvoice(lnd, data) |
|
|
createinvoice(lnd, data) |
|
|
.then(invoice => event.sender.send('createdInvoice', Object.assign(invoice, { memo, value, r_hash: new Buffer(invoice.r_hash,'hex').toString('hex') }))) |
|
|
.then(invoice => event.sender.send('createdInvoice', Object.assign(invoice, { memo: data.memo, value: data.value, r_hash: new Buffer(invoice.r_hash,'hex').toString('hex') }))) |
|
|
.catch(error => console.log('createInvoice error: ', error)) |
|
|
.catch(error => console.log('createInvoice error: ', error)) |
|
|
break |
|
|
break |
|
|
case 'sendPayment': |
|
|
case 'sendPayment': |
|
|
// Payment looks like { payment_preimage: Buffer, payment_route: Object }
|
|
|
// Payment looks like { payment_preimage: Buffer, payment_route: Object }
|
|
|
// { paymentRequest } = data
|
|
|
// { paymentRequest } = data
|
|
|
sendPayment(lnd, data) |
|
|
payinvoice(lnd, data) |
|
|
.then(payment => event.sender.send('paymentSuccessful')) |
|
|
.then(({ payment_route }) => event.sender.send('paymentSuccessful', Object.assign(data, { payment_route }))) |
|
|
.catch(error => console.log('sendPayment error: ', error)) |
|
|
.catch(error => console.log('payinvoice error: ', error)) |
|
|
break |
|
|
break |
|
|
case 'openChannel': |
|
|
case 'openChannel': |
|
|
// Response is empty. Streaming updates on channel status and updates
|
|
|
// Response is empty. Streaming updates on channel status and updates
|
|
|