mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-08-23 17:27:25 +00:00
added --include_full_tx option to txo_list
This commit is contained in:
parent
6de7a035fa
commit
886d1e8a19
2 changed files with 11 additions and 3 deletions
|
@ -4251,7 +4251,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
@requires(WALLET_COMPONENT)
|
@requires(WALLET_COMPONENT)
|
||||||
async def jsonrpc_txo_spend(
|
async def jsonrpc_txo_spend(
|
||||||
self, account_id=None, wallet_id=None, batch_size=1000,
|
self, account_id=None, wallet_id=None, batch_size=1000,
|
||||||
preview=False, blocking=False, **kwargs):
|
include_full_tx=False, preview=False, blocking=False, **kwargs):
|
||||||
"""
|
"""
|
||||||
Spend transaction outputs, batching into multiple transactions as necessary.
|
Spend transaction outputs, batching into multiple transactions as necessary.
|
||||||
|
|
||||||
|
@ -4280,6 +4280,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
--preview : (bool) do not broadcast the transaction
|
--preview : (bool) do not broadcast the transaction
|
||||||
--blocking : (bool) wait until abandon is in mempool
|
--blocking : (bool) wait until abandon is in mempool
|
||||||
--batch_size=<batch_size> : (int) number of txos to spend per transactions
|
--batch_size=<batch_size> : (int) number of txos to spend per transactions
|
||||||
|
--include_full_tx : (bool) include entire tx in output and not just the txid
|
||||||
|
|
||||||
Returns: {List[Transaction]}
|
Returns: {List[Transaction]}
|
||||||
"""
|
"""
|
||||||
|
@ -4300,7 +4301,9 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
if not preview:
|
if not preview:
|
||||||
for tx in txs:
|
for tx in txs:
|
||||||
await self.broadcast_or_release(tx, blocking)
|
await self.broadcast_or_release(tx, blocking)
|
||||||
|
if include_full_tx:
|
||||||
return txs
|
return txs
|
||||||
|
return [{'txid': tx.id} for tx in txs]
|
||||||
|
|
||||||
@requires(WALLET_COMPONENT)
|
@requires(WALLET_COMPONENT)
|
||||||
def jsonrpc_txo_sum(self, account_id=None, wallet_id=None, **kwargs):
|
def jsonrpc_txo_sum(self, account_id=None, wallet_id=None, **kwargs):
|
||||||
|
|
|
@ -616,7 +616,7 @@ class TransactionOutputCommands(ClaimTestCase):
|
||||||
await self.support_create(stream_id, '0.1')
|
await self.support_create(stream_id, '0.1')
|
||||||
await self.assertBalance(self.account, '7.978478')
|
await self.assertBalance(self.account, '7.978478')
|
||||||
self.assertEqual('1.0', lbc(await self.txo_sum(type='support', unspent=True)))
|
self.assertEqual('1.0', lbc(await self.txo_sum(type='support', unspent=True)))
|
||||||
txs = await self.txo_spend(type='support', batch_size=3)
|
txs = await self.txo_spend(type='support', batch_size=3, include_full_tx=True)
|
||||||
self.assertEqual(4, len(txs))
|
self.assertEqual(4, len(txs))
|
||||||
self.assertEqual(3, len(txs[0]['inputs']))
|
self.assertEqual(3, len(txs[0]['inputs']))
|
||||||
self.assertEqual(3, len(txs[1]['inputs']))
|
self.assertEqual(3, len(txs[1]['inputs']))
|
||||||
|
@ -625,6 +625,11 @@ class TransactionOutputCommands(ClaimTestCase):
|
||||||
self.assertEqual('0.0', lbc(await self.txo_sum(type='support', unspent=True)))
|
self.assertEqual('0.0', lbc(await self.txo_sum(type='support', unspent=True)))
|
||||||
await self.assertBalance(self.account, '8.977606')
|
await self.assertBalance(self.account, '8.977606')
|
||||||
|
|
||||||
|
await self.support_create(stream_id, '0.1')
|
||||||
|
txs = await self.daemon.jsonrpc_txo_spend(type='support', batch_size=3)
|
||||||
|
self.assertEqual(1, len(txs))
|
||||||
|
self.assertEqual({'txid'}, set(txs[0]))
|
||||||
|
|
||||||
|
|
||||||
class ClaimCommands(ClaimTestCase):
|
class ClaimCommands(ClaimTestCase):
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue