-
Notifications
You must be signed in to change notification settings - Fork 20
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
[CFE-635]: Feat - txs graphql to api #1135
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
6 Skipped Deployments
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes involve significant updates to transaction handling within the codebase. Key modifications include the removal of outdated GraphQL queries and hooks, the introduction of new API functions for fetching transaction data, and the refactoring of components to streamline transaction count retrieval. Additionally, several constants and functions related to transaction counts have been eliminated or replaced, indicating a shift in the data-fetching strategy and overall structure. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI
participant API
participant Service
User->>UI: Request transaction data
UI->>Service: Call useTxsByPoolId
Service->>API: Fetch transaction data by pool ID
API-->>Service: Return transaction data
Service-->>UI: Provide transaction data
UI-->>User: Display transaction data
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (10)
- CHANGELOG.md (1 hunks)
- src/lib/data/constant.ts (1 hunks)
- src/lib/pages/pools/components/pool-details/PoolRelatedTxs.tsx (11 hunks)
- src/lib/pages/pools/components/pool-details/tables/pool-txs/index.tsx (3 hunks)
- src/lib/pages/pools/data.ts (2 hunks)
- src/lib/query/tx.ts (1 hunks)
- src/lib/services/expression/index.ts (1 hunks)
- src/lib/services/tx/api.ts (2 hunks)
- src/lib/services/tx/index.ts (4 hunks)
- src/lib/services/types/tx.ts (1 hunks)
Files skipped from review due to trivial changes (4)
- CHANGELOG.md
- src/lib/data/constant.ts
- src/lib/pages/pools/data.ts
- src/lib/services/expression/index.ts
Additional comments not posted (14)
src/lib/query/tx.ts (3)
Line range hint
1-6
: QuerygetTxsCount
is correctly implemented.This query remains unchanged and is correctly implemented according to the GraphQL syntax. It aligns with the PR objectives of simplifying transaction data retrieval.
Line range hint
30-38
: Query for transaction count by block height is correctly implemented.The query
getBlockTransactionCountByHeightQueryDocument
is correctly implemented. Ensure that theblock_height
parameter is correctly passed and handled in the codebase to maintain the integrity of the data fetched.Run the following script to verify the parameter handling:
Verification successful
Verification of
block_height
Parameter HandlingThe
block_height
parameter is used extensively across the codebase, particularly in GraphQL queries and TypeScript files. The search results indicate that the parameter is correctly implemented and utilized in various contexts, including queries and data models. This suggests that the parameter is being handled appropriately within the codebase.
- Files with
block_height
usage:
src/lib/query/tx.ts
: Used in GraphQL queries to filter transactions by block height.src/lib/gql/gql.ts
: Contains multiple queries utilizingblock_height
.src/lib/gql/graphql.ts
: Defines types and queries involvingblock_height
.Based on the gathered information, the handling of the
block_height
parameter appears to be consistent and correct across the codebase. However, it is recommended to manually verify the integration points to ensure that the parameter is passed and utilized correctly in all relevant parts of the application.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling of `block_height` parameter in the codebase. # Test: Search for the parameter usage. Expect: Correct implementation and usage across the codebase. rg --type python -A 5 $'block_height'Length of output: 67
Script:
#!/bin/bash # Description: Verify the handling of `block_height` parameter in the TypeScript codebase. # Test: Search for the parameter usage in TypeScript files. Expect: Correct implementation and usage across the codebase. rg --type ts -A 5 'block_height'Length of output: 165396
Line range hint
8-28
: Complex query handling multiple conditions.The query
getBlockTransactionsByHeightQueryDocument
is complex and handles multiple conditions based onisWasm
andisMove
flags. Ensure that these flags are correctly handled elsewhere in the codebase to maintain the integrity of the data fetched.Run the following script to verify the flag handling:
src/lib/pages/pools/components/pool-details/PoolRelatedTxs.tsx (4)
73-138
: Approve the direct usage of transaction counts inCustomTab
components.Using the transaction counts directly from the hook's response in
CustomTab
components is an effective way to ensure that the displayed data is accurate and up-to-date. This approach reduces the complexity and potential for errors in data handling.
Line range hint
149-213
: Approve the updated rendering logic but verify the UI display.The return statement has been correctly updated to reflect the new data structure, ensuring that the correct transaction counts are passed to each
PoolRelatedTxsTable
based on the selected tab. Verify that the UI correctly displays these counts to ensure the functionality remains intact.
14-14
: Verify the import of the new hook.Ensure that the hook
useTxsByPoolIdTableCounts
is correctly imported and available in thelib/services/tx
module as expected.Verification successful
Import statement is correct.
The hook
useTxsByPoolIdTableCounts
is correctly defined and exported in thelib/services/tx
module, confirming that the import statement inPoolRelatedTxs.tsx
is valid. No further action is needed.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of `useTxsByPoolIdTableCounts` in the `lib/services/tx` module. # Test: Search for the hook definition. Expect: At least one occurrence. rg --type typescript -A 5 $'export const useTxsByPoolIdTableCounts'Length of output: 103
Script:
#!/bin/bash # Description: Verify the existence of `useTxsByPoolIdTableCounts` in the `lib/services/tx` module. # Test: Search for the hook definition. Expect: At least one occurrence. rg --type ts -A 5 $'export const useTxsByPoolIdTableCounts'Length of output: 442
36-46
: Approve the usage of the new hook but verify its impact.The refactoring to use
useTxsByPoolIdTableCounts
simplifies the component by reducing the number of hooks and potentially improving performance. However, verify that this change integrates correctly across the application, especially where transaction counts are displayed or used.Verification successful
Verify the functionality of
useTxsByPoolIdTableCounts
inPoolRelatedTxs.tsx
.The
useTxsByPoolIdTableCounts
hook is currently only used in thePoolRelatedTxs.tsx
component. Ensure that its integration is functioning correctly within this component, as there are no other usages in the codebase.
- File:
src/lib/pages/pools/components/pool-details/PoolRelatedTxs.tsx
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration of `useTxsByPoolIdTableCounts` across the application. # Test: Search for the hook usage in other components. Expect: Consistent usage and handling of the response. rg --type typescript -A 5 $'useTxsByPoolIdTableCounts'Length of output: 88
Script:
#!/bin/bash # Description: Verify the integration of `useTxsByPoolIdTableCounts` across the application. # Test: Search for the hook usage in other components. Expect: Consistent usage and handling of the response. rg --type ts -A 5 $'useTxsByPoolIdTableCounts'Length of output: 1536
src/lib/pages/pools/components/pool-details/tables/pool-txs/index.tsx (3)
7-7
: Import statement updated for new hook.The import statement has been updated to use
useTxsByPoolId
instead ofuseTxsByPoolIdPagination
. This change aligns with the new API-based approach for fetching transaction data.Run the following script to verify the implementation of the new hook:
Verification successful
Import statement and hook implementation verified.
The
useTxsByPoolId
hook is correctly implemented insrc/lib/services/tx/index.ts
and the import statement inindex.tsx
is accurate. The function is defined as a constant and takes parameters suitable for fetching transactions by pool ID. No issues were found with the import or implementation.
src/lib/services/tx/index.ts
: Implementation ofuseTxsByPoolId
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of `useTxsByPoolId`. # Test: Search for the hook implementation. Expect: Only occurrences of the new hook. ast-grep --lang javascript --pattern $'export function useTxsByPoolId($_, $_, $_, $_) { $$$ }'Length of output: 97
Script:
#!/bin/bash # Description: Broaden the search for the `useTxsByPoolId` function definition. # Search for any function definition named `useTxsByPoolId`. ast-grep --lang javascript --pattern $'function useTxsByPoolId($$$) { $$$ }' # Search for any occurrences of `useTxsByPoolId` in the codebase to gather more context. rg 'useTxsByPoolId' -A 5Length of output: 3065
48-49
: Error handling property updated.The error handling property in the hook's response has been updated from
error
toisError
. This change likely standardizes error handling across the application.Run the following script to verify consistent usage of
isError
across the component:Also applies to: 61-61
Verification successful
Error handling property updated and verified.
The error handling property in the hook's response has been updated from
error
toisError
and is used consistently in thesrc/lib/pages/pools/components/pool-details/tables/pool-txs/index.tsx
file. No issues were found with this change.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify consistent usage of `isError` in the component. # Test: Search for any remaining occurrences of `error`. Expect: No occurrences. rg --type javascript -A 5 $'error'Length of output: 68
Script:
#!/bin/bash # Description: Verify consistent usage of `isError` in the component. # Test: Search for any remaining occurrences of `error`. Expect: No occurrences. rg --type ts -A 5 $'error'Length of output: 250477
Script:
#!/bin/bash # Description: Verify consistent usage of `isError` in the specific file. # Test: Search for occurrences of `error` and `isError` in the specific file. rg 'error|isError' src/lib/pages/pools/components/pool-details/tables/pool-txs/index.tsx -A 5Length of output: 373
67-67
: Data structure updated for transactions.The transactions are now accessed via
txs?.items
, indicating a change in the data structure returned by the hook. This should be verified to ensure that thePoolTxsTable
component handles the new structure correctly.Run the following script to verify the handling of
txs?.items
in thePoolTxsTable
component:src/lib/services/tx/api.ts (1)
7-8
: Approved import changes.The new imports are correctly placed and are essential for the added functionality.
Also applies to: 12-12
src/lib/services/types/tx.ts (3)
372-401
: Review:zTxByPoolIdResponse
schema implementation.The schema is well-defined with appropriate transformations and nested structures. It correctly handles the conversion of snake_case to camelCase and parses transaction hashes. Ensure that the API consistently returns the data in the expected format to match this schema.
403-406
: Review:zTxsByPoolIdResponse
constant implementation.This constant is correctly defined to represent a collection of transactions by pool ID, using an array of
zTxByPoolIdResponse
. It is well-aligned with the expected API response structure.
408-419
: Review:zTxsByPoolIdTxsCountResponse
constant implementation.This constant is well-defined and includes a comprehensive summary of transaction counts across various categories. The transformation to camelCase is correctly applied, ensuring consistency with the rest of the application's data handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
src/lib/query/index.ts (1)
Action Required: Address Remaining References to
./tx
ModuleThe removal of the
./tx
module export fromsrc/lib/query/index.ts
has not been fully integrated into the codebase. Multiple files still reference this module, which could lead to broken imports and functionality. Please ensure that all references to the./tx
module are updated or removed as necessary.
- Files with References:
src/lib/utils/index.ts
src/lib/types/nft.ts
src/lib/types/contract.ts
src/lib/types/index.ts
src/lib/services/types/block.ts
src/lib/services/types/index.ts
src/lib/services/searchService.ts
src/lib/services/nft/sequencer.ts
src/lib/services/nft-collection/sequencer.ts
src/lib/app-provider/index.ts
src/lib/data/index.ts
- And many more...
Analysis chain
Line range hint
1-9
: Verify the impact of removing the./tx
module.The removal of the
./tx
module export from this file could potentially break existing functionality that depends on it. It's crucial to verify that all references to this module have been updated or removed accordingly.Run the following script to verify the usage of the
./tx
module:Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to the `./tx` module have been updated or removed. # Test: Search for the module usage. Expect: No occurrences of the `./tx` module. rg --type typescript -A 5 $'./tx'Length of output: 67
Script:
#!/bin/bash # Description: Verify all references to the `./tx` module have been updated or removed. # Test: Search for the module usage. Expect: No occurrences of the `./tx` module. rg --type ts -A 5 $'./tx'Length of output: 62848
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/lib/query/index.ts (1 hunks)
Additional comments not posted (1)
src/lib/query/index.ts (1)
Line range hint
1-9
: Verify the integration and usage of the./nft
and./nftOld
modules.The addition of the
./nft
and./nftOld
exports suggests new functionality or refactoring of existing features. Ensure that these modules are properly integrated and used across the codebase.Run the following script to verify the integration and usage of the
./nft
and./nftOld
modules:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- CHANGELOG.md (1 hunks)
- src/lib/services/tx/index.ts (5 hunks)
Files skipped from review as they are similar to previous changes (2)
- CHANGELOG.md
- src/lib/services/tx/index.ts
Please resolve the conflict. |
src/lib/pages/pools/components/pool-details/tables/pool-txs/index.tsx
Outdated
Show resolved
Hide resolved
Also, please resolve the conflict. |
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Documentation