Jack Mallers
8 years ago
12 changed files with 130 additions and 13 deletions
@ -0,0 +1,11 @@ |
|||
import bitcore from 'bitcore-lib' |
|||
import pushclosechannel from '../push/closechannel' |
|||
|
|||
export default function closechannel(lnd, event, payload) { |
|||
console.log('payload: ', payload) |
|||
return new Promise((resolve, reject) => |
|||
pushclosechannel(lnd, event, payload) |
|||
.then(data => resolve(data)) |
|||
.catch(error => reject(error)) |
|||
) |
|||
} |
@ -0,0 +1,19 @@ |
|||
export default function pushclosechannel(lnd, event, payload) { |
|||
console.log('here with payload: ', payload) |
|||
return new Promise((resolve, reject) => { |
|||
try { |
|||
const call = lnd.closeChannel(payload) |
|||
|
|||
call.on('data', data => event.sender.send('pushclosechannelupdated', { data })) |
|||
call.on('end', () => event.sender.send('pushclosechannelend')) |
|||
call.on('error', error => event.sender.send('pushclosechannelerror', { error })) |
|||
call.on('status', status => event.sender.send('pushclosechannelstatus', { status })) |
|||
|
|||
console.log('call: ', call) |
|||
resolve(null, payload) |
|||
} catch (error) { |
|||
console.log('error: ', error) |
|||
reject(error, null) |
|||
} |
|||
}) |
|||
} |
@ -1,4 +1,4 @@ |
|||
export default function pushchannel(lnd, event, payload) { |
|||
export default function pushopenchannel(lnd, event, payload) { |
|||
return new Promise((resolve, reject) => { |
|||
try { |
|||
const call = lnd.openChannel(payload) |
Loading…
Reference in new issue