balanceofsatoshis 11.7.0 → 11.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Versions
2
2
 
3
+ ## Version 11.7.1
4
+
5
+ - `chart-fees-paid`: Increase precision of total fees paid
6
+
3
7
  ## Version 11.7.0
4
8
 
5
9
  - `fund`: Add `MAX` variable to allow spending down specified UTXOs
package/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  "postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis --push .",
81
81
  "test": "tap --branches=1 --functions=1 --lines=1 --statements=1 -t 60 test/arrays/*.js test/balances/*.js test/chain/*.js test/display/*.js test/encryption/*.js test/fiat/*.js test/lnd/*.js test/network/*.js test/nodes/*.js test/peers/*.js test/responses/*.js test/routing/*.js test/services/*.js test/swaps/*.js test/tags/*.js test/wallets/*.js"
82
82
  },
83
- "version": "11.7.0"
83
+ "version": "11.7.1"
84
84
  }
@@ -23,6 +23,7 @@ const {keys} = Object;
23
23
  const minChartDays = 4;
24
24
  const maxChartDays = 90;
25
25
  const mtokensAsBigUnit = n => (Number(n / BigInt(1e3)) / 1e8).toFixed(8);
26
+ const mtokensAsTokens = mtokens => Number(mtokens / BigInt(1e3));
26
27
  const tokensAsBigUnit = tokens => (tokens / 1e8).toFixed(8);
27
28
 
28
29
  /** Get routing fees paid
@@ -280,9 +281,12 @@ module.exports = (args, cbk) => {
280
281
 
281
282
  // Total paid
282
283
  total: ['forwards', ({forwards}, cbk) => {
283
- const paid = forwards.reduce((sum, {fee}) => sum + fee, Number());
284
+ const paid = forwards.reduce((sum, payment) => {
285
+ return sum + BigInt(payment.fee_mtokens);
286
+ },
287
+ BigInt(Number()));
284
288
 
285
- return cbk(null, paid);
289
+ return cbk(null, mtokensAsTokens(paid));
286
290
  }],
287
291
 
288
292
  // Payments activity aggregated