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.
81 lines
1.9 KiB
81 lines
1.9 KiB
/**
|
|
* [info description]
|
|
* @param {[type]} lnd [description]
|
|
* @return {[type]} [description]
|
|
*/
|
|
export function getInfo(lnd) {
|
|
return new Promise((resolve, reject) => {
|
|
lnd.getInfo({}, (err, data) => {
|
|
if (err) { reject(err) }
|
|
|
|
resolve(data)
|
|
})
|
|
})
|
|
}
|
|
|
|
|
|
/**
|
|
* Returns general information concerning the lightning node
|
|
* @param {[type]} lnd [description]
|
|
* @param {[type]} pubkey [description]
|
|
* @return {[type]} [description]
|
|
*/
|
|
export function getNodeInfo(lnd, { pubkey }) {
|
|
return new Promise((resolve, reject) => {
|
|
lnd.getNodeInfo({ pub_key: pubkey }, (err, data) => {
|
|
if (err) { reject(err) }
|
|
|
|
resolve(data)
|
|
})
|
|
})
|
|
}
|
|
|
|
|
|
/**
|
|
* Returns a description of the latest graph state from the point of view of the node
|
|
* @param {[type]} lnd [description]
|
|
* @return {[type]} [description]
|
|
*/
|
|
export function describeGraph(lnd) {
|
|
return new Promise((resolve, reject) => {
|
|
lnd.describeGraph({}, (err, data) => {
|
|
if (err) { reject(err) }
|
|
|
|
resolve(data)
|
|
})
|
|
})
|
|
}
|
|
|
|
|
|
/**
|
|
* Attempts to query the daemon’s Channel Router for a possible route to a target destination capable of carrying a specific amount of satoshis
|
|
* @param {[type]} lnd [description]
|
|
* @param {[type]} pubkey [description]
|
|
* @param {[type]} amount [description]
|
|
* @return {[type]} [description]
|
|
*/
|
|
export function queryRoutes(lnd, { pubkey, amount }) {
|
|
return new Promise((resolve, reject) => {
|
|
lnd.queryRoutes({ pub_key: pubkey, amt: amount }, (err, data) => {
|
|
if (err) { reject(err) }
|
|
|
|
resolve(data)
|
|
})
|
|
})
|
|
}
|
|
|
|
|
|
/**
|
|
* Returns some basic stats about the known channel graph from the point of view of the node
|
|
* @param {[type]} lnd [description]
|
|
* @return {[type]} [description]
|
|
*/
|
|
export function getNetworkInfo(lnd) {
|
|
return new Promise((resolve, reject) => {
|
|
lnd.getNetworkInfo({}, (err, data) => {
|
|
if (err) { reject(err) }
|
|
|
|
resolve(data)
|
|
})
|
|
})
|
|
}
|
|
|