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(bitcoin): Add phantom wallet adapter #1267

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

Conversation

gin-lsl
Copy link
Collaborator

@gin-lsl gin-lsl commented Nov 29, 2024

添加 Phantom Wallet 的 比特币钱包适配器。

Phantom 的文档见:https://docs.phantom.app/bitcoin/integrating-phantom

注:

  1. 目前 Phantom 的 bitcoin 目前没有提供 sendTransfer 或类似方法,所以修改了 BitcoinWallet 接口;
  2. Phantom 对 signPsbt 的支持似乎有些问题,所以在 sign 的 demo 中另外添加了 psbt 测试值;
  3. signPsbt 不支持 broadcast 选项;
  4. 添加了 uint8array-tools 依赖,用于对 Uint8Array 值做转换;

💡 Background and solution

🔗 Related issue link

Copy link

changeset-bot bot commented Nov 29, 2024

🦋 Changeset detected

Latest commit: d51fcfc

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

This PR includes changesets to release 1 package
Name Type
@ant-design/web3-bitcoin Minor

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

vercel bot commented Nov 29, 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 Dec 4, 2024 2:40am

Copy link

github-actions bot commented Nov 29, 2024

Preview is ready

@LCJove
Copy link
Collaborator

LCJove commented Nov 29, 2024

看到这个 psbt 想到一个问题,钱包更关心的是如何发起一笔交易,其中的 psbt 数据应该是不感知的。
这个后续可以提一个需求,参考 unisat 组装 psbt 的方法。

Copy link

codecov bot commented Nov 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.99%. Comparing base (1c18695) to head (e56d9c3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1267   +/-   ##
=======================================
  Coverage   99.99%   99.99%           
=======================================
  Files         858      859    +1     
  Lines       14726    14729    +3     
  Branches     1589     1589           
=======================================
+ Hits        14725    14728    +3     
  Misses          1        1           

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

@yutingzhao1991
Copy link
Collaborator

有冲突了

@gin-lsl
Copy link
Collaborator Author

gin-lsl commented Dec 3, 2024

报错是 vitest 里面有类型不匹配,没看明白怎么改

@yutingzhao1991
Copy link
Collaborator

报错是 vitest 里面有类型不匹配,没看明白怎么改

我看你改了 lock 文件,不要改呢?把和这个 PR 无关的内容先去掉。

另外升级下 pnpm 到 9

Copy link

socket-security bot commented Dec 3, 2024

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

Package New capabilities Transitives Size Publisher
npm/@ant-design/[email protected] environment +3 556 kB zombiej
npm/@ant-design/[email protected] environment +4 12.8 MB afc163
npm/@biomejs/[email protected] None 0 210 kB conaclos, dominionl, ematipico, ...1 more
npm/@changesets/[email protected] environment, filesystem, shell +20 1.88 MB changesets-release-bot
npm/@ianvs/[email protected] environment, unsafe +13 6.39 MB ianvs
npm/@mysten/[email protected] Transitive: environment, network +43 6.2 MB ebmifa
npm/@mysten/[email protected] None +9 9.7 MB ebmifa
npm/@tanstack/[email protected] Transitive: environment +2 2.03 MB nksaraf, tannerlinsley
npm/@tanstack/[email protected] Transitive: environment +2 2.02 MB tannerlinsley
npm/@tanstack/[email protected] environment +1 2.56 MB nksaraf, tannerlinsley
npm/@tonconnect/[email protected] network +3 1.08 MB thekiba
npm/@types/[email protected] None 0 2.28 MB types
npm/@types/[email protected] None +1 446 kB types
npm/@umijs/[email protected] environment, filesystem Transitive: unsafe +119 16 MB chenshuai2144
npm/@vitest/[email protected] None +7 904 kB antfu, oreanno, patak, ...1 more
npm/@walletconnect/[email protected] network Transitive: filesystem +22 8.56 MB gancho_walletconnect
npm/@walletconnect/[email protected] network Transitive: filesystem +13 10.4 MB gancho_walletconnect
npm/@walletconnect/[email protected] environment, network Transitive: filesystem +49 9.62 MB gancho_walletconnect
npm/@walletconnect/[email protected] Transitive: filesystem, network +55 23.2 MB bkrem, chris13524, cyberdrk, ...9 more

🚮 Removed packages: npm/@ant-design/[email protected], npm/@ant-design/[email protected], npm/@biomejs/[email protected], npm/@changesets/[email protected], npm/@ianvs/[email protected], npm/@mysten/[email protected], npm/@mysten/[email protected], npm/@solana/[email protected], npm/@tanstack/[email protected], npm/@tanstack/[email protected], npm/@tanstack/[email protected], npm/@tonconnect/[email protected], npm/@types/[email protected], npm/@types/[email protected]

View full report↗︎

@gin-lsl
Copy link
Collaborator Author

gin-lsl commented Dec 4, 2024

我看你改了 lock 文件,不要改呢?把和这个 PR 无关的内容先去掉。

pr 新增了一个依赖,好像避免不了 lock 文件的变动。

@yutingzhao1991
Copy link
Collaborator

看上去 CI 的报错就和你加的依赖有关:

packages/bitcoin build: error - src/adapter/wallets/xverse.ts:88:7 - TS2353: Object literal may only specify known properties, and 'allowedSignHash' does not exist in type 'SignPsbtParams'.
packages/bitcoin build: error - Error: Declaration generation failed.

@yutingzhao1991
Copy link
Collaborator

我看你改了 lock 文件,不要改呢?把和这个 PR 无关的内容先去掉。

pr 新增了一个依赖,好像避免不了 lock 文件的变动。

升级到 pnpm@9 之后再重新添加下依赖试试呢?

@gin-lsl
Copy link
Collaborator Author

gin-lsl commented Dec 4, 2024

升级到 pnpm@9 之后再重新添加下依赖试试呢?

我本地的 pnpm 已经是最新的了。

看上去 CI 的报错就和你加的依赖有关:

这个错误是由于另一个依赖 sats-connect 变更导致的: #1274

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