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: batch estimate fee error fallback OK-34516 #6401

Merged
merged 1 commit into from
Dec 24, 2024
Merged

Conversation

weatherstar
Copy link
Contributor

@weatherstar weatherstar commented Dec 24, 2024

Summary by CodeRabbit

  • 新功能
    • 改进了交易确认流程的错误处理和控制流。
    • 允许在没有新费用数据时重用先前的交易费用信息。

Copy link

codesandbox bot commented Dec 24, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

coderabbitai bot commented Dec 24, 2024

概述

演练

此次更改主要针对 SendConfirmFromSwap 组件,涉及交易确认流程的错误处理和控制流优化。新增了 IFeeInfoUnit 类型,并修改了 handleConfirmMultiTxsOnHwOrExternal 函数,使其能处理 undefined 的多交易费用结果。更新了导航和错误处理逻辑,确保在缺少新费用信息时可以重用之前的交易费用信息。

变更

文件 变更摘要
packages/kit/src/views/Send/pages/SendConfirmFromSwap/SendConfirmFromSwap.tsx - 添加 IFeeInfoUnit 类型导入
- 更新 handleConfirmMultiTxsOnHwOrExternal 函数参数类型
- 修改错误处理和导航逻辑
@onekeyhq/shared/types/fee 新增 IFeeInfoUnit 类型

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

@weatherstar weatherstar enabled auto-merge (squash) December 24, 2024 03:12
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: 2

🔭 Outside diff range comments (1)
packages/kit/src/views/Send/pages/SendConfirmFromSwap/SendConfirmFromSwap.tsx (1)

Line range hint 111-134: 批量估算回退逻辑很稳健。
捕获异常后调用 handleConfirmMultiTxsOnHwOrExternal(undefined),避免重复代码可考。

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 736d593 and 077733a.

📒 Files selected for processing (1)
  • packages/kit/src/views/Send/pages/SendConfirmFromSwap/SendConfirmFromSwap.tsx (4 hunks)
🔇 Additional comments (4)
packages/kit/src/views/Send/pages/SendConfirmFromSwap/SendConfirmFromSwap.tsx (4)

13-17: 导入新类型很棒,增强可读性。
简洁且易懂。类型声明更清晰了。


37-54: 添加对 undefined 参数的支持,逻辑更灵活。
请确保调用方都正确处理 undefined。建议加额外的判空测试。


55-56: 设置 prevTxFeeInfo,保留之前的费用信息。
这让多笔交易的费用衔接更顺畅。


94-96: 更新 prevTxFeeInfo 时机很好,用最新的费率信息。
确保 result[0].feeInfo 必定满足期望格式。

@weatherstar weatherstar merged commit 03a3218 into x Dec 24, 2024
8 checks passed
@weatherstar weatherstar deleted the fix/wallet-issues branch December 24, 2024 03:24
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.

3 participants