add claim_send_tip
This commit is contained in:
parent
dd8db5a6b0
commit
c5fe8b5381
3 changed files with 47 additions and 0 deletions
|
@ -12,6 +12,10 @@ at anytime.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|
||||||
|
### Added
|
||||||
|
* Added `claim_send_tip`, a command to tip the owner of a claim via a support transaction
|
||||||
|
*
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|
|
@ -976,6 +976,15 @@ class Wallet(object):
|
||||||
d.addCallback(lambda claim_out: _parse_support_claim_out(claim_out))
|
d.addCallback(lambda claim_out: _parse_support_claim_out(claim_out))
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def tip_claim(self, claim_id, amount):
|
||||||
|
claim_out = yield self._tip_claim(claim_id, amount)
|
||||||
|
if claim_out:
|
||||||
|
result = self._process_claim_out(claim_out)
|
||||||
|
defer.returnValue(result)
|
||||||
|
else:
|
||||||
|
raise Exception("failed to send tip of %f to claim id %s" % (amount, claim_id))
|
||||||
|
|
||||||
def get_block_info(self, height):
|
def get_block_info(self, height):
|
||||||
d = self._get_blockhash(height)
|
d = self._get_blockhash(height)
|
||||||
return d
|
return d
|
||||||
|
@ -1085,6 +1094,9 @@ class Wallet(object):
|
||||||
def _support_claim(self, name, claim_id, amount):
|
def _support_claim(self, name, claim_id, amount):
|
||||||
return defer.fail(NotImplementedError())
|
return defer.fail(NotImplementedError())
|
||||||
|
|
||||||
|
def _tip_claim(self, claim_id, amount):
|
||||||
|
return defer.fail(NotImplementedError())
|
||||||
|
|
||||||
def _do_send_many(self, payments_to_send):
|
def _do_send_many(self, payments_to_send):
|
||||||
return defer.fail(NotImplementedError())
|
return defer.fail(NotImplementedError())
|
||||||
|
|
||||||
|
@ -1372,6 +1384,14 @@ class LBRYumWallet(Wallet):
|
||||||
claim_out = yield self._broadcast_claim_transaction(tx)
|
claim_out = yield self._broadcast_claim_transaction(tx)
|
||||||
defer.returnValue(claim_out)
|
defer.returnValue(claim_out)
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def _tip_claim(self, claim_id, amount):
|
||||||
|
log.debug("Tip %s %f", claim_id, amount)
|
||||||
|
broadcast = False
|
||||||
|
tx = yield self._run_cmd_as_defer_succeed('sendwithsupport', claim_id, amount, broadcast)
|
||||||
|
claim_out = yield self._broadcast_claim_transaction(tx)
|
||||||
|
defer.returnValue(claim_out)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _broadcast_claim_transaction(self, claim_out):
|
def _broadcast_claim_transaction(self, claim_out):
|
||||||
if 'success' not in claim_out:
|
if 'success' not in claim_out:
|
||||||
|
|
|
@ -1909,6 +1909,29 @@ class Daemon(AuthJSONRPCServer):
|
||||||
self.analytics_manager.send_claim_action('new_support')
|
self.analytics_manager.send_claim_action('new_support')
|
||||||
defer.returnValue(result)
|
defer.returnValue(result)
|
||||||
|
|
||||||
|
@AuthJSONRPCServer.auth_required
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def jsonrpc_claim_send_tip(self, claim_id, amount):
|
||||||
|
"""
|
||||||
|
Send a tip to the owner of a claim specified by uri. A tip is a claim support
|
||||||
|
where the recipient of the support is the claim address for the claim being supported.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
claim_send_tip (<claim_id> | --claim_id=<claim_id>) (<amount> | --amount=<amount>)
|
||||||
|
|
||||||
|
Return:
|
||||||
|
(dict) Dictionary containing the result of the support
|
||||||
|
{
|
||||||
|
txid : (str) txid of resulting support claim
|
||||||
|
nout : (int) nout of the resulting support claim
|
||||||
|
fee : (float) fee paid for the transaction
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
result = yield self.session.wallet.tip_claim(claim_id, amount)
|
||||||
|
self.analytics_manager.send_claim_action('new_support')
|
||||||
|
defer.returnValue(result)
|
||||||
|
|
||||||
@AuthJSONRPCServer.auth_required
|
@AuthJSONRPCServer.auth_required
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def jsonrpc_claim_send_to_address(self, claim_id, address, amount=None):
|
def jsonrpc_claim_send_to_address(self, claim_id, address, amount=None):
|
||||||
|
|
Loading…
Reference in a new issue