From df9bbaab2ca6fb02c78cc1474618c83796b0cc5d Mon Sep 17 00:00:00 2001 From: albertfolch-redeemeum <102516373+albertfolch-redeemeum@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:35:37 +0100 Subject: [PATCH] feat: remove uniswap wallet and fix coinbase wallet (#1000) --- package-lock.json | 102 +++++++++--------- package.json | 2 +- .../accountDrawer/AuthenticatedHeader.tsx | 9 +- src/components/header/web3Provider/index.tsx | 2 +- src/components/header/web3Status/index.tsx | 1 + src/lib/connection/index.ts | 28 +---- src/lib/utils/hooks/useSwitchChain.ts | 4 +- 7 files changed, 68 insertions(+), 80 deletions(-) diff --git a/package-lock.json b/package-lock.json index 466892189..be4a11c37 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@apollo/client": "^3.8.1", "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/react-kit": "^0.25.0-alpha.2", + "@bosonprotocol/react-kit": "^0.25.0-alpha.4", "@davatar/react": "^1.10.4", "@ethersproject/address": "^5.6.1", "@ethersproject/units": "^5.6.1", @@ -2304,11 +2304,11 @@ } }, "node_modules/@bosonprotocol/common": { - "version": "1.25.1-alpha.5", - "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.25.1-alpha.5.tgz", - "integrity": "sha512-qofelwJcLELug01HqRX/X3jkqpWu/UeBJYO3wNjUhd4/2ElXVKKLrkSZgpwnmnL3+nINwtzvMYdtW+4k9heYYg==", + "version": "1.25.1-alpha.7", + "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.25.1-alpha.7.tgz", + "integrity": "sha512-Zd5FdrM4quHnK2HtRpcCuP96oyZ9T5O8kPuPJV+HzDov98mN6lVoS4grj1pqP1qG2QsQ6SsYdT85sJlKYuadMQ==", "dependencies": { - "@bosonprotocol/metadata": "^1.13.1-alpha.5", + "@bosonprotocol/metadata": "^1.13.1-alpha.7", "@ethersproject/abi": "^5.5.0", "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -2318,11 +2318,11 @@ } }, "node_modules/@bosonprotocol/core-sdk": { - "version": "1.35.0-alpha.2", - "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.35.0-alpha.2.tgz", - "integrity": "sha512-Du37u6nA1HHS6sUAB2Bgb+adq/psoRUY31uxmQyJ9kWb+/23QLPGLCFYonxdkZAbwqbdFtRk6592W1ctzCOXYw==", + "version": "1.35.0-alpha.4", + "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.35.0-alpha.4.tgz", + "integrity": "sha512-Oi7etzqgL5muA1yXFcD75wwTFDFWZFnqATbHfstKi6CmkJF5smMTclvzd4hR0wFWqVpWTi4p3k3bA0bjT+k58Q==", "dependencies": { - "@bosonprotocol/common": "^1.25.1-alpha.5", + "@bosonprotocol/common": "^1.25.1-alpha.7", "@ethersproject/abi": "^5.5.0", "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -2338,44 +2338,44 @@ } }, "node_modules/@bosonprotocol/ethers-sdk": { - "version": "1.12.12-alpha.5", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.12.12-alpha.5.tgz", - "integrity": "sha512-6lZz0Z3ZFT7HBGf8sJEvYkpiXtNRAk4ciImueFZWUwxAiiJj/9ofu06tYrsjBE8j4S4pQEzRVL6uHZ4s2M4Vcw==", + "version": "1.12.12-alpha.7", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.12.12-alpha.7.tgz", + "integrity": "sha512-igc/RCUsumyZ9fbbLi+yx7qBzEWqQLktKsNID6s21miz3OD8KU0HnvAiTtDDbpc0szfGTNaU9oVCl/9xleiFew==", "dependencies": { - "@bosonprotocol/common": "^1.25.1-alpha.5" + "@bosonprotocol/common": "^1.25.1-alpha.7" }, "peerDependencies": { "ethers": "^5.5.0" } }, "node_modules/@bosonprotocol/ipfs-storage": { - "version": "1.10.11-alpha.5", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ipfs-storage/-/ipfs-storage-1.10.11-alpha.5.tgz", - "integrity": "sha512-K9odaw8BcaUvfojPfB1UQ15EmnP6QHKQqZxESQ50g/Qz0DVSrTQRMJWF1pEjc/yPulukMPZelOnPW76wG/1pkg==", + "version": "1.10.11-alpha.7", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ipfs-storage/-/ipfs-storage-1.10.11-alpha.7.tgz", + "integrity": "sha512-9XOEGJDjQvcEgFcWXBn7IZWwLcx5jPDX7rS1M+pa8HNkBFL/iyZUegIWM7oNE+5edyJ/PJI6sNYn3HIc1n3j+Q==", "dependencies": { - "@bosonprotocol/metadata": "^1.13.1-alpha.5", + "@bosonprotocol/metadata": "^1.13.1-alpha.7", "ipfs-http-client": "^56.0.1", "multiformats": "^9.6.4", "uint8arrays": "^3.0.0" } }, "node_modules/@bosonprotocol/metadata": { - "version": "1.13.1-alpha.5", - "resolved": "https://registry.npmjs.org/@bosonprotocol/metadata/-/metadata-1.13.1-alpha.5.tgz", - "integrity": "sha512-VFZOZ07ZV4hm/6bPJ7XqsLcE2aoPjDmk0sqCErsd8z1IuNod8yIsqxT1wZNP5a4J3SAqgg2wA45qTIvkyT8QKw==", + "version": "1.13.1-alpha.7", + "resolved": "https://registry.npmjs.org/@bosonprotocol/metadata/-/metadata-1.13.1-alpha.7.tgz", + "integrity": "sha512-R2IJM/WzscVTxRPqM61j8yGUR3W1v7qGAxqOzLYBq6FcpnCt9CHlf7/9M9CwiQX6yRWw8RYDkRwxMoxN2vRdiA==", "dependencies": { "schema-to-yup": "^1.11.11" } }, "node_modules/@bosonprotocol/react-kit": { - "version": "0.25.0-alpha.2", - "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.25.0-alpha.2.tgz", - "integrity": "sha512-Qt6keVZWOVl3qicTsy7TEYRiaruXt5gUWBJmIY0xUGtm8MZYrennR4uZbHU8nf9bmPeqX+Jn3YlAPHWQ30SJMA==", + "version": "0.25.0-alpha.4", + "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.25.0-alpha.4.tgz", + "integrity": "sha512-IbjnPxsHeLEZ+biSAJjNyd9FqnJ/i75SG/IBacfmwCWJ1e6MDl7kTyqLwdpqVTvUdMQXgdFR1jPBa/B0hgWYMw==", "dependencies": { "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/core-sdk": "^1.35.0-alpha.2", - "@bosonprotocol/ethers-sdk": "^1.12.12-alpha.5", - "@bosonprotocol/ipfs-storage": "^1.10.11-alpha.5", + "@bosonprotocol/core-sdk": "^1.35.0-alpha.4", + "@bosonprotocol/ethers-sdk": "^1.12.12-alpha.7", + "@bosonprotocol/ipfs-storage": "^1.10.11-alpha.7", "@davatar/react": "1.11.1", "@ethersproject/units": "5.6.0", "@glidejs/glide": "3.6.0", @@ -47630,11 +47630,11 @@ } }, "@bosonprotocol/common": { - "version": "1.25.1-alpha.5", - "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.25.1-alpha.5.tgz", - "integrity": "sha512-qofelwJcLELug01HqRX/X3jkqpWu/UeBJYO3wNjUhd4/2ElXVKKLrkSZgpwnmnL3+nINwtzvMYdtW+4k9heYYg==", + "version": "1.25.1-alpha.7", + "resolved": "https://registry.npmjs.org/@bosonprotocol/common/-/common-1.25.1-alpha.7.tgz", + "integrity": "sha512-Zd5FdrM4quHnK2HtRpcCuP96oyZ9T5O8kPuPJV+HzDov98mN6lVoS4grj1pqP1qG2QsQ6SsYdT85sJlKYuadMQ==", "requires": { - "@bosonprotocol/metadata": "^1.13.1-alpha.5", + "@bosonprotocol/metadata": "^1.13.1-alpha.7", "@ethersproject/abi": "^5.5.0", "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -47644,11 +47644,11 @@ } }, "@bosonprotocol/core-sdk": { - "version": "1.35.0-alpha.2", - "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.35.0-alpha.2.tgz", - "integrity": "sha512-Du37u6nA1HHS6sUAB2Bgb+adq/psoRUY31uxmQyJ9kWb+/23QLPGLCFYonxdkZAbwqbdFtRk6592W1ctzCOXYw==", + "version": "1.35.0-alpha.4", + "resolved": "https://registry.npmjs.org/@bosonprotocol/core-sdk/-/core-sdk-1.35.0-alpha.4.tgz", + "integrity": "sha512-Oi7etzqgL5muA1yXFcD75wwTFDFWZFnqATbHfstKi6CmkJF5smMTclvzd4hR0wFWqVpWTi4p3k3bA0bjT+k58Q==", "requires": { - "@bosonprotocol/common": "^1.25.1-alpha.5", + "@bosonprotocol/common": "^1.25.1-alpha.7", "@ethersproject/abi": "^5.5.0", "@ethersproject/address": "^5.5.0", "@ethersproject/bignumber": "^5.5.0", @@ -47664,41 +47664,41 @@ } }, "@bosonprotocol/ethers-sdk": { - "version": "1.12.12-alpha.5", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.12.12-alpha.5.tgz", - "integrity": "sha512-6lZz0Z3ZFT7HBGf8sJEvYkpiXtNRAk4ciImueFZWUwxAiiJj/9ofu06tYrsjBE8j4S4pQEzRVL6uHZ4s2M4Vcw==", + "version": "1.12.12-alpha.7", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ethers-sdk/-/ethers-sdk-1.12.12-alpha.7.tgz", + "integrity": "sha512-igc/RCUsumyZ9fbbLi+yx7qBzEWqQLktKsNID6s21miz3OD8KU0HnvAiTtDDbpc0szfGTNaU9oVCl/9xleiFew==", "requires": { - "@bosonprotocol/common": "^1.25.1-alpha.5" + "@bosonprotocol/common": "^1.25.1-alpha.7" } }, "@bosonprotocol/ipfs-storage": { - "version": "1.10.11-alpha.5", - "resolved": "https://registry.npmjs.org/@bosonprotocol/ipfs-storage/-/ipfs-storage-1.10.11-alpha.5.tgz", - "integrity": "sha512-K9odaw8BcaUvfojPfB1UQ15EmnP6QHKQqZxESQ50g/Qz0DVSrTQRMJWF1pEjc/yPulukMPZelOnPW76wG/1pkg==", + "version": "1.10.11-alpha.7", + "resolved": "https://registry.npmjs.org/@bosonprotocol/ipfs-storage/-/ipfs-storage-1.10.11-alpha.7.tgz", + "integrity": "sha512-9XOEGJDjQvcEgFcWXBn7IZWwLcx5jPDX7rS1M+pa8HNkBFL/iyZUegIWM7oNE+5edyJ/PJI6sNYn3HIc1n3j+Q==", "requires": { - "@bosonprotocol/metadata": "^1.13.1-alpha.5", + "@bosonprotocol/metadata": "^1.13.1-alpha.7", "ipfs-http-client": "^56.0.1", "multiformats": "^9.6.4", "uint8arrays": "^3.0.0" } }, "@bosonprotocol/metadata": { - "version": "1.13.1-alpha.5", - "resolved": "https://registry.npmjs.org/@bosonprotocol/metadata/-/metadata-1.13.1-alpha.5.tgz", - "integrity": "sha512-VFZOZ07ZV4hm/6bPJ7XqsLcE2aoPjDmk0sqCErsd8z1IuNod8yIsqxT1wZNP5a4J3SAqgg2wA45qTIvkyT8QKw==", + "version": "1.13.1-alpha.7", + "resolved": "https://registry.npmjs.org/@bosonprotocol/metadata/-/metadata-1.13.1-alpha.7.tgz", + "integrity": "sha512-R2IJM/WzscVTxRPqM61j8yGUR3W1v7qGAxqOzLYBq6FcpnCt9CHlf7/9M9CwiQX6yRWw8RYDkRwxMoxN2vRdiA==", "requires": { "schema-to-yup": "^1.11.11" } }, "@bosonprotocol/react-kit": { - "version": "0.25.0-alpha.2", - "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.25.0-alpha.2.tgz", - "integrity": "sha512-Qt6keVZWOVl3qicTsy7TEYRiaruXt5gUWBJmIY0xUGtm8MZYrennR4uZbHU8nf9bmPeqX+Jn3YlAPHWQ30SJMA==", + "version": "0.25.0-alpha.4", + "resolved": "https://registry.npmjs.org/@bosonprotocol/react-kit/-/react-kit-0.25.0-alpha.4.tgz", + "integrity": "sha512-IbjnPxsHeLEZ+biSAJjNyd9FqnJ/i75SG/IBacfmwCWJ1e6MDl7kTyqLwdpqVTvUdMQXgdFR1jPBa/B0hgWYMw==", "requires": { "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/core-sdk": "^1.35.0-alpha.2", - "@bosonprotocol/ethers-sdk": "^1.12.12-alpha.5", - "@bosonprotocol/ipfs-storage": "^1.10.11-alpha.5", + "@bosonprotocol/core-sdk": "^1.35.0-alpha.4", + "@bosonprotocol/ethers-sdk": "^1.12.12-alpha.7", + "@bosonprotocol/ipfs-storage": "^1.10.11-alpha.7", "@davatar/react": "1.11.1", "@ethersproject/units": "5.6.0", "@glidejs/glide": "3.6.0", diff --git a/package.json b/package.json index e6e954249..a153e7e6e 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "dependencies": { "@apollo/client": "^3.8.1", "@bosonprotocol/chat-sdk": "^1.3.1-alpha.9", - "@bosonprotocol/react-kit": "^0.25.0-alpha.2", + "@bosonprotocol/react-kit": "^0.25.0-alpha.4", "@davatar/react": "^1.10.4", "@ethersproject/address": "^5.6.1", "@ethersproject/units": "^5.6.1", diff --git a/src/components/header/accountDrawer/AuthenticatedHeader.tsx b/src/components/header/accountDrawer/AuthenticatedHeader.tsx index e7de4131e..98c483dc9 100644 --- a/src/components/header/accountDrawer/AuthenticatedHeader.tsx +++ b/src/components/header/accountDrawer/AuthenticatedHeader.tsx @@ -83,6 +83,7 @@ const IconHoverText = styled.span` const IconContainer = styled.div` display: flex; align-items: center; + justify-content: flex-end; & > a, & > button { margin-right: 8px; @@ -144,6 +145,12 @@ const PortfolioDrawerContainer = styled(Column)` flex: 1; `; +const StyledIconWithConfirmTextButton = styled(IconWithConfirmTextButton)` + * { + font-size: 0.7rem; + } +`; + export function PortfolioArrow({ change, ...rest @@ -247,7 +254,7 @@ export default function AuthenticatedHeader({ account }: { account: string }) { )} - disconnect({ isUserDisconnecting: true })} Icon={SignOut} diff --git a/src/components/header/web3Provider/index.tsx b/src/components/header/web3Provider/index.tsx index b3b49f5b1..6718c472a 100644 --- a/src/components/header/web3Provider/index.tsx +++ b/src/components/header/web3Provider/index.tsx @@ -35,7 +35,7 @@ function Updater() { const [, addConnectedWallet] = useConnectedWallets(); useEffect(() => { if (account && account !== previousAccount) { - const walletType = getConnection(connector).getName(); + const walletType = getConnection(connector)?.getName() ?? ""; addConnectedWallet({ account, walletType }); } diff --git a/src/components/header/web3Status/index.tsx b/src/components/header/web3Status/index.tsx index d20ffde59..6a16b2601 100644 --- a/src/components/header/web3Status/index.tsx +++ b/src/components/header/web3Status/index.tsx @@ -41,6 +41,7 @@ const Web3StatusGeneric = styled.button` const breakpointWhenConnectButtonOverflows = "1300px"; const Web3StatusConnected = styled(Web3StatusGeneric)<{ $color: string }>` border: 2px solid transparent; + width: auto; font-weight: 500; color: ${({ $color }) => $color}; &:hover, diff --git a/src/lib/connection/index.ts b/src/lib/connection/index.ts index e40d5b803..55aba9b15 100644 --- a/src/lib/connection/index.ts +++ b/src/lib/connection/index.ts @@ -8,7 +8,6 @@ import { Actions, Connector } from "@web3-react/types"; import GNOSIS_ICON from "assets/images/gnosis.png"; import UNISWAP_LOGO from "assets/svg/logo.svg"; import COINBASE_ICON from "assets/wallets/coinbase-icon.svg"; -import UNIWALLET_ICON from "assets/wallets/uniswap-wallet-icon.png"; import WALLET_CONNECT_ICON from "assets/wallets/walletconnect-icon.svg"; import { CONFIG, @@ -18,7 +17,7 @@ import { import { useSyncExternalStore } from "react"; import { RPC_PROVIDERS } from "../constants/providers"; -import { isMobile, isNonIOSPhone } from "../utils/userAgent"; +import { isMobile } from "../utils/userAgent"; import { Connection, ConnectionType } from "./types"; import { getInjection, @@ -26,10 +25,7 @@ import { getIsInjected, getIsMetaMaskWallet } from "./utils"; -import { - UniwalletConnect as UniwalletWCV2Connect, - WalletConnectV2 -} from "./WalletConnectV2"; +import { WalletConnectV2 } from "./WalletConnectV2"; const RPC_URLS = CONFIG.rpcUrls; function onError(error: Error) { @@ -170,19 +166,6 @@ export const walletConnectV2Connection: Connection = new (class } })(); -const [web3WCV2UniwalletConnect, web3WCV2UniwalletConnectHooks] = - initializeConnector( - (actions) => new UniwalletWCV2Connect({ actions, onError }) - ); -export const uniwalletWCV2ConnectConnection: Connection = { - getName: () => "Uniswap Wallet", - connector: web3WCV2UniwalletConnect, - hooks: web3WCV2UniwalletConnectHooks, - type: ConnectionType.UNISWAP_WALLET_V2, - getIcon: () => UNIWALLET_ICON, - shouldDisplay: () => Boolean(!getIsInjectedMobileBrowser() && !isNonIOSPhone) -}; - const [web3CoinbaseWallet, web3CoinbaseWalletHooks] = initializeConnector( (actions) => @@ -197,7 +180,7 @@ const [web3CoinbaseWallet, web3CoinbaseWalletHooks] = onError }) ); -const coinbaseWalletConnection: Connection = { +export const coinbaseWalletConnection: Connection = { getName: () => "Coinbase Wallet", connector: web3CoinbaseWallet, hooks: web3CoinbaseWalletHooks, @@ -224,8 +207,7 @@ export const connections = [ gnosisSafeConnection, walletConnectV2Connection, coinbaseWalletConnection, - networkConnection, - uniwalletWCV2ConnectConnection + networkConnection ]; export function getConnection(c: Connector | ConnectionType) { @@ -245,8 +227,6 @@ export function getConnection(c: Connector | ConnectionType) { return coinbaseWalletConnection; case ConnectionType.WALLET_CONNECT_V2: return walletConnectV2Connection; - case ConnectionType.UNISWAP_WALLET_V2: - return uniwalletWCV2ConnectConnection; case ConnectionType.NETWORK: return networkConnection; case ConnectionType.GNOSIS_SAFE: diff --git a/src/lib/utils/hooks/useSwitchChain.ts b/src/lib/utils/hooks/useSwitchChain.ts index 381a5e331..1809bfb24 100644 --- a/src/lib/utils/hooks/useSwitchChain.ts +++ b/src/lib/utils/hooks/useSwitchChain.ts @@ -7,8 +7,8 @@ import { useAppDispatch } from "state/hooks"; import { endSwitchingChain, startSwitchingChain } from "state/wallets/reducer"; import { + coinbaseWalletConnection, networkConnection, - uniwalletWCV2ConnectConnection, walletConnectV2Connection } from "../../connection"; import { getChainInfo } from "../../constants/chainInfo"; @@ -51,7 +51,7 @@ export function useSwitchChain(doConnect = true) { if ( [ walletConnectV2Connection.connector, - uniwalletWCV2ConnectConnection.connector, + coinbaseWalletConnection.connector, networkConnection.connector ].includes(connector) ) {