bitshares / bitshares-core

BitShares Blockchain node and command-line wallet
https://bitshares.github.io/
Other
1.17k stars 643 forks source link

Add `history_api::get_account_history_by_time` API #2650

Closed abitmore closed 1 year ago

abitmore commented 1 year ago

PR for #2647.

Add history_api::get_account_history_by_time API,

/**
 * @brief Get the history of operations related to the specified account no later than the specified time
 * @param account_name_or_id The account name or ID whose history should be queried
 * @param limit Maximum number of operations to retrieve, must not exceed the configured value of
 *              @a api_limit_get_account_history
 * @param start the time point to start looping back through history
 * @return A list of operations related to the specified account, ordered from most recent to oldest.
 *
 * @note
 * 1. If @p account_name_or_id cannot be tied to an account, an empty list will be returned
 * 2. @p limit can be omitted or be @a null, if so the configured value of
 *       @a api_limit_get_account_history will be used
 * 3. @p start can be omitted or be @a null, if so the api will return the "first page" of the history
 * 4. One or more optional parameters can be omitted from the end of the parameter list, and the optional
 *    parameters in the middle cannot be omitted (but can be @a null).
 */
vector<operation_history_object> get_account_history_by_time(
   const std::string& account_name_or_id,
   const optional<uint32_t>& limit = optional<uint32_t>(),
   const optional<fc::time_point_sec>& start = optional<fc::time_point_sec>()
)const;

and refactor history_api::get_account_history by the way.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication