Merge branch 'wallet_send'
This commit is contained in:
commit
c07230a5f1
3 changed files with 45 additions and 25 deletions
|
@ -13,7 +13,7 @@ at anytime.
|
||||||
*
|
*
|
||||||
|
|
||||||
### Added
|
### 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 `reflector` keyword parameter to `file_reflect` command
|
||||||
* Added configuration options for auto re-reflect
|
* Added configuration options for auto re-reflect
|
||||||
* Added option to abandon by txid/nout
|
* Added option to abandon by txid/nout
|
||||||
|
|
|
@ -1916,29 +1916,6 @@ 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):
|
||||||
|
@ -2238,6 +2215,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
d.addCallback(lambda address: self._render_response(address))
|
d.addCallback(lambda address: self._render_response(address))
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
@AuthJSONRPCServer.deprecated("wallet_send")
|
||||||
@AuthJSONRPCServer.auth_required
|
@AuthJSONRPCServer.auth_required
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def jsonrpc_send_amount_to_address(self, amount, address):
|
def jsonrpc_send_amount_to_address(self, amount, address):
|
||||||
|
@ -2263,6 +2241,45 @@ class Daemon(AuthJSONRPCServer):
|
||||||
self.analytics_manager.send_credits_sent()
|
self.analytics_manager.send_credits_sent()
|
||||||
defer.returnValue(True)
|
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):
|
def jsonrpc_block_show(self, blockhash=None, height=None):
|
||||||
"""
|
"""
|
||||||
Get contents of a block
|
Get contents of a block
|
||||||
|
|
|
@ -340,7 +340,6 @@ class AuthJSONRPCServer(AuthorizedBase):
|
||||||
)
|
)
|
||||||
return server.NOT_DONE_YET
|
return server.NOT_DONE_YET
|
||||||
except DeprecatedAPIMethodError:
|
except DeprecatedAPIMethodError:
|
||||||
log.warning('API function is deprecated %s', function_name)
|
|
||||||
self._render_error(
|
self._render_error(
|
||||||
JSONRPCError(None, JSONRPCError.CODE_METHOD_NOT_FOUND),
|
JSONRPCError(None, JSONRPCError.CODE_METHOD_NOT_FOUND),
|
||||||
request, id_
|
request, id_
|
||||||
|
@ -475,6 +474,10 @@ class AuthJSONRPCServer(AuthorizedBase):
|
||||||
|
|
||||||
def _check_deprecated(self, function_path):
|
def _check_deprecated(self, function_path):
|
||||||
if function_path in self.deprecated_methods:
|
if function_path in self.deprecated_methods:
|
||||||
|
new_command = self.deprecated_methods[function_path]._new_command
|
||||||
|
log.warning('API function \"%s\" is deprecated, please update to use \"%s\"',
|
||||||
|
function_path, new_command)
|
||||||
|
|
||||||
raise DeprecatedAPIMethodError(function_path)
|
raise DeprecatedAPIMethodError(function_path)
|
||||||
|
|
||||||
def _verify_method_is_callable(self, function_path):
|
def _verify_method_is_callable(self, function_path):
|
||||||
|
|
Loading…
Add table
Reference in a new issue