txcreate_examples.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/usr/bin/env python3
  2. #
  3. # MMGen Wallet, a terminal-based cryptocurrency wallet
  4. # Copyright (C)2013-2026 The MMGen Project <mmgen@tuta.io>
  5. # Licensed under the GNU General Public License, Version 3:
  6. # https://www.gnu.org/licenses
  7. # Public project repositories:
  8. # https://github.com/mmgen/mmgen-wallet
  9. # https://gitlab.com/mmgen/mmgen-wallet
  10. """
  11. help.txcreate_examples: txcreate and txdo help examples for the MMGen Wallet suite
  12. """
  13. from ..cfg import gc
  14. from . import help_notes
  15. def help(proto, cfg):
  16. mmtype = 'B' if 'B' in proto.mmtypes else proto.mmtypes[0]
  17. from ..tool.coin import tool_cmd
  18. t = tool_cmd(cfg, mmtype=mmtype)
  19. addr = t.privhex2addr('bead' * 16)
  20. sample_addr = addr.views[addr.view_pref]
  21. cmd_base = help_notes.help_notes(proto, cfg).cmd_coin_arg()
  22. action = 'Create' if gc.prog_name == 'mmgen-txcreate' else 'Execute'
  23. match proto.base_proto:
  24. case 'Bitcoin':
  25. return f"""
  26. EXAMPLES:
  27. Send 0.123 {proto.coin} to an external {proto.name} address, returning the change to a
  28. specific MMGen address in the tracking wallet:
  29. $ {cmd_base} {sample_addr},0.123 01ABCDEF:{mmtype}:7
  30. Same as above, but select the change address automatically:
  31. $ {cmd_base} {sample_addr},0.123 01ABCDEF:{mmtype}
  32. Same as above, but select the change address automatically by address type:
  33. $ {cmd_base} {sample_addr},0.123 {mmtype}
  34. Same as above, but reduce verbosity and specify fee of 20 satoshis
  35. per byte:
  36. $ {cmd_base} -q -f 20s {sample_addr},0.123 {mmtype}
  37. Send entire balance of selected inputs minus fee to an external {proto.name}
  38. address:
  39. $ {cmd_base} {sample_addr}
  40. Send entire balance of selected inputs minus fee to first unused wallet
  41. address of specified type:
  42. $ {cmd_base} {mmtype}
  43. """
  44. case 'Monero':
  45. return f"""
  46. EXAMPLES:
  47. Send 0.123 {proto.coin} to an external {proto.name} address:
  48. $ {cmd_base} {sample_addr},0.123
  49. {action} a sweep transaction:
  50. $ {cmd_base}
  51. """
  52. case _:
  53. return f"""
  54. EXAMPLES:
  55. Send 0.123 {proto.coin} to an external {proto.name} address:
  56. $ {cmd_base} {sample_addr},0.123
  57. Send 0.123 {proto.coin} to another account in wallet 01ABCDEF:
  58. $ {cmd_base} 01ABCDEF:{mmtype}:7,0.123
  59. """