Transaction Methods

Async methods for working with transactions on the XRP Ledger.

exception xrpl.asyncio.transaction.XRPLReliableSubmissionException

Bases: XRPLException

General XRPL Reliable Submission Exception.

async xrpl.asyncio.transaction.autofill(transaction: Transaction, client: Client, signers_count: int | None = None) Transaction

Autofills fields in a transaction. This will set sequence, fee, and last_ledger_sequence according to the current state of the server this Client is connected to. It also converts all X-Addresses to classic addresses.

Parameters:
  • transaction – the transaction to be signed.

  • client – a network client.

  • signers_count – the expected number of signers for this transaction. Only used for multisigned transactions.

Returns:

The autofilled transaction.

async xrpl.asyncio.transaction.autofill_and_sign(transaction: Transaction, client: Client, wallet: Wallet, check_fee: bool = True) Transaction

Autofills relevant fields. Then, signs a transaction locally, without trusting external rippled nodes.

Parameters:
  • transaction – the transaction to be signed.

  • wallet – the wallet with which to sign the transaction.

  • client – a network client.

  • check_fee – whether to check if the fee is higher than the expected transaction type fee. Defaults to True.

Returns:

The signed transaction.

xrpl.asyncio.transaction.sign(transaction: Transaction, wallet: Wallet, multisign: bool = False) Transaction

Signs a transaction locally, without trusting external rippled nodes.

Parameters:
  • transaction – the transaction to be signed.

  • wallet – the wallet with which to sign the transaction.

  • multisign – whether to sign the transaction for a multisignature transaction.

Returns:

The signed transaction blob.

async xrpl.asyncio.transaction.sign_and_submit(transaction: Transaction, client: Client, wallet: Wallet, autofill: bool = True, check_fee: bool = True) Response

Signs a transaction (locally, without trusting external rippled nodes) and submits it to the XRPL.

Parameters:
  • transaction – the transaction to be signed and submitted.

  • client – the network client with which to submit the transaction.

  • wallet – the wallet with which to sign the transaction.

  • autofill – whether to autofill the relevant fields. Defaults to True.

  • check_fee – whether to check if the fee is higher than the expected transaction type fee. Defaults to True.

Returns:

The response from the ledger.

async xrpl.asyncio.transaction.submit(transaction: Transaction, client: Client, *, fail_hard: bool = False) Response

Submits a transaction to the ledger.

Parameters:
  • transaction – the Transaction to be submitted.

  • client – the network client with which to submit the transaction.

  • fail_hard – an optional boolean. If True, and the transaction fails for the initial server, do not retry or relay the transaction to other servers. Defaults to False.

Returns:

The response from the ledger.

Raises:

XRPLRequestFailureException – if the rippled API call fails.

async xrpl.asyncio.transaction.submit_and_wait(transaction: Transaction | str, client: Client, wallet: Wallet | None = None, *, check_fee: bool = True, autofill: bool = True, fail_hard: bool = False) Response

Signs a transaction locally if the transaction is unsigned, then submits, and verifies that it has been included in a validated ledger (or has errored/ will not be included for some reason). See Reliable Transaction Submission for a full explanation of this workflow

Parameters:
  • transaction – the signed/unsigned transaction (or transaction blob) to be submitted.

  • client – the network client with which to submit the transaction.

  • wallet – an optional wallet with which to sign the transaction. This is only needed if the transaction is unsigned.

  • check_fee – an optional bolean indicating whether to check if the fee is higher than the expected transaction type fee. Defaults to True.

  • autofill – an optional boolean indicating whether to autofill the transaction. Defaults to True.

  • fail_hard – an optional boolean. If True, and the transaction fails for the initial server, do not retry or relay the transaction to other servers. Defaults to False.

Returns:

The response from the ledger.

xrpl.asyncio.transaction.transaction_json_to_binary_codec_form(dictionary: Dict[str, Any]) Dict[str, Any]

Returns a new dictionary in which the keys have been formatted as CamelCase and standardized to be serialized by the binary codec.

Parameters:

dictionary – The dictionary to be reformatted.

Returns:

A new dictionary object that has been reformatted.