Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/lemon-bugs-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@node-real/walletkit': minor
---

fix: restore BinanceWeb3WalletConnector for mobile in-app browser compatibility

5 changes: 5 additions & 0 deletions .changeset/moody-shrimps-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@node-real/walletkit': minor
---

feat: add desktop extension support for Binance Web3 Wallet
13 changes: 13 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"permissions": {
"allow": [
"Bash(/tmp/comparison.txt:*)",
"Read(//tmp/**)",
"WebFetch(domain:developers.binance.com)",
"Bash(npm run:*)",
"Bash(git stash:*)",
"Bash(grep \"\"version\"\":*)",
"Bash(npx tsc:*)"
]
}
}
9 changes: 7 additions & 2 deletions examples/nextjs/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import {
WalletKitProvider,
getDefaultConfig,
} from '@node-real/walletkit';
import { trustWallet, metaMask, walletConnect } from '@node-real/walletkit/wallets';
import {
binanceWeb3Wallet,
trustWallet,
metaMask,
walletConnect,
} from '@node-real/walletkit/wallets';

const config = createConfig(
getDefaultConfig({
Expand All @@ -22,7 +27,7 @@ const config = createConfig(
walletConnectProjectId: 'e68a1816d39726c2afabf05661a32767',

chains,
connectors: [trustWallet(), metaMask(), walletConnect()],
connectors: [binanceWeb3Wallet(), trustWallet(), metaMask(), walletConnect()],
}),
);

Expand Down
9 changes: 7 additions & 2 deletions examples/vite/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import {
WalletKitOptions,
SwitchNetworkModal,
} from '@node-real/walletkit';
import { trustWallet, metaMask, walletConnect } from '@node-real/walletkit/wallets';
import {
binanceWeb3Wallet,
trustWallet,
metaMask,
walletConnect,
} from '@node-real/walletkit/wallets';

const config = createConfig(
getDefaultConfig({
Expand All @@ -20,7 +25,7 @@ const config = createConfig(
walletConnectProjectId: 'e68a1816d39726c2afabf05661a32767',

chains,
connectors: [trustWallet(), metaMask(), walletConnect()],
connectors: [binanceWeb3Wallet(), trustWallet(), metaMask(), walletConnect()],
}),
);

Expand Down
1 change: 1 addition & 0 deletions packages/walletkit/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ declare global {
tokenpocket: any;
okexchain: any;
bitkeep: any;
binancew3w: any;
}
}

Expand Down
3 changes: 3 additions & 0 deletions packages/walletkit/src/wallets/binanceWeb3Wallet/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@ function getProvider() {
if (isMobile()) {
return window.ethereum;
}

// Desktop: use Binance Web3 Wallet browser extension
return window.binancew3w?.ethereum;
}
6 changes: 3 additions & 3 deletions packages/walletkit/src/wallets/binanceWeb3Wallet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ export function binanceWeb3Wallet(props: PartialCustomProps = {}): WalletProps {
default: 'https://www.binance.com/en/web3wallet',
},
spinnerColor: undefined,
showQRCode: true,
showQRCode: false,
isInstalled: isBinanceWeb3Wallet,
createConnector: (chains: Chain[]) => {
return new BinanceWeb3WalletConnector({
chains,
options: {
shimDisconnect: true,
...connectorOptions,
},
});
Expand All @@ -44,7 +43,8 @@ export function binanceWeb3Wallet(props: PartialCustomProps = {}): WalletProps {
}

export function isBinanceWeb3Wallet() {
return hasInjectedProvider('isBinance' as any);
if (typeof window === 'undefined') return false;
return !!window.binancew3w?.ethereum || hasInjectedProvider('isBinance' as any);
}

const getDeepLink = (url: string) => {
Expand Down
11 changes: 8 additions & 3 deletions website/src/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ npm i @node-real/walletkit@^1 wagmi@^1 viem@^1

| wallet | mainnet | testnet |
| ------------------- | ------- | ------- |
| binanceWeb3Wallet() | ✅ | |
| binanceWeb3Wallet() | ✅ | |
| bitgetWallet() | ✅ | ❌ |
| coinbaseWallet() | ✅ | ✅ |
| metaMask() | ✅ | ✅ |
Expand Down Expand Up @@ -96,7 +96,12 @@ import {
WalletKitOptions,
SwitchNetworkModal,
} from '@node-real/walletkit';
import { metaMask, trustWallet, walletConnect } from '@node-real/walletkit/wallets';
import {
binanceWeb3Wallet,
metaMask,
trustWallet,
walletConnect,
} from '@node-real/walletkit/wallets';

const config = createConfig(
getDefaultConfig({
Expand All @@ -108,7 +113,7 @@ const config = createConfig(
walletConnectProjectId: 'xxx',

chains,
connectors: [trustWallet(), metaMask(), walletConnect()],
connectors: [binanceWeb3Wallet(), trustWallet(), metaMask(), walletConnect()],
}),
);

Expand Down