Skip to content

Commit

Permalink
chore: refactor get_transaction_status (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Nov 9, 2024
1 parent 6a69143 commit d3cb784
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion eth_portfolio/_ledgers/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,21 @@ class InternalTransfersList(PandableList[InternalTransfer]):
eth_retry.auto_retry(dank_mids.eth.trace_filter)
)

get_transaction_status = alru_cache(maxsize=None)(dank_mids.eth.get_transaction_status)

@alru_cache(maxsize=None)
async def get_transaction_status(txhash: str) -> Status:
"""
Retrieves the status for a transaction.
This function is cached to disk to reduce resource usage.
Args:
txhash: The hash of the transaction.
Returns:
The status of the transaction.
"""
return await dank_mids.eth.get_transaction_status(txhash)


@cache_to_disk
Expand All @@ -437,6 +451,8 @@ async def get_traces(filter_params: TraceFilterParams) -> List[FilterTrace]:
"""
Retrieves traces from the web3 provider using the given parameters.
This function is cached to disk to reduce resource usage.
Args:
filter_params: The parameters for the trace filter.
Expand Down

0 comments on commit d3cb784

Please sign in to comment.