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

feat(api): add query for listing all transactions #240

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

golnar-boosty
Copy link
Collaborator

Pull Request Description

This PR :

1- Add logic for paginated listing of all transactions
2- Refactors part of the transaction handling logic in the interx module, improving modularity, readability, and maintainability while reducing redundancy. Below is a summary of the changes made across the commits:

- Refactored File Path Logic for Transactions:
1- Centralized file path construction logic using a new resolveFileName helper function.
2- Simplified logic in GetTransactions and SaveTransactions to reduce redundancy and improve readability.

- Improved Transaction Query Handling:

1- Replaced the redundant TxsResponse definition with types.TxsResponse for consistency.
2- Consolidated transaction queries in GetTransactionsWithSync using BuildTxSearchEndpoint for endpoint construction.
3- Simplified direction-specific logic in GetFilteredTransactions by introducing the reusable processDirection function.

- Removed Redundant Functions and Code:

1- Eliminated the obsolete getBlockHeight function as it is no longer needed.
2- Removed unnecessary validations and checks (e.g., redundant address validation in QueryBlockTransactionsHandler).

- Enhanced Error Handling and Logging:

1- Improved error handling in processDirection and transaction queries to provide more meaningful logs and responses.

- Standardized API Response Handling:

1- Updated responses in QueryBlockTransactionsHandler to consistently use types.TxsResponse.

…ded a function to simplify the creation of

tx_search endpoint URLs. This utility takes the RPC address, query, pagination parameters, and order criteria as input, and returns a
well-formatted endpoint string.
…struct.

- Added a  field to the  struct to include the block height in transaction details.
- Introduced a new  struct for wrapping multiple transactions with a total count, enhancing API response consistency.

This change improves the API structure by providing more granular transaction information and supporting batch responses effectively.
…Added as a direct dependency in .

- Removed its previous listing as an indirect dependency. This change ensures the  package is explicitly managed, improving dependency clarity and avoiding potential issues with transitive dependency resolution.
…ieval.Updated interx.tx_test.go to use types.TxsResponse instead of TxsResponse for consistency with the types package. Added getBlockHeight function to retrieve block height for a transaction hash from cache or Tendermint. Improved error handling and logging in getBlockHeight.
…ehavior. Refactored GetTransactions to simplify file path construction using basePath and suffix. Added a new resolveFileName helper function to centralize file name determination logic. Updated SaveTransactions to use resolveFileName, improving readability and maintainability. Improved conditional handling in SaveTransactions to append cached transactions only when an address is provided. Enhanced error logging with more descriptive messages in SaveTransactions.
…ng.Removed the redundant TxsResponse definition and replaced it with types.TxsResponse for consistency.Refactored GetTransactionsWithSync. Consolidated outbound and inbound logic with improved query construction.Eliminated unnecessary checks for empty addresses.Replaced repetitive endpoint construction with BuildTxSearchEndpoint.

Simplified GetFilteredTransactions.Introduced processDirection to handle direction-specific logic modularly.Removed redundant loops and conditions for processing inbound and outbound transactions.Added processDirection as a reusable function for transaction direction handling.Enhanced QueryBlockTransactionsHandler.Removed redundant address validation.Updated responses to use types.TxsResponse for consistency.Removed the obsolete getBlockHeight function, as it is no longer needed.
Copy link

This repository does not accept pull requests from non version branches.
--- Please CLOSE this PR after acknowledging the issue ---

@github-actions github-actions bot added the invalid This doesn't seem right label Nov 21, 2024
@github-actions github-actions bot locked as spam and limited conversation to collaborators Nov 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant