Account Methods

Async methods for interacting with XRPL accounts.

async xrpl.asyncio.account.does_account_exist(address: str, client: Client, ledger_index: 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.

async xrpl.asyncio.account.get_account_root(address: str, client: Client, ledger_index: str | int = 'validated') Dict[str, 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.

Raises:

XRPLRequestFailureException – if the rippled API call fails.

async xrpl.asyncio.account.get_balance(address: str, client: Client, ledger_index: 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.

async xrpl.asyncio.account.get_latest_transaction(account: str, client: Client) 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.

async xrpl.asyncio.account.get_next_valid_seq_number(address: str, client: Client, ledger_index: 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.