balanceofsatoshis 11.44.0 → 11.45.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
+ ## 11.45.0
4
+
5
+ - `increase-inbound-liquidity`: Add support for formulas in `--amount`
6
+
3
7
  ## 11.44.0
4
8
 
5
9
  - `send`: Add support for `--max-fee-rate` to limit fees paid via PPM measure
@@ -0,0 +1,72 @@
1
+ # Contribution Guidelines
2
+
3
+ - Feel free to open issues or pull requests
4
+ - They may not be addressed or merged
5
+ - You can ignore coding styles if you want
6
+
7
+ ## Coding Style
8
+
9
+ If you want to help with style, here are some rough guidelines on style ideas:
10
+
11
+ ### Formatting
12
+
13
+ - Spaces not tabs, 2 spaces
14
+ - Arguments to methods are snake_case
15
+ - Regular variables are camelCase
16
+ - Returned attributes are snake_case
17
+ - Minimize function nesting, make new files if nesting is required
18
+ - No extraneous whitespace
19
+ - A single newline should appear at the end of a file
20
+ - Don't bother with () in functions when not needed: `const a = b => c`
21
+ - If there are multiple things together, alphabetize them
22
+ - Don't split up long strings over multiple lines
23
+ - Lines should be terminated by explicit semicolons
24
+ - Logic like ternary operators should not extend beyond a single line
25
+ - Don't let any lines linger when they don't do anything
26
+ - Tightly space objects, like `{attribute: value}` not `{ attribute : value }`
27
+ - Use single '' quotes not double "" quotes, except when `` is required
28
+ - If conditions should avoid spanning multiple lines
29
+ - Avoid double specifying an attribute and value, `{type: type}` vs `{type}`
30
+
31
+ ### Control Flow
32
+
33
+ - Async functions should support both cbk and Promise style
34
+ - Use async.js methods for asynchronous control flow
35
+ - Try to exit early from functions when possible, and note this exit in comment
36
+ - Prefer cbk over Promise style, aside from in tests or in Promise libs
37
+ - Use `asyncAuto` for asynchronous control flow dependency management
38
+ - Callbacks should generally be named cbk even when redefinining in inner scope
39
+ - Avoid mixing non-async complex logic and async control flows in the same file
40
+ - Minimize async nesting in returned attributes and in method arguments
41
+ - Methods should always document their arguments and their output
42
+
43
+ ### Variables
44
+
45
+ - Generally use undefined rather than null when defining nil types
46
+ - Prefer variable assignments on new lines rather than on a single line
47
+ - Reduce the usage of . property access, like isArray instead of Array.isArray
48
+ - When there is a newline in an object, always put a comma at the end of a line
49
+ - Short properties always go first in objects: `{short, longer: type}`
50
+ - If a statement relies on a statement above it, it should have a newline above
51
+ - Avoid including scalar values such as strings or numbers in the code itself
52
+
53
+ ### JS Features
54
+
55
+ - Limit usage of `let` and never use `var`, prefer `const`
56
+ - Limit use of npm dependencies when possible, only use good dependencies
57
+ - Target support of the oldest node.js LTS release still being supported
58
+ - Never use class or prototype
59
+ - Do not import more methods from an import than you actually use
60
+ - Try to avoid passing objects in arguments as much as possible
61
+ - Prefer using function iteration like map and forEach over for and while
62
+ - Use arrow functions and not `function` functions whenever possible
63
+
64
+ ### Errors
65
+
66
+ - Never ignore an error case, always deal with it as soon as possible
67
+ - In the case of errors, do include the error string in the code
68
+ - Add simple validations to help target simple calling mistakes
69
+ - When throwing or returning error messages, use PascalCase for the message
70
+ - Use HTTP status codes as a guideline: 4** is a local issue, 5** is remote
71
+ - Return async errors as arrays: `[typeNumber, errorMsgString, extraDetails]`
72
+ - Try to be very specific with error messages and try to not repeat one
package/bos CHANGED
@@ -25,6 +25,7 @@ const {accountingCategories} = commandConstants;
25
25
  const balances = importLazy('./balances');
26
26
  const chain = importLazy('./chain');
27
27
  const commands = importLazy('./commands');
28
+ const display = importLazy('./display');
28
29
  const encryption = importLazy('./encryption');
29
30
  const lnd = importLazy('./lnd');
30
31
  const network = importLazy('./network');
@@ -54,7 +55,6 @@ const months = [...Array(12).keys()].map(n => ++n);
54
55
  const {REPEATABLE} = prog;
55
56
  const {STRING} = prog;
56
57
  const yearMatch = /^\d{4}$/;
57
-
58
58
  prog
59
59
  .version(version)
60
60
 
@@ -884,10 +884,11 @@ prog
884
884
  .command('increase-inbound-liquidity', 'Increase node inbound liquidity')
885
885
  .help('Spend down a channel to get inbound. Fee is an estimate, may be more')
886
886
  .help('If you want to control chain fee increases, use show-raw-recoveries')
887
+ .help('Formulas supported for --amount like 5*m or 0.05*BTC for 5 million')
887
888
  .option('--address <out_address>', 'Out chain address to send funds out to')
888
889
  .option('--api-key <api_key>', 'Pre-paid API key to use')
890
+ .option('--amount <amount>', 'Amount to increase inbound', STRING, '500*k')
889
891
  .option('--avoid <pubkey/chan/tag>', 'Avoid forwarding through', REPEATABLE)
890
- .option('--amount <amount>', 'Amount to increase liquidity', INT, 5e5)
891
892
  .option('--confs <confs>', 'Confs to consider reorg safe', INT, 1)
892
893
  .option('--dryrun', 'Only show cost estimate for increase')
893
894
  .option('--fast', 'Request swap server avoid batching delay')
@@ -930,11 +931,11 @@ prog
930
931
  spend_address: options.spendAddress || undefined,
931
932
  spend_tokens: options.spendAmount || undefined,
932
933
  timeout: 1000 * 60 * 60 * 10,
933
- tokens: options.amount,
934
+ tokens: display.parseAmount({amount: options.amount}).tokens,
934
935
  },
935
936
  responses.returnObject({exit, logger, reject, resolve}));
936
937
  } catch (err) {
937
- return reject(err);
938
+ return reject(logger.error({err}));
938
939
  }
939
940
  });
940
941
  })
package/package.json CHANGED
@@ -28,7 +28,7 @@
28
28
  "crypto-js": "4.1.1",
29
29
  "csv-parse": "5.0.4",
30
30
  "goldengate": "11.0.0",
31
- "grammy": "1.6.2",
31
+ "grammy": "1.7.0",
32
32
  "hot-formula-parser": "4.0.0",
33
33
  "import-lazy": "4.0.0",
34
34
  "ini": "2.0.0",
@@ -52,7 +52,7 @@
52
52
  "description": "Lightning balance CLI",
53
53
  "devDependencies": {
54
54
  "@alexbosworth/tap": "15.0.10",
55
- "ln-docker-daemons": "2.2.2",
55
+ "ln-docker-daemons": "2.2.3",
56
56
  "mock-lnd": "1.4.1",
57
57
  "secp256k1": "4.0.3"
58
58
  },
@@ -81,5 +81,5 @@
81
81
  "postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis --push .",
82
82
  "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/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"
83
83
  },
84
- "version": "11.44.0"
84
+ "version": "11.45.0"
85
85
  }