From bd330356a66c36b3c3ccca3d699675e0492ee88a Mon Sep 17 00:00:00 2001 From: Alexander Khramov Date: Tue, 27 Aug 2024 21:50:42 +0300 Subject: [PATCH 1/5] feat: reorder wallets --- apps/demo-react/components/WalletsModal.tsx | 2 +- .../src/components/WalletsModal/WalletsModalForEth.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/demo-react/components/WalletsModal.tsx b/apps/demo-react/components/WalletsModal.tsx index 0030c12d..e4a2ab8a 100644 --- a/apps/demo-react/components/WalletsModal.tsx +++ b/apps/demo-react/components/WalletsModal.tsx @@ -12,7 +12,7 @@ export default function WalletsModal(props: { isDarkTheme: boolean }) { metrics={metrics} shouldInvertWalletIcon={isDarkTheme} linkDontHaveWallet={LINK_DONT_HAVE_WALLET_DEFAULT} - walletsPinned={['okx', 'browserExtension']} + walletsPinned={['binanceWallet', 'browserExtension']} onClickWalletsMore={() => console.log('metrics: wallets modal show more')} onClickWalletsLess={() => console.log('metrics: wallets modal show less')} /> diff --git a/packages/connect-wallet-modal/src/components/WalletsModal/WalletsModalForEth.tsx b/packages/connect-wallet-modal/src/components/WalletsModal/WalletsModalForEth.tsx index 53fb01d3..34c42e1f 100644 --- a/packages/connect-wallet-modal/src/components/WalletsModal/WalletsModalForEth.tsx +++ b/packages/connect-wallet-modal/src/components/WalletsModal/WalletsModalForEth.tsx @@ -26,13 +26,13 @@ const buttonComponentsByConnectorId: WalletsModalEthProps['buttonComponentsByCon const WALLETS_DISPLAY_CONFIG_DEFAULT: WalletsModalEthProps['walletsShown'] = [ 'browserExtension', 'metaMask', + 'okx', 'ledgerHID', 'ledgerLive', 'walletConnect', 'binanceWallet', 'coinbase', 'trust', - 'okx', 'exodus', 'brave', 'bitget', From 511169f9d05691ac725e429942d6f737809f865e Mon Sep 17 00:00:00 2001 From: Alexander Khramov Date: Tue, 27 Aug 2024 23:52:58 +0300 Subject: [PATCH 2/5] fix: pass chainId to binanceWalletConnector --- packages/wallets/binance-wallet/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/wallets/binance-wallet/src/index.ts b/packages/wallets/binance-wallet/src/index.ts index 3989b8b6..b0c29e3b 100644 --- a/packages/wallets/binance-wallet/src/index.ts +++ b/packages/wallets/binance-wallet/src/index.ts @@ -23,7 +23,7 @@ export const BinanceWeb3Wallet: WalletAdapterType = ({ defaultChain }) => { walletName: name, type: binanceWalletConnector.type, icon: WalletIcon, - createConnectorFn: binanceWalletConnector(), + createConnectorFn: binanceWalletConnector({ chainId: defaultChain.id }), detector: isInBinance, deeplink, }; From 26072f018cb670f07e0d021959a4bc2d9b8c168b Mon Sep 17 00:00:00 2001 From: Alexander Khramov Date: Tue, 27 Aug 2024 23:55:36 +0300 Subject: [PATCH 3/5] fix: binance wallet - actually use deeplink --- .../src/connectButtons/ConnectBinance.tsx | 41 ++++++++++++------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/packages/connect-wallet-modal/src/connectButtons/ConnectBinance.tsx b/packages/connect-wallet-modal/src/connectButtons/ConnectBinance.tsx index 3cd6bb03..b2cd9372 100644 --- a/packages/connect-wallet-modal/src/connectButtons/ConnectBinance.tsx +++ b/packages/connect-wallet-modal/src/connectButtons/ConnectBinance.tsx @@ -3,6 +3,8 @@ import { useConnect } from 'wagmi'; import { useDisconnect } from '@reef-knot/core-react'; import { ConnectButton } from '../components/ConnectButton'; import { ConnectInjectedProps } from './types'; +import { isMobileOrTablet } from '@reef-knot/wallets-helpers'; +import { openWindow } from '../helpers/index'; export const ConnectBinance: FC = ( props: ConnectInjectedProps, @@ -18,36 +20,43 @@ export const ConnectBinance: FC = ( downloadURLs, detector, connector, + deeplink, ...rest } = props; const metricsOnConnect = metrics?.events?.connect?.handlers[walletId]; const metricsOnClick = metrics?.events?.click?.handlers[walletId]; - const { connect } = useConnect(); + const { connectAsync } = useConnect(); const { disconnect } = useDisconnect(); - const handleConnect = useCallback(() => { + const handleConnect = useCallback(async () => { onBeforeConnect?.(); metricsOnClick?.(); disconnect?.(); - connect( - { connector }, - { - onSuccess: () => { - onConnect?.(); - metricsOnConnect?.(); + + if (isMobileOrTablet && deeplink) { + openWindow(deeplink); + } else { + await connectAsync( + { connector }, + { + onSuccess: () => { + onConnect?.(); + metricsOnConnect?.(); + }, }, - }, - ); + ); + } }, [ - connect, - connector, - disconnect, metricsOnClick, + metricsOnConnect, + disconnect, + deeplink, + connectAsync, + connector, onBeforeConnect, onConnect, - metricsOnConnect, ]); return ( @@ -55,7 +64,9 @@ export const ConnectBinance: FC = ( {...rest} icon={WalletIcon} shouldInvertWalletIcon={shouldInvertWalletIcon} - onClick={handleConnect} + onClick={() => { + void handleConnect(); + }} > {walletName} From 44243b53a6cce6bddbf79416d757c0b5a9b02204 Mon Sep 17 00:00:00 2001 From: Alexander Khramov Date: Wed, 28 Aug 2024 00:04:14 +0300 Subject: [PATCH 4/5] chore: reef-knot v5.5.2 --- packages/connect-wallet-modal/CHANGELOG.md | 8 ++++++++ packages/connect-wallet-modal/package.json | 4 ++-- packages/reef-knot/CHANGELOG.md | 9 +++++++++ packages/reef-knot/package.json | 6 +++--- packages/wallets-list/CHANGELOG.md | 7 +++++++ packages/wallets-list/package.json | 4 ++-- packages/wallets/binance-wallet/CHANGELOG.md | 6 ++++++ packages/wallets/binance-wallet/package.json | 2 +- 8 files changed, 38 insertions(+), 8 deletions(-) diff --git a/packages/connect-wallet-modal/CHANGELOG.md b/packages/connect-wallet-modal/CHANGELOG.md index 897c9cee..e74030c1 100644 --- a/packages/connect-wallet-modal/CHANGELOG.md +++ b/packages/connect-wallet-modal/CHANGELOG.md @@ -1,5 +1,13 @@ # @reef-knot/connect-wallet-modal +## 5.3.2 + +### Patch Changes + +- Binance Wallet: actually use explicitly passed deeplink on mobiles +- Reorder wallets + - @reef-knot/wallets-list@2.2.2 + ## 5.3.1 ### Patch Changes diff --git a/packages/connect-wallet-modal/package.json b/packages/connect-wallet-modal/package.json index e08f779a..9d3e94fb 100644 --- a/packages/connect-wallet-modal/package.json +++ b/packages/connect-wallet-modal/package.json @@ -1,6 +1,6 @@ { "name": "@reef-knot/connect-wallet-modal", - "version": "5.3.1", + "version": "5.3.2", "main": "dist/index.js", "types": "dist/index.d.ts", "exports": { @@ -41,7 +41,7 @@ "@ledgerhq/hw-app-eth": "^6.37.1", "@ledgerhq/hw-transport-webhid": "^6.29.0", "@lidofinance/lido-ui": "^3.18.0", - "@reef-knot/wallets-list": "^2.2.1", + "@reef-knot/wallets-list": "^2.2.2", "@types/react": "18.2.45", "@types/react-dom": "18.2.17" }, diff --git a/packages/reef-knot/CHANGELOG.md b/packages/reef-knot/CHANGELOG.md index b83d4524..61f2419d 100644 --- a/packages/reef-knot/CHANGELOG.md +++ b/packages/reef-knot/CHANGELOG.md @@ -1,5 +1,14 @@ # reef-knot +## 5.5.2 + +### Patch Changes + +- Updated dependencies +- Updated dependencies + - @reef-knot/connect-wallet-modal@5.3.2 + - @reef-knot/wallets-list@2.2.2 + ## 5.5.1 ### Patch Changes diff --git a/packages/reef-knot/package.json b/packages/reef-knot/package.json index 2fd67d55..95a622a5 100644 --- a/packages/reef-knot/package.json +++ b/packages/reef-knot/package.json @@ -1,6 +1,6 @@ { "name": "reef-knot", - "version": "5.5.1", + "version": "5.5.2", "main": "dist/index.js", "types": "dist/index.d.ts", "exports": { @@ -41,11 +41,11 @@ "lint": "eslint --ext ts,tsx,js,mjs ." }, "dependencies": { - "@reef-knot/connect-wallet-modal": "5.3.1", + "@reef-knot/connect-wallet-modal": "5.3.2", "@reef-knot/core-react": "4.2.1", "@reef-knot/web3-react": "4.0.1", "@reef-knot/ui-react": "2.1.3", - "@reef-knot/wallets-list": "2.2.1", + "@reef-knot/wallets-list": "2.2.2", "@reef-knot/wallets-helpers": "2.1.0", "@reef-knot/types": "2.1.0", "@reef-knot/ledger-connector": "4.1.0" diff --git a/packages/wallets-list/CHANGELOG.md b/packages/wallets-list/CHANGELOG.md index ab5338a8..3bdd41fb 100644 --- a/packages/wallets-list/CHANGELOG.md +++ b/packages/wallets-list/CHANGELOG.md @@ -1,5 +1,12 @@ # @reef-knot/wallets-list +## 2.2.2 + +### Patch Changes + +- Updated dependencies + - @reef-knot/wallet-adapter-binance-wallet@1.0.2 + ## 2.2.1 ### Patch Changes diff --git a/packages/wallets-list/package.json b/packages/wallets-list/package.json index 4d3d3ec3..907698da 100644 --- a/packages/wallets-list/package.json +++ b/packages/wallets-list/package.json @@ -1,6 +1,6 @@ { "name": "@reef-knot/wallets-list", - "version": "2.2.1", + "version": "2.2.2", "main": "dist/index.js", "types": "dist/index.d.ts", "exports": { @@ -43,7 +43,7 @@ "@reef-knot/wallet-adapter-exodus": "2.1.0", "@reef-knot/wallet-adapter-walletconnect": "2.0.1", "@reef-knot/wallet-adapter-ambire": "2.0.1", - "@reef-knot/wallet-adapter-binance-wallet": "1.0.1", + "@reef-knot/wallet-adapter-binance-wallet": "1.0.2", "@reef-knot/wallet-adapter-bitkeep": "2.1.0", "@reef-knot/wallet-adapter-coin98": "2.1.0", "@reef-knot/wallet-adapter-brave": "2.1.0", diff --git a/packages/wallets/binance-wallet/CHANGELOG.md b/packages/wallets/binance-wallet/CHANGELOG.md index 2a719143..155171fc 100644 --- a/packages/wallets/binance-wallet/CHANGELOG.md +++ b/packages/wallets/binance-wallet/CHANGELOG.md @@ -1,5 +1,11 @@ # @reef-knot/wallet-adapter-binance-wallet +## 1.0.2 + +### Patch Changes + +- Pass chainId to binanceWalletConnector + ## 1.0.1 ### Patch Changes diff --git a/packages/wallets/binance-wallet/package.json b/packages/wallets/binance-wallet/package.json index f204a34f..9c1bd14f 100644 --- a/packages/wallets/binance-wallet/package.json +++ b/packages/wallets/binance-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@reef-knot/wallet-adapter-binance-wallet", - "version": "1.0.1", + "version": "1.0.2", "main": "dist/index.js", "types": "dist/index.d.ts", "exports": { From 551aa9d13ab41bcdc8ce488c7642b746932a5af9 Mon Sep 17 00:00:00 2001 From: Alexander Khramov Date: Wed, 28 Aug 2024 09:33:58 +0300 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20ConnectBinance=20=E2=80=93=20fix=20d?= =?UTF-8?q?eeplink=20condition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connect-wallet-modal/src/connectButtons/ConnectBinance.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/connect-wallet-modal/src/connectButtons/ConnectBinance.tsx b/packages/connect-wallet-modal/src/connectButtons/ConnectBinance.tsx index b2cd9372..3ca06c18 100644 --- a/packages/connect-wallet-modal/src/connectButtons/ConnectBinance.tsx +++ b/packages/connect-wallet-modal/src/connectButtons/ConnectBinance.tsx @@ -35,7 +35,7 @@ export const ConnectBinance: FC = ( metricsOnClick?.(); disconnect?.(); - if (isMobileOrTablet && deeplink) { + if (isMobileOrTablet && deeplink && !detector?.()) { openWindow(deeplink); } else { await connectAsync(