@@ -2,7 +2,8 @@ import { Chain } from 'wagmi';
22import { PartialCustomProps , WalletProps } from '..' ;
33import { BinanceWeb3WalletIcon , BinanceWeb3WalletTransparentIcon } from './icon' ;
44import { hasInjectedProvider } from '../utils' ;
5- import { BinanceWeb3WalletConnector } from './connector' ;
5+ import { CustomConnector } from '../custom/connector' ;
6+ import { isMobile } from '@/base/utils/mobile' ;
67
78export const BINANCE_WEB3_WALLET_ID = 'binanceWeb3Wallet' ;
89export const BINANCE_WEB3_WALLET_NAME = 'Binance Web3 Wallet' ;
@@ -21,13 +22,24 @@ export function binanceWeb3Wallet(props: PartialCustomProps = {}): WalletProps {
2122 default : 'https://www.binance.com/en/web3wallet' ,
2223 } ,
2324 spinnerColor : undefined ,
24- showQRCode : true ,
25+ showQRCode : false ,
2526 isInstalled : isBinanceWeb3Wallet ,
2627 createConnector : ( chains : Chain [ ] ) => {
27- return new BinanceWeb3WalletConnector ( {
28+ return new CustomConnector ( {
29+ id : BINANCE_WEB3_WALLET_ID ,
2830 chains,
2931 options : {
32+ name : BINANCE_WEB3_WALLET_NAME ,
3033 shimDisconnect : true ,
34+ getProvider ( ) {
35+ if ( typeof window === 'undefined' ) return ;
36+
37+ if ( isMobile ( ) ) {
38+ return window . ethereum ;
39+ }
40+
41+ return window . binancew3w ?. ethereum ;
42+ } ,
3143 ...connectorOptions ,
3244 } ,
3345 } ) ;
@@ -44,7 +56,8 @@ export function binanceWeb3Wallet(props: PartialCustomProps = {}): WalletProps {
4456}
4557
4658export function isBinanceWeb3Wallet ( ) {
47- return hasInjectedProvider ( 'isBinance' as any ) ;
59+ if ( typeof window === 'undefined' ) return false ;
60+ return ! ! window . binancew3w ?. ethereum || hasInjectedProvider ( 'isBinance' as any ) ;
4861}
4962
5063const getDeepLink = ( url : string ) => {
0 commit comments