mirror of
https://github.com/alexbosworth/balanceofsatoshis.git
synced 2026-08-13 12:33:37 +02:00
update dependencies
This commit is contained in:
parent
2c4ae98915
commit
7ec2f93f81
13 changed files with 648 additions and 530 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Versions
|
||||
|
||||
## 12.15.1
|
||||
## 12.15.2
|
||||
|
||||
- `telegram`: Fix regression TypeError when setting up new bot api key
|
||||
|
||||
|
|
|
|||
39
bos
39
bos
|
|
@ -13,7 +13,6 @@ const importLazy = require('import-lazy')(require);
|
|||
|
||||
const fetch = importLazy('@alexbosworth/node-fetch');
|
||||
const fiat = importLazy('@alexbosworth/fiat');
|
||||
const inquirer = importLazy('inquirer');
|
||||
const lnService = importLazy('ln-service');
|
||||
const lnSync = importLazy('ln-sync');
|
||||
const paidServices = importLazy('paid-services');
|
||||
|
|
@ -231,7 +230,7 @@ prog
|
|||
try {
|
||||
return commands.callRawApi({
|
||||
logger,
|
||||
ask: (n, cbk) => inquirer.prompt([n]).then(n => cbk(null, n)),
|
||||
ask: await commands.interrogate({}),
|
||||
lnd: (await lndForNode(logger, options.node)).lnd,
|
||||
method: args.method,
|
||||
params: flatten([options.param].filter(n => !!n)),
|
||||
|
|
@ -320,7 +319,7 @@ prog
|
|||
const saved = await nodes.manageSavedNodes({
|
||||
logger,
|
||||
spawn,
|
||||
ask: (n, cbk) => inquirer.prompt([n]).then(res => cbk(res)),
|
||||
ask: await commands.interrogate({}),
|
||||
fs: {
|
||||
writeFile,
|
||||
getDirectoryFiles: readdir,
|
||||
|
|
@ -338,7 +337,7 @@ prog
|
|||
return paidServices.changeChannelCapacity({
|
||||
lnd,
|
||||
logger,
|
||||
ask: (n, cbk) => inquirer.prompt([n]).then(res => cbk(res)),
|
||||
ask: await commands.interrogate({}),
|
||||
nodes: saved.nodes,
|
||||
},
|
||||
responses.returnObject({exit, logger, reject, resolve}));
|
||||
|
|
@ -509,10 +508,10 @@ prog
|
|||
.option('--nospend', 'Credentials do not include spending privileges')
|
||||
.option('--readonly', 'Credentials only include read permissions')
|
||||
.action((args, options, logger) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
return lnd.getCredentials({
|
||||
logger,
|
||||
ask: (n, cbk) => inquirer.prompt([n]).then(res => cbk(res)),
|
||||
ask: await commands.interrogate({}),
|
||||
expire_days: options.days,
|
||||
is_cleartext: options.cleartext,
|
||||
is_nospend: options.nospend,
|
||||
|
|
@ -717,7 +716,7 @@ prog
|
|||
logger,
|
||||
addresses: args.addressAmount.filter((n, i) => !(i % 2)),
|
||||
amounts: args.addressAmount.filter((n, i) => i % 2),
|
||||
ask: (n, cbk) => inquirer.prompt([n]).then(res => cbk(res)),
|
||||
ask: await commands.interrogate({}),
|
||||
fee_tokens_per_vbyte: options.feeRate,
|
||||
is_dry_run: !!options.dryrun,
|
||||
is_selecting_utxos: options.selectUtxos,
|
||||
|
|
@ -1049,7 +1048,7 @@ prog
|
|||
try {
|
||||
return lnurl.manageLnurl({
|
||||
logger,
|
||||
ask: (n, cbk) => inquirer.prompt(n).then(n => cbk(n)),
|
||||
ask: await commands.interrogate({}),
|
||||
avoid: flatten([options.avoid].filter(n => !!n)),
|
||||
function: args.function,
|
||||
lnd: (await lnd.authenticatedLnd({logger, node: options.node})).lnd,
|
||||
|
|
@ -1075,11 +1074,11 @@ prog
|
|||
.option('--remove', 'Remove saved node')
|
||||
.option('--unlock', 'Remove encryption from auth macaroon')
|
||||
.action((args, options, logger) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
return nodes.manageSavedNodes({
|
||||
logger,
|
||||
spawn,
|
||||
ask: (n, cbk) => inquirer.prompt([n]).then(res => cbk(res)),
|
||||
ask: await commands.interrogate({}),
|
||||
fs: {
|
||||
writeFile,
|
||||
getDirectoryFiles: readdir,
|
||||
|
|
@ -1118,7 +1117,7 @@ prog
|
|||
try {
|
||||
return peers.openChannels({
|
||||
logger,
|
||||
ask: (n, cbk) => inquirer.prompt([n]).then(res => cbk(res)),
|
||||
ask: await commands.interrogate({}),
|
||||
capacities: collect(options.amount),
|
||||
cooperative_close_addresses: collect(options.coopCloseAddress),
|
||||
fs: {getFile: readFile},
|
||||
|
|
@ -1154,7 +1153,7 @@ prog
|
|||
logger,
|
||||
address: options.coopCloseAddress || undefined,
|
||||
after: new Date(Date.now() - (1000 * 60 * 60 * 6)).toISOString(),
|
||||
ask: (n, cbk) => inquirer.prompt([n]).then(res => cbk(res)),
|
||||
ask: await commands.interrogate({}),
|
||||
lnd: (await lnd.authenticatedLnd({logger, node: options.node})).lnd,
|
||||
recover: options.recover,
|
||||
},
|
||||
|
|
@ -1176,7 +1175,7 @@ prog
|
|||
try {
|
||||
return paidServices.manageGroupJoin({
|
||||
logger,
|
||||
ask: (n, cbk) => inquirer.prompt([n]).then(res => cbk(res)),
|
||||
ask: await commands.interrogate({}),
|
||||
lnd: (await lnd.authenticatedLnd({logger, node: options.node})).lnd,
|
||||
},
|
||||
responses.returnObject({exit, logger, reject, resolve}));
|
||||
|
|
@ -1491,7 +1490,7 @@ prog
|
|||
lnd,
|
||||
logger,
|
||||
address: options.address,
|
||||
ask: (n, cbk) => inquirer.prompt([n]).then(n => cbk(n)),
|
||||
ask: await commands.interrogate({}),
|
||||
chain_fee_rate: options.feeRate || undefined,
|
||||
filters: flatten([options.filter].filter(n => !!n)),
|
||||
fs: {getFile: readFile},
|
||||
|
|
@ -1668,7 +1667,7 @@ prog
|
|||
try {
|
||||
return paidServices.manageSwap({
|
||||
logger,
|
||||
ask: (n, cbk) => inquirer.prompt([n]).then(res => cbk(res)),
|
||||
ask: await commands.interrogate({}),
|
||||
lnd: (await lnd.authenticatedLnd({logger, node: options.node})).lnd,
|
||||
request: commands.simpleRequest,
|
||||
},
|
||||
|
|
@ -1763,6 +1762,7 @@ prog
|
|||
try {
|
||||
return await telegram.connectToTelegram({
|
||||
logger,
|
||||
ask: await commands.interrogate({}),
|
||||
fs: {
|
||||
writeFile,
|
||||
getFile: readFile,
|
||||
|
|
@ -1795,13 +1795,14 @@ prog
|
|||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const {lnd} = await lndForNode(logger, options.node);
|
||||
const {Separator} = (await import('inquirer')).default;
|
||||
|
||||
return paidServices.manageTrades({
|
||||
lnd,
|
||||
logger,
|
||||
ask: (n, cbk) => inquirer.prompt([n]).then(res => cbk(null, res)),
|
||||
ask: await commands.interrogate({}),
|
||||
request: commands.simpleRequest,
|
||||
separator: () => new inquirer.Separator(),
|
||||
separator: () => new Separator(),
|
||||
},
|
||||
responses.returnObject({exit, logger, reject, resolve}));
|
||||
} catch (err) {
|
||||
|
|
@ -1858,7 +1859,7 @@ prog
|
|||
try {
|
||||
return triggers.manageTriggers({
|
||||
logger,
|
||||
ask: (n, cbk) => inquirer.prompt([n]).then(res => cbk(res)),
|
||||
ask: await commands.interrogate({}),
|
||||
lnd: (await lndForNode(logger, options.node)).lnd,
|
||||
},
|
||||
responses.returnObject({exit, logger, reject, resolve}));
|
||||
|
|
@ -1899,7 +1900,7 @@ prog
|
|||
return await services.usePaidService({
|
||||
lnd,
|
||||
logger,
|
||||
ask: (n, cbk) => inquirer.prompt(n).then(res => cbk(res)),
|
||||
ask: await commands.interrogate({}),
|
||||
fs: {getFile: readFile},
|
||||
network: (await lnSync.getNetwork({lnd})).network,
|
||||
node: args.serverId,
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ module.exports = ({ask, lnd, logger, method, params}, cbk) => {
|
|||
name: 'method',
|
||||
type: 'list',
|
||||
},
|
||||
cbk);
|
||||
({method}) => cbk(null, method));
|
||||
}],
|
||||
|
||||
// Get method arguments
|
||||
|
|
@ -112,7 +112,7 @@ module.exports = ({ask, lnd, logger, method, params}, cbk) => {
|
|||
prefix: `[${named}]`,
|
||||
type: 'confirm',
|
||||
},
|
||||
cbk);
|
||||
res => cbk(null, res));
|
||||
}
|
||||
|
||||
return ask({
|
||||
|
|
@ -158,7 +158,7 @@ module.exports = ({ask, lnd, logger, method, params}, cbk) => {
|
|||
return true;
|
||||
},
|
||||
},
|
||||
cbk);
|
||||
res => cbk(null, res));
|
||||
},
|
||||
cbk);
|
||||
}],
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
const {accountingCategories} = require('./constants');
|
||||
const callRawApi = require('./call_raw_api');
|
||||
const fetchRequest = require('./fetch_request');
|
||||
const interrogate = require('./interrogate');
|
||||
const {marketPairs} = require('./constants');
|
||||
const {peerSortOptions} = require('./constants');
|
||||
const {rateProviders} = require('./constants');
|
||||
|
|
@ -11,6 +12,7 @@ module.exports = {
|
|||
accountingCategories,
|
||||
callRawApi,
|
||||
fetchRequest,
|
||||
interrogate,
|
||||
marketPairs,
|
||||
peerSortOptions,
|
||||
rateProviders,
|
||||
|
|
|
|||
14
commands/interrogate.js
Normal file
14
commands/interrogate.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/** Get ask function
|
||||
|
||||
{}
|
||||
|
||||
@returns
|
||||
<Interrogation Function>
|
||||
*/
|
||||
module.exports = ({}) => {
|
||||
return new Promise(async resolve => {
|
||||
const inquirer = (await import('inquirer')).default;
|
||||
|
||||
return resolve((n, cbk) => inquirer.prompt([n]).then(res => cbk(res)));
|
||||
});
|
||||
};
|
||||
|
|
@ -436,7 +436,10 @@ module.exports = (args, cbk) => {
|
|||
return cbk([503, 'UnexpectedErrorClosingChannel', {err}]);
|
||||
}
|
||||
|
||||
args.logger.info({close_transaction_id: res.transaction_id});
|
||||
args.logger.info({
|
||||
close_transaction_id: res.transaction_id,
|
||||
close_transaction_vout: res.transaction_vout,
|
||||
});
|
||||
|
||||
return cbk();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
const asyncAuto = require('async/auto');
|
||||
const {decodeFirst} = require('cbor');
|
||||
const inquirer = require('inquirer');
|
||||
const {returnResult} = require('asyncjs-util');
|
||||
const sanitize = require('sanitize-filename');
|
||||
|
||||
|
|
|
|||
1076
package-lock.json
generated
1076
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -34,13 +34,13 @@
|
|||
"hot-formula-parser": "4.0.0",
|
||||
"import-lazy": "4.0.0",
|
||||
"ini": "3.0.0",
|
||||
"inquirer": "8.2.4",
|
||||
"inquirer": "9.0.0",
|
||||
"ln-accounting": "5.0.7",
|
||||
"ln-service": "53.17.4",
|
||||
"ln-sync": "3.13.0",
|
||||
"ln-telegram": "3.22.3",
|
||||
"moment": "2.29.4",
|
||||
"paid-services": "3.17.1",
|
||||
"paid-services": "3.17.2",
|
||||
"probing": "2.0.6",
|
||||
"psbt": "2.6.0",
|
||||
"qrcode-terminal": "0.12.0",
|
||||
|
|
@ -83,5 +83,5 @@
|
|||
"postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis --push .",
|
||||
"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"
|
||||
},
|
||||
"version": "12.15.1"
|
||||
"version": "12.15.2"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ const smallUnitsType = 'full';
|
|||
/** Connect nodes to Telegram
|
||||
|
||||
{
|
||||
ask: <Ask Function>
|
||||
fs: {
|
||||
getFile: <Get File Contents Function>
|
||||
getFileStatus: <Get File Status Function>
|
||||
|
|
@ -46,6 +47,10 @@ module.exports = (args, cbk) => {
|
|||
return cbk([400, 'ExpectedLaterVersionOfNodeJsInstalled']);
|
||||
}
|
||||
|
||||
if (!args.ask) {
|
||||
return cbk([400, 'ExpectedAskFunctionToConnectToTelegram']);
|
||||
}
|
||||
|
||||
if (!args.fs) {
|
||||
return cbk([400, 'ExpectedFsToConnectToTelegram']);
|
||||
}
|
||||
|
|
@ -114,6 +119,7 @@ module.exports = (args, cbk) => {
|
|||
|
||||
return asyncForever(cbk => {
|
||||
return runTelegramBot({
|
||||
ask: args.ask,
|
||||
bot: getBot.bot,
|
||||
fs: args.fs,
|
||||
id: Number(args.id),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
const asyncAuto = require('async/auto');
|
||||
const asyncReflect = require('async/reflect');
|
||||
const {Bot} = require('grammy');
|
||||
const inquirer = require('inquirer');
|
||||
const {returnResult} = require('asyncjs-util');
|
||||
|
||||
const getSocksProxy = require('./get_socks_proxy');
|
||||
|
|
@ -31,6 +30,9 @@ const botKeyFile = 'telegram_bot_api_key';
|
|||
module.exports = ({fs, proxy}, cbk) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return asyncAuto({
|
||||
// Import inquirer
|
||||
inquirer: async () => (await import('inquirer')).default,
|
||||
|
||||
// Check arguments
|
||||
validate: cbk => {
|
||||
if (!fs) {
|
||||
|
|
@ -41,7 +43,7 @@ module.exports = ({fs, proxy}, cbk) => {
|
|||
},
|
||||
|
||||
// Ask for an API key
|
||||
apiKey: ['validate', ({}, cbk) => {
|
||||
apiKey: ['inquirer', 'validate', ({inquirer}, cbk) => {
|
||||
return fs.getFile(homePath({file: botKeyFile}).path, (err, res) => {
|
||||
// Exit early when resetting the API key
|
||||
if (!!err || !res || !res.toString() || !!fs.is_reset_state) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ const {isArray} = Array;
|
|||
/** Run the telegram bot for a node or multiple nodes
|
||||
|
||||
{
|
||||
ask: <Ask Function>
|
||||
bot: <Telegram Bot Object>
|
||||
fs: {
|
||||
getFile: <Get File Contents Function>
|
||||
|
|
@ -44,6 +45,10 @@ module.exports = (args, cbk) => {
|
|||
return asyncAuto({
|
||||
// Check arguments
|
||||
validate: cbk => {
|
||||
if (!args.ask) {
|
||||
return cbk([400, 'ExpectedAskFunctionToRunTelegramBot']);
|
||||
}
|
||||
|
||||
if (!args.bot) {
|
||||
return cbk([400, 'ExpectedTelegramBotToRunTelegramBot']);
|
||||
}
|
||||
|
|
@ -85,6 +90,7 @@ module.exports = (args, cbk) => {
|
|||
args.logger.info({connecting_to_telegram: args.nodes});
|
||||
|
||||
return startTelegramBot({
|
||||
ask: args.ask,
|
||||
bot: args.bot,
|
||||
fs: args.fs,
|
||||
id: args.id,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ const {handleStartCommand} = require('ln-telegram');
|
|||
const {handleStopCommand} = require('ln-telegram');
|
||||
const {handleVersionCommand} = require('ln-telegram');
|
||||
const {InputFile} = require('grammy');
|
||||
const inquirer = require('inquirer');
|
||||
const {isMessageReplyAction} = require('ln-telegram');
|
||||
const {notifyOfForwards} = require('ln-telegram');
|
||||
const {postChainTransaction} = require('ln-telegram');
|
||||
|
|
@ -54,7 +53,6 @@ const interaction = require('./interaction');
|
|||
const named = require('./../package').name;
|
||||
const {version} = require('./../package');
|
||||
|
||||
const ask = (n, cbk) => inquirer.prompt(n).then(n => cbk(n));
|
||||
const fileAsDoc = file => new InputFile(file.source, file.filename);
|
||||
const fromName = node => `${node.alias} ${node.public_key.substring(0, 8)}`;
|
||||
const {isArray} = Array;
|
||||
|
|
@ -70,6 +68,7 @@ const sanitize = n => (n || '').replace(/_/g, '\\_').replace(/[*~`]/g, '');
|
|||
/** Start a Telegram bot
|
||||
|
||||
{
|
||||
ask: <Ask Function>
|
||||
bot: <Telegram Bot Object>
|
||||
[id]: <Authorized User Id Number>
|
||||
key: <Telegram API Key String>
|
||||
|
|
@ -96,6 +95,10 @@ module.exports = (args, cbk) => {
|
|||
return asyncAuto({
|
||||
// Check arguments
|
||||
validate: cbk => {
|
||||
if (!args.ask) {
|
||||
return cbk([400, 'ExpectedAskFunctionToStartTelegramBot']);
|
||||
}
|
||||
|
||||
if (!isArray(args.lnds) || !args.lnds.length) {
|
||||
return cbk([400, 'ExpectedLndsToStartTelegramBot']);
|
||||
}
|
||||
|
|
@ -494,7 +497,7 @@ module.exports = (args, cbk) => {
|
|||
return cbk();
|
||||
}
|
||||
|
||||
return ask({
|
||||
return args.ask({
|
||||
message: interaction.user_id_prompt.message,
|
||||
name: 'code',
|
||||
type: 'input',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue