index.md and code updated python wfc
@@ -4,37 +4,7 @@ import base64
from algosdk import mnemonic
from algosdk.v2client import algod
from algosdk.future.transaction import PaymentTxn
-
-
-# utility for waiting on a transaction confirmation
-def wait_for_confirmation(client, transaction_id, timeout):
- """
- Wait until the transaction is confirmed or rejected, or until 'timeout'
- number of rounds have passed.
- Args:
- transaction_id (str): the transaction to wait for
- timeout (int): maximum number of rounds to wait
- Returns:
- dict: pending transaction information, or throws an error if the transaction
- is not confirmed or rejected in the next timeout rounds
- """
- start_round = client.status()["last-round"] + 1;
- current_round = start_round
-
- while current_round < start_round + timeout:
- try:
- pending_txn = client.pending_transaction_info(transaction_id)
- except Exception:
- return
- if pending_txn.get("confirmed-round", 0) > 0:
- return pending_txn
- elif pending_txn["pool-error"]:
- raise Exception(
- 'pool error: {}'.format(pending_txn["pool-error"]))
- client.status_after_block(current_round)
- current_round += 1
- raise Exception(
- 'pending tx not found in timeout rounds, timeout value = : {}'.format(timeout))
+from algosdk.future.transaction import wait_for_confirmation
def getting_started_example():
algod_address = "http://localhost:4001"
