From 5d7f148c0ee5cd35aa3a624a0a1f9cf6d914bbe8 Mon Sep 17 00:00:00 2001 From: Grant Steuart Date: Mon, 9 May 2022 10:01:00 -0500 Subject: [PATCH 01/52] feat: init walletconnect integration --- headers.js | 5 + package.json | 2 + sample.env | 1 + src/assets/translations/en/main.json | 15 + src/assets/translations/es/main.json | 15 + src/assets/translations/fr/main.json | 15 + src/assets/translations/id/main.json | 15 + src/assets/translations/ko/main.json | 15 + src/assets/translations/pt/main.json | 15 + src/assets/translations/ru/main.json | 15 + src/assets/translations/zh/main.json | 15 + src/components/Icons/WalletConnectIcon.tsx | 19 ++ src/config.ts | 1 + src/context/WalletProvider/KeyManager.ts | 1 + .../WalletConnect/components/Connect.tsx | 140 ++++++++ .../WalletConnect/components/Failure.tsx | 10 + .../WalletProvider/WalletConnect/config.ts | 8 + src/context/WalletProvider/config.ts | 10 + .../preferencesSlice/preferencesSlice.ts | 2 + src/test/mocks/store.ts | 1 + yarn.lock | 303 +++++++++++++++++- 21 files changed, 615 insertions(+), 8 deletions(-) create mode 100644 src/components/Icons/WalletConnectIcon.tsx create mode 100644 src/context/WalletProvider/WalletConnect/components/Connect.tsx create mode 100644 src/context/WalletProvider/WalletConnect/components/Failure.tsx create mode 100644 src/context/WalletProvider/WalletConnect/config.ts diff --git a/headers.js b/headers.js index a297ace1512..3afff3cfa1f 100644 --- a/headers.js +++ b/headers.js @@ -37,6 +37,11 @@ const cspMeta = Object.entries({ 'https://api.coincap.io/v2/assets', // @shapeshiftoss/market-service@1.7.0: https://github.com/shapeshift/lib/blob/9123527ebbcf0fd62a619ab2824d970123bd5ac2/packages/market-service/src/coincap/coincap.ts#L21 'https://api.coincap.io/v2/assets/', + 'https://registry.walletconnect.com/api/v2/wallets', + // WalletConnect Image CDN - Needed for icons inside WalletConnect + 'https://imagedelivery.net/', + // Subdomain can change between loads + 'wss://*.bridge.walletconnect.org', // https://github.com/shapeshift/web/blob/70111acd6236759675cf81ddcd196c31472989a6/src/components/Modals/FiatRamps/utils.ts#L40 process.env.REACT_APP_GEM_COINIFY_SUPPORTED_COINS, // https://github.com/shapeshift/web/blob/70111acd6236759675cf81ddcd196c31472989a6/src/components/Modals/FiatRamps/utils.ts#L50 diff --git a/package.json b/package.json index 2cfa4ab0f23..c2938568c0a 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "@shapeshiftoss/hdwallet-native": "^1.21.1", "@shapeshiftoss/hdwallet-native-vault": "^1.21.1", "@shapeshiftoss/hdwallet-portis": "^1.21.1", + "@shapeshiftoss/hdwallet-walletconnect": "/Users/gmsteuart/Workspace/shapeshift/hdwallet/packages/hdwallet-walletconnect", "@shapeshiftoss/investor-foxy": "^1.4.1", "@shapeshiftoss/investor-yearn": "^1.4.5", "@shapeshiftoss/logger": "^1.1.2", @@ -37,6 +38,7 @@ "@visx/responsive": "^2.8.0", "@visx/shape": "^2.4.0", "@visx/tooltip": "^2.8.0", + "@walletconnect/web3-provider": "^1.7.8", "allsettled-polyfill": "^1.0.4", "axios": "^0.26.1", "bignumber.js": "^9.0.2", diff --git a/sample.env b/sample.env index 4a0746f0a35..63c4022eeab 100644 --- a/sample.env +++ b/sample.env @@ -27,6 +27,7 @@ REACT_APP_FEATURE_KEEPKEY_SETTINGS=false REACT_APP_FOXY_APY=0.15 REACT_APP_FEATURE_WALLET_MIGRATION=false REACT_APP_FEATURE_DEMO_WALLET=false +REACT_APP_FEATURE_WALLETCONNECT_WALLET=false REACT_APP_GEM_COINIFY_SUPPORTED_COINS=https://api.gem.co/institutions/coinify/supported_currencies REACT_APP_GEM_WYRE_SUPPORTED_COINS=https://api.gem.co/institutions/wyre/supported_currencies diff --git a/src/assets/translations/en/main.json b/src/assets/translations/en/main.json index 5777a34cf6b..3a580e7dd2e 100644 --- a/src/assets/translations/en/main.json +++ b/src/assets/translations/en/main.json @@ -823,6 +823,21 @@ "body": "By connecting a wallet, you agree to ShapeShift's Terms of Service and acknowledge that you have read and understand the ShapeShift disclaimer.", "footer": "Don't have a wallet?", "create": "Create one" + }, + "walletConnect": { + "errors": { + "unknown": "An unexpected error occurred communicating with WalletConnect", + "connectFailure": "Unable to connect WalletConnect wallet" + }, + "connect": { + "header": "Pair WalletConnect", + "body": "Click Pair then select WalletConnect from the popup window", + "button": "Pair" + }, + "failure": { + "header": "Error", + "body": "Unable to connect WalletConnect wallet" + } } }, "graph": { diff --git a/src/assets/translations/es/main.json b/src/assets/translations/es/main.json index 469cc5c3d1b..f9f36fcc8f7 100644 --- a/src/assets/translations/es/main.json +++ b/src/assets/translations/es/main.json @@ -764,6 +764,21 @@ "body": "Al conectar una billetera, acepta los Términos de servicio de ShapeShift y reconoce que ha leído y comprende el descargo de responsabilidad de ShapeShift.", "footer": "¿No tienes billetera?", "create": "Crea una" + }, + "walletConnect": { + "errors": { + "unknown": "Ocurrió un error inesperado al comunicarse con WalletConnect", + "connectFailure": "No se puede conectar la billetera WalletConnect" + }, + "connect": { + "header": "Emparejar WalletConnect", + "body": "Haga clic en Emparejar y luego seleccione WalletConnect en la ventana emergente", + "button": "Emparejar" + }, + "failure": { + "header": "Error", + "body": "No se puede conectar la billetera WalletConnect" + } } }, "graph": { diff --git a/src/assets/translations/fr/main.json b/src/assets/translations/fr/main.json index 689045a3ceb..edfdd5be521 100644 --- a/src/assets/translations/fr/main.json +++ b/src/assets/translations/fr/main.json @@ -764,6 +764,21 @@ "body": "En connectant un porte-monnaie, vous acceptez les conditions de service de ShapeShift et reconnaissez avoir lu et compris la clause de non-responsabilité de ShapeShift.", "footer": "Vous n'avez pas de porte-monnaie ?", "create": "Créez-en un" + }, + "walletConnect": { + "errors": { + "unknown": "Une erreur inattendue s'est produite lors de la communication avec WalletConnect", + "connectFailure": "Impossible de connecter le porte-monnaie WalletConnect." + }, + "connect": { + "header": "Appairer WalletConnect", + "body": "Cliquez sur Appairer et connectez-vous à WalletConnect à partir de la fenêtre popup", + "button": "Appairer" + }, + "failure": { + "header": "Erreur", + "body": "Impossible de se connecter au porte-monnaie WalletConnect" + } } }, "graph": { diff --git a/src/assets/translations/id/main.json b/src/assets/translations/id/main.json index a5ec1c2fab7..b72659753fb 100644 --- a/src/assets/translations/id/main.json +++ b/src/assets/translations/id/main.json @@ -470,6 +470,21 @@ "body": "Dengan menghubungkan dompet, Anda menyetujui Persyaratan Layanan ShapeShift dan mengakui bahwa Anda telah membaca dan memahami penafian ShapeShift.", "footer": "Tidak punya dompet?", "create": "Buat Satu" + }, + "walletConnect": { + "errors": { + "unknown": "Terjadi kesalahan tak terduga saat berkomunikasi dengan WalletConnect", + "connectFailure": "Tidak dapat menghubungkan dompet WalletConnect" + }, + "connect": { + "header": "Pasangkan WalletConnect", + "body": "Klik Pasangkan lalu pilih WalletConnect dari jendela popup", + "button": "Pasangkan" + }, + "failure": { + "header": "Kesalahan", + "body": "Tidak dapat menghubungkan dompet WalletConnect" + } } }, "graph": { diff --git a/src/assets/translations/ko/main.json b/src/assets/translations/ko/main.json index 48076a62b44..4f89b4a6459 100644 --- a/src/assets/translations/ko/main.json +++ b/src/assets/translations/ko/main.json @@ -764,6 +764,21 @@ "body": "지갑을 연결하는 것으로, 셰이프시프트의 서비스 약관에 동의하며 셰이프시프트의 면책 및 면피 조항을 읽고 이해했음을 확인합니다.", "footer": "지갑이 없으신가요?", "create": "지갑 만들기" + }, + "walletConnect": { + "errors": { + "unknown": "WalletConnect와 연동하는 도중에 예기치 못한 오류가 발생했습니다.", + "connectFailure": "WalletConnect 지갑을 연결할 수 없습니다." + }, + "connect": { + "header": "WalletConnect 지갑 연동하기", + "body": "연결하기 버튼을 누른 후 팝업창에서 WalletConnect를 선택하세요.", + "button": "연결하기" + }, + "failure": { + "header": "오류 발생", + "body": "WalletConnect 지갑을 연결할 수 없습니다." + } } }, "graph": { diff --git a/src/assets/translations/pt/main.json b/src/assets/translations/pt/main.json index 361e48a04ea..dd9beefad05 100644 --- a/src/assets/translations/pt/main.json +++ b/src/assets/translations/pt/main.json @@ -631,6 +631,21 @@ "body": "Ao conectar sua carteira, você concorda com os Termos de Serviço da ShapeShift e reconhece que leu e entendeu o aviso legal da ShapeShift.", "footer": "Não tem carteira?", "create": "Crie um" + }, + "walletConnect": { + "errors": { + "unknown": "Ocorreu um erro inesperado na comunicação com a WalletConnect", + "connectFailure": "Não foi possível conectar sua carteira WalletConnect" + }, + "connect": { + "header": "Emparelhar WalletConnect", + "body": "Clique em Emparelhar e conecte sua carteira WalletConnect na janela pop-up", + "button": "Emparelhar" + }, + "failure": { + "header": "Erro", + "body": "Não foi possível conectar sua carteira WalletConnect" + } } }, "graph": { diff --git a/src/assets/translations/ru/main.json b/src/assets/translations/ru/main.json index 9d3b16a55d0..440cecdea70 100644 --- a/src/assets/translations/ru/main.json +++ b/src/assets/translations/ru/main.json @@ -460,6 +460,21 @@ "selectModal": { "header": "Подключить кошелек", "body": "Подключая кошелек, вы соглашаетесь с Условиями предоставления услуг ShapeShift и подтверждаете, что прочитали и поняли отказ от ответственности ShapeShift." + }, + "walletConnect": { + "errors": { + "unknown": "Возникла непредвиденная ошибка при соединении с WalletConnect", + "connectFailure": "Невозможно подключить кошелек WalletConnect" + }, + "connect": { + "header": "Обьединить WalletConnect", + "body": "Нажмите обьединить, затем выберите WalletConnect во всплывающем окне", + "button": "Обьединить" + }, + "failure": { + "header": "Ошибка", + "body": "Невозможно подключить кошелек WalletConnect" + } } }, "graph": { diff --git a/src/assets/translations/zh/main.json b/src/assets/translations/zh/main.json index 7a44f23be00..9ef3809ad09 100644 --- a/src/assets/translations/zh/main.json +++ b/src/assets/translations/zh/main.json @@ -667,6 +667,21 @@ "body": "连接一个钱包代表您同意接受 ShapeShift 的服务条款并确认您已经阅读并理解 Shapeshift 的免责声明。", "footer": "还没有钱包?", "create": "创建一个" + }, + "walletConnect": { + "errors": { + "unknown": "与您的 WalletConnect 通讯出现未知错误", + "connectFailure": "无法连接 WalletConnect" + }, + "connect": { + "header": "与 WalletConnect 配对", + "body": "点击配对并在弹窗中选择 WalletConnect", + "button": "配对" + }, + "failure": { + "header": "错误", + "body": "无法连接 WalletConnect" + } } }, "graph": { diff --git a/src/components/Icons/WalletConnectIcon.tsx b/src/components/Icons/WalletConnectIcon.tsx new file mode 100644 index 00000000000..30bb70ff048 --- /dev/null +++ b/src/components/Icons/WalletConnectIcon.tsx @@ -0,0 +1,19 @@ +import { createIcon } from '@chakra-ui/react' + +/** + * WalletConnect Icon + * + * @see https://github.com/WalletConnect/walletconnect-docs/blob/main/static/img/walletconnect-logo.svg + */ +export const WalletConnectIcon = createIcon({ + displayName: 'WalletConnectIcon', + path: ( + + + + ), + viewBox: '0 0 300 185', +}) diff --git a/src/config.ts b/src/config.ts index 45ca3e960ad..67d963001fb 100644 --- a/src/config.ts +++ b/src/config.ts @@ -37,6 +37,7 @@ const validators = { REACT_APP_FEATURE_KEEPKEY_SETTINGS: bool({ default: false }), REACT_APP_FEATURE_WALLET_MIGRATION: bool({ default: false }), REACT_APP_FEATURE_DEMO_WALLET: bool({ default: false }), + REACT_APP_FEATURE_WALLETCONNECT_WALLET: bool({ default: false }), } function reporter({ errors }: envalid.ReporterOptions) { diff --git a/src/context/WalletProvider/KeyManager.ts b/src/context/WalletProvider/KeyManager.ts index 306a7844df8..0ca54930b76 100644 --- a/src/context/WalletProvider/KeyManager.ts +++ b/src/context/WalletProvider/KeyManager.ts @@ -4,4 +4,5 @@ export enum KeyManager { MetaMask = 'metamask', Portis = 'portis', Demo = 'demo', + WalletConnect = 'walletconnect', } diff --git a/src/context/WalletProvider/WalletConnect/components/Connect.tsx b/src/context/WalletProvider/WalletConnect/components/Connect.tsx new file mode 100644 index 00000000000..75a626d0564 --- /dev/null +++ b/src/context/WalletProvider/WalletConnect/components/Connect.tsx @@ -0,0 +1,140 @@ +import WalletConnectProvider from '@walletconnect/web3-provider' +import { getConfig } from 'config' +import React, { useEffect, useState } from 'react' +import { isMobile } from 'react-device-detect' +import { RouteComponentProps } from 'react-router-dom' +import { ActionTypes, WalletActions } from 'context/WalletProvider/actions' +import { KeyManager } from 'context/WalletProvider/KeyManager' +import { setLocalWalletTypeAndDeviceId } from 'context/WalletProvider/local-wallet' +import { useWallet } from 'hooks/useWallet/useWallet' + +import { ConnectModal } from '../../components/ConnectModal' +import { RedirectModal } from '../../components/RedirectModal' +import { LocationState } from '../../NativeWallet/types' +import { WalletConnectConfig } from '../config' +import { WalletConnectHDWallet } from '@shapeshiftoss/hdwallet-walletconnect' + +export interface WalletConnectSetupProps + extends RouteComponentProps< + {}, + any, // history + LocationState + > { + dispatch: React.Dispatch +} + +/** + * WalletConnect Connect component + * + * Test WalletConnect Tool: https://test.walletconnect.org/ + */ +export const WalletConnectConnect = ({ history }: WalletConnectSetupProps) => { + const { dispatch, state } = useWallet() + const [loading, setLoading] = useState(false) + const [error, setError] = useState(null) + const [provider, setProvider] = useState() + + const setErrorLoading = (e: string | null) => { + setError(e) + setLoading(false) + } + + useEffect(() => { + ;(async () => { + try { + const rpcUrl = getConfig().REACT_APP_ETHEREUM_NODE_URL + if (!rpcUrl) { + console.error('ConfigNotFound: ethereum node url not set') + return + } + const opts = { + rpc: { + 1: rpcUrl, + }, + } + setProvider(new WalletConnectProvider(opts)) + } catch (e) { + if (!isMobile) console.error(e) + } + })() + }, [setProvider]) + + const pairDevice = async () => { + setError(null) + setLoading(true) + + if (!provider) { + throw new Error('walletProvider.walletConnect.errors.connectFailure') + } + + if (state.adapters && state.adapters?.has(KeyManager.WalletConnect)) { + const wallet = await state.adapters.get(KeyManager.WalletConnect)?.pairDevice() as WalletConnectHDWallet + if (!wallet) { + setErrorLoading('walletProvider.errors.walletNotFound') + throw new Error('Call to hdwallet-walletconnect::pairDevice returned null or undefined') + } + + const { name, icon } = WalletConnectConfig + try { + const deviceId = await wallet.getDeviceID() + + provider.onConnect(async () => { + const { connected } = await provider.getWalletConnector() + console.info(`connector connected: ${connected}`) + }) + + // Enable session (triggers QR Code modal) + await provider.enable() + + dispatch({ + type: WalletActions.SET_WALLET, + payload: { wallet, name, icon, deviceId }, + }) + dispatch({ type: WalletActions.SET_IS_CONNECTED, payload: true }) + setLocalWalletTypeAndDeviceId(KeyManager.WalletConnect, deviceId) + dispatch({ type: WalletActions.SET_WALLET_MODAL, payload: false }) + } catch (e: any) { + if (e?.message?.startsWith('walletProvider.')) { + console.error('WalletConnect Connect: There was an error initializing the wallet', e) + setErrorLoading(e?.message) + } else { + setErrorLoading('walletProvider.walletConnect.errors.unknown') + history.push('/walletconnect/failure') + } + } + } + setLoading(false) + } + + // This constructs the WalletConnect deep-linking target from the currently-loaded + // window.location. The port will be blank if not specified, in which case it + // should be omitted. + const mmDeeplinkTarget = [window.location.hostname, window.location.port] + .filter(x => !!x) + .join(':') + + // TODO: test native app + // The WalletConnect mobile app itself injects a provider, so we'll use pairDevice once + // we've reopened ourselves in that environment. + return !provider && isMobile ? ( + { + window.location.assign(`https://walletconnect.app.link/dapp/${mmDeeplinkTarget}`) + }} + loading={loading} + error={error} + > + ) : ( + + ) +} diff --git a/src/context/WalletProvider/WalletConnect/components/Failure.tsx b/src/context/WalletProvider/WalletConnect/components/Failure.tsx new file mode 100644 index 00000000000..5dab5842b57 --- /dev/null +++ b/src/context/WalletProvider/WalletConnect/components/Failure.tsx @@ -0,0 +1,10 @@ +import { FailureModal } from 'context/WalletProvider/components/FailureModal' + +export const WalletConnectFailure = () => { + return ( + + ) +} diff --git a/src/context/WalletProvider/WalletConnect/config.ts b/src/context/WalletProvider/WalletConnect/config.ts new file mode 100644 index 00000000000..d071a6a91fa --- /dev/null +++ b/src/context/WalletProvider/WalletConnect/config.ts @@ -0,0 +1,8 @@ +import { WalletConnectAdapter } from '@shapeshiftoss/hdwallet-walletconnect' +import { WalletConnectIcon } from 'components/Icons/WalletConnectIcon' + +export const WalletConnectConfig = { + adapter: WalletConnectAdapter, + icon: WalletConnectIcon, + name: 'WalletConnect', +} diff --git a/src/context/WalletProvider/config.ts b/src/context/WalletProvider/config.ts index 2f6dcab15b4..3edd5407707 100644 --- a/src/context/WalletProvider/config.ts +++ b/src/context/WalletProvider/config.ts @@ -33,6 +33,9 @@ import { NativeConfig } from './NativeWallet/config' import { PortisConnect } from './Portis/components/Connect' import { PortisFailure } from './Portis/components/Failure' import { PortisConfig } from './Portis/config' +import { WalletConnectConnect } from './WalletConnect/components/Connect' +import { WalletConnectFailure } from './WalletConnect/components/Failure' +import { WalletConnectConfig } from './WalletConnect/config' export interface SupportedWalletInfo { adapter: any @@ -91,4 +94,11 @@ export const SUPPORTED_WALLETS: Record = { ...DemoConfig, routes: [], }, + [KeyManager.WalletConnect]: { + ...WalletConnectConfig, + routes: [ + { path: '/walletconnect/connect', component: WalletConnectConnect }, + { path: '/walletconnect/failure', component: WalletConnectFailure }, + ], + }, } diff --git a/src/state/slices/preferencesSlice/preferencesSlice.ts b/src/state/slices/preferencesSlice/preferencesSlice.ts index a300bdd3246..9dff56aa030 100644 --- a/src/state/slices/preferencesSlice/preferencesSlice.ts +++ b/src/state/slices/preferencesSlice/preferencesSlice.ts @@ -9,6 +9,7 @@ export type FeatureFlags = { KeepKeySettings: boolean WalletMigration: boolean DemoWallet: boolean + WalletConnectWallet: boolean } export type Flag = keyof FeatureFlags @@ -26,6 +27,7 @@ const initialState: Preferences = { KeepKeySettings: getConfig().REACT_APP_FEATURE_KEEPKEY_SETTINGS, WalletMigration: getConfig().REACT_APP_FEATURE_WALLET_MIGRATION, DemoWallet: getConfig().REACT_APP_FEATURE_DEMO_WALLET, + WalletConnectWallet: getConfig().REACT_APP_FEATURE_WALLETCONNECT_WALLET, }, selectedLocale: simpleLocale(), balanceThreshold: '0', diff --git a/src/test/mocks/store.ts b/src/test/mocks/store.ts index 3a45af41007..3fe8734c84c 100644 --- a/src/test/mocks/store.ts +++ b/src/test/mocks/store.ts @@ -54,6 +54,7 @@ export const mockStore: ReduxState = { KeepKeySettings: false, WalletMigration: false, DemoWallet: false, + WalletConnectWallet: false, }, selectedLocale: 'en', balanceThreshold: '0', diff --git a/yarn.lock b/yarn.lock index 0fa93e3e6bf..5852d35ac35 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3986,6 +3986,14 @@ p-lazy "^3.1.0" web3 "^1.5.1" +"@shapeshiftoss/hdwallet-walletconnect@file:../hdwallet/packages/hdwallet-walletconnect": + version "1.21.1" + dependencies: + "@shapeshiftoss/hdwallet-core" "1.21.1" + "@walletconnect/qrcode-modal" "^1.7.8" + "@walletconnect/web3-provider" "^1.7.8" + ethers "^5.6.5" + "@shapeshiftoss/investor-foxy@^1.4.1": version "1.4.3" resolved "https://registry.yarnpkg.com/@shapeshiftoss/investor-foxy/-/investor-foxy-1.4.3.tgz#c21bb2b9055d09e29d3ca737373a1802e4cade0f" @@ -6304,6 +6312,176 @@ prop-types "^15.5.10" react-use-measure "^2.0.4" +"@walletconnect/browser-utils@^1.7.8": + version "1.7.8" + resolved "https://registry.yarnpkg.com/@walletconnect/browser-utils/-/browser-utils-1.7.8.tgz#c9e27f69d838442d69ccf53cb38ffc3c554baee2" + integrity sha512-iCL0XCWOZaABIc0lqA79Vyaybr3z26nt8mxiwvfrG8oaKUf5Y21Of4dj+wIXQ4Hhblre6SgDlU0Ffb39+1THOw== + dependencies: + "@walletconnect/safe-json" "1.0.0" + "@walletconnect/types" "^1.7.8" + "@walletconnect/window-getters" "1.0.0" + "@walletconnect/window-metadata" "1.0.0" + detect-browser "5.2.0" + +"@walletconnect/client@^1.7.8": + version "1.7.8" + resolved "https://registry.yarnpkg.com/@walletconnect/client/-/client-1.7.8.tgz#62c2d7114e59495d90772ea8033831ceb29c6a78" + integrity sha512-pBroM6jZAaUM0SoXJZg5U7aPTiU3ljQAw3Xh/i2pxFDeN/oPKao7husZ5rdxS5xuGSV6YpqqRb0RxW1IeoR2Pg== + dependencies: + "@walletconnect/core" "^1.7.8" + "@walletconnect/iso-crypto" "^1.7.8" + "@walletconnect/types" "^1.7.8" + "@walletconnect/utils" "^1.7.8" + +"@walletconnect/core@^1.7.8": + version "1.7.8" + resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-1.7.8.tgz#97c52ea7d00126863cd37bf19bd3e87d4f30de1e" + integrity sha512-9xcQ0YNf9JUFb0YOX1Mpy4Yojt+6w2yQz/0aIEyj2X/s9D71NW0fTYsMcdhkLOI7mn2cqVbx2t1lRvdgqsbrSQ== + dependencies: + "@walletconnect/socket-transport" "^1.7.8" + "@walletconnect/types" "^1.7.8" + "@walletconnect/utils" "^1.7.8" + +"@walletconnect/crypto@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@walletconnect/crypto/-/crypto-1.0.2.tgz#3fcc2b2cde6f529a19eadd883dc555cd0e861992" + integrity sha512-+OlNtwieUqVcOpFTvLBvH+9J9pntEqH5evpINHfVxff1XIgwV55PpbdvkHu6r9Ib4WQDOFiD8OeeXs1vHw7xKQ== + dependencies: + "@walletconnect/encoding" "^1.0.1" + "@walletconnect/environment" "^1.0.0" + "@walletconnect/randombytes" "^1.0.2" + aes-js "^3.1.2" + hash.js "^1.1.7" + +"@walletconnect/encoding@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@walletconnect/encoding/-/encoding-1.0.1.tgz#93c18ce9478c3d5283dbb88c41eb2864b575269a" + integrity sha512-8opL2rs6N6E3tJfsqwS82aZQDL3gmupWUgmvuZ3CGU7z/InZs3R9jkzH8wmYtpbq0sFK3WkJkQRZFFk4BkrmFA== + dependencies: + is-typedarray "1.0.0" + typedarray-to-buffer "3.1.5" + +"@walletconnect/environment@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@walletconnect/environment/-/environment-1.0.0.tgz#c4545869fa9c389ec88c364e1a5f8178e8ab5034" + integrity sha512-4BwqyWy6KpSvkocSaV7WR3BlZfrxLbJSLkg+j7Gl6pTDE+U55lLhJvQaMuDVazXYxcjBsG09k7UlH7cGiUI5vQ== + +"@walletconnect/http-connection@^1.7.8": + version "1.7.8" + resolved "https://registry.yarnpkg.com/@walletconnect/http-connection/-/http-connection-1.7.8.tgz#98bcc726c29751ddc791ff151742aa712bf679a7" + integrity sha512-31gjBw46MRU9hFMTNXAqh+f8qpDNzVeV9BJehzVWKiNC3ciL1JCZkbvsY0djwajduE6TB2ujaML0XDXS9HgBRA== + dependencies: + "@walletconnect/types" "^1.7.8" + "@walletconnect/utils" "^1.7.8" + eventemitter3 "4.0.7" + xhr2-cookies "1.1.0" + +"@walletconnect/iso-crypto@^1.7.8": + version "1.7.8" + resolved "https://registry.yarnpkg.com/@walletconnect/iso-crypto/-/iso-crypto-1.7.8.tgz#41f09326d129faa09beae213e78614c19d90bbd6" + integrity sha512-Qo6qDcMG0Ac+9fpWE0h/oE55NHLk6eM2vlXpWlQDN/me7RZGrkvk+LXsAkQ3UiYPEiPfq4eswcyRWC9AcrAscg== + dependencies: + "@walletconnect/crypto" "^1.0.2" + "@walletconnect/types" "^1.7.8" + "@walletconnect/utils" "^1.7.8" + +"@walletconnect/jsonrpc-types@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.0.tgz#fa75ad5e8f106a2e33287b1e6833e22ed0225055" + integrity sha512-11QXNq5H1PKZk7bP8SxgmCw3HRaDuPOVE+wObqEvmhc7OWYUZqfuaaMb+OXGRSOHL3sbC+XHfdeCxFTMXSFyng== + dependencies: + keyvaluestorage-interface "^1.0.0" + +"@walletconnect/jsonrpc-utils@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-utils/-/jsonrpc-utils-1.0.0.tgz#1a2f668d606e8f0b6e7d8fdebae86001bd037a3f" + integrity sha512-qUHbKUK6sHeHn67qtHZoLoYk5hS6x1arTPjKDRkY93/6Fx+ZmNIpdm1owX3l6aYueyegJ7mz43FpvYHUqJ8xcw== + dependencies: + "@walletconnect/environment" "^1.0.0" + "@walletconnect/jsonrpc-types" "^1.0.0" + +"@walletconnect/mobile-registry@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@walletconnect/mobile-registry/-/mobile-registry-1.4.0.tgz#502cf8ab87330841d794819081e748ebdef7aee5" + integrity sha512-ZtKRio4uCZ1JUF7LIdecmZt7FOLnX72RPSY7aUVu7mj7CSfxDwUn6gBuK6WGtH+NZCldBqDl5DenI5fFSvkKYw== + +"@walletconnect/qrcode-modal@^1.7.8": + version "1.7.8" + resolved "https://registry.yarnpkg.com/@walletconnect/qrcode-modal/-/qrcode-modal-1.7.8.tgz#52b3d15922f3e371ddc92fd0f49f93ff40241365" + integrity sha512-LqNJMLWO+ljvoRSdq8tcEslW0imKrrb+ugs3bw4w/jEI1FSJzVeinEsgVpyaMv8wsUcyTcSCXSkXpT1SXHtcpw== + dependencies: + "@walletconnect/browser-utils" "^1.7.8" + "@walletconnect/mobile-registry" "^1.4.0" + "@walletconnect/types" "^1.7.8" + copy-to-clipboard "^3.3.1" + preact "10.4.1" + qrcode "1.4.4" + +"@walletconnect/randombytes@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@walletconnect/randombytes/-/randombytes-1.0.2.tgz#95c644251a15e6675f58fbffc9513a01486da49c" + integrity sha512-ivgOtAyqQnN0rLQmOFPemsgYGysd/ooLfaDA/ACQ3cyqlca56t3rZc7pXfqJOIETx/wSyoF5XbwL+BqYodw27A== + dependencies: + "@walletconnect/encoding" "^1.0.1" + "@walletconnect/environment" "^1.0.0" + randombytes "^2.1.0" + +"@walletconnect/safe-json@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@walletconnect/safe-json/-/safe-json-1.0.0.tgz#12eeb11d43795199c045fafde97e3c91646683b2" + integrity sha512-QJzp/S/86sUAgWY6eh5MKYmSfZaRpIlmCJdi5uG4DJlKkZrHEF7ye7gA+VtbVzvTtpM/gRwO2plQuiooIeXjfg== + +"@walletconnect/socket-transport@^1.7.8": + version "1.7.8" + resolved "https://registry.yarnpkg.com/@walletconnect/socket-transport/-/socket-transport-1.7.8.tgz#a4ef50d8054293991dbfde7f9c66788030182ec3" + integrity sha512-bqEjLxfSzG79v2OT7XVOZoyUkg6g3yng0fURrdLusWs42fYHWnrSrIZDejFn8N5PiZk5R2edrggkQ7w0VUUAfw== + dependencies: + "@walletconnect/types" "^1.7.8" + "@walletconnect/utils" "^1.7.8" + ws "7.5.3" + +"@walletconnect/types@^1.7.8": + version "1.7.8" + resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-1.7.8.tgz#ec397e6fbdc8147bccc17029edfeb41c50a5ca09" + integrity sha512-0oSZhKIrtXRJVP1jQ0EDTRtotQY6kggGjDcmm/LLQBKnOZXdPeo0sPkV/7DjT5plT3O7Cjc6JvuXt9WOY0hlCA== + +"@walletconnect/utils@^1.7.8": + version "1.7.8" + resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-1.7.8.tgz#f94572bca5eb6b5f81daf8a35268f249f9c6b1ec" + integrity sha512-DSpfH6Do0TQmdrgzu+SyjVhupVjN0WEMvNWGK9K4VlSmLFpCWfme7qxzrvuxBZ47gDqs1kGWvjyJmviWqvOnAg== + dependencies: + "@walletconnect/browser-utils" "^1.7.8" + "@walletconnect/encoding" "^1.0.1" + "@walletconnect/jsonrpc-utils" "^1.0.0" + "@walletconnect/types" "^1.7.8" + bn.js "4.11.8" + js-sha3 "0.8.0" + query-string "6.13.5" + +"@walletconnect/web3-provider@^1.7.8": + version "1.7.8" + resolved "https://registry.yarnpkg.com/@walletconnect/web3-provider/-/web3-provider-1.7.8.tgz#fe9b66a4010ee831db664a3fe5014d67a758a1fc" + integrity sha512-2VxGo7KPfQTWRJ+rygt3ok/u04InkVE+H9LBIF/RMUwcwyGf2nsP3CcYZVcg3yYpacgN7bAZCersCEYwU8AeeA== + dependencies: + "@walletconnect/client" "^1.7.8" + "@walletconnect/http-connection" "^1.7.8" + "@walletconnect/qrcode-modal" "^1.7.8" + "@walletconnect/types" "^1.7.8" + "@walletconnect/utils" "^1.7.8" + web3-provider-engine "16.0.1" + +"@walletconnect/window-getters@1.0.0", "@walletconnect/window-getters@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@walletconnect/window-getters/-/window-getters-1.0.0.tgz#1053224f77e725dfd611c83931b5f6c98c32bfc8" + integrity sha512-xB0SQsLaleIYIkSsl43vm8EwETpBzJ2gnzk7e0wMF3ktqiTGS6TFHxcprMl5R44KKh4tCcHCJwolMCaDSwtAaA== + +"@walletconnect/window-metadata@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@walletconnect/window-metadata/-/window-metadata-1.0.0.tgz#93b1cc685e6b9b202f29c26be550fde97800c4e5" + integrity sha512-9eFvmJxIKCC3YWOL97SgRkKhlyGXkrHwamfechmqszbypFspaSk+t2jQXAEU7YClHF6Qjw5eYOmy1//zFi9/GA== + dependencies: + "@walletconnect/window-getters" "^1.0.0" + "@webassemblyjs/ast@1.11.1": version "1.11.1" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7" @@ -6706,6 +6884,11 @@ aes-js@3.0.0: resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" integrity sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0= +aes-js@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.1.2.tgz#db9aabde85d5caabbfc0d4f2a4446960f627146a" + integrity sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ== + agent-base@6: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" @@ -7758,6 +7941,11 @@ bn.js@4.11.6: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" integrity sha1-UzRK2xRhehP26N0s4okF0cC6MhU= +bn.js@4.11.8: + version "4.11.8" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" + integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== + bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.0, bn.js@^4.11.6, bn.js@^4.11.8, bn.js@^4.11.9: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" @@ -8004,6 +8192,19 @@ btoa@^1.2.1: resolved "https://registry.yarnpkg.com/btoa/-/btoa-1.2.1.tgz#01a9909f8b2c93f6bf680ba26131eb30f7fa3d73" integrity sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g== +buffer-alloc-unsafe@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0" + integrity sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg== + +buffer-alloc@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/buffer-alloc/-/buffer-alloc-1.2.0.tgz#890dd90d923a873e08e10e5fd51a57e5b7cce0ec" + integrity sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow== + dependencies: + buffer-alloc-unsafe "^1.1.0" + buffer-fill "^1.0.0" + buffer-crc32@~0.2.3: version "0.2.13" resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" @@ -8014,7 +8215,12 @@ buffer-equals@^1.0.3: resolved "https://registry.yarnpkg.com/buffer-equals/-/buffer-equals-1.0.4.tgz#0353b54fd07fd9564170671ae6f66b9cf10d27f5" integrity sha1-A1O1T9B/2VZBcGca5vZrnPENJ/U= -buffer-from@^1.0.0: +buffer-fill@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" + integrity sha1-+PeLdniYiO858gXNY39o5wISKyw= + +buffer-from@^1.0.0, buffer-from@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== @@ -8051,7 +8257,7 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" -buffer@^5.0.5, buffer@^5.1.0, buffer@^5.5.0, buffer@^5.6.0: +buffer@^5.0.5, buffer@^5.1.0, buffer@^5.4.3, buffer@^5.5.0, buffer@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -9855,6 +10061,11 @@ detab@2.0.4: dependencies: repeat-string "^1.5.4" +detect-browser@5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/detect-browser/-/detect-browser-5.2.0.tgz#c9cd5afa96a6a19fda0bbe9e9be48a6b6e1e9c97" + integrity sha512-tr7XntDAu50BVENgQfajMLzacmSe34D+qZc4zjnniz0ZVuw/TZcLcyxHQjYpJTM36sGEkZZlYLnIM1hH7alTMA== + detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" @@ -9924,6 +10135,11 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" +dijkstrajs@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/dijkstrajs/-/dijkstrajs-1.0.2.tgz#2e48c0d3b825462afe75ab4ad5e829c8ece36257" + integrity sha512-QV6PMaHTCNmKSeP6QoXhVTw9snc9VD8MulTT0Bd99Pacp4SS1cjcrYPgBPmibqKVtMJJfqC6XvOXgPMEEPH/fg== + dir-glob@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.2.2.tgz#fa09f0694153c8918b18ba0deafae94769fc50c4" @@ -11104,7 +11320,7 @@ ethers@5.4.4: "@ethersproject/web" "5.4.0" "@ethersproject/wordlists" "5.4.0" -ethers@^5.0.13, ethers@^5.4.7, ethers@^5.5.3: +ethers@^5.0.13, ethers@^5.4.7, ethers@^5.5.3, ethers@^5.6.5: version "5.6.5" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.6.5.tgz#3185ac7815dc640993408adf6f133ffabfbcbb63" integrity sha512-9CTmplO9bv0s/aPw3HB3txGzKz3tUSI2EfO4dJo0W2WvaEq1ArgsEX6obV+bj5X3yY+Zgb1kAux8TDtJKe1FaA== @@ -11179,7 +11395,7 @@ eventemitter3@4.0.4: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.4.tgz#b5463ace635a083d018bdc7c917b4c5f10a85384" integrity sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ== -eventemitter3@^4.0.0: +eventemitter3@4.0.7, eventemitter3@^4.0.0: version "4.0.7" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== @@ -13523,7 +13739,7 @@ is-typed-array@^1.1.3, is-typed-array@^1.1.7: foreach "^2.0.5" has-tostringtag "^1.0.0" -is-typedarray@^1.0.0, is-typedarray@~1.0.0: +is-typedarray@1.0.0, is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= @@ -13592,7 +13808,7 @@ isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= -isarray@^2.0.5: +isarray@^2.0.1, isarray@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== @@ -14483,6 +14699,11 @@ keyv@^3.0.0: dependencies: json-buffer "3.0.0" +keyvaluestorage-interface@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/keyvaluestorage-interface/-/keyvaluestorage-interface-1.0.0.tgz#13ebdf71f5284ad54be94bd1ad9ed79adad515ff" + integrity sha512-8t6Q3TclQ4uZynJY9IGr2+SsIGwK9JHcO6ootkHCGA0CrQCRy+VkouYNO2xicET6b9al7QKzpebNow+gkpCL8g== + kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -16640,7 +16861,7 @@ pkg-up@^3.1.0: dependencies: find-up "^3.0.0" -pngjs@^3.3.3: +pngjs@^3.3.0, pngjs@^3.3.3: version "3.4.0" resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.4.0.tgz#99ca7d725965fb655814eaf65f38f12bbdbf555f" integrity sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w== @@ -17276,6 +17497,11 @@ postinstall-postinstall@^2.1.0: resolved "https://registry.yarnpkg.com/postinstall-postinstall/-/postinstall-postinstall-2.1.0.tgz#4f7f77441ef539d1512c40bd04c71b06a4704ca3" integrity sha512-7hQX6ZlZXIoRiWNrbMQaLzUUfH+sSx39u8EJ9HYuDc1kLo9IXKWjM5RSquZN1ad5GnH8CGFM78fsAAQi3OKEEQ== +preact@10.4.1: + version "10.4.1" + resolved "https://registry.yarnpkg.com/preact/-/preact-10.4.1.tgz#9b3ba020547673a231c6cf16f0fbaef0e8863431" + integrity sha512-WKrRpCSwL2t3tpOOGhf2WfTpcmbpxaWtDbdJdKdjd0aEiTkvOmS4NBkG6kzlaAHI9AkQ3iVqbFWM3Ei7mZ4o1Q== + precond@0.2: version "0.2.3" resolved "https://registry.yarnpkg.com/precond/-/precond-0.2.3.tgz#aa9591bcaa24923f1e0f4849d240f47efc1075ac" @@ -17630,6 +17856,19 @@ qr-image@^3.2.0: resolved "https://registry.yarnpkg.com/qr-image/-/qr-image-3.2.0.tgz#9fa8295beae50c4a149cf9f909a1db464a8672e8" integrity sha1-n6gpW+rlDEoUnPn5CaHbRkqGcug= +qrcode@1.4.4: + version "1.4.4" + resolved "https://registry.yarnpkg.com/qrcode/-/qrcode-1.4.4.tgz#f0c43568a7e7510a55efc3b88d9602f71963ea83" + integrity sha512-oLzEC5+NKFou9P0bMj5+v6Z40evexeE29Z9cummZXZ9QXyMr3lphkURzxjXgPJC5azpxcshoDWV1xE46z+/c3Q== + dependencies: + buffer "^5.4.3" + buffer-alloc "^1.2.0" + buffer-from "^1.1.1" + dijkstrajs "^1.0.1" + isarray "^2.0.1" + pngjs "^3.3.0" + yargs "^13.2.4" + qs@6.10.3, qs@^6.10.0, qs@^6.10.1: version "6.10.3" resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.3.tgz#d6cde1b2ffca87b5aa57889816c5f81535e22e8e" @@ -17642,6 +17881,15 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA== +query-string@6.13.5: + version "6.13.5" + resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.13.5.tgz#99e95e2fb7021db90a6f373f990c0c814b3812d8" + integrity sha512-svk3xg9qHR39P3JlHuD7g3nRnyay5mHbrPctEBDUxUkHRifPHXJDhBUycdCC0NBjXoDf44Gb+IsOZL1Uwn8M/Q== + dependencies: + decode-uri-component "^0.2.0" + split-on-first "^1.0.0" + strict-uri-encode "^2.0.0" + query-string@^5.0.1: version "5.1.1" resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb" @@ -19559,6 +19807,11 @@ spdy@^4.0.2: select-hose "^2.0.0" spdy-transport "^3.0.0" +split-on-first@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f" + integrity sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw== + split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" @@ -19734,6 +19987,11 @@ strict-uri-encode@^1.0.0: resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= +strict-uri-encode@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" + integrity sha1-ucczDHBChi9rFC3CdLvMWGbONUY= + string-length@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" @@ -20747,7 +21005,7 @@ typed-assert@^1.0.8: resolved "https://registry.yarnpkg.com/typed-assert/-/typed-assert-1.0.8.tgz#4bf9f1ce7f3f974d09c3afd7c68d12e1391a233c" integrity sha512-5NkbXZUlmCE73Fs7gvkp1XXJWHYetPkg60QnQ2NXQmBYNFxbBr2zA8GCtaH4K2s2WhOmSlgiSTmrjrcm5tnM5g== -typedarray-to-buffer@^3.1.5: +typedarray-to-buffer@3.1.5, typedarray-to-buffer@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== @@ -22289,6 +22547,11 @@ ws@7.4.6: resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== +ws@7.5.3: + version "7.5.3" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.3.tgz#160835b63c7d97bfab418fc1b8a9fced2ac01a74" + integrity sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg== + ws@^3.0.0, ws@^3.2.0: version "3.3.3" resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" @@ -22425,6 +22688,14 @@ yamljs@^0.3.0: argparse "^1.0.7" glob "^7.0.5" +yargs-parser@^13.1.2: + version "13.1.2" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" + integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + yargs-parser@^15.0.1: version "15.0.3" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-15.0.3.tgz#316e263d5febe8b38eef61ac092b33dfcc9b1115" @@ -22451,6 +22722,22 @@ yargs-parser@^21.0.0: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.0.tgz#a485d3966be4317426dd56bdb6a30131b281dc55" integrity sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA== +yargs@^13.2.4: + version "13.3.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" + integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== + dependencies: + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.2" + yargs@^14.0.0: version "14.2.3" resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.3.tgz#1a1c3edced1afb2a2fea33604bc6d1d8d688a414" From 9c133e807d2d2de30bc168cb0750095b6216de64 Mon Sep 17 00:00:00 2001 From: Grant Steuart Date: Mon, 9 May 2022 10:02:40 -0500 Subject: [PATCH 02/52] chore: lint --- .../WalletProvider/WalletConnect/components/Connect.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/context/WalletProvider/WalletConnect/components/Connect.tsx b/src/context/WalletProvider/WalletConnect/components/Connect.tsx index 75a626d0564..7383446d73e 100644 --- a/src/context/WalletProvider/WalletConnect/components/Connect.tsx +++ b/src/context/WalletProvider/WalletConnect/components/Connect.tsx @@ -1,3 +1,4 @@ +import { WalletConnectHDWallet } from '@shapeshiftoss/hdwallet-walletconnect' import WalletConnectProvider from '@walletconnect/web3-provider' import { getConfig } from 'config' import React, { useEffect, useState } from 'react' @@ -12,7 +13,6 @@ import { ConnectModal } from '../../components/ConnectModal' import { RedirectModal } from '../../components/RedirectModal' import { LocationState } from '../../NativeWallet/types' import { WalletConnectConfig } from '../config' -import { WalletConnectHDWallet } from '@shapeshiftoss/hdwallet-walletconnect' export interface WalletConnectSetupProps extends RouteComponentProps< @@ -68,7 +68,9 @@ export const WalletConnectConnect = ({ history }: WalletConnectSetupProps) => { } if (state.adapters && state.adapters?.has(KeyManager.WalletConnect)) { - const wallet = await state.adapters.get(KeyManager.WalletConnect)?.pairDevice() as WalletConnectHDWallet + const wallet = (await state.adapters + .get(KeyManager.WalletConnect) + ?.pairDevice()) as WalletConnectHDWallet if (!wallet) { setErrorLoading('walletProvider.errors.walletNotFound') throw new Error('Call to hdwallet-walletconnect::pairDevice returned null or undefined') From c5df37264b812d635ce481e68d9435438ae9bf66 Mon Sep 17 00:00:00 2001 From: Grant Steuart Date: Tue, 10 May 2022 16:54:05 -0500 Subject: [PATCH 03/52] fix: wallet init --- .../WalletProvider/WalletConnect/components/Connect.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/context/WalletProvider/WalletConnect/components/Connect.tsx b/src/context/WalletProvider/WalletConnect/components/Connect.tsx index 7383446d73e..9b7bad83b04 100644 --- a/src/context/WalletProvider/WalletConnect/components/Connect.tsx +++ b/src/context/WalletProvider/WalletConnect/components/Connect.tsx @@ -70,7 +70,7 @@ export const WalletConnectConnect = ({ history }: WalletConnectSetupProps) => { if (state.adapters && state.adapters?.has(KeyManager.WalletConnect)) { const wallet = (await state.adapters .get(KeyManager.WalletConnect) - ?.pairDevice()) as WalletConnectHDWallet + ?.pairDevice(provider)) as WalletConnectHDWallet if (!wallet) { setErrorLoading('walletProvider.errors.walletNotFound') throw new Error('Call to hdwallet-walletconnect::pairDevice returned null or undefined') @@ -80,13 +80,13 @@ export const WalletConnectConnect = ({ history }: WalletConnectSetupProps) => { try { const deviceId = await wallet.getDeviceID() - provider.onConnect(async () => { + wallet.provider.onConnect(async () => { const { connected } = await provider.getWalletConnector() console.info(`connector connected: ${connected}`) }) // Enable session (triggers QR Code modal) - await provider.enable() + await wallet.provider.enable() dispatch({ type: WalletActions.SET_WALLET, From f91861c2189e6d2644e3877e30c0fcf5ce78b627 Mon Sep 17 00:00:00 2001 From: Grant Steuart Date: Sun, 15 May 2022 00:54:47 -0500 Subject: [PATCH 04/52] fix: wallet init --- src/context/WalletProvider/WalletConnect/components/Connect.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/context/WalletProvider/WalletConnect/components/Connect.tsx b/src/context/WalletProvider/WalletConnect/components/Connect.tsx index 9b7bad83b04..185eb598280 100644 --- a/src/context/WalletProvider/WalletConnect/components/Connect.tsx +++ b/src/context/WalletProvider/WalletConnect/components/Connect.tsx @@ -86,7 +86,7 @@ export const WalletConnectConnect = ({ history }: WalletConnectSetupProps) => { }) // Enable session (triggers QR Code modal) - await wallet.provider.enable() + await wallet.initialize() dispatch({ type: WalletActions.SET_WALLET, From 9362270754840deb38a89df0258f16a79a3891aa Mon Sep 17 00:00:00 2001 From: Grant Steuart Date: Tue, 17 May 2022 06:47:32 -0500 Subject: [PATCH 05/52] fix: add imagedelivery to headers --- headers.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/headers.js b/headers.js index 3afff3cfa1f..8b120f70521 100644 --- a/headers.js +++ b/headers.js @@ -41,7 +41,7 @@ const cspMeta = Object.entries({ // WalletConnect Image CDN - Needed for icons inside WalletConnect 'https://imagedelivery.net/', // Subdomain can change between loads - 'wss://*.bridge.walletconnect.org', + 'wss://*.bridge.walletconnect.org/', // https://github.com/shapeshift/web/blob/70111acd6236759675cf81ddcd196c31472989a6/src/components/Modals/FiatRamps/utils.ts#L40 process.env.REACT_APP_GEM_COINIFY_SUPPORTED_COINS, // https://github.com/shapeshift/web/blob/70111acd6236759675cf81ddcd196c31472989a6/src/components/Modals/FiatRamps/utils.ts#L50 @@ -85,6 +85,7 @@ const cspMeta = Object.entries({ 'https://raw.githack.com/shapeshift/lib/', 'https://raw.githubusercontent.com/shapeshift/lib/', 'https://raw.githubusercontent.com/cosmostation/', + 'https://imagedelivery.net/' ], 'script-src': [ "'self'", From 8ea4876e1aa78c89985d2b341f713c692096336c Mon Sep 17 00:00:00 2001 From: Grant Steuart Date: Tue, 17 May 2022 06:49:00 -0500 Subject: [PATCH 06/52] chore: use package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c2938568c0a..dc9ce06ec86 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@shapeshiftoss/hdwallet-native": "^1.21.1", "@shapeshiftoss/hdwallet-native-vault": "^1.21.1", "@shapeshiftoss/hdwallet-portis": "^1.21.1", - "@shapeshiftoss/hdwallet-walletconnect": "/Users/gmsteuart/Workspace/shapeshift/hdwallet/packages/hdwallet-walletconnect", + "@shapeshiftoss/hdwallet-walletconnect": "^1.21.1", "@shapeshiftoss/investor-foxy": "^1.4.1", "@shapeshiftoss/investor-yearn": "^1.4.5", "@shapeshiftoss/logger": "^1.1.2", From c2870f0cd94a214ba7014bda4cc2d3fa7298fc8c Mon Sep 17 00:00:00 2001 From: Grant Steuart Date: Wed, 18 May 2022 03:23:09 -0500 Subject: [PATCH 07/52] chore: show/hide WalletConnect based on flag --- src/context/WalletProvider/SelectModal.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/context/WalletProvider/SelectModal.tsx b/src/context/WalletProvider/SelectModal.tsx index 07971e138c0..ca9d135b96b 100644 --- a/src/context/WalletProvider/SelectModal.tsx +++ b/src/context/WalletProvider/SelectModal.tsx @@ -2,6 +2,8 @@ import { Button, Center, Flex, ModalBody, ModalHeader, Stack, Tag } from '@chakr import { useTranslate } from 'react-polyglot' import { RawText, Text } from 'components/Text' import { useWallet } from 'hooks/useWallet/useWallet' +import { selectFeatureFlag } from 'state/slices/selectors' +import { useAppSelector } from 'state/store' import { SUPPORTED_WALLETS } from './config' import { KeyManager } from './KeyManager' @@ -13,7 +15,12 @@ export const SelectModal = () => { create, } = useWallet() const translate = useTranslate() - const wallets = Object.values(KeyManager).filter(key => key !== KeyManager.Demo) + const walletConnectFeatureFlag = useAppSelector(state => + selectFeatureFlag(state, 'WalletConnectWallet'), + ) + const wallets = Object.values(KeyManager) + .filter(key => key !== KeyManager.Demo) + .filter(key => walletConnectFeatureFlag || key !== KeyManager.WalletConnect) return ( <> From 5f2cb3b04c0e1488b6c7e176b4eef7b5fa1f0811 Mon Sep 17 00:00:00 2001 From: GMSteuart Date: Tue, 24 May 2022 23:28:38 -0500 Subject: [PATCH 08/52] fix: headers for macos/ios safari --- headers.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/headers.js b/headers.js index 8b120f70521..e01c8b5aeca 100644 --- a/headers.js +++ b/headers.js @@ -6,6 +6,9 @@ const cspMeta = Object.entries({ 'connect-src': [ "'self'", 'data:', + // Fixes local (dev) websocket requests in Safari on macOS/iOS + ...(process.env.NODE_ENV === 'development' ? ['ws://localhost:3000/ws', + `ws://${process.env.REACT_APP_LOCAL_IP}:3000/ws`] : []), // @shapeshiftoss/swapper@1.15.0: https://github.com/shapeshift/lib/blob/f833ac7f8c70dee801eaa24525336ca6992e5903/packages/swapper/src/swappers/zrx/utils/zrxService.ts#L4 'https://api.0x.org', // @shapeshiftoss/chain-adapters@1.22.1: https://github.com/shapeshift/lib/blob/476550629be9485bfc089decc4df85456968464a/packages/chain-adapters/src/ethereum/EthereumChainAdapter.ts#L226 From e2f10e9d764318448c703ff4b77c2f5fb5363443 Mon Sep 17 00:00:00 2001 From: GMSteuart Date: Tue, 24 May 2022 23:30:52 -0500 Subject: [PATCH 09/52] fix: show feature flag nav item for alt host --- src/Routes/RoutesCommon.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Routes/RoutesCommon.tsx b/src/Routes/RoutesCommon.tsx index 31f01070c01..8a2f6e00140 100644 --- a/src/Routes/RoutesCommon.tsx +++ b/src/Routes/RoutesCommon.tsx @@ -150,7 +150,9 @@ export const routes: Array = [ path: '/flags', label: 'navBar.featureFlags', icon: , - hide: window.location.hostname !== 'localhost', + hide: + window.location.hostname !== 'localhost' && + window.location.hostname !== process.env.REACT_APP_LOCAL_IP, main: Flags, }, ] From 2ed80bafebb625a28c2d12df75054b6a5930626e Mon Sep 17 00:00:00 2001 From: GMSteuart Date: Tue, 24 May 2022 23:32:27 -0500 Subject: [PATCH 10/52] perf: add env var for better local development --- sample.env | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sample.env b/sample.env index 43650eefab8..2056ba1d661 100644 --- a/sample.env +++ b/sample.env @@ -34,3 +34,6 @@ REACT_APP_GEM_WYRE_SUPPORTED_COINS=https://api.gem.co/institutions/wyre/supporte REACT_APP_GEM_ASSET_LOGO=https://gem-widgets-assets.s3-us-west-2.amazonaws.com/currencies/crypto/ REACT_APP_GEM_ENV=production REACT_APP_GEM_API_KEY=bb4164a72246dae1e03010d664d6cdae4e19b2554de02e3bf6c3cd30aa7e359e + +# IP/Hostname used for connecting external devices to localhost +REACT_APP_LOCAL_IP=192.168.1.222 \ No newline at end of file From 03fdaad2dc1b79191a2ddb48f1dffa852369cd73 Mon Sep 17 00:00:00 2001 From: GMSteuart Date: Wed, 25 May 2022 13:37:08 -0500 Subject: [PATCH 11/52] chore: remove unecessary code --- .../WalletConnect/components/Connect.tsx | 71 ++++--------------- 1 file changed, 12 insertions(+), 59 deletions(-) diff --git a/src/context/WalletProvider/WalletConnect/components/Connect.tsx b/src/context/WalletProvider/WalletConnect/components/Connect.tsx index 185eb598280..9a55b87fc6d 100644 --- a/src/context/WalletProvider/WalletConnect/components/Connect.tsx +++ b/src/context/WalletProvider/WalletConnect/components/Connect.tsx @@ -1,16 +1,12 @@ import { WalletConnectHDWallet } from '@shapeshiftoss/hdwallet-walletconnect' -import WalletConnectProvider from '@walletconnect/web3-provider' import { getConfig } from 'config' -import React, { useEffect, useState } from 'react' -import { isMobile } from 'react-device-detect' +import React, { useState } from 'react' import { RouteComponentProps } from 'react-router-dom' import { ActionTypes, WalletActions } from 'context/WalletProvider/actions' import { KeyManager } from 'context/WalletProvider/KeyManager' import { setLocalWalletTypeAndDeviceId } from 'context/WalletProvider/local-wallet' import { useWallet } from 'hooks/useWallet/useWallet' - import { ConnectModal } from '../../components/ConnectModal' -import { RedirectModal } from '../../components/RedirectModal' import { LocationState } from '../../NativeWallet/types' import { WalletConnectConfig } from '../config' @@ -32,45 +28,30 @@ export const WalletConnectConnect = ({ history }: WalletConnectSetupProps) => { const { dispatch, state } = useWallet() const [loading, setLoading] = useState(false) const [error, setError] = useState(null) - const [provider, setProvider] = useState() const setErrorLoading = (e: string | null) => { setError(e) setLoading(false) } - useEffect(() => { - ;(async () => { - try { - const rpcUrl = getConfig().REACT_APP_ETHEREUM_NODE_URL - if (!rpcUrl) { - console.error('ConfigNotFound: ethereum node url not set') - return - } - const opts = { - rpc: { - 1: rpcUrl, - }, - } - setProvider(new WalletConnectProvider(opts)) - } catch (e) { - if (!isMobile) console.error(e) - } - })() - }, [setProvider]) - const pairDevice = async () => { setError(null) setLoading(true) - if (!provider) { - throw new Error('walletProvider.walletConnect.errors.connectFailure') + const rpcUrl = getConfig().REACT_APP_ETHEREUM_NODE_URL + if (!rpcUrl) { + throw new Error('walletProvider.walletConnect.errors.rpcUrlNotFound') + } + const config = { + rpc: { + 1: rpcUrl, + }, } if (state.adapters && state.adapters?.has(KeyManager.WalletConnect)) { const wallet = (await state.adapters .get(KeyManager.WalletConnect) - ?.pairDevice(provider)) as WalletConnectHDWallet + ?.pairDevice(config)) as WalletConnectHDWallet if (!wallet) { setErrorLoading('walletProvider.errors.walletNotFound') throw new Error('Call to hdwallet-walletconnect::pairDevice returned null or undefined') @@ -80,14 +61,6 @@ export const WalletConnectConnect = ({ history }: WalletConnectSetupProps) => { try { const deviceId = await wallet.getDeviceID() - wallet.provider.onConnect(async () => { - const { connected } = await provider.getWalletConnector() - console.info(`connector connected: ${connected}`) - }) - - // Enable session (triggers QR Code modal) - await wallet.initialize() - dispatch({ type: WalletActions.SET_WALLET, payload: { wallet, name, icon, deviceId }, @@ -108,28 +81,8 @@ export const WalletConnectConnect = ({ history }: WalletConnectSetupProps) => { setLoading(false) } - // This constructs the WalletConnect deep-linking target from the currently-loaded - // window.location. The port will be blank if not specified, in which case it - // should be omitted. - const mmDeeplinkTarget = [window.location.hostname, window.location.port] - .filter(x => !!x) - .join(':') - - // TODO: test native app - // The WalletConnect mobile app itself injects a provider, so we'll use pairDevice once - // we've reopened ourselves in that environment. - return !provider && isMobile ? ( - { - window.location.assign(`https://walletconnect.app.link/dapp/${mmDeeplinkTarget}`) - }} - loading={loading} - error={error} - > - ) : ( + // The WalletConnect modal handles desktop and mobile detection as well as deep linking + return ( Date: Wed, 25 May 2022 13:52:44 -0500 Subject: [PATCH 12/52] chore: remove package dep --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index bb79c69fec0..6e53957c045 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "@visx/responsive": "^2.8.0", "@visx/shape": "^2.4.0", "@visx/tooltip": "^2.8.0", - "@walletconnect/web3-provider": "^1.7.8", "allsettled-polyfill": "^1.0.4", "axios": "^0.26.1", "bignumber.js": "^9.0.2", From b98b7ba339e4790e5827be1351b46d76e987ba47 Mon Sep 17 00:00:00 2001 From: pastaghost Date: Thu, 2 Jun 2022 14:30:10 -0600 Subject: [PATCH 13/52] chore: add hdwallet-walletconnect alpha dependency --- package.json | 2 +- .../WalletConnect/components/Connect.tsx | 1 + yarn.lock | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ca8e4471c1b..8b6e9d69be8 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@shapeshiftoss/hdwallet-native": "^1.21.2", "@shapeshiftoss/hdwallet-native-vault": "^1.21.2", "@shapeshiftoss/hdwallet-portis": "^1.21.2", - "@shapeshiftoss/hdwallet-walletconnect": "^1.21.1", + "@shapeshiftoss/hdwallet-walletconnect": "^1.23.1-alpha.0", "@shapeshiftoss/hdwallet-xdefi": "^1.21.2", "@shapeshiftoss/investor-foxy": "^3.0.0", "@shapeshiftoss/investor-yearn": "^2.0.0", diff --git a/src/context/WalletProvider/WalletConnect/components/Connect.tsx b/src/context/WalletProvider/WalletConnect/components/Connect.tsx index 9a55b87fc6d..0b8850024dc 100644 --- a/src/context/WalletProvider/WalletConnect/components/Connect.tsx +++ b/src/context/WalletProvider/WalletConnect/components/Connect.tsx @@ -6,6 +6,7 @@ import { ActionTypes, WalletActions } from 'context/WalletProvider/actions' import { KeyManager } from 'context/WalletProvider/KeyManager' import { setLocalWalletTypeAndDeviceId } from 'context/WalletProvider/local-wallet' import { useWallet } from 'hooks/useWallet/useWallet' + import { ConnectModal } from '../../components/ConnectModal' import { LocationState } from '../../NativeWallet/types' import { WalletConnectConfig } from '../config' diff --git a/yarn.lock b/yarn.lock index c2b453cef59..baf5ff0f5e7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4004,6 +4004,16 @@ p-lazy "^3.1.0" web3 "^1.5.1" +"@shapeshiftoss/hdwallet-walletconnect@^1.23.1-alpha.0": + version "1.23.1-alpha.0" + resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-walletconnect/-/hdwallet-walletconnect-1.23.1-alpha.0.tgz#7f579440491a22de7b01c8a06cec5ce814684528" + integrity sha512-7tb8xZYmFsvujC2BPE+BfSlxSQIH6jPeZMBkJ3CMUPOj7ptaZCE6Rvlo+GLg6/lWGTtvKvcL2OptEeXux+cWrA== + dependencies: + "@shapeshiftoss/hdwallet-core" "1.22.0" + "@walletconnect/qrcode-modal" "^1.7.8" + "@walletconnect/web3-provider" "^1.7.8" + ethers "^5.6.5" + "@shapeshiftoss/hdwallet-xdefi@^1.21.2": version "1.22.0" resolved "https://registry.yarnpkg.com/@shapeshiftoss/hdwallet-xdefi/-/hdwallet-xdefi-1.22.0.tgz#74b39347bb39d165cdc4cc0a90b786b2bef7a6d2" From 1ad7b195ea085f5ca01155dbc0823d7940e489e7 Mon Sep 17 00:00:00 2001 From: pastaghost Date: Fri, 3 Jun 2022 15:33:23 -0600 Subject: [PATCH 14/52] fix: add walletconnect csp entries --- headers/csps/wallets/walletconnect.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 headers/csps/wallets/walletconnect.ts diff --git a/headers/csps/wallets/walletconnect.ts b/headers/csps/wallets/walletconnect.ts new file mode 100644 index 00000000000..1608f9dacae --- /dev/null +++ b/headers/csps/wallets/walletconnect.ts @@ -0,0 +1,8 @@ +import type { Csp } from '../../types' + +export const csp: Csp = { + 'connect-src': [ + 'wss://*.bridge.walletconnect.org/', + 'https://registry.walletconnect.com/api/v2/wallets', + ], +} From 306006255931a607699e51bd76598b28271c369e Mon Sep 17 00:00:00 2001 From: pastaghost Date: Fri, 3 Jun 2022 15:33:40 -0600 Subject: [PATCH 15/52] fix: utilize feature flag --- src/context/WalletProvider/SelectModal.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/context/WalletProvider/SelectModal.tsx b/src/context/WalletProvider/SelectModal.tsx index 2d928dad95e..777278eea70 100644 --- a/src/context/WalletProvider/SelectModal.tsx +++ b/src/context/WalletProvider/SelectModal.tsx @@ -4,8 +4,6 @@ import { useTranslate } from 'react-polyglot' import { RawText, Text } from 'components/Text' import { useFeatureFlag } from 'hooks/useFeatureFlag/useFeatureFlag' import { useWallet } from 'hooks/useWallet/useWallet' -import { selectFeatureFlag } from 'state/slices/selectors' -import { useAppSelector } from 'state/store' import { SUPPORTED_WALLETS } from './config' import { KeyManager } from './KeyManager' @@ -17,14 +15,12 @@ export const SelectModal = () => { create, } = useWallet() const translate = useTranslate() - const walletConnectFeatureFlag = useAppSelector(state => - selectFeatureFlag(state, 'WalletConnectWallet'), - ) + const wallets = Object.values(KeyManager) .filter(key => key !== KeyManager.Demo) - .filter(key => walletConnectFeatureFlag || key !== KeyManager.WalletConnect) const tallyHoFeatureFlag = useFeatureFlag('TallyHoWallet') + const walletConnectFeatureFlag = useFeatureFlag('WalletConnectWallet') return ( <> @@ -46,6 +42,8 @@ export const SelectModal = () => { if (!tallyHoFeatureFlag && key === KeyManager.TallyHo) return false + if (!walletConnectFeatureFlag && key === KeyManager.WalletConnect) return false + return (