def run_cmdline(self, config_options): password = config_options.get('password') new_password = config_options.get('new_password') config = SimpleConfig(config_options) config.fee_estimates = self.network.config.fee_estimates.copy() cmdname = config.get('cmd') cmd = known_commands[cmdname] if cmd.requires_wallet: path = config.get_wallet_path() wallet = self.wallets.get(path) if wallet is None: return { 'error': 'Wallet not open. Use "electrum-vtc daemon load_wallet"' } else: wallet = None # arguments passed to function args = map(lambda x: config.get(x), cmd.params) # decode json arguments args = map(json_decode, args) # options args += map( lambda x: (config_options.get(x) if x in ['password', 'new_password'] else config.get(x)), cmd.options) cmd_runner = Commands(config, wallet, self.network) func = getattr(cmd_runner, cmd.name) result = func(*args) return result
def run_cmdline(self, config_options): password = config_options.get('password') new_password = config_options.get('new_password') config = SimpleConfig(config_options) config.fee_estimates = self.network.config.fee_estimates.copy() cmdname = config.get('cmd') cmd = known_commands[cmdname] if cmd.requires_wallet: path = config.get_wallet_path() wallet = self.wallets.get(path) if wallet is None: return {'error': 'Wallet not open. Use "electrum daemon load_wallet"'} else: wallet = None # arguments passed to function args = map(lambda x: config.get(x), cmd.params) # decode json arguments args = map(json_decode, args) # options args += map(lambda x: config.get(x), cmd.options) cmd_runner = Commands(config, wallet, self.network, password=password, new_password=new_password) func = getattr(cmd_runner, cmd.name) result = func(*args) return result