balanceofsatoshis 17.1.2 → 17.2.0

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
+ ## 17.2.0
4
+
5
+ - `telegram`: Add `--use-rounded-units` to format amounts as rounded amounts
6
+
3
7
  ## 17.1.2
4
8
 
5
9
  - `recover-p2pk`: Fix recovering funds not sent to index 0
package/bos CHANGED
@@ -1922,6 +1922,7 @@ prog
1922
1922
  .option('--node <node_name>', 'Node to connect to Telegram', REPEATABLE)
1923
1923
  .option('--reset-api-key', 'Reset the Telegram API key')
1924
1924
  .option('--use-proxy <path>', 'Proxy agent to connect to Telegram')
1925
+ .option('--use-rounded-units', 'No leading zeros or fractions on amounts')
1925
1926
  .option('--use-small-units', 'Avoid showing leading zeros on amounts')
1926
1927
  .action((args, options, logger) => {
1927
1928
  return new Promise(async (resolve, reject) => {
@@ -1937,6 +1938,7 @@ prog
1937
1938
  makeDirectory: mkdir,
1938
1939
  },
1939
1940
  id: options.connect,
1941
+ is_rounded_units: options.useRoundedUnits || undefined,
1940
1942
  is_small_units: options.useSmallUnits || undefined,
1941
1943
  min_forward_tokens: options.ignoreForwardsBelow || undefined,
1942
1944
  min_rebalance_tokens: options.ignoreRebalancesBelow || undefined,
package/package.json CHANGED
@@ -37,9 +37,9 @@
37
37
  "ini": "4.1.1",
38
38
  "inquirer": "9.2.11",
39
39
  "ln-accounting": "7.0.2",
40
- "ln-service": "57.0.1",
40
+ "ln-service": "57.1.0",
41
41
  "ln-sync": "5.2.3",
42
- "ln-telegram": "5.0.0",
42
+ "ln-telegram": "6.0.0",
43
43
  "moment": "2.29.4",
44
44
  "paid-services": "5.0.5",
45
45
  "probing": "4.0.0",
@@ -54,7 +54,7 @@
54
54
  "description": "Lightning balance CLI",
55
55
  "devDependencies": {
56
56
  "invoices": "3.0.0",
57
- "ln-docker-daemons": "6.0.2",
57
+ "ln-docker-daemons": "6.0.3",
58
58
  "mock-lnd": "1.4.4"
59
59
  },
60
60
  "engines": {
@@ -82,5 +82,5 @@
82
82
  "postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis -t alexbosworth/balanceofsatoshis:$npm_package_version --push .",
83
83
  "test": "npx nyc@15.1.0 node --experimental-test-coverage --test test/arrays/*.js test/balances/*.js test/chain/*.js test/display/*.js test/encryption/*.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/telegram/*.js test/wallets/*.js"
84
84
  },
85
- "version": "17.1.2"
85
+ "version": "17.2.0"
86
86
  }
@@ -12,6 +12,7 @@ const runTelegramBot = require('./run_telegram_bot');
12
12
  const defaultPaymentsBudget = 0;
13
13
  const isNumber = n => !isNaN(n);
14
14
  const restartDelayMs = 1000 * 60 * 3;
15
+ const roundedUnitsType = 'rounded';
15
16
  const smallUnitsType = 'full';
16
17
 
17
18
  /** Connect nodes to Telegram
@@ -25,7 +26,8 @@ const smallUnitsType = 'full';
25
26
  writeFile: <Write File Function>
26
27
  }
27
28
  [id]: <Authorized User Id Number>
28
- is_small_units: <Formatting Should Use Small Units Bool>
29
+ [is_rounded_units]: <Formatting Should Use Rounded Units Bool>
30
+ [is_small_units]: <Formatting Should Use Small Units Bool>
29
31
  logger: <Winston Logger Object>
30
32
  [min_forward_tokens]: <Minimum Forward Tokens Number>
31
33
  [min_rebalance_tokens]: <Minimum Rebalance Tokens Number>
@@ -103,12 +105,15 @@ module.exports = (args, cbk) => {
103
105
 
104
106
  // Set the units formatting
105
107
  setUnits: ['validate', ({}, cbk) => {
106
- // Exit early when using default units formatting
107
- if (!args.is_small_units) {
108
- return cbk();
108
+ // Set rounded value formatting type
109
+ if (!!args.is_rounded_units) {
110
+ process.env.PREFERRED_TOKENS_TYPE = roundedUnitsType;
109
111
  }
110
112
 
111
- process.env.PREFERRED_TOKENS_TYPE = smallUnitsType;
113
+ // Set small units value formatting type
114
+ if (!!args.is_small_units) {
115
+ process.env.PREFERRED_TOKENS_TYPE = smallUnitsType;
116
+ }
112
117
 
113
118
  return cbk();
114
119
  }],