Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add high-level methods for accounts #34

Open
9 tasks
LimpidCrypto opened this issue Sep 2, 2022 · 0 comments
Open
9 tasks

Add high-level methods for accounts #34

LimpidCrypto opened this issue Sep 2, 2022 · 0 comments
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)

Comments

@LimpidCrypto
Copy link
Collaborator

  • does_account_exist -> bool
  1. Queries a ledger and checks if an account exists.

  2. The function simply calls the get_account_info function. If the Result is no error the account exists.

fields type explanation
account &str An accounts classic address.
client WebsocketClient/AsyncWebsocketClient A websocket client object.
ledger_index Option<&str> A ledger index. Must be one of "validated", "current", "closed", or an integer as str.

Sources:

  1. Queries the ledger for an account to its next valid sequence number.

  2. The function simply calls the get_account_root function and returns the AccountRoot object's Sequence field.

fields type explanation
account &str An accounts classic address.
client WebsocketClient/AsyncWebsocketClient A websocket client object.
ledger_index Option<&str> A ledger index. Must be one of: "validated", "current", "closed", integer as str

Sources:

  1. Queries the Ledger for an account's XRP balance.

  2. The function simply calls the get_account_root function and returns the AccountRoot object's Balance field.

  3. Use drops_to_xrp to convert the drops amount into a XRP amount.

fields type explanation
account &str An accounts classic address.
client WebsocketClient/AsyncWebsocketClient A websocket client object.
ledger_index Optional<&str> A ledger index. Must be one of: "validated", "current", "closed", integer as str

Sources:

  1. Queries the Ledger for all balances (XRP and Token) a given account holds.

  2. The function calls the get_account_xrp_balance and the AccountLines request method and brings the balances in an easy-to-use format.

fields type explanation
account &str An accounts classic address.
client WebsocketClient/AsyncWebsocketClient A websocket client object.
ledger_index Optional<&str> A ledger index. Must be one of: "validated", "current", "closed", integer as str

Sources:

  1. Queries the ledger for an AccountRoot object of a given address.

  2. The function simply calls the get_account_info function and returns the result's account_data field.

  3. The return type AccountRoot may not be defined yet.

fields type explanation
account &str An accounts classic address.
client WebsocketClient/AsyncWebsocketClient A websocket client object.
ledger_index Option<&str> A ledger index. Must be one of: "validated", "current", "closed", integer as str

Sources:

  1. Queries the ledger for account info of an account's address.

  2. The function calls the AccountInfo request method using the WebsocketClient/AsyncWebsocketClient.

  3. 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 no ledger_index is defined (: None) the default is "validated". If a Ledger Index is defined edit the AccountInfo request as wished.

fields type explanation
account &str An accounts classic address.
client WebsocketClient/AsyncWebsocketClient A websocket client object.
ledger_index Option<&str> A ledger index. Must be one of: "validated", "current", "closed", integer as str

Sources:

  1. Queries the Ledger for the last transaction a given account has sent.

  2. The function calls the AccountTx request method using the WebsocketClient/AsyncWebsocketClient.

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

AccountTx {
command: RequestMethod::AccountTx, // maybe obsolete; check if `<https://github.com/sephynox/xrpl-rust/issues/19)>` is closed.
account: account,
id: None,
ledger_hash: None,
ledger_index: None,
binary: None,
forward: None,
ledger_index_min: None,
ledger_index_max: -1,
limit: 1,
marker: None
}
fields type explanation
account &str An accounts classic address.
client WebsocketClient/AsyncWebsocketClient A websocket client object.

Sources:

  1. Queries the Ledger for transactions sent by a given address.

  2. The function calls the AccountTx request method using the WebsocketClient/AsyncWebsocketClient.

  3. 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 the marker field in AccountTx to receive the next batch of transactions.

fields type explanation
account &str An accounts classic address.
client WebsocketClient/AsyncWebsocketClient A websocket client object.
marker u32 The Marker to request the next batch of transactions.

Sources:

  1. Queries the Ledger for transactions sent by a given address with the TransactionType Payment.

  2. The function simply calls the get_account_transactions function and filters the list of transactions for transactions with TransactionType Payment.

fields type explanation
account &str An accounts classic address.
client WebsocketClient/AsyncWebsocketClient A websocket client object.
marker u32 The Marker to request the next batch of transactions.

Sources:

@LimpidCrypto LimpidCrypto added enhancement New feature or request 3rd month Planned to be worked on in the third month. Estimate budget: 10,000 $ XRPL Grants This issue is planned to get resoled as part of the XRPL Grants program (within 8 months) labels Sep 2, 2022
@LimpidCrypto LimpidCrypto added this to the Add high-level methods milestone Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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)
Projects
Status: 🔖 Ready
Development

No branches or pull requests

1 participant