File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change 11# Copyright © Aptos Foundation
22# SPDX-License-Identifier: Apache-2.0
33
4- import asyncio
54import logging
65import time
76from typing import Any , Dict , List , Optional
@@ -573,16 +572,14 @@ async def wait_for_transaction(self, txn_hash: str) -> None:
573572 Waits up to the duration specified in client_config for a transaction to move past pending
574573 state.
575574 """
576-
577- count = 0
578- while await self .transaction_pending (txn_hash ):
579- assert (
580- count < self .client_config .transaction_wait_in_seconds
581- ), f"transaction { txn_hash } timed out"
582- await asyncio .sleep (1 )
583- count += 1
584-
585- response = await self ._get (endpoint = f"transactions/by_hash/{ txn_hash } " )
575+ while True :
576+ response = await self ._get (endpoint = f"transactions/wait_by_hash/{ txn_hash } " )
577+ if response .status_code == 404 :
578+ continue
579+ if response .status_code >= 400 :
580+ raise ApiError (response .text , response .status_code )
581+ if response .json ()["type" ] != "pending_transaction" :
582+ break
586583 assert (
587584 "success" in response .json () and response .json ()["success" ]
588585 ), f"{ response .text } - { txn_hash } "
You can’t perform that action at this time.
0 commit comments