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

feat: Support Sui #1024

Merged
merged 50 commits into from
Aug 26, 2024
Merged

feat: Support Sui #1024

merged 50 commits into from
Aug 26, 2024

Conversation

gin-lsl
Copy link
Collaborator

@gin-lsl gin-lsl commented Jul 8, 2024

[中文版模板 / Chinese template]

💡 Background and solution

添加 Sui 适配。

内部使用了 Sui 官方提供的 @mysten/dapp-kit@mysten/sui,请求基于 React Query。

一些简单的概念:

  • Sui 将它的状态称为 Object,包括资产、合约状态等,所以会看到一些链方法例如 “getObject” 等。
  • Sui 使用 Move 编写智能合约,所以相对应的有个 moveObject 的概念,所以有时候会遇到单词 move,要注意它不是“移动”的意思。
  • 编译后的合约代码称为 Package;将数据、资源等称为 moveObject(例如 NFT、代币等)。
  • ZAN 已支持 Sui 的 mainnet 和 testnet。
  • Sui 官方实现了 Wallet Standard 标准,一些常见钱包都支持(例如 Sui WalletSuiet);
  • 账户下可以有多种 Coin(这里有一份 Coin List)。所以它除了有 getBalance 外,还有 getBalances 接口(此 PR 使用了 getBalance,获取的是默认的 Sui Coin)
  • 官网提供了从 faucet 获取代币的方法 Get Sui Tokens。如果安装了 Sui Wallet 钱包,可以在钱包中一键获取。

一些跟此 PR 无关但比较有意思的概念 😄️:

  • Sui 的合约是可升级的
  • Sui 的 NFT 是可组合的。例如一个游戏角色可以装备某些武器,武器作为它的属性。当然武器也可以有自己的属性,可以添加装饰、附魔 Buff 等。

Todo List:

  • 测试用例
  • Demo
  • 文档
  • Readme

🔗 Related issue link

Copy link

vercel bot commented Jul 8, 2024

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

Name Status Preview Comments Updated (UTC)
ant-design-web3 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 22, 2024 4:19pm

Copy link

changeset-bot bot commented Jul 8, 2024

🦋 Changeset detected

Latest commit: 0c6f080

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@ant-design/web3-sui Major
@ant-design/web3-common Minor
@ant-design/web3 Patch
@ant-design/web3-assets Patch
@ant-design/web3-bitcoin Patch
@ant-design/web3-eth-web3js Patch
@ant-design/web3-ethers-v5 Patch
@ant-design/web3-ethers Patch
@ant-design/web3-solana Patch
@ant-design/web3-ton Patch
@ant-design/web3-wagmi Patch
@example/eth-web3js Patch
@example/ethers-v5 Patch
@example/ethers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

github-actions bot commented Jul 8, 2024

Preview is ready

@github-actions github-actions bot added the major label Jul 8, 2024
Copy link

github-actions bot commented Jul 8, 2024

🚨 @gin-lsl, 本次 PR 的更改包含 major 变更,请确认是否符合预期。


🚨 @gin-lsl, this PR contains major changes, please confirm if it is as expected.

+'@ant-design/web3-sui': major

Copy link

codecov bot commented Jul 9, 2024

Codecov Report

Attention: Patch coverage is 99.49559% with 4 lines in your changes missing coverage. Please review.

Project coverage is 99.22%. Comparing base (f045e6b) to head (0c6f080).
Report is 1 commits behind head on main.

Files Patch % Lines
...ages/sui/src/sui-provider/__tests__/basic.test.tsx 97.95% 2 Missing ⚠️
...es/sui/src/sui-provider/__tests__/connect.test.tsx 98.07% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #1024    +/-   ##
========================================
  Coverage   99.21%   99.22%            
========================================
  Files         937      955    +18     
  Lines       26491    27284   +793     
  Branches     2789     2909   +120     
========================================
+ Hits        26283    27072   +789     
- Misses        206      210     +4     
  Partials        2        2            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jeasonstudio
Copy link
Collaborator

看了下 sui 提供的几个官方的 ts sdk 质量都挺高的,而且设计上也参考了 wagmi/viem,对我们来说是好事 😄。

gin-lsl added 2 commits July 31, 2024 12:37
# Conflicts:
#	package.json
#	pnpm-lock.yaml
#	tsconfig.base.json
#	vitest.config.mts
Copy link

socket-security bot commented Aug 21, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@mysten/dapp-kit@0.14.17 Transitive: environment, network +37 5.89 MB ebmifa
npm/@mysten/sui@1.7.0 None +9 10.1 MB ebmifa

🚮 Removed packages: npm/@walletconnect/core@2.14.0), npm/@walletconnect/universal-provider@2.14.0), npm/@walletconnect/utils@2.13.3), npm/@walletconnect/web3wallet@1.14.0)

View full report↗︎

@yutingzhao1991
Copy link
Collaborator

pnpm-lock.yaml 这个还有冲突

@yutingzhao1991 yutingzhao1991 merged commit 9bb1ea1 into main Aug 26, 2024
14 checks passed
@yutingzhao1991 yutingzhao1991 deleted the feat/sui-adapter branch August 26, 2024 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants