forked from LBRYCommunity/lbry-sdk
add wallet_list_unspent
This commit is contained in:
parent
4a9bf58bff
commit
3152ecfd71
3 changed files with 40 additions and 1 deletions
|
@ -26,7 +26,7 @@ at anytime.
|
|||
*
|
||||
|
||||
### Added
|
||||
*
|
||||
* Added `wallet_list_unspent` command
|
||||
*
|
||||
|
||||
### Removed
|
||||
|
|
|
@ -1488,6 +1488,9 @@ class LBRYumWallet(Wallet):
|
|||
def list_addresses(self):
|
||||
return self._run_cmd_as_defer_succeed('listaddresses')
|
||||
|
||||
def list_unspent(self):
|
||||
return self._run_cmd_as_defer_succeed('listunspent')
|
||||
|
||||
def send_claim_to_address(self, claim_id, destination, amount):
|
||||
return self._run_cmd_as_defer_succeed('sendclaimtoaddress', claim_id, destination, amount)
|
||||
|
||||
|
|
|
@ -2404,6 +2404,42 @@ class Daemon(AuthJSONRPCServer):
|
|||
tx['broadcast'] = broadcast
|
||||
defer.returnValue(tx)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def jsonrpc_wallet_list_unspent(self):
|
||||
"""
|
||||
List unspent transaction outputs
|
||||
|
||||
Usage:
|
||||
wallet_prefill_addresses
|
||||
|
||||
Returns:
|
||||
(list) List of UTXOs
|
||||
[
|
||||
{
|
||||
"address": (str) the output address
|
||||
"amount": (float) unspent amount
|
||||
"height": (int) block height
|
||||
"is_claim": (bool) is the tx a claim
|
||||
"is_coinbase": (bool) is the tx a coinbase tx
|
||||
"is_support": (bool) is the tx a support
|
||||
"is_update": (bool) is the tx an update
|
||||
"nout": (int) nout of the output
|
||||
"txid": (str) txid of the output
|
||||
},
|
||||
...
|
||||
]
|
||||
"""
|
||||
|
||||
unspent = yield self.session.wallet.list_unspent()
|
||||
for i, utxo in enumerate(unspent):
|
||||
utxo['txid'] = utxo.pop('prevout_hash')
|
||||
utxo['nout'] = utxo.pop('prevout_n')
|
||||
utxo['amount'] = utxo.pop('value')
|
||||
utxo['is_coinbase'] = utxo.pop('coinbase')
|
||||
unspent[i] = utxo
|
||||
|
||||
defer.returnValue(unspent)
|
||||
|
||||
def jsonrpc_block_show(self, blockhash=None, height=None):
|
||||
"""
|
||||
Get contents of a block
|
||||
|
|
Loading…
Reference in a new issue