Skip to content

Commit f65bdd5

Browse files
流戈davidiw
authored andcommitted
update fund_account response to return the txn hash
1 parent d34a13a commit f65bdd5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

aptos_sdk/async_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,15 +962,19 @@ def __init__(
962962
async def close(self):
963963
await self.rest_client.close()
964964

965-
async def fund_account(self, address: AccountAddress, amount: int):
965+
async def fund_account(
966+
self, address: AccountAddress, amount: int, wait_for_transaction=True
967+
):
966968
"""This creates an account if it does not exist and mints the specified amount of
967969
coins into that account."""
968970
request = f"{self.base_url}/mint?amount={amount}&address={address}"
969971
response = await self.rest_client.client.post(request, headers=self.headers)
970972
if response.status_code >= 400:
971973
raise ApiError(response.text, response.status_code)
972-
for txn_hash in response.json():
974+
txn_hash = response.json()[0]
975+
if wait_for_transaction:
973976
await self.rest_client.wait_for_transaction(txn_hash)
977+
return txn_hash
974978

975979
async def healthy(self) -> bool:
976980
response = await self.rest_client.client.get(self.base_url)

0 commit comments

Comments
 (0)