Skip to content

autonomy.chain.tx

Tx settlement helper.

should_retry

def should_retry(error: str) -> bool

Check an error message to check if we should raise an error or retry the tx

should_reprice

def should_reprice(error: str) -> bool

Check an error message to check if we should reprice the transaction

already_known

def already_known(error: str) -> bool

Check if the transaction is already sent

TxSettler Objects

class TxSettler()

Tx settlement helper

__init__

def __init__(ledger_api: LedgerApi,
             crypto: Crypto,
             chain_type: ChainType,
             tx_builder: Callable[[], Dict],
             timeout: Optional[float] = None,
             retries: Optional[int] = None,
             sleep: Optional[float] = None,
             gas_price_multiplier: Optional[float] = None,
             gas_estimate_multiplier: Optional[float] = None) -> None

Initialize object.

transact

def transact(dry_run: bool = False) -> "TxSettler"

Make a transaction and return a receipt

settle

def settle() -> "TxSettler"

Wait for the tx to be mined.

get_events

def get_events(contract: "Contract",
               event_name: str) -> tuple["EventData", ...]

Get events from the tx receipt.

verify_events

def verify_events(contract: "Contract", event_name: str,
                  expected_event_arg_name: str,
                  expected_event_arg_value: Any) -> "TxSettler"

Verify that an event is in the tx receipt.