add wallet_send

This commit is contained in:
Jack Robison 2017-08-15 11:11:38 -04:00
parent 690ef15ba1
commit ac4d905a7e
No known key found for this signature in database
GPG key ID: 284699E7404E3CFF
2 changed files with 41 additions and 24 deletions

View file

@ -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

View file

@ -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> | --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
@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> | --address=<address>) | (<claim_id> | --claim_id=<claim_id>))
(<amount> | --amount=<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