From 9991f79326600d77e12e7bbab74acfd9fa0e1725 Mon Sep 17 00:00:00 2001 From: Jimmy Kiselak Date: Fri, 26 Feb 2016 01:45:52 -0500 Subject: [PATCH] add support for claiming names, abandoning names, and listing claimed names to the LBRYumWallet --- lbrynet/core/LBRYcrdWallet.py | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/lbrynet/core/LBRYcrdWallet.py b/lbrynet/core/LBRYcrdWallet.py index 922246714..8869a319d 100644 --- a/lbrynet/core/LBRYcrdWallet.py +++ b/lbrynet/core/LBRYcrdWallet.py @@ -938,7 +938,9 @@ class LBRYumWallet(LBRYWallet): return d def get_name_claims(self): - return defer.fail(NotImplementedError()) + cmd = known_commands['getnameclaims'] + func = getattr(self.cmd_runner, cmd.name) + return threads.deferToThread(func) def check_first_run(self): return defer.succeed(self.first_run) @@ -949,13 +951,38 @@ class LBRYumWallet(LBRYWallet): return threads.deferToThread(func, txid) def _send_name_claim(self, name, val, amount): - return defer.fail(NotImplementedError()) + def send_claim(address): + cmd = known_commands['claimname'] + func = getattr(self.cmd_runner, cmd.name) + return threads.deferToThread(func, address, amount, name, val) + d = self.get_new_address() + d.addCallback(send_claim) + d.addCallback(self._broadcast_transaction) + return d def _get_decoded_tx(self, raw_tx): - return defer.fail(NotImplementedError()) + tx = Transaction(raw_tx) + decoded_tx = {} + decoded_tx['vout'] = [] + for output in tx.outputs(): + out = {} + out['value'] = output[2] + decoded_tx['vout'].append(out) + return decoded_tx def _send_abandon(self, txid, address, amount): - return defer.fail(NotImplementedError()) + cmd = known_commands['abandonclaim'] + func = getattr(self.cmd_runner, cmd.name) + d = threads.deferToThread(func, txid, address, amount) + d.addCallback(self._broadcast_transaction) + return d + + def _broadcast_transaction(self, raw_tx): + cmd = known_commands['broadcast'] + func = getattr(self.cmd_runner, cmd.name) + d = threads.deferToThread(func, raw_tx) + d.addCallback(self._save_wallet) + return d def _do_send_many(self, payments_to_send): log.warning("Doing send many. payments to send: %s", str(payments_to_send))