Compare commits
2 Commits
1d3ab23ec4
...
aba212f6ec
Author | SHA1 | Date |
---|---|---|
k00b | aba212f6ec | |
k00b | 6aac9eeed4 |
|
@ -21,19 +21,24 @@ getWalletInfo({ lnd }, (err, result) => {
|
|||
|
||||
export async function estimateRouteFee ({ lnd, destination, tokens, mtokens, request, timeout }) {
|
||||
return await new Promise((resolve, reject) => {
|
||||
const params = {}
|
||||
if (request) {
|
||||
params.payment_request = request
|
||||
} else {
|
||||
params.dest = Buffer.from(destination, 'hex')
|
||||
params.amt_sat = tokens ? toPositiveNumber(tokens) : toPositiveNumber(BigInt(mtokens) / BigInt(1e3))
|
||||
}
|
||||
|
||||
lnd.router.estimateRouteFee({
|
||||
dest: Buffer.from(destination, 'hex'),
|
||||
amt_sat: tokens ? toPositiveNumber(tokens) : toPositiveNumber(BigInt(mtokens) / BigInt(1e3)),
|
||||
payment_request: request,
|
||||
...params,
|
||||
timeout
|
||||
}, (err, res) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
return
|
||||
}
|
||||
|
||||
if (res?.failure_reason) {
|
||||
reject(new Error(`Unable to estimate route: ${res.failure_reason}`))
|
||||
if (res?.failure_reason) {
|
||||
reject(new Error(`Unable to estimate route: ${res.failure_reason}`))
|
||||
} else {
|
||||
reject(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM polarlightning/lnd:0.17.5-beta
|
||||
FROM polarlightning/lnd:0.18.0-beta
|
||||
|
||||
ARG LN_NODE_FOR
|
||||
ENV LN_NODE_FOR=$LN_NODE_FOR
|
||||
|
|
|
@ -36,7 +36,7 @@ export default async function wrapInvoice (bolt11, { msats, description, descrip
|
|||
throw new Error('Unable to decode invoice')
|
||||
}
|
||||
|
||||
console.log('invoice', inv.mtokens, inv.expires_at, inv.cltv_delta)
|
||||
console.log('invoice', inv.id, inv.mtokens, inv.expires_at, inv.cltv_delta, inv.destination)
|
||||
|
||||
// validate outgoing amount
|
||||
if (inv.mtokens) {
|
||||
|
@ -77,6 +77,8 @@ export default async function wrapInvoice (bolt11, { msats, description, descrip
|
|||
case 49:
|
||||
case 149: // trampoline routing
|
||||
case 151: // electrum trampoline routing
|
||||
case 262:
|
||||
case 263: // blinded paths
|
||||
break
|
||||
default:
|
||||
throw new Error(`Unsupported feature bit: ${f.bit}`)
|
||||
|
|
Loading…
Reference in New Issue