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: evm proxy contract and checksum #1242

Merged
merged 4 commits into from
Feb 20, 2025
Merged

Conversation

songwongtp
Copy link
Collaborator

@songwongtp songwongtp commented Feb 20, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced contract verification displays now present additional proxy target and implementation address details for clearer contract interactions.
  • Improvements

    • Addresses across the platform are now consistently formatted with accurate checksum conversion.
    • UI text updates improve clarity by refining labels, such as appending colons for better legibility.

These updates collectively enhance the transparency and reliability of contract information and address presentation to users.

Copy link

vercel bot commented Feb 20, 2025

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 Feb 20, 2025 10:01am
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
celatone-frontend-main ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2025 10:01am
initia-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2025 10:01am
neutron-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2025 10:01am
osmosis-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2025 10:01am
sei-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2025 10:01am
terra-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2025 10:01am

Copy link

coderabbitai bot commented Feb 20, 2025

Walkthrough

This pull request introduces enhancements in address validation and formatting across the codebase. Major changes include replacing direct type assertions with parsing via zHexAddr.parse and checksum conversions using toChecksumAddress. New properties and components were added to improve EVM proxy contract details and verification flows. Additionally, numerous import statements were updated to use type-only syntax for better type safety and bundling. A new changelog entry documents these improvements.

Changes

File(s) Change Summary
CHANGELOG.md Added new entry for issue #1242: "Improve EVM proxy contract details and checksum address".
src/lib/hooks/useFormatAddresses.ts Enhanced address formatting: added useCelatoneApp hook and introduced formatHexAddress to conditionally use unpadHexAddress or toChecksumAddress with zHexAddr.parse.
src/lib/pages/account-details/components/nfts/NftsSectionSequencer.tsx,
src/lib/pages/account-details/hooks/useAccountRedirect.ts
Updated address handling by replacing direct type assertions with parsing via zHexAddr32.parse or zHexAddr20.parse.
src/lib/pages/contract-details/components/ContractTop.tsx Cosmetic update: added colons to labels (e.g., "Contract Address:" etc.).
src/lib/pages/evm-contract-details/**
(Top, Overview, Interact, etc.)
Enhanced EVM details: replaced simple boolean flags with detailed evmVerifyInfo, added new props (proxyTargetAddress, proxyTargetEvmVerifyInfo), and introduced new components (OverviewProxyTargetInfo, OverviewVerifiedProxyTargetCmds) for richer proxy verification UI.
src/lib/services/evm/json-rpc/proxy/utils.ts Modified readAddress to apply checksum conversion by returning toChecksumAddress(zHexAddr20.parse(address)).
src/lib/services/move/module/index.ts,
src/lib/services/move/resource/index.ts
Updated import syntax and replaced type assertions with parsing functions using zHexAddr.parse for improved address validation.
src/lib/services/searchService.ts Improved NFT search: replaced direct casting to HexAddr32 with parsing (zHexAddr32.parse), added isHex20Bytes to validate addresses, and conditionally applied toChecksumAddress.
src/lib/services/types/tx.ts Added toChecksumAddress transformation within the new schema definitions for zTxJsonRpc and zTxReceiptJsonRpc.
src/lib/utils/address.ts Enhanced address utilities: updated bech32AddressToHex, padHexAddress, and unpadHexAddress to use zHexAddr.parse; modified toChecksumAddress to use a generic type.
src/lib/utils/evm.ts Updated getEvmToAddress to use toChecksumAddress in conjunction with zHexAddr20.parse for proper address validation.
Multiple files (across components, pages, services, types, config, etc.) Converted numerous standard imports to type-only imports for enhanced type safety and optimized bundling.

Sequence Diagram(s)

sequenceDiagram
    participant C as Component
    participant H as useFormatAddresses Hook
    participant CApp as useCelatoneApp
    participant F as formatHexAddress
    participant U as Address Formatter (unpadHexAddress / toChecksumAddress)

    C->>H: Invoke useFormatAddresses
    H->>CApp: Retrieve chain configuration ("move" feature)
    CApp-->>H: Return feature flag
    H->>F: Call formatHexAddress with flag
    F->>U: Conditionally call unpadHexAddress (if move enabled) or toChecksumAddress
    U-->>F: Return formatted address
    F-->>H: Return address parsed via zHexAddr.parse
    H-->>C: Provide final formatted address
Loading
sequenceDiagram
    participant U as User
    participant O as EvmContractDetailsOverview
    participant T as OverviewVerifiedProxyTargetCmds

    U->>O: Request contract details
    O->>O: Check evmVerifyInfo and proxyTargetEvmVerifyInfo status
    alt Proxy Verified
        O->>T: Render proxy target commands component
    else
        O->>O: Render standard verified commands view
    end
    O-->>U: Display updated contract details and commands
Loading

Possibly related PRs

Poem

In the burrows deep, I hop with grace,
Coding addresses with a whiskered pace.
Parsing and checking, a tidy affair,
EVM secrets now handled with care.
My little paws dance in ASCII delight 🐰✨
Celebrating each change, from morning to night!

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/lib/pages/evm-contract-verify/helpers.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in ".eslintrc.json".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

src/lib/types/evm.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in ".eslintrc.json".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-write/index.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in ".eslintrc.json".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

  • 3 others

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aac0fe0 and eb745f3.

📒 Files selected for processing (7)
  • CHANGELOG.md (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewInfo.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-read/index.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-write/index.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/helpers.ts (1 hunks)
  • src/lib/pages/evm-contract-verify/index.tsx (2 hunks)
  • src/lib/types/evm.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-write/index.tsx
  • src/lib/pages/evm-contract-verify/helpers.ts
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewInfo.tsx
  • src/lib/types/evm.ts
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-read/index.tsx
  • src/lib/pages/evm-contract-verify/index.tsx
  • CHANGELOG.md

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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: 1

🧹 Nitpick comments (2)
src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedProxyTargetCmds.tsx (1)

40-46: Consider adding a tooltip for the verification icon.

Adding a tooltip would improve user experience by explaining what the verification icon means.

 <CustomIcon
   name="verification-solid"
   boxSize={4}
   color="secondary.main"
+  title="Contract is verified"
 />
src/lib/pages/evm-contract-details/components/interact-evm-contract/index.tsx (1)

114-136: Improve error handling for proxy contract verification.

The proxy contract UI section should handle the case where proxyTargetEvmVerifyInfo exists but is not verified.

Consider adding an error state:

-      {!!proxyTargetEvmVerifyInfo?.isVerified && (
+      {!!proxyTargetEvmVerifyInfo && (
         <Stack gap={1} mb={8}>
+          {!proxyTargetEvmVerifyInfo.isVerified && (
+            <Text color="text.error">Proxy target contract is not verified</Text>
+          )}
           <Flex gap={2} align="center">
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fda9341 and ed5b7d6.

📒 Files selected for processing (19)
  • CHANGELOG.md (1 hunks)
  • src/lib/hooks/useFormatAddresses.ts (1 hunks)
  • src/lib/pages/account-details/components/nfts/NftsSectionSequencer.tsx (2 hunks)
  • src/lib/pages/account-details/hooks/useAccountRedirect.ts (2 hunks)
  • src/lib/pages/contract-details/components/ContractTop.tsx (3 hunks)
  • src/lib/pages/evm-contract-details/components/EvmContractDetailsTop.tsx (5 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewProxyTargetInfo.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedCmds.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedProxyTargetCmds.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/index.tsx (2 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/index.tsx (3 hunks)
  • src/lib/pages/evm-contract-details/index.tsx (7 hunks)
  • src/lib/services/evm/json-rpc/proxy/utils.ts (2 hunks)
  • src/lib/services/move/module/index.ts (2 hunks)
  • src/lib/services/move/resource/index.ts (4 hunks)
  • src/lib/services/searchService.ts (3 hunks)
  • src/lib/services/types/tx.ts (2 hunks)
  • src/lib/utils/address.ts (5 hunks)
  • src/lib/utils/evm.ts (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/lib/pages/contract-details/components/ContractTop.tsx
🔇 Additional comments (40)
src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedCmds.tsx (3)

1-11: LGTM! Clean imports and well-defined types.

The imports are properly organized and the interface is well-typed with HexAddr20 and EvmVerifyInfo.


13-18: LGTM! Clean and efficient implementation.

The component efficiently categorizes ABI operations and maintains a clean implementation without unnecessary complexity.


19-50:

✅ Verification successful

Verify theme color and approve responsive layout.

The UI structure implements responsive design effectively and maintains a clear visual hierarchy. However, let's verify that the color token "secondary.main" exists in the theme.


🏁 Script executed:

#!/bin/bash
# Search for theme configuration files
echo "Searching for theme configuration files..."
fd -e ts -e js -e json "theme|colors" src

# Search for "secondary.main" color token usage
echo "Searching for secondary.main color token usage..."
rg "secondary.main" -A 2 -B 2

Length of output: 9759


Theme token verified; UI layout approved.

  • The color token "secondary.main" is confirmed to be defined and used consistently in the theme (e.g., in src/lib/styles/theme/components/button.ts and other component style files).
  • The responsive layout and visual hierarchy using Chakra UI components are implemented correctly.
src/lib/pages/evm-contract-details/components/EvmContractDetailsTop.tsx (3)

13-15: Interface extension looks good.
These additions for evmVerifyInfo, proxyTargetAddress, and proxyTargetEvmVerifyInfo allow rendering more comprehensive contract verification data and proxy targeting details.


77-97: Proxy contract details implementation is well-structured.
Conditionally displaying the implementation address and associated verification status is straightforward. Just ensure upstream data (e.g., proxyTargetAddress) is always a valid, parsable address to prevent any unexpected behavior in external explorers.


100-136: Conditional Read/Write display is consistent.
Showing the read/write buttons only when the contract is verified aligns with common practice, preventing users from interfacing with an unverified ABI. This approach is user-friendly and lowers risks of invalid interaction attempts.

src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewProxyTargetInfo.tsx (2)

7-10: Strong prop typing.
Defining proxyTargetAddressHex and proxyTargetEvmVerifyInfo in their own interface is helpful for clarity and maintainability.


12-43: New component cleanly renders proxy details.
This modular approach is well-structured, providing dedicated rendering for proxy target information, including Explorer links and verification icons. The code effectively checks isVerified before rendering the “verification-solid” icon.

src/lib/hooks/useFormatAddresses.ts (3)

13-18: Appropriate feature-flag approach.
Conditionally using unpadHexAddress for Move chains and toChecksumAddress otherwise keeps address formatting flexible and consistent with chain-specific requirements.


22-28: Helper function extraction is good practice.
formatHexAddress encapsulates chain-specific logic, improving readability and making it simpler to adapt if more chain conditions arise.


34-44: Improved validation with zod parsers.
Replacing direct type casting with zHexAddr.parse and zBechAddr.parse provides robust validations, catching bad data earlier. The fallback to checksum formatting ensures consistent representation for EVM chains.

src/lib/pages/account-details/hooks/useAccountRedirect.ts (2)

9-14: LGTM! Good practice using explicit type imports.

The explicit type imports improve code readability and maintainability.


32-32: LGTM! Safer address handling with parsing.

Replacing type casting with zHexAddr20.parse is a better approach as it validates the address format at runtime.

src/lib/services/evm/json-rpc/proxy/utils.ts (2)

2-2: LGTM! Good practice importing checksum utility.

The toChecksumAddress import adds important address validation functionality.


20-20: LGTM! Enhanced address validation with checksum.

The combination of zHexAddr20.parse and toChecksumAddress ensures proper address validation and formatting.

src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedProxyTargetCmds.tsx (2)

10-13: LGTM! Well-defined props interface.

The props interface clearly defines the required types for the component.


21-22: LGTM! Safe handling of optional ABI data.

Good use of optional chaining and default empty array to prevent runtime errors.

src/lib/pages/evm-contract-details/components/evm-contract-details-overview/index.tsx (2)

19-19: LGTM! Clean import of new component.

The import follows the established pattern in the file.


73-78: LGTM! Clear conditional rendering logic.

The component is only rendered when the proxy target is verified, which is the correct behavior.

src/lib/services/move/resource/index.ts (2)

9-10: LGTM! Enhanced type safety with zHexAddr.

The switch from type casting to using zHexAddr parser improves runtime validation of addresses.


43-43: Consistent use of address parsing.

Good use of zHexAddr.parse() for validating addresses across all instances. This ensures addresses are properly validated before being used.

Also applies to: 52-52, 72-72

src/lib/pages/account-details/components/nfts/NftsSectionSequencer.tsx (2)

9-14: LGTM! Improved type imports organization.

Good organization of type imports and addition of zHexAddr32 for address validation.


80-80: Enhanced address validation for collection addresses.

Using zHexAddr32.parse() ensures collection addresses are properly validated before being used in the UI.

src/lib/utils/address.ts (2)

12-12: LGTM! Consistent address validation.

Good use of zHexAddr.parse() across all address transformation functions, ensuring consistent validation.

Also applies to: 38-38, 41-41, 44-44


86-113:

✅ Verification successful

Verify empty string handling in toChecksumAddress.

The function returns an empty string when the keccak hash matches a specific value. Please verify this behavior aligns with EIP-55 checksum address specification.


🌐 Web query:

What does EIP-55 specify for handling empty strings in checksum address calculation?

💡 Result:

EIP-55 does not directly handle empty strings in checksum calculations because its specification requires valid 40-character hexadecimal addresses as input. The standard operates under these key constraints:

  1. Address Structure
    Ethereum addresses must be 40 hex characters prefixed with 0x, making empty strings invalid by definition[2][6].

  2. Checksum Process
    The algorithm:

    • Removes the 0x prefix
    • Converts remaining characters to lowercase
    • Computes Keccak-256 hash of this normalized string[1][7]
    • Uses hash bits to determine uppercase letters in final checksum[3][8]
  3. Edge Case Implications
    While not explicitly mentioned in EIP-55 documentation[1][7], an empty input would fail at multiple stages:

    • Length validation (minimum 40 chars required after 0x removal)
    • Hashing step would process zero-length input as keccak256("")
      This produces fixed hash c5d246...d85a470 per Ethereum Yellow Paper[2], but since empty input isn't a valid address format, this scenario never occurs in proper implementations.

The specification implicitly assumes non-empty inputs through its requirement for standard Ethereum address formatting[1][3][7]. Wallet implementations typically validate address length before applying checksum logic[4][9].

Citations:


Clarification on Empty Input Handling in toChecksumAddress

After verifying with the EIP-55 specification, it’s clear that the standard only defines behavior for valid 40-character hexadecimal addresses (prefixed with "0x") and does not directly address empty strings. Since an empty input is already invalid by definition, the current implementation’s approach—returning an empty string when the keccak hash matches that of an empty input—serves as a safeguard for such invalid cases. This behavior is acceptable given that proper address validation (ensuring a 40-character hex string) should occur before invoking this function.

src/lib/utils/evm.ts (2)

3-3: LGTM! Added zHexAddr20 for EVM address validation.

Good addition of zHexAddr20 for proper EVM address validation.


39-39:

✅ Verification successful

Verify EVM address parsing from input data.

The code correctly uses toChecksumAddress with zHexAddr20.parse(), but please verify the slice operations for extracting addresses from input data:

  • Line 39: input.slice(34, 74) for TransferErc20
  • Line 49: Direct use of contractAddress for Create
  • Line 60: Direct use of contractAddress from logs for CallErc20Factory

Also applies to: 49-49, 60-60, 68-68


🌐 Web query:

What are the standard positions for addresses in EVM transaction input data for ERC20 transfer method?

💡 Result:

In Ethereum ERC-20 token transfers using the transfer method, addresses and values are encoded in specific positions within transaction input data:

Input Data Structure

The input data for an ERC-20 transfer call follows this hexadecimal format:

0xa9059cbb                                 // Method ID (4 bytes)
000000000000000000000000<recipient_address> // Recipient address (32 bytes)
0000000000000000000000000000000000000000<value> // Transfer amount (32 bytes)

Key Positions

  1. Recipient Address

    • Starts at byte position 4 (after Method ID)
    • Occupies 32 bytes total
    • Padded with leading zeros to fill 32 bytes
      Example:
      0x311d373126efae95e261deff004ff245021739d1 becomes
      000000000000000000000000311d373126efae95e261deff004ff245021739d1
  2. Transfer Value

    • Starts at byte position 36 (after Method ID + address)
    • Occupies 32 bytes as a uint256 value
    • Encoded in hexadecimal with leading zeros
      Example:
      600.856457 USDT (0x23d05789 in hex) becomes
      0000000000000000000000000000000000000000000000000000000023d05789

Technical Breakdown

Component Byte Range Length Encoding Rule
Method ID 0-3 4 First 4 bytes of SHA3("transfer(address,uint256)")
Recipient 4-35 32 Left-padded to 32 bytes
Value 36-67 32 Left-padded hexadecimal integer

This structure derives from Ethereum's ABI encoding specifications[1][3][7]. All ERC-20 compliant contracts follow this format for standard token transfers[3][7][10].

Citations:


EVM Address Parsing Verified

After reviewing the ERC-20 transfer input data standard, the slicing operation on line 39 is correct. Given that the full recipient field is 32 bytes (64 hex characters) with left-padding, slicing input.slice(34, 74) effectively extracts the actual 20-byte (40 hex characters) address from the padded field.

  • Line 39: The slice operation correctly obtains the recipient address from the ERC20 transfer data.
  • Line 49 & 60 (and 68): Directly using the provided contractAddress for Create and Call operations is acceptable provided these addresses are already validated and checksummed.

No changes are necessary regarding how the address extraction is performed based on the ERC-20 ABI encoding specifications.

src/lib/pages/evm-contract-details/components/interact-evm-contract/index.tsx (3)

22-28: LGTM! Props interface changes improve type safety.

The changes to InteractEvmContractProps interface enhance type safety by using Option<EvmVerifyInfo> instead of direct ABI array. This provides better control over verification status and proxy information.


50-52: LGTM! ABI categorization uses verification info.

The change to use evmVerifyInfo?.abi for ABI categorization is correct and aligns with the new verification-based approach.


44-46:

✅ Verification successful

Verify proxy contract interaction logic.

The condition for proxy interaction has been updated to handle both verification status and proxy type. Please ensure that this change doesn't affect existing proxy contracts.

Run the following script to verify the proxy contract handling:


🏁 Script executed:

#!/bin/bash
# Description: Search for proxy contract interactions to ensure compatibility.

# Test: Search for proxy contract usage patterns
rg -A 5 'isAsProxy|proxyTargetEvmVerifyInfo'

Length of output: 23981


Proxy Contract Interaction Logic Verified

After executing the verification script, the usage of the isAsProxy condition appears consistent across the codebase. In particular, the condition:

const isAsProxy =
  !evmVerifyInfo?.isVerified ||
  (!!proxyTargetEvmVerifyInfo?.isVerified && selectedType.endsWith("proxy"));

is utilized in multiple files (e.g., in the interact-evm-contract component, as well as in overview components) to correctly determine proxy interaction. This updated logic adequately handles both verification status and proxy type, and no conflicting behavior was observed for existing proxy contracts.

No further changes are required based on the current analysis.

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

27-27: LGTM! Import statement includes address utilities.

The addition of toChecksumAddress import improves address handling consistency.


68-75: LGTM! Loading state renamed for clarity.

The change from isLoading to isFetching better represents the asynchronous state.


151-154:

❓ Verification inconclusive

Verify Read/Write tab visibility logic.

The condition for showing the Read/Write tab has been updated to check both contract and proxy target verification status.

Run the following script to verify the tab visibility logic:


🏁 Script executed:

#!/bin/bash
# Description: Search for Read/Write tab visibility conditions.

# Test: Search for tab visibility patterns
rg -A 5 'hidden.*evmVerifyInfo|hidden.*proxyTargetEvmVerifyInfo'

Length of output: 66


Action Required: Confirm Read/Write Tab Visibility Behavior

The updated logic:

hidden={
  !evmVerifyInfo?.isVerified &&
  !proxyTargetEvmVerifyInfo?.isVerified
}

appears to implement the intended behavior—making the Read/Write tab visible if either the contract or the proxy target is verified (i.e. the tab is hidden only when both are unverified). However, our automated search (using the provided rg command) did not return any output for visibility conditions in the repository. This outcome prevents us from being fully confident that the logic is applied consistently in the codebase.

Next Steps:

  • Please manually verify in src/lib/pages/evm-contract-details/index.tsx (lines 151–154) that the Read/Write tab visibility behaves as expected.
  • Confirm that any changes to verification statuses elsewhere in the component do not inadvertently override this behavior.
  • Double-check that no additional conditions affect the visibility of the Read/Write tab that might conflict with this logic.
src/lib/services/move/module/index.ts (2)

26-36: LGTM! Import syntax updated for better type handling.

The changes to import syntax improve type handling by explicitly marking type imports.


169-169: LGTM! Address parsing uses proper validation.

The change from type casting to zHexAddr.parse ensures proper address validation.

src/lib/services/types/tx.ts (2)

438-464: LGTM! Transaction schema includes address validation.

The transformation of from and to addresses using toChecksumAddress ensures consistent address format.


466-487: LGTM! Receipt schema maintains consistent address handling.

The receipt schema follows the same address transformation pattern, ensuring consistency across the codebase.

src/lib/services/searchService.ts (2)

12-12: LGTM! New imports enhance address validation capabilities.

The additions of zHexAddr20, isHex20Bytes, and toChecksumAddress improve the robustness of address handling.

Also applies to: 16-16, 23-23


360-363: LGTM! Proper EVM address handling with checksum.

The conditional checksum conversion for EVM addresses enhances address format consistency.

CHANGELOG.md (1)

82-82: LGTM! Changelog entry follows the standard format.

The entry is properly placed under "Improvements" and includes the PR number and a clear description.

@@ -149,13 +151,13 @@ export const useSearchHandler = (
/// /////////////////////////////////////////////////////

const { data: nftData, isFetching: nftFetching } = useNftByNftAddressLcd(
debouncedKeyword as HexAddr32,
zHexAddr32.parse(debouncedKeyword),
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify NFT data parsing error handling.

The change from direct casting to zHexAddr32.parse() improves type safety, but we should ensure proper error handling when parsing fails.

Run this script to check for error handling in NFT-related functions:

Also applies to: 160-160


🏁 Script executed:

#!/bin/bash
# Search for try-catch blocks or error handling around zHexAddr32.parse
rg -A 5 "zHexAddr32\.parse" 

Length of output: 1508


Action Required: Add Error Handling for NFT Data Parsing

While changing to zHexAddr32.parse() does improve type safety, our search shows that neither src/lib/services/searchService.ts (lines 154 and 160) nor the NFT-related usage in src/lib/pages/account-details/components/nfts/NftsSectionSequencer.tsx include explicit error handling (e.g., try-catch blocks) around the parse calls. Please consider adding proper error handling to gracefully manage cases where parsing fails.

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

🧹 Nitpick comments (14)
src/lib/pages/evm-contract-verify/components/ConstructorArgs.tsx (1)

49-63: Enhance validation and user guidance for constructor arguments.

Consider the following improvements for better user experience:

  1. Add hex format validation for constructor arguments
  2. Provide more specific error messages
  3. Add helper text explaining the expected format

Apply this diff to implement the suggestions:

         <ControllerTextarea
           backgroundColor="gray.900"
           name={`${name}.value` as FieldPath<T>}
           control={control}
           isRequired
           label="Constructor Arguments"
-          placeholder="ex.000000000000000000000000c005dc82818d67af737725bd4bf75435d065d239"
+          placeholder="e.g., 000000000000000000000000c005dc82818d67af737725bd4bf75435d065d239"
           variant="fixed-floating"
           labelBgColor="gray.900"
+          helperText="Enter constructor arguments as a hex string without '0x' prefix"
           error={
-            constructorArgsValue === ""
-              ? "Invalid constructor arguments"
+            !constructorArgsValue
+              ? "Constructor arguments are required"
+              : !/^[0-9a-fA-F]+$/.test(constructorArgsValue)
+              ? "Constructor arguments must be a valid hex string without '0x' prefix"
               : undefined
           }
         />
src/lib/services/evm/index.ts (2)

33-33: Consider enhancing error messages.

The error messages could be more descriptive to help with debugging. Consider including additional context such as the chain ID or configuration details.

Example improvement:

-      if (!evm.enabled) throw new Error("EVM is not enabled (useEvmParams)");
+      if (!evm.enabled) throw new Error(`EVM is not enabled for chain ${chainConfig.chainId} (useEvmParams)`);

Also applies to: 104-104, 133-134


36-43: Consider extracting common query configurations.

Multiple hooks share similar query configurations. Consider extracting these into a shared constant or helper function to reduce duplication and maintain consistency.

Example implementation:

const DEFAULT_EVM_QUERY_CONFIG = {
  retry: false,
  refetchOnWindowFocus: false,
  refetchOnMount: false,
} as const;

// Usage in hooks
{
  ...DEFAULT_EVM_QUERY_CONFIG,
  enabled: evm.enabled,
  ...options,
}

Also applies to: 54-59, 76-81, 107-114, 137-144

src/lib/pages/evm-contract-verify/helpers.ts (1)

1-4: LGTM! Consider grouping related imports.

The changes improve type safety by using type-only imports. The imports are correctly separated between type imports and value imports.

Consider grouping related imports from lib/types together:

-import type { HexAddr20, Option } from "lib/types";
-import { zHexAddr20 } from "lib/types";
-import type { EvmContractVerifyForm, EvmVerifyConfig } from "lib/types";
-import { EvmProgrammingLanguage } from "lib/types";
+import type { HexAddr20, Option, EvmContractVerifyForm, EvmVerifyConfig } from "lib/types";
+import { zHexAddr20, EvmProgrammingLanguage } from "lib/types";
src/lib/pages/evm-contract-verify/components/EvmContractVerifyOptions.tsx (1)

7-9: Rename interface to match component name.

The interface name EvmContractVerifyVyperProps doesn't match the component name EvmContractVerifyOptions. This could be confusing as the interface is used for the options component, not just for Vyper-specific props.

Apply this diff:

-interface EvmContractVerifyVyperProps {
+interface EvmContractVerifyOptionsProps {
   control: Control<EvmContractVerifyForm>;
 }

And update the component props:

-}: EvmContractVerifyVyperProps) => {
+}: EvmContractVerifyOptionsProps) => {
src/lib/pages/evm-contract-verify/components/evm-contract-verify-modal/EvmContractVerifyModalBody.tsx (1)

22-32: Consider using a more robust loading state implementation.

The current implementation uses a setTimeout to simulate loading, which could lead to inconsistencies if the actual loading state changes during the timeout.

Consider using this pattern instead:

-  const [fakeLoading, setFakeLoading] = useState(false);
+  const [showLoading, setShowLoading] = useState(false);
 
   useEffect(() => {
-    setFakeLoading(true);
+    if (isLoading) {
+      setShowLoading(true);
+    } else {
+      const timeoutId = setTimeout(() => {
+        setShowLoading(false);
+      }, 1500);
 
-    const timeoutId = setTimeout(() => {
-      setFakeLoading((newFakeLoading) => !newFakeLoading);
-    }, 1500);
-
-    return () => clearTimeout(timeoutId);
+      return () => clearTimeout(timeoutId);
+    }
   }, [isLoading]);
src/lib/pages/evm-contract-verify/components/solidity/EvmContractVerifySolidityHardhat.tsx (1)

29-31: Consider making Solidity version configurable.

The hardcoded Solidity version in the Hardhat configuration template could lead to confusion if it doesn't match the actual contract's version.

Consider making it dynamic:

-  solidity: "v0.8.28", // replace with your solidity version
+  solidity: "${useWatch({ control, name: 'compilerVersion' }) || 'v0.8.28'}", // dynamically use selected compiler version
src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedProxyTargetCmds.tsx (2)

21-22: Consider improving null safety handling.

The optional chaining with nullish coalescing could be simplified.

-  const { read: proxyTargetAbiRead, write: proxyTargetAbiWrite } =
-    categorizeAbi(proxyTargetEvmVerifyInfo?.abi ?? []);
+  const { read: proxyTargetAbiRead, write: proxyTargetAbiWrite } =
+    categorizeAbi(proxyTargetEvmVerifyInfo.abi);

Since proxyTargetEvmVerifyInfo is required by the props interface, the optional chaining is unnecessary.


49-60: Consider matching parent component's responsive design.

The parent component uses a column layout on mobile, but this component maintains a row layout which might cause inconsistency.

-      <Flex gap={4} width="full">
+      <Flex
+        gap={4}
+        width="full"
+        flexDirection={{
+          base: "column",
+          md: "row",
+        }}
+      >
src/lib/pages/evm-contract-details/components/interact-evm-contract/index.tsx (3)

46-48: Verify proxy contract detection logic.

The proxy detection logic has been updated to consider both verification states. However, the condition might be more readable with explicit parentheses.

Consider this more explicit version:

-  !evmVerifyInfo?.isVerified ||
-  (!!proxyTargetEvmVerifyInfo?.isVerified && selectedType.endsWith("proxy"));
+  (!evmVerifyInfo?.isVerified) ||
+  (proxyTargetEvmVerifyInfo?.isVerified === true && selectedType.endsWith("proxy"));

52-54: Verify ABI access safety.

The code safely handles undefined ABI with the nullish coalescing operator, but there's room for improvement in type safety.

Consider adding runtime type checking:

-  const { read: abiRead, write: abiWrite } = categorizeAbi(
-    evmVerifyInfo?.abi ?? []
-  );
+  const { read: abiRead, write: abiWrite } = categorizeAbi(
+    Array.isArray(evmVerifyInfo?.abi) ? evmVerifyInfo.abi : []
+  );

116-138: Verify proxy contract UI state handling.

The proxy contract UI state handling looks good, with appropriate checks for verification status. However, consider adding a tooltip to explain why the switch is disabled.

Add a tooltip to improve UX:

 <Switch
   isChecked={isAsProxy}
   onChange={handleSetIsAsProxy}
   isDisabled={!evmVerifyInfo?.isVerified}
+  title={!evmVerifyInfo?.isVerified ? "Contract must be verified to interact as proxy" : ""}
 />
src/lib/pages/evm-contract-details/index.tsx (2)

107-113: Verify loading state completeness.

The loading state checks are comprehensive, but consider adding a timeout to prevent infinite loading.

Consider adding a timeout using React Query's staleTime option in the respective hooks:

const { data: evmVerifyInfo, isFetching: isEvmVerifyInfoFetching } = useEvmVerifyInfo(
  contractAddress,
  { staleTime: 30000 } // 30 seconds
);

147-150: Verify tab visibility logic.

The tab visibility logic correctly considers both contract and proxy verification states. However, consider extracting this logic to a utility function for reusability and testing.

Consider this refactor:

const isReadWriteTabVisible = (
  contractVerified?: boolean,
  proxyVerified?: boolean
): boolean => !!(contractVerified || proxyVerified);

// Usage:
hidden={!isReadWriteTabVisible(
  evmVerifyInfo?.isVerified,
  proxyTargetEvmVerifyInfo?.isVerified
)}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed5b7d6 and aac0fe0.

📒 Files selected for processing (91)
  • .eslintrc.json (1 hunks)
  • src/config/theme/index.ts (1 hunks)
  • src/lib/app-fns/tx/common/postEvm.tsx (1 hunks)
  • src/lib/app-fns/tx/common/sendingEvm.tsx (1 hunks)
  • src/lib/app-fns/tx/evm/requestEvm.tsx (1 hunks)
  • src/lib/app-provider/hooks/useSignAndBroadcastEvm.ts (1 hunks)
  • src/lib/app-provider/tx/evm/requestEvm.ts (1 hunks)
  • src/lib/components/ContractCmdButton.tsx (1 hunks)
  • src/lib/components/EstimatedFeeEvmRender.tsx (1 hunks)
  • src/lib/components/UserDocsLink.tsx (1 hunks)
  • src/lib/components/editor/EditorFileBody.tsx (1 hunks)
  • src/lib/components/editor/EditorSidebar.tsx (1 hunks)
  • src/lib/components/editor/EditorTop.tsx (1 hunks)
  • src/lib/components/editor/FullEditor.tsx (1 hunks)
  • src/lib/components/editor/FullEditorSidebarMobile.tsx (1 hunks)
  • src/lib/components/editor/helpers.ts (1 hunks)
  • src/lib/components/editor/types.ts (1 hunks)
  • src/lib/components/evm-abi/EvmAbiForm.tsx (1 hunks)
  • src/lib/components/evm-abi/fields/BaseField.tsx (1 hunks)
  • src/lib/components/evm-abi/fields/BoolField.tsx (1 hunks)
  • src/lib/components/evm-abi/fields/Field.tsx (1 hunks)
  • src/lib/components/evm-abi/fields/FieldTemplate.tsx (1 hunks)
  • src/lib/components/evm-abi/fields/TupleField.tsx (1 hunks)
  • src/lib/components/evm-abi/fields/index.tsx (1 hunks)
  • src/lib/components/evm-abi/fields/types.ts (1 hunks)
  • src/lib/components/evm-abi/fields/utils.ts (1 hunks)
  • src/lib/components/evm-abi/utils.ts (1 hunks)
  • src/lib/components/evm-verify-section/FailedDetails.tsx (1 hunks)
  • src/lib/components/evm-verify-section/InProgressDetails.tsx (1 hunks)
  • src/lib/components/evm-verify-section/index.tsx (1 hunks)
  • src/lib/components/modal/evm-verify-status/EvmVerifyProcess.tsx (1 hunks)
  • src/lib/components/modal/evm-verify-status/EvmVerifyRequestInfo.tsx (1 hunks)
  • src/lib/components/modal/evm-verify-status/index.tsx (1 hunks)
  • src/lib/components/modal/evm-verify-status/utils.ts (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-contract-info/ContractAbi.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-contract-info/ContractByteCode.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-contract-info/ContractCode.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-contract-info/ContractLibraryList.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-contract-info/index.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/EvmContractCmdGroup.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/Optimizer.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewInfo.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewProxyTargetInfo.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedCmds.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedInfo.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedProxyTargetCmds.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/index.tsx (2 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-read/ReadBox.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-read/index.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-write/WriteBox.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-write/index.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/index.tsx (4 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/utils.ts (1 hunks)
  • src/lib/pages/evm-contract-details/index.tsx (7 hunks)
  • src/lib/pages/evm-contract-verify/components/ConstructorArgs.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/ContractLibraries.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/ContractLibrary.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/EvmContractVerifyForms.tsx (2 hunks)
  • src/lib/pages/evm-contract-verify/components/EvmContractVerifyOptions.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/EvmVersionToTarget.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/OptimizerConfiguration.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/evm-contract-verify-modal/EvmContractVerifyModalBody.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/evm-contract-verify-modal/EvmContractVerifySuccessModal.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/evm-contract-verify-modal/index.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/solidity/EvmContractVerifySolidityContractCode.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/solidity/EvmContractVerifySolidityFoundry.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/solidity/EvmContractVerifySolidityHardhat.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/solidity/EvmContractVerifySolidityJsonInput.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/solidity/EvmContractVerifySolidityUploadFiles.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/vyper/EvmContractVerifyVyperContractCode.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/vyper/EvmContractVerifyVyperJsonInput.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/vyper/EvmContractVerifyVyperUploadFile.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/helpers.ts (1 hunks)
  • src/lib/pages/evm-contract-verify/index.tsx (2 hunks)
  • src/lib/pages/tx-details/components/TxInfo.tsx (1 hunks)
  • src/lib/pages/tx-details/components/TxInfoMobile.tsx (1 hunks)
  • src/lib/services/chain-config/api.ts (1 hunks)
  • src/lib/services/chain-config/index.ts (1 hunks)
  • src/lib/services/evm/index.ts (2 hunks)
  • src/lib/services/evm/json-rpc/eth.ts (1 hunks)
  • src/lib/services/evm/json-rpc/proxy/index.ts (1 hunks)
  • src/lib/services/evm/json-rpc/proxy/types.ts (1 hunks)
  • src/lib/services/evm/json-rpc/proxy/utils.ts (2 hunks)
  • src/lib/services/tx/jsonRpc.ts (1 hunks)
  • src/lib/services/tx/simulateFeeEvm.ts (1 hunks)
  • src/lib/services/types/verification/evm.ts (1 hunks)
  • src/lib/services/verification/evm/api.ts (2 hunks)
  • src/lib/services/verification/evm/index.ts (1 hunks)
  • src/lib/services/verification/evm/utils.ts (1 hunks)
  • src/lib/types/evm.ts (1 hunks)
  • src/lib/utils/evm.ts (4 hunks)
✅ Files skipped from review due to trivial changes (65)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-contract-info/ContractByteCode.tsx
  • src/lib/components/UserDocsLink.tsx
  • src/lib/components/editor/types.ts
  • src/lib/services/evm/json-rpc/eth.ts
  • src/lib/types/evm.ts
  • src/lib/components/modal/evm-verify-status/utils.ts
  • src/lib/components/evm-abi/fields/utils.ts
  • src/lib/services/evm/json-rpc/proxy/types.ts
  • src/lib/components/evm-verify-section/FailedDetails.tsx
  • src/lib/components/evm-abi/fields/BaseField.tsx
  • src/lib/pages/evm-contract-verify/components/ContractLibrary.tsx
  • src/lib/components/editor/EditorSidebar.tsx
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewInfo.tsx
  • src/lib/services/tx/jsonRpc.ts
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/EvmContractCmdGroup.tsx
  • src/lib/components/evm-abi/fields/BoolField.tsx
  • src/lib/components/ContractCmdButton.tsx
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/utils.ts
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/Optimizer.tsx
  • src/lib/app-fns/tx/common/postEvm.tsx
  • src/lib/services/tx/simulateFeeEvm.ts
  • src/lib/pages/evm-contract-details/components/evm-contract-details-contract-info/ContractLibraryList.tsx
  • src/lib/pages/evm-contract-verify/components/vyper/EvmContractVerifyVyperJsonInput.tsx
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-write/index.tsx
  • src/lib/services/chain-config/index.ts
  • src/lib/components/modal/evm-verify-status/EvmVerifyProcess.tsx
  • src/lib/pages/evm-contract-verify/components/ContractLibraries.tsx
  • src/lib/components/modal/evm-verify-status/index.tsx
  • src/lib/pages/evm-contract-verify/components/solidity/EvmContractVerifySolidityFoundry.tsx
  • src/lib/pages/evm-contract-verify/components/vyper/EvmContractVerifyVyperContractCode.tsx
  • src/lib/pages/evm-contract-verify/index.tsx
  • src/lib/app-fns/tx/evm/requestEvm.tsx
  • src/lib/pages/evm-contract-verify/components/OptimizerConfiguration.tsx
  • src/lib/components/evm-abi/fields/index.tsx
  • src/lib/components/evm-abi/fields/types.ts
  • src/lib/pages/tx-details/components/TxInfo.tsx
  • src/lib/services/chain-config/api.ts
  • src/lib/components/editor/helpers.ts
  • src/lib/app-provider/tx/evm/requestEvm.ts
  • src/lib/components/evm-abi/EvmAbiForm.tsx
  • src/lib/components/evm-verify-section/InProgressDetails.tsx
  • src/lib/components/editor/EditorTop.tsx
  • src/lib/pages/evm-contract-details/components/evm-contract-details-contract-info/index.tsx
  • src/lib/components/editor/FullEditorSidebarMobile.tsx
  • src/lib/components/evm-abi/fields/FieldTemplate.tsx
  • src/lib/pages/evm-contract-verify/components/EvmContractVerifyForms.tsx
  • src/lib/components/evm-abi/utils.ts
  • src/lib/app-provider/hooks/useSignAndBroadcastEvm.ts
  • src/lib/pages/evm-contract-verify/components/vyper/EvmContractVerifyVyperUploadFile.tsx
  • src/lib/pages/evm-contract-verify/components/solidity/EvmContractVerifySolidityUploadFiles.tsx
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-write/WriteBox.tsx
  • src/lib/pages/evm-contract-details/components/evm-contract-details-contract-info/ContractCode.tsx
  • src/lib/pages/evm-contract-verify/components/solidity/EvmContractVerifySolidityContractCode.tsx
  • src/lib/components/EstimatedFeeEvmRender.tsx
  • src/lib/services/verification/evm/index.ts
  • src/lib/components/evm-abi/fields/Field.tsx
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-read/index.tsx
  • src/lib/services/evm/json-rpc/proxy/index.ts
  • src/lib/components/modal/evm-verify-status/EvmVerifyRequestInfo.tsx
  • src/lib/components/evm-abi/fields/TupleField.tsx
  • src/lib/services/types/verification/evm.ts
  • src/lib/components/evm-verify-section/index.tsx
  • src/lib/pages/evm-contract-verify/components/solidity/EvmContractVerifySolidityJsonInput.tsx
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-read/ReadBox.tsx
  • src/lib/services/verification/evm/api.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/lib/utils/evm.ts
  • src/lib/services/evm/json-rpc/proxy/utils.ts
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewProxyTargetInfo.tsx
🔇 Additional comments (25)
src/config/theme/index.ts (1)

5-5: LGTM! Good use of type-only import.

The change to use import type is a good practice as it explicitly indicates that Option is used only for type checking, which helps with code clarity and bundle size optimization.

src/lib/pages/evm-contract-verify/components/EvmVersionToTarget.tsx (2)

3-4: LGTM! Import statements are properly organized.

The separation of type-only imports from value imports improves code clarity and follows TypeScript best practices.

Also applies to: 6-7


10-68: LGTM! Component implementation is robust and type-safe.

The component demonstrates good practices:

  • Generic type parameters for form values
  • Proper type safety with react-hook-form
  • Clear separation of UI and logic
  • Helpful user guidance with descriptive text
src/lib/app-fns/tx/common/sendingEvm.tsx (1)

4-4: LGTM! Good TypeScript practice.

Converting to a type-only import is appropriate here since SimulatedFeeEvm is only used as a type annotation. This change helps with tree-shaking and makes the code's intent clearer.

src/lib/pages/evm-contract-details/components/evm-contract-details-contract-info/ContractAbi.tsx (1)

2-2: LGTM! Good use of type-only import.

The change to use a type-only import for JsonFragment is appropriate since it's only used for type annotations. This helps with tree-shaking and potentially reduces the bundle size.

src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedInfo.tsx (1)

3-3: LGTM! Good use of type-only import.

The change to use a type-only import for EvmVerifyInfo is appropriate since it's only used for type annotations. This helps with tree-shaking and potentially reduces the bundle size.

.eslintrc.json (1)

29-36: Enforcing Consistent Type Imports

The new rule @typescript-eslint/consistent-type-imports is added correctly with appropriate options. The configuration enforces type-only imports with a clear and consistent style, aligning well with the PR objectives.

src/lib/pages/tx-details/components/TxInfoMobile.tsx (1)

9-9: LGTM! Type-only import improves code clarity and bundle optimization.

The change to use the type keyword for importing Option and Ratio types follows TypeScript best practices. This helps the bundler optimize the code by clearly indicating these imports are only used for type checking and will be erased at runtime.

src/lib/components/editor/EditorFileBody.tsx (1)

1-3: LGTM! Good use of type-only imports.

The changes follow TypeScript best practices by using import type for type-only imports. This helps reduce bundle size by ensuring types are removed during compilation.

src/lib/components/editor/FullEditor.tsx (1)

3-3: LGTM! Good separation of type and value imports.

The changes follow TypeScript best practices by:

  1. Using import type for type-only imports
  2. Properly organizing imports by separating type imports from value imports

Also applies to: 7-7, 10-11

src/lib/pages/evm-contract-verify/components/ConstructorArgs.tsx (1)

2-3: LGTM! Clean separation of type and value imports.

The changes follow TypeScript best practices by clearly distinguishing between type imports and runtime value imports.

src/lib/services/evm/index.ts (2)

1-2: LGTM! Well-organized type imports.

The changes improve type safety by properly distinguishing between type and value imports, following TypeScript best practices.

Also applies to: 10-11, 20-20


91-91: LGTM! Type-safe address parsing.

The use of zHexAddr20.parse() instead of direct type casting improves type safety and validation.

src/lib/pages/evm-contract-verify/components/EvmContractVerifyOptions.tsx (1)

2-5: LGTM! Import changes improve type safety.

The changes correctly separate type-only imports from value imports, improving type safety and clarity.

src/lib/pages/evm-contract-verify/components/evm-contract-verify-modal/index.tsx (1)

4-4: LGTM! Type-only import improves type safety.

The change to use a type-only import for EvmContractVerifyForm is a good practice as it ensures the type is not included in the runtime bundle.

src/lib/pages/evm-contract-verify/components/evm-contract-verify-modal/EvmContractVerifyModalBody.tsx (1)

7-7: LGTM! Type-only import improves type safety.

The change to use a type-only import for EvmContractVerifyForm is a good practice as it ensures the type is not included in the runtime bundle.

src/lib/pages/evm-contract-verify/components/solidity/EvmContractVerifySolidityHardhat.tsx (1)

6-10: LGTM! Import organization improves code clarity.

The changes to separate type imports and organize imports logically improve code maintainability.

src/lib/pages/evm-contract-verify/components/evm-contract-verify-modal/EvmContractVerifySuccessModal.tsx (1)

19-19: LGTM! Type-only import improves type safety.

The change to use a type-only import for EvmContractVerifyForm is a good practice as it ensures the type is not included in the runtime bundle.

src/lib/services/verification/evm/utils.ts (1)

2-3: LGTM! Good separation of type-only imports.

The change to make ContractLibraries a type-only import is a good practice as it clarifies intent and potentially reduces bundle size.

src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedCmds.tsx (1)

1-7: LGTM! Good component refactoring.

The changes improve the component by:

  • Following single responsibility principle
  • Using responsive design patterns correctly
  • Maintaining clean imports and type declarations

Also applies to: 19-50

src/lib/pages/evm-contract-details/components/evm-contract-details-overview/index.tsx (1)

73-78: LGTM! Good separation of proxy target rendering.

The conditional rendering of proxy target commands maintains a clean separation of concerns and follows the same pattern as the main verified commands section.

src/lib/pages/evm-contract-details/components/interact-evm-contract/index.tsx (2)

4-4: LGTM! Clean import organization.

The imports are well-organized, with types separated from React imports. The explicit type imports improve code clarity.

Also applies to: 6-8


24-30: Props interface update aligns with verification-based approach.

The removal of contractAbi in favor of evmVerifyInfo and proxyTargetEvmVerifyInfo improves the component's design by:

  • Centralizing verification and ABI information
  • Supporting proxy contract interactions
  • Making the verification status explicit
src/lib/pages/evm-contract-details/index.tsx (2)

27-27: LGTM! Improved address handling with checksum support.

The addition of toChecksumAddress import enhances address validation and display consistency.


235-238:

✅ Verification successful

Verify address validation and conversion.

The checksum address conversion is correctly applied, but consider adding error handling for invalid addresses.

Let's verify the address validation:

Consider adding error handling:

-  contractAddress={toChecksumAddress(validated.data.contractAddress)}
+  contractAddress={
+    try {
+      toChecksumAddress(validated.data.contractAddress)
+    } catch (e) {
+      console.error('Invalid address format:', e);
+      validated.data.contractAddress // fallback to original
+    }
+  }

🏁 Script executed:

#!/bin/bash
# Search for other instances of address validation
rg "isHexWalletAddress|toChecksumAddress" -A 2

Length of output: 11445


Ensure address handling remains robust

After verifying the code, the conditional check using !isHexWalletAddress(validated.data.contractAddress) in the same file already prevents invalid addresses from reaching the toChecksumAddress conversion. This existing validation ensures that only properly formatted addresses are processed, so adding an extra try/catch block in the JSX layer is redundant. In short, the current approach is correct and no changes are necessary.

@songwongtp songwongtp merged commit 834a908 into develop Feb 20, 2025
13 checks passed
@songwongtp songwongtp deleted the feat/proxy-contract-verify branch February 20, 2025 10:01
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.

2 participants