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: ton token transfer #379

Merged
merged 2 commits into from
Oct 18, 2024
Merged

fix: ton token transfer #379

merged 2 commits into from
Oct 18, 2024

Conversation

ByteZhang1024
Copy link
Contributor

@ByteZhang1024 ByteZhang1024 commented Oct 18, 2024

Summary by CodeRabbit

  • 新特性

    • 更新多个包的版本至1.0.12,提升了软件的稳定性和安全性。
    • 在消息中添加了新的字段,增强了数据传输的灵活性。
    • 新增方法以支持 Jetton 相关功能和错误检查。
  • Bug 修复

    • 修正了参数验证,确保更准确的参数处理。
  • 文档

    • 更新了依赖项,确保兼容性和性能提升。

@ByteZhang1024 ByteZhang1024 marked this pull request as ready for review October 18, 2024 07:06
Copy link

coderabbitai bot commented Oct 18, 2024

Walkthrough

本次变更主要涉及多个软件包的版本更新,从“1.0.12-alpha.2”更新为“1.0.12”。多个依赖项的版本也进行了相应更新,以确保所有相关模块使用相同的稳定版本。此外,部分文件中添加了新方法和字段,更新了参数验证和类型签名,以支持新的功能和数据结构。

Changes

文件路径 变更摘要
packages/connect-examples/electron-example/package.json 版本更新至“1.0.12”
packages/connect-examples/expo-example/package.json 版本更新至“1.0.12”;多个依赖项版本更新至“1.0.12”
packages/core/package.json 版本更新至“1.0.12”;多个依赖项版本更新至“1.0.12”
packages/hd-ble-sdk/package.json 版本更新至“1.0.12”;多个依赖项版本更新至“1.0.12”
packages/hd-common-connect-sdk/package.json 版本更新至“1.0.12”;多个依赖项版本更新至“1.0.12”
packages/hd-transport-http/package.json 版本更新至“1.0.12”;多个依赖项版本更新至“1.0.12”
packages/hd-transport-lowlevel/package.json 版本更新至“1.0.12”;多个依赖项版本更新至“1.0.12”
packages/hd-transport-react-native/package.json 版本更新至“1.0.12”;多个依赖项版本更新至“1.0.12”
packages/hd-transport-webusb/package.json 版本更新至“1.0.12”;多个依赖项版本更新至“1.0.12”
packages/hd-transport/package.json 版本更新至“1.0.12”
packages/core/src/api/ton/TonSignMessage.ts 添加多个新方法
packages/core/src/api/ton/TonSignProof.ts 更新参数验证,expireAt 类型修改
packages/core/src/data/messages/messages.json 添加和修改多个消息字段
packages/core/src/types/api/tonSignMessage.ts 更新多个类型签名
packages/core/src/types/api/tonSignProof.ts 更新expireAt类型
packages/hd-transport/scripts/protobuf-patches/index.js 添加多个新字段
packages/hd-transport/src/types/messages.ts 更新多个类型签名
packages/shared/package.json 版本更新至“1.0.12”
submodules/firmware 子项目提交更新

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

Copy link

socket-security bot commented Oct 18, 2024

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

@ByteZhang1024 ByteZhang1024 requested review from wabicai and originalix and removed request for wabicai October 18, 2024 07:10
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: 8

🧹 Outside diff range comments (4)
packages/hd-transport/src/types/messages.ts (3)

Line range hint 3889-3892: 修正拼写错误并重新考虑字段可选性

发现以下问题:

  1. "signning_message"拼写错误,应为"signing_message"。
  2. 所有字段都是可选的,这对签名消息结果来说不太常见。

建议:

  • 更正拼写错误。
  • 至少将signature字段设为必填。

应用此更改:

 export type TonSignedMessage = {
-  signature?: string;
-  signning_message?: string;
+  signature: string;
+  signing_message?: string;
 };

Line range hint 3894-3905: 结构合理,可进一步提高一致性

TonSignProof类型定义结构清晰,字段选择恰当。

建议:

  • TonSignMessage保持一致,考虑添加chain_id字段。
  • 对可选字段添加简短注释,说明其用途。

Line range hint 3907-3909: 签名字段应为必填

对于签名证明结果,当前结构可能不够严谨。

建议:

  • signature字段改为必填,确保始终有签名结果。

应用此更改:

 export type TonSignedProof = {
-  signature?: string;
+  signature: string;
 };
packages/core/src/data/messages/messages.json (1)

Line range hint 10635-10638: signning_message 字段有拼写错误

新增的 signning_message 字段名拼错了。应该改为 signing_message

建议修改如下:

-        "signning_message": {
+        "signing_message": {
           "type": "bytes",
           "id": 2
         }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 237c606 and d8dbe7e.

📒 Files selected for processing (21)
  • packages/connect-examples/electron-example/package.json (1 hunks)
  • packages/connect-examples/expo-example/package.json (2 hunks)
  • packages/connect-examples/expo-example/src/data/ton.ts (1 hunks)
  • packages/core/package.json (2 hunks)
  • packages/core/src/api/ton/TonSignMessage.ts (3 hunks)
  • packages/core/src/api/ton/TonSignProof.ts (1 hunks)
  • packages/core/src/data/messages/messages.json (1 hunks)
  • packages/core/src/types/api/tonSignMessage.ts (1 hunks)
  • packages/core/src/types/api/tonSignProof.ts (1 hunks)
  • packages/hd-ble-sdk/package.json (2 hunks)
  • packages/hd-common-connect-sdk/package.json (2 hunks)
  • packages/hd-transport-http/package.json (2 hunks)
  • packages/hd-transport-lowlevel/package.json (2 hunks)
  • packages/hd-transport-react-native/package.json (2 hunks)
  • packages/hd-transport-webusb/package.json (2 hunks)
  • packages/hd-transport/package.json (1 hunks)
  • packages/hd-transport/scripts/protobuf-patches/index.js (1 hunks)
  • packages/hd-transport/src/types/messages.ts (2 hunks)
  • packages/hd-web-sdk/package.json (2 hunks)
  • packages/shared/package.json (1 hunks)
  • submodules/firmware (1 hunks)
🧰 Additional context used
🔇 Additional comments (27)
packages/core/src/types/api/tonSignProof.ts (2)

1-6: 导入语句更新得当!

新增的 UintType 导入提高了类型安全性。这个改动与后续的使用一致,值得称赞。


13-13: 类型更新有助于提高安全性

expireAt 的类型从 number 改为 UintType 是个好主意。这样可以更精确地表示无符号整数。

请运行以下脚本,检查是否有代码需要更新:

✅ Verification successful

请运行以下脚本,检查是否有代码需要更新:


请运行以下脚本,进一步检查是否有代码需要更新:


类型更新已验证且无影响

通过执行脚本,未发现任何使用旧 TonSignProofParams 类型 expireAt: number 的代码。这表明类型更新不会影响现有代码。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:查找使用旧 TonSignProofParams 类型的代码
rg --type typescript 'TonSignProofParams.*expireAt.*number'

Length of output: 96


Script:

#!/bin/bash
# 描述:查找使用旧 TonSignProofParams 类型的代码
rg --glob '*.ts' 'TonSignProofParams.*expireAt.*number'

Length of output: 57


Script:

#!/bin/bash
# 描述:查找使用旧 TonSignProofParams 类型的代码,包括 .ts 和 .tsx 文件
rg --glob '*.{ts,tsx}' 'TonSignProofParams\s*:\s*number'

Length of output: 58

packages/hd-transport-lowlevel/package.json (4)

3-3: 版本更新正确。

从alpha版本升级到稳定版本,移除了预发布标识符。这符合语义化版本控制的最佳实践。


22-22: 依赖版本更新合理。

@onekeyfe/hd-shared 的版本更新与包自身版本一致,保持了相关包之间的版本同步。这是个好做法。


23-23: 依赖版本更新合理。

@onekeyfe/hd-transport 的版本更新与包自身版本一致,保持了相关包之间的版本同步。这是个好做法。


3-3: 整体更新看起来不错。

这次更新将包版本从alpha升级到稳定版,并同步更新了相关依赖。这表明项目正在向更稳定的版本迈进。请确保在发布前进行充分测试,以验证新版本的稳定性。

Also applies to: 22-23

packages/shared/package.json (1)

3-3: 版本更新获批!

版本号从 1.0.12-alpha.2 升至 1.0.12,表明包已达到稳定状态。好样的!

别忘了更新更新日志哦,让用户知道这个版本有啥新鲜玩意儿。

packages/hd-ble-sdk/package.json (2)

3-3: 版本更新获批!

从alpha版本升级到稳定版本是个好举措。这表明软件包已经准备好进行更广泛的使用。


23-25: 依赖项版本同步更新,很好!

所有依赖项都更新到了与主包相同的版本。这种一致性有助于避免版本冲突,提高系统稳定性。

packages/hd-transport/package.json (1)

3-3: 版本更新已确认

版本号从 1.0.12-alpha.2 升级到 1.0.12,表明包已进入稳定版本。这是个好消息!

请运行以下脚本,检查相关包是否也需要更新:

✅ Verification successful

版本更新已验证

未发现其他包使用旧版本 "1.0.12-alpha.2"。当前版本更新仅影响 packages/hd-transport

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:检查其他包的版本是否需要更新

# 测试:搜索其他包中的版本号
rg --type json '"version": "1\.0\.12-alpha\.2"' packages/

Length of output: 59

packages/hd-transport-webusb/package.json (1)

3-3: 版本更新到稳定版,依赖同步更新。

包版本从1.0.12-alpha.2升级到1.0.12,标志着从alpha版本转为稳定版。依赖项@onekeyfe/hd-shared和@onekeyfe/hd-transport也相应更新,保持一致性。这是个好变更。

Also applies to: 23-24

packages/hd-transport-react-native/package.json (2)

3-3: 版本更新到稳定版

包版本从 1.0.12-alpha.2 更新到 1.0.12。这是个好变化,表明软件已经准备好发布稳定版本了。


22-23: 依赖项版本同步更新

@onekeyfe/hd-shared 和 @onekeyfe/hd-transport 的版本都更新到了 ^1.0.12。这保持了包之间的一致性,是个好做法。

packages/hd-transport-http/package.json (3)

3-3: 版本更新到稳定版

从alpha版升级到稳定版。好的进展!


27-27: 依赖项同步更新

hd-shared依赖版本与主包保持一致。很好!


28-28: 依赖项同步更新,建议验证

hd-transport依赖版本更新正确。建议检查其他相关包是否也需要更新。

运行以下脚本检查其他包的版本:

packages/hd-common-connect-sdk/package.json (1)

3-3: 版本更新看起来不错!

包版本从 alpha 升级到稳定版。依赖项也同步更新了。干得好!

运行以下脚本,确保相关包都已更新:

Also applies to: 23-27

✅ Verification successful

版本更新已经确认!

所有相关包版本均已更新至稳定版 1.0.12,没有发现残留的 alpha 版本。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:检查相关包是否都更新到了 1.0.12 版本

# 测试:搜索所有 package.json 文件中的版本号
fd -e json -x rg -i '"version":\s*"1\.0\.12'

# 测试:检查是否有遗漏的 alpha 版本
fd -e json -x rg -i 'alpha'

Length of output: 566

packages/core/src/types/api/tonSignMessage.ts (2)

1-6: 导入语句更新得当。

新增的 UintType 导入与接口中的使用一致,提高了类型安全性。


14-16: 类型更新提高了精确度。

number 改为 UintType 增强了类型安全性。建议检查使用这些属性的代码,确保兼容性。

运行以下脚本验证更改影响:

Also applies to: 21-21, 28-28

✅ Verification successful

类型更新已验证,无发现问题。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:查找使用 TonSignMessageParams 的地方

rg --type typescript "TonSignMessageParams" -C 5

Length of output: 83


Script:

#!/bin/bash
# 描述:查找使用 TonSignMessageParams 的地方

rg "TonSignMessageParams" --glob "*.ts" --glob "*.tsx" -C 5

Length of output: 4290

packages/core/package.json (1)

3-3: 版本更新到稳定版

包版本从alpha升级到稳定版。依赖项也相应更新。这是个好变化。

Also applies to: 28-29

packages/connect-examples/electron-example/package.json (1)

5-5: 版本更新已确认。

版本从 alpha 升级到稳定版,这是个好消息。

请运行以下脚本,确保项目中的版本号一致:

packages/hd-web-sdk/package.json (1)

3-3: 版本更新已完成

包版本和依赖项已更新到稳定版1.0.12。这是个好变化。

  • 主包:1.0.12-alpha.2 → 1.0.12
  • 依赖项:^1.0.12-alpha.2 → ^1.0.12

版本一致性提高了。干得好!

Also applies to: 24-27

packages/connect-examples/expo-example/package.json (1)

3-3: 版本更新看起来不错!

版本从 alpha 升级到稳定版本,这是个好消息。

请运行以下脚本,确保所有相关包都使用相同的版本:

另外,建议全面测试项目,确保与新版本兼容。

Also applies to: 22-25

✅ Verification successful

版本更新一致,验证通过!

所有相关包已成功更新到 ^1.0.12

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:检查所有 @onekeyfe 包是否使用相同的版本

# 测试:搜索所有 package.json 文件中的 @onekeyfe 包版本
fd -e json -x grep -H '"@onekeyfe/' {} \;

Length of output: 3355

packages/core/src/data/messages/messages.json (1)

10631-10634: 新字段 jetton_amount_bytes 添加得很好

这个新字段可以更精确地处理 Jetton 金额。用字节类型存储有助于保持数据的完整性。

packages/core/src/api/ton/TonSignMessage.ts (2)

73-76: 新增对 classic1s 设备的版本支持

getVersionRange 方法中,增加了对 classic1s 设备的支持。这是很好的改进。


79-85: 添加了 getSupportJettonAmountBytesVersionRange 方法

新增了 getSupportJettonAmountBytesVersionRange 方法,返回支持 jetton_amount_bytes 的设备固件版本范围。

packages/hd-transport/scripts/protobuf-patches/index.js (1)

204-209: 新增的TON字段类型定义正确

添加的TonSignMessageTonSignProof的字段类型均为UINT_TYPE,符合预期。

submodules/firmware Show resolved Hide resolved
packages/core/src/api/ton/TonSignProof.ts Show resolved Hide resolved
packages/connect-examples/expo-example/src/data/ton.ts Outdated Show resolved Hide resolved
packages/hd-transport/src/types/messages.ts Show resolved Hide resolved
packages/core/src/api/ton/TonSignMessage.ts Show resolved Hide resolved
packages/core/src/api/ton/TonSignMessage.ts Outdated Show resolved Hide resolved
packages/core/src/api/ton/TonSignMessage.ts Show resolved Hide resolved
packages/core/src/api/ton/TonSignMessage.ts Show resolved Hide resolved
Copy link

Report too large to display inline

View full report↗︎

@ByteZhang1024 ByteZhang1024 enabled auto-merge (squash) October 18, 2024 07:30
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: 9

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between d8dbe7e and 01b81c9.

📒 Files selected for processing (14)
  • packages/connect-examples/electron-example/package.json (1 hunks)
  • packages/connect-examples/expo-example/package.json (2 hunks)
  • packages/connect-examples/expo-example/src/data/ton.ts (1 hunks)
  • packages/core/package.json (2 hunks)
  • packages/core/src/api/ton/TonSignMessage.ts (3 hunks)
  • packages/hd-ble-sdk/package.json (2 hunks)
  • packages/hd-common-connect-sdk/package.json (2 hunks)
  • packages/hd-transport-http/package.json (2 hunks)
  • packages/hd-transport-lowlevel/package.json (2 hunks)
  • packages/hd-transport-react-native/package.json (2 hunks)
  • packages/hd-transport-webusb/package.json (2 hunks)
  • packages/hd-transport/package.json (1 hunks)
  • packages/hd-web-sdk/package.json (2 hunks)
  • packages/shared/package.json (1 hunks)
🧰 Additional context used
🔇 Additional comments (12)
packages/hd-transport-lowlevel/package.json (1)

3-3: 版本更新看起来不错!

从alpha版本升级到稳定版本是个好主意。这表明软件包已经准备好更广泛的使用了。

Also applies to: 22-23

packages/hd-ble-sdk/package.json (2)

3-3: 版本更新到稳定版

包版本从alpha升级到稳定版。好事!确保测试充分。


23-25: 依赖项版本同步更新

核心依赖全部更新到1.0.12。保持一致性,减少潜在冲突。

packages/hd-transport-webusb/package.json (2)

3-3: 版本更新到稳定版

从alpha版本升级到稳定版本。这是个重要的里程碑。


23-24: 依赖项版本同步更新

依赖项版本与主版本一致更新。保持一致性很重要。

packages/hd-transport-react-native/package.json (1)

3-3: 版本更新看起来不错!

包版本和依赖版本从alpha升级到稳定版,保持一致。好的做法。

运行以下脚本检查其他相关包是否也已更新:

Also applies to: 22-23

packages/hd-transport-http/package.json (3)

3-3: 版本升级到稳定版

从alpha版本升级到稳定版。这是个重要变更,可能影响用户和依赖包。


27-27: 依赖包版本同步更新

hd-shared依赖包版本更新,与主包版本一致。保持项目版本同步很重要。


28-28: 依赖包版本同步更新

hd-transport依赖包版本更新,与主包版本一致。这确保了整个项目的版本一致性。

packages/hd-common-connect-sdk/package.json (1)

3-3: 版本更新看起来不错!

从alpha版本升级到稳定版本是个好主意。依赖项也同步更新了,保持一致性。干得漂亮!

让我们确认一下其他相关包是否也已更新:

Also applies to: 23-27

packages/core/package.json (1)

3-3: 版本和依赖更新

包版本从alpha升级到稳定版。依赖项也相应更新。这些变更保持了包之间的一致性。

Also applies to: 28-29

packages/connect-examples/expo-example/package.json (1)

3-3: 版本更新看起来不错!

项目和依赖包从 alpha 版本升级到稳定版本,这是个好消息。

请运行以下脚本,确保所有相关包都已更新:

Also applies to: 22-25

✅ Verification successful

版本更新已验证!

所有相关的 @onekeyfe 包已成功更新到 1.0.12 版本。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:检查所有 @onekeyfe 包是否已更新到 1.0.12 版本

# 测试:搜索所有 package.json 文件中的 @onekeyfe 包版本
fd -e json -x rg --json '"@onekeyfe/.*": "\^1\.0\.12.*"' {} | jq -r '.data.lines.text'

Length of output: 1477

packages/hd-transport-lowlevel/package.json Show resolved Hide resolved
packages/shared/package.json Show resolved Hide resolved
packages/hd-transport/package.json Show resolved Hide resolved
packages/hd-web-sdk/package.json Show resolved Hide resolved
packages/core/src/api/ton/TonSignMessage.ts Show resolved Hide resolved
packages/core/src/api/ton/TonSignMessage.ts Show resolved Hide resolved
packages/core/src/api/ton/TonSignMessage.ts Show resolved Hide resolved
@ByteZhang1024 ByteZhang1024 merged commit f53726e into onekey Oct 18, 2024
7 checks passed
@ByteZhang1024 ByteZhang1024 deleted the fix/tonTransfer branch October 18, 2024 07:51
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.

2 participants