Commit c9bc5ea
authored
feat: Add more l1 data (#69)
* feat: Add L1DailyStatsSchema and GetL1DailyStatsToolSchema for daily statistics retrieval
- Introduced L1DailyStatsSchema to define the structure of daily statistics including transactions, volume, gas fees, active wallets, TPS, and TVL.
- Implemented GetL1DailyStatsToolSchema to fetch historical daily statistics with date validation, ensuring only past dates can be queried.
- Enhanced L1DataTool with methods to retrieve daily data from the API, including error handling for API failures and malformed responses.
- Expanded unit tests to validate the new schema and tool functionality, ensuring robust error handling and accurate data retrieval.
* feat(l1data): Add holders data retrieval to L1DailyStatsSchema and L1DataTool
- Introduced a new field 'holders' in L1DailyStatsSchema to track the number of IOTX holders for the day.
- Implemented fetchDailyHolders method in L1DataTool to retrieve holders data from the API with error handling for empty responses.
- Updated unit tests to validate the new holders data retrieval and ensure proper error handling for empty data scenarios.
* feat(l1data): Implement safe fetching and error handling for daily data retrieval
- Added a FetchResult type to standardize fetch results with value and error properties.
- Refactored getDailyData method to utilize safeFetch for improved error handling during API calls.
- Enhanced logging to capture errors for each metric fetch, ensuring better visibility into failures.
- Updated unit tests to validate the new error handling and ensure correct behavior when some fetches fail.
* feat(l1data): Add avg_staking_duration to L1DailyStatsSchema and implement data fetching
- Introduced avg_staking_duration field in L1DailyStatsSchema to track average staking duration in days.
- Implemented fetchDailyStakingDuration method in L1DataTool for retrieving staking duration data from the API.
- Updated unit tests to validate the new avg_staking_duration field and ensure correct handling of empty data scenarios.1 parent 9cfc993 commit c9bc5ea
2 files changed
+645
-2
lines changed
0 commit comments