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/contract verify UI upload #1060

Merged
merged 34 commits into from
Aug 16, 2024
Merged

Conversation

jennieramida
Copy link
Collaborator

@jennieramida jennieramida commented Aug 1, 2024

Summary by CodeRabbit

  • New Features

    • Added a new hook to fetch and manage versions of WebAssembly optimizers.
    • Integrated verification information for contracts into the ContractsTable component, enhancing data display.
    • Introduced device-specific rendering logic in the InstantiateInfo component for better user experience on mobile devices.
    • Enhanced the UploadComplete component to provide actionable options based on verification status.
  • Improvements

    • Introduced loading states across components to improve user feedback during data fetching.
    • Updated layout design in the ContractsTable for improved responsiveness with increased minimum column widths.
    • Refined handling of derived WebAssembly verification information in the ContractDetailsBody for clarity and usability.
    • Enhanced schema handling across multiple components, improving flexibility and responsiveness of the user interface.

Copy link

vercel bot commented Aug 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
celatone-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 16, 2024 9:34am
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
celatone-frontend-main ⬜️ Ignored (Inspect) Visit Preview Aug 16, 2024 9:34am
initia-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Aug 16, 2024 9:34am
neutron-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Aug 16, 2024 9:34am
osmosis-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Aug 16, 2024 9:34am
sei-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Aug 16, 2024 9:34am
terra-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Aug 16, 2024 9:34am

Base automatically changed from feat/contract-verify-ui to feature/cfe-461-verify-flow August 2, 2024 09:52
Base automatically changed from feature/cfe-461-verify-flow to develop August 7, 2024 11:13
@songwongtp songwongtp changed the title [WIP] Feat/contract verify UI upload Feat/contract verify UI upload Aug 8, 2024
@songwongtp songwongtp requested review from evilpeach and Poafs1 August 8, 2024 10:39
Copy link

coderabbitai bot commented Aug 15, 2024

Walkthrough

This update enhances the functionality of WebAssembly (Wasm) optimizers and contract verification processes in the application. A new hook, useWasmOptimizerVersions, is introduced for managing Wasm optimizer data, while the ContractsTable component fetches and displays verification information for contracts. These updates improve data retrieval efficiency and refine the overall user interface, promoting a better user experience.

Changes

Files Change Summary
src/lib/components/modal/wasm-verify-submit/hooks/useWasmOptimizerVersions.ts
src/lib/components/table/contracts/ContractsTable.tsx
Introduced the useWasmOptimizerVersions hook for managing Wasm optimizer versions and integrated useWasmVerifyInfos in ContractsTable for fetching contract verification data. Updated loading states and enhanced layout responsiveness in the table, refining the handling of verification information.
src/lib/pages/contract-details/components/InstantiateInfo.tsx
src/lib/pages/contract-details/index.tsx
Added device-specific rendering logic in InstantiateInfo through the useMobile hook, enhancing user experience. In ContractDetailsBody, updated variable names for clarity and improved loading state management, refining the display of derived data.
src/lib/pages/upload/completed.tsx Enhanced the UploadComplete component with new UI elements for verification status, incorporating nuanced control flow and improved schema handling. Structured rendering logic for better user guidance and clarity on upload status.
src/lib/services/wasm/contract/index.ts Introduced new query hooks with enhanced error handling for contract management. Updated existing hooks for improved input validation and query efficiency, enhancing robustness in API interactions.
src/lib/pages/interact-contract/components/execute-area/index.tsx
src/lib/pages/interact-contract/components/query-area/index.tsx
Updated the ExecuteArea and QueryArea components to incorporate new schema props (verifiedSchema and localSchema) for enhanced schema management. Refined control flow to prioritize the most relevant schemas and improve user experience.
src/lib/pages/interact-contract/components/query-area/schema-query/index.tsx Modified the SchemaQuery component to replace the schema retrieval method with a new utility function, improving clarity and flexibility in schema handling. Enhanced user feedback for schema validation status.
src/lib/pages/interact-contract/index.tsx Replaced the useCodeLcd hook with useDerivedWasmVerifyInfo, enabling comprehensive retrieval of contract verification data based on both codeId and codeHash, enhancing the component's logic and data flow.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ContractsTable
    participant useWasmVerifyInfos
    participant Loading

    User->>ContractsTable: Request to load contracts
    ContractsTable->>useWasmVerifyInfos: Fetch verification info
    useWasmVerifyInfos-->>ContractsTable: Return verification info
    ContractsTable->>Loading: Show loading state if fetching
    Loading-->>ContractsTable: Hide loading state
    ContractsTable->>User: Render contracts with verification info
Loading

🐇✨
In the world of code, so bright and neat,
Optimizers and contracts now dance to the beat.
With hooks and tables, they come alive,
Fetching data swiftly, watch them thrive!
A rabbit's delight in this digital space,
Hopping through changes, a joyous embrace! 🥕


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 13

Outside diff range, codebase verification and nitpick comments (5)
src/lib/pages/contract-details/components/command-section/ContractCmdGroup.tsx (1)

8-13: Consider type safety improvements.

The cmds prop is typed as an array of tuples, which is good. Ensure that the tuples always contain two strings, and consider using a more descriptive type alias for readability.

type CommandTuple = [string, string];
src/lib/components/json-schema/AttachSchemaCard.tsx (1)

15-15: Inconsistent renaming of schema to localSchema.

The search results indicate multiple occurrences of schema that may not have been updated to localSchema. Please review the following files and update the references as necessary:

  • src/lib/stores/schema.ts
  • src/lib/services/verification/wasm/index.ts
  • src/lib/types/verification.ts
  • src/lib/utils/json.ts
  • src/lib/pages/upload/completed.tsx
  • src/lib/pages/migrate/components/MigrateContract.tsx
  • src/lib/pages/instantiate/instantiate.tsx
  • src/lib/pages/interact-contract/index.tsx
  • src/lib/pages/code-details/index.tsx
  • src/lib/components/json-schema/AttachSchemaCard.tsx

Ensure that all relevant instances of schema are correctly renamed to localSchema to maintain consistency and prevent potential issues.

Analysis chain

Verify consistent renaming of schema to localSchema.

Ensure all references to the old schema prop are updated to localSchema throughout the codebase to prevent potential issues.

Also applies to: 23-23

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to the old `schema` prop are updated to `localSchema`.

# Test: Search for any remaining usage of `schema` in the context of AttachSchemaCard. Expect: No occurrences of `schema`.
rg --type js 'AttachSchemaCard' -A 5 | rg 'schema'

Length of output: 48


Script:

#!/bin/bash
# Description: Check for any remaining usage of `schema` in the entire codebase.

# Test: Search for any remaining occurrences of `schema` in JavaScript and TypeScript files. Expect: No occurrences if renaming is consistent.
rg --type-add 'js:*.{js,jsx,ts,tsx}' 'schema'

Length of output: 54603

src/lib/app-fns/tx/storeCode.tsx (1)

25-25: Review Initialization of codeHash in index.tsx.

In src/lib/pages/upload/completed.tsx, the handling of codeHash correctly checks for undefined values, aligning with its type Option<string>. However, in src/lib/pages/upload/index.tsx, txInfo initializes codeHash with an empty string. Consider revising this to better reflect the optional nature of codeHash.

  • File: src/lib/pages/upload/index.tsx
    • Line: Initialization of txInfo with codeHash: ""

Ensure that the initialization aligns with the Option<string> type to fully utilize its benefits.

Analysis chain

Verify usage of StoreCodeTxInternalResult.

The change of codeHash to Option<string> is appropriate for handling optional values. Ensure that all usages of StoreCodeTxInternalResult accommodate this change.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of `StoreCodeTxInternalResult` to ensure they handle `Option<string>` for `codeHash`.

# Test: Search for the interface usage. Expect: All usages handle `Option<string>`.
rg --type typescript 'StoreCodeTxInternalResult'

Length of output: 83


Script:

#!/bin/bash
# Description: Verify all usages of `StoreCodeTxInternalResult` to ensure they handle `Option<string>` for `codeHash`.

# Test: Search for the interface usage. Expect: All usages handle `Option<string>`.
rg --type ts 'StoreCodeTxInternalResult'

Length of output: 578


Script:

#!/bin/bash
# Description: Check how `txResult` is used in `completed.tsx` to ensure `codeHash` is handled as `Option<string>`.
rg 'txResult' src/lib/pages/upload/completed.tsx -A 5

Length of output: 3192


Script:

#!/bin/bash
# Description: Check how `txInfo` is used in `index.tsx` to ensure `codeHash` is handled as `Option<string>`.
rg 'txInfo' src/lib/pages/upload/index.tsx -A 5

Length of output: 367

src/lib/components/wasm-verify-section/VerifiedDetails.tsx (1)

67-97: Enhance Flex Component Usage.

The Flex component is used with overflow="hidden" and className="ellipsis" to manage long URLs. Ensure this styling is consistent across different screen sizes and browsers.

-  <Flex direction="column" gap={6} w="full">
+  <Flex direction="column" gap={6} w="full" overflow="hidden" className="ellipsis">
CHANGELOG.md (1)

48-49: Ensure consistency in feature descriptions.

The feature descriptions should maintain a consistent level of detail. For example, the entry for handling WASM verification info could specify the pages affected, similar to how other entries provide context.

- Handle wasm verify info on various pages e.g. deploy/migrate flow pages, code/contract pages
+ Handle WASM verification information on various pages, such as deploy/migrate flow pages and code/contract pages, for improved clarity and consistency.
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7bee529 and 9ab70ac.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (105)
  • CHANGELOG.md (1 hunks)
  • package.json (2 hunks)
  • src/lib/app-fns/tx/storeCode.tsx (2 hunks)
  • src/lib/app-provider/env.ts (2 hunks)
  • src/lib/components/ContractSelectSection.tsx (3 hunks)
  • src/lib/components/ExplorerLink.tsx (3 hunks)
  • src/lib/components/StatusMessageBox.tsx (1 hunks)
  • src/lib/components/WasmVerifyBadge.tsx (4 hunks)
  • src/lib/components/forms/SelectInput.tsx (1 hunks)
  • src/lib/components/json-schema/AttachSchemaCard.tsx (2 hunks)
  • src/lib/components/json-schema/section/SchemaInputNotExist.tsx (1 hunks)
  • src/lib/components/json-schema/section/SchemaInputSection.tsx (5 hunks)
  • src/lib/components/json-schema/upload/UploadSchema.tsx (1 hunks)
  • src/lib/components/json-schema/upload/UploadSchemaSection.tsx (2 hunks)
  • src/lib/components/json-schema/view/ViewSchemaModal.tsx (4 hunks)
  • src/lib/components/modal/contract/AddToOtherList.tsx (1 hunks)
  • src/lib/components/modal/contract/ContractDetailsTemplate.tsx (1 hunks)
  • src/lib/components/modal/contract/RemoveContract.tsx (1 hunks)
  • src/lib/components/modal/contract/SaveNewContract.tsx (5 hunks)
  • src/lib/components/modal/wasm-verify-status/WasmVerifyRequestInfo.tsx (3 hunks)
  • src/lib/components/modal/wasm-verify-submit/WasmVerifySubmitCompleted.tsx (1 hunks)
  • src/lib/components/modal/wasm-verify-submit/WasmVerifySubmitFailed.tsx (2 hunks)
  • src/lib/components/modal/wasm-verify-submit/WasmVerifySubmitForm.tsx (5 hunks)
  • src/lib/components/modal/wasm-verify-submit/hooks/index.ts (1 hunks)
  • src/lib/components/modal/wasm-verify-submit/hooks/useWasmOptimizerVersions.ts (1 hunks)
  • src/lib/components/modal/wasm-verify-submit/index.tsx (4 hunks)
  • src/lib/components/select-code/CodeSelect.tsx (1 hunks)
  • src/lib/components/select-contract/ContractListDetail.tsx (2 hunks)
  • src/lib/components/select-contract/SelectContractAdmin.tsx (2 hunks)
  • src/lib/components/table/codes/CodesTable.tsx (1 hunks)
  • src/lib/components/table/contracts/ContractNameCell.tsx (1 hunks)
  • src/lib/components/table/contracts/ContractsTable.tsx (4 hunks)
  • src/lib/components/table/contracts/ContractsTableMobileCard.tsx (3 hunks)
  • src/lib/components/table/contracts/ContractsTableRow.tsx (4 hunks)
  • src/lib/components/table/contracts/EditTags.tsx (1 hunks)
  • src/lib/components/upload/InProgressVerifiedSection.tsx (1 hunks)
  • src/lib/components/upload/IndirectlyVerifiedAlert.tsx (1 hunks)
  • src/lib/components/upload/OptionButton.tsx (1 hunks)
  • src/lib/components/upload/UploadSection.tsx (4 hunks)
  • src/lib/components/upload/index.ts (1 hunks)
  • src/lib/components/wasm-verify-section/FailedDetails.tsx (3 hunks)
  • src/lib/components/wasm-verify-section/InProgressDetails.tsx (2 hunks)
  • src/lib/components/wasm-verify-section/IndirectlyVerifiedDetails.tsx (2 hunks)
  • src/lib/components/wasm-verify-section/NotVerifiedDetails.tsx (2 hunks)
  • src/lib/components/wasm-verify-section/RelatedVerifiedCodeLinks.tsx (1 hunks)
  • src/lib/components/wasm-verify-section/VerifiedDetails.tsx (4 hunks)
  • src/lib/components/wasm-verify-section/index.tsx (1 hunks)
  • src/lib/hooks/useHandleSave.tsx (3 hunks)
  • src/lib/model/contract.ts (3 hunks)
  • src/lib/pages/code-details/components/code-info/CodeTopInfo.tsx (2 hunks)
  • src/lib/pages/code-details/components/code-schema-section/CodeSchemaTabs.tsx (1 hunks)
  • src/lib/pages/code-details/components/code-schema-section/SchemaPanel.tsx (1 hunks)
  • src/lib/pages/code-details/components/code-schema-section/index.tsx (1 hunks)
  • src/lib/pages/code-details/data.ts (1 hunks)
  • src/lib/pages/code-details/index.tsx (7 hunks)
  • src/lib/pages/contract-details/components/ContractVerificationSection.tsx (1 hunks)
  • src/lib/pages/contract-details/components/InstantiateInfo.tsx (3 hunks)
  • src/lib/pages/contract-details/components/command-section/CommandSectionHeader.tsx (1 hunks)
  • src/lib/pages/contract-details/components/command-section/ContractCmdGroup.tsx (1 hunks)
  • src/lib/pages/contract-details/components/command-section/index.tsx (1 hunks)
  • src/lib/pages/contract-details/components/tables/migration/MigrationMobileCard.tsx (2 hunks)
  • src/lib/pages/contract-details/components/tables/migration/MigrationRow.tsx (2 hunks)
  • src/lib/pages/contract-details/components/tables/migration/MigrationTableFull.tsx (3 hunks)
  • src/lib/pages/contract-details/components/tables/migration/MigrationTableLite.tsx (3 hunks)
  • src/lib/pages/contract-details/index.tsx (6 hunks)
  • src/lib/pages/contract-list/index.tsx (1 hunks)
  • src/lib/pages/deploy-script/components/UploadScriptCard.tsx (1 hunks)
  • src/lib/pages/instantiate/completed.tsx (1 hunks)
  • src/lib/pages/instantiate/component/InstantiateOffchainForm.tsx (3 hunks)
  • src/lib/pages/instantiate/index.tsx (3 hunks)
  • src/lib/pages/instantiate/instantiate.tsx (8 hunks)
  • src/lib/pages/interact-contract/components/execute-area/index.tsx (2 hunks)
  • src/lib/pages/interact-contract/components/execute-area/schema-execute/ExecuteBox.tsx (1 hunks)
  • src/lib/pages/interact-contract/components/execute-area/schema-execute/index.tsx (6 hunks)
  • src/lib/pages/interact-contract/components/query-area/index.tsx (2 hunks)
  • src/lib/pages/interact-contract/components/query-area/schema-query/SchemaQueryComponent.tsx (1 hunks)
  • src/lib/pages/interact-contract/components/query-area/schema-query/SchemaQueryResponse.tsx (2 hunks)
  • src/lib/pages/interact-contract/components/query-area/schema-query/index.tsx (3 hunks)
  • src/lib/pages/interact-contract/index.tsx (7 hunks)
  • src/lib/pages/migrate/components/MigrateContract.tsx (4 hunks)
  • src/lib/pages/migrate/components/UploadNewCode.tsx (1 hunks)
  • src/lib/pages/proposal/store-code/index.tsx (1 hunks)
  • src/lib/pages/public-project/components/tables/codes/PublicProjectCodeMobileCard.tsx (2 hunks)
  • src/lib/pages/public-project/components/tables/codes/PublicProjectCodeRow.tsx (2 hunks)
  • src/lib/pages/public-project/components/tables/codes/index.tsx (6 hunks)
  • src/lib/pages/public-project/components/tables/contracts/PublicProjectContractMobileCard.tsx (2 hunks)
  • src/lib/pages/public-project/components/tables/contracts/PublicProjectContractRow.tsx (3 hunks)
  • src/lib/pages/public-project/components/tables/contracts/index.tsx (6 hunks)
  • src/lib/pages/publish-module/components/UploadModuleCard.tsx (1 hunks)
  • src/lib/pages/upload/completed.tsx (5 hunks)
  • src/lib/pages/upload/upload.tsx (1 hunks)
  • src/lib/query/contract.ts (1 hunks)
  • src/lib/services/docker-image/api.ts (1 hunks)
  • src/lib/services/publicProjectService.ts (1 hunks)
  • src/lib/services/types/docker-image.ts (1 hunks)
  • src/lib/services/types/verification/wasm.ts (2 hunks)
  • src/lib/services/types/wasm/contract.ts (4 hunks)
  • src/lib/services/verification/wasm/api.ts (1 hunks)
  • src/lib/services/verification/wasm/index.ts (3 hunks)
  • src/lib/services/wasm/contract/api.ts (2 hunks)
  • src/lib/services/wasm/contract/index.ts (5 hunks)
  • src/lib/stores/contract.ts (3 hunks)
  • src/lib/stores/schema.test.ts (2 hunks)
  • src/lib/stores/schema.ts (2 hunks)
  • src/lib/types/projects.ts (1 hunks)
Files not processed due to max files limit (7)
  • src/lib/types/verification.ts
  • src/lib/utils/_suites/verification/wasm/example.ts
  • src/lib/utils/json.ts
  • src/lib/utils/verification.ts
  • src/lib/utils/verification/index.ts
  • src/lib/utils/verification/wasm.test.ts
  • src/lib/utils/verification/wasm.ts
Files skipped from review due to trivial changes (15)
  • src/lib/components/ExplorerLink.tsx
  • src/lib/components/StatusMessageBox.tsx
  • src/lib/components/forms/SelectInput.tsx
  • src/lib/components/select-code/CodeSelect.tsx
  • src/lib/components/upload/index.ts
  • src/lib/components/wasm-verify-section/InProgressDetails.tsx
  • src/lib/pages/contract-details/components/ContractVerificationSection.tsx
  • src/lib/pages/deploy-script/components/UploadScriptCard.tsx
  • src/lib/pages/interact-contract/components/execute-area/schema-execute/ExecuteBox.tsx
  • src/lib/pages/interact-contract/components/query-area/schema-query/SchemaQueryComponent.tsx
  • src/lib/pages/migrate/components/UploadNewCode.tsx
  • src/lib/pages/proposal/store-code/index.tsx
  • src/lib/pages/publish-module/components/UploadModuleCard.tsx
  • src/lib/pages/upload/upload.tsx
  • src/lib/services/publicProjectService.ts
Additional context used
Biome
src/lib/components/table/contracts/ContractsTable.tsx

[error] 37-37: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

src/lib/services/wasm/contract/api.ts

[error] 141-141: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

Additional comments not posted (206)
src/lib/components/modal/wasm-verify-submit/hooks/index.ts (1)

1-1: Verify the implementation of useWasmOptimizerVersions.

The export change suggests a shift from Rust-specific to Wasm-specific optimizations. Ensure that useWasmOptimizerVersions is correctly implemented and integrated within the codebase.

Verification successful

Implementation and Integration of useWasmOptimizerVersions Verified

The useWasmOptimizerVersions hook is correctly implemented and integrated within the WasmVerifySubmitForm.tsx component. It effectively manages Wasm optimization versions, aligning with the intended focus on Wasm-specific optimizations. No issues were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `useWasmOptimizerVersions`.

# Test: Search for the implementation of `useWasmOptimizerVersions`. Expect: A valid implementation.
ast-grep --lang typescript --pattern 'export const useWasmOptimizerVersions = $_'

Length of output: 3758


Script:

#!/bin/bash
# Check where `useWasmOptimizerVersions` is used in the codebase.
rg 'useWasmOptimizerVersions' --type js --type ts -A 3

Length of output: 1471

src/lib/services/types/verification/wasm.ts (3)

18-18: LGTM! Ensure consistent usage of WasmVerifyInfosResponse.

The introduction of WasmVerifyInfosResponse enhances type safety. Ensure that this type is consistently used throughout the codebase where applicable.


3-3: Verify the definition of zRelatedWasmVerifyInfo.

Ensure that zRelatedWasmVerifyInfo is correctly defined in lib/types and is compatible with the existing data structures.

Verification successful

zRelatedWasmVerifyInfo is correctly defined and compatible.

The zRelatedWasmVerifyInfo is defined as a Zod object schema with the expected fields and transformation. It includes a nullable schema and an array of relatedVerifiedCodes, which aligns with typical verification data structures. No issues found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definition of `zRelatedWasmVerifyInfo`.

# Test: Search for the definition of `zRelatedWasmVerifyInfo`. Expect: A valid definition.
ast-grep --lang typescript --pattern 'export const zRelatedWasmVerifyInfo = $_'

Length of output: 666


22-22: Verify the usage of zWasmRelatedVerifyInfosResponse.

Ensure that zWasmRelatedVerifyInfosResponse is correctly used and integrated within the codebase, given the change to use zRelatedWasmVerifyInfo.

Verification successful

Verified Usage of zWasmRelatedVerifyInfosResponse: The zWasmRelatedVerifyInfosResponse is correctly used and integrated within the codebase. It is defined as a record in wasm.ts, imported, and used for data parsing in api.ts. No inconsistencies or issues were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `zWasmRelatedVerifyInfosResponse`.

# Test: Search for the usage of `zWasmRelatedVerifyInfosResponse`. Expect: Consistent usage.
rg --type typescript 'zWasmRelatedVerifyInfosResponse'

Length of output: 89


Script:

#!/bin/bash
# Description: Verify the usage of `zWasmRelatedVerifyInfosResponse`.

# Test: Search for the usage of `zWasmRelatedVerifyInfosResponse` in the codebase.
rg 'zWasmRelatedVerifyInfosResponse'

Length of output: 326

src/lib/services/docker-image/api.ts (1)

7-25: Ensure robust pagination and error handling in getDockerImageTag.

The introduction of pagination improves data handling. Verify that the pagination logic is robust and consider enhancing error handling to manage potential failures during recursive calls.

#!/bin/bash
# Description: Verify the robustness of pagination and error handling in `getDockerImageTag`.

# Test: Search for the implementation details of `getDockerImageTag`. Expect: Robust pagination and error handling.
ast-grep --lang typescript --pattern $'export const getDockerImageTag = async ($_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_,$_

</blockquote></details>
<details>
<summary>src/lib/components/upload/IndirectlyVerifiedAlert.tsx (1)</summary><blockquote>

`1-26`: **Well-structured component!**

The `IndirectlyVerifiedAlert` component is well-implemented, making good use of Chakra UI components and ensuring robustness with default prop values.

</blockquote></details>
<details>
<summary>src/lib/components/wasm-verify-section/RelatedVerifiedCodeLinks.tsx (1)</summary><blockquote>

`1-34`: **Effective display logic!**

The `RelatedVerifiedCodeLinks` component effectively handles the display of related verified codes with proper formatting and use of the `ExplorerLink` component.

</blockquote></details>
<details>
<summary>src/lib/query/contract.ts (1)</summary><blockquote>

Line range hint `1-31`: 
**Queries are well-structured!**

The existing GraphQL queries are well-structured and serve clear purposes for contract data retrieval.

</blockquote></details>
<details>
<summary>src/lib/components/modal/wasm-verify-submit/WasmVerifySubmitCompleted.tsx (1)</summary><blockquote>

`12-40`: **Well-structured component with improved usability.**

The introduction of the `onClose` prop and the close button enhances the component's functionality and user experience. The layout adjustments improve visual spacing. The changes are well-implemented.

</blockquote></details>
<details>
<summary>src/lib/components/upload/InProgressVerifiedSection.tsx (1)</summary><blockquote>

`1-41`: **New component effectively communicates verification status.**

The `InProgressVerifiedSection` component is well-designed, providing users with clear information about the ongoing verification process. The use of Chakra UI components and `AppLink` for navigation is effective. The component is ready for use.

</blockquote></details>
<details>
<summary>src/lib/components/modal/wasm-verify-submit/hooks/useWasmOptimizerVersions.ts (2)</summary><blockquote>

`5-6`: **Update hook name to reflect broader functionality.**

The hook has been renamed from `useRustOptimizerVersions` to `useWasmOptimizerVersions`, which is appropriate given the inclusion of a new optimizer data source.

---

`30-35`: **Review sorting logic for potential improvements.**

The sorting logic prioritizes `cosmwasm/optimizer` entries when versions are equal. Ensure this logic aligns with business requirements.

</blockquote></details>
<details>
<summary>src/lib/components/table/contracts/ContractNameCell.tsx (1)</summary><blockquote>

`21-22`: **Verify the impact of parameter reordering.**

The addition of `codeId` and reordering of parameters in the `useHandleContractSave` call could impact the function's behavior. Verify that the function correctly handles the new parameter order.

<details>
<summary>Verification successful</summary>



---

<!-- [monologue]
[task review_file_2/3] The `useHandleContractSave` function is defined as an arrow function that takes a destructured object with several properties, including `codeId` and `instantiator`.
[observations] The function's parameters include `codeId` and `instantiator`, which aligns with the changes in `ContractNameCell.tsx`. The function uses these parameters to update contract information.
[analysis] The addition of `codeId` and reordering of parameters in the call to `useHandleContractSave` in `ContractNameCell.tsx` is consistent with the function's definition. The function appears to handle these parameters correctly.
[actions] Conclude that the parameter changes in `ContractNameCell.tsx` are correctly handled by `useHandleContractSave`.
-->

**Parameter Handling Verified in `useHandleContractSave`**

The addition and reordering of parameters, including `codeId`, in the call to `useHandleContractSave` are correctly aligned with its definition. The function handles these parameters as expected. No further action is needed.



</details>


<details>
<summary>Scripts executed</summary>

The following scripts were executed for the analysis:

Script:

```shell
#!/bin/bash
# Description: Verify `useHandleContractSave` handles the new parameter order correctly.

# Test: Search for the `useHandleContractSave` function definition. Expect: Correct handling of `codeId`.
ast-grep --lang typescript --pattern $'function useHandleContractSave({ title, contractAddress, label, codeId, instantiator, actions }) { $$$ }'

Length of output: 145


Script:

#!/bin/bash
# Description: Search for the `useHandleContractSave` function definition by name to verify parameter handling.

# Test: Locate the `useHandleContractSave` function definition.
ast-grep --lang typescript --pattern 'function useHandleContractSave($_) { $$$ }'

Length of output: 83


Script:

#!/bin/bash
# Description: Search for occurrences of `useHandleContractSave` to identify its definition and usage.

# Test: Find all mentions of `useHandleContractSave` in the codebase.
rg 'useHandleContractSave'

Length of output: 1396


Script:

#!/bin/bash
# Description: Extract the definition of `useHandleContractSave` from its source file to verify parameter handling.

# Test: Retrieve the definition of `useHandleContractSave`.
rg 'export const useHandleContractSave' -A 20 src/lib/hooks/useHandleSave.tsx

Length of output: 580

src/lib/stores/schema.ts (1)

4-5: Ensure consistency with new type imports.

The import of CodeSchema and SchemaProperties from lib/types suggests a reorganization of types. Verify that these types are correctly defined and used throughout the codebase.

Verification successful

Type Definitions Verified:

The CodeSchema and SchemaProperties types are correctly defined and used throughout the codebase. The CodeSchema is defined as an interface in src/lib/types/verification.ts, and SchemaProperties is an enum in the same file. Both are integral to the system's functionality.

  • CodeSchema is defined and used across multiple files.
  • SchemaProperties is defined in src/lib/types/verification.ts.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistency of `CodeSchema` and `SchemaProperties` definitions.

# Test: Search for `CodeSchema` and `SchemaProperties` definitions. Expect: Correct and consistent definitions.
ast-grep --lang typescript --pattern $'export type CodeSchema = { $$$ }' --pattern $'export enum SchemaProperties { $$$ }'

Length of output: 289


Script:

#!/bin/bash
# Description: Verify consistency of `CodeSchema` definition.

# Test: Search for `CodeSchema` definition. Expect: Correct and consistent definition.
ast-grep --lang typescript --pattern $'export type CodeSchema = { $$$ }'

Length of output: 73


Script:

#!/bin/bash
# Description: Verify consistency of `SchemaProperties` definition.

# Test: Search for `SchemaProperties` definition. Expect: Correct and consistent definition.
ast-grep --lang typescript --pattern $'export enum SchemaProperties { $$$ }'

Length of output: 794


Script:

#!/bin/bash
# Description: Search for any definition of `CodeSchema`.

# Test: Search for `CodeSchema` in the codebase. Expect: Find its definition or confirm its absence.
rg 'CodeSchema'

Length of output: 5653

src/lib/components/json-schema/upload/UploadSchema.tsx (4)

10-10: Prop Renaming Improves Clarity.

Renaming schema to localSchema in the UploadSchemaContentInterface improves clarity about the type of schema being used. Ensure that all references to this prop are updated throughout the codebase.


18-21: Update Function Signature Reflects Prop Change.

The UploadSchema function signature now correctly reflects the updated prop name localSchema. This change maintains consistency with the interface definition.


26-35: Conditional Rendering Enhances Flexibility.

The introduction of conditional rendering based on triggerElement enhances the component's flexibility, allowing different UI behaviors. This is a positive change for user interaction.


37-43: Direct Rendering of AttachSchemaCard Maintained.

The direct rendering of AttachSchemaCard when triggerElement is not provided maintains the existing functionality, ensuring backward compatibility.

src/lib/components/modal/wasm-verify-submit/WasmVerifySubmitFailed.tsx (2)

14-14: New Prop errorMsg Enhances Error Handling.

Adding the errorMsg prop to WasmVerifySubmitFailedProps allows the component to display specific error messages, improving user feedback.


Line range hint 19-36:
Conditional Error Message Display Improves User Feedback.

The logic for displaying error messages based on errorMsg content is well-implemented, providing clear and context-specific feedback to users.

src/lib/pages/code-details/components/code-schema-section/SchemaPanel.tsx (3)

10-16: SchemaPanelProps Interface Defines Required Props Clearly.

The SchemaPanelProps interface clearly defines the required properties, ensuring type safety and clarity in the component's usage.


25-36: Conditional Rendering Handles Schema Absence Gracefully.

The conditional rendering logic effectively handles cases where jsonSchema is undefined, providing appropriate UI feedback with EmptyState or UploadSchemaSection.


38-44: JsonReadOnly Component Utilized for Schema Display.

The use of JsonReadOnly for displaying the schema when available is appropriate, leveraging existing components for consistent UI behavior.

src/lib/pages/instantiate/index.tsx (3)

13-13: Addition of codeId to InstantiateTxInfo is appropriate.

The inclusion of codeId in the InstantiateTxInfo interface enhances the data structure by providing an identifier for the code being instantiated. Ensure that all usages of this interface are updated accordingly.


29-29: Initialization of codeId in txInfo state is logical.

Setting codeId to 0 as a default value is appropriate. Ensure that this aligns with the application's logic and expectations.


44-47: Update to onComplete function signature is appropriate.

Including codeId in the parameters ensures comprehensive transaction information. Verify that all calls to onComplete correctly provide the codeId.

Verification successful

onComplete Function Usage Verified

The onComplete function is correctly used with the codeId parameter in the instantiate.tsx file, confirming the appropriate update to the function signature.

  • src/lib/pages/instantiate/instantiate.tsx: onComplete is called with codeId.

If there are concerns about upload.tsx, they should be reviewed separately.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all calls to `onComplete` provide the correct `codeId`.

# Test: Search for `onComplete` usage. Expect: Occurrences with `codeId` parameter.
rg --type tsx -A 3 $'onComplete'

Length of output: 59


Script:

#!/bin/bash
# Description: Verify all calls to `onComplete` provide the correct `codeId`.

# Test: Search for `onComplete` usage in .tsx files. Expect: Occurrences with `codeId` parameter.
rg --glob '*.tsx' -A 3 'onComplete'

Length of output: 2235

src/lib/services/types/docker-image.ts (3)

3-3: Import of zUtcDate is necessary and appropriate.

The use of zUtcDate for date fields enhances validation and type safety. Ensure that zUtcDate is defined correctly in the codebase.


21-37: Updates to zDockerImageTagResult schema improve type safety.

Using zUtcDate for date fields and making digest optional enhances the schema's robustness. Ensure that these changes are reflected in the application logic.


45-45: Change to next field in zDockerImageTag schema is appropriate.

Making next nullable provides flexibility in pagination handling. Ensure that this change is accommodated in the application logic.

src/lib/model/contract.ts (2)

20-27: Refinement of useInstantiatedByMe hook enhances efficiency.

The use of useInstantiatedContractsByAddress with limit and offset parameters streamlines data fetching. Ensure that this logic aligns with the intended functionality.


5-5: Removal of useInstantiatedMockInfoByMe is noted.

The removal indicates a change in how instantiated contract information is handled. Verify that this functionality is no longer necessary or is replaced elsewhere.

Verification successful

Functionality of useInstantiatedMockInfoByMe is covered by existing functions.

The functions useInstantiatedByMe and useInstantiatedContractsByAddress appear to handle the functionality previously covered by useInstantiatedMockInfoByMe. The removal seems intentional and is accounted for in the current codebase.

  • useInstantiatedByMe is used in multiple locations, indicating it may serve a similar purpose.
  • useInstantiatedContractsByAddress is also widely used and likely contributes to the intended functionality.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the removal of `useInstantiatedMockInfoByMe` and ensure its functionality is covered elsewhere.

# Test: Search for `useInstantiatedMockInfoByMe` usage. Expect: No occurrences.
rg --type ts $'useInstantiatedMockInfoByMe'

Length of output: 42


Script:

#!/bin/bash
# Description: Search for comments or documentation that reference `useInstantiatedMockInfoByMe` or its replacement.

# Test: Search for `useInstantiatedMockInfoByMe` in comments or documentation.
rg --type md,ts,js,jsx,tsx -A 2 'useInstantiatedMockInfoByMe'

# Test: Search for similar functions that might replace `useInstantiatedMockInfoByMe`.
rg --type ts 'useInstantiatedContractsByAddress|useInstantiated'

Length of output: 1804

src/lib/components/upload/OptionButton.tsx (2)

10-30: LGTM!

The OptionButton component is well-structured and uses Chakra UI effectively. The use of props for title and description promotes reusability.


33-56: LGTM!

The OptionButtonDisabled component appropriately indicates a disabled state and maintains consistency with the OptionButton.

src/lib/stores/schema.test.ts (3)

1-6: Centralized imports improve maintainability.

The use of centralized utilities and types enhances code clarity and maintainability.


34-37: Test cases for saving and deleting schemas are correct.

The test cases correctly validate the functionality of saveNewSchema and deleteSchema using the updated identifiers.


43-53: Comprehensive test cases for schema retrieval.

The test cases for getSchemaByCodeHash are comprehensive and correctly validate schema retrieval functionality using different code hash formats.

src/lib/pages/code-details/data.ts (1)

68-68: Including codeId enhances contract data structure.

The addition of codeId to the ContractInfo objects provides valuable context for downstream processing.

Ensure that downstream code correctly handles the additional codeId property.

src/lib/pages/contract-details/components/command-section/ContractCmdGroup.tsx (4)

23-25: Spinner rendering logic is clear.

The spinner is appropriately shown when isFetching is true, ensuring feedback during loading states.


58-61: Fallback message is user-friendly.

The fallback message when no commands are available is clear and concise, enhancing user experience.


1-6: Ensure proper import usage.

The imports from Chakra UI and internal libraries seem appropriate. However, verify that all imported modules are used in the component.

Verification successful

All imports are used correctly in ContractCmdGroup.tsx.

The review comment's concern about potential unused imports is addressed, as each imported module is confirmed to be utilized within the file.

  • ButtonGroup, Spinner, and Text from @chakra-ui/react are used in the component rendering.
  • useInternalNavigate is used to handle navigation.
  • ContractCmdButton is used in the component rendering.
  • BechAddr32 is used as a type.
  • jsonPrettify and libEncode are used together in a function call.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of imported modules in ContractCmdGroup.tsx.

# Test: Check for unused imports. Expect: All imports should be used.
rg --type tsx -A 5 'import' src/lib/pages/contract-details/components/command-section/ContractCmdGroup.tsx

Length of output: 134


Script:

#!/bin/bash
# Description: Check the usage of each imported module in ContractCmdGroup.tsx.

# List all imports in the file
imports=("ButtonGroup" "Spinner" "Text" "useInternalNavigate" "ContractCmdButton" "BechAddr32" "jsonPrettify" "libEncode")

# Check usage of each import
for import in "${imports[@]}"; do
  echo "Checking usage of $import:"
  rg "$import" src/lib/pages/contract-details/components/command-section/ContractCmdGroup.tsx || echo "$import not used"
done

Length of output: 2531


26-55: Ensure correct sorting and rendering of commands.

The commands are sorted before being mapped to buttons. Confirm that sorting is necessary and correctly implemented. Additionally, ensure that cmd and msg are always valid strings.

src/lib/components/json-schema/upload/UploadSchemaSection.tsx (2)

65-65: Explicitly setting localSchema to undefined.

Setting localSchema to undefined explicitly indicates that no schema is provided. Ensure this behavior is consistent with the component's requirements.


5-5: Verify impact of prop changes on component functionality.

The removal of the schema prop and introduction of localSchema set to undefined may impact the component's behavior. Ensure that this change aligns with the intended design and doesn't break existing functionality.

src/lib/components/json-schema/section/SchemaInputNotExist.tsx (3)

24-29: Logic for verified schema is straightforward.

The logic for handling verified schemas is clear and provides appropriate feedback to the user.


7-14: Ensure prop types are appropriate and consistent.

The props for SchemaInputNotExist include various types. Verify that these types align with their usage and are consistent across the codebase.


31-63: Handle local schema and user guidance effectively.

The component effectively handles scenarios with and without a local schema, providing clear instructions to the user. Ensure that the openModal function is correctly implemented and used.

Verification successful

The openModal function is correctly handled in SchemaInputNotExist.tsx.

The openModal function is used as a prop in SchemaInputNotExist.tsx and is passed from SchemaInputSection.tsx as onOpen. Ensure that onOpen is correctly implemented in the parent component. No issues found with the current usage in SchemaInputNotExist.tsx.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation and usage of `openModal` in SchemaInputNotExist.tsx.

# Test: Check for the definition and usage of `openModal`.
rg --type tsx -A 5 'openModal' src/lib/components/json-schema/section

Length of output: 97


Script:

#!/bin/bash
# Description: Verify the implementation and usage of `openModal` in SchemaInputNotExist.tsx.

# Test: Check for the definition and usage of `openModal` without specifying the file type.
rg -A 5 'openModal' src/lib/components/json-schema/section

Length of output: 2016

src/lib/components/modal/contract/RemoveContract.tsx (1)

30-31: LGTM! But verify the hook usage with the new parameter.

The addition of codeId and reordering of parameters in useHandleContractSave is a logical enhancement. Ensure that the hook is used consistently with the new parameter order throughout the codebase.

Verification successful

Verification Successful: Hook Usage Consistent

The useHandleContractSave hook is used consistently with the new parameter order across the codebase. The parameters title, contractAddress, label, codeId, and instantiator are correctly utilized in all instances.

  • Files with verified usage:
    • src/lib/components/table/contracts/EditTags.tsx
    • src/lib/components/table/contracts/ContractNameCell.tsx
    • src/lib/components/modal/contract/ContractDetailsTemplate.tsx
    • src/lib/components/modal/contract/AddToOtherList.tsx
    • src/lib/components/modal/contract/SaveNewContract.tsx
    • src/lib/components/modal/contract/RemoveContract.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `useHandleContractSave` to ensure compatibility with the new parameter order.

# Test: Search for the hook usage. Expect: Occurrences matching the new parameter order.
rg --type javascript --type typescript -A 5 $'useHandleContractSave'

Length of output: 102


Script:

#!/bin/bash
# Description: Verify the usage of `useHandleContractSave` to ensure compatibility with the new parameter order.

# Corrected Test: Search for the hook usage. Expect: Occurrences matching the new parameter order.
rg --type js --type ts -A 5 $'useHandleContractSave'

Length of output: 7373

src/lib/components/wasm-verify-section/IndirectlyVerifiedDetails.tsx (1)

Line range hint 9-51:
Improved modularity with RelatedVerifiedCodeLinks.

The replacement of RelatedVerifiedCodes with RelatedVerifiedCodeLinks enhances the modularity and readability of the component. Ensure that RelatedVerifiedCodeLinks functions as intended.

Verification successful

Verified functionality of RelatedVerifiedCodeLinks.

The RelatedVerifiedCodeLinks component is correctly implemented and integrated into the codebase. It is exported as a functional component and imported where needed, enhancing the modularity and readability of the code. The component's functionality aligns with the intended design.

  • Exported in src/lib/components/wasm-verify-section/RelatedVerifiedCodeLinks.tsx.
  • Imported in src/lib/components/wasm-verify-section/IndirectlyVerifiedDetails.tsx.
  • Imported in src/lib/components/wasm-verify-section/FailedDetails.tsx.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the functionality of `RelatedVerifiedCodeLinks`.

# Test: Search for the component implementation. Expect: Correct handling of related verified codes.
ast-grep --lang typescript --pattern $'function RelatedVerifiedCodeLinks($_) {
  $$$
}'

Length of output: 88


Script:

#!/bin/bash
# Description: Search for `RelatedVerifiedCodeLinks` as an arrow function or class component.

# Search for `RelatedVerifiedCodeLinks` implemented as an arrow function.
ast-grep --lang typescript --pattern $'const RelatedVerifiedCodeLinks = ($_) => {
  $$$
}'

# Search for `RelatedVerifiedCodeLinks` implemented as a class component.
ast-grep --lang typescript --pattern $'class RelatedVerifiedCodeLinks extends $_ {
  $$$
}'

Length of output: 184


Script:

#!/bin/bash
# Description: Search for any export or import of `RelatedVerifiedCodeLinks`.

# Search for any export of `RelatedVerifiedCodeLinks`.
rg 'export.*RelatedVerifiedCodeLinks' -A 5

# Search for imports of `RelatedVerifiedCodeLinks` to verify its usage.
rg 'import.*RelatedVerifiedCodeLinks' -A 2

Length of output: 1299

src/lib/pages/contract-details/components/tables/migration/MigrationTableLite.tsx (1)

Line range hint 6-58:
Enhanced functionality with useWasmVerifyInfos.

The integration of useWasmVerifyInfos adds valuable verification data to the component. Ensure that the hook is implemented correctly and used consistently.

Verification successful

Verification Successful: useWasmVerifyInfos is Correctly Implemented and Used Consistently

The useWasmVerifyInfos hook is implemented in src/lib/services/verification/wasm/index.ts and is used consistently across various components, including MigrationTableLite. It correctly utilizes useQuery to fetch and manage verification data, ensuring enhanced functionality. No issues were found with its implementation or usage.

  • Implementation found in: src/lib/services/verification/wasm/index.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation and usage of `useWasmVerifyInfos`.

# Test: Search for the hook implementation. Expect: Correct retrieval and handling of verification data.
ast-grep --lang typescript --pattern $'function useWasmVerifyInfos($_) {
  $$$
}'

Length of output: 82


Script:

#!/bin/bash
# Description: Search for the `useWasmVerifyInfos` implementation using a broader approach.

# Search for the `useWasmVerifyInfos` as a named export or arrow function.
rg 'useWasmVerifyInfos' -A 5

# Check for any imports of `useWasmVerifyInfos` to locate its source module.
rg 'useWasmVerifyInfos' --type ts --type tsx

Length of output: 9743

src/lib/hooks/useHandleSave.tsx (2)

14-15: Addition of codeId and repositioning of instantiator.

The addition of codeId and repositioning of instantiator in the UseHandleContractSaveProps interface looks good. This change allows for more flexible handling of contract data.


35-36: Update to useHandleContractSave function signature.

The function signature update to include codeId and reposition instantiator is consistent with the interface changes. Ensure that all calls to this function are updated accordingly.

Also applies to: 52-53

Verification successful

All calls to useHandleContractSave are updated correctly.

The function calls across the codebase have been updated to match the new signature, including the parameters codeId and instantiator. No further action is required.

  • Verified in files such as EditTags.tsx, ContractNameCell.tsx, SaveNewContract.tsx, ContractDetailsTemplate.tsx, RemoveContract.tsx, and AddToOtherList.tsx.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `useHandleContractSave` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type typescript -A 5 $'useHandleContractSave'

Length of output: 84


Script:

#!/bin/bash
# Description: Verify all function calls to `useHandleContractSave` match the new signature.

# Correct the previous command by searching for occurrences of the function in TypeScript files.
rg 'useHandleContractSave' -A 5

Length of output: 7353

src/lib/components/wasm-verify-section/NotVerifiedDetails.tsx (1)

3-3: Integration of ExplorerLink for codeId.

The introduction of ExplorerLink to display codeId as a clickable element enhances the user interface by allowing direct interaction. Ensure that the ExplorerLink component is correctly configured and tested.

Also applies to: 29-33

src/lib/components/table/codes/CodesTable.tsx (1)

30-31: Enhanced loading state management.

The inclusion of isWasmVerifyInfosLoading in the loading state management ensures that the loading indicator is displayed when either data source is still being fetched. This change improves user experience during asynchronous operations.

Also applies to: 33-33

src/lib/pages/code-details/components/code-schema-section/CodeSchemaTabs.tsx (1)

50-54: Ensure unique keys for dynamically created components.

The key for StyledCustomTab is derived from schemaProperty, which should be unique. Ensure that SchemaMsgTabList contains unique values to prevent potential rendering issues.

Verification successful

Keys are unique for dynamically created components.

The SchemaMsgTabList contains unique values derived from constants, ensuring that the keys for StyledCustomTab are unique. No further action is needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that SchemaMsgTabList contains unique values.

# Test: Print unique values from SchemaMsgTabList. Expect: No duplicates.
rg --type js --no-heading --no-filename 'SchemaMsgTabList' -A 5 | sort | uniq -d

Length of output: 80


Script:

#!/bin/bash
# Search for the definition of SchemaMsgTabList and its contents in the codebase
rg 'SchemaMsgTabList' -A 10

Length of output: 7034

src/lib/pages/contract-list/index.tsx (2)

14-14: Ensure the new hook is correctly implemented.

The import of useInstantiatedByMe suggests a shift from mock data to real data. Verify that this hook is correctly implemented and returns the expected data structure.

Verification successful

The useInstantiatedByMe hook is correctly implemented.

The hook is defined in src/lib/model/contract.ts and utilizes several other hooks to fetch data, indicating a shift from mock to real data. It appears to be correctly structured to return the expected data.

  • Implementation found in: src/lib/model/contract.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of the `useInstantiatedByMe` hook.

# Test: Search for the implementation of `useInstantiatedByMe`. Expect: Correct implementation of the hook.
ast-grep --lang typescript --pattern $'function useInstantiatedByMe($_) {
  $$$
}'

Length of output: 83


Script:

#!/bin/bash
# Description: Broaden search for the implementation of `useInstantiatedByMe`.

# Test: Search for the implementation of `useInstantiatedByMe` as a function or arrow function.
rg 'useInstantiatedByMe' -A 10 --type=typescript

Length of output: 83


Script:

#!/bin/bash
# Description: Broaden search for the implementation of `useInstantiatedByMe`.

# Test: Search for the implementation of `useInstantiatedByMe` as a function or arrow function.
rg 'useInstantiatedByMe' -A 10 --type=ts

Length of output: 6207


22-24: Check data structure compatibility.

The contractLists array now includes instantiatedListInfo from useInstantiatedByMe(true). Ensure that this data structure is compatible with the rest of the code that consumes contractLists.

Verification successful

Data Structure Compatibility Verified

The instantiatedListInfo is of type ContractListInfo, which matches the expected structure for elements within contractLists. This confirms compatibility with the rest of the code that consumes contractLists.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility of `instantiatedListInfo` with the rest of the code.

# Test: Search for usage of `contractLists` to ensure compatibility. Expect: Correct handling of `instantiatedListInfo`.
rg --type typescript -A 5 $'contractLists'

Length of output: 76


Script:

#!/bin/bash
# Description: Verify compatibility of `instantiatedListInfo` with the rest of the code.

# Corrected Test: Search for usage of `contractLists` to ensure compatibility. Expect: Correct handling of `instantiatedListInfo`.
rg --type ts -A 5 'contractLists'

Length of output: 5883


Script:

#!/bin/bash
# Description: Verify the structure of `instantiatedListInfo` to ensure compatibility with `contractLists`.

# Test: Search for the definition or return type of `useInstantiatedByMe(true)` to inspect `instantiatedListInfo`.
rg --type ts 'useInstantiatedByMe' -A 10

Length of output: 6207


Script:

#!/bin/bash
# Description: Inspect the structure of `InstantiatedByMeState` or `instantiatedListInfo`.

# Test: Search for the type definition of `InstantiatedByMeState` to understand the structure of `instantiatedListInfo`.
rg --type ts 'InstantiatedByMeState' -A 10

Length of output: 1069

src/lib/components/table/contracts/EditTags.tsx (1)

25-26: Verify the addition of codeId.

The codeId parameter has been added to handleSave. Ensure that codeId is correctly used in the save operation and that it doesn't introduce any errors.

src/lib/pages/interact-contract/components/query-area/schema-query/SchemaQueryResponse.tsx (2)

6-6: Confirm the usage of QueryResponse.

The addition of QueryResponse enhances type safety. Ensure that this type is correctly defined and used throughout the codebase.

Verification successful

QueryResponse is correctly defined and used.

The QueryResponse type is defined as an interface in src/lib/types/verification.ts and is correctly imported and used in SchemaQueryResponse.tsx. The type enhances type safety by ensuring the parsed JSON data conforms to the expected structure.

  • Definition: src/lib/types/verification.ts
  • Usage: src/lib/pages/interact-contract/components/query-area/schema-query/SchemaQueryResponse.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definition and usage of `QueryResponse`.

# Test: Search for the definition and usage of `QueryResponse` to ensure it is correctly defined and used.
ast-grep --lang typescript --pattern $'type QueryResponse = {
  $$$
}'

Length of output: 71


Script:

#!/bin/bash
# Search for the usage of `QueryResponse` across the codebase to understand how it is defined or imported.
rg 'QueryResponse' -A 5

Length of output: 10433


Script:

#!/bin/bash
# Search for the import statement of `QueryResponse` to see if it is imported from an external module or another file.
rg 'import .*QueryResponse.*' -A 2

Length of output: 1978


86-86: Ensure type safety with QueryResponse.

Casting parseJsonStr(res) to QueryResponse improves type safety. Verify that this cast is correct and that res conforms to the QueryResponse structure.

Verification successful

Type Safety Verified for QueryResponse Casting

The casting of parseJsonStr(res) to QueryResponse is correct. The parseJsonStr function is a generic JSON parser, and the QueryResponse interface requires a data property of type JsonDataType. Ensure that res is a valid JSON string that can be parsed into an object with this structure.

  • parseJsonStr is a generic function returning parsed JSON.
  • QueryResponse is defined with a data property in src/lib/types/verification.ts.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `res` conforms to the `QueryResponse` structure.

# Test: Search for the implementation of `parseJsonStr` to ensure it returns data conforming to `QueryResponse`.
ast-grep --lang typescript --pattern $'function parseJsonStr($_) {
  $$$
}'

Length of output: 76


Script:

#!/bin/bash
# Search for the definition or usage of `parseJsonStr` in the codebase to locate its implementation.
rg 'parseJsonStr' -A 5

# Search for the definition of `QueryResponse` to understand its structure.
rg 'type QueryResponse' -A 10

Length of output: 4847


Script:

#!/bin/bash
# Search for `QueryResponse` in the codebase to locate its definition or usage.
rg 'QueryResponse' -A 10

Length of output: 17115

src/lib/components/table/contracts/ContractsTableRow.tsx (3)

5-11: Imports look good.

The new imports for WasmVerifyBadge, Nullish, and WasmVerifyInfo are appropriate for the added functionality.


28-28: Interface update is appropriate.

Adding wasmVerifyInfo: Nullish<WasmVerifyInfo> to the ContractsTableRowProps interface is a suitable enhancement for handling optional verification information.


53-60: Conditional rendering logic is sound.

The logic for conditionally rendering WasmVerifyBadge based on wasmVerifyInfo and contractInfo.codeId is well-implemented.

src/lib/components/wasm-verify-section/index.tsx (1)

34-34: Update to rendering condition is logical.

Changing the condition to check relatedVerifiedCodes.length === 0 instead of wasmVerifyInfo.schema is a sensible shift if related codes are a better indicator of verification status.

Ensure this change aligns with the intended verification criteria and doesn't inadvertently alter expected behavior.

Verification successful

Verification logic change is consistent with intended usage.

The condition change to check relatedVerifiedCodes.length === 0 aligns with the broader usage of relatedVerifiedCodes as an indicator of verification status across the codebase.

  • relatedVerifiedCodes is consistently used to determine verification status in various components and utilities.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the alignment of the rendering condition change with the intended verification logic.

# Test: Check for documentation or comments regarding the verification logic.
rg 'verification logic' -A 5

Length of output: 30


Script:

#!/bin/bash
# Description: Search for occurrences of `relatedVerifiedCodes` to understand its role in the verification logic.

# Find all occurrences of `relatedVerifiedCodes` in the codebase.
rg 'relatedVerifiedCodes' -A 5

Length of output: 42573

src/lib/services/verification/wasm/index.ts (4)

17-21: Mutation hook type annotations are beneficial.

The explicit type parameters for useMutation improve type safety and clarity regarding the mutation's behavior and error handling.


27-39: Query hook structure is improved.

The use of queryKey and queryFn aligns with React Query best practices, improving readability and maintainability.


44-55: Consistency in query hook structure is commendable.

The structured approach in useWasmRelatedVerifyInfos ensures consistency and adherence to best practices.


73-74: Standardizing hash input is a good practice.

Converting the hash to uppercase before accessing related verification information helps avoid case-related lookup issues.

src/lib/pages/code-details/components/code-schema-section/index.tsx (2)

18-79: LGTM!

The CodeSchemaSection component is well-structured and integrates seamlessly with existing utilities and components.


67-67: Verify the user documentation link.

Ensure that the href value for the UserDocsLink component is correct and accessible.

src/lib/components/modal/contract/AddToOtherList.tsx (1)

26-27: LGTM!

The inclusion of codeId in the handleSave function enhances the component's functionality by providing more context for contract management.

src/lib/components/wasm-verify-section/FailedDetails.tsx (3)

50-61: LGTM!

The addition of related verified code links provides valuable context to the user, enhancing the functionality of the FailedDetails component.


9-9: Verify the new import for RelatedVerifiedCodeLinks.

Ensure that the RelatedVerifiedCodeLinks component is correctly implemented and imported.

Verification successful

Import of RelatedVerifiedCodeLinks is Correct

The RelatedVerifiedCodeLinks component is correctly implemented and exported in RelatedVerifiedCodeLinks.tsx. It is properly imported and used in FailedDetails.tsx and IndirectlyVerifiedDetails.tsx. No issues were found with the import statement.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation and import of `RelatedVerifiedCodeLinks`.

# Test: Check if the `RelatedVerifiedCodeLinks` component exists and is correctly implemented.
# Expected: The component should be present and properly implemented.
ast-grep --lang typescript --pattern 'export const RelatedVerifiedCodeLinks = $_' 

Length of output: 83


Script:

#!/bin/bash
# Searching for any mention of RelatedVerifiedCodeLinks in the codebase to locate its definition and export method.
rg 'RelatedVerifiedCodeLinks' -A 5

Length of output: 3410


88-91: Ensure schema parameter usage is correct.

The getWasmVerifyStatus function now includes a schema parameter set to null. Verify that this change aligns with the intended logic and does not introduce any issues.

Verification successful

Schema Parameter Handling in getWasmVerifyStatus is Correct

The schema parameter is part of the WasmVerifyInfo type, which allows schema to be null. The transformation logic in the Zod schema handles null values appropriately by setting schema to null if it is not a CodeSchema. Therefore, setting schema to null in the getWasmVerifyStatus function call aligns with the intended logic and does not introduce any issues.

  • The schema property is defined as z.unknown().nullable() in zWasmVerifyInfo.
  • The transformation ensures schema is set to null if it is not a valid CodeSchema.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `schema` parameter in `getWasmVerifyStatus`.

# Test: Check if the `getWasmVerifyStatus` function correctly handles the `schema` parameter.
# Expected: The function should correctly process the `schema` parameter without issues.
ast-grep --lang typescript --pattern 'function getWasmVerifyStatus($_) { $$$ }'

Length of output: 81


Script:

#!/bin/bash
# Search for the definition and usage of the `getWasmVerifyStatus` function in the codebase
rg 'getWasmVerifyStatus' -A 5

Length of output: 28248


Script:

#!/bin/bash
# Search for the definition of `WasmVerifyInfo` to verify if it includes a `schema` property
rg 'interface WasmVerifyInfo' -A 10

Length of output: 37


Script:

#!/bin/bash
# Search for `WasmVerifyInfo` definition or import in the codebase
rg 'WasmVerifyInfo'

Length of output: 16306


Script:

#!/bin/bash
# Search for the definition of `zWasmVerifyInfo` and `zWasmVerifyInfoBase` to verify the structure of `WasmVerifyInfo`
rg 'zWasmVerifyInfo' -A 10 src/lib/types/verification.ts

Length of output: 1200

src/lib/components/select-contract/SelectContractAdmin.tsx (2)

18-18: Import statement looks good.

The import of useAllAdminContractsByAddress is appropriate for the updated data-fetching logic.


38-47: Verify the mapping logic for contract data.

The use of data?.items with optional chaining is a good defensive programming practice. Ensure that getContractLocalInfo handles cases where contract.contractAddress might not exist or be invalid.

Verification successful

Mapping logic correctly handles potential undefined values from getContractLocalInfo.

The function getContractLocalInfo is designed to return undefined if no contract information is found, which is properly handled in the mapping logic using optional chaining and default values. No changes are necessary.

  • getContractLocalInfo is defined to return ContractLocalInfo | undefined, ensuring edge cases are considered.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `getContractLocalInfo` to ensure it handles potential edge cases.

# Test: Search for the function definition and check its implementation.
ast-grep --lang typescript --pattern $'function getContractLocalInfo($_) { $$$ }'

Length of output: 82


Script:

#!/bin/bash
# Description: Search for occurrences of `getContractLocalInfo` to locate its definition or usage.
rg 'getContractLocalInfo'

Length of output: 4860


Script:

#!/bin/bash
# Description: Locate the implementation of `getContractLocalInfo` in `src/lib/stores/contract.ts`.

# Test: Search for the method definition within the specified file.
ast-grep --lang typescript --pattern $'getContractLocalInfo($_) { $$$ }' src/lib/stores/contract.ts

Length of output: 555


Script:

#!/bin/bash
# Description: Search for the definition of `getContractLocalInfo` in `src/lib/stores/contract.ts`.

# Test: Use ripgrep to search for the method definition within the specified file.
rg 'getContractLocalInfo' src/lib/stores/contract.ts

Length of output: 133

src/lib/pages/public-project/components/tables/codes/PublicProjectCodeMobileCard.tsx (2)

7-9: Import statements look good.

The imports for WasmVerifyBadge, Nullish, and WasmVerifyInfo are necessary for the new functionality.


Line range hint 15-42: Verify the usage of wasmVerifyInfo and badge rendering.

The wasmVerifyInfo prop is correctly added and destructured. Ensure that getWasmVerifyStatus handles all possible states of wasmVerifyInfo, and verify that relatedVerifiedCodes are correctly displayed.

Verification successful

Verification of getWasmVerifyStatus Implementation

The getWasmVerifyStatus function handles all possible states of wasmVerifyInfo effectively. It checks for null values, handles cases where verification information is absent, and accounts for errors and in-progress states. This ensures that the WasmVerifyBadge will display the correct status based on the provided wasmVerifyInfo.

  • File: src/lib/utils/verification/wasm.ts
  • Lines: 144-163

The function covers these states:

  • Not verified
  • Indirectly verified
  • Failed
  • In progress
  • Verified

This implementation ensures robust handling of wasmVerifyInfo in the PublicProjectCodeMobileCard component.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `getWasmVerifyStatus` to ensure it handles all states of `wasmVerifyInfo`.

# Test: Search for the function definition and check its implementation.
ast-grep --lang typescript --pattern $'function getWasmVerifyStatus($_) { $$$ }'

Length of output: 81


Script:

#!/bin/bash
# Description: Search for the `getWasmVerifyStatus` function across the codebase to find its definition or import statement.
rg 'getWasmVerifyStatus'

Length of output: 5764


Script:

#!/bin/bash
# Description: Extract the implementation of `getWasmVerifyStatus` from its source file.
ast-grep --lang typescript --pattern 'export const getWasmVerifyStatus = ($_: $_) => { $$$ }' src/lib/utils/verification/wasm.ts

Length of output: 1501

src/lib/pages/public-project/components/tables/codes/PublicProjectCodeRow.tsx (2)

12-14: Import statements look good.

The imports for WasmVerifyBadge, Nullish, and WasmVerifyInfo are necessary for the new functionality.


Line range hint 20-56: Verify the usage of wasmVerifyInfo and badge rendering.

The wasmVerifyInfo prop is correctly added and destructured. Ensure that getWasmVerifyStatus handles all possible states of wasmVerifyInfo, and verify that relatedVerifiedCodes are correctly displayed.

Verification successful

Verification of wasmVerifyInfo Prop and Badge Rendering

The getWasmVerifyStatus function correctly handles different states of wasmVerifyInfo, ensuring robust badge rendering logic. The integration of wasmVerifyInfo and WasmVerifyBadge is implemented correctly. No issues were found.

  • Function location: src/lib/utils/verification/wasm.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `getWasmVerifyStatus` to ensure it handles all states of `wasmVerifyInfo`.

# Test: Search for the function definition and check its implementation.
ast-grep --lang typescript --pattern $'function getWasmVerifyStatus($_) { $$$ }'

Length of output: 81


Script:

#!/bin/bash
# Description: Use ripgrep to locate the `getWasmVerifyStatus` function and check its implementation.
rg 'getWasmVerifyStatus' -A 10

Length of output: 49398

src/lib/pages/public-project/components/tables/contracts/PublicProjectContractMobileCard.tsx (2)

46-50: Verify the conditional rendering logic for WasmVerifyBadge.

The WasmVerifyBadge is conditionally rendered based on wasmVerifyInfo. Ensure that the logic correctly handles cases where wasmVerifyInfo is null or undefined.

Verification successful

Conditional Rendering Logic for WasmVerifyBadge is Correctly Implemented

The use of optional chaining (?.) in PublicProjectContractMobileCard.tsx ensures that the code safely handles cases where wasmVerifyInfo might be null or undefined. This indicates that the conditional rendering logic for WasmVerifyBadge is correctly implemented.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the conditional rendering logic for `WasmVerifyBadge`.

# Test: Search for the usage of `WasmVerifyBadge` and check the conditions. Expect: Proper handling of null or undefined values.
rg --type typescript -A 5 $'WasmVerifyBadge'

Length of output: 78


Script:

#!/bin/bash
# Description: Verify the conditional rendering logic for `WasmVerifyBadge`.

# Find all TypeScript files and search for the usage of `WasmVerifyBadge` to check the conditions.
fd --extension ts --extension tsx | xargs rg 'WasmVerifyBadge' -A 5

Length of output: 32625


10-13: Ensure proper error handling for Wasm verification status.

The getWasmVerifyStatus function is used to determine the status of the WasmVerifyBadge. Ensure that this function handles all possible cases of wasmVerifyInfo to prevent runtime errors.

Verification successful

getWasmVerifyStatus Handles All Cases Appropriately

The getWasmVerifyStatus function effectively handles all possible cases of wasmVerifyInfo, including null or undefined values, and various states of verification. The implementation is robust against runtime errors related to these scenarios. No further changes are necessary.

  • The function returns WasmVerifyStatus.NOT_VERIFIED if wasmVerifyInfo is null or undefined.
  • It handles cases where verificationInfo is null or has an error message.
  • It checks for comparedTimestamp being null to determine if verification is in progress.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `getWasmVerifyStatus` to ensure it handles all cases of `wasmVerifyInfo`.

# Test: Search for the function implementation. Expect: Proper handling of null or undefined values.
ast-grep --lang typescript --pattern $'function getWasmVerifyStatus($_) { $$$ }'

Length of output: 81


Script:

#!/bin/bash
# Description: Search for the `getWasmVerifyStatus` function definition in the codebase using ripgrep.
rg "function getWasmVerifyStatus" -A 10

Length of output: 41


Script:

#!/bin/bash
# Description: Search for the import statement of `getWasmVerifyStatus` to trace its origin.
rg "getWasmVerifyStatus" --type js --type ts

Length of output: 5784


Script:

#!/bin/bash
# Description: Extract the implementation of `getWasmVerifyStatus` from its source file for review.
rg "export const getWasmVerifyStatus" -A 20 src/lib/utils/verification/wasm.ts

Length of output: 672

src/lib/components/table/contracts/ContractsTableMobileCard.tsx (2)

64-70: Verify the conditional rendering logic for WasmVerifyBadge.

The WasmVerifyBadge is conditionally rendered based on contractInfo.codeId. Ensure that the logic correctly handles cases where wasmVerifyInfo is null or undefined.

Verification successful

Conditional Rendering Logic for WasmVerifyBadge is Correct

The conditional rendering logic for WasmVerifyBadge in ContractsTableMobileCard.tsx correctly handles cases where wasmVerifyInfo is null or undefined by using optional chaining. This prevents runtime errors and ensures robust code execution.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the conditional rendering logic for `WasmVerifyBadge`.

# Test: Search for the usage of `WasmVerifyBadge` and check the conditions. Expect: Proper handling of null or undefined values.
rg --type typescript -A 5 $'WasmVerifyBadge'

Length of output: 78


Script:

#!/bin/bash
# Description: Verify the conditional rendering logic for `WasmVerifyBadge`.

# Test: Search for the usage of `WasmVerifyBadge` and check the conditions. Expect: Proper handling of null or undefined values.
rg --type ts -A 5 $'WasmVerifyBadge'

Length of output: 32593


6-16: Ensure imports are used correctly.

The imports for WasmVerifyBadge and getWasmVerifyStatus are necessary for the new functionality. Verify that these components and functions are correctly implemented and used.

Verification successful

Imports are correctly implemented and used

The WasmVerifyBadge component and the getWasmVerifyStatus function are correctly implemented and utilized in the codebase. The component is defined with appropriate props, and the function is used to determine the verification status across multiple components.

  • WasmVerifyBadge is implemented in src/lib/components/WasmVerifyBadge.tsx.
  • getWasmVerifyStatus is implemented in src/lib/utils/verification/wasm.ts.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation and usage of `WasmVerifyBadge` and `getWasmVerifyStatus`.

# Test: Search for the implementation of `WasmVerifyBadge`. Expect: Correct implementation.
ast-grep --lang typescript --pattern $'function WasmVerifyBadge($_) { $$$ }'

# Test: Search for the implementation of `getWasmVerifyStatus`. Expect: Correct implementation.
ast-grep --lang typescript --pattern $'function getWasmVerifyStatus($_) { $$$ }'

Length of output: 159


Script:

#!/bin/bash
# Description: Search for the export and usage of `WasmVerifyBadge` and `getWasmVerifyStatus`.

# Search for `WasmVerifyBadge` export or declaration.
rg 'WasmVerifyBadge' -A 5

# Search for `getWasmVerifyStatus` export or declaration.
rg 'getWasmVerifyStatus' -A 5

Length of output: 60832

src/lib/pages/contract-details/components/tables/migration/MigrationRow.tsx (2)

43-46: Verify the conditional rendering logic for WasmVerifyBadge.

The WasmVerifyBadge is conditionally rendered based on wasmVerifyInfo. Ensure that the logic correctly handles cases where wasmVerifyInfo is null or undefined.

Verification successful

Conditional Rendering Logic for WasmVerifyBadge is Correct

The use of optional chaining (?.) in accessing relatedVerifiedCodes within the WasmVerifyBadge component indicates that the code is designed to handle cases where wasmVerifyInfo might be null or undefined. This suggests that the conditional rendering logic is implemented correctly.

  • File: src/lib/pages/contract-details/components/tables/migration/MigrationRow.tsx
  • Lines: 43-46
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the conditional rendering logic for `WasmVerifyBadge`.

# Test: Search for the usage of `WasmVerifyBadge` and check the conditions. Expect: Proper handling of null or undefined values.
rg --type typescript -A 5 $'WasmVerifyBadge'

Length of output: 78


Script:

#!/bin/bash
# Description: Verify the conditional rendering logic for `WasmVerifyBadge`.

# Test: Search for the usage of `WasmVerifyBadge` and check the conditions. Expect: Proper handling of null or undefined values.
rg -A 5 'WasmVerifyBadge'

Length of output: 32583


7-19: Ensure imports are used correctly.

The imports for WasmVerifyBadge and getWasmVerifyStatus are necessary for the new functionality. Verify that these components and functions are correctly implemented and used.

Verification successful

Imports are used correctly.

The WasmVerifyBadge and getWasmVerifyStatus are properly implemented and utilized across the codebase, confirming their correct integration and usage.

  • WasmVerifyBadge is defined in src/lib/components/WasmVerifyBadge.tsx.
  • getWasmVerifyStatus is defined in src/lib/utils/verification/wasm.ts.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation and usage of `WasmVerifyBadge` and `getWasmVerifyStatus`.

# Test: Search for the implementation of `WasmVerifyBadge`. Expect: Correct implementation.
ast-grep --lang typescript --pattern $'function WasmVerifyBadge($_) { $$$ }'

# Test: Search for the implementation of `getWasmVerifyStatus`. Expect: Correct implementation.
ast-grep --lang typescript --pattern $'function getWasmVerifyStatus($_) { $$$ }'

Length of output: 159


Script:

#!/bin/bash
# Description: Locate the implementation and usage of `WasmVerifyBadge` and `getWasmVerifyStatus`.

# Search for `WasmVerifyBadge` to find its definition and usage.
rg 'WasmVerifyBadge' -A 5

# Search for `getWasmVerifyStatus` to find its definition and usage.
rg 'getWasmVerifyStatus' -A 5

Length of output: 60832

src/lib/components/table/contracts/ContractsTable.tsx (5)

4-4: Import statement for useWasmVerifyInfos is correct.

The import statement for useWasmVerifyInfos is properly added, aligning with the new functionality introduced in the component.


43-43: Loading state management is well-implemented.

The component correctly handles loading states by rendering the Loading component when either isLoading or isWasmVerifyInfosFetching is true.


48-52: Template columns adjustments are consistent.

The adjustments to templateColumns ensure better layout responsiveness. The changes are consistent across different conditions.


68-72: Passing wasmVerifyInfo prop is correctly implemented.

The wasmVerifyInfo prop is conditionally passed to ContractsTableMobileCard, enhancing its functionality with verification info.


101-105: Passing wasmVerifyInfo prop to ContractsTableRow is correct.

The wasmVerifyInfo prop is conditionally passed to ContractsTableRow, ensuring that verification data is utilized effectively.

src/lib/pages/contract-details/components/command-section/CommandSectionHeader.tsx (3)

1-9: Chakra UI components are correctly imported.

The necessary Chakra UI components are imported, indicating the component's reliance on Chakra UI for styling and layout.


29-51: Conditional rendering based on wasmVerifyInfo is well-structured.

The component conditionally renders different layouts based on the presence of wasmVerifyInfo, using WasmVerifyBadge and ViewSchemaModal effectively.


53-107: Local schema handling and UI interactions are well-implemented.

The component handles local schema retrieval and provides UI interactions for schema viewing and editing. The use of useDisclosure for modal management is appropriate.

src/lib/pages/instantiate/completed.tsx (1)

114-114: Addition of codeId prop enhances data handling.

The inclusion of the codeId prop in InstantiateOffChainForm enhances the component's ability to manage and display relevant transaction information.

src/lib/components/modal/wasm-verify-submit/index.tsx (6)

32-36: New properties in WasmVerifySubmitModalBodyProps.

The addition of onSubmit, isLoading, isSuccess, isError, and errorMsg improves the component's ability to manage submission states. Ensure that these properties are utilized consistently and correctly throughout the component.


41-49: Conditional rendering based on submission state.

The WasmVerifySubmitModalBody component now conditionally renders based on isError and isSuccess. This approach improves user feedback. Ensure that transitions between states are handled smoothly.


67-77: Query invalidation logic in handleClose.

The handleClose function now includes logic to invalidate queries based on success or error states. This ensures the application state is consistent with the modal's lifecycle. Verify that all relevant queries are correctly invalidated.


93-93: Use of handleClose in Modal.

The handleClose function replaces onClose in the Modal component, integrating the new query invalidation logic. Ensure that this change does not disrupt existing functionality.


8-10: Consider the necessity of useCallback for handleClose.

The useCallback hook is used to memoize the handleClose function. Ensure that memoization is necessary for performance optimization, as unnecessary usage can lead to complexity without benefits.

Verification successful

Memoization of handleClose is justified.

The handleClose function is used as a prop for onClose events in the component, which can benefit from memoization to prevent unnecessary re-renders. This is especially useful if the components receiving this prop are complex or deeply nested. The use of useCallback is appropriate here.

  • File: src/lib/components/modal/wasm-verify-submit/index.tsx
  • Lines: 8-10
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `handleClose` to determine if memoization is necessary.

# Test: Search for `handleClose` usage in the codebase to assess its impact.
rg --type tsx 'handleClose'

Length of output: 55


Script:

#!/bin/bash
# Description: Verify the usage of `handleClose` to determine if memoization is necessary.

# Corrected Test: Search for `handleClose` usage in TypeScript and JSX files to assess its impact.
rg 'handleClose' --type-add 'typescript:*.{ts,tsx}' --type typescript

Length of output: 337


23-23: Type change for codeHash to Option<string>.

The change from string to Option<string> allows for better handling of potentially absent values. Ensure that all usages of codeHash accommodate this change.

src/lib/pages/contract-details/components/tables/migration/MigrationTableFull.tsx (4)

52-56: Integration of useWasmVerifyInfos hook.

The hook fetches verification information based on codeId. Ensure that this integration does not introduce performance issues, especially with large data sets.


58-58: Loading state enhancement.

The component now considers both data loading states. This ensures users are informed of all loading processes. Verify that the loading indicator is displayed appropriately.


76-81: Passing wasmVerifyInfo to MigrationMobileCard.

The mobile view now includes verification information, enhancing the detail available to users. Ensure that this information is displayed correctly and does not affect the layout negatively.


87-92: Passing wasmVerifyInfo to MigrationRow.

The desktop view is similarly enhanced with verification information. Ensure consistency in how this information is displayed across different views.

src/lib/services/wasm/contract/api.ts (1)

118-124: New function getAllAdminContractsByAddress.

This function retrieves all admin contracts for a given address. Ensure that the endpoint and response parsing are correct and handle errors appropriately.

src/lib/components/modal/contract/ContractDetailsTemplate.tsx (1)

83-84: Verify the handleSave function signature.

The addition of codeId and the reordering of parameters require verification to ensure they match the expected function signature of useHandleContractSave.

Verification successful

Function Signature Verification Successful

The useHandleContractSave function signature correctly includes codeId and matches the expected parameter order. No issues were found with the changes in ContractDetailsTemplate.tsx.

  • Location of Definition: src/lib/hooks/useHandleSave.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the function signature of `useHandleContractSave`.

# Test: Search for the function definition. Expect: The signature matches the new parameter order.
ast-grep --lang typescript --pattern $'function useHandleContractSave({ title, contractAddress, label, codeId, instantiator, name, description, tags, lists, actions }) {
  $$$
}'

Length of output: 179


Script:

#!/bin/bash
# Description: Search for the `useHandleContractSave` function definition without specifying parameters.

# Test: Locate the function definition to verify its signature.
rg 'function useHandleContractSave' -A 5 --glob '**/*.ts*'

Length of output: 60


Script:

#!/bin/bash
# Description: Search for any occurrence of `useHandleContractSave` in the codebase.

# Test: Locate any definition or usage of `useHandleContractSave`.
rg 'useHandleContractSave' --glob '**/*.ts*' -A 10

Length of output: 12418

src/lib/pages/instantiate/component/InstantiateOffchainForm.tsx (2)

21-21: Addition of codeId to InstantiateOffChainFormProps looks good.

The codeId property is a useful addition to the interface, aligning with the component's functionality.


76-77: Usage of codeId in updateContractLocalInfo is appropriate.

The inclusion of codeId in the function call aligns with the component's functionality and enhances its data handling capabilities.

src/lib/types/projects.ts (1)

55-55: Addition of code to RawPublicContract is appropriate.

The code property enhances the data model, allowing for more detailed contract representations.

src/lib/app-fns/tx/storeCode.tsx (1)

70-70: LGTM! Verify function logic.

The removal of the default empty string for codeHash aligns with the Option<string> type, ensuring stricter handling of optional values. Verify that this change does not introduce issues in the function logic.

Verification successful

No Issues with codeHash Handling in storeCodeTx

The removal of the default empty string for codeHash in the storeCodeTx function is appropriate. The function directly uses codeHash in the onTxSucceed callback, which enforces stricter handling of optional values. Ensure that any logic relying on codeHash can handle undefined values appropriately.

  • storeCodeTx implementation in src/lib/app-fns/tx/storeCode.tsx confirms this behavior.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify logic in `storeCodeTx` to ensure no issues arise from the removal of the default empty string for `codeHash`.

# Test: Search for the function implementation. Expect: No issues with the new `codeHash` handling.
ast-grep --lang typescript --pattern $'const storeCodeTx = ({$$$}) => { $$$ }'

Length of output: 79


Script:

#!/bin/bash
# Description: Search for function definitions in the `storeCode.tsx` file to locate `storeCodeTx`.

# Locate the `storeCode.tsx` file and search for function definitions within it.
fd 'storeCode.tsx' --exec rg 'function\s+\w+|const\s+\w+\s*=\s*\(?\s*.*?\s*=>'

Length of output: 156


Script:

#!/bin/bash
# Description: Search for the `storeCodeTx` function by name across the entire codebase.

# Use ripgrep to find the `storeCodeTx` function definition.
rg 'storeCodeTx' --type ts --type tsx

Length of output: 65


Script:

#!/bin/bash
# Description: Search for the `storeCodeTx` function by name across the entire codebase without specifying file types.

# Use ripgrep to find the `storeCodeTx` function definition.
rg 'storeCodeTx'

Length of output: 436


Script:

#!/bin/bash
# Description: Extract the implementation of `storeCodeTx` from `storeCode.tsx` to review its logic.

# Use ripgrep to extract the implementation of `storeCodeTx`.
rg 'export const storeCodeTx' -A 30 src/lib/app-fns/tx/storeCode.tsx

Length of output: 885

src/lib/components/modal/wasm-verify-status/WasmVerifyRequestInfo.tsx (3)

15-15: Verify impact of whiteSpace: "nowrap" on UI.

The addition of whiteSpace: "nowrap" prevents text wrapping, which can improve layout. Ensure this change does not negatively affect other UI components.


37-37: Verify impact of setting schema to null.

Setting schema to null in getWasmVerifyStatus may affect its behavior. Verify that this change is intentional and does not introduce issues.

Verification successful

Review the usage of getWasmVerifyStatus with schema: null.

The function getWasmVerifyStatus is used in several locations across the codebase, and in some instances, the schema is explicitly set to null. This suggests that setting schema to null is an intentional design choice. Ensure that this behavior is consistent with the intended functionality and does not introduce any unintended side effects. Here are some key locations to review:

  • src/lib/components/wasm-verify-section/FailedDetails.tsx
  • src/lib/components/modal/wasm-verify-status/WasmVerifyRequestInfo.tsx

Please verify these instances to ensure they align with the expected application logic.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of setting `schema` to `null` in `getWasmVerifyStatus`.

# Test: Search for `getWasmVerifyStatus` implementations. Expect: No issues with `schema` set to `null`.
ast-grep --lang typescript --pattern $'getWasmVerifyStatus({$$$ schema: null $$$})'

Length of output: 84


Script:

#!/bin/bash
# Search for all instances of `getWasmVerifyStatus` in the codebase to review its usage.
rg 'getWasmVerifyStatus' -A 5

Length of output: 28248


41-41: LGTM! Verify gitUrlWithCommit construction.

The construction of gitUrlWithCommit enhances the user experience by providing a commit-specific link. Verify that the URL is constructed correctly.

Verification successful

Verified: gitUrlWithCommit construction is correct.

The gitUrlWithCommit is consistently constructed and used across the codebase to link to specific commits, enhancing user accessibility to commit details.

  • Files:
    • src/lib/components/wasm-verify-section/VerifiedDetails.tsx
    • src/lib/components/modal/wasm-verify-status/WasmVerifyRequestInfo.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the construction of `gitUrlWithCommit` to ensure correctness.

# Test: Search for `gitUrlWithCommit` usage. Expect: Correct URL construction.
rg --type typescript 'gitUrlWithCommit'

Length of output: 74


Script:

#!/bin/bash
# Description: Verify the construction of `gitUrlWithCommit` to ensure correctness.

# Test: Search for `gitUrlWithCommit` usage. Expect: Correct URL construction.
rg --type tsx 'gitUrlWithCommit'

Length of output: 60


Script:

#!/bin/bash
# Description: Verify the construction of `gitUrlWithCommit` to ensure correctness.

# Test: Search for `gitUrlWithCommit` usage. Expect: Correct URL construction.
rg 'gitUrlWithCommit'

Length of output: 1007

src/lib/components/WasmVerifyBadge.tsx (3)

5-5: Verify impact of removing formatRelatedVerifiedCodes.

The removal of formatRelatedVerifiedCodes suggests a change in handling related verified codes. Verify that this does not affect functionality.


75-81: Verify impact of icon margin adjustment.

The change from mr={0} to mx={0} affects icon spacing. Ensure this adjustment does not negatively impact the UI layout.


109-110: LGTM! Verify badgeStatus conditional check.

The conditional check for badgeStatus improves performance by preventing unnecessary rendering. Verify that this does not introduce issues in the component's behavior.

src/lib/components/json-schema/section/SchemaInputSection.tsx (5)

11-12: Import statement update looks good.

The addition of Nullish from lib/types is necessary for the updated schema handling logic. This change is appropriate given the new approach to managing schema data.


19-20: Schema handling logic updated.

The SchemaSectionProps interface now includes verifiedSchema and localSchema, which improves the flexibility of schema management. This change is well-aligned with the goal of separating verified and local schemas.


31-32: Correct usage of schema prioritization.

The logic correctly prioritizes verifiedSchema over localSchema using the nullish coalescing operator. This ensures that the most relevant schema is used, enhancing robustness.


105-107: Clarified schema status message.

The text provides clearer context about the verification status of the schema, enhancing user understanding. This is a positive change for user feedback.


110-122: Conditional rendering for reattaching schema.

The button for reattaching a schema is conditionally rendered based on the presence of verifiedSchema, which improves the user experience by providing relevant options.

src/lib/pages/interact-contract/components/query-area/index.tsx (5)

14-14: Import statement update looks good.

The addition of Nullish and Option types is necessary for the updated schema handling logic. This change aligns with the new props introduced in the component.


20-21: New props for schema handling.

The QueryAreaProps interface now includes verifiedSchema and localSchema, improving the component's flexibility in handling schema data. This change is well-aligned with the goal of enhancing schema management.


40-41: Correct schema prioritization logic.

The logic correctly prioritizes verifiedSchema over localSchema, ensuring that the most relevant schema is used for rendering. This enhances the robustness of the component.


52-56: Improved control flow for tab selection.

The useEffect hook now dynamically adjusts the active tab based on schema availability and device type, enhancing the user experience by providing a responsive interface.


92-124: Streamlined rendering logic for schema content.

The integration of the new schema handling logic into the MessageInputContent component results in a cleaner and more efficient rendering process. This change improves code readability and maintainability.

src/lib/pages/contract-details/components/tables/migration/MigrationMobileCard.tsx (3)

15-15: Addition of WasmVerifyBadge component.

The inclusion of WasmVerifyBadge enhances the component by providing immediate feedback on the verification status, improving the user interface.


31-31: New prop for Wasm verification information.

The MigrationMobileCardProps interface now includes wasmVerifyInfo, allowing the component to handle verification information related to WebAssembly contracts. This change is well-aligned with the goal of enhancing the component's functionality.


57-60: Conditional rendering of Wasm verification status.

The WasmVerifyBadge is conditionally rendered based on the verification status, enhancing the user interface by providing relevant feedback on the contract's verification status.

src/lib/components/json-schema/view/ViewSchemaModal.tsx (2)

48-48: Prop renaming is consistent.

The renaming of jsonSchema to schema in ViewSchemaModalProps is consistent throughout the file.


141-146: Component usage updated correctly.

The ViewSchemaPanel component now correctly uses schema instead of jsonSchema.

src/lib/pages/interact-contract/components/execute-area/index.tsx (2)

21-22: New props integrated successfully.

The new props verifiedSchema and localSchema are correctly added to ExecuteAreaProps.


41-42: Schema handling logic improved.

The logic adjustment prioritizing verifiedSchema over localSchema is correct and improves schema handling.

src/lib/pages/public-project/components/tables/contracts/PublicProjectContractRow.tsx (2)

34-34: New prop integrated successfully.

The wasmVerifyInfo prop is correctly added to ContractTableRowProps.


77-81: Component usage enhances UI.

The WasmVerifyBadge component is correctly used to display the verification status, enhancing the user interface.

src/lib/pages/public-project/components/tables/contracts/index.tsx (4)

17-18: Imports look good.

The new imports for handling verification information are appropriate and necessary for the added functionality.


Line range hint 47-71: Enhancements to ContentRender are well-implemented.

The addition of wasmVerifyInfos and its integration with child components enhances the component's functionality. The use of optional chaining (?.) is a good practice to prevent runtime errors.


83-87: Integration of useWasmVerifyInfos is seamless.

The use of the useWasmVerifyInfos hook to fetch and pass verification data is well-implemented and enhances the component's functionality.


124-127: Usage of ContentRender with new props is correct.

The ContentRender component is correctly utilized with the new wasmVerifyInfos prop, ensuring that verification information is passed appropriately.

src/lib/pages/public-project/components/tables/codes/index.tsx (4)

16-17: Imports look good.

The new imports for handling verification information are appropriate and necessary for the added functionality.


Line range hint 50-75: Enhancements to ContentRender are well-implemented.

The addition of wasmVerifyInfos and its integration with child components enhances the component's functionality. The use of optional chaining (?.) is a good practice to prevent runtime errors.


87-91: Integration of useWasmVerifyInfos is seamless.

The use of the useWasmVerifyInfos hook to fetch and pass verification data is well-implemented and enhances the component's functionality.


134-138: Usage of ContentRender with new props is correct.

The ContentRender component is correctly utilized with the new wasmVerifyInfos prop, ensuring that verification information is passed appropriately.

src/lib/components/select-contract/ContractListDetail.tsx (2)

11-11: Function renaming is appropriate.

The renaming of useAdminByContractAddresses to useAdminsByContractAddresses aligns with the function's purpose of handling multiple admin addresses, improving code clarity.


92-92: Usage of renamed function is correct.

The function useAdminsByContractAddresses is used correctly in the component, maintaining the existing logic while aligning with the updated naming convention.

src/lib/components/upload/UploadSection.tsx (4)

11-12: Ensure Correct Import Usage.

The imports for useDerivedWasmVerifyInfo, WasmVerifyStatus, and getWasmVerifyStatus are correctly added to handle Wasm verification. Ensure these utilities are well-tested and documented. The IndirectlyVerifiedAlert component is also introduced for conditional rendering.

Also applies to: 19-19, 22-22


123-127: Conditional Rendering of IndirectlyVerifiedAlert.

The component IndirectlyVerifiedAlert is conditionally rendered based on wasmVerifyStatus. Ensure that relatedVerifiedCodes provides meaningful context and is correctly populated.

Verification successful

Verification of relatedVerifiedCodes Population in derivedWasmVerifyInfo

The search results indicate that relatedVerifiedCodes is being used and manipulated in several parts of the codebase, particularly in the wasm.ts file where its length is checked to determine the verification status. This suggests that relatedVerifiedCodes is indeed being populated and used meaningfully.

  • Key Observations:
    • In src/lib/utils/verification/wasm.ts, the length of relatedVerifiedCodes is checked to determine the verification status, indicating it is populated before use.
    • The function formatRelatedVerifiedCodes is used to format these codes, further confirming their presence and use in the application logic.

Given this evidence, it appears that relatedVerifiedCodes is correctly populated and provides meaningful context as required by the review comment.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the population of `relatedVerifiedCodes` in `derivedWasmVerifyInfo`.

# Test: Search for the usage of `relatedVerifiedCodes` to ensure it's correctly populated.
rg --type javascript -A 5 $'relatedVerifiedCodes'

Length of output: 83


Script:

#!/bin/bash
# Description: Verify the population of `relatedVerifiedCodes` in `derivedWasmVerifyInfo`.

# Test: Search for the usage of `relatedVerifiedCodes` to ensure it's correctly populated.
rg 'relatedVerifiedCodes' -A 5

Length of output: 42573


50-53: Verify Dependency Management for useDerivedWasmVerifyInfo.

The useDerivedWasmVerifyInfo hook is used with codeHash as a dependency. Ensure that codeHash is correctly set and updated to avoid unnecessary re-renders or stale data.

Verification successful

Ensure Proper Management of codeHash Dependency

The setCodeHash function is used in multiple places to update the codeHash state. The updates appear to be correctly managed, ensuring that codeHash is set based on various data sources, such as data.hash.toLowerCase() or data.contract.codeHash. This suggests that codeHash is being updated appropriately to prevent unnecessary re-renders or stale data.

  • Locations where setCodeHash is used:
    • src/lib/pages/instantiate/instantiate.tsx
    • src/lib/pages/migrate/components/MigrateContract.tsx
    • src/lib/pages/interact-contract/index.tsx
    • src/lib/components/upload/UploadSection.tsx
    • src/lib/components/ContractSelectSection.tsx
    • src/lib/components/select-code/CodeSelectSection.tsx
    • src/lib/components/select-code/CodeSelect.tsx

These updates should ensure that the useDerivedWasmVerifyInfo hook receives the correct codeHash values as dependencies.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `useDerivedWasmVerifyInfo` to ensure `codeHash` is correctly managed.

# Test: Search for `setCodeHash` and ensure it's correctly updating `codeHash`.
rg --type javascript -A 5 $'setCodeHash'

Length of output: 74


Script:

#!/bin/bash
# Description: Verify the usage of `useDerivedWasmVerifyInfo` to ensure `codeHash` is correctly managed.

# Test: Search for `setCodeHash` and ensure it's correctly updating `codeHash`.
rg --type ts -A 5 'setCodeHash'

Length of output: 6310


91-91: Check Logic for wasmVerifyStatus.

The getWasmVerifyStatus function is used to determine the verification status. Ensure that this logic accurately reflects the intended verification states and handles all possible status values.

src/lib/components/wasm-verify-section/VerifiedDetails.tsx (1)

39-41: Verify URL Construction Logic.

The gitUrlWithCommit variable is introduced to construct URLs with commit references. Ensure that verificationInfo.gitUrl and verificationInfo.commit are always valid and correctly formatted.

src/lib/pages/interact-contract/components/query-area/schema-query/index.tsx (2)

26-27: Check Schema Retrieval Logic.

The getQuerySchema function is used to retrieve the schema. Ensure that this function correctly prioritizes verifiedSchema over localSchema and handles fallback scenarios.

Also applies to: 40-40

Verification successful

Schema Retrieval Logic Correctly Prioritizes verifiedSchema

The getQuerySchema function is used in the code with the expression verifiedSchema ?? localSchema, ensuring that verifiedSchema is prioritized over localSchema. This logic correctly handles the fallback scenario as intended.

  • Location: src/lib/pages/interact-contract/components/query-area/schema-query/index.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `getQuerySchema` to ensure correct schema prioritization.

# Test: Search for the function definition and review its logic.
ast-grep --lang javascript --pattern $'function getQuerySchema($_, $_) { $$$ }'

Length of output: 80


Script:

#!/bin/bash
# Description: Broaden the search for `getQuerySchema` to include various function definitions.

# Search for any function or method named `getQuerySchema`.
rg 'getQuerySchema' -A 10

Length of output: 5952


17-18: Ensure Proper Schema Prop Usage.

The SchemaQueryProps interface now includes verifiedSchema and localSchema. Ensure that these props are correctly passed and utilized throughout the component.

Verification successful

Schema Prop Usage Verified

The verifiedSchema and localSchema props are correctly passed and utilized throughout the components. Their usage is consistent and follows logical patterns to ensure proper schema handling.

  • Confirmed in files such as src/lib/pages/interact-contract/index.tsx, src/lib/pages/instantiate/instantiate.tsx, and others.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `verifiedSchema` and `localSchema` in the component.

# Test: Search for the usage of `verifiedSchema` and `localSchema` to ensure they are correctly handled.
rg --type javascript -A 5 $'verifiedSchema'
rg --type javascript -A 5 $'localSchema'

Length of output: 152


Script:

#!/bin/bash
# Description: Verify the usage of `verifiedSchema` and `localSchema` in the component.

# Test: Search for the usage of `verifiedSchema` and `localSchema` to ensure they are correctly handled.
rg --type typescript -A 5 $'verifiedSchema'
rg --type typescript -A 5 $'localSchema'

Length of output: 152


Script:

#!/bin/bash
# Description: Verify the usage of `verifiedSchema` and `localSchema` in the component.

# Test: Search for the usage of `verifiedSchema` and `localSchema` in `.tsx` files.
rg --glob '*.tsx' -A 5 $'verifiedSchema'
rg --glob '*.tsx' -A 5 $'localSchema'

Length of output: 53306

package.json (1)

49-49: Verify the impact of downgrading @chain-registry/types.

The version of @chain-registry/types has been downgraded from 0.45.36 to 0.45.20. Ensure that this change does not introduce any breaking changes or regressions in the application.

Also applies to: 144-144

src/lib/pages/code-details/index.tsx (4)

31-31: Update to CodeSchemaSection usage.

The CodeLocalSchemaSection has been replaced with CodeSchemaSection. Ensure that this change aligns with the intended functionality and that the new component correctly handles schema data.

Verification successful

Verification Successful: CodeSchemaSection Implementation and Usage

The CodeSchemaSection component is correctly implemented and used within the codebase. It handles schema-related data through its properties, aligning with the intended functionality. The change from CodeLocalSchemaSection to CodeSchemaSection appears to be appropriate.

  • File: src/lib/pages/code-details/index.tsx
  • Component Definition: src/lib/pages/code-details/components/code-schema-section/index.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation and usage of `CodeSchemaSection`.

# Test: Search for the definition and usage of `CodeSchemaSection`. Expect: Proper handling of schema data.
ast-grep --lang tsx --pattern 'const CodeSchemaSection = ($_$$$)'

Length of output: 67


Script:

#!/bin/bash
# Search for the definition of `CodeSchemaSection` in TypeScript and TSX files.
rg 'CodeSchemaSection' --type-add 'tsx:*.{ts,tsx}' --type tsx -A 5

Length of output: 2677


84-85: Refactor schema handling logic.

The variable jsonSchema has been renamed to localSchema, and its usage has been updated. Ensure that this refactor maintains the intended functionality and that all references are updated accordingly.

Verification successful

Refactor verification successful.

The variable localSchema is consistently used throughout the codebase, indicating that the refactoring from jsonSchema to localSchema has been correctly applied. No discrepancies were found in its usage.

  • The refactoring maintains the intended functionality.
  • All references to localSchema appear to be updated correctly.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `localSchema` and ensure all references are updated.

# Test: Search for the usage of `localSchema`. Expect: Consistent and correct usage throughout the codebase.
rg --type tsx 'localSchema'

Length of output: 55


Script:

#!/bin/bash
# Description: Verify the usage of `localSchema` and ensure all references are updated.

# Find all .tsx files and search for the usage of `localSchema`.
fd --extension tsx --exec rg 'localSchema' {}

Length of output: 2574


158-158: Removal of observer wrapper from CodeDetails.

The observer wrapper has been removed from CodeDetails. Verify that this change does not impact the component's reactivity and state management.

Verification successful

Removal of observer wrapper from CodeDetails appears safe.

The CodeDetails component does not use observable patterns or MobX-specific hooks directly, suggesting that removing the observer wrapper should not negatively impact its reactivity or state management. However, ensure that any interactions with other observable components or stores are not affected.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of removing the `observer` wrapper from `CodeDetails`.

# Test: Search for the usage of `CodeDetails`. Expect: No negative impact on reactivity or state management.
rg --type tsx 'CodeDetails'

Length of output: 55


Script:

#!/bin/bash
# Description: Find all .tsx files and search for the usage of `CodeDetails` within them.
fd -e tsx -x rg 'CodeDetails' {}

Length of output: 1549


Script:

#!/bin/bash
# Description: Search for MobX-related imports and observable patterns in the CodeDetails component.
fd -e tsx -x rg 'import.*mobx' {}
fd -e tsx -x rg 'observable|useLocalObservable|useObserver|useLocalStore' {}

Length of output: 2258


60-60: Check parameter changes in useDerivedWasmVerifyInfo.

The parameters for useDerivedWasmVerifyInfo have changed from codeId to data?.info.codeId. Verify that this aligns with the expected data structure and functionality.

src/lib/pages/interact-contract/components/execute-area/schema-execute/index.tsx (3)

94-115: Conditional rendering based on verifiedSchema.

The rendering logic now checks for verifiedSchema and provides different messages and options based on its presence. Ensure that this logic is correctly implemented and enhances the user experience.


26-27: Check logic for schema retrieval with getExecuteSchema.

The logic for schema retrieval now uses getExecuteSchema with verifiedSchema or localSchema. Verify that this logic is correctly implemented and aligns with the intended functionality.

Verification successful

Correct Implementation of getExecuteSchema Logic Verified

The function getExecuteSchema is defined in src/lib/utils/verification/wasm.ts and is used in src/lib/pages/interact-contract/components/execute-area/schema-execute/index.tsx. The logic appears to retrieve the schema using verifiedSchema or localSchema as intended.

  • Definition: src/lib/utils/verification/wasm.ts
  • Usage: src/lib/pages/interact-contract/components/execute-area/schema-execute/index.tsx

The logic aligns with the intended functionality of schema retrieval. No issues found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation and usage of `getExecuteSchema`.

# Test: Search for the implementation of `getExecuteSchema`. Expect: Correct handling of schema retrieval logic.
ast-grep --lang tsx --pattern 'function getExecuteSchema($_) { $$$ }'

Length of output: 71


Script:

#!/bin/bash
# Search for any references to `getExecuteSchema` in the codebase to understand its implementation and usage.
rg 'getExecuteSchema' --type tsx --type ts --context 5

Length of output: 82


Script:

#!/bin/bash
# Correcting the previous search by using --glob to specify file extensions.
rg 'getExecuteSchema' --glob '*.tsx' --glob '*.ts' --context 5

Length of output: 5753


16-17: Update to SchemaExecuteProps interface.

The SchemaExecuteProps interface now includes verifiedSchema and localSchema. Ensure that these changes align with the intended schema management and that all references are updated accordingly.

Verification successful

No external references to SchemaExecuteProps found.

The SchemaExecuteProps interface, including verifiedSchema and localSchema, appears to be used only within the index.tsx file where it is defined. No imports or external references were found in the rest of the codebase. Therefore, no additional updates are required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `SchemaExecuteProps` and ensure all references are updated.

# Test: Search for the usage of `SchemaExecuteProps`. Expect: Consistent and correct usage throughout the codebase.
rg --type tsx 'SchemaExecuteProps'

Length of output: 62


Script:

#!/bin/bash
# Description: Verify the usage of `SchemaExecuteProps` and ensure all references are updated.

# Test: Search for the usage of `SchemaExecuteProps` in TypeScript and TSX files.
rg 'SchemaExecuteProps' --glob '*.ts' --glob '*.tsx' -A 3

Length of output: 1022


Script:

#!/bin/bash
# Description: Search for imports of `SchemaExecuteProps` across the codebase to verify its usage in other files.

# Test: Search for import statements of `SchemaExecuteProps`.
rg 'import.*SchemaExecuteProps' --glob '*.ts' --glob '*.tsx' -A 1

Length of output: 67

src/lib/components/modal/contract/SaveNewContract.tsx (5)

27-28: Addition of codeId to SaveNewContractDetail is appropriate.

The codeId property is a necessary addition for managing contract details and is consistent with the data structure enhancements described.


49-50: Initialization of codeId in defaultValues is correct.

Setting codeId to 0 ensures that the form starts with a default value, aligning with standard initialization practices.


72-73: Inclusion of codeId in state tracking is appropriate.

Tracking codeId ensures that any changes to this field are captured, maintaining consistency with other tracked fields.


101-102: Inclusion of codeId in reset function is correct.

Ensuring codeId is reset to the appropriate value from data.contract.codeId maintains data integrity when resetting the form.


158-159: Passing codeIdState to handleSave is appropriate.

Including codeIdState ensures that all necessary contract details are saved, aligning with the component's purpose.

src/lib/pages/code-details/components/code-info/CodeTopInfo.tsx (2)

32-39: Wrapping CodeTopInfo with observer is appropriate.

This change enables the component to reactively update based on observable state changes, improving integration with MobX.


109-115: Label change to "Code ID" and use of CopyLink is appropriate.

This enhances usability by focusing on code identification and providing a convenient way to copy the code ID.

src/lib/pages/interact-contract/index.tsx (5)

55-58: Use of useDerivedWasmVerifyInfo is appropriate.

This hook provides necessary verification information, aligning with the component's enhanced functionality.


50-50: Introduction of codeHash state is appropriate.

Managing codeHash alongside codeId ensures comprehensive handling of contract data.


144-147: Updating successCallback to set codeId and codeHash is appropriate.

This ensures that both pieces of data are captured upon contract selection, aligning with the component's functionality.


164-169: Passing verifiedSchema and localSchema to QueryArea is appropriate.

These props enhance the component's ability to manage contract interactions accurately.


174-180: Passing verifiedSchema and localSchema to ExecuteArea is appropriate.

These props enhance the component's ability to manage contract executions accurately.

src/lib/pages/upload/completed.tsx (3)

1-32: Imports look good.

The import statements are well-organized and align with the component's functionality. The new components and utilities are necessary for the enhancements made to the UploadComplete component.


Line range hint 118-201: Rendering logic is well-structured.

The conditional rendering based on wasmVerifyStatus and displayOptions is well-implemented, providing a clear and user-friendly UI. The use of SimpleGrid and other components enhances the layout.


42-51: Verify logic for schema retrieval and status check.

The logic for retrieving the schema and checking the verification status appears correct. Ensure that getSchemaByCodeHash and getWasmVerifyStatus handle edge cases appropriately, such as when txResult.codeHash is undefined.

Verification successful

Logic for Schema Retrieval and Status Check is Correct

The functions getSchemaByCodeHash and getWasmVerifyStatus handle edge cases appropriately, such as when txResult.codeHash is undefined or when verification info is missing. The logic in UploadComplete correctly utilizes these functions to manage schema retrieval and verification status. No further action is needed.

  • getSchemaByCodeHash returns undefined for unknown code hashes.
  • getWasmVerifyStatus defaults to NOT_VERIFIED for nullish verification info.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `getSchemaByCodeHash` and `getWasmVerifyStatus`.

# Test: Search for the function implementations. Expect: Correct handling of edge cases.
ast-grep --lang typescript --pattern 'function getSchemaByCodeHash($_) { $$$ }'
ast-grep --lang typescript --pattern 'function getWasmVerifyStatus($_) { $$$ }'

Length of output: 163


Script:

#!/bin/bash
# Description: Search for various forms of `getSchemaByCodeHash` and `getWasmVerifyStatus` definitions.

# Search for `getSchemaByCodeHash` as a function or variable assignment.
rg 'getSchemaByCodeHash\s*[:=]\s*\(.*\)\s*=>' -A 3 --type=typescript
rg 'function\s+getSchemaByCodeHash' -A 3 --type=typescript

# Search for `getWasmVerifyStatus` as a function or variable assignment.
rg 'getWasmVerifyStatus\s*[:=]\s*\(.*\)\s*=>' -A 3 --type=typescript
rg 'function\s+getWasmVerifyStatus' -A 3 --type=typescript

Length of output: 403


Script:

#!/bin/bash
# Description: Correctly search for various forms of `getSchemaByCodeHash` and `getWasmVerifyStatus` definitions.

# Search for `getSchemaByCodeHash` as a function or variable assignment.
rg 'getSchemaByCodeHash\s*[:=]\s*\(.*\)\s*=>' -A 3 --type=ts
rg 'function\s+getSchemaByCodeHash' -A 3 --type=ts

# Search for `getWasmVerifyStatus` as a function or variable assignment.
rg 'getWasmVerifyStatus\s*[:=]\s*\(.*\)\s*=>' -A 3 --type=ts
rg 'function\s+getWasmVerifyStatus' -A 3 --type=ts

Length of output: 231


Script:

#!/bin/bash
# Description: Search for import statements and usage of `getSchemaByCodeHash` and `getWasmVerifyStatus`.

# Search for import statements for these functions.
rg 'import.*getSchemaByCodeHash' --type=ts
rg 'import.*getWasmVerifyStatus' --type=ts

# Search for usage of these functions to trace their origin.
rg 'getSchemaByCodeHash\(' --type=ts
rg 'getWasmVerifyStatus\(' --type=ts

Length of output: 6564


Script:

#!/bin/bash
# Description: Locate the definitions of `getSchemaByCodeHash` and `getWasmVerifyStatus`.

# Search for the definition of `getSchemaByCodeHash` in the schema store.
rg 'getSchemaByCodeHash' src/lib/stores/schema.ts -A 5

# Search for the definition of `getWasmVerifyStatus` in the utils module.
rg 'getWasmVerifyStatus' src/lib/utils -A 5

Length of output: 672

src/lib/services/types/wasm/contract.ts (2)

Line range hint 39-49: New code_id field is correctly added.

The addition of the code_id field to zContractsResponseItem and its transformation is correctly implemented, enhancing the data structure with a unique identifier for the contract code.


242-273: New types are well-defined.

The new types zAllAdminContractsResponseItem and zContractAdminsResponse are well-defined and transformed appropriately, expanding the functionality for handling contract-related data.

src/lib/components/modal/wasm-verify-submit/WasmVerifySubmitForm.tsx (3)

22-29: Type change to Option<string> is appropriate.

Changing codeHash to Option<string> enhances type safety by explicitly handling potentially absent values. This change aligns with best practices for handling optional data.


161-174: Conditional rendering for codeHash is well-implemented.

The conditional rendering of UI elements based on the presence of codeHash optimizes the component's behavior, preventing unnecessary rendering when codeHash is absent.


63-67: Validation messages are clear and helpful.

The updated validation messages for the GitHub URL provide clearer instructions, improving user guidance during input.

src/lib/pages/contract-details/components/InstantiateInfo.tsx (3)

6-6: Import useMobile for device-specific logic.

The addition of useMobile helps tailor the UI experience based on the device type, enhancing responsiveness.


117-117: Use useMobile to conditionally render UI elements.

The isMobile variable is used to determine if the application is accessed on a mobile device, which is crucial for responsive design.


150-176: Conditional rendering based on isMobile.

The verification prompt is conditionally rendered based on the isMobile flag, ensuring it only appears on non-mobile devices when the verification status is neither VERIFIED nor IN_PROGRESS. This improves user experience by avoiding unnecessary prompts on mobile devices.

src/lib/components/ContractSelectSection.tsx (3)

181-184: Add isLoading to track loading state.

The inclusion of isLoading: isDerivedWasmVerifyInfoLoading enhances the component's ability to manage loading states, improving responsiveness.


204-204: Update loading overlay condition.

The loading overlay now considers both isFetching and isDerivedWasmVerifyInfoLoading, ensuring the UI accurately reflects loading states from multiple data sources.


240-240: Pass linkedCodeId prop to child component.

The addition of the linkedCodeId prop allows the child component to potentially process or display the codeId, enhancing data flow and component interaction.

src/lib/services/wasm/contract/index.ts (4)

Line range hint 117-148:
Enhance useInstantiatedContractsByAddress with optional address and enabled flag.

The hook now handles Option<BechAddr> for the address parameter, improving robustness by preventing unnecessary API calls when the address is undefined. The enabled flag allows conditional execution, enhancing control over query execution.


160-160: Update query key for useAdminContractsByAddress.

The query key has been updated to ADMIN_CONTRACTS_BY_ADDRESS, improving clarity and consistency in naming conventions.


306-322: Introduce useAllAdminContractsByAddress hook.

This new hook provides a way to query all admin contracts by address, with error handling for missing addresses, enhancing robustness and API interaction.


325-337: Introduce useAdminsByContractAddresses hook.

This new hook allows querying admins by contract addresses, with conditional logic to enable queries only when the contractAddresses array is non-empty, improving efficiency.

src/lib/stores/contract.ts (2)

19-19: Addition of codeId is appropriate.

The addition of codeId as an optional property in ContractLocalInfo enhances the data model by allowing more detailed contract information.


Line range hint 233-246:
Inclusion of codeId in updateContractLocalInfo is well-integrated.

The method now supports updating the codeId property, enhancing the contract update functionality.

Ensure that all calls to updateContractLocalInfo correctly handle the new codeId parameter.

Verification successful

Verification Successful: codeId Parameter Handling is Correct

The codeId parameter is correctly integrated into the updateContractLocalInfo function calls across the codebase.

  • src/lib/pages/instantiate/component/InstantiateOffchainForm.tsx
  • src/lib/hooks/useHandleSave.tsx

No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all calls to `updateContractLocalInfo` handle the new `codeId` parameter.

# Test: Search for method usage. Expect: Correct handling of `codeId`.
rg --type typescript -A 5 $'updateContractLocalInfo'

Length of output: 86


Script:

#!/bin/bash
# Description: Verify all calls to `updateContractLocalInfo` handle the new `codeId` parameter.

# Test: Search for method usage. Expect: Correct handling of `codeId`.
rg --type ts -A 5 $'updateContractLocalInfo'

Length of output: 2060

src/lib/app-provider/env.ts (2)

48-48: Addition of ALL_ADMIN_CONTRACTS_BY_ADDRESS is appropriate.

The new key broadens the scope of admin-related queries, potentially enhancing functionality.


168-170: Reintroduction of verification keys is justified.

The keys WASM_VERIFICATION_INFOS, WASM_RELATED_VERIFICATION_INFOS, and MODULE_VERIFY_INFO consolidate verification-related queries, improving clarity.

src/lib/pages/migrate/components/MigrateContract.tsx (3)

92-95: Integration of useDerivedWasmVerifyInfo is well-executed.

The hook enhances schema verification by fetching derived information.


101-103: Replacement of jsonSchema with verifiedSchema and localSchema is appropriate.

This change aligns with improved schema handling, ensuring the component uses the most accurate schema data.

Also applies to: 252-253, 301-302


87-87: Verify the impact of changing isValidJsonInput initial state to true.

Changing the initial state may affect validation logic. Ensure it aligns with the intended functionality.

src/lib/pages/contract-details/index.tsx (4)

79-82: LGTM! Ensure consistent usage of derivedWasmVerifyInfo.

The renaming of relatedWasmVerifyInfo to derivedWasmVerifyInfo and the addition of isDerivedWasmVerifyInfoLoading improve clarity and loading state management. Ensure these changes are consistently applied throughout the file.


107-108: LGTM! Enhanced loading state management.

The conditional rendering now checks both isLoading and isDerivedWasmVerifyInfoLoading, which improves the accuracy of the loading state representation in the UI.


128-128: LGTM! Consistent usage of derivedWasmVerifyInfo.

The update to use derivedWasmVerifyInfo for the wasmVerifyInfo prop ensures consistency across components. Verify that all instances are updated correctly.

Also applies to: 181-181, 187-187, 236-236


38-38: Verify the import path change.

Ensure that the change to a lowercase import path for CommandSection is consistent with the project's naming conventions and that the file path exists.

Verification successful

Import Path Verification Successful

The import path for CommandSection is consistent with the project's directory structure. It correctly points to the index.tsx file within the command-section directory, which is a common practice for simplifying imports.

  • The command-section directory contains an index.tsx file, which is typically used for aggregating exports.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the updated import path for `CommandSection`.

# Test: Check for the existence of the file with the updated path.
fd 'command-section.tsx' --type f

Length of output: 33


Script:

#!/bin/bash
# Description: Search for files with similar names to `command-section` to verify the import path.

# Test: Check for any files with similar names in the expected directory.
fd 'command-section' --type f

Length of output: 29


Script:

#!/bin/bash
# Description: List all files in the `components` directory to identify potential naming issues or missing files.

# Test: List all files in the `components` directory.
fd . --type f --search-path 'src/lib/pages/contract-details/components'

Length of output: 1605

src/lib/pages/instantiate/instantiate.tsx (5)

54-54: LGTM! Import of useDerivedWasmVerifyInfo.

The import of useDerivedWasmVerifyInfo is appropriate for retrieving verification information, enhancing the component's functionality.


84-84: LGTM! Expanded onComplete function signature.

The addition of codeId and instantiator to the onComplete function signature expands the data passed upon completion, which may enhance functionality. Ensure correct implementation throughout the component.


114-114: LGTM! Updated initial state for isValidJsonInput.

Changing the initial state to true affects the validation logic, potentially improving user experience by starting in a valid state.


157-160: LGTM! Integration of useDerivedWasmVerifyInfo.

The usage of useDerivedWasmVerifyInfo to retrieve verification information and set verifiedSchema enhances the component's data verification capabilities.

Also applies to: 165-165


397-400: LGTM! Logic for setting the tab based on localSchema.

The effect correctly prioritizes localSchema, improving the control flow and potentially enhancing user interaction.

Copy link

@coderabbitai coderabbitai bot left a 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

Commits

Files that changed from the base of the PR and between 9ab70ac and 16a836c.

Files selected for processing (2)
  • src/lib/components/modal/wasm-verify-submit/hooks/useWasmOptimizerVersions.ts (1 hunks)
  • src/lib/components/table/contracts/ContractsTable.tsx (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/lib/components/modal/wasm-verify-submit/hooks/useWasmOptimizerVersions.ts
Additional comments not posted (5)
src/lib/components/table/contracts/ContractsTable.tsx (5)

4-4: Import statement is well-placed.

The addition of useWasmVerifyInfos is correctly placed and follows the existing import structure.


43-43: Loading state logic is robust.

The addition of isWasmVerifyInfosFetching to the loading condition ensures the UI accurately reflects the data fetching state.


48-52: Template columns update enhances layout.

The increased minimum widths in templateColumns improve the layout's responsiveness and aesthetics.


68-72: Conditional prop passing improves component functionality.

Passing wasmVerifyInfo based on contractInfo.codeId enhances the child components' ability to utilize verification data.

Also applies to: 101-105


34-41: Efficient use of useWasmVerifyInfos, but optimize reduce.

The hook useWasmVerifyInfos is used effectively to fetch verification data. However, the use of spread syntax in reduce can lead to performance issues. Consider using push instead.

- contracts?.reduce<number[]>((acc, contract) => {
-   if (contract.codeId) acc.push(contract.codeId);
-   return acc;
- }, []) ?? [],
+ (contracts?.reduce<number[]>((acc, contract) => {
+   if (contract.codeId) acc.push(contract.codeId);
+   return acc;
+ }, []) ?? []),

Likely invalid or redundant comment.

Copy link

@coderabbitai coderabbitai bot left a 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

Commits

Files that changed from the base of the PR and between 16a836c and a100e22.

Files selected for processing (4)
  • src/lib/pages/contract-details/components/InstantiateInfo.tsx (3 hunks)
  • src/lib/pages/contract-details/index.tsx (6 hunks)
  • src/lib/pages/upload/completed.tsx (5 hunks)
  • src/lib/services/wasm/contract/index.ts (4 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/lib/pages/contract-details/components/InstantiateInfo.tsx
  • src/lib/pages/contract-details/index.tsx
Additional comments not posted (6)
src/lib/pages/upload/completed.tsx (4)

1-31: Imports are well-organized and necessary.

The newly added imports support the enhanced functionality of the UploadComplete component.


Line range hint 118-206:
UI rendering logic is clear and user-friendly.

The component effectively uses conditional rendering to enhance user experience based on verification status.


Line range hint 191-211:
Navigation logic is intuitive and functional.

The navigation actions are well-implemented, guiding users appropriately based on their actions.


41-54: Component logic enhancements are effective.

The logic for handling verification status and schema attachment is well-structured and improves user experience.

Ensure that getWasmVerifyStatus is correctly integrated and utilized across the codebase.

Verification successful

getWasmVerifyStatus is correctly integrated and utilized across the codebase.

The function is consistently used in various components, ensuring proper handling of verification statuses.

  • Locations where getWasmVerifyStatus is used include components related to upload, public projects, code details, contract details, and more.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage and integration of `getWasmVerifyStatus`.

# Test: Search for the function usage. Expect: Consistent and correct usage across the codebase.
rg --type typescript -A 5 $'getWasmVerifyStatus'

Length of output: 82


Script:

#!/bin/bash
# Description: Verify the usage and integration of `getWasmVerifyStatus`.

# Test: Search for the function usage. Expect: Consistent and correct usage across the codebase.
rg --glob '*.ts' -A 5 $'getWasmVerifyStatus'

Length of output: 451


Script:

#!/bin/bash
# Description: Check for additional usages of `getWasmVerifyStatus` in the codebase.

# Test: Search for all occurrences of `getWasmVerifyStatus` to verify its usage.
rg 'getWasmVerifyStatus'

Length of output: 5764

src/lib/services/wasm/contract/index.ts (2)

313-344: New hooks are well-implemented and functional.

The addition of useAllAdminContractsByAddress and useAdminsByContractAddresses enhances the contract management capabilities.

Verify the integration and usage of these new hooks in the codebase.


117-149: Hook modifications enhance robustness and clarity.

The changes to useInstantiatedContractsByAddress improve error handling and query key clarity.

Verify the usage of updated query keys to ensure consistency across the codebase.

Copy link

@coderabbitai coderabbitai bot left a 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 (3)
src/lib/pages/interact-contract/components/query-area/index.tsx (2)

54-57: Optimize useEffect Dependency Array.

The useEffect dependency array includes JSON.stringify(schema), which might cause unnecessary re-renders. Consider optimizing this if performance issues arise.

- }, [isMobile, JSON.stringify(schema)]);
+ }, [isMobile, schema]);

15-15: Missing Type Definition for CodeSchema.

The type CodeSchema is not defined in the codebase, which may lead to issues if it's used in the file. However, BechAddr32, Nullish, and Option are correctly defined and can be used as intended.

  • BechAddr32 is defined in src/lib/types/addrs.ts.
  • Nullish and Option are defined in src/lib/types/common.ts.

Please verify the usage of CodeSchema or define it if necessary.

Analysis chain

Ensure Type Imports are Correct.

The imported types BechAddr32, CodeSchema, Nullish, and Option should be verified for correctness and usage within the file.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and usage of imported types.

# Test: Search for the type definitions. Expect: Definitions of the types.
rg --type ts --type tsx $'type BechAddr32' && rg --type ts --type tsx $'type CodeSchema' && rg --type ts --type tsx $'type Nullish' && rg --type ts --type tsx $'type Option'

Length of output: 71


Script:

#!/bin/bash
# Description: Verify the existence and usage of imported types.

# Test: Search for the type definitions without specifying file types.
rg 'type BechAddr32' && rg 'type CodeSchema' && rg 'type Nullish' && rg 'type Option'

Length of output: 122


Script:

#!/bin/bash
# Description: Verify the existence of the remaining imported types.

# Test: Search for the type definitions of CodeSchema, Nullish, and Option.
rg 'type CodeSchema' || echo "CodeSchema not found"
rg 'type Nullish' || echo "Nullish not found"
rg 'type Option' || echo "Option not found"

Length of output: 246

src/lib/pages/interact-contract/components/execute-area/schema-execute/index.tsx (1)

10-11: Missing Type Definition for CodeSchema.

The type CodeSchema is imported but not defined in the codebase. Please ensure it is correctly defined or remove the import if it's unnecessary. The other types (BechAddr32, Nullish, and Option) are correctly imported and used.

  • BechAddr32 is defined in src/lib/types/addrs.ts.
  • Nullish and Option are defined in src/lib/types/common.ts.
Analysis chain

Ensure Correct Type Imports.

The imported types BechAddr32, CodeSchema, Nullish, and Option should be verified for correctness and usage within the file.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and usage of imported types.

# Test: Search for the type definitions. Expect: Definitions of the types.
rg --type ts --type tsx $'type BechAddr32' && rg --type ts --type tsx $'type CodeSchema' && rg --type ts --type tsx $'type Nullish' && rg --type ts --type tsx $'type Option'

Length of output: 71


Script:

#!/bin/bash
# Description: Verify the existence and usage of imported types.

# Correct the file type recognition and search for type definitions.
rg --type-add 'ts:*.{ts,tsx}' --type ts 'type BechAddr32'
rg --type-add 'ts:*.{ts,tsx}' --type ts 'type CodeSchema'
rg --type-add 'ts:*.{ts,tsx}' --type ts 'type Nullish'
rg --type-add 'ts:*.{ts,tsx}' --type ts 'type Option'

# Check usage of these types in the specified file.
rg 'BechAddr32|CodeSchema|Nullish|Option' src/lib/pages/interact-contract/components/execute-area/schema-execute/index.tsx

Length of output: 747

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a100e22 and 0e25752.

Files selected for processing (5)
  • src/lib/pages/interact-contract/components/execute-area/index.tsx (4 hunks)
  • src/lib/pages/interact-contract/components/execute-area/schema-execute/index.tsx (6 hunks)
  • src/lib/pages/interact-contract/components/query-area/index.tsx (3 hunks)
  • src/lib/pages/interact-contract/components/query-area/schema-query/index.tsx (3 hunks)
  • src/lib/pages/interact-contract/index.tsx (8 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/lib/pages/interact-contract/components/execute-area/index.tsx
  • src/lib/pages/interact-contract/index.tsx
Additional comments not posted (10)
src/lib/pages/interact-contract/components/query-area/index.tsx (3)

21-22: Review New Props in QueryAreaProps.

The addition of verifiedSchema and localSchema props enhances schema handling. Ensure these changes align with the overall design and usage of the component.


41-42: Schema Handling Logic Update.

The logic for determining the schema now prioritizes verifiedSchema over localSchema. This change should improve schema relevance but verify it aligns with the intended functionality.


99-106: Refactor Conditional Rendering for Schema Content.

The conditional rendering logic for schemaContent is well-structured. Ensure that the components SchemaQuery and UploadSchemaSection handle the props correctly.

src/lib/pages/interact-contract/components/query-area/schema-query/index.tsx (4)

17-18: Review New Props in SchemaQueryProps.

The addition of verifiedSchema and localSchema props enhances schema handling. Ensure these changes align with the overall design and usage of the component.


40-40: Schema Retrieval Logic Update.

The use of getQuerySchema function to retrieve the schema is a good change. Ensure that this function correctly handles the logic for verifiedSchema and localSchema.


83-104: Refactor Conditional Rendering Logic.

The conditional rendering logic for displaying schema-related messages is updated. Ensure that the logic accurately reflects the presence of verifiedSchema and provides meaningful feedback.


10-11: Ensure Correct Store Usage.

The useContractStore should be verified for correct usage and implementation within the context of this component.

Verification successful

Correct Usage of useContractStore Confirmed

The useContractStore hook is defined in src/lib/providers/store.tsx and is used in the specified component as well as in several other files across the codebase. Its usage in the component src/lib/pages/interact-contract/components/query-area/schema-query/index.tsx is confirmed. Further verification of its implementation would require additional context on expected behavior.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and usage of `useContractStore`.

# Test: Search for the hook definition. Expect: Definition of `useContractStore`.
rg --type ts --type tsx $'useContractStore'

Length of output: 70


Script:

#!/bin/bash
# Description: Verify the existence and usage of `useContractStore`.

# Corrected Test: Search for the hook definition. Expect: Definition of `useContractStore`.
rg --type=typescript --type=tsx 'useContractStore'

Length of output: 85


Script:

#!/bin/bash
# Description: Verify the existence and usage of `useContractStore`.

# Corrected Test: Search for the hook definition. Expect: Definition of `useContractStore`.
rg --type=ts --type=tsx 'useContractStore'

Length of output: 70


Script:

#!/bin/bash
# Description: Verify the existence and usage of `useContractStore`.

# Broad Test: Search for the hook definition without specifying file types.
rg 'useContractStore'

Length of output: 5642

src/lib/pages/interact-contract/components/execute-area/schema-execute/index.tsx (3)

16-17: Review New Props in SchemaExecuteProps.

The addition of verifiedSchema and localSchema props enhances schema handling. Ensure these changes align with the overall design and usage of the component.


48-48: Schema Retrieval Logic Update.

The use of getExecuteSchema function to retrieve the schema is a good change. Ensure that this function correctly handles the logic for verifiedSchema and localSchema.


94-115: Refactor Conditional Rendering Logic.

The conditional rendering logic for displaying schema-related messages is updated. Ensure that the logic accurately reflects the presence of verifiedSchema and provides meaningful feedback.

@songwongtp songwongtp merged commit 8406d9e into develop Aug 16, 2024
13 checks passed
@songwongtp songwongtp deleted the feat/contract-verify-ui-upload branch August 16, 2024 10:37
@coderabbitai coderabbitai bot mentioned this pull request Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants