From d1596a6e9a3ac9f36ad315f4979054485e8431a1 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 13 Jun 2025 10:23:55 +0000 Subject: [PATCH] cfg, opts: `coin_codes` cleanup and fix Fixes a regression (disabling of the --proxy option for swaps) introduced by the previous batch of commits. --- mmgen/cfg.py | 15 ++++++++------- mmgen/data/version | 2 +- mmgen/main_txcreate.py | 6 +++--- mmgen/main_txdo.py | 6 +++--- mmgen/opts.py | 18 +++++++++--------- 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/mmgen/cfg.py b/mmgen/cfg.py index 0429962e..87357656 100755 --- a/mmgen/cfg.py +++ b/mmgen/cfg.py @@ -52,7 +52,8 @@ class GlobalConstants(Lockable): # core_coins must match CoinProtocol.coins core_coins = ('btc', 'bch', 'ltc', 'eth', 'etc', 'zec', 'xmr', 'rune') - rpc_coins = ('btc', 'bch', 'ltc', 'eth', 'etc', 'xmr') + rpc_coins = ('btc', 'bch', 'ltc', 'eth', 'etc', 'xmr', 'rune') + local_rpc_coins = ('btc', 'bch', 'ltc', 'eth', 'etc', 'xmr') remote_rpc_coins = ('rune',) btc_fork_rpc_coins = ('btc', 'bch', 'ltc') eth_fork_coins = ('eth', 'etc') @@ -62,7 +63,7 @@ class GlobalConstants(Lockable): cmd_caps_data = { 'addrgen': _cc(True, False, True, None, [], 'lmw'), 'addrimport': _cc(True, True, True, None, ['tw'], 'lmw'), - 'autosign': _cc(True, True, False, '-rRb', ['rpc'], 'lm'), + 'autosign': _cc(True, True, False, '-bRrXx', ['rpc'], 'lm'), 'cli': _cc(True, True, True, None, ['tw'], 'lmw'), 'keygen': _cc(True, False, True, None, [], 'lmw'), 'msg': _cc(True, True, True, None, ['msg'], 'lmw'), @@ -72,18 +73,18 @@ class GlobalConstants(Lockable): 'seedjoin': _cc(False, False, False, None, [], 'lmw'), 'seedsplit': _cc(False, False, False, None, [], 'lmw'), 'subwalletgen': _cc(False, False, False, None, [], 'lmw'), - 'swaptxcreate': _cc(True, True, False, '-rRb', ['tw'], 'lmw'), - 'swaptxdo': _cc(True, True, False, '-rRb', ['tw'], 'lmw'), + 'swaptxcreate': _cc(True, True, False, '-bRrx', ['tw'], 'lmw'), + 'swaptxdo': _cc(True, True, False, '-bRrx', ['tw'], 'lmw'), 'tool': _cc(True, True, True, None, [], 'lmw'), 'txbump': _cc(True, True, True, None, ['tw'], 'lmw'), 'txcreate': _cc(True, True, True, None, ['tw'], 'lmw'), 'txdo': _cc(True, True, True, None, ['tw'], 'lmw'), - 'txsend': _cc(True, True, False, '-rRb', ['tw'], 'lmw'), - 'txsign': _cc(True, True, False, '-rRb', ['tw'], 'lmw'), + 'txsend': _cc(True, True, False, '-bRrXx', ['tw'], 'lmw'), + 'txsign': _cc(True, True, False, '-bRrXx', ['tw'], 'lmw'), 'walletchk': _cc(False, False, False, None, [], 'lmw'), 'walletconv': _cc(False, False, False, None, [], 'lmw'), 'walletgen': _cc(False, False, False, None, [], 'lmw'), - 'xmrwallet': _cc(True, True, False, '-r', ['rpc'], 'lmw'), + 'xmrwallet': _cc(True, True, False, '-rx', ['rpc'], 'lmw'), } prog_name = os.path.basename(sys.argv[0]) diff --git a/mmgen/data/version b/mmgen/data/version index 1e1569b0..5f49b911 100644 --- a/mmgen/data/version +++ b/mmgen/data/version @@ -1 +1 @@ -15.1.dev44 +15.1.dev45 diff --git a/mmgen/main_txcreate.py b/mmgen/main_txcreate.py index 5123a665..976e40c3 100755 --- a/mmgen/main_txcreate.py +++ b/mmgen/main_txcreate.py @@ -44,7 +44,7 @@ opts_data = { -- -a, --autosign Create a transaction for offline autosigning (see + ‘mmgen-autosign’). The removable device is mounted and + unmounted automatically - L- -A, --fee-adjust= f Adjust transaction fee by factor ‘f’ (see below) + r- -A, --fee-adjust= f Adjust transaction fee by factor ‘f’ (see below) -- -B, --no-blank Don't blank screen before displaying {a_info} -- -c, --comment-file=f Source the transaction's comment from file 'f' b- -C, --fee-estimate-confs=c Desired number of confirmations for fee estimation @@ -53,7 +53,7 @@ opts_data = { e- -D, --contract-data=D Path to file containing hex-encoded contract data b- -E, --fee-estimate-mode=M Specify the network fee estimate mode. Choices: + {fe_all}. Default: {fe_dfl!r} - L- -f, --fee= f Transaction fee, as a decimal {cu} amount or as + r- -f, --fee= f Transaction fee, as a decimal {cu} amount or as + {fu} (an integer followed by {fl}). + See FEE SPECIFICATION below. If omitted, fee will be + calculated using network fee estimation. @@ -81,7 +81,7 @@ opts_data = { -s -S, --list-assets List available swap assets -- -v, --verbose Produce more verbose output b- -V, --vsize-adj= f Adjust transaction's estimated vsize by factor 'f' - Ls -x, --proxy=P Fetch the swap quote via SOCKS5h proxy ‘P’ (host:port). + rs -x, --proxy=P Fetch the swap quote via SOCKS5h proxy ‘P’ (host:port). + Use special value ‘env’ to honor *_PROXY environment + vars instead. X- -x, --proxy=P Connect to remote server(s) via SOCKS5h proxy ‘P’ diff --git a/mmgen/main_txdo.py b/mmgen/main_txdo.py index 4fc22a8a..629e146f 100755 --- a/mmgen/main_txdo.py +++ b/mmgen/main_txdo.py @@ -41,7 +41,7 @@ opts_data = { 'options': """ -- -h, --help Print this help message -- --, --longhelp Print help message for long (global) options - L- -A, --fee-adjust= f Adjust transaction fee by factor ‘f’ (see below) + r- -A, --fee-adjust= f Adjust transaction fee by factor ‘f’ (see below) -- -b, --brain-params=l,p Use seed length 'l' and hash preset 'p' for + brainwallet input -- -B, --no-blank Don't blank screen before displaying {a_info} @@ -53,7 +53,7 @@ opts_data = { -- -e, --echo-passphrase Print passphrase to screen when typing it b- -E, --fee-estimate-mode=M Specify the network fee estimate mode. Choices: + {fe_all}. Default: {fe_dfl!r} - L- -f, --fee= f Transaction fee, as a decimal {cu} amount or as + r- -f, --fee= f Transaction fee, as a decimal {cu} amount or as + {fu} (an integer followed by {fl}). + See FEE SPECIFICATION below. If omitted, fee will be + calculated using network fee estimation. @@ -107,7 +107,7 @@ opts_data = { -- -v, --verbose Produce more verbose output b- -V, --vsize-adj= f Adjust transaction's estimated vsize by factor 'f' e- -w, --wait Wait for transaction confirmation - Ls -x, --proxy=P Fetch the swap quote via SOCKS5h proxy ‘P’ (host:port). + rs -x, --proxy=P Fetch the swap quote via SOCKS5h proxy ‘P’ (host:port). + Use special value ‘env’ to honor *_PROXY environment + vars instead. X- -x, --proxy=P Connect to remote server(s) via SOCKS5h proxy ‘P’ diff --git a/mmgen/opts.py b/mmgen/opts.py index 0fa1e5f7..a8116566 100755 --- a/mmgen/opts.py +++ b/mmgen/opts.py @@ -301,7 +301,7 @@ class UserOpts(Opts): Rr --daemon-id=ID Specify the coin daemon ID rr --ignore-daemon-version Ignore coin daemon version check Rr --list-daemon-ids List all available daemon IDs - -r --http-timeout=t Set HTTP timeout in seconds for JSON-RPC connections + xr --http-timeout=t Set HTTP timeout in seconds for JSON-RPC connections -- --no-license Suppress the GPL license prompt Rr --rpc-host=HOST Communicate with coin daemon running on host HOST rr --rpc-port=PORT Communicate with coin daemon listening on port PORT @@ -356,11 +356,11 @@ class UserOpts(Opts): 'b' - Bitcoin or Bitcoin code fork supporting RPC 'R' - Bitcoin or Ethereum code fork supporting RPC 'e' - Ethereum or Ethereum code fork - 'r' - coin supporting RPC 'h' - Bitcoin Cash - 'L' - local RPC coin + 'r' - local RPC coin 'X' - remote RPC coin - '-' - other coin + 'x' - local or remote RPC coin + '-' - any coin Cmd codes: 'p' - proto required 'c' - proto required, --coin recognized @@ -374,11 +374,11 @@ class UserOpts(Opts): return ret( coin = caps.coin_codes or ( None if coin is None else - ['-', 'r', 'R', 'b', 'h', 'L'] if coin == 'bch' else - ['-', 'r', 'R', 'b', 'L'] if coin in gc.btc_fork_rpc_coins else - ['-', 'r', 'R', 'e', 'L'] if coin in gc.eth_fork_coins else - ['-', 'r', 'L'] if coin in gc.rpc_coins else - ['-', 'X'] if coin in gc.remote_rpc_coins else + ['-', 'r', 'R', 'b', 'h', 'x'] if coin == 'bch' else + ['-', 'r', 'R', 'b', 'x'] if coin in gc.btc_fork_rpc_coins else + ['-', 'r', 'R', 'e', 'x'] if coin in gc.eth_fork_coins else + ['-', 'r', 'x'] if coin in gc.local_rpc_coins else + ['-', 'X', 'x'] if coin in gc.remote_rpc_coins else ['-']), cmd = ( ['-']