Skip to content

Commit 9c2d1d4

Browse files
committed
Merge branch 'feat/coin_selection' into running_fixes
2 parents 63bd0b6 + b1bd94a commit 9c2d1d4

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

pycardano/coinselection.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,19 +183,21 @@ def _random_select_subset(
183183
@staticmethod
184184
def _split_by_asset(value: Value) -> List[Value]:
185185
# Extract ADA
186-
assets = [Value(value.coin)]
186+
assets = [Value(value.coin)] if value.coin else []
187187

188188
# Extract native assets
189-
for policy_id, policy_id_dict in value.multi_asset.items():
190-
for asset_name, amount in policy_id_dict.items():
189+
for policy_id, d in value.multi_asset.items():
190+
for asset_name, amount in d.items():
191191
if not amount:
192192
# skip 0 amounts
193193
continue
194-
value = Value.from_primitive(
195-
[
196-
0,
197-
{policy_id.payload: {asset_name.payload: amount}},
198-
]
194+
assets.append(
195+
Value.from_primitive(
196+
[
197+
0,
198+
{policy_id.payload: {asset_name.payload: amount}},
199+
]
200+
)
199201
)
200202
assets.append(value)
201203

0 commit comments

Comments
 (0)