diff --git a/src/cardano_account_pandas_dumper/__main__.py b/src/cardano_account_pandas_dumper/__main__.py index 9af1d4d..9c0fea0 100644 --- a/src/cardano_account_pandas_dumper/__main__.py +++ b/src/cardano_account_pandas_dumper/__main__.py @@ -198,6 +198,7 @@ def main(): reporter.make_transaction_frame( transactions, detail_level=args.detail_level, + with_rewards=not args.no_rewards, ).replace(np.float64(0), pd.NA).to_csv(args.csv_output, index=False) except OSError as exception: warnings.warn(f"Failed to write CSV file: {exception}") @@ -206,6 +207,7 @@ def main(): reporter.make_transaction_frame( transactions, detail_level=args.detail_level, + with_rewards=not args.no_rewards, text_cleaner=lambda x: ILLEGAL_CHARACTERS_RE.sub( lambda y: "".join( ["\\x0" + hex(ord(y.group(0))).removeprefix("0x")] diff --git a/src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py b/src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py index 16b33a2..a4510f0 100644 --- a/src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py +++ b/src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py @@ -451,10 +451,11 @@ def make_transaction_frame( self, transactions: pd.Series, detail_level: int, - text_cleaner: Callable = lambda x: x, + with_rewards: bool, with_tx_hash: bool = True, with_tx_message: bool = True, with_total: bool = True, + text_cleaner: Callable = lambda x: x, ) -> pd.DataFrame: """Build a transaction spreadsheet.""" @@ -462,6 +463,11 @@ def make_transaction_frame( total: List[Any] = [columns[0].max() + self.TRANSACTION_OFFSET] if with_tx_hash: columns.append(transactions.rename("hash").map(lambda x: x.hash)) + total.append("" if (with_tx_message or with_rewards) else "Total") + if with_rewards: + columns.append( + transactions.rename("reward").map(lambda x: bool(x.reward_amount)) + ) total.append("" if with_tx_message else "Total") if with_tx_message: columns.append(