4 changed files with 608 additions and 11 deletions
File diff suppressed because it is too large
@ -1,10 +1,19 @@ |
|||||
import bitcore from 'bitcore-lib' |
import bitcore from 'bitcore-lib' |
||||
import pushclosechannel from '../push/closechannel' |
import pushclosechannel from '../push/closechannel' |
||||
|
|
||||
|
const BufferUtil = bitcore.util.buffer |
||||
|
|
||||
export default function closechannel(lnd, event, payload) { |
export default function closechannel(lnd, event, payload) { |
||||
console.log('payload: ', payload) |
const tx = payload.channel_point.funding_txid.match(/.{2}/g).reverse().join('') |
||||
|
const res = { |
||||
|
channel_point: { |
||||
|
funding_txid: BufferUtil.hexToBuffer(tx), |
||||
|
output_index: Number(payload.channel_point.output_index) |
||||
|
} |
||||
|
} |
||||
|
|
||||
return new Promise((resolve, reject) => |
return new Promise((resolve, reject) => |
||||
pushclosechannel(lnd, event, payload) |
pushclosechannel(lnd, event, res) |
||||
.then(data => resolve(data)) |
.then(data => resolve(data)) |
||||
.catch(error => reject(error)) |
.catch(error => reject(error)) |
||||
) |
) |
||||
|
Loading…
Reference in new issue