sephynox / xrpl-rust

A 100% Rust library to interact with the XRPL. XRPL Grant Winner
https://crates.io/crates/xrpl-rust
ISC License
20 stars 8 forks source link

Add high-level methods for accounts #34

Open LimpidCrypto opened 2 years ago

LimpidCrypto commented 2 years ago
  1. 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. 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. The function simply calls the get_account_root function and returns the AccountRoot object's Balance field.

  2. 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. 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. The function simply calls the get_account_info function and returns the result's account_data field.

  2. 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. The function calls the AccountInfo request method using the WebsocketClient/AsyncWebsocketClient.

  2. The returning Response struct may not have been added yet. Keep a look at https://github.com/sephynox/xrpl-rust/issues/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. The function calls the AccountTx request method using the WebsocketClient/AsyncWebsocketClient.

  2. The returning Response struct may not have been added yet. Keep a look at https://github.com/sephynox/xrpl-rust/issues/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. The function calls the AccountTx request method using the WebsocketClient/AsyncWebsocketClient.

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