balanceofsatoshis 11.14.0 → 11.16.2
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 +17 -0
- package/Dockerfile +2 -2
- package/README.md +81 -68
- package/balances/get_liquidity.js +0 -1
- package/bos +9 -5
- package/chain/index.js +0 -2
- package/network/push_payment.js +1 -18
- package/package.json +6 -6
- package/peers/detect_open_rule_violation.js +5 -0
- package/peers/index.js +2 -2
- package/peers/{reject_inbound_channels.js → intercept_inbound_channels.js} +55 -21
- package/peers/open_channels.js +3 -3
- package/routing/adjust_fees.js +1 -2
- package/services/accept_balanced_channel.js +58 -160
- package/services/initiate_balanced_channel.js +71 -208
- package/services/open_balanced_channel.js +20 -80
- package/services/recover_transit_funds.js +2 -4
- package/swaps/swap_in.js +7 -2
- package/telegram/start_telegram_bot.js +47 -39
- package/test/integration/test_open_balanced_channel.js +76 -63
- package/test/network/test_push_payment.js +1 -1
- package/test/services/test_accept_balanced_channel.js +17 -6
- package/test/services/test_initiate_balanced_channel.js +10 -4
- package/chain/broadcast_transaction.js +0 -113
- package/network/get_network.js +0 -57
- package/routing/update_channel_fee.js +0 -142
- package/services/get_balanced_refund.js +0 -160
- package/test/routing/test_update_channel_fee.js +0 -183
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 11.16.2
|
|
4
|
+
|
|
5
|
+
- Address Docker image installation issues
|
|
6
|
+
- `open-balanced-channel`: Move up indicator of waiting for incoming channel
|
|
7
|
+
|
|
8
|
+
## 11.16.1
|
|
9
|
+
|
|
10
|
+
- `send`: Add support for global ignores from `tags` when `--avoid` unspecified
|
|
11
|
+
|
|
12
|
+
## 11.16.0
|
|
13
|
+
|
|
14
|
+
- `open-balanced-channel`: Add `--coop-close-address` to add a close-to-address
|
|
15
|
+
|
|
16
|
+
## 11.15.0
|
|
17
|
+
|
|
18
|
+
- `inbound-channel-rules`: Add `--coop-close-address` to request close address
|
|
19
|
+
|
|
3
20
|
## 11.14.0
|
|
4
21
|
|
|
5
22
|
- `open-balanced-channel`: Add support for accepting using p2p messaging
|
package/Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
FROM node:
|
|
1
|
+
FROM node:16
|
|
2
2
|
|
|
3
3
|
# UID / GID 1000 is default for user `node` in the `node:latest` image, this
|
|
4
4
|
# way the process will run as a non-root user
|
|
@@ -15,6 +15,6 @@ USER $USER_ID:$GROUP_ID
|
|
|
15
15
|
|
|
16
16
|
COPY . /app/
|
|
17
17
|
|
|
18
|
-
RUN npm ci
|
|
18
|
+
RUN npm ci
|
|
19
19
|
|
|
20
20
|
ENTRYPOINT [ "/app/bos" ]
|
package/README.md
CHANGED
|
@@ -6,33 +6,35 @@ Commands for working with LND balances.
|
|
|
6
6
|
|
|
7
7
|
Supported LND versions:
|
|
8
8
|
|
|
9
|
-
- v0.
|
|
10
|
-
- v0.13.0-beta to v0.13.4-beta
|
|
11
|
-
- v0.12.0-beta to v0.12.1-beta
|
|
12
|
-
- v0.11.0-beta to v0.11.1-beta
|
|
9
|
+
- v0.11.0-beta to v0.14.1-beta
|
|
13
10
|
|
|
14
11
|
## Install
|
|
15
12
|
|
|
16
|
-
- Requires an [installation of Node v12.20+]
|
|
17
|
-
- Have a RaspiBlitz? Check out [this install guide](https://gist.github.com/openoms/823f99d1ab6e1d53285e489f7ba38602)
|
|
18
|
-
|
|
19
|
-
If you want to try out any command without npm install, you can also do `npx
|
|
20
|
-
balanceofsatoshis` to run a command directly.
|
|
21
|
-
|
|
22
|
-
If you have [Docker](https://docs.docker.com/get-docker/) installed or are using a Docker based
|
|
23
|
-
platform like Umbrel or BTCPayServer, you can [run through Docker](#docker) instead.
|
|
13
|
+
- Requires an [installation of Node v12.20+][nodejs-install-guide]
|
|
24
14
|
|
|
25
15
|
```shell
|
|
26
16
|
npm install -g balanceofsatoshis
|
|
27
17
|
```
|
|
28
18
|
|
|
29
|
-
|
|
19
|
+
Or use a platform-specific guide:
|
|
20
|
+
|
|
21
|
+
- [Docker/BTCPayServer install notes](#docker)
|
|
22
|
+
- [RaspiBlitz install guide][raspiblitz-install-guide]
|
|
23
|
+
- [RaspiBolt/Debian guide][raspibolt-install-guide]
|
|
24
|
+
- [Umbrel install guide][umbrel-install-guide]
|
|
25
|
+
|
|
26
|
+
If you want to try out any command without npm install, you can also do `npx
|
|
27
|
+
balanceofsatoshis` to run a command directly.
|
|
28
|
+
|
|
29
|
+
Get the version to verify that it's installed:
|
|
30
30
|
|
|
31
31
|
```shell
|
|
32
32
|
bos --version
|
|
33
33
|
# current installed version
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
Re-install if you want to update to a new version.
|
|
37
|
+
|
|
36
38
|
## Usage
|
|
37
39
|
|
|
38
40
|
To see a list of available options and flags run:
|
|
@@ -49,7 +51,7 @@ Or ask about commands on [Telegram](https://t.me/balanceofsatoshis)
|
|
|
49
51
|
If you want autocomplete on commands and options you can do:
|
|
50
52
|
|
|
51
53
|
```
|
|
52
|
-
## Autocomplete on ZSH shells (on startup: you can add this to ~/.zshrc)
|
|
54
|
+
## Autocomplete on MacOS/ZSH shells (on startup: you can add this to ~/.zshrc)
|
|
53
55
|
autoload -Uz compinit && compinit
|
|
54
56
|
source <(bos completion zsh)
|
|
55
57
|
|
|
@@ -132,6 +134,9 @@ bos nodes
|
|
|
132
134
|
# Open channels to public keys in a batch transaction
|
|
133
135
|
bos open "public_keys..."
|
|
134
136
|
|
|
137
|
+
# Open a balanced channel with a peer
|
|
138
|
+
bos open-balanced-channel
|
|
139
|
+
|
|
135
140
|
# Outputs the sum total of local channel liquidity
|
|
136
141
|
bos outbound-liquidity
|
|
137
142
|
|
|
@@ -177,15 +182,16 @@ bos utxos
|
|
|
177
182
|
- Another `rebalance` [command howto](https://yalls.org/articles/97d67df1-d721-417d-a6c0-11d793739be9:0965AC5E-56CD-4870-9041-E69616660E6F/30a7c519-0ec0-4644-b3aa-341c41bac296)
|
|
178
183
|
- Running `rebalance` [video (In German)](https://www.youtube.com/watch?v=EimVHnv-SUk)
|
|
179
184
|
- Secrets of `rebalance` [command revealed](https://yalls.org/articles/97d67df1-d721-417d-a6c0-11d793739be9:0965AC5E-56CD-4870-9041-E69616660E6F/3c0709b7-5f6a-4a3c-944e-48b80e0556df)
|
|
180
|
-
- Running `telegram` [via nohup/tmux howto](https://plebnet.wiki/wiki/Umbrel_-_Installing_BoS)
|
|
185
|
+
- Running `telegram` [via nohup/tmux howto](https://plebnet.wiki/wiki/Umbrel_-_Installing_BoS#Installing_Telegram_Bot)
|
|
181
186
|
- Running `telegram` [via systemd](https://github.com/ziggie1984/miscellanous/blob/97c4905747fe23a824b6e53dc674c4a571ac0f5c/automation_telegram_bot.md)
|
|
187
|
+
- Another `rebalance` + `tags` & `telegram` [commands howto](https://raspibolt.org/bonus/lightning/balance-of-satoshis.html#balance-of-satoshis-in-action)
|
|
182
188
|
|
|
183
189
|
Want to stack some sats? Write your own LN paywalled guide!
|
|
184
190
|
|
|
185
191
|
## Nodes
|
|
186
192
|
|
|
187
|
-
By default `bos` expects `tls.cert` in the root of the default `lnd` directory
|
|
188
|
-
`admin.macaroon` in `<default_lnd_dir>/data/chain/bitcoin/<network>`.
|
|
193
|
+
By default `bos` expects `tls.cert` in the root of the default `lnd` directory
|
|
194
|
+
and `admin.macaroon` in `<default_lnd_dir>/data/chain/bitcoin/<network>`.
|
|
189
195
|
|
|
190
196
|
Default LND directories:
|
|
191
197
|
* macOS: `~/Library/Application Support/Lnd/`
|
|
@@ -211,13 +217,13 @@ Use any shorthand you'd like when choosing this profile node name
|
|
|
211
217
|
|
|
212
218
|
2. Each file should have the following format:
|
|
213
219
|
|
|
214
|
-
|
|
220
|
+
```json
|
|
215
221
|
{
|
|
216
222
|
"cert": "base64 tls.cert value",
|
|
217
223
|
"macaroon": "base64 .macaroon value",
|
|
218
224
|
"socket": "host:port"
|
|
219
225
|
}
|
|
220
|
-
|
|
226
|
+
```
|
|
221
227
|
|
|
222
228
|
> **Note:** `cert` and (admin) `macaroon` should have base64-encoded, and newline-stripped content of the files. To get the strings in appropriate format you can run, ex:
|
|
223
229
|
>
|
|
@@ -231,23 +237,23 @@ Use any shorthand you'd like when choosing this profile node name
|
|
|
231
237
|
>
|
|
232
238
|
> **Note_2:** `socket` should contain `host:port` pointing to `lnd`'s gRPC interface, `localhost:10009` by convention.
|
|
233
239
|
|
|
234
|
-
|
|
235
|
-
|
|
240
|
+
You can also set `cert_path` and `macaroon_path` to the path of the relevant
|
|
241
|
+
files instead.
|
|
236
242
|
|
|
237
243
|
#### Umbrel Saved Node
|
|
238
244
|
|
|
239
245
|
*Note: Umbrel is not FOSS software, use at your own risk.*
|
|
240
246
|
|
|
241
247
|
If you are using Umbrel and you have already installed but you get an error like
|
|
242
|
-
`Name resolution failed for target dns:umbrel.local:10009` then try adding
|
|
243
|
-
to your `/etc/hosts` file, like `sudo nano /etc/hosts` and add a line
|
|
244
|
-
`127.0.0.1 umbrel.local`
|
|
248
|
+
`Name resolution failed for target dns:umbrel.local:10009` then try adding
|
|
249
|
+
umbrel.local to your `/etc/hosts` file, like `sudo nano /etc/hosts` and add a line `127.0.0.1 umbrel.local`
|
|
245
250
|
|
|
246
251
|
1. Identify your Umbrel home dir, like /home/umbrel/umbrel
|
|
247
|
-
2. Look in the .env file in that dir for the `LND_IP` to use as the socket to
|
|
252
|
+
2. Look in the .env file in that dir for the `LND_IP` to use as the socket to
|
|
253
|
+
connect to
|
|
248
254
|
|
|
249
|
-
You can also use umbrel.local if that is in your Umbrel TLS cert but you will
|
|
250
|
-
hostname is known to the client.
|
|
255
|
+
You can also use umbrel.local if that is in your Umbrel TLS cert but you will
|
|
256
|
+
have to make sure the hostname is known to the client.
|
|
251
257
|
|
|
252
258
|
```
|
|
253
259
|
{
|
|
@@ -333,7 +339,8 @@ Keep a channel balanced between two of your own nodes
|
|
|
333
339
|
*/30 * * * * /home/ubuntu/.npm-global/bin/bos send PUBKEY --max-fee 0 --message="rebalance" --amount="IF(OUTBOUND+1*m>(LIQUIDITY/2), OUTBOUND-(LIQUIDITY/2), 0)"
|
|
334
340
|
```
|
|
335
341
|
|
|
336
|
-
If you want to 50:50 rebalance with a peer node, you can use
|
|
342
|
+
If you want to 50:50 rebalance with a peer node, you can use
|
|
343
|
+
`--out-target-inbound=capacity/2` with `bos rebalance`
|
|
337
344
|
|
|
338
345
|
## Alerts and Reports with `sendnotification`
|
|
339
346
|
|
|
@@ -398,9 +405,9 @@ Examples of shell scripts that could be executed by crontab:
|
|
|
398
405
|
|
|
399
406
|
### Persist Long-Running Commands
|
|
400
407
|
|
|
401
|
-
If you are running a long-running command and want it to persist, you will need
|
|
402
|
-
Docker or nohup or tmux to assist you in that and then kill the
|
|
403
|
-
updating.
|
|
408
|
+
If you are running a long-running command and want it to persist, you will need
|
|
409
|
+
something like Docker or nohup or tmux to assist you in that and then kill the
|
|
410
|
+
process and restart it when updating.
|
|
404
411
|
|
|
405
412
|
Nohup example:
|
|
406
413
|
|
|
@@ -418,23 +425,23 @@ docker run -d --restart always -v $HOME/.bos:/home/node/.bos alexbosworth/balanc
|
|
|
418
425
|
|
|
419
426
|
This presumes you have Docker installed.
|
|
420
427
|
|
|
421
|
-
- [Instructions for installing Docker on Ubuntu]
|
|
422
|
-
|
|
423
|
-
### Docker Load
|
|
428
|
+
- [Instructions for installing Docker on Ubuntu][docker-install-guide]
|
|
424
429
|
|
|
425
430
|
Install the Docker image:
|
|
426
431
|
|
|
427
|
-
```
|
|
432
|
+
```shell
|
|
428
433
|
docker pull alexbosworth/balanceofsatoshis
|
|
429
434
|
```
|
|
430
435
|
|
|
436
|
+
### Docker Load
|
|
437
|
+
|
|
431
438
|
You can also build the image yourself: `npm run build-docker`, this will make
|
|
432
439
|
`balanceofsatoshis.tar.gz` that you can rsync or scp somewhere else and then
|
|
433
440
|
do `docker load < balanceofsatoshis.tar.gz`.
|
|
434
441
|
|
|
435
442
|
Once the image is installed, you can "docker run" commands for all the commands:
|
|
436
443
|
|
|
437
|
-
```
|
|
444
|
+
```shell
|
|
438
445
|
# Make sure you have a home directory created to give Docker access to
|
|
439
446
|
mkdir $HOME/.bos
|
|
440
447
|
|
|
@@ -450,17 +457,17 @@ dir as an additional -v argument to docker run:
|
|
|
450
457
|
|
|
451
458
|
If you are on MacOS:
|
|
452
459
|
|
|
453
|
-
```
|
|
460
|
+
```shell
|
|
454
461
|
--network="host" -v $HOME/Library/Application\ Support/Lnd/:/home/node/.lnd:ro
|
|
455
462
|
```
|
|
456
463
|
|
|
457
464
|
Or on Linux:
|
|
458
465
|
|
|
459
|
-
```
|
|
466
|
+
```shell
|
|
460
467
|
--network="host" -v $HOME/.lnd:/home/node/.lnd:ro
|
|
461
468
|
```
|
|
462
469
|
|
|
463
|
-
On
|
|
470
|
+
On BTCPayServer:
|
|
464
471
|
|
|
465
472
|
Create the credential.json file as explained in the saved nodes section, and for socket put:
|
|
466
473
|
`"socket": "lnd_bitcoin:10009"`
|
|
@@ -481,22 +488,20 @@ On Umbrel this would be:
|
|
|
481
488
|
docker run -it --rm --network="host" --add-host=umbrel.local:192.168.1.23 -v $HOME/.bos:/home/node/.bos -v $HOME/umbrel/lnd:/home/node/.lnd:ro alexbosworth/balanceofsatoshis report
|
|
482
489
|
```
|
|
483
490
|
|
|
484
|
-
Note: For [umbrel-os](https://github.com/getumbrel/umbrel-os) users, when
|
|
485
|
-
docker run command, ensure the "192.168.1.23" portion of the
|
|
486
|
-
IP of the lnd container. You can find the IP
|
|
487
|
-
`$HOME/umbrel/.env` file.
|
|
488
|
-
|
|
489
|
-
(Note: Umbrel is not FOSS software, use at your own risk.)
|
|
491
|
+
Note: For [umbrel-os](https://github.com/getumbrel/umbrel-os) users, when
|
|
492
|
+
running the above docker run command, ensure the "192.168.1.23" portion of the
|
|
493
|
+
command is updated to reflect the IP of the lnd container. You can find the IP
|
|
494
|
+
by looking for the `LND_IP` value inside the `$HOME/umbrel/.env` file.
|
|
490
495
|
|
|
491
496
|
Otherwise you can just pass the local node credentials as shown above using the
|
|
492
497
|
saved nodes.
|
|
493
498
|
|
|
494
|
-
If you are running a long-running command like `telegram`, use `-d --restart
|
|
495
|
-
of `-it --rm` to run in daemon mode and auto-restart.
|
|
499
|
+
If you are running a long-running command like `telegram`, use `-d --restart
|
|
500
|
+
always` instead of `-it --rm` to run in daemon mode and auto-restart.
|
|
496
501
|
|
|
497
|
-
Note: if you are used to using ctrl+c to terminate the process, that doesn't
|
|
498
|
-
Instead, you can use ctrl+p and then ctrl+q to background the
|
|
499
|
-
`docker ps` and `docker rm` to kill the instance.
|
|
502
|
+
Note: if you are used to using ctrl+c to terminate the process, that doesn't
|
|
503
|
+
work on Docker. Instead, you can use ctrl+p and then ctrl+q to background the
|
|
504
|
+
interactive mode, then do `docker ps` and `docker rm` to kill the instance.
|
|
500
505
|
|
|
501
506
|
### Build Your Own
|
|
502
507
|
|
|
@@ -525,8 +530,9 @@ You can also define an alias for placing in `~/.profile` or `~/.bash_profile`:
|
|
|
525
530
|
alias bos="docker run -it --rm -v $HOME/.bos:/home/node/.bos alexbosworth/balanceofsatoshis"
|
|
526
531
|
```
|
|
527
532
|
|
|
528
|
-
Adjust this alias to however you run the full Docker command. Remember to
|
|
529
|
-
to install the alias into your current session: `.
|
|
533
|
+
Adjust this alias to however you run the full Docker command. Remember to
|
|
534
|
+
execute the ~/.profile to install the alias into your current session: `.
|
|
535
|
+
~/.profile`
|
|
530
536
|
|
|
531
537
|
You can also create an alias to run a command in the background
|
|
532
538
|
|
|
@@ -536,18 +542,19 @@ alias bosd="docker run -d --rm -v $HOME/.bos:/home/node/.bos alexbosworth/balanc
|
|
|
536
542
|
|
|
537
543
|
## Formulas
|
|
538
544
|
|
|
539
|
-
Some commands take formula arguments. Formulas are expressions that allow you
|
|
540
|
-
functions and reference variables.
|
|
545
|
+
Some commands take formula arguments. Formulas are expressions that allow you
|
|
546
|
+
to perform functions and reference variables.
|
|
541
547
|
|
|
542
548
|
There is a dynamic playground here where you can play with expressions:
|
|
543
549
|
https://formulajs.info/functions/
|
|
544
550
|
|
|
545
551
|
### `--avoid`
|
|
546
552
|
|
|
547
|
-
In `--avoid` flag commands like rebalance, a formula can be applied
|
|
553
|
+
In `--avoid` flag commands like rebalance, a formula can be applied
|
|
554
|
+
directionally:
|
|
548
555
|
|
|
549
|
-
`--avoid "fee_rate < 100/<PUBKEY>"` to avoid channels forwarding to the public
|
|
550
|
-
charge a fee rate under 100 PPM.
|
|
556
|
+
`--avoid "fee_rate < 100/<PUBKEY>"` to avoid channels forwarding to the public
|
|
557
|
+
key that charge a fee rate under 100 PPM.
|
|
551
558
|
|
|
552
559
|
Available variables:
|
|
553
560
|
|
|
@@ -577,14 +584,14 @@ defined:
|
|
|
577
584
|
|
|
578
585
|
Examples:
|
|
579
586
|
|
|
580
|
-
```
|
|
581
|
-
bos fund <address> 7*m
|
|
587
|
+
```shell
|
|
588
|
+
bos fund <address> "7*m"
|
|
582
589
|
// Fund address with value 7,000,000
|
|
583
590
|
|
|
584
|
-
bos probe <key> 100*k
|
|
591
|
+
bos probe <key> "100*k"
|
|
585
592
|
// Probe to key amount 100,000
|
|
586
593
|
|
|
587
|
-
bos send <key> m/2
|
|
594
|
+
bos send <key> "m/2"
|
|
588
595
|
// Push 500,000 to key
|
|
589
596
|
```
|
|
590
597
|
|
|
@@ -604,9 +611,9 @@ And for `--in-filter` and `--out-filter`:
|
|
|
604
611
|
|
|
605
612
|
Example:
|
|
606
613
|
|
|
607
|
-
```
|
|
614
|
+
```shell
|
|
608
615
|
// Rebalance with a target of 1,000,000
|
|
609
|
-
bos rebalance --amount 1*m
|
|
616
|
+
bos rebalance --amount "1*m"
|
|
610
617
|
```
|
|
611
618
|
|
|
612
619
|
#### `send`
|
|
@@ -621,9 +628,9 @@ Send defines additional variables:
|
|
|
621
628
|
|
|
622
629
|
Example:
|
|
623
630
|
|
|
624
|
-
```
|
|
631
|
+
```shell
|
|
625
632
|
// Send node $1
|
|
626
|
-
bos send <key> --amount 1*usd
|
|
633
|
+
bos send <key> --amount "1*usd"
|
|
627
634
|
```
|
|
628
635
|
|
|
629
636
|
#### `transfer`
|
|
@@ -636,7 +643,7 @@ Transfer variables:
|
|
|
636
643
|
|
|
637
644
|
Example:
|
|
638
645
|
|
|
639
|
-
```
|
|
646
|
+
```shell
|
|
640
647
|
// Equalize inbound with a mutual peer
|
|
641
648
|
bos transfer node "in_inbound - (in_inbound + out_inbound)/2" --through peer
|
|
642
649
|
```
|
|
@@ -657,7 +664,7 @@ You can also use functions:
|
|
|
657
664
|
|
|
658
665
|
Example:
|
|
659
666
|
|
|
660
|
-
```
|
|
667
|
+
```shell
|
|
661
668
|
// Set the fee rate to a tag to 1% of the value forwarded
|
|
662
669
|
bos fees --to tag --set-fee-rate "percent(1)"
|
|
663
670
|
```
|
|
@@ -677,7 +684,13 @@ Formula variables:
|
|
|
677
684
|
|
|
678
685
|
Example:
|
|
679
686
|
|
|
680
|
-
```
|
|
687
|
+
```shell
|
|
681
688
|
// Reject channels that are smaller than 2,000,000 capacity
|
|
682
689
|
bos inbound-channel-rules "capacity < 2*m"
|
|
683
690
|
```
|
|
691
|
+
|
|
692
|
+
[docker-install-guide]: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04
|
|
693
|
+
[nodejs-install-guide]: https://gist.github.com/alexbosworth/8fad3d51f9e1ff67995713edf2d20126
|
|
694
|
+
[raspiblitz-install-guide]: https://gist.github.com/openoms/823f99d1ab6e1d53285e489f7ba38602
|
|
695
|
+
[raspibolt-install-guide]: https://raspibolt.org/bonus/lightning/balance-of-satoshis.html
|
|
696
|
+
[umbrel-install-guide]: https://plebnet.wiki/wiki/Umbrel_-_Installing_BoS
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const asyncAuto = require('async/auto');
|
|
2
2
|
const {getChannels} = require('ln-service');
|
|
3
3
|
const {getLiquidity} = require('ln-sync');
|
|
4
|
-
const {getNetwork} = require('ln-sync');
|
|
5
4
|
const {getNode} = require('ln-service');
|
|
6
5
|
const {getScoredNodes} = require('ln-sync');
|
|
7
6
|
const {returnResult} = require('asyncjs-util');
|
package/bos
CHANGED
|
@@ -199,7 +199,7 @@ prog
|
|
|
199
199
|
.action((args, options, logger) => {
|
|
200
200
|
return new Promise(async (resolve, reject) => {
|
|
201
201
|
try {
|
|
202
|
-
return
|
|
202
|
+
return lnSync.broadcastTransaction({
|
|
203
203
|
logger,
|
|
204
204
|
description: options.description,
|
|
205
205
|
lnd: (await lnd.authenticatedLnd({logger, node: options.node})).lnd,
|
|
@@ -742,24 +742,26 @@ prog
|
|
|
742
742
|
});
|
|
743
743
|
})
|
|
744
744
|
|
|
745
|
-
//
|
|
745
|
+
// Intercept inbound channel requests and set requirements for inbound opens
|
|
746
746
|
.command('inbound-channel-rules', 'Enforce rules for inbound channels')
|
|
747
|
-
.help('
|
|
748
|
-
.help('
|
|
747
|
+
.help('Rules should be written evaluating to TRUE to accept a channel')
|
|
748
|
+
.help('Example rule: --rule "CAPACITY > 100000"')
|
|
749
749
|
.help('For formulas: CAPACITIES are the sizes of the peer public channels')
|
|
750
750
|
.help('For formulas: CAPACITY is the size of the requested channel open')
|
|
751
751
|
.help('For formulas: CHANNEL_AGES are the block ages of public channels')
|
|
752
752
|
.help('For formulas: FEE_RATES are the outbound fee rates for the peer')
|
|
753
753
|
.help('For formulas: LOCAL_BALANCE is the gifted amount from the peer')
|
|
754
754
|
.help('For formulas: PUBLIC_KEY is the public key of the requesting peer')
|
|
755
|
+
.option('--coop-close-address', 'Request using a cooperative close address')
|
|
755
756
|
.option('--node <node_name>', 'Saved node to reject inbound channels on')
|
|
756
757
|
.option('--reason <message>', 'Message to return when rejecting a request')
|
|
757
758
|
.option('--rule <formula>', 'Freeform rule for inbound channel', REPEATABLE)
|
|
758
759
|
.action((args, options, logger) => {
|
|
759
760
|
return new Promise(async (resolve, reject) => {
|
|
760
761
|
try {
|
|
761
|
-
return await peers.
|
|
762
|
+
return await peers.interceptInboundChannels({
|
|
762
763
|
logger,
|
|
764
|
+
address: options.coopCloseAddress || undefined,
|
|
763
765
|
lnd: (await lndForNode(logger, options.node)).lnd,
|
|
764
766
|
reason: options.reason,
|
|
765
767
|
rules: flatten([options.rule].filter(n => !!n)),
|
|
@@ -1003,6 +1005,7 @@ prog
|
|
|
1003
1005
|
.help('Remote node must be prepared to receive this type of channel')
|
|
1004
1006
|
.help('The remote node should also run this same command after you propose')
|
|
1005
1007
|
.help('Channel details are negotiated with keysend so that is also required')
|
|
1008
|
+
.option('--coop-close-address <addr>', 'Close address (for proposing open)')
|
|
1006
1009
|
.option('--node <node_name>', 'Use saved node details instead of local node')
|
|
1007
1010
|
.option('--recover <addr>', 'Recover if funds sent to an address by mistake')
|
|
1008
1011
|
.action((args, options, logger) => {
|
|
@@ -1010,6 +1013,7 @@ prog
|
|
|
1010
1013
|
try {
|
|
1011
1014
|
return services.openBalancedChannel({
|
|
1012
1015
|
logger,
|
|
1016
|
+
address: options.coopCloseAddress || undefined,
|
|
1013
1017
|
after: new Date(Date.now() - (1000 * 60 * 60 * 6)).toISOString(),
|
|
1014
1018
|
ask: (n, cbk) => inquirer.prompt([n]).then(res => cbk(res)),
|
|
1015
1019
|
lnd: (await lnd.authenticatedLnd({logger, node: options.node})).lnd,
|
package/chain/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const broadcastTransaction = require('./broadcast_transaction');
|
|
2
1
|
const fundTransaction = require('./fund_transaction');
|
|
3
2
|
const getAddressUtxo = require('./get_address_utxo');
|
|
4
3
|
const getChainFees = require('./get_chain_fees');
|
|
@@ -11,7 +10,6 @@ const recoverP2pk = require('./recover_p2pk');
|
|
|
11
10
|
const splitUtxos = require('./split_utxos');
|
|
12
11
|
|
|
13
12
|
module.exports = {
|
|
14
|
-
broadcastTransaction,
|
|
15
13
|
fundTransaction,
|
|
16
14
|
getAddressUtxo,
|
|
17
15
|
getChainFees,
|
package/network/push_payment.js
CHANGED
|
@@ -126,11 +126,6 @@ module.exports = (args, cbk) => {
|
|
|
126
126
|
|
|
127
127
|
// Get the node identity public key
|
|
128
128
|
getIdentity: ['validate', ({}, cbk) => {
|
|
129
|
-
// Exit early when there are no avoids
|
|
130
|
-
if (!args.avoid.length) {
|
|
131
|
-
return cbk();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
129
|
return getIdentity({lnd: args.lnd}, cbk);
|
|
135
130
|
}],
|
|
136
131
|
|
|
@@ -153,14 +148,7 @@ module.exports = (args, cbk) => {
|
|
|
153
148
|
}],
|
|
154
149
|
|
|
155
150
|
// Get tags for figuring out avoid flags
|
|
156
|
-
getTags: ['validate', ({}, cbk) => {
|
|
157
|
-
// Exit early when there are no avoids
|
|
158
|
-
if (!args.avoid.length) {
|
|
159
|
-
return cbk();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return getTags({fs: args.fs}, cbk);
|
|
163
|
-
}],
|
|
151
|
+
getTags: ['validate', ({}, cbk) => getTags({fs: args.fs}, cbk)],
|
|
164
152
|
|
|
165
153
|
// Get ignores
|
|
166
154
|
getIgnores: [
|
|
@@ -169,11 +157,6 @@ module.exports = (args, cbk) => {
|
|
|
169
157
|
'getTags',
|
|
170
158
|
({getChannels, getIdentity, getTags}, cbk) =>
|
|
171
159
|
{
|
|
172
|
-
// Exit early when there are no avoids
|
|
173
|
-
if (!args.avoid.length) {
|
|
174
|
-
return cbk(null, {ignore: []});
|
|
175
|
-
}
|
|
176
|
-
|
|
177
160
|
return getIgnores({
|
|
178
161
|
avoid: args.avoid,
|
|
179
162
|
channels: getChannels.channels,
|
package/package.json
CHANGED
|
@@ -27,15 +27,16 @@
|
|
|
27
27
|
"colorette": "2.0.16",
|
|
28
28
|
"crypto-js": "4.1.1",
|
|
29
29
|
"csv-parse": "5.0.3",
|
|
30
|
-
"goldengate": "
|
|
30
|
+
"goldengate": "11.0.0",
|
|
31
|
+
"grammy": "1.5.4",
|
|
31
32
|
"hot-formula-parser": "4.0.0",
|
|
32
33
|
"import-lazy": "4.0.0",
|
|
33
34
|
"ini": "2.0.0",
|
|
34
35
|
"inquirer": "8.2.0",
|
|
35
36
|
"invoices": "2.0.2",
|
|
36
37
|
"ln-accounting": "5.0.5",
|
|
37
|
-
"ln-service": "53.
|
|
38
|
-
"ln-sync": "3.
|
|
38
|
+
"ln-service": "53.2.0",
|
|
39
|
+
"ln-sync": "3.6.0",
|
|
39
40
|
"ln-telegram": "3.4.2",
|
|
40
41
|
"moment": "2.29.1",
|
|
41
42
|
"paid-services": "3.2.0",
|
|
@@ -44,14 +45,12 @@
|
|
|
44
45
|
"qrcode-terminal": "0.12.0",
|
|
45
46
|
"sanitize-filename": "1.6.3",
|
|
46
47
|
"table": "6.7.5",
|
|
47
|
-
"telegraf": "4.4.2",
|
|
48
48
|
"update-notifier": "5.1.0",
|
|
49
49
|
"window-size": "1.1.1"
|
|
50
50
|
},
|
|
51
51
|
"description": "Lightning balance CLI",
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@alexbosworth/tap": "15.0.10",
|
|
54
|
-
"ecpair": "1.0.1",
|
|
55
54
|
"ln-docker-daemons": "2.1.0",
|
|
56
55
|
"mock-lnd": "1.4.1",
|
|
57
56
|
"secp256k1": "4.0.2"
|
|
@@ -76,9 +75,10 @@
|
|
|
76
75
|
},
|
|
77
76
|
"scripts": {
|
|
78
77
|
"build-docker": "docker build -t alexbosworth/balanceofsatoshis . && docker save alexbosworth/balanceofsatoshis > balanceofsatoshis.tar && gzip balanceofsatoshis.tar",
|
|
78
|
+
"integration-tests": "tap --branches=1 --functions=1 --lines=1 --statements=1 -t 120 test/integration/*.js",
|
|
79
79
|
"postpack": "PACKAGE_VERSION=$(cat package.json | grep \\\"version\\\" | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag -s v$PACKAGE_VERSION -m v$PACKAGE_VERSION && git push github --tags",
|
|
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/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.
|
|
83
|
+
"version": "11.16.2"
|
|
84
84
|
}
|
|
@@ -68,6 +68,11 @@ module.exports = (args, cbk) => {
|
|
|
68
68
|
'getNodeFees',
|
|
69
69
|
({getHeight, getNodeFees}, cbk) =>
|
|
70
70
|
{
|
|
71
|
+
// Exit early when there are no rules to evaluate
|
|
72
|
+
if (!args.rules.length) {
|
|
73
|
+
return cbk(null, {});
|
|
74
|
+
}
|
|
75
|
+
|
|
71
76
|
const key = args.partner_public_key;
|
|
72
77
|
|
|
73
78
|
const channelAges = getNodeFees.channels.map(({id}) => {
|
package/peers/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const findTagMatch = require('./find_tag_match');
|
|
2
|
+
const interceptInboundChannels = require('./intercept_inbound_channels');
|
|
2
3
|
const openChannels = require('./open_channels');
|
|
3
|
-
const rejectInboundChannels = require('./reject_inbound_channels');
|
|
4
4
|
|
|
5
|
-
module.exports = {findTagMatch,
|
|
5
|
+
module.exports = {findTagMatch, interceptInboundChannels, openChannels};
|