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

fix: catch error transaction simulation failed for sol #635

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

gamalielhere
Copy link
Contributor

@gamalielhere gamalielhere commented Mar 12, 2025

Summary by CodeRabbit

  • New Features
    • Enhanced swap flow behavior with network-specific error handling; the "Try again" option now appears only when applicable.
    • Improved error messaging offers clearer, user-friendly guidance based on your network context.
  • Bug Fixes
    • Various dependency updates to ensure improved performance and security across the application.

Verified

This commit was signed with the committer’s verified signature.
gamalielhere Gamaliel 'Yel' Padillo
Copy link

coderabbitai bot commented Mar 12, 2025

Walkthrough

This pull request updates two Vue components to incorporate network-specific behavior. In the swap-initiated component, the "Try again" link now appears only when the network is not Solana, while a new network prop is added to its interface. In the swap-best-offer component, the network prop is passed down to child components, and its error handling logic is enhanced to differentiate error messages based on whether the network is Solana. New type definitions and imports support these conditional behaviors.

Changes

File(s) Change Summary
packages/extension/src/ui/action/views/swap-initiated/index.vue
packages/extension/src/ui/action/views/swap-best-offer/index.vue
Added a network property (of type BaseNetwork) and new imports (NetworkNames, BaseNetwork). In swap-initiated, the "Try again" link is conditionally rendered based on if network.name is not NetworkNames.Solana. In swap-best-offer, the :network="network" attribute is added, and error handling logic in sendAction is modified to return different messages based on network conditions.
package.json
packages/extension-bridge/package.json
packages/extension/package.json
packages/hw-wallets/package.json
packages/keyring/package.json
packages/name-resolution/package.json
packages/request/package.json
packages/signers/bitcoin/package.json
packages/signers/ethereum/package.json
packages/signers/kadena/package.json
packages/signers/polkadot/package.json
packages/storage/package.json
packages/swap/package.json
packages/types/package.json
packages/utils/package.json
Updated various dependencies and devDependencies across multiple package.json files to newer versions, including @types/node, eslint, prettier, typescript, and others.

Sequence Diagram(s)

Loading
sequenceDiagram
    participant U as User
    participant SI as SwapInitiated Component
    participant SBO as SwapBestOffer Component
    U->>SI: Initiate swap action
    SI->>SI: Check if network !== Solana
    alt Network is not Solana
        SI->>U: Render "Try again" link
    else
        SI->>U: Do not render "Try again" link
    end
    U->>SBO: Trigger sendAction
    SBO->>SBO: Evaluate error in sendAction
    alt Network is not Solana
        SBO->>U: Display error message from error object
    else Network is Solana
        SBO->>SBO: Check for "Transaction simulation failed"
        SBO->>U: Display user-friendly network issue message
    end

Possibly related PRs

  • Release: v2.4.1 #623: The changes in the main PR are related to the modifications in the retrieved PR, as both involve updates to the handling of network-related properties and error messages in Vue components, specifically focusing on conditional rendering and error handling logic.
  • Fix/UI freezing #610: The changes in the main PR are related to the modifications in the retrieved PR as both involve enhancements to error handling and conditional rendering in Vue components, specifically focusing on network-related logic.
  • Release: 2.4.2 #627: The changes in the main PR are related to the modifications of network handling in the Vue component, specifically the introduction of a new network property, which aligns with the updates in the retrieved PR that also involve changes to network identifiers and handling.

Suggested reviewers

  • NickKelly1
  • kvhnuke

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c017077 and d3347e6.

📒 Files selected for processing (1)
  • packages/extension/src/ui/action/views/swap/views/swap-best-offer/index.vue (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/extension/src/ui/action/views/swap/views/swap-best-offer/index.vue
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: buildAll
  • GitHub Check: test

🪧 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.

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

github-actions bot commented Mar 12, 2025

💼 Build Files
chrome: enkrypt-chrome-d3347e6a.zip
firefox: enkrypt-firefox-d3347e6a.zip

💉 Virus total analysis
chrome: d3347e6a
firefox: d3347e6a

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 (1)
packages/extension/src/ui/action/views/swap/views/swap-best-offer/index.vue (1)

439-450: Excellent error handling enhancement for Solana networks.

This implementation improves the user experience by providing a more user-friendly error message when Solana transaction simulations fail, which addresses the PR objective. The condition properly checks for "Transaction simulation failed" in the error message and provides appropriate guidance to users.

Consider adding a comment explaining why this special handling is needed for Solana networks to help future developers understand the reasoning behind this conditional logic.

 if (network.value!.name !== NetworkNames.Solana) {
   TXSendErrorMessage.value = err.error
     ? err.error.message
     : err.message;
 } else {
+  // Solana transaction simulation failures are often due to network congestion
+  // and not user error, so we provide a more user-friendly message
   TXSendErrorMessage.value = error.includes(
     'Transaction simulation failed',
   )
     ? 'Network may be busy. Please try again later.'
     : error;
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 88b1888 and 5ab8f20.

📒 Files selected for processing (2)
  • packages/extension/src/ui/action/views/swap-initiated/index.vue (3 hunks)
  • packages/extension/src/ui/action/views/swap/views/swap-best-offer/index.vue (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: buildAll
  • GitHub Check: test
🔇 Additional comments (5)
packages/extension/src/ui/action/views/swap-initiated/index.vue (3)

40-42: Good implementation of network-specific behavior.

This conditional rendering ensures the "Try again" link only appears for non-Solana networks, which is aligned with the PR objective of fixing error handling for Solana transaction simulation failures.


66-67: LGTM: Necessary imports added.

These imports provide the required types for the network-specific behavior implementation.


78-78: LGTM: Essential prop addition.

Adding the network prop to the interface ensures type safety and enables the conditional rendering functionality.

packages/extension/src/ui/action/views/swap/views/swap-best-offer/index.vue (2)

95-95: Good implementation: Network prop properly passed to child component.

This change correctly passes the network information to the swap-initiated component, enabling network-specific behavior.


138-138: LGTM: Required import added.

Adding NetworkNames to the imports is necessary for the enhanced error handling implementation.

kvhnuke and others added 2 commits March 13, 2025 11:23

Verified

This commit was signed with the committer’s verified signature.
gamalielhere Gamaliel 'Yel' Padillo
…into fix/solana-swap-error
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 (2)
packages/swap/package.json (1)

25-40: Production Dependencies Update in Swap.
Updates to @solana/spl-token (^0.4.13), rango-sdk-basic (^0.1.64), uuid (^11.1.0), and ws (^8.18.1) should enhance compatibility and performance. Given the PR objective to catch simulation errors on Sol, please double-check that these changes do not inadvertently affect the transaction simulation logic on the Solana network.

packages/hw-wallets/package.json (1)

50-63: Hardware Wallet and Polkadot Dependency Upgrades.
Upgrading Ledger-related packages (@ledgerhq/hw-app-btc to ^10.6.0 and @ledgerhq/hw-app-eth to ^6.42.9) along with Polkadot modules (@polkadot/types to ^15.8.1 and @polkadot/util to ^13.4.3) is beneficial for ensuring compatibility with the latest wallet integrations and blockchain protocols. Running integration tests will help validate that transaction simulation and error-handling (especially for Solana-related flows) are correct.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ab8f20 and fdeb66a.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (15)
  • package.json (1 hunks)
  • packages/extension-bridge/package.json (1 hunks)
  • packages/extension/package.json (4 hunks)
  • packages/hw-wallets/package.json (2 hunks)
  • packages/keyring/package.json (1 hunks)
  • packages/name-resolution/package.json (2 hunks)
  • packages/request/package.json (1 hunks)
  • packages/signers/bitcoin/package.json (1 hunks)
  • packages/signers/ethereum/package.json (1 hunks)
  • packages/signers/kadena/package.json (1 hunks)
  • packages/signers/polkadot/package.json (1 hunks)
  • packages/storage/package.json (1 hunks)
  • packages/swap/package.json (1 hunks)
  • packages/types/package.json (1 hunks)
  • packages/utils/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • packages/signers/ethereum/package.json
  • packages/extension-bridge/package.json
  • packages/signers/kadena/package.json
  • packages/utils/package.json
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: buildAll
  • GitHub Check: test
🔇 Additional comments (38)
package.json (1)

35-37: Dependency Version Bump in devDependencies

The versions for "@commitlint/cli", "@commitlint/config-conventional", and "@swc/core" have been updated to ^19.8.0, ^19.8.0, and ^1.11.9 respectively. These upgrades are consistent with the project’s broader dependency update strategy. Please ensure that the updated tooling is fully verified in your test suite to avoid any potential regressions.

packages/types/package.json (3)

27-27: Updated @types/node Version

The "@types/node" dependency has been updated to ^22.13.10. This aligns with similar updates in other packages and ensures consistency.


30-30: ESLint and Prettier Updates

The "eslint" version is bumped to ^9.22.0 and "prettier" to ^3.5.3, which should help maintain up-to-date linting and formatting standards.


39-41: TypeScript and Build Tool Upgrades

The updates for "tsup", "typescript", and "typescript-eslint" to ^8.4.0, ^5.8.2, and 8.26.1 respectively are in line with the overall dependency updates. Make sure that after these bumps, the build process and type checking remain error‑free.

packages/request/package.json (2)

30-31: Updated Dependencies: uuid and ws

The dependency versions for "uuid" and "ws" have been updated to ^11.1.0 and ^8.18.1 respectively. Since these are minor version bumps, they should be backward‑compatible; verifying their behavior during integration tests is recommended.


34-49: Coherent Update of Dev Dependencies

The dev dependencies—including "@types/node", "eslint", "prettier", "tsup", "typescript", "typescript-eslint", and "vitest"—have all been updated to their newer versions. This consistency safeguards the development workflow. Please double‑check that all tests (especially those related to build and linting) pass after these upgrades.

packages/storage/package.json (3)

30-30: Updated @types/node Dependency

The "@types/node" version is now ^22.13.10, matching the revisions in the rest of the repository.


33-33: ESLint Version Update

The "eslint" package has been bumped to ^9.22.0. This should keep linting configurations in sync with the latest rules—please verify that no new linting errors have surfaced.


39-45: Consistent Dev Dependencies Updates

The updates for "prettier", "tsup", "typescript", "typescript-eslint", and "vitest" to ^3.5.3, ^8.4.0, ^5.8.2, 8.26.1, and ^3.0.8 respectively are well aligned across the project. Confirm that these changes do not affect the local testing and build outputs.

packages/signers/bitcoin/package.json (3)

35-35: Updated @types/node Dependency

The "@types/node" is updated to ^22.13.10, ensuring uniformity with similar packages.


38-38: ESLint Version Bump

The "eslint" package is now at ^9.22.0; please verify that the project’s lint configuration is fully compatible with the updated version.


44-50: Consistent Dev Dependencies Updates

The updates to "prettier", "tsup", "typescript", "typescript-eslint", and "vitest" are consistent with those implemented in other packages. Ensure that these improvements do not introduce any unexpected issues in the build or test pipelines.

packages/signers/polkadot/package.json (2)

24-31: Production Dependency Version Upgrades.
The versions for @commitlint/cli, @polkadot/util, and @polkadot/util-crypto have been updated to ^19.8.0 and ^13.4.3, respectively. These changes ensure consistency with our workspace-wide updates. Please verify that these versions are compatible with all dependent packages.


32-50: DevDependencies Update Consistency.
The updates for development tooling—ranging from @types/node, eslint, prettier, tsup, typescript, to typescript-eslint and vitest—align with our broader dependency refresh effort across the monorepo. Ensure that local build, lint, and test commands execute without issues.

packages/keyring/package.json (2)

24-35: Aligned Production Dependencies.
Upgrading @polkadot/util to ^13.4.3 brings this package in line with recent dependency revisions across the project. Make sure that other modules relying on Polkadot utilities are similarly updated.


36-53: DevDependencies Upgrades Verification.
The updates for @types/node, eslint, prettier, tsup, typescript, typescript-eslint, and vitest are consistent with our coordinated dependency management. Please run the tests and linting workflow to verify that these newer versions do not introduce breaking changes.

packages/name-resolution/package.json (2)

25-40: DevDependencies Upgrade Consistency.
The updated development dependencies (including @types/node, eslint, prettier, tsup, typescript, typescript-eslint, and vitest) align with our unified upgrade strategy. This consistency should help avoid version conflicts across packages.


49-54: Production Dependency Update for ethers.
Upgrading ethers to ^5.8.0 ensures that we benefit from the latest features and bug fixes. Verify that any downstream usage in the name resolution logic properly supports this update.

packages/swap/package.json (1)

41-57: DevDependencies Update in Swap Package.
The devDependencies—updating @types/node, eslint, prettier, tsup, typescript, typescript-eslint, and vitest—are in harmony with our global version bumps. Ensure that the testing and linting processes run smoothly following these revisions.

packages/hw-wallets/package.json (1)

24-41: Updated DevDependencies in HW-Wallets.
The synchronization of dev tool versions (including @types/node, eslint, prettier, tsup, typescript, typescript-eslint, and vitest) with our overall repository strategy is well-handled. Confirm that local development workflows (tests, linting, builds) are unaffected by these updates.

packages/extension/package.json (18)

26-26: Updated "@amplitude/analytics-browser" Version
The dependency version has been bumped to ^2.11.13 (a patch update). Please review the changelog to ensure no unexpected changes affect the analytics integration.


39-40: Updated Kadena Dependencies
"@kadena/client" and "@kadena/pactjs-cli" have been updated to ^1.17.1. Verify that these updates are compatible with your transaction simulation and error-handling logic—especially given the PR focus on catching transaction simulation errors on Sol.


44-45: Updated Metaplex Dependencies
The versions for "@metaplex-foundation/umi" and "@metaplex-foundation/umi-bundle-defaults" have been updated to ^1.1.1. These changes should align with downstream component usage. Confirm that no breaking changes affect the Vue components relying on these packages.


46-53: Updated Polkadot Dependencies
Multiple Polkadot packages (e.g., @polkadot/api, @polkadot/extension-inject, @polkadot/keyring, etc.) are now using newer patch versions. It is important to verify that these updates do not interfere with existing functionality or integrations within the extension.


55-56: Updated Solana Dependencies
The versions for "@solana-developers/helpers" and "@solana/spl-token" have been updated. Given the PR title’s focus on handling Solana error transactions, ensure these upgrades are tested against the new network-specific error handling logic.


80-80: Updated "uuid" Dependency
The "uuid" package is now at ^11.1.0. This is a minor bump, but please verify that any usage of UUIDs in the project remains consistent with the updated API (if applicable).


92-93: Updated CRXJS and Rollup CommonJS Plugin
Dev dependencies "@crxjs/vite-plugin" and "@rollup/plugin-commonjs" have been updated. These should provide bug fixes and performance improvements for your build process.


96-96: Updated Rollup Node Resolve Plugin
The upgrade to "@rollup/plugin-node-resolve" at ^16.0.1 might affect module resolution. Verify bundler configurations and test the build process to ensure compatibility.


102-102: Updated Chrome Type Definitions
"@types/chrome" has been updated to ^0.0.309. Make sure that this change does not introduce any type conflicts in your extension’s Chrome-specific code.


107-108: Updated Type Definitions for Lodash and Node
The updates to "@types/lodash" and "@types/node" should improve type safety and compatibility. It’s advisable to run a full type check to catch any potential issues.


116-116: Updated Vue ESLint Config for TypeScript
The dependency "@vue/eslint-config-typescript" now uses ^14.5.0, which should enhance linting for TypeScript in Vue. Confirm that your ESLint rules are still correctly enforced.


118-118: Updated VueUse Core
"@vueuse/core" has been updated to ^12.8.2. Please verify that any composable functions or utilities used in your Vue components continue to behave as expected.


120-121: Updated ESLint and ESLint Plugin for Vue
The versions for "eslint" and "eslint-plugin-vue" have been updated. These updates are critical for maintaining robust static analysis. Double-check your ESLint configuration to ensure consistency after these changes.


127-127: Updated Prettier Version
Prettier is now at ^3.5.3. This upgrade might introduce minor formatting changes. Ensure that any pre-commit hooks or formatting rules are adjusted accordingly.


129-129: Updated Rollup Version
Rollup has been updated to ^4.35.0. Validate that your bundling configuration produces the expected output without introducing regressions.


133-134: Updated TSup and TypeScript
The updates to "tsup" (^8.4.0) and "typescript" (~5.8.2) require a careful review of the build and type-checking pipeline. Please run a complete build and type-check to confirm stability.


136-136: Updated Vite Version
Vite is now using ^6.2.1. Make sure that this upgrade is compatible with your current plugin ecosystem and does not affect development or production builds.


139-140: Updated Vitest and Vue TSC
The testing and type-checking tools ("vitest" and "vue-tsc") have been updated. It is important to run your test suite and check for any new type errors or test failures as a result.

@gamalielhere gamalielhere changed the base branch from main to develop March 14, 2025 19:41

Verified

This commit was signed with the committer’s verified signature.
gamalielhere Gamaliel 'Yel' Padillo

Verified

This commit was signed with the committer’s verified signature.
gamalielhere Gamaliel 'Yel' Padillo
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.

None yet

3 participants