-
Notifications
You must be signed in to change notification settings - Fork 366
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
optimize: swap UI in send confirm OK-34238 #6316
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
Walkthrough本次更改涉及多个文件,主要集中在 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant VaultBase
participant VaultBtc
participant VaultKaspa
participant TxActionSwapInfo
participant SwapServiceFeeOverview
User->>VaultBase: 发起交换请求
VaultBase->>VaultBtc: 构建解码交易
VaultBtc->>VaultBase: 返回解码交易
VaultBase->>User: 返回交易详情
User->>TxActionSwapInfo: 查看交换信息
TxActionSwapInfo->>User: 展示交换详情
User->>SwapServiceFeeOverview: 查看服务费用
SwapServiceFeeOverview->>User: 展示费用概览
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
🧹 Outside diff range comments (2)
packages/kit-bg/src/vaults/impls/kaspa/Vault.ts (1)
Line range hint
284-295
: 重复的错误处理在 '_collectUTXOsInfoByApi' 方法中,'try' 块中抛出了错误,'catch' 块中又抛出了相同的错误。这可能导致堆栈信息丢失,建议只在 'catch' 块中处理错误。
packages/kit/src/components/TxAction/TxActionTransfer.tsx (1)
Line range hint
755-773
: 条件判断可简化第755到773行,对 'networkInfo' 的处理,可以将条件判断合并,减少嵌套,提升代码简洁性。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
⛔ Files ignored due to path filters (20)
packages/shared/src/locale/json/bn.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/de.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/en.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/en_US.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/es.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/fr_FR.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/hi_IN.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/id.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/it_IT.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/ja_JP.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/ko_KR.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/pt.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/pt_BR.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/ru.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/th_TH.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/uk_UA.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/vi.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/zh_CN.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/zh_HK.json
is excluded by!packages/shared/src/locale/json/*.json
packages/shared/src/locale/json/zh_TW.json
is excluded by!packages/shared/src/locale/json/*.json
📒 Files selected for processing (12)
packages/kit-bg/src/vaults/base/VaultBase.ts
(3 hunks)packages/kit-bg/src/vaults/impls/btc/Vault.ts
(2 hunks)packages/kit-bg/src/vaults/impls/kaspa/Vault.ts
(2 hunks)packages/kit/src/components/TxAction/TxActionSwapInfo.tsx
(1 hunks)packages/kit/src/components/TxAction/TxActionTransfer.tsx
(6 hunks)packages/kit/src/views/AssetDetails/pages/HistoryDetails/components/TxDetailsInfoItem/index.tsx
(3 hunks)packages/kit/src/views/Swap/components/SwapProviderInfoItem.tsx
(3 hunks)packages/kit/src/views/Swap/components/SwapServiceFeeOverview.tsx
(1 hunks)packages/shared/src/locale/enum/translations.ts
(2 hunks)packages/shared/types/swap/SwapProvider.constants.ts
(1 hunks)packages/shared/types/swap/types.ts
(1 hunks)packages/shared/types/tx.ts
(1 hunks)
🔇 Additional comments (14)
packages/kit/src/components/TxAction/TxActionTransfer.tsx (1)
Line range hint 583-606
: 检查 'networkId' 的有效性
第583到606行,使用 'swapInfo.sender.accountInfo.networkId',需要确保该值存在,避免可能的空引用错误。
packages/kit-bg/src/vaults/base/VaultBase.ts (1)
Line range hint 962-974
: 确保 'networkId' 的正确性
第962和974行,向 'transfers' 数组中的对象添加了 'networkId' 属性,需验证该属性是否正确设置,防止后续操作出错。
packages/kit/src/views/Swap/components/SwapProviderInfoItem.tsx (3)
17-17
: 新增 SwapServiceFeeOverview 组件导入
引入新组件优化了费用展示逻辑,使代码更加模块化。
50-50
: 使用 SwapServiceFeeOverview 替换原有费用显示逻辑
简化了费用展示方式,提高了代码可维护性。
55-57
: 优化组件导出方式
使用 memo 包装组件并显式导出,有助于性能优化。
packages/kit/src/views/AssetDetails/pages/HistoryDetails/components/TxDetailsInfoItem/index.tsx (2)
28-28
: 新增 compactAll 布局控制属性
通过新增的 compactAll 属性,提供了更灵活的布局控制选项。
Also applies to: 38-38
57-59
: 实现 compactAll 布局逻辑
合理实现了 compactAll 的布局控制,保持了与现有 compact 属性的一致性。
packages/shared/types/tx.ts (1)
161-161
: 扩展交易信息类型定义
在 IDecodedTxTransferInfo 接口中添加 networkId 字段,增强了多网络场景下的交易支持。建议验证所有使用此接口的地方是否需要更新。
packages/shared/types/swap/types.ts (1)
269-269
: 代码变更看起来不错!
为 IFetchQuoteResult
接口添加可选的 slippage
属性能更好地支持滑点功能。
packages/kit-bg/src/vaults/impls/btc/Vault.ts (2)
254-254
: 代码变更正确!
为发送代币添加 networkId
属性有助于跨链交易的追踪。
266-266
: 代码变更合理!
为接收代币添加 networkId
属性完善了跨链交易的网络信息。
packages/shared/types/swap/SwapProvider.constants.ts (1)
16-17
: 常量定义合适!
添加 swapServiceFeeDefault
常量统一了默认交换服务费用的设置,值为 0.3 是合理的。
packages/shared/src/locale/enum/translations.ts (2)
1451-1451
: 命名规范符合要求!
provider_cow_route
的命名遵循了现有的命名模式,并且正确放置在provider相关配置区域。
1928-1929
: 交换提示文案已完整添加!
批量交换和单笔交换的提示文案都已添加,保持了命名一致性。
让我们验证是否所有swap相关的翻译都已完整:
✅ Verification successful
交换相关的翻译已完整添加且保持一致!
搜索结果显示所有交换相关的翻译都已完整添加到各个语言文件中,包括:
- 批量交换提示 (batch_swap_tip)
- 单笔交换提示 (single_swap_tip)
- 交换汇率 (rate)
- 报价相关提示 (quotes)
所有翻译保持了命名和格式的一致性。
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# 搜索所有swap相关的翻译key
rg "swap.*tip"
Length of output: 73637
Script:
#!/bin/bash
# Search for all swap-related translation keys in the codebase
rg "swap.*tip|swap.*quote|swap.*rate"
Length of output: 94535
Summary by CodeRabbit
TxActionSwapInfo
和SwapServiceFeeOverview
,用于显示交易和服务费用信息。swapServiceFeeDefault
。