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

xodex support #5406

Open
wants to merge 4 commits into
base: x
Choose a base branch
from
Open

xodex support #5406

wants to merge 4 commits into from

Conversation

itskongz
Copy link

@itskongz itskongz commented Aug 2, 2024

Summary by CodeRabbit

  • 新功能

    • 新增网络短代码 'xodex',支持更多网络标识符。
    • 新增网络配置 xodexTestnetxodex,支持主网和测试网的功能。
    • 支持在 evm--2415 网络上进行 Xodex 和 USD Coin 的代币互换。
  • 文档

    • 更新了网络和代币配置的相关文档以反映新功能。

Copy link

codesandbox bot commented Aug 2, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

what-the-diff bot commented Aug 2, 2024

PR Summary

  • New Server Network Configuration for Xodex
    A new set of network settings for Xodex was introduced. This includes important characteristics like its ID, name, symbol, and status among others, helping the system recognize and handle Xodex properly.

Copy link
Contributor

coderabbitai bot commented Sep 18, 2024

Walkthrough

本次更改涉及在网络配置中引入新的网络短代码和网络配置,具体包括添加新的网络短代码 'xodex',以及定义新的网络配置 xodexTestnetxodex。此外,还添加了与特定网络 ID 相关的代币交换配置,允许在指定网络上进行代币交换。

Changes

文件路径 更改摘要
packages/shared/src/config/networkIds.ts 添加网络短代码 'xodex' 到类型 INetworkShortCode
packages/shared/src/config/presetNetworks.ts 添加网络配置 xodexTestnetxodex,并修改 presetNetworksMapgetPresetNetworks 以包含这两个网络。
packages/shared/types/swap/SwapProvider.constants.ts swapDefaultSetTokens 中添加 evm--2415 条目,包含代币 XodexUSD Coin 的详细信息。

Poem

🐰 在网络中跳跃,代码如春风,
新的短代码,带来新梦。
代币交换,流动如风,
小兔欢舞,庆祝这变动!
让我们一起,迎接新生,
在区块链上,畅游无穷! 🌟


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 generate interesting stats about this repository and render them as a table.
    -- @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 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
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 08cb713 and 28ecf55.

Files selected for processing (3)
  • packages/shared/src/config/networkIds.ts (1 hunks)
  • packages/shared/src/config/presetNetworks.ts (3 hunks)
  • packages/shared/types/swap/SwapProvider.constants.ts (1 hunks)
Additional comments not posted (3)
packages/shared/src/config/networkIds.ts (1)

14-14: 看起来不错!

添加新的网络短代码 'xodex'INetworkShortCode 类型是合理的改动。这个改动扩展了类型的灵活性,以适应未来可能需要集成或支持 xodex 网络的功能。新增的标识符与现有的命名约定保持一致,不会引入任何明显的问题或不一致。

packages/shared/src/config/presetNetworks.ts (2)

147-185: 代码看起来不错!

新增的 xodexTestnet 网络配置对象的属性设置正确,符合 IServerNetwork 接口的定义。将 isTestnet 设为 true 正确标识了这是一个测试网络。


187-225: 主网配置看起来正确!

新增的 xodex 主网配置与之前的 xodexTestnet 测试网配置大部分属性一致,区别在于 chainIdisTestnet。将 isTestnet 设为 false 正确标识了这是一个主网。

Comment on lines +271 to +293
'evm--2415': {
fromToken: {
'networkId': 'evm--2415',
'contractAddress': '',
'name': 'Xodex',
'symbol': 'xodex',
'decimals': 18,
'logoURI':
'https://i.postimg.cc/XqDnc4g2/XODEX-Avatar-02-2-copy.png',

'isNative': true,
},
toToken: {
'networkId': 'evm--2415',
'contractAddress': '0x04068da6c83afcfa0e13ba15a6696662335d5b75',
'name': 'USD Coin',
'symbol': 'USDC',
'decimals': 6,
'logoURI':
'https://uni-test.onekey-asset.com/server-service-onchain/evm--250/tokens/0x04068da6c83afcfa0e13ba15a6696662335d5b75.png',
'isNative': false,
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

添加 'evm--2415' 网络的代币交换配置看起来不错!

但是请注意,'toToken'(USD Coin)的 logoURI 当前指向了 'evm--250' 网络的代币图标。为了保持一致性和正确性,请确保使用 'evm--2415' 网络特定的 USD Coin 图标 URL。

建议将 'toToken' 的 logoURI 更新为:

-  'logoURI':
-    'https://uni-test.onekey-asset.com/server-service-onchain/evm--250/tokens/0x04068da6c83afcfa0e13ba15a6696662335d5b75.png',
+  'logoURI':
+    'https://uni-test.onekey-asset.com/server-service-onchain/evm--2415/tokens/0x04068da6c83afcfa0e13ba15a6696662335d5b75.png',
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'evm--2415': {
fromToken: {
'networkId': 'evm--2415',
'contractAddress': '',
'name': 'Xodex',
'symbol': 'xodex',
'decimals': 18,
'logoURI':
'https://i.postimg.cc/XqDnc4g2/XODEX-Avatar-02-2-copy.png',
'isNative': true,
},
toToken: {
'networkId': 'evm--2415',
'contractAddress': '0x04068da6c83afcfa0e13ba15a6696662335d5b75',
'name': 'USD Coin',
'symbol': 'USDC',
'decimals': 6,
'logoURI':
'https://uni-test.onekey-asset.com/server-service-onchain/evm--250/tokens/0x04068da6c83afcfa0e13ba15a6696662335d5b75.png',
'isNative': false,
},
},
'evm--2415': {
fromToken: {
'networkId': 'evm--2415',
'contractAddress': '',
'name': 'Xodex',
'symbol': 'xodex',
'decimals': 18,
'logoURI':
'https://i.postimg.cc/XqDnc4g2/XODEX-Avatar-02-2-copy.png',
'isNative': true,
},
toToken: {
'networkId': 'evm--2415',
'contractAddress': '0x04068da6c83afcfa0e13ba15a6696662335d5b75',
'name': 'USD Coin',
'symbol': 'USDC',
'decimals': 6,
'logoURI':
'https://uni-test.onekey-asset.com/server-service-onchain/evm--2415/tokens/0x04068da6c83afcfa0e13ba15a6696662335d5b75.png',
'isNative': false,
},
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants