Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove uniswap wallet and fix coinbase wallet #1000

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
102 changes: 51 additions & 51 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/components/header/web3Provider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
Expand Down
28 changes: 4 additions & 24 deletions src/lib/connection/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -18,18 +17,15 @@ 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,
getIsCoinbaseWallet,
getIsInjected,
getIsMetaMaskWallet
} from "./utils";
import {
UniwalletConnect as UniwalletWCV2Connect,
WalletConnectV2
} from "./WalletConnectV2";
import { WalletConnectV2 } from "./WalletConnectV2";
const RPC_URLS = CONFIG.rpcUrls;

function onError(error: Error) {
Expand Down Expand Up @@ -170,19 +166,6 @@ export const walletConnectV2Connection: Connection = new (class
}
})();

const [web3WCV2UniwalletConnect, web3WCV2UniwalletConnectHooks] =
initializeConnector<UniwalletWCV2Connect>(
(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<CoinbaseWallet>(
(actions) =>
Expand All @@ -197,7 +180,7 @@ const [web3CoinbaseWallet, web3CoinbaseWalletHooks] =
onError
})
);
const coinbaseWalletConnection: Connection = {
export const coinbaseWalletConnection: Connection = {
getName: () => "Coinbase Wallet",
connector: web3CoinbaseWallet,
hooks: web3CoinbaseWalletHooks,
Expand All @@ -224,8 +207,7 @@ export const connections = [
gnosisSafeConnection,
walletConnectV2Connection,
coinbaseWalletConnection,
networkConnection,
uniwalletWCV2ConnectConnection
networkConnection
];

export function getConnection(c: Connector | ConnectionType) {
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/lib/utils/hooks/useSwitchChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -51,7 +51,7 @@ export function useSwitchChain(doConnect = true) {
if (
[
walletConnectV2Connection.connector,
uniwalletWCV2ConnectConnection.connector,
coinbaseWalletConnection.connector,
networkConnection.connector
].includes(connector)
) {
Expand Down
Loading