mirror of
https://github.com/alexbosworth/balanceofsatoshis.git
synced 2026-08-13 12:33:37 +02:00
add fresh option to chain deposit to make a fresh address
This commit is contained in:
parent
4fba7e5088
commit
9e98a54b42
7 changed files with 378 additions and 1101 deletions
|
|
@ -1,5 +1,9 @@
|
|||
# Versions
|
||||
|
||||
## 15.9.0
|
||||
|
||||
- `chain-deposit`: Add `--fresh` option to generate a brand new chain address
|
||||
|
||||
## 15.8.15
|
||||
|
||||
- `call`: Improve error message to show a suggested public key
|
||||
|
|
|
|||
2
bos
2
bos
|
|
@ -273,6 +273,7 @@ prog
|
|||
.help('--format address types supported: np2wpkh, p2tr, p2wpkh (default)')
|
||||
.argument('[amount]', 'Amount to receive', INT)
|
||||
.option('--format <format>', 'Address type', ['np2wpkh', 'p2tr', 'p2wpkh'])
|
||||
.option('--fresh', 'Create a fresh address')
|
||||
.option('--no-color', 'Mute all colors')
|
||||
.option('--node <node_name>', 'Node to deposit coins to')
|
||||
.action((args, options, logger) => {
|
||||
|
|
@ -280,6 +281,7 @@ prog
|
|||
try {
|
||||
return chain.getDepositAddress({
|
||||
format: options.format || undefined,
|
||||
fresh: options.fresh || undefined,
|
||||
lnd: (await lnd.authenticatedLnd({logger, node: options.node})).lnd,
|
||||
tokens: args.amount,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ const bigTok = tokens => !tokens ? '0' : (tokens / 1e8).toFixed(8);
|
|||
|
||||
{
|
||||
[format]: <Address Format String>
|
||||
[fresh]: <Use Fresh Address Bool>
|
||||
lnd: <Authenticated LND API Object>
|
||||
[tokens]: <Tokens to Receive Number>
|
||||
}
|
||||
|
|
@ -19,7 +20,7 @@ const bigTok = tokens => !tokens ? '0' : (tokens / 1e8).toFixed(8);
|
|||
deposit_qr: <Deposit Address URL QR Code String>
|
||||
}
|
||||
*/
|
||||
module.exports = ({format, lnd, tokens}, cbk) => {
|
||||
module.exports = ({format, fresh, lnd, tokens}, cbk) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return asyncAuto({
|
||||
// Check arguments
|
||||
|
|
@ -33,7 +34,7 @@ module.exports = ({format, lnd, tokens}, cbk) => {
|
|||
|
||||
// Get an address
|
||||
getAddress: ['validate', ({}, cbk) => {
|
||||
return createChainAddress({format, lnd, is_unused: true}, cbk);
|
||||
return createChainAddress({format, lnd, is_unused: !fresh}, cbk);
|
||||
}],
|
||||
|
||||
// Get a QR code for the address URL
|
||||
|
|
|
|||
1449
package-lock.json
generated
1449
package-lock.json
generated
File diff suppressed because it is too large
Load diff
12
package.json
12
package.json
|
|
@ -25,7 +25,7 @@
|
|||
"bolt01": "2.0.0",
|
||||
"bolt03": "1.3.1",
|
||||
"bolt07": "1.8.4",
|
||||
"cbor": "9.0.0",
|
||||
"cbor": "9.0.1",
|
||||
"colorette": "2.0.20",
|
||||
"crypto-js": "4.1.1",
|
||||
"csv-parse": "5.4.0",
|
||||
|
|
@ -35,11 +35,11 @@
|
|||
"hot-formula-parser": "4.0.0",
|
||||
"import-lazy": "4.0.0",
|
||||
"ini": "4.1.1",
|
||||
"inquirer": "9.2.8",
|
||||
"inquirer": "9.2.9",
|
||||
"ln-accounting": "7.0.2",
|
||||
"ln-service": "56.9.0",
|
||||
"ln-service": "56.11.0",
|
||||
"ln-sync": "5.2.3",
|
||||
"ln-telegram": "4.6.1",
|
||||
"ln-telegram": "5.0.0",
|
||||
"moment": "2.29.4",
|
||||
"paid-services": "5.0.4",
|
||||
"probing": "4.0.0",
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
"description": "Lightning balance CLI",
|
||||
"devDependencies": {
|
||||
"invoices": "3.0.0",
|
||||
"ln-docker-daemons": "5.1.1",
|
||||
"ln-docker-daemons": "5.1.2",
|
||||
"mock-lnd": "1.4.4"
|
||||
},
|
||||
"engines": {
|
||||
|
|
@ -82,5 +82,5 @@
|
|||
"postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis -t alexbosworth/balanceofsatoshis:$npm_package_version --push .",
|
||||
"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"
|
||||
},
|
||||
"version": "15.8.15"
|
||||
"version": "15.9.0"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,6 +151,8 @@ module.exports = (args, cbk) => {
|
|||
});
|
||||
|
||||
sub.on('error', err => {
|
||||
sub.removeAllListeners();
|
||||
|
||||
return cbk(err);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
const {deepEqual} = require('node:assert').strict;
|
||||
const {equal} = require('node:assert').strict;
|
||||
const {exit} = require('node:process');
|
||||
const test = require('node:test');
|
||||
|
||||
const asyncAuto = require('async/auto');
|
||||
|
|
@ -39,7 +40,9 @@ const times = 2000;
|
|||
const tokens = 500095;
|
||||
|
||||
// Opening a balanced channel with a peer should open a balanced channel
|
||||
test(`Open balanced channel`, async () => {
|
||||
test(`Open balanced channel`, async t => {
|
||||
t.after(() => exit());
|
||||
|
||||
const {kill, nodes} = await spawnLightningCluster({size});
|
||||
|
||||
const [{generate, lnd}, target] = nodes;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue