tx: helpscreen fixes
This commit is contained in:
parent
856058941c
commit
c449e4d4d9
7 changed files with 46 additions and 26 deletions
|
|
@ -30,14 +30,18 @@ class help_notes:
|
|||
def account_info_desc(self):
|
||||
return 'unspent outputs' if self.proto.base_proto == 'Bitcoin' else 'account info'
|
||||
|
||||
def fee_spec_letters(self, *, use_quotes=False):
|
||||
cu = self.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_letters(self, *, use_quotes=False, proto=None):
|
||||
cu = (proto or self.proto).coin_amt.units
|
||||
pfx, sfx, sep, conj = (('', '', ',', ' or '), ("‘", "’", "’,‘", "’ or ‘"))[use_quotes]
|
||||
return pfx + sep.join(u[0] for u in cu[:-1]) + ('', conj)[len(cu)>1] + cu[-1][0] + sfx
|
||||
|
||||
def fee_spec_names(self):
|
||||
cu = self.proto.coin_amt.units
|
||||
return ', '.join(cu[:-1]) + ('', ' and ')[len(cu)>1] + cu[-1] + ('', ',\nrespectively')[len(cu)>1]
|
||||
def fee_spec_names(self, *, proto=None, linebreak=' '):
|
||||
cu = (proto or self.proto).coin_amt.units
|
||||
return (
|
||||
', '.join(cu[:-1])
|
||||
+ ('', ' and ')[len(cu)>1]
|
||||
+ cu[-1]
|
||||
+ (f',{linebreak}respectively' if len(cu) > 1 else ''))
|
||||
|
||||
def dfl_twname(self):
|
||||
from ..proto.btc.rpc import BitcoinRPCClient
|
||||
|
|
@ -114,19 +118,31 @@ FMT CODES:
|
|||
from ..tx import BaseTX
|
||||
return BaseTX(cfg=self.cfg, proto=self.proto).rel_fee_desc
|
||||
|
||||
def fee(self):
|
||||
def fee(self, all_coins=False):
|
||||
from ..tx import BaseTX
|
||||
return """
|
||||
text = """
|
||||
FEE SPECIFICATION
|
||||
|
||||
Transaction fees, both on the command line and at the 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 = self.proto.coin,
|
||||
r = BaseTX(cfg=self.cfg, proto=self.proto).rel_fee_desc,
|
||||
l = self.fee_spec_letters(use_quotes=True),
|
||||
u = self.fee_spec_names())
|
||||
be specified as either absolute coin amounts, using a plain decimal number, or
|
||||
as {r}, using an integer followed by {l}, for{s}{u}""".format(
|
||||
r = BaseTX(cfg=self.cfg, proto=self.proto).rel_fee_desc,
|
||||
l = self.fee_spec_letters(use_quotes=True),
|
||||
s = '\n' if self.proto.base_coin == 'ETH' else ' ',
|
||||
u = self.fee_spec_names())
|
||||
|
||||
if all_coins:
|
||||
from ..protocol import init_proto
|
||||
eth_proto = init_proto(self.cfg, 'eth', need_amt=True)
|
||||
return text + (
|
||||
' (for\nBitcoin, Litecoin and Bitcoin Cash)'
|
||||
+ ", or {r}, using an integer followed\nby {l}, for {u}".format(
|
||||
r = BaseTX(cfg=self.cfg, proto=eth_proto).rel_fee_desc,
|
||||
l = self.fee_spec_letters(use_quotes=True, proto=eth_proto),
|
||||
u = self.fee_spec_names(proto=eth_proto, linebreak='\n'))
|
||||
+ ' (for Ethereum)')
|
||||
else:
|
||||
return text + '.'
|
||||
|
||||
def passwd(self):
|
||||
return """
|
||||
|
|
|
|||
|
|
@ -68,15 +68,15 @@ does this automatically) and then adjust the fee interactively if desired.
|
|||
|
||||
When choosing a fee, bear in mind that the longer the transaction remains
|
||||
unconfirmed, the greater the risk that the vault address will expire, leading
|
||||
to loss of funds. It’s therefore advisable to learn how to create, sign and
|
||||
to loss of funds. It’s therefore recommended to learn how to create, sign and
|
||||
send replacement transactions with ‘mmgen-txbump’ before performing a swap
|
||||
with this script. When bumping a stuck swap transaction, the safest option
|
||||
is to create a replacement transaction with one output that returns funds back
|
||||
to the originating tracking wallet, thus aborting the swap, rather than one
|
||||
that merely increases the fee (see EXAMPLES below).
|
||||
|
||||
Before broadcasting the transaction, it’s advisable to double-check the vault
|
||||
address on a block explorer such as thorchain.net or runescan.io.
|
||||
Before broadcasting the transaction, it’s a good idea to double-check the
|
||||
vault address on a block explorer such as thorchain.net or runescan.io.
|
||||
|
||||
The MMGen Node Tools suite contains two useful tools to help with fine-tuning
|
||||
transaction fees, ‘mmnode-feeview’ and ‘mmnode-blocks-info’, in addition to
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ def help(proto, cfg):
|
|||
return f"""
|
||||
EXAMPLES:
|
||||
|
||||
Display available swap assets:
|
||||
|
||||
$ {gc.prog_name} -S
|
||||
|
||||
Create a BTC-to-LTC swap transaction, prompting the user for transaction
|
||||
inputs. The full value of the inputs, minus miner fees, will be swapped
|
||||
and sent to an unused address in the user’s LTC tracking wallet:
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ help.txsign: txsign help notes for the MMGen Wallet suite
|
|||
"""
|
||||
|
||||
from ..cfg import gc
|
||||
from ..proto.btc.params import mainnet
|
||||
from ..daemon import CoinDaemon
|
||||
|
||||
def help(proto, cfg):
|
||||
|
|
@ -24,7 +23,7 @@ def help(proto, cfg):
|
|||
return """
|
||||
Transactions may contain both {pnm} or non-{pnm} input addresses.
|
||||
|
||||
To sign non-{pnm} inputs, a {wd}flat key list is used
|
||||
To sign non-{pnm} inputs, a coin daemon wallet dump or flat key list is used
|
||||
as the key source (--keys-from-file option).
|
||||
|
||||
To sign {pnm} inputs, key data is generated from a seed as with the
|
||||
|
|
@ -42,7 +41,6 @@ source. Therefore, seed files or a key-address file for all {pnm} outputs
|
|||
must also be supplied on the command line if the data can’t be found in the
|
||||
default wallet.
|
||||
""".format(
|
||||
wd = f'{coind_exec()} wallet dump or ' if isinstance(proto, mainnet) else '',
|
||||
pnm = gc.proj_name,
|
||||
pnu = proto.name,
|
||||
pnl = gc.proj_name.lower())
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ opts_data = {
|
|||
-- -d, --outdir= d Specify an alternate directory 'd' for output
|
||||
-- -e, --echo-passphrase Print passphrase to screen when typing it
|
||||
-- -f, --fee= f Transaction fee, as a decimal {cu} amount or as
|
||||
+ {fu} (an integer followed by {fl!r}).
|
||||
+ {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)
|
||||
|
|
@ -107,6 +107,7 @@ with the --proxy option. To improve privacy, it’s recommended to proxy
|
|||
requests to the quote server via Tor or some other anonymity network.
|
||||
|
||||
{e}
|
||||
|
||||
{s}
|
||||
Seed source files must have the canonical extensions listed in the 'FileExt'
|
||||
column below:
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ opts_data = {
|
|||
b- -E, --fee-estimate-mode=M Specify the network fee estimate mode. Choices:
|
||||
+ {fe_all}. Default: {fe_dfl!r}
|
||||
-- -f, --fee= f Transaction fee, as a decimal {cu} amount or as
|
||||
+ {fu} (an integer followed by {fl!r}).
|
||||
+ {fu} (an integer followed by {fl}).
|
||||
+ See FEE SPECIFICATION below. If omitted, fee will be
|
||||
+ calculated using network fee estimation.
|
||||
e- -g, --gas= g Specify start gas amount in Wei
|
||||
|
|
@ -80,7 +80,7 @@ opts_data = {
|
|||
-- -y, --yes Answer 'yes' to prompts, suppress non-essential output
|
||||
e- -X, --cached-balances Use cached balances
|
||||
""",
|
||||
'notes': '\n{c}\n{n_at}\n\n{F}\n{x}',
|
||||
'notes': '\n{c}\n{n_at}\n\n{F}\n\n{x}',
|
||||
},
|
||||
'code': {
|
||||
'usage': lambda cfg, proto, help_notes, s: s.format(
|
||||
|
|
@ -97,7 +97,7 @@ opts_data = {
|
|||
x_dfl = cfg._autoset_opts['swap_proto'].choices[0]),
|
||||
'notes': lambda cfg, help_mod, help_notes, s: s.format(
|
||||
c = help_mod(f'{target}create'),
|
||||
F = help_notes('fee'),
|
||||
F = help_notes('fee', all_coins={'tx': False, 'swaptx': True}[target]),
|
||||
n_at = help_notes('address_types'),
|
||||
x = help_mod(f'{target}create_examples'))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ opts_data = {
|
|||
|
||||
{F}
|
||||
|
||||
|
||||
SIGNING NOTES
|
||||
{s}
|
||||
Seed source files must have the canonical extensions listed in the 'FileExt'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue