Transaction Methods

Methods for working with transactions on the XRP Ledger.

exception xrpl.transaction.XRPLReliableSubmissionException

Bases: XRPLException

General XRPL Reliable Submission Exception.

xrpl.transaction.autofill(transaction: Transaction, client: SyncClient, 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.

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

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

Parameters:
  • transaction – the transaction to be signed.

  • client – a network client.

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

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

Returns:

The signed transaction.

xrpl.transaction.multisign(transaction: Transaction, tx_list: List[Transaction]) Transaction

Takes several transactions with Signer fields and creates a single transaction with all Signers that then gets signed and returned.

Parameters:
  • transaction – the transaction to be multisigned.

  • tx_list – a list of signed transactions to combine into a single multisigned transaction.

Returns:

The multisigned transaction.

xrpl.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.

xrpl.transaction.sign_and_submit(transaction: Transaction, client: SyncClient, 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.

xrpl.transaction.submit(transaction: Transaction, client: SyncClient, *, 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.

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

Signs a transaction locally, without trusting external rippled nodes (only if the input transaction is unsigned; otherwise, proceeds to the next steps), 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

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.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.