Skip to content

Commit 3d4eadc

Browse files
authored
Fix return value of wallet_client from get_node_and_wallet_clients (#66)
1 parent 9a99955 commit 3d4eadc

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

cic/cli/main.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
calculate_synthetic_offset,
3333
DEFAULT_HIDDEN_PUZZLE_HASH,
3434
)
35+
from chia.wallet.transaction_record import TransactionRecord
3536

3637
from cic import __version__
3738
from cic.cli.record_types import SingletonRecord, ACHRecord, RekeyRecord
@@ -876,17 +877,20 @@ async def do_command():
876877
print("Cannot find a way to link fee to this transaction. Please specify 0 fee and try again.")
877878
return
878879
else:
879-
spends.append(
880-
(
881-
await wallet_client.create_signed_transaction(
882-
[
883-
{"puzzle_hash": bytes32([0] * 32), "amount": 0}
884-
], # This is dust but the RPC requires it
885-
fee=uint64(fee),
886-
coin_announcements=[fee_announcement],
887-
)
888-
).spend_bundle
880+
txs: List[TransactionRecord] = await wallet_client.create_signed_transactions(
881+
additions=[
882+
{"puzzle_hash": bytes32([0] * 32), "amount": 0}
883+
], # This is dust but the RPC requires it,
884+
fee=uint64(fee),
885+
coin_announcements=[fee_announcement],
886+
min_coin_amount=uint64(0),
887+
max_coin_amount=uint64(2 ** 64 - 1),
889888
)
889+
if len(txs) == 0:
890+
raise ValueError("`create_signed_transaction` returned empty list!")
891+
892+
tx = txs[0]
893+
spends.append(tx.spend_bundle)
890894

891895
result = await node_client.push_tx(SpendBundle.aggregate(spends))
892896
print(result)

tests/cli_clients.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ async def create_signed_transaction(
7474
coin_spends.append(CoinSpend(coin, ACS, Program.to([])))
7575
return TXMock(SpendBundle(coin_spends, G2Element()))
7676

77+
async def create_signed_transactions(
78+
self,
79+
additions: List[Dict],
80+
coins: Optional[List[Coin]] = None,
81+
fee=uint64(0),
82+
coin_announcements: Optional[List[Announcement]] = None,
83+
min_coin_amount: uint64 = 0,
84+
max_coin_amount: uint64 = 0,
85+
) -> [TXMock]:
86+
return [await self.create_signed_transaction(additions, coins, fee, coin_announcements)]
87+
7788
def close(self):
7889
return
7990

0 commit comments

Comments
 (0)