enable getting a new address via the console

This commit is contained in:
Jimmy Kiselak 2015-09-17 10:59:57 -04:00
parent 33b6b85e72
commit 7eb528232e
2 changed files with 20 additions and 1 deletions

View file

@ -178,6 +178,23 @@ class GetWalletBalancesFactory(ControlHandlerFactory):
control_handler_class = GetWalletBalances
class GetNewWalletAddress(ControlHandler):
prompt_description = "Get a new LBRYcrd address"
def __init__(self, wallet):
self.wallet = wallet
def handle_line(self, line):
assert line is None, "Get new LBRYcrd address should not be passed any arguments"
d = self.wallet.get_new_address()
d.addCallback(lambda address: str(address))
return True, d
class GetNewWalletAddressFactory(ControlHandlerFactory):
control_handler_class = GetNewWalletAddress
class ShutDown(ControlHandler):
prompt_description = "Shut down"

View file

@ -29,7 +29,7 @@ from lbrynet.lbrynet_console.ControlHandlers import ShowPublishedSDHashesChooser
from lbrynet.lbrynet_console.ControlHandlers import CreatePlainStreamDescriptorChooserFactory
from lbrynet.lbrynet_console.ControlHandlers import ShowLBRYFileStreamHashChooserFactory, AddStreamFromHashFactory
from lbrynet.lbrynet_console.ControlHandlers import AddStreamFromSDFactory, AddStreamFromLBRYcrdNameFactory
from lbrynet.lbrynet_console.ControlHandlers import ClaimNameFactory
from lbrynet.lbrynet_console.ControlHandlers import ClaimNameFactory, GetNewWalletAddressFactory
from lbrynet.lbrynet_console.ControlHandlers import ShowServerStatusFactory, ModifyServerSettingsFactory
from lbrynet.lbrynet_console.ControlHandlers import ModifyLBRYFileOptionsChooserFactory
from lbrynet.lbrynet_console.ControlHandlers import PeerStatsAndSettingsChooserFactory
@ -307,6 +307,8 @@ class LBRYConsole():
self.session.wallet)),
('General',
ClaimNameFactory(self.session.wallet)),
('General',
GetNewWalletAddressFactory(self.session.wallet))
]
self.add_control_handlers(lbrycrd_handlers)
if self.peer_port is not None: