diff --git a/CHANGELOG.md b/CHANGELOG.md index ae4481cc1..913755651 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ at anytime. * ### Added - * Added `claim_send_tip`, a command to tip the owner of a claim via a support transaction + * Added `wallet_send`, a command to send credits and tips * Added `reflector` keyword parameter to `file_reflect` command * Added configuration options for auto re-reflect * Added option to abandon by txid/nout diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index 68d129ca9..927eb0660 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -1916,29 +1916,6 @@ class Daemon(AuthJSONRPCServer): self.analytics_manager.send_claim_action('new_support') 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=) ( | --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 @defer.inlineCallbacks def jsonrpc_claim_send_to_address(self, claim_id, address, amount=None): @@ -2238,6 +2215,7 @@ class Daemon(AuthJSONRPCServer): d.addCallback(lambda address: self._render_response(address)) return d + @AuthJSONRPCServer.deprecated("wallet_send") @AuthJSONRPCServer.auth_required @defer.inlineCallbacks def jsonrpc_send_amount_to_address(self, amount, address): @@ -2263,6 +2241,45 @@ class Daemon(AuthJSONRPCServer): self.analytics_manager.send_credits_sent() defer.returnValue(True) + @AuthJSONRPCServer.auth_required + @defer.inlineCallbacks + def jsonrpc_wallet_send(self, address=None, claim_id=None, amount=None): + """ + Send credits. If given an address, send credits to it. If given a claim id, 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: + wallet_send ((
| --address=
) | ( | --claim_id=)) + ( | --amount=) + + Return: + If sending to an address: + (bool) true if payment successfully scheduled + + If sending a claim tip: + (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 + } + """ + + if address and claim_id: + raise Exception("Given both an address and a claim id") + elif not address and not claim_id: + raise Exception("Not given an address or a claim id") + if not amount: + raise Exception("Cannot send without an amount") + + if address: + result = yield self.jsonrpc_send_amount_to_address(amount, address) + else: + result = yield self.session.wallet.tip_claim(claim_id, amount) + self.analytics_manager.send_claim_action('new_support') + defer.returnValue(result) + def jsonrpc_block_show(self, blockhash=None, height=None): """ Get contents of a block