fix send_amount_to_address backwards compatibility

This commit is contained in:
Jack Robison 2017-08-15 11:36:03 -04:00
parent 46c5a98752
commit 4b716bbcdd
No known key found for this signature in database
GPG key ID: 284699E7404E3CFF
2 changed files with 8 additions and 6 deletions

View file

@ -29,7 +29,7 @@ at anytime.
### Deprecated ### Deprecated
* The API will no longer be served at the /lbryapi path. It will now be at the root. * The API will no longer be served at the /lbryapi path. It will now be at the root.
* * Deprecated `send_amount_to_address` in favor of `wallet_send`
### Changed ### Changed
* Renamed `reflect` command to `file_reflect` * Renamed `reflect` command to `file_reflect`

View file

@ -2243,15 +2243,15 @@ class Daemon(AuthJSONRPCServer):
@AuthJSONRPCServer.auth_required @AuthJSONRPCServer.auth_required
@defer.inlineCallbacks @defer.inlineCallbacks
def jsonrpc_wallet_send(self, address=None, claim_id=None, amount=None): def jsonrpc_wallet_send(self, amount, address=None, claim_id=None):
""" """
Send credits. If given an address, send credits to it. If given a claim id, send a tip 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 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. of the support is the claim address for the claim being supported.
Usage: Usage:
wallet_send ((<address> | --address=<address>) | (<claim_id> | --claim_id=<claim_id>)) wallet_send (<amount> | --amount=<amount>)
(<amount> | --amount=<amount>) ((<address> | --address=<address>) | (<claim_id> | --claim_id=<claim_id>))
Return: Return:
If sending to an address: If sending to an address:
@ -2270,8 +2270,10 @@ class Daemon(AuthJSONRPCServer):
raise Exception("Given both an address and a claim id") raise Exception("Given both an address and a claim id")
elif not address and not claim_id: elif not address and not claim_id:
raise Exception("Not given an address or a claim id") raise Exception("Not given an address or a claim id")
if not amount: if amount < 0:
raise Exception("Cannot send without an amount") raise NegativeFundsError()
elif not amount:
raise NullFundsError()
if address: if address:
result = yield self.jsonrpc_send_amount_to_address(amount, address) result = yield self.jsonrpc_send_amount_to_address(amount, address)