8000 fix(bridge): use explorer link from provider networks by shoom3301 · Pull Request #5865 · cowprotocol/cowswap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(bridge): use explorer link from provider 8000 networks #5865

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

Merged
merged 1 commit into from
Jun 20, 2025

Conversation

shoom3301
Copy link
Collaborator
@shoom3301 shoom3301 commented Jun 19, 2025

Summary

Fixes https://www.notion.so/cownation/Token-link-navigates-to-ethereum-1c38da5f04ca802abf21f75838a663cd?source=copy_link

image

To Test

  1. Open buy token selector
  2. Select Optimism network
  3. Open some token info tooltip
  4. Cick to "View details"

Summary by CodeRabbit

  • New Features

    • Explorer links can now be customized based on bridge network data, potentially improving accuracy and user experience when viewing addresses on block explorers.
  • Refactor

    • Improved type safety and clarity by explicitly specifying return types for key components.
    • Explorer link generation is now more flexible, allowing for configurable default URLs.

@shoom3301 shoom3301 requested review from a team June 19, 2025 10:57
@shoom3301 shoom3301 self-assigned this Jun 19, 2025
Copy link
vercel bot commented Jun 19, 2025

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

Name Status Preview Updated (UTC)
cosmos ❌ Failed (Inspect) Jun 19, 2025 11:12am
cowfi ✅ Ready (Inspect) Visit Preview Jun 19, 2025 11:12am
explorer-dev ✅ Ready (Inspect) Visit Preview Jun 19, 2025 11:12am
sdk-tools ✅ Ready (Inspect) Visit Preview Jun 19, 2025 11:12am
swap-dev ✅ Ready (Inspect) Visit Preview Jun 19, 2025 11:12am
widget-configurator ✅ Ready (Inspect) Visit Preview Jun 19, 2025 11:12am

Copy link
Contributor
coderabbitai bot commented Jun 19, 2025

Walkthrough

The changes introduce explicit return type annotations for React components, update the getExplorerLink utility to accept a configurable default explorer URL, and enhance the ClickableAddress component to use bridge network data for generating explorer links. No core logic or control flow was altered.

Changes

File(s) Change Summary
apps/cowswap-frontend/src/common/pure/ClickableAddress/index.tsx Uses useBridgeSupportedNetworks to fetch bridge network data; passes explorer URL to utility; adds explicit ReactNode return type.
apps/cowswap-frontend/src/modules/tokensList/pure/TokenInfo/index.tsx Adds explicit ReactNode return type to TokenInfo component.
libs/common-utils/src/getExplorerLink.ts Adds optional defaultPrefix parameter to getExplorerLink to allow custom fallback explorer URLs.

Suggested reviewers

  • elena-zh

Poem

A rabbit hopped through code so neat,
Tweaked explorer links for a treat.
Types made clear, returns defined,
Bridge networks now aligned.
With every hop, the code grew bright—
Explorer links now work just right!
🐇✨

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.

yarn install v1.22.22
[1/4] Resolving packages...
(node:7636) [DEP0169] DeprecationWarning: url.parse() behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for url.parse() vulnerabilities.
(Use node --trace-deprecation ... to show where the warning was created)
[2/4] Fetching packages...
error nx@21.0.3: The engine "node" is incompatible with this module. Expected version "^20.19.0 || ^22.12.0". Got "24.2.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.


📜 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 6d77019 and 4b4f671.

📒 Files selected for processing (3)
  • apps/cowswap-frontend/src/common/pure/ClickableAddress/index.tsx (2 hunks)
  • apps/cowswap-frontend/src/modules/tokensList/pure/TokenInfo/index.tsx (1 hunks)
  • libs/common-utils/src/getExplorerLink.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Cypress
  • GitHub Check: Setup
🔇 Additional comments (7)
libs/common-utils/src/getExplorerLink.ts (1)

16-24: LGTM! Well-designed enhancement for configurable explorer URLs.

The addition of the optional defaultPrefix parameter with a sensible default maintains backward compatibility while enabling the flexibility needed for multi-network support. The implementation correctly uses the parameter as the fallback when chain-specific explorer info is unavailable.

apps/cowswap-frontend/src/common/pure/ClickableAddress/index.tsx (5)

1-1: LGTM! Proper import addition for return type annotation.


7-7: LGTM! Correct hook import for bridge network data.


18-18: LGTM! Explicit return type improves type safety.


24-25: LGTM! Proper bridge network lookup implementation.

The logic correctly finds the matching bridge network by chainId to enable network-specific explorer links.


31-31: ```shell
#!/bin/bash

Inspect the useBridgeSupportedNetworks hook implementation and search for blockExplorer references

sed -n '1,200p' apps/cowswap-frontend/src/entities/bridgeProvider/useBridgeSupportedNetworks.ts
rg -n "blockExplorer" -N apps/cowswap-frontend/src/entities/bridgeProvider/useBridgeSupportedNetworks.ts


</details>
<details>
<summary>apps/cowswap-frontend/src/modules/tokensList/pure/TokenInfo/index.tsx (1)</summary>

`17-17`: **LGTM! Explicit return type improves type safety.**

The return type annotation enhances code clarity and type safety without affecting the component's behavior.

</details>

</blockquote></details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAM3gADwAKAQp4WlIASi5sRA8SBO4vfH8+L3gMAGtIWIoWHjqJdMpIclwAdxLKxAAaaPtsAWZ1Gno5SFyWxFh8FgBmOYAGAEYe9Fpaf0Q85EwUbeDIdthKDwJKskhyquQKpgp/MS95DDQmomoz/DCTyABRXAnfyOSDMbQYNqQApFEotJIAoGIBiYTIoDCIGhoej4WI/Dxobi8fC8eCfVokDpdKGFYqlDQwX7xBJQ9HYLY/ahHE5YSYUZB5SJidDkykUaoOBiwdDIADy3HEw0QzDWgK+FywSlw2l8126kFo8EeoQIeIUD1EoWhtJaAFUbAAZGolDmhNqdMVrWLOgpoZhFEhrWC4XDcRAc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GGSMiZKDJRTGmNcWjgW8qxFnUKB4dqKpqHPAQblqg4NtA6HlzRAp7roVamzdnWj4CkpMEKqAZbyYk/4JkGtBOnzzX3fRRajaakoMMcgpoHN8Hvg0KTzJ/DxUQmeeVbA1g4WNL8ILPk5w+Fs9fVLqBhXWNbPEIgbIlaQCaL634PHj5CbPkNat7i811uyy1DwTa/wtqCYUEJHbPAROLVEvtsTIAJJo1gYdo70n6wnS3ejEDKBMaSG3DuXAMCOD8hQNY5C0BcBgpBFULKuAYfMgAEWoGgZVGFURNM25hicu3QoVH260I7lBTtPYu7+K7zKMK3YY5QR7WoXsBhnOJrikmgoAF5IDqeDKU7Tdk9OpnwGuepaIW4wbgxsjAiHxByWeWhikd3GMTmOWB85I0DAnRZPyq6/NEX8SxstF6b1hbOHkNtLle01D/SOkDVnY1NbDFwAAfXSIgeX/gmiSToPLjEzhQgs7ZwAFgEHr2IAA2AA7MsU3iwsQACYACcsQACsAhFi29t8sBgpvLfW9oAIW3RvTf25IO763qhTeA2Bmzh66hFe0GV6riSU5aDy4muHoAA -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

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.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=cowprotocol/cowswap&utm_content=5865):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `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 explain this code block.`
  -	`@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 explain its main purpose.`
  - `@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.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

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](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

Copy link
Contributor
@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

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

Great, thank you

@shoom3301 shoom3301 merged commit 01eb38e into develop Jun 20, 2025
13 of 15 checks passed
@shoom3301 shoom3301 deleted the fix/bridge-explorer-url branch June 20, 2025 06:07
@github-actions github-actions bot locked and limited conversation to collaborators Jun 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0