Account Methods¶
Methods for interacting with XRPL accounts.
- xrpl.account.does_account_exist(address: str, client: SyncClient, ledger_index: Union[str, int] = 'validated') bool ¶
Query the ledger for whether the account exists.
- Parameters:
address – the account to query.
client – the network client used to make network calls.
ledger_index – The ledger index to use for the request. Must be an integer ledger value or “current” (the current working version), “closed” (for the closed-and-proposed version), or “validated” (the most recent version validated by consensus). The default is “validated”.
- Returns:
Whether the account exists on the ledger.
- Raises:
XRPLRequestFailureException – if the transaction fails.
- xrpl.account.get_account_info(address: str, client: SyncClient, ledger_index: Union[str, int] = 'validated') Response ¶
Query the ledger for account info of given address.
- Parameters:
address – the account to query.
client – the network client used to make network calls.
ledger_index – The ledger index to use for the request. Must be an integer ledger value or “current” (the current working version), “closed” (for the closed-and-proposed version), or “validated” (the most recent version validated by consensus). The default is “validated”.
- Returns:
The account info for the address.
- Raises:
XRPLRequestFailureException – if the rippled API call fails.
Deprecated since version 1.8.0: Sending an AccountInfo request directly is just as easy to use.
- xrpl.account.get_account_payment_transactions(address: str, client: SyncClient) List[Dict[str, Any]] ¶
Query the ledger for a list of payment transactions that involved a given account. To access more than just the first page of results, use the
AccountTx
request directly then filter for transactions with a “Payment” TransactionType.- Parameters:
address – the account to query.
client – the network client used to make network calls.
- Returns:
The first page of payment transaction history for the address. For the full history, page through the
AccountTx
request directly.
Deprecated since version 1.8.0: Sending an AccountTx request directly and filtering for payments allows you to page through all results and is just as easy to use.
- xrpl.account.get_account_root(address: str, client: SyncClient, ledger_index: Union[str, int] = 'validated') Dict[str, Union[int, str]] ¶
Query the ledger for the AccountRoot object associated with a given address.
- Parameters:
address – the account to query.
client – the network client used to make network calls.
ledger_index – The ledger index to use for the request. Must be an integer ledger value or “current” (the current working version), “closed” (for the closed-and-proposed version), or “validated” (the most recent version validated by consensus). The default is “validated”.
- Returns:
The AccountRoot dictionary for the address.
- xrpl.account.get_account_transactions(address: str, client: SyncClient) List[Dict[str, Any]] ¶
Query the ledger for a list of transactions that involved a given account. To access more than just the first page of results, use the
AccountTx
request directly.- Parameters:
address – the account to query.
client – the network client used to make network calls.
- Returns:
The most recent transaction history for the address. For the full history, page through the
AccountTx
request directly.- Raises:
XRPLRequestFailureException – if the transaction fails.
Deprecated since version 1.6.0: Sending an AccountTx request directly allows you to page through all results and is just as easy to use.
- xrpl.account.get_balance(address: str, client: SyncClient, ledger_index: Union[str, int] = 'validated') int ¶
Query the ledger for the balance of the given account.
- Parameters:
address – the account to query.
client – the network client used to make network calls.
ledger_index – The ledger index to use for the request. Must be an integer ledger value or “current” (the current working version), “closed” (for the closed-and-proposed version), or “validated” (the most recent version validated by consensus). The default is “validated”.
- Returns:
The balance of the address.
- xrpl.account.get_latest_transaction(account: str, client: SyncClient) Response ¶
Fetches the most recent transaction on the ledger associated with an account.
- Parameters:
account – the account to query.
client – the network client used to communicate with a rippled node.
- Returns:
The Response object containing the transaction info.
- Raises:
XRPLRequestFailureException – if the transaction fails.
- xrpl.account.get_next_valid_seq_number(address: str, client: SyncClient, ledger_index: Union[str, int] = 'current') int ¶
Query the ledger for the next available sequence number for an account.
- Parameters:
address – the account to query.
client – the network client used to make network calls.
ledger_index – The ledger index to use for the request. Must be an integer ledger value or “current” (the current working version), “closed” (for the closed-and-proposed version), or “validated” (the most recent version validated by consensus). The default is “current”.
- Returns:
The next valid sequence number for the address.