Skip to content

fix transaction hash and erc20 value for walletconnect#260

Merged
RanaBug merged 1 commit intostagingfrom
fix/wallet-connect-qa-fixes
Mar 19, 2025
Merged

fix transaction hash and erc20 value for walletconnect#260
RanaBug merged 1 commit intostagingfrom
fix/wallet-connect-qa-fixes

Conversation

@RanaBug
Copy link
Collaborator

@RanaBug RanaBug commented Mar 18, 2025

Description

  • Fix transaction hash chain id for walletConnect transactions
  • Fix ERC20 default value for walletConnect transactions

How Has This Been Tested?

  • Existing Unit Tests and Manual Testing

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Summary by CodeRabbit

  • Chores
    • Upgraded a key dependency to leverage the latest improvements.
  • Bug Fixes
    • Extended wallet connection notifications to remain visible longer.
    • Improved transaction processing with more robust defaults and enhanced chain identification.
    • Refined error messages to offer clearer guidance during connection issues.

@RanaBug RanaBug requested a review from IAmKio March 18, 2025 17:30
@RanaBug RanaBug self-assigned this Mar 18, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2025

Walkthrough

This update bumps the version of the @etherspot/transaction-kit dependency in package.json, adjusts the duration for toast notifications in the WalletConnect component, introduces logic in the Send Modal Tokens tab to robustly determine the appropriate chainId for transaction hashing, and refines error handling in the wallet connect service by improving transaction value assignment and error messages.

Changes

File(s) Change Summary
package.json Updated @etherspot/transaction-kit dependency from ^1.0.4 to ^1.0.5.
src/apps/.../WalletConnectToast.tsx Increased toast auto-close timeout from 5000ms to 10000ms.
src/components/.../SendModalTokensTabView.tsx Added logic to derive chainId (from payload, userOp, or default) for computing the transaction hash.
src/services/walletConnect.ts Revised error handling by removing a specific toast notification for transaction timeouts, updated the transaction value assignment with a conditional check, and modified the session request error subtitle to cover both failure and timeout cases.

Sequence Diagram(s)

sequenceDiagram
    participant Component as SendModalTokensTabView
    participant Payload as Payload Object
    participant Service as Transaction Service

    Component->>Payload: Check for payload.chainId
    alt payload.chainId exists
        Component->>Service: Call getTransactionHash(payload.chainId)
    else
        Component->>Payload: Retrieve userOpChainId
        alt userOpChainId exists
            Component->>Service: Call getTransactionHash(userOpChainId)
        else
            Component->>Service: Call getTransactionHash(etherspotDefaultChainId)
        end
    end
Loading
sequenceDiagram
    participant WCService as WalletConnect Service
    participant TxData as Transaction Data

    WCService->>TxData: Check if transaction.value exists
    alt value is present
        WCService->>WCService: Format and assign transaction.value
    else
        WCService->>WCService: Assign default value '0'
    end
    Note over WCService: Session request error subtitle updated for timeout and failure cases
Loading

Suggested reviewers

  • IAmKio

Poem

I’m a rabbit, hopping with cheer,
Changes in code make my bounce sincere.
From timeouts extended to better chainId views,
My whiskers twitch with debug hues.
Let’s nibble on bugs and code so bright,
With ASCII carrots and commits in sight!
Hop hop, celebrate every byte!

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 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 e602065 and 18a9f8d.

⛔ Files ignored due to path filters (3)
  • package-lock.json is excluded by !**/package-lock.json
  • src/apps/pillarx-app/components/MediaGridCollection/tests/__snapshots__/DisplayCollectionImage.test.tsx.snap is excluded by !**/*.snap
  • src/apps/pillarx-app/components/PointsTile/test/__snapshots__/PointsTile.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (4)
  • package.json (1 hunks)
  • src/apps/pillarx-app/components/WalletConnectToast/WalletConnectToast.tsx (1 hunks)
  • src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (1 hunks)
  • src/services/walletConnect.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: unit-tests
  • GitHub Check: Cloudflare Pages
  • GitHub Check: build
🔇 Additional comments (6)
package.json (1)

22-22:

Details

✅ Verification successful

Dependency update for transaction-kit

The version bump for @etherspot/transaction-kit from 1.0.4 to 1.0.5 is likely related to the fixes for transaction hash chain ID and ERC20 value handling.


🏁 Script executed:

#!/bin/bash
# Check for changelog or release notes for @etherspot/transaction-kit 1.0.5

# Query npm for package info
echo "Checking npm for package details:"
npm view @etherspot/transaction-kit versions --json | grep 1.0.5

# Check GitHub for release information
echo -e "\nChecking GitHub for release info:"
gh api repos/etherspot/transaction-kit/releases | jq '.[] | select(.tag_name=="v1.0.5") | {tag_name, name, body}'

Length of output: 352


Transaction-kit dependency update verified

  • The npm registry confirms that version 1.0.5 of @etherspot/transaction-kit is available.
  • Although no detailed release notes were retrieved from GitHub, the update plausibly addresses the fixes for transaction hash chain ID and ERC20 value handling.
  • The dependency bump in package.json (line 22) is correct as-is.
src/apps/pillarx-app/components/WalletConnectToast/WalletConnectToast.tsx (1)

27-27: Extended toast notification duration

Increased the toast notification timeout from 5 seconds to 10 seconds, providing users with more time to read and react to WalletConnect notifications, which is especially important for transaction-related messages.

src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (2)

276-282: Fixed transaction hash chain ID logic

Added robust chainId determination logic for transaction hashing. This change ensures the correct chain ID is used when generating transaction hashes for WalletConnect transactions by establishing a clear priority order:

  1. Use the chainId from the payload if available
  2. Fall back to the chainId from the sent batch
  3. Default to the etherspot default chainId if neither is available

288-291: Updated transaction hash retrieval with proper chainId

The getTransactionHash function now receives the appropriate chainIdForTxHash parameter, ensuring that transaction hashes are generated with the correct chain identifier.

src/services/walletConnect.ts (2)

505-507: Fixed ERC20 transaction value handling

Implemented conditional logic to ensure the transaction value is properly formatted:

  1. If transaction.value exists, it formats the value using formatEther
  2. Otherwise, it defaults to '0', preventing potential issues with undefined values

This ensures that ERC20 transactions always have a valid, well-defined value.


539-539: Improved error messaging for transaction failures

Enhanced the error message to provide more context about session request failures, including explicit mention of timeout scenarios and guidance to check transaction status before retrying.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
  • @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.

@cloudflare-workers-and-pages
Copy link

Deploying x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 18a9f8d
Status: ✅  Deploy successful!
Preview URL: https://5cace764.x-e62.pages.dev
Branch Preview URL: https://fix-wallet-connect-qa-fixes.x-e62.pages.dev

View logs


const userOpChainId = sent?.[0]?.sentBatches[0]?.chainId;

const chainIdForTxHash =
Copy link
Collaborator

Choose a reason for hiding this comment

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

i had to double check this 😂

Copy link
Collaborator

@IAmKio IAmKio left a comment

Choose a reason for hiding this comment

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

LGTM

@RanaBug RanaBug merged commit 66e94ed into staging Mar 19, 2025
7 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jun 23, 2025
3 tasks
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