web3modal icon indicating copy to clipboard operation
web3modal copied to clipboard

feat: add unisat, bitget and binance web3 wallet bitcoin connector

Open danielsimao opened this issue 6 months ago • 11 comments

Description

Added a new UnisatConnector class to support Bitcoin wallet connectivity for Unisat, Bitget, and BinanceW3W wallets (all of these use the same wallet API).

NOTE: BinanceW3W injects window value inside binance web3 app browser.

Type of change

  • [ ] Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

Associated Issues

For Linear issues: Closes APKT-123 (replace with actual issue ID) For GH issues: closes #456 (replace with actual issue number)

Showcase (Optional)

N/A - No UI changes. This is a backend connector implementation.
Demo recording: [Link to demo recording, if available]

Checklist

  • [ ] Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • [x] My changes generate no new warnings
  • [x] I have reviewed my own code
  • [x] I have filled out all required sections
  • [x] I have tested my changes on the preview link
  • [ ] Approver of this PR confirms that the changes are tested on the preview link

danielsimao avatar Jun 03 '25 15:06 danielsimao

⚠️ No Changeset found

Latest commit: dfb8c7290bbaa650b58f5dba45e4388b0b92e593

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

changeset-bot[bot] avatar Jun 03 '25 15:06 changeset-bot[bot]

@danielsimao is attempting to deploy a commit to the Reown Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jun 03 '25 15:06 vercel[bot]

Deployment failed with the following error:

The provided GitHub repository does not contain the requested branch or commit reference. Please ensure the repository is not empty.

vercel[bot] avatar Jun 04 '25 16:06 vercel[bot]

Hey @enesozturk. Thank you so much for taking the time to helps us ship this. I apologize not not including the docs on the PR description

Unisat Docs: https://docs.unisat.io/dev/open-api-documentation/unisat-wallet Unisat network reference: https://docs.unisat.io/dev/open-api-documentation/unisat-wallet#getnetwork Bitget Docs: https://web3.bitget.com/en/docs/provider-api/btc.html#BTC Binance web3 Wallet Docs: https://developers.binance.com/docs/binance-w3w/bitcoin-provider#provider-detection

danielsimao avatar Jun 06 '25 07:06 danielsimao

Thanks @danielsimao - lastly can you add unit tests for the new connector? We keen to merge this to ship on the next release. I'll follow up for the CI after we add tests

enesozturk avatar Jun 06 '25 08:06 enesozturk

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

Name Status Preview Comments Updated (UTC)
appkit-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2025 6:59am
appkit-gallery ❌ Failed (Inspect) Jul 24, 2025 6:59am
appkit-laboratory ❌ Failed (Inspect) Jul 24, 2025 6:59am

vercel[bot] avatar Jun 06 '25 08:06 vercel[bot]

Thanks @danielsimao - lastly can you add unit tests for the new connector? We keen to merge this to ship on the next release. I'll follow up for the CI after we add tests

Added. Let me know if I missed any test case @enesozturk

danielsimao avatar Jun 06 '25 13:06 danielsimao

@enesozturk note that images are missing for these wallets. Also, testing binance web3 would require a preview deployment because I was not able to access/test it locally.

danielsimao avatar Jun 06 '25 13:06 danielsimao

@danielsimao I've approved the previews so you can see on top. Here is for lab: https://appkit-laboratory-max1etm4j-reown-com.vercel.app/

enesozturk avatar Jun 06 '25 14:06 enesozturk

@danielsimao Testing wallets in the Bitcoin example: https://appkit-laboratory-max1etm4j-reown-com.vercel.app/library/bitcoin/

I've realized that these wallets are not listed as separate options. There is one "UniSat Wallet" option and it's connecting to what ever it picks (UniSat wallet or BitGet)

The wallets should be listed separately. Anyways tested wallets by enabling only one of them each time:

  • UniSat - sign message, switch network, sign message, refresh page + reconnection, all fine ✅
  • BitGet - sign message, switch network, sign message works fine - but there is an issue after page refresh that AppKit doesn't loaded ❌
  • Binance W3W - Is this have a Chrome Extension? How can I test this?

enesozturk avatar Jun 06 '25 14:06 enesozturk

@danielsimao Testing wallets in the Bitcoin example: https://appkit-laboratory-max1etm4j-reown-com.vercel.app/library/bitcoin/

I've realized that these wallets are not listed as separate options. There is one "UniSat Wallet" option and it's connecting to what ever it picks (UniSat wallet or BitGet)

The wallets should be listed separately.

https://github.com/reown-com/appkit/pull/4465/files#diff-b7fafe0b3786d9f8ca6e73b0b8f7a3728ed3bc372b53ad8b9d0bd76ab610354cR123

This is how I added the wallets.

Anyways tested wallets by enabling only one of them each time:

  • UniSat - sign message, switch network, sign message, refresh page + reconnection, all fine ✅
  • BitGet - sign message, switch network, sign message works fine - but there is an issue after page refresh that AppKit doesn't loaded ❌
  • Binance W3W - Is this have a Chrome Extension? How can I test this?

Binance one you can access only through Binance App. They have a wallet inside it, which has a browser. Just like metamask now allows a browser in-app. I just tried and already noticed that it fails to switch chain (maybe it does not support it)

danielsimao avatar Jun 06 '25 14:06 danielsimao

As I see there are some TS issues and it's not able to build the packages:

> @reown/[email protected] build /Users/enesozturk/Desktop/Projects/appkit/packages/ada
│ pters/bitcoin
│ > tsc --build tsconfig.build.json
│ 
│ src/connectors/UnisatConnector.ts:178:35 - error TS2339: Property 'unisat' does not exist on type 
│ 'Wallet'.
│ 
│ 178         wallet = window?.bitkeep?.unisat
│                                       ~~~~~~
│ 
│ src/connectors/UnisatConnector.ts:181:38 - error TS2339: Property 'bitcoin' does not exist on type
│  'Wallet'.
│ 
│ 181         wallet = window?.binancew3w?.bitcoin
│                                          ~~~~~~~
│

The Window object types should have been extended to make sure it has these props. @danielsimao

enesozturk avatar Jul 24 '25 07:07 enesozturk

@danielsimao can you double check if sending psbt with bitget wallet works ? I remember having an issue with that last time

magiziz avatar Jul 24 '25 08:07 magiziz

Replaced with: https://github.com/reown-com/appkit/pull/4705

tomiir avatar Jul 25 '25 15:07 tomiir