balanceofsatoshis 13.0.3 → 13.1.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/bos +60 -0
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Versions
2
2
 
3
+ ## 13.1.0
4
+
5
+ - `create-group-channel`: Add method to non-interactively create channel group
6
+ - `join-group-channel`: Add method to non-interactively join channel group
7
+
3
8
  ## 13.0.3
4
9
 
5
10
  - `accounting`: Improve reliability
package/bos CHANGED
@@ -50,6 +50,7 @@ const collect = arr => [].concat(...[arr]).filter(n => !!n);
50
50
  const {exit} = process;
51
51
  const flatten = arr => [].concat(...arr);
52
52
  const {FLOAT} = prog;
53
+ const {floor} = Math;
53
54
  const hexMatch = /^[0-9a-f]+$/i;
54
55
  const {INT} = prog;
55
56
  const {keys} = Object;
@@ -518,6 +519,35 @@ prog
518
519
  });
519
520
  })
520
521
 
522
+ // Coordinate a new group channel
523
+ .command('create-group-channel', 'Coordinate balanced channels group')
524
+ .visible(false)
525
+ .help('Other nodes can join the group using join-group-channel')
526
+ .option('--capacity <channel_capacity>', 'Channel capacity', INT, 5e6)
527
+ .option('--fee-rate <per_vbyte>', 'Chain fee rate for open', INT)
528
+ .option('--node <node_name>', 'Use saved node to create channels group')
529
+ .option('--size <count>', 'Number of group members', INT, 3)
530
+ .action((args, options, logger) => {
531
+ return new Promise(async (resolve, reject) => {
532
+ try {
533
+ const {lnd} = await lndForNode(logger, options.node);
534
+
535
+ const defaultRate = await lnService.getChainFeeRate({lnd});
536
+
537
+ return await paidServices.createGroupChannel({
538
+ lnd,
539
+ logger,
540
+ capacity: options.capacity,
541
+ count: options.size,
542
+ rate: options.feeRate || floor(defaultRate.tokens_per_vbyte),
543
+ },
544
+ responses.returnObject({exit, logger, reject, resolve}));
545
+ } catch (err) {
546
+ return logger.error({err}) && reject();
547
+ }
548
+ });
549
+ })
550
+
521
551
  // Export LND credentials
522
552
  .command('credentials', 'Export local credentials')
523
553
  .help('Output encrypted remote access credentials. Use with "nodes --add"')
@@ -1018,6 +1048,36 @@ prog
1018
1048
  });
1019
1049
  })
1020
1050
 
1051
+ // Join a group channel open
1052
+ .command('join-group-channel', 'Join a balanced channels group')
1053
+ .visible(false)
1054
+ .help('Another node should have run create-group-channel to create group')
1055
+ .argument('<code>', 'Invite code to join group', STRING)
1056
+ .option('--max-fee-rate <per_vbyte>', 'Maximum fee/vbyte for open', INT)
1057
+ .option('--node <node_name>', 'Use saved node to join group')
1058
+ .action((args, options, logger) => {
1059
+ return new Promise(async (resolve, reject) => {
1060
+ try {
1061
+ const {lnd} = await lndForNode(logger, options.node);
1062
+
1063
+ const defaultRate = await lnService.getChainFeeRate({
1064
+ confirmation_target: 2,
1065
+ lnd,
1066
+ });
1067
+
1068
+ return await paidServices.joinGroupChannel({
1069
+ lnd,
1070
+ logger,
1071
+ code: args.code,
1072
+ max_rate: options.maxFeeRate || defaultRate.tokens_per_vbyte,
1073
+ },
1074
+ responses.returnObject({exit, logger, reject, resolve}));
1075
+ } catch (err) {
1076
+ return logger.error({err}) && reject();
1077
+ }
1078
+ });
1079
+ })
1080
+
1021
1081
  // Get the price for liquidity
1022
1082
  .command('liquidity-cost', 'Get the price of liquidity')
1023
1083
  .visible(false)
package/package.json CHANGED
@@ -40,7 +40,7 @@
40
40
  "ln-sync": "3.14.0",
41
41
  "ln-telegram": "3.22.5",
42
42
  "moment": "2.29.4",
43
- "paid-services": "3.21.0",
43
+ "paid-services": "4.0.0",
44
44
  "probing": "2.0.6",
45
45
  "psbt": "2.7.1",
46
46
  "qrcode-terminal": "0.12.0",
@@ -83,5 +83,5 @@
83
83
  "postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis --push .",
84
84
  "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/telegram/*.js test/wallets/*.js"
85
85
  },
86
- "version": "13.0.3"
86
+ "version": "13.1.0"
87
87
  }