Browse Source

txcreate,txdo,txbump: update help screens

MMGen 6 years ago
parent
commit
f436f7fd97
4 changed files with 52 additions and 30 deletions
  1. 22 12
      mmgen/common.py
  2. 9 6
      mmgen/main_txbump.py
  3. 10 5
      mmgen/main_txcreate.py
  4. 11 7
      mmgen/main_txdo.py

+ 22 - 12
mmgen/common.py

@@ -35,7 +35,17 @@ def set_debug_all():
 
 def help_notes(k):
 	from mmgen.seed import SeedSource
+	from mmgen.tx import MMGenTX
+	def fee_spec_letters(use_quotes=False):
+		cu = g.proto.coin_amt.units
+		sep,conj = ((',',' or '),("','","' or '"))[use_quotes]
+		return sep.join(u[0] for u in cu[:-1]) + ('',conj)[len(cu)>1] + cu[-1][0]
+	def fee_spec_names():
+		cu = g.proto.coin_amt.units
+		return ', '.join(cu[:-1]) + ('',' and ')[len(cu)>1] + cu[-1] + ('',',\nrespectively')[len(cu)>1]
 	return {
+		'rel_fee_desc': MMGenTX().rel_fee_desc,
+		'fee_spec_letters': fee_spec_letters(),
 		'passwd': """
 For passphrases all combinations of whitespace are equal and leading and
 trailing space is ignored.  This permits reading passphrase or brainwallet
@@ -53,11 +63,11 @@ The transaction's outputs are specified on the command line, while its inputs
 are chosen from a list of the user's unpent outputs via an interactive menu.
 
 If the transaction fee is not specified on the command line (see FEE
-SPECIFICATION below), it will be calculated dynamically using {dn}'s
-"estimatefee" function for the default (or user-specified) number of
-confirmations.  If "estimatefee" fails, the user will be prompted for a fee.
+SPECIFICATION below), it will be calculated dynamically using network fee
+estimation for the default (or user-specified) number of confirmations.
+If network fee estimation fails, the user will be prompted for a fee.
 
-Dynamic ("estimatefee") fees will be multiplied by the value of '--tx-fee-adj',
+Network-estimated fees will be multiplied by the value of '--tx-fee-adj',
 if specified.
 
 Ages of transactions are approximate based on an average block discovery
@@ -68,16 +78,16 @@ addresses of the form <seed ID>:<index>.
 
 To send the value of all inputs (minus TX fee) to a single output, specify
 one address with no amount on the command line.
-""".format( g=g,
-			pnm=g.proj_name,
-			dn=g.proto.daemon_name,
-			pnu=g.proto.name.capitalize()),
+""".format(g=g,pnm=g.proj_name,pnu=g.proto.name.capitalize()),
 		'fee': """
 FEE SPECIFICATION: Transaction fees, both on the command line and at the
-interactive prompt, may be specified as either absolute {} amounts, using
-a plain decimal number, or as satoshis per byte, using an integer followed by
-the letter 's'.
-""".format(g.coin),
+interactive prompt, may be specified as either absolute {c} amounts, using
+a plain decimal number, or as {r}, using an integer followed by
+'{l}', for {u}.
+""".format( c=g.coin,
+			r=MMGenTX().rel_fee_desc,
+			l=fee_spec_letters(use_quotes=True),
+			u=fee_spec_names() ),
 		'txsign': u"""
 Transactions may contain both {pnm} or non-{pnm} input addresses.
 

+ 9 - 6
mmgen/main_txbump.py

@@ -35,8 +35,9 @@ opts_data = lambda: {
 -c, --comment-file=  f Source the transaction's comment from file 'f'
 -d, --outdir=        d Specify an alternate directory 'd' for output
 -e, --echo-passphrase  Print passphrase to screen when typing it
--f, --tx-fee=        f Transaction fee, as a decimal {cu} amount or in
-                       satoshis per byte (an integer followed by 's')
+-f, --tx-fee=        f Transaction fee, as a decimal {cu} amount or as
+                       {fu} (an integer followed by {fl}).
+                       See FEE SPECIFICATION below.
 -H, --hidden-incog-input-params=f,o  Read hidden incognito data from file
                       'f' at offset 'o' (comma-separated)
 -i, --in-fmt=        f Input is from wallet format 'f' (see FMT CODES below)
@@ -64,12 +65,14 @@ opts_data = lambda: {
 -v, --verbose          Produce more verbose output
 -y, --yes             Answer 'yes' to prompts, suppress non-essential output
 -z, --show-hash-presets Show information on available hash presets
-""".format(g=g,pnm=g.proj_name,pnl=g.proj_name.lower(),dn=g.proto.daemon_name,
+""",
+	'options_fmt_args': lambda: dict(
+		g=g,pnm=g.proj_name,pnl=g.proj_name.lower(),dn=g.proto.daemon_name,
+		fu=help_notes('rel_fee_desc'),fl=help_notes('fee_spec_letters'),
 		kgs=' '.join(['{}:{}'.format(n,k) for n,k in enumerate(g.key_generators,1)]),
 		kg=g.key_generator,
-		cu=g.coin
-		),
-	'notes': '\n' + help_notes('fee') + help_notes('txsign')
+		cu=g.coin),
+	'notes': lambda: '\n' + help_notes('fee') + help_notes('txsign')
 }
 
 cmd_args = opts.init(opts_data)

+ 10 - 5
mmgen/main_txcreate.py

@@ -35,9 +35,10 @@ opts_data = lambda: {
 -c, --comment-file=f Source the transaction's comment from file 'f'
 -C, --tx-confs=    c Desired number of confirmations (default: {g.tx_confs})
 -d, --outdir=      d Specify an alternate directory 'd' for output
--f, --tx-fee=      f Transaction fee, as a decimal {cu} amount or in satoshis
-                     per byte (an integer followed by 's').  If omitted, fee
-                     will be calculated using {dn}'s 'estimatefee' call
+-f, --tx-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.
 -i, --info           Display unspent outputs and exit
 -L, --locktime=    t Lock time (block height or unix seconds) (default: 0)
 -m, --minconf=     n Minimum number of confirmations required to spend
@@ -47,8 +48,12 @@ opts_data = lambda: {
 -v, --verbose        Produce more verbose output
 -V, --vsize-adj=   f Adjust transaction's estimated vsize by factor 'f'
 -y, --yes            Answer 'yes' to prompts, suppress non-essential output
-""".format(g=g,cu=g.coin,dn=g.proto.daemon_name),
-	'notes': '\n' + help_notes('txcreate') + help_notes('fee')
+""",
+	'options_fmt_args': lambda: dict(
+							g=g,cu=g.coin,
+							fu=help_notes('rel_fee_desc'),
+							fl=help_notes('fee_spec_letters') ),
+	'notes': lambda: '\n' + help_notes('txcreate') + help_notes('fee')
 }
 
 cmd_args = opts.init(opts_data)

+ 11 - 7
mmgen/main_txdo.py

@@ -37,10 +37,10 @@ opts_data = lambda: {
 -C, --tx-confs=      c Desired number of confirmations (default: {g.tx_confs})
 -d, --outdir=        d Specify an alternate directory 'd' for output
 -e, --echo-passphrase  Print passphrase to screen when typing it
--f, --tx-fee=        f Transaction fee, as a decimal {cu} amount or in
-                       satoshis per byte (an integer followed by 's').
-                       If omitted, {dn}'s 'estimatefee' will be used
-                       to calculate the fee.
+-f, --tx-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.
 -H, --hidden-incog-input-params=f,o  Read hidden incognito data from file
                       'f' at offset 'o' (comma-separated)
 -i, --in-fmt=        f Input is from wallet format 'f' (see FMT CODES below)
@@ -67,13 +67,17 @@ opts_data = lambda: {
 -q, --quiet            Suppress warnings; overwrite files without prompting
 -v, --verbose          Produce more verbose output
 -V, --vsize-adj=     f Adjust transaction's estimated vsize by factor 'f'
--y, --yes             Answer 'yes' to prompts, suppress non-essential output
+-y, --yes              Answer 'yes' to prompts, suppress non-essential output
 -z, --show-hash-presets Show information on available hash presets
-""".format(g=g,pnm=g.proj_name,pnl=g.proj_name.lower(),dn=g.proto.daemon_name,
+""",
+	'options_fmt_args': lambda: dict(
+		g=g,pnm=g.proj_name,pnl=g.proj_name.lower(),
 		kgs=' '.join(['{}:{}'.format(n,k) for n,k in enumerate(g.key_generators,1)]),
+		fu=help_notes('rel_fee_desc'),
+		fl=help_notes('fee_spec_letters'),
 		kg=g.key_generator,
 		cu=g.coin),
-	'notes': '\n' + help_notes('txcreate') + help_notes('fee') + help_notes('txsign')
+	'notes': lambda: '\n' + help_notes('txcreate') + help_notes('fee') + help_notes('txsign')
 }
 
 cmd_args = opts.init(opts_data)