Skip to content

Commit fb9e798

Browse files
committed
fix(transaction): handle fee parsing for newer CLI output
Updated the fee parsing logic to handle the new CLI output format where the fee is followed by "Lovelace". This ensures compatibility with both the new and old versions of the `build` command.
1 parent daa731f commit fb9e798

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cardano_clusterlib/transaction_group.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,13 +1013,15 @@ def build_tx( # noqa: C901
10131013
*self._clusterlib_obj.magic_args,
10141014
*self._clusterlib_obj.socket_args,
10151015
]
1016-
stdout = self._clusterlib_obj.cli(cli_args).stdout
1016+
stdout = self._clusterlib_obj.cli(cli_args).stdout.strip()
10171017
stdout_dec = stdout.decode("utf-8") if stdout else ""
10181018

1019-
# check for the presence of fee information so compatibility with older versions
1020-
# of the `build` command is preserved
1019+
# Check for the presence of fee information. No fee information was provided in older
1020+
# versions of the `build` command.
10211021
estimated_fee = -1
1022-
if "transaction fee" in stdout_dec:
1022+
if stdout_dec.endswith("Lovelace"):
1023+
estimated_fee = int(stdout_dec.split()[-2])
1024+
elif "transaction fee" in stdout_dec:
10231025
estimated_fee = int(stdout_dec.split()[-1])
10241026

10251027
return structs.TxRawOutput(

0 commit comments

Comments
 (0)