move commands list to commands.py
This commit is contained in:
parent
31e265b11d
commit
ea2d8f2491
76
electrum
76
electrum
|
@ -38,82 +38,6 @@ except ImportError:
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
known_commands = {
|
|
||||||
'help':'Prints this help',
|
|
||||||
'validateaddress':'Check that the address is valid',
|
|
||||||
'balance': "Display the balance of your wallet or of an address.\nSyntax: balance [<address>]",
|
|
||||||
'contacts': "Show your list of contacts",
|
|
||||||
'create':'Create a wallet',
|
|
||||||
'restore':'Restore a wallet',
|
|
||||||
'payto':"""Create and broadcast a transaction.
|
|
||||||
Syntax: payto <recipient> <amount> [label]
|
|
||||||
<recipient> can be a bitcoin address or a label
|
|
||||||
options:\n --fee, -f: set transaction fee\n --fromaddr, -s: send from address -\n --changeaddr, -c: send change to address
|
|
||||||
""",
|
|
||||||
'sendrawtransaction':
|
|
||||||
'Broadcasts a transaction to the network. \nSyntax: sendrawtransaction <tx in hexadecimal>',
|
|
||||||
'password':
|
|
||||||
"Changes your password",
|
|
||||||
'addresses':
|
|
||||||
"""Shows your list of addresses.
|
|
||||||
options:
|
|
||||||
-a: show all addresses, including change addresses
|
|
||||||
-k: show private keys
|
|
||||||
-b: show the balance of addresses""",
|
|
||||||
|
|
||||||
'history':"Shows the transaction history",
|
|
||||||
'setlabel':'Assign a label to an item\nSyntax: label <tx_hash> <label>',
|
|
||||||
'mktx':
|
|
||||||
"""Create a signed transaction, password protected.
|
|
||||||
Syntax: mktx <recipient> <amount> [label]
|
|
||||||
options:\n --fee, -f: set transaction fee\n --fromaddr, -s: send from address -\n --changeaddr, -c: send change to address
|
|
||||||
""",
|
|
||||||
'get_seed':
|
|
||||||
"Print the generation seed of your wallet.",
|
|
||||||
'importprivkey':
|
|
||||||
'Import a private key\nSyntax: importprivkey <privatekey>',
|
|
||||||
'signmessage':
|
|
||||||
'Signs a message with a key\nSyntax: signmessage <address> <message>\nIf you want to lead or end a message with spaces, or want double spaces inside the message make sure you quote the string. I.e. " Hello This is a weird String "',
|
|
||||||
'verifymessage':
|
|
||||||
'Verifies a signature\nSyntax: verifymessage <address> <signature> <message>\nIf you want to lead or end a message with spaces, or want double spaces inside the message make sure you quote the string. I.e. " Hello This is a weird String "',
|
|
||||||
'eval':
|
|
||||||
"Run python eval() on an object\nSyntax: eval <expression>\nExample: eval \"wallet.aliases\"",
|
|
||||||
'get':
|
|
||||||
"Get config parameter.",
|
|
||||||
'set':
|
|
||||||
"Set config parameter.",
|
|
||||||
'deseed':
|
|
||||||
"Create a seedless, watching-only wallet.",
|
|
||||||
'freeze':'',
|
|
||||||
'unfreeze':'',
|
|
||||||
'prioritize':'',
|
|
||||||
'unprioritize':'',
|
|
||||||
'dumpprivkey':'similar to bitcoind\'s command',
|
|
||||||
'dumpprivkeys':'dump all private keys',
|
|
||||||
'listunspent':'similar to bitcoind\'s command',
|
|
||||||
'createmultisig':'similar to bitcoind\'s command',
|
|
||||||
'createrawtransaction':'similar to bitcoind\'s command',
|
|
||||||
'decoderawtransaction':'similar to bitcoind\'s command',
|
|
||||||
'signrawtransaction':'similar to bitcoind\'s command',
|
|
||||||
'get_history': 'get history for an address'
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
offline_commands = [ 'password', 'mktx',
|
|
||||||
'setlabel', 'contacts',
|
|
||||||
'help', 'validateaddress',
|
|
||||||
'signmessage', 'verifymessage',
|
|
||||||
'eval', 'set', 'get', 'create', 'addresses',
|
|
||||||
'importprivkey', 'get_seed',
|
|
||||||
'deseed',
|
|
||||||
'freeze','unfreeze',
|
|
||||||
'prioritize','unprioritize',
|
|
||||||
'dumpprivkey','listunspent',
|
|
||||||
'createmultisig', 'createrawtransaction', 'decoderawtransaction', 'signrawtransaction'
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# get password routine
|
# get password routine
|
||||||
|
|
|
@ -10,4 +10,4 @@ import bitcoin
|
||||||
from bitcoin import Transaction, EC_KEY
|
from bitcoin import Transaction, EC_KEY
|
||||||
from mnemonic import mn_encode as mnemonic_encode
|
from mnemonic import mn_encode as mnemonic_encode
|
||||||
from mnemonic import mn_decode as mnemonic_decode
|
from mnemonic import mn_decode as mnemonic_decode
|
||||||
from commands import protected_commands, Commands
|
from commands import protected_commands, known_commands, offline_commands, Commands
|
||||||
|
|
|
@ -22,6 +22,80 @@ from bitcoin import *
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import bitcoin
|
import bitcoin
|
||||||
|
|
||||||
|
known_commands = {
|
||||||
|
'help':'Prints this help',
|
||||||
|
'validateaddress':'Check that the address is valid',
|
||||||
|
'balance': "Display the balance of your wallet or of an address.\nSyntax: balance [<address>]",
|
||||||
|
'contacts': "Show your list of contacts",
|
||||||
|
'create':'Create a wallet',
|
||||||
|
'restore':'Restore a wallet',
|
||||||
|
'payto':"""Create and broadcast a transaction.
|
||||||
|
Syntax: payto <recipient> <amount> [label]
|
||||||
|
<recipient> can be a bitcoin address or a label
|
||||||
|
options:\n --fee, -f: set transaction fee\n --fromaddr, -s: send from address -\n --changeaddr, -c: send change to address
|
||||||
|
""",
|
||||||
|
'sendrawtransaction':
|
||||||
|
'Broadcasts a transaction to the network. \nSyntax: sendrawtransaction <tx in hexadecimal>',
|
||||||
|
'password':
|
||||||
|
"Changes your password",
|
||||||
|
'addresses':
|
||||||
|
"""Shows your list of addresses.
|
||||||
|
options:
|
||||||
|
-a: show all addresses, including change addresses""",
|
||||||
|
|
||||||
|
'history':"Shows the transaction history",
|
||||||
|
'setlabel':'Assign a label to an item\nSyntax: label <tx_hash> <label>',
|
||||||
|
'mktx':
|
||||||
|
"""Create a signed transaction, password protected.
|
||||||
|
Syntax: mktx <recipient> <amount> [label]
|
||||||
|
options:\n --fee, -f: set transaction fee\n --fromaddr, -s: send from address -\n --changeaddr, -c: send change to address
|
||||||
|
""",
|
||||||
|
'get_seed':
|
||||||
|
"Print the generation seed of your wallet.",
|
||||||
|
'importprivkey':
|
||||||
|
'Import a private key\nSyntax: importprivkey <privatekey>',
|
||||||
|
'signmessage':
|
||||||
|
'Signs a message with a key\nSyntax: signmessage <address> <message>\nIf you want to lead or end a message with spaces, or want double spaces inside the message make sure you quote the string. I.e. " Hello This is a weird String "',
|
||||||
|
'verifymessage':
|
||||||
|
'Verifies a signature\nSyntax: verifymessage <address> <signature> <message>\nIf you want to lead or end a message with spaces, or want double spaces inside the message make sure you quote the string. I.e. " Hello This is a weird String "',
|
||||||
|
'eval':
|
||||||
|
"Run python eval() on an object\nSyntax: eval <expression>\nExample: eval \"wallet.aliases\"",
|
||||||
|
'get':
|
||||||
|
"Get config parameter.",
|
||||||
|
'set':
|
||||||
|
"Set config parameter.",
|
||||||
|
'deseed':
|
||||||
|
"Create a seedless, watching-only wallet.",
|
||||||
|
'freeze':'',
|
||||||
|
'unfreeze':'',
|
||||||
|
'prioritize':'',
|
||||||
|
'unprioritize':'',
|
||||||
|
'dumpprivkey':'similar to bitcoind\'s command',
|
||||||
|
'dumpprivkeys':'dump all private keys',
|
||||||
|
'listunspent':'similar to bitcoind\'s command',
|
||||||
|
'createmultisig':'similar to bitcoind\'s command',
|
||||||
|
'createrawtransaction':'similar to bitcoind\'s command',
|
||||||
|
'decoderawtransaction':'similar to bitcoind\'s command',
|
||||||
|
'signrawtransaction':'similar to bitcoind\'s command',
|
||||||
|
'get_history': 'get history for an address'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
offline_commands = [ 'password', 'mktx',
|
||||||
|
'setlabel', 'contacts',
|
||||||
|
'help', 'validateaddress',
|
||||||
|
'signmessage', 'verifymessage',
|
||||||
|
'eval', 'set', 'get', 'create', 'addresses',
|
||||||
|
'importprivkey', 'get_seed',
|
||||||
|
'deseed',
|
||||||
|
'freeze','unfreeze',
|
||||||
|
'prioritize','unprioritize',
|
||||||
|
'dumpprivkey','listunspent',
|
||||||
|
'createmultisig', 'createrawtransaction', 'decoderawtransaction', 'signrawtransaction'
|
||||||
|
]
|
||||||
|
|
||||||
protected_commands = ['payto', 'password', 'mktx', 'get_seed', 'importprivkey','signmessage', 'signrawtransaction', 'dumpprivkey', 'dumpprivkeys' ]
|
protected_commands = ['payto', 'password', 'mktx', 'get_seed', 'importprivkey','signmessage', 'signrawtransaction', 'dumpprivkey', 'dumpprivkeys' ]
|
||||||
|
|
||||||
class Commands:
|
class Commands:
|
||||||
|
|
Loading…
Reference in New Issue