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.
53 lines
1.1 KiB
53 lines
1.1 KiB
7 years ago
|
/**
|
||
|
* [connectpeer description]
|
||
|
* @param {[type]} lnd [description]
|
||
|
* @param {[type]} pubkey [description]
|
||
|
* @param {[type]} host [description]
|
||
|
* @return {[type]} [description]
|
||
|
*/
|
||
|
export function connectPeer(lnd, { pubkey, host }) {
|
||
|
return new Promise((resolve, reject) => {
|
||
|
|
||
|
lnd.connectPeer({ addr: { pubkey, host }, perm: true }, (err, data) => {
|
||
|
if (err) { reject(err) }
|
||
|
|
||
|
resolve(data)
|
||
|
})
|
||
|
})
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* [disconnectpeer description]
|
||
|
* @param {[type]} lnd [description]
|
||
|
* @param {[type]} pubkey [description]
|
||
|
* @return {[type]} [description]
|
||
|
*/
|
||
|
export function disconnectPeer(lnd, { pubkey }) {
|
||
|
return new Promise((resolve, reject) => {
|
||
|
|
||
|
lnd.disconnectPeer({ pub_key: pubkey }, (err, data) => {
|
||
|
if (err) { reject(err) }
|
||
|
|
||
|
resolve(data)
|
||
|
})
|
||
|
})
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* [peers description]
|
||
|
* @param {[type]} lnd [description]
|
||
|
* @return {[type]} [description]
|
||
|
*/
|
||
|
export function listPeers(lnd) {
|
||
|
return new Promise((resolve, reject) => {
|
||
|
|
||
|
lnd.listPeers({}, (err, data) => {
|
||
|
if (err) { reject(err) }
|
||
|
|
||
|
resolve(data)
|
||
|
})
|
||
|
})
|
||
|
}
|