Transaction Methods¶
Async methods for working with transactions on the XRP Ledger.
- exception xrpl.asyncio.transaction.XRPLReliableSubmissionException¶
Bases:
xrpl.constants.XRPLException
General XRPL Reliable Submission Exception.
- async xrpl.asyncio.transaction.get_transaction_from_hash(tx_hash: str, client: xrpl.asyncio.clients.client.Client, binary: bool = False, min_ledger: Optional[int] = None, max_ledger: Optional[int] = None) → xrpl.models.response.Response¶
Given a transaction hash, fetch the corresponding transaction from the ledger.
- Parameters
tx_hash – the transaction hash.
client – the network client used to communicate with a rippled node.
binary – If true, return transaction data and metadata as binary serialized to hexadecimal strings. If false, return transaction data and metadata as JSON. The default is false.
min_ledger – Use this with max_ledger to specify a range of up to 1000 ledger indexes, starting with this ledger (inclusive). If the server cannot find the transaction, it confirms whether it was able to search all the ledgers in this range.
max_ledger – Use this with min_ledger to specify a range of up to 1000 ledger indexes, ending with this ledger (inclusive). If the server cannot find the transaction, it confirms whether it was able to search all the ledgers in the requested range.
- Returns
The Response object containing the transaction info.
- Raises
XRPLRequestFailureException – if the transaction fails.
- async xrpl.asyncio.transaction.safe_sign_and_autofill_transaction(transaction: xrpl.models.transactions.transaction.Transaction, wallet: xrpl.wallet.main.Wallet, client: xrpl.asyncio.clients.client.Client, check_fee: bool = True) → xrpl.models.transactions.transaction.Transaction¶
Signs a transaction locally, without trusting external rippled nodes. Autofills relevant fields.
- 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.
- async xrpl.asyncio.transaction.safe_sign_and_submit_transaction(transaction: xrpl.models.transactions.transaction.Transaction, wallet: xrpl.wallet.main.Wallet, client: xrpl.asyncio.clients.client.Client, autofill: bool = True, check_fee: bool = True) → xrpl.models.response.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.
wallet – the wallet with which to sign the transaction.
client – the network client with which to submit 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.safe_sign_transaction(transaction: xrpl.models.transactions.transaction.Transaction, wallet: xrpl.wallet.main.Wallet, check_fee: bool = True) → xrpl.models.transactions.transaction.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.
check_fee – whether to check if the fee is higher than the expected transaction type fee. Defaults to True.
- Returns
The signed transaction blob.
- async xrpl.asyncio.transaction.send_reliable_submission(transaction: xrpl.models.transactions.transaction.Transaction, client: xrpl.asyncio.clients.client.Client) → xrpl.models.response.Response¶
Asynchronously submits a transaction 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 transaction to submit to the ledger. Requires a last_ledger_sequence param.
client – the network client used to submit the transaction to a rippled node.
- Returns
The response from a validated ledger.
- Raises
XRPLReliableSubmissionException – if the transaction fails or is missing a last_ledger_sequence param.
- async xrpl.asyncio.transaction.submit_transaction(transaction: xrpl.models.transactions.transaction.Transaction, client: xrpl.asyncio.clients.client.Client) → xrpl.models.response.Response¶
Submits a transaction to the ledger.
- Parameters
transaction – the Transaction to be submitted.
client – the network client with which to submit the transaction.
- Returns
The response from the ledger.
- Raises
XRPLRequestFailureException – if the rippled API call fails.
- 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.