You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
586 B
20 lines
586 B
import bitcore from 'bitcore-lib'
|
|
import pushclosechannel from '../push/closechannel'
|
|
|
|
const BufferUtil = bitcore.util.buffer
|
|
|
|
export default function closechannel(lnd, event, 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) =>
|
|
pushclosechannel(lnd, event, res)
|
|
.then(data => resolve(data))
|
|
.catch(error => reject(error))
|
|
)
|
|
}
|
|
|