Skip to content

Commit

Permalink
fix duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelsoup42 committed Sep 12, 2023
1 parent a87078d commit 7e31a6a
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,32 +66,33 @@ def _transaction_data(
self,
api: BlockFrostApi,
) -> pd.Series:
result_list = []
transaction_set = set()
for addr in self.own_addresses:
for outer_tx in api.address_transactions(
addr,
to_block=self.to_block,
gather_pages=True,
):
transaction = api.transaction(outer_tx.tx_hash)
transaction.utxos = api.transaction_utxos(outer_tx.tx_hash)
transaction.utxos.nonref_inputs = [
i for i in transaction.utxos.inputs if not i.reference
]
transaction.metadata = api.transaction_metadata(outer_tx.tx_hash)
transaction.redeemers = (
api.transaction_redeemers(outer_tx.tx_hash)
if transaction.redeemer_count
else []
)
transaction.withdrawals = (
api.transaction_withdrawals(outer_tx.tx_hash)
if transaction.withdrawal_count
else []
)
transaction.reward_amount = None
transaction_set.add(outer_tx.tx_hash)
result_list = []
for tx_hash in transaction_set:
transaction = api.transaction(tx_hash)
transaction.utxos = api.transaction_utxos(tx_hash)
transaction.utxos.nonref_inputs = [
i for i in transaction.utxos.inputs if not i.reference
]
transaction.metadata = api.transaction_metadata(tx_hash)
transaction.redeemers = (
api.transaction_redeemers(tx_hash) if transaction.redeemer_count else []
)
transaction.withdrawals = (
api.transaction_withdrawals(tx_hash)
if transaction.withdrawal_count
else []
)
transaction.reward_amount = None

result_list.append(transaction)
result_list.append(transaction)
return pd.Series(
name="Transactions", data=result_list, index=[t.hash for t in result_list]
).sort_index()
Expand Down Expand Up @@ -447,6 +448,5 @@ def make_transaction_frame(self) -> pd.DataFrame:
]
)
frame = frame.join(balance)
# frame.drop_duplicates(inplace=True)
frame.sort_values(by=frame.columns[0], inplace=True)
return frame

0 comments on commit 7e31a6a

Please sign in to comment.