add claim_renew

This commit is contained in:
Jack Robison 2017-11-28 11:00:17 -05:00
parent 0cf45657c0
commit d6e3b11026
No known key found for this signature in database
GPG key ID: 284699E7404E3CFF
3 changed files with 47 additions and 0 deletions

View file

@ -30,6 +30,7 @@ at anytime.
### Added
* Added `channel_import` and `channel_export` commands
* Added `is_mine` field to `channel_list` results
* Added `claim_renew` command
### Removed
* Removed claim related filter arguments `name`, `claim_id`, and `outpoint` from `file_list`, `file_delete`, `file_set_status`, and `file_reflect`

View file

@ -1132,6 +1132,12 @@ class Wallet(object):
def _get_values_for_uris(self, page, page_size, *uris):
return defer.fail(NotImplementedError())
def _claim_renew_all_before_expiration(self, height):
return defer.fail(NotImplementedError())
def _claim_renew(self, txid, nout):
return defer.fail(NotImplementedError())
def send_claim_to_address(self, claim_id, destination, amount):
return defer.fail(NotImplementedError())
@ -1512,6 +1518,12 @@ class LBRYumWallet(Wallet):
def get_certificates_for_signing(self):
return self._run_cmd_as_defer_succeed('getcertificatesforsigning')
def _claim_renew_all_before_expiration(self, height):
return self._run_cmd_as_defer_succeed('renewclaimsbeforeexpiration', height)
def _claim_renew(self, txid, nout):
return self._run_cmd_as_defer_succeed('listunspent')
# TODO: get rid of this function. lbryum should take care of it
def _save_wallet(self, val=None):
self.wallet.storage.write()

View file

@ -1993,6 +1993,40 @@ class Daemon(AuthJSONRPCServer):
self.analytics_manager.send_claim_action('new_support')
defer.returnValue(result)
@AuthJSONRPCServer.auth_required
@defer.inlineCallbacks
def jsonrpc_claim_renew(self, outpoint=None, height=None):
"""
Renew claim(s) or support(s)
Usage:
claim_renew (<outpoint> | --outpoint=<outpoint>) | (<height> | --height=<height>)
Return:
(dict) Dictionary containing result of the claim/support renewals
{
'tx' : (str) hex encoded transaction
'txid' : (str) txid of resulting claim
'nout' : (int) nout of the resulting claim
'fee' : (float) fee paid for the claim transaction
'claim_id' : (str) claim ID of the resulting claim
}
"""
if outpoint is None and height is None:
raise Exception("must provide an outpoint or a height")
elif outpoint is not None:
if len(outpoint.split(":")) == 2:
txid, nout = outpoint.split(":")
nout = int(nout)
else:
raise Exception("invalid outpoint")
result = yield self.session.wallet.claim_renew(txid, nout)
else:
height = int(height)
result = yield self.session.wallet.claim_renew_all_before_expiration(height)
defer.returnValue(result)
@AuthJSONRPCServer.auth_required
@defer.inlineCallbacks
def jsonrpc_claim_send_to_address(self, claim_id, address, amount=None):