ln-service
Advanced tools
Comparing version 3.0.4 to 3.0.6
@@ -0,5 +1,9 @@ | ||
const BN = require('bn.js'); | ||
const {isFinite} = require('lodash'); | ||
const {routesFromQueryRoutes} = require('./../lnd'); | ||
const defaultRoutesReturnCount = 10; | ||
const intBase = 10; | ||
const msatsPerToken = 1e3; | ||
@@ -57,21 +61,9 @@ const pathNotFoundErrors = [ | ||
if (!res || !Array.isArray(res.routes)) { | ||
return cbk([503, 'ExpectedRoutes']); | ||
try { | ||
return cbk(null, routesFromQueryRoutes({response: res})); | ||
} catch (e) { | ||
return cbk([503, 'InvalidGetRoutesResponse', e]); | ||
} | ||
const invalidRoutes = res.routes | ||
.map(route => parseInt(route.total_fees, intBase)) | ||
.filter(fees => !isFinite(fees)); | ||
if (!!invalidRoutes.length) { | ||
return cbk([503, 'ExpectedValidRoutes']); | ||
} | ||
const routes = res.routes.map(route => { | ||
return {fee: parseInt(route.total_fees, intBase)}; | ||
}); | ||
return cbk(null, {routes}); | ||
}); | ||
}; | ||
@@ -14,2 +14,4 @@ const asyncAuto = require('async/auto'); | ||
{ | ||
[chain_fee_tokens_per_vbyte]: <Chain Fee Tokens Per VByte Number> | ||
[give_tokens]: <Tokens to Give To Partner Number> | ||
lnd: <LND GRPC API Object> | ||
@@ -54,7 +56,17 @@ [local_tokens]: <Local Tokens Number> // When not set, uses max possible | ||
const open = args.lnd.openChannel({ | ||
const options = { | ||
local_funding_amount: channelAmount - staticFee, | ||
node_pubkey: Buffer.from(args.partner_public_key, 'hex'), | ||
}); | ||
} | ||
if (!!args.chain_fee_tokens_per_vbyte) { | ||
options.sat_per_byte = chain_fee_tokens_per_vbyte; | ||
} | ||
if (!!args.give_tokens) { | ||
options.push_sat = args.give_tokens; | ||
} | ||
const open = args.lnd.openChannel(options); | ||
open.on('data', chan => { | ||
@@ -61,0 +73,0 @@ switch (chan.update) { |
@@ -15,8 +15,7 @@ { | ||
"express": "4.16.3", | ||
"express-basic-auth": "1.1.4", | ||
"express-basic-auth": "1.1.5", | ||
"grpc": "1.10.1", | ||
"lodash": "4.17.5", | ||
"lodash": "4.17.10", | ||
"morgan": "1.9.0", | ||
"request": "2.85.0", | ||
"safe-buffer": "5.1.1", | ||
"secp256k1": "3.5.0", | ||
@@ -28,7 +27,7 @@ "walnut": "0.0.3", | ||
"devDependencies": { | ||
"tap": "11.1.1" | ||
"tap": "11.1.4" | ||
}, | ||
"engines": { | ||
"node": "6.13.1", | ||
"npm": "3.10.10" | ||
"node": ">=8.11.1", | ||
"npm": "5.8.0" | ||
}, | ||
@@ -49,5 +48,6 @@ "keywords": [ | ||
"scripts": { | ||
"start": "node server.js", | ||
"test": "tap test/*.js" | ||
}, | ||
"version": "3.0.4" | ||
"version": "3.0.6" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
177914
16
85
3502
+ Addedexpress-basic-auth@1.1.5(transitive)
+ Addedlodash@4.17.10(transitive)
- Removedsafe-buffer@5.1.1
- Removedexpress-basic-auth@1.1.4(transitive)
- Removedlodash@4.17.5(transitive)
Updatedexpress-basic-auth@1.1.5
Updatedlodash@4.17.10