From d3cb78428da4d510333803e1bbcbbb87a72138be Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Sat, 9 Nov 2024 12:11:18 -0400 Subject: [PATCH] chore: refactor get_transaction_status (#117) --- eth_portfolio/_ledgers/address.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/eth_portfolio/_ledgers/address.py b/eth_portfolio/_ledgers/address.py index bc92842c..d42510bc 100644 --- a/eth_portfolio/_ledgers/address.py +++ b/eth_portfolio/_ledgers/address.py @@ -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 @@ -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.