You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large File The file 'explorer/gql/types/accounts.ts' is exceptionally large (560 lines of code). This could impact maintainability and readability. Consider splitting into smaller, more focused modules.
Code Duplication There appears to be significant duplication in the rendering logic within the 'AccountTransfersList.tsx' component. Consider abstracting common patterns into reusable components or hooks to improve code maintainability.
Complex Component The 'ActionsModal' component is complex and handles multiple states and side effects. Refactoring into smaller subcomponents or using a state management library could help manage complexity.
Error Handling The 'useTxHelper' hook does not adequately handle potential errors from transactions. It should be robust against failures and provide clear feedback to the user.
Data Consistency The event processing functions in 'unlock.ts' do not consistently update related entities in the cache, which might lead to data inconsistency issues.
Why: Correctly calculating the offset is essential for preventing errors in pagination, especially when handling edge cases like zero or negative page indices.
10
Ensure case insensitivity in string comparison for runtime determination
Consider checking for case insensitivity when using stringifiedRuntime.includes("autoId") to ensure consistent behavior regardless of the case in the runtime string.
Why: This suggestion addresses a potential issue with case sensitivity that could lead to inconsistent behavior. Ensuring case insensitivity in string comparison is a good practice for robustness.
8
Best practice
Improve type safety by specifying more accurate types for numeric and timestamptz
Consider using a more specific type instead of any for the numeric and timestamptz scalar types to ensure type safety and avoid potential runtime errors.
Why: This suggestion improves type safety by specifying more accurate types for numeric and timestamptz, which can prevent potential runtime errors and enhance code reliability.
9
Use optional chaining to safely access properties on potentially undefined objects
Use optional chaining to safely access properties on potentially undefined objects to prevent runtime errors.
Why: Using optional chaining is a best practice that enhances code safety by preventing errors when accessing properties on possibly undefined objects.
8
Possible bug
Add a null check for sorting[0].id to prevent potential runtime errors
Consider handling the case where sorting[0].id is undefined or null to prevent runtime errors.
Why: Adding a null check for sorting[0].id is crucial to prevent potential runtime errors, especially when accessing properties on potentially undefined objects.
9
Add explicit check to prevent division by zero in share price calculation
To avoid potential division by zero errors, add an explicit check before performing the division when calculating domain.currentSharePrice.
Why: The suggestion correctly identifies a potential division by zero error and provides a solution to prevent it, which is crucial for preventing runtime errors.
9
Enhancement
Enhance error logging by including the error object
To improve error handling, log the error message to provide more context about the failure when sending logs.
Why: Including the error object in the log enhances error handling by providing more context, which is crucial for debugging and maintaining the application.
8
Maintainability
Add responsive classes to maintain layout consistency across devices
Ensure consistent responsive design by adding missing responsive classes to the new div element for better layout management on different screen sizes.
Why: Simplifying the conditional logic improves code readability and maintainability, making it easier for developers to understand and modify the code in the future.
7
Consolidate repeated withdrawal updates and cache settings into a single function
Refactor repeated code for setting total withdrawals and updating cache into a function to reduce duplication and improve maintainability.
Why: This suggestion reduces code duplication and enhances maintainability by consolidating repeated logic into a function, which is a good practice for cleaner code.
7
Encapsulate the creation and storage of reward events into a single function
Refactor the creation of operatorRewardedEvent to ensure that the event creation and its properties are encapsulated within a function to enhance modularity and readability.
Why: Encapsulating the creation and storage of reward events into a single function improves code modularity and readability, which is beneficial for maintainability.
6
Cleanup
Remove unnecessary ESLint directive to clean up the code
Remove the commented-out eslint-disable camelcase directive as it is no longer necessary after the refactor.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Sync main w/ prod
PR Type
Enhancement, Tests, Bug fix, Documentation
Description
AccountTransfersList
component to display account transfers with sorting and pagination.ActionsModal
with improved validation and transaction logging.AccountExtrinsicList
component layout and logic.useTxHelper
for better error tracking.ChainProvider
.Changes walkthrough 📝
15 files
accounts.ts
Add GraphQL types and queries for accounts and transfers
explorer/gql/types/accounts.ts
AccountTransfersList.tsx
Implement AccountTransfersList component with data fetching
explorer/src/components/Consensus/Account/AccountTransfersList.tsx
AccountTransfersList
component to display accounttransfers.
ActionsModal.tsx
Enhance ActionsModal with validation and logging
explorer/src/components/Staking/ActionsModal.tsx
AccountExtrinsicList.tsx
Simplify AccountExtrinsicList component layout and logic
explorer/src/components/Consensus/Account/AccountExtrinsicList.tsx
useTxHelper.ts
Add transaction logging to useTxHelper hook
explorer/src/hooks/useTxHelper.ts
staking.ts
Update NominationsListQuery with pending actions
explorer/gql/types/staking.ts
NominationsListQuery
to include pending actions.NominationsTable.tsx
Refine NominationsTable action logic based on status
explorer/src/components/Staking/NominationsTable.tsx
cache.ts
Rename RewardEvent and implement batch saving in cache
indexers/staking-squid/src/utils/cache.ts
RewardEvent
toReward
.unlock.ts
Update unlock event processing with total withdrawals logic
indexers/staking-squid/src/events/unlock.ts
NO_ACTION_REQUIRED
for nominators.ChainProvider.tsx
Simplify network URI logic in ChainProvider
explorer/src/providers/ChainProvider.tsx
Tooltip.tsx
Optimize Tooltip component with useMemo
explorer/src/components/common/Tooltip.tsx
useMemo
.OperatorsList.tsx
Adjust OperatorsList actions based on status and pending actions
explorer/src/components/Staking/OperatorsList.tsx
actions.
epoch.ts
Update epoch transition logic for domains and operators
indexers/staking-squid/src/events/epoch.ts
Account.tsx
Add AccountTransfersList to account page with tabs
explorer/src/components/Consensus/Account/Account.tsx
AccountTransfersList
to account page with tabbed navigation.staking.ts
Add enums for staking statuses and actions
explorer/src/constants/staking.ts
37 files
public_account_extrinsic_total_count.yaml
...
indexers/db/metadata/databases/leaderboard/tables/public_account_extrinsic_total_count.yaml
...
public_account_transfer_receiver_total_count.yaml
...
indexers/db/metadata/databases/leaderboard/tables/public_account_transfer_receiver_total_count.yaml
...
public_account_transfer_receiver_total_value.yaml
...
indexers/db/metadata/databases/leaderboard/tables/public_account_transfer_receiver_total_value.yaml
...
public_account_transfer_sender_total_count.yaml
...
indexers/db/metadata/databases/leaderboard/tables/public_account_transfer_sender_total_count.yaml
...
public_account_transfer_sender_total_value.yaml
...
indexers/db/metadata/databases/leaderboard/tables/public_account_transfer_sender_total_value.yaml
...
public_operator_total_rewards_collected.yaml
...
indexers/db/metadata/databases/leaderboard/tables/public_operator_total_rewards_collected.yaml
...
public_operator_total_tax_collected.yaml
...
indexers/db/metadata/databases/leaderboard/tables/public_operator_total_tax_collected.yaml
...
public_farmer_block_total_count.yaml
...
indexers/db/metadata/databases/leaderboard/tables/public_farmer_block_total_count.yaml
...
public_farmer_block_total_value.yaml
...
indexers/db/metadata/databases/leaderboard/tables/public_farmer_block_total_value.yaml
...
public_farmer_vote_total_count.yaml
...
indexers/db/metadata/databases/leaderboard/tables/public_farmer_vote_total_count.yaml
...
public_farmer_vote_total_value.yaml
...
indexers/db/metadata/databases/leaderboard/tables/public_farmer_vote_total_value.yaml
...
public_account_remark_count.yaml
...
indexers/db/metadata/databases/leaderboard/tables/public_account_remark_count.yaml
...
public_operator_bundle_total_count.yaml
...
indexers/db/metadata/databases/leaderboard/tables/public_operator_bundle_total_count.yaml
...
public_reward_event.yaml
...
indexers/db/metadata/databases/staking/tables/public_reward_event.yaml
...
settings.json
...
.vscode/settings.json
...
.env
...
.env
...
.env
...
indexers/staking-squid/.env
...
squid.yaml
...
indexers/staking-squid/squid.yaml
...
config.yaml
...
indexers/db/config.yaml
...
init-db.sql
...
indexers/db/docker-entrypoint-initdb.d/init-db.sql
...
actions.yaml
...
indexers/db/metadata/actions.yaml
...
squid_processor_status.yaml
...
indexers/db/metadata/databases/leaderboard/tables/squid_processor_status.yaml
...
squid_processor_status.yaml
...
indexers/db/metadata/databases/staking/tables/squid_processor_status.yaml
...
public_migrations.yaml
...
indexers/db/metadata/databases/staking/tables/public_migrations.yaml
...
graphql_schema_introspection.yaml
...
indexers/db/metadata/graphql_schema_introspection.yaml
...
version.yaml
...
indexers/db/metadata/version.yaml
...
cron_triggers.yaml
...
indexers/db/metadata/cron_triggers.yaml
...
remote_schemas.yaml
...
indexers/db/metadata/remote_schemas.yaml
...
allow_list.yaml
...
indexers/db/metadata/allow_list.yaml
...
inherited_roles.yaml
...
indexers/db/metadata/inherited_roles.yaml
...
metrics_config.yaml
...
indexers/db/metadata/metrics_config.yaml
...
opentelemetry.yaml
...
indexers/db/metadata/opentelemetry.yaml
...
rest_endpoints.yaml
...
indexers/db/metadata/rest_endpoints.yaml
...
api_limits.yaml
...
indexers/db/metadata/api_limits.yaml
...
backend_configs.yaml
...
indexers/db/metadata/backend_configs.yaml
...
query_collections.yaml
...
indexers/db/metadata/query_collections.yaml
...
network.yaml
...
indexers/db/metadata/network.yaml
...