Add high-level methods for accounts #34
Labels
3rd month
Planned to be worked on in the third month. Estimate budget: 10,000 $
enhancement
New feature or request
XRPL Grants
This issue is planned to get resoled as part of the XRPL Grants program (within 8 months)
Milestone
does_account_exist -> bool
Queries a ledger and checks if an account exists.
The function simply calls the
get_account_info
function. If theResult
is no error the account exists.&str
WebsocketClient
/AsyncWebsocketClient
Option<&str>
Sources:
https://github.com/XRPLF/xrpl-py/blob/master/xrpl/asyncio/account/main.py#L12
get_next_valid_account_seq_number -> u32
Queries the ledger for an account to its next valid sequence number.
The function simply calls the
get_account_root
function and returns the AccountRoot object'sSequence
field.&str
WebsocketClient
/AsyncWebsocketClient
Option<&str>
Sources:
https://github.com/XRPLF/xrpl-py/blob/master/xrpl/asyncio/account/main.py#L42
get_account_xrp_balance -> Currency
Queries the Ledger for an account's XRP balance.
The function simply calls the
get_account_root
function and returns the AccountRoot object'sBalance
field.Use
drops_to_xrp
to convert the drops amount into a XRP amount.&str
WebsocketClient
/AsyncWebsocketClient
Optional<&str>
Sources:
https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/sugar/balances.ts#L43
https://github.com/XRPLF/xrpl-py/blob/master/xrpl/asyncio/account/main.py#L64
get_account_balances -> Vec<Currency>
Queries the Ledger for all balances (XRP and Token) a given account holds.
The function calls the
get_account_xrp_balance
and theAccountLines
request method and brings the balances in an easy-to-use format.&str
WebsocketClient
/AsyncWebsocketClient
Optional<&str>
Sources:
https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/sugar/balances.ts#L77
get_account_root -> AccountRoot
Queries the ledger for an AccountRoot object of a given address.
The function simply calls the
get_account_info
function and returns the result'saccount_data
field.The return type
AccountRoot
may not be defined yet.&str
WebsocketClient
/AsyncWebsocketClient
Option<&str>
Sources:
https://github.com/XRPLF/xrpl-py/blob/master/xrpl/asyncio/account/main.py#L84
get_account_info -> Response
Queries the ledger for account info of an account's address.
The function calls the
AccountInfo
request method using theWebsocketClient
/AsyncWebsocketClient
.The returning
Response
struct may not have been added yet. Keep a look at Add clients #17, if the tick is already set.The user can choose which ledger he wants to query using the
ledger_index
argument. If noledger_index
is defined (: None
) the default is "validated". If a Ledger Index is defined edit theAccountInfo
request as wished.&str
WebsocketClient
/AsyncWebsocketClient
Option<&str>
Sources:
https://github.com/XRPLF/xrpl-py/blob/master/xrpl/asyncio/account/main.py#L105
https://xrpl.org/account_info.html
get_latest_transaction -> Response
Queries the Ledger for the last transaction a given account has sent.
The function calls the
AccountTx
request method using theWebsocketClient
/AsyncWebsocketClient
.The returning
Response
struct may not have been added yet. Keep a look at Add clients #17, if the tick is already set.To receive an account's latest transaction define request:
&str
WebsocketClient
/AsyncWebsocketClient
Sources:
https://github.com/XRPLF/xrpl-py/blob/master/xrpl/asyncio/account/transaction_history.py#L10
get_account_transactions
Queries the Ledger for transactions sent by a given address.
The function calls the
AccountTx
request method using theWebsocketClient
/AsyncWebsocketClient
.If an account has send too many transactions for the node to send, the node sends as many transactions as it can and includes a
marker
field to tell you to how many Ledgers it looked back. You can define themarker
field inAccountTx
to receive the next batch of transactions.&str
WebsocketClient
/AsyncWebsocketClient
u32
Sources:
https://xrpl.org/markers-and-pagination.html#markers-and-pagination
https://xrpl.org/account_tx.html#account_tx
https://github.com/XRPLF/xrpl-py/blob/master/xrpl/asyncio/account/transaction_history.py#L35
get_account_payment_transactions
Queries the Ledger for transactions sent by a given address with the
TransactionType
Payment
.The function simply calls the
get_account_transactions
function and filters the list of transactions for transactions withTransactionType
Payment
.&str
WebsocketClient
/AsyncWebsocketClient
u32
Sources:
The text was updated successfully, but these errors were encountered: