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