From 8611a663fe5aa5df0963e884a1cd1cf44ba46e8c Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Wed, 16 Aug 2023 01:08:53 +0700 Subject: [PATCH 01/58] feat: integrate safe + krystal --- package.json | 3 +- src/assets/wallets-connect/krystal.svg | 7 +++++ src/assets/wallets-connect/safe.svg | 15 +++++++++ src/constants/connectors/evm.ts | 3 ++ src/constants/connectors/utils.ts | 3 ++ src/constants/wallets.ts | 37 +++++++++++++++++++++++ src/react-app-env.d.ts | 1 + yarn.lock | 42 +++++++++++++++++++++++++- 8 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 src/assets/wallets-connect/krystal.svg create mode 100644 src/assets/wallets-connect/safe.svg diff --git a/package.json b/package.json index 8ac6a94b36..32b10549bf 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "@use-gesture/react": "^10.2.27", "@web3-react/coinbase-wallet": "^8.2.0", "@web3-react/core": "^8.2.0", + "@web3-react/gnosis-safe": "^8.2.0", "@web3-react/metamask": "^8.2.1", "@web3-react/types": "^8.2.0", "@web3-react/walletconnect-v2": "^8.3.3", @@ -206,4 +207,4 @@ "@lingui/core": "3.14.0", "@lingui/conf": "3.16.0" } -} +} \ No newline at end of file diff --git a/src/assets/wallets-connect/krystal.svg b/src/assets/wallets-connect/krystal.svg new file mode 100644 index 0000000000..3548af080d --- /dev/null +++ b/src/assets/wallets-connect/krystal.svg @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/src/assets/wallets-connect/safe.svg b/src/assets/wallets-connect/safe.svg new file mode 100644 index 0000000000..6041861eac --- /dev/null +++ b/src/assets/wallets-connect/safe.svg @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index a1cb1548e8..28a3f1971a 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -2,6 +2,7 @@ import { ChainId } from '@kyberswap/ks-sdk-core' import { OPTIONAL_EVENTS } from '@walletconnect/ethereum-provider' import { CoinbaseWallet } from '@web3-react/coinbase-wallet' import { initializeConnector } from '@web3-react/core' +import { GnosisSafe } from '@web3-react/gnosis-safe' import { MetaMask } from '@web3-react/metamask' import { WalletConnect as WalletConnectV2 } from '@web3-react/walletconnect-v2' @@ -14,7 +15,9 @@ import { } from 'constants/networks' export const [injected, injectedHooks] = initializeConnector(actions => new MetaMask({ actions })) +export const [krystal, krystalHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [metaMask, metamaskHooks] = initializeConnector(actions => new MetaMask({ actions })) +export const [gnosisSafe, gnosisSafeHooks] = initializeConnector(actions => new GnosisSafe({ actions })) export const [coin98, coin98Hooks] = initializeConnector(actions => new MetaMask({ actions })) export const [brave, braveHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [trustWallet, trustWalletHooks] = initializeConnector(actions => new MetaMask({ actions })) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index cd4fe725cf..08d67b3947 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -9,12 +9,15 @@ const allNonMetamaskFlags = [ 'isTrustWallet', 'isLedgerConnect', 'isCoin98', + 'isKrystal', 'isKrystalWallet', ] as const export const getIsMetaMaskWallet = () => Boolean(window.ethereum?.isMetaMask && !allNonMetamaskFlags.some(flag => window.ethereum?.[flag])) +export const getIsKrystalWallet = () => Boolean(window.ethereum?.isKrystalWallet || window.ethereum?.isKrystal) + export const getIsCoinbaseWallet = () => Boolean( (window.ethereum?.isCoinbaseWallet || window.ethereum?.providers?.some(p => p?.isCoinbaseWallet)) && diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index 9c7b9d3c54..e35e0680e6 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -6,8 +6,10 @@ import { isMobile } from 'react-device-detect' import BRAVE from 'assets/wallets-connect/brave.svg' import COIN98 from 'assets/wallets-connect/coin98.svg' import COINBASE from 'assets/wallets-connect/coinbase.svg' +import KRYSTAL from 'assets/wallets-connect/krystal.svg' import METAMASK from 'assets/wallets-connect/metamask.svg' import PHANTOM from 'assets/wallets-connect/phantom.svg' +import SAFE from 'assets/wallets-connect/safe.svg' import SLOPE from 'assets/wallets-connect/slope.svg' import SOLFLARE from 'assets/wallets-connect/solflare.svg' import TRUSTWALLET from 'assets/wallets-connect/trust-wallet.svg' @@ -21,8 +23,12 @@ import { coin98Hooks, coinbaseWallet, coinbaseWalletHooks, + gnosisSafe, + gnosisSafeHooks, injected, injectedHooks, + krystal, + krystalHooks, metaMask, metamaskHooks, trustWallet, @@ -43,6 +49,7 @@ import { getIsC98Wallet, getIsCoinbaseWallet, getIsGenericInjector, + getIsKrystalWallet, getIsMetaMaskWallet, getIsTrustWallet, } from 'constants/connectors/utils' @@ -58,6 +65,18 @@ const detectMetamask = (): WalletReadyState => { return WalletReadyState.NotDetected } +const detectSafe = (): WalletReadyState => { + // todo namgold: WIP + return WalletReadyState.Installed + // if (getIsGenericInjector()) return WalletReadyState.Installed + // return WalletReadyState.NotDetected +} + +const detectKrystal = (): WalletReadyState => { + if (getIsKrystalWallet()) return WalletReadyState.Installed + return WalletReadyState.NotDetected +} + const detectBrave = (): WalletReadyState => { //todo known issue: fail connect on mobile solana if (getIsBraveWallet()) return WalletReadyState.Installed @@ -129,6 +148,24 @@ export const SUPPORTED_WALLETS = { installLink: 'https://metamask.io/download', readyState: detectMetamask, } as EVMWalletInfo, + SAFE: { + connector: gnosisSafe, + hooks: gnosisSafeHooks, + name: 'Safe{Wallet}', + icon: SAFE, + iconLight: SAFE, + installLink: 'https://safe.global/wallet', + readyState: detectSafe, + } as EVMWalletInfo, + KRYSTAL: { + connector: krystal, + hooks: krystalHooks, + name: 'Krystal', + icon: KRYSTAL, + iconLight: KRYSTAL, + installLink: 'https://wallet.krystal.app', + readyState: detectKrystal, + } as EVMWalletInfo, BRAVE: { connector: brave, hooks: braveHooks, diff --git a/src/react-app-env.d.ts b/src/react-app-env.d.ts index 167044713b..c2cb2e63aa 100644 --- a/src/react-app-env.d.ts +++ b/src/react-app-env.d.ts @@ -15,6 +15,7 @@ interface Window { isTrustWallet?: boolean isRabby?: boolean isLedgerConnect?: boolean + isKrystal?: boolean isKrystalWallet?: boolean on?: (...args: any[]) => void removeListener?: (...args: any[]) => void diff --git a/yarn.lock b/yarn.lock index 078f7e665b..d17564e83b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2876,6 +2876,37 @@ estree-walker "^2.0.2" picomatch "^2.3.1" +"@safe-global/safe-apps-provider@^0.16.0": + version "0.16.0" + resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-provider/-/safe-apps-provider-0.16.0.tgz#55cb8ef168900fa13d4f4508a99ef00b565bf55d" + integrity sha512-oeRlvU+2hjFx/7EbskGq30kkwL2hyfdseZZZYf6na/xD85mZ59zKO81lBxZcWnvofJFqjqtScz84PAKth9Sq2g== + dependencies: + "@safe-global/safe-apps-sdk" "7.10.0" + events "^3.3.0" + +"@safe-global/safe-apps-sdk@7.10.0": + version "7.10.0" + resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-sdk/-/safe-apps-sdk-7.10.0.tgz#e75fc581126f27c52ec2601da51bca5eb99b61f4" + integrity sha512-is0QAHVoGkP06YfOPcp4X3/YUEA3wRdgFUyKZ4rT47uOEnzxA9Sm8BFJrIZqZOjjqC+aJXRMF0cE2qucS953rg== + dependencies: + "@safe-global/safe-gateway-typescript-sdk" "^3.5.3" + ethers "^5.7.2" + +"@safe-global/safe-apps-sdk@^7.10.0": + version "7.11.0" + resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-sdk/-/safe-apps-sdk-7.11.0.tgz#2cbc164fb70141cdf4d3331ff222cd98a2529316" + integrity sha512-RDamzPM1Lhhiiz0O+Dn6FkFqIh47jmZX+HCV/BBnBBOSKfBJE//IGD3+02zMgojXHTikQAburdPes9qmH1SA1A== + dependencies: + "@safe-global/safe-gateway-typescript-sdk" "^3.5.3" + ethers "^5.7.2" + +"@safe-global/safe-gateway-typescript-sdk@^3.5.3": + version "3.9.0" + resolved "https://registry.yarnpkg.com/@safe-global/safe-gateway-typescript-sdk/-/safe-gateway-typescript-sdk-3.9.0.tgz#5aa36c05b865f6fe754d1d460f83bc9bf3a0145e" + integrity sha512-DxRM/sBBQhv955dPtdo0z2Bf2fXxrzoRUnGyTa3+4Z0RAhcyiqnffRP1Bt3tyuvlyfZnFL0RsvkqDcAIKzq3RQ== + dependencies: + cross-fetch "^3.1.5" + "@scure/base@~1.1.0": version "1.1.1" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.1.tgz#ebb651ee52ff84f420097055f4bf46cfba403938" @@ -5623,6 +5654,15 @@ optionalDependencies: "@ethersproject/providers" "^5" +"@web3-react/gnosis-safe@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@web3-react/gnosis-safe/-/gnosis-safe-8.2.0.tgz#003e7f5b335751b6699152be301256c989631b51" + integrity sha512-52Z1uHcnIVsyfEPjj2C+cDF21wNCMrCT6kr1JTFXkvLMfZ3LvfWOX1j+C9lOBGUyZRBe5ZtkjiLiogGqRqZYmA== + dependencies: + "@safe-global/safe-apps-provider" "^0.16.0" + "@safe-global/safe-apps-sdk" "^7.10.0" + "@web3-react/types" "^8.2.0" + "@web3-react/metamask@^8.2.1": version "8.2.1" resolved "https://registry.yarnpkg.com/@web3-react/metamask/-/metamask-8.2.1.tgz#7ffac16e2a55ff8f1195e2831a9f9f99fa0bfba9" @@ -9423,7 +9463,7 @@ ethereumjs-util@^7.1.5: ethereum-cryptography "^0.1.3" rlp "^2.2.4" -ethers@^5.4.6, ethers@^5.6.9, ethers@^5.7.1: +ethers@^5.4.6, ethers@^5.6.9, ethers@^5.7.1, ethers@^5.7.2: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== From d11240dcc5ac3eba0e54f78fbb5a1578f1db1295 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Wed, 16 Aug 2023 16:57:04 +0700 Subject: [PATCH 02/58] update detect Krystal --- src/constants/connectors/utils.ts | 3 ++- src/constants/wallets.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index 08d67b3947..b90eb289dd 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -16,7 +16,8 @@ const allNonMetamaskFlags = [ export const getIsMetaMaskWallet = () => Boolean(window.ethereum?.isMetaMask && !allNonMetamaskFlags.some(flag => window.ethereum?.[flag])) -export const getIsKrystalWallet = () => Boolean(window.ethereum?.isKrystalWallet || window.ethereum?.isKrystal) +export const getIsKrystalWallet = () => + Boolean(window.ethereum?.isKrystalWallet || (window.ethereum?.isKrystal && !getIsTrustWallet())) export const getIsCoinbaseWallet = () => Boolean( diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index e35e0680e6..2948fe398e 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -151,7 +151,7 @@ export const SUPPORTED_WALLETS = { SAFE: { connector: gnosisSafe, hooks: gnosisSafeHooks, - name: 'Safe{Wallet}', + name: 'Safe', icon: SAFE, iconLight: SAFE, installLink: 'https://safe.global/wallet', From 18e8e7d396447e8ca819f6c357a8693e697e6c76 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Wed, 16 Aug 2023 19:57:49 +0700 Subject: [PATCH 03/58] update --- src/assets/wallets-connect/rabby.svg | 36 +++++++++++ src/components/FeeSelector/index.tsx | 4 +- src/constants/connectors/evm.ts | 1 + src/constants/connectors/utils.ts | 5 +- src/constants/networks.ts | 2 +- src/constants/wallets.ts | 32 +++++++++- src/hooks/index.ts | 3 +- src/hooks/web3/useEagerConnect.ts | 4 ++ src/hooks/web3/useWalletSupportedChains.ts | 1 - .../BridgeTransferHistory/RouteCell.tsx | 3 +- .../TransferHistoryTable/Mobile.tsx | 3 +- .../TransfersHistory/HistoryTable/Mobile.tsx | 3 +- src/state/transactions/updater.tsx | 3 +- src/types/array.d.ts | 8 +++ src/types/object.d.ts | 7 +++ src/utils/array.ts | 8 --- src/utils/index.ts | 62 +++++++------------ yarn.lock | 7 +-- 18 files changed, 121 insertions(+), 71 deletions(-) create mode 100644 src/assets/wallets-connect/rabby.svg create mode 100644 src/types/array.d.ts create mode 100644 src/types/object.d.ts diff --git a/src/assets/wallets-connect/rabby.svg b/src/assets/wallets-connect/rabby.svg new file mode 100644 index 0000000000..6a28dda508 --- /dev/null +++ b/src/assets/wallets-connect/rabby.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/FeeSelector/index.tsx b/src/components/FeeSelector/index.tsx index 15136a5c29..b8c6a7205b 100644 --- a/src/components/FeeSelector/index.tsx +++ b/src/components/FeeSelector/index.tsx @@ -220,7 +220,7 @@ function FeeSelector({ (acc, cur, index) => ({ ...acc, [cur]: poolAddresses[index] }), {} as { [key in FeeAmount]: string }, ) - const tiersThatHasFarmV1 = FEE_AMOUNTS.filter((_fee, i) => { + const tiersThatHasFarmV1: FeeAmount[] = FEE_AMOUNTS.filter((_fee, i) => { const poolAddress = poolAddresses[i].toLowerCase() return farmingPoolAddress.includes(poolAddress) }) @@ -249,7 +249,7 @@ function FeeSelector({ - {(tiersThatHasFarmV1.includes(feeAmount) || + {(tiersThatHasFarmV1.includes(feeAmount as any) || activeFarmV2s?.find(item => item.poolAddress === poolByFeeAmount[feeAmount].toLowerCase())) && ( )} diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index 28a3f1971a..2003117241 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -15,6 +15,7 @@ import { } from 'constants/networks' export const [injected, injectedHooks] = initializeConnector(actions => new MetaMask({ actions })) +export const [rabby, rabbyHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [krystal, krystalHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [metaMask, metamaskHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [gnosisSafe, gnosisSafeHooks] = initializeConnector(actions => new GnosisSafe({ actions })) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index b90eb289dd..81db531853 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -12,10 +12,11 @@ const allNonMetamaskFlags = [ 'isKrystal', 'isKrystalWallet', ] as const - export const getIsMetaMaskWallet = () => Boolean(window.ethereum?.isMetaMask && !allNonMetamaskFlags.some(flag => window.ethereum?.[flag])) +export const getIsRabbyWallet = () => Boolean(window.ethereum?.isRabby) + export const getIsKrystalWallet = () => Boolean(window.ethereum?.isKrystalWallet || (window.ethereum?.isKrystal && !getIsTrustWallet())) @@ -37,6 +38,8 @@ export const getIsGenericInjector = () => !getIsCoinbaseWallet() && !getIsBraveWallet() && !getIsC98Wallet() && + !getIsRabbyWallet() && + !getIsKrystalWallet() && !getIsTrustWallet() // https://eips.ethereum.org/EIPS/eip-1193#provider-errors diff --git a/src/constants/networks.ts b/src/constants/networks.ts index 43ef0bd59f..081eee814e 100644 --- a/src/constants/networks.ts +++ b/src/constants/networks.ts @@ -67,7 +67,7 @@ export const NETWORKS_INFO = new Proxy(NETWORKS_INFO_CONFIG, { // temporary disable Solana // todo: either enable back or completely remove Solana from codebase -export const SUPPORTED_NETWORKS = Object.keys(NETWORKS_INFO).map(Number).filter(isEVM) as ChainId[] +export const SUPPORTED_NETWORKS = Object.keys(NETWORKS_INFO).map(Number).filter(isEVM) export const MAINNET_NETWORKS = [ ChainId.MAINNET, diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index 2948fe398e..f37aadb84f 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -9,6 +9,7 @@ import COINBASE from 'assets/wallets-connect/coinbase.svg' import KRYSTAL from 'assets/wallets-connect/krystal.svg' import METAMASK from 'assets/wallets-connect/metamask.svg' import PHANTOM from 'assets/wallets-connect/phantom.svg' +import RABBY from 'assets/wallets-connect/rabby.svg' import SAFE from 'assets/wallets-connect/safe.svg' import SLOPE from 'assets/wallets-connect/slope.svg' import SOLFLARE from 'assets/wallets-connect/solflare.svg' @@ -31,6 +32,8 @@ import { krystalHooks, metaMask, metamaskHooks, + rabby, + rabbyHooks, trustWallet, trustWalletHooks, walletConnectV2, @@ -51,6 +54,7 @@ import { getIsGenericInjector, getIsKrystalWallet, getIsMetaMaskWallet, + getIsRabbyWallet, getIsTrustWallet, } from 'constants/connectors/utils' @@ -72,6 +76,11 @@ const detectSafe = (): WalletReadyState => { // return WalletReadyState.NotDetected } +const detectRabby = (): WalletReadyState => { + if (getIsRabbyWallet()) return WalletReadyState.Installed + return WalletReadyState.NotDetected +} + const detectKrystal = (): WalletReadyState => { if (getIsKrystalWallet()) return WalletReadyState.Installed return WalletReadyState.NotDetected @@ -157,6 +166,15 @@ export const SUPPORTED_WALLETS = { installLink: 'https://safe.global/wallet', readyState: detectSafe, } as EVMWalletInfo, + RABBBY: { + connector: rabby, + hooks: rabbyHooks, + name: 'Rabby', + icon: RABBY, + iconLight: RABBY, + installLink: 'https://rabby.io', + readyState: detectRabby, + } as EVMWalletInfo, KRYSTAL: { connector: krystal, hooks: krystalHooks, @@ -243,10 +261,20 @@ export const SUPPORTED_WALLETS = { readyState: detectTrustWallet, } as EVMWalletInfo, } as const +export type SUPPORTED_WALLET = keyof typeof SUPPORTED_WALLETS export const connections = Object.values(SUPPORTED_WALLETS).filter(wallet => 'connector' in wallet) as EVMWalletInfo[] -export type SUPPORTED_WALLET = keyof typeof SUPPORTED_WALLETS - export const LOCALSTORAGE_LAST_WALLETKEY_EVM = 'last-wallet-key-evm' export const LOCALSTORAGE_LAST_WALLETKEY_SOLANA = 'last-wallet-key-solana' +export const INJECTED_KEYS = [ + 'COIN98', + 'BRAVE', + 'METAMASK', + 'COINBASE', + 'TRUST_WALLET', + 'KRYSTAL', + 'RABBBY', + 'INJECTED', +] as const +export type INJECTED_KEY = typeof INJECTED_KEYS[number] diff --git a/src/hooks/index.ts b/src/hooks/index.ts index c3c8cfeb08..e0bfd03cf4 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -57,10 +57,11 @@ export function useActiveWeb3React(): { const walletKeyEVM = useMemo(() => { if (!isConnectedEVM) return undefined - const detectedWallet = detectInjectedType() if (connectedConnectorEVM === walletConnectV2) { return 'WALLET_CONNECT' } + const detectedWallet = detectInjectedType() + return ( detectedWallet ?? (Object.keys(SUPPORTED_WALLETS) as SUPPORTED_WALLET[]).find(walletKey => { diff --git a/src/hooks/web3/useEagerConnect.ts b/src/hooks/web3/useEagerConnect.ts index ed6e35f592..bef23a9456 100644 --- a/src/hooks/web3/useEagerConnect.ts +++ b/src/hooks/web3/useEagerConnect.ts @@ -35,6 +35,10 @@ export function useEagerConnect() { if (trying || tried) return trying = true let activated = false + try { + await tryActivation('SAFE', true) + activated = true + } catch {} const lastWalletKeyEVM = localStorage.getItem(LOCALSTORAGE_LAST_WALLETKEY_EVM) const lastWalletKeySolana = localStorage.getItem(LOCALSTORAGE_LAST_WALLETKEY_SOLANA) await Promise.all([ diff --git a/src/hooks/web3/useWalletSupportedChains.ts b/src/hooks/web3/useWalletSupportedChains.ts index 946bb0acf8..6b5429c39f 100644 --- a/src/hooks/web3/useWalletSupportedChains.ts +++ b/src/hooks/web3/useWalletSupportedChains.ts @@ -22,7 +22,6 @@ export function useWalletSupportedChains() { case walletConnectV2: return [ ...getChainsFromEIP155Accounts((connector as WalletConnectV2).provider?.session?.namespaces?.eip155?.accounts), - // ChainId.SOLANA, ] default: return SUPPORTED_NETWORKS diff --git a/src/pages/Bridge/BridgeTransferHistory/RouteCell.tsx b/src/pages/Bridge/BridgeTransferHistory/RouteCell.tsx index 192bccca34..17a4a61647 100644 --- a/src/pages/Bridge/BridgeTransferHistory/RouteCell.tsx +++ b/src/pages/Bridge/BridgeTransferHistory/RouteCell.tsx @@ -6,7 +6,6 @@ import { useTheme } from 'styled-components' import QuestionHelper from 'components/QuestionHelper' import { NETWORKS_INFO, SUPPORTED_NETWORKS } from 'constants/networks' import { useIsDarkMode } from 'state/user/hooks' -import { includes } from 'utils/array' type Props = { fromChainID: number @@ -17,7 +16,7 @@ const RouteCell: React.FC = ({ fromChainID, toChainID }) => { const theme = useTheme() const renderChainIcon = (chainId: number) => { - if (includes(SUPPORTED_NETWORKS, chainId)) { + if (SUPPORTED_NETWORKS.includes(chainId)) { const chainInfo = NETWORKS_INFO[chainId] const src = isDark && chainInfo.iconDark ? chainInfo.iconDark : chainInfo.icon return {chainInfo.name} diff --git a/src/pages/Bridge/BridgeTransferHistory/TransferHistoryTable/Mobile.tsx b/src/pages/Bridge/BridgeTransferHistory/TransferHistoryTable/Mobile.tsx index 1375d8a27b..fe404d0ad2 100644 --- a/src/pages/Bridge/BridgeTransferHistory/TransferHistoryTable/Mobile.tsx +++ b/src/pages/Bridge/BridgeTransferHistory/TransferHistoryTable/Mobile.tsx @@ -11,7 +11,6 @@ import ActionCell from 'pages/Bridge/BridgeTransferHistory/ActionCell' import StatusBadge from 'pages/Bridge/BridgeTransferHistory/StatusBadge' import TimeStatusCell from 'pages/Bridge/BridgeTransferHistory/TimeStatusCell' import TokenReceiveCell from 'pages/Bridge/BridgeTransferHistory/TokenReceiveCell' -import { includes } from 'utils/array' import { Props } from './index' @@ -59,7 +58,7 @@ const ChainWrapper = styled.div` color: ${({ theme }) => theme.subText}; ` const ChainDisplay: React.FC<{ chainId: number }> = ({ chainId }) => { - if (includes(SUPPORTED_NETWORKS, chainId)) { + if (SUPPORTED_NETWORKS.includes(chainId)) { const chainInfo = NETWORKS_INFO[chainId] return ( diff --git a/src/pages/CrossChain/TransfersHistory/HistoryTable/Mobile.tsx b/src/pages/CrossChain/TransfersHistory/HistoryTable/Mobile.tsx index 3fdaeacaa9..dc8a558427 100644 --- a/src/pages/CrossChain/TransfersHistory/HistoryTable/Mobile.tsx +++ b/src/pages/CrossChain/TransfersHistory/HistoryTable/Mobile.tsx @@ -16,7 +16,6 @@ import ActionButtons from 'pages/CrossChain/TransfersHistory/HistoryTable/Action import { DetailTransaction } from 'pages/CrossChain/TransfersHistory/HistoryTable/DetailTransaction' import { useGetTransactionStatus } from 'pages/CrossChain/TransfersHistory/HistoryTable/TransactionItem' import { CrossChainTransfer } from 'pages/CrossChain/useTransferHistory' -import { includes } from 'utils/array' import TokenReceiveCell from './TokenReceiveCell' import { Props } from './index' @@ -65,7 +64,7 @@ const ChainWrapper = styled.div` color: ${({ theme }) => theme.subText}; ` const ChainDisplay: React.FC<{ chainId: number }> = ({ chainId }) => { - if (includes(SUPPORTED_NETWORKS, chainId)) { + if (SUPPORTED_NETWORKS.includes(chainId)) { const chainInfo = NETWORKS_INFO[chainId] return ( diff --git a/src/state/transactions/updater.tsx b/src/state/transactions/updater.tsx index a8119e4871..4813dd3cfa 100644 --- a/src/state/transactions/updater.tsx +++ b/src/state/transactions/updater.tsx @@ -13,7 +13,6 @@ import { useSetClaimingCampaignRewardId } from 'state/campaigns/hooks' import { AppDispatch, AppState } from 'state/index' import { revokePermit } from 'state/user/actions' import { findTx } from 'utils' -import { includes } from 'utils/array' import { checkedTransaction, finalizeTransaction, removeTx, replaceTx } from './actions' import { SerializableTransactionReceipt, TRANSACTION_TYPE, TransactionDetails } from './type' @@ -134,7 +133,7 @@ export default function Updater(): null { blockHash: receipt.blockHash, status: receipt.status, }, - needCheckSubgraph: includes(NEED_CHECK_SUBGRAPH_TRANSACTION_TYPES, transaction.type), + needCheckSubgraph: NEED_CHECK_SUBGRAPH_TRANSACTION_TYPES.includes(transaction.type), }), ) diff --git a/src/types/array.d.ts b/src/types/array.d.ts new file mode 100644 index 0000000000..8d250a1fb8 --- /dev/null +++ b/src/types/array.d.ts @@ -0,0 +1,8 @@ +interface Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: any, fromIndex?: number): searchElement is T +} diff --git a/src/types/object.d.ts b/src/types/object.d.ts new file mode 100644 index 0000000000..2bb60cea06 --- /dev/null +++ b/src/types/object.d.ts @@ -0,0 +1,7 @@ +interface ObjectConstructor { + /** + * Returns the names of the enumerable string properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: { [keys in T]: unknown }): T[] +} diff --git a/src/utils/array.ts b/src/utils/array.ts index bdaa63450f..2a348bbb9f 100644 --- a/src/utils/array.ts +++ b/src/utils/array.ts @@ -7,14 +7,6 @@ export const chunk = (arr: readonly T[], chunkSize: number): T[][] => { return result } -export const includes = ( - srcStr: readonly T[] | T[], - searchElement: any, - fromIndex?: number | undefined, -): searchElement is T => { - return (srcStr as any[]).includes(searchElement, fromIndex) -} - export const uniqueArray = (array: T[], keySelector = (item: T): U => item as any): T[] => { const set = new Set() const result: T[] = [] diff --git a/src/utils/index.ts b/src/utils/index.ts index 478da2b351..0ee87bb61e 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,6 +1,7 @@ import { ApolloClient, NormalizedCacheObject } from '@apollo/client' import { BigNumber } from '@ethersproject/bignumber' import { ChainId, Currency, CurrencyAmount, Percent, Token, WETH } from '@kyberswap/ks-sdk-core' +import { WalletReadyState } from '@solana/wallet-adapter-base' import { PublicKey } from '@solana/web3.js' import dayjs from 'dayjs' import JSBI from 'jsbi' @@ -12,11 +13,18 @@ import { ENV_KEY } from 'constants/env' import { DEFAULT_GAS_LIMIT_MARGIN, ZERO_ADDRESS } from 'constants/index' import { NETWORKS_INFO, SUPPORTED_NETWORKS, isEVM } from 'constants/networks' import { KNC, KNCL_ADDRESS } from 'constants/tokens' -import { EVMWalletInfo, SUPPORTED_WALLET, SolanaWalletInfo, WalletInfo } from 'constants/wallets' +import { + EVMWalletInfo, + INJECTED_KEY, + INJECTED_KEYS, + SUPPORTED_WALLET, + SUPPORTED_WALLETS, + SolanaWalletInfo, + WalletInfo, +} from 'constants/wallets' import store from 'state' import { GroupedTxsByHash, TransactionDetails } from 'state/transactions/type' import { chunk } from 'utils/array' -import checkForBraveBrowser from 'utils/checkForBraveBrowser' export const isWalletAddressSolana = async (addr: string) => { try { @@ -430,54 +438,26 @@ export const deleteUnique = (array: T[] | undefined, element: T): T[] => { export const isEVMWallet = (wallet?: WalletInfo): wallet is EVMWalletInfo => !!wallet && 'connector' in wallet export const isSolanaWallet = (wallet?: WalletInfo): wallet is SolanaWalletInfo => !!wallet && 'adapter' in wallet -enum WALLET_KEYS { - COIN98 = 'COIN98', - BRAVE = 'BRAVE', - METAMASK = 'METAMASK', - COINBASE = 'COINBASE', - TRUST_WALLET = 'TRUST_WALLET', - WALLET_CONNECT = 'WALLET_CONNECT', -} - // https://docs.metamask.io/guide/ethereum-provider.html#basic-usage // https://docs.cloud.coinbase.com/wallet-sdk/docs/injected-provider#properties // Coin98 and Brave wallet is overriding Metamask. So at a time, there is only 1 exists -export const detectInjectedType = (): WALLET_KEYS | null => { - const { ethereum } = window - // When Coinbase wallet connected will inject selectedProvider property and some others props - if (ethereum?.selectedProvider) { - if (ethereum?.selectedProvider?.isMetaMask) return WALLET_KEYS.METAMASK - if (ethereum?.selectedProvider?.isCoinbaseWallet) return WALLET_KEYS.COINBASE - } - - if (ethereum?.isCoinbaseWallet) return WALLET_KEYS.COINBASE - - if (ethereum?.isTrustWallet) return WALLET_KEYS.TRUST_WALLET - - if (checkForBraveBrowser() && ethereum?.isBraveWallet) return WALLET_KEYS.BRAVE - - if (ethereum?.isMetaMask) { - if (ethereum?.isCoin98) { - return WALLET_KEYS.COIN98 - } - return WALLET_KEYS.METAMASK - } - if (JSON.parse(localStorage.walletconnect || '{}').connected) { - return WALLET_KEYS.WALLET_CONNECT - } - return null +export const detectInjectedType = (): INJECTED_KEY | undefined => { + return INJECTED_KEYS.find(walletKey => { + const wallet = SUPPORTED_WALLETS[walletKey] + return wallet.readyState() === WalletReadyState.Installed + }) } export const isOverriddenWallet = (wallet: SUPPORTED_WALLET) => { const injectedType = detectInjectedType() return ( - (wallet === WALLET_KEYS.COIN98 && injectedType === WALLET_KEYS.METAMASK) || - (wallet === WALLET_KEYS.METAMASK && injectedType === WALLET_KEYS.COIN98) || - (wallet === WALLET_KEYS.BRAVE && injectedType === WALLET_KEYS.COIN98) || - (wallet === WALLET_KEYS.COIN98 && injectedType === WALLET_KEYS.BRAVE) || - (wallet === WALLET_KEYS.COINBASE && injectedType === WALLET_KEYS.COIN98) || + (wallet === 'COIN98' && injectedType === 'METAMASK') || + (wallet === 'METAMASK' && injectedType === 'COIN98') || + (wallet === 'BRAVE' && injectedType === 'COIN98') || + (wallet === 'COIN98' && injectedType === 'BRAVE') || + (wallet === 'COINBASE' && injectedType === 'COIN98') || // Coin98 turned off override MetaMask in setting - (wallet === WALLET_KEYS.COIN98 && window.coin98 && !window.ethereum?.isCoin98) + (wallet === 'COIN98' && window.coin98 && !window.ethereum?.isCoin98) ) } diff --git a/yarn.lock b/yarn.lock index d17564e83b..7be11f1259 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16843,16 +16843,11 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== -typescript@4.8.4: +typescript@^4.6.2, typescript@4.8.4: version "4.8.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== -typescript@^4.6.2: - version "4.9.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.4.tgz#a2a3d2756c079abda241d75f149df9d561091e78" - integrity sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg== - ua-parser-js@^0.7.24: version "0.7.35" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.35.tgz#8bda4827be4f0b1dda91699a29499575a1f1d307" From e10291c0e07863d74611e36df85aaf1d74c6533a Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Wed, 16 Aug 2023 20:20:04 +0700 Subject: [PATCH 04/58] update detect safe --- src/hooks/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hooks/index.ts b/src/hooks/index.ts index e0bfd03cf4..e9fe91cf0d 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -7,7 +7,7 @@ import { useEffect, useMemo } from 'react' import { useSelector } from 'react-redux' import { useSearchParams } from 'react-router-dom' -import { metaMask, walletConnectV2 } from 'constants/connectors/evm' +import { gnosisSafe, metaMask, walletConnectV2 } from 'constants/connectors/evm' import { MOCK_ACCOUNT_EVM, MOCK_ACCOUNT_SOLANA } from 'constants/env' import { NETWORKS_INFO, isSupportedChainId } from 'constants/networks' import { NetworkInfo } from 'constants/networks/type' @@ -60,6 +60,9 @@ export function useActiveWeb3React(): { if (connectedConnectorEVM === walletConnectV2) { return 'WALLET_CONNECT' } + if (connectedConnectorEVM === gnosisSafe) { + return 'SAFE' + } const detectedWallet = detectInjectedType() return ( From 6d8d9be4c47b295e6b6f717f918f59067798f0bc Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Thu, 17 Aug 2023 15:45:22 +0700 Subject: [PATCH 05/58] debug blocto --- src/assets/wallets-connect/bocto.svg | 18 ++++++++++++++++++ src/constants/connectors/evm.ts | 1 + src/constants/connectors/utils.ts | 7 +++++++ src/constants/wallets.ts | 18 ++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 src/assets/wallets-connect/bocto.svg diff --git a/src/assets/wallets-connect/bocto.svg b/src/assets/wallets-connect/bocto.svg new file mode 100644 index 0000000000..9100b0026a --- /dev/null +++ b/src/assets/wallets-connect/bocto.svg @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index 2003117241..3619c5b665 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -22,6 +22,7 @@ export const [gnosisSafe, gnosisSafeHooks] = initializeConnector(act export const [coin98, coin98Hooks] = initializeConnector(actions => new MetaMask({ actions })) export const [brave, braveHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [trustWallet, trustWalletHooks] = initializeConnector(actions => new MetaMask({ actions })) +export const [blocto, bloctoHooks] = initializeConnector(actions => new MetaMask({ actions })) const darkmode = Boolean(window.matchMedia('(prefers-color-scheme: dark)')) export const [walletConnectV2, walletConnectV2Hooks] = initializeConnector( diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index 81db531853..6795dde285 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -1,3 +1,5 @@ +import { captureEvent, captureMessage } from '@sentry/react' + import checkForBraveBrowser from 'utils/checkForBraveBrowser' export const getIsInjected = () => Boolean(window.ethereum) @@ -17,6 +19,11 @@ export const getIsMetaMaskWallet = () => export const getIsRabbyWallet = () => Boolean(window.ethereum?.isRabby) +export const getIsBloctoWallet = () => { + captureMessage('blocto eth:', { level: 'info', extra: { 'window.ethereum': window.ethereum } }) + return Boolean(window.ethereum?.isRabby) +} + export const getIsKrystalWallet = () => Boolean(window.ethereum?.isKrystalWallet || (window.ethereum?.isKrystal && !getIsTrustWallet())) diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index f37aadb84f..7014100e69 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -3,6 +3,7 @@ import { Web3ReactHooks } from '@web3-react/core' import { Connector } from '@web3-react/types' import { isMobile } from 'react-device-detect' +import BLOCTO from 'assets/wallets-connect/bocto.svg' import BRAVE from 'assets/wallets-connect/brave.svg' import COIN98 from 'assets/wallets-connect/coin98.svg' import COINBASE from 'assets/wallets-connect/coinbase.svg' @@ -18,6 +19,8 @@ import WALLETCONNECT from 'assets/wallets-connect/wallet-connect.svg' import INJECTED_DARK_ICON from 'assets/wallets/browser-wallet-dark.svg' import INJECTED_LIGHT_ICON from 'assets/wallets/browser-wallet-light.svg' import { + blocto, + bloctoHooks, brave, braveHooks, coin98, @@ -48,6 +51,7 @@ import { solflareAdapter, } from 'constants/connectors/solana' import { + getIsBloctoWallet, getIsBraveWallet, getIsC98Wallet, getIsCoinbaseWallet, @@ -69,6 +73,11 @@ const detectMetamask = (): WalletReadyState => { return WalletReadyState.NotDetected } +const detectBlocto = (): WalletReadyState => { + if (getIsBloctoWallet()) return WalletReadyState.Installed + return WalletReadyState.NotDetected +} + const detectSafe = (): WalletReadyState => { // todo namgold: WIP return WalletReadyState.Installed @@ -157,6 +166,15 @@ export const SUPPORTED_WALLETS = { installLink: 'https://metamask.io/download', readyState: detectMetamask, } as EVMWalletInfo, + BLOCTO: { + connector: blocto, + hooks: bloctoHooks, + name: 'Blocto', + icon: BLOCTO, + iconLight: BLOCTO, + installLink: 'https://www.blocto.io/download', + readyState: detectBlocto, + } as EVMWalletInfo, SAFE: { connector: gnosisSafe, hooks: gnosisSafeHooks, From 619488164b7f439e3fff6ddec315699ac9ae7ae9 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Thu, 17 Aug 2023 15:48:49 +0700 Subject: [PATCH 06/58] update lint --- src/constants/connectors/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index 6795dde285..b7e603df08 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -1,4 +1,4 @@ -import { captureEvent, captureMessage } from '@sentry/react' +import { captureMessage } from '@sentry/react' import checkForBraveBrowser from 'utils/checkForBraveBrowser' From a3bd06e307588c389aca964a9e4eabbb45661931 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Thu, 17 Aug 2023 16:03:31 +0700 Subject: [PATCH 07/58] detect blocto --- src/constants/connectors/utils.ts | 10 ++++++++-- src/react-app-env.d.ts | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index b7e603df08..f5deb17df0 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -1,7 +1,12 @@ import { captureMessage } from '@sentry/react' +import { ENV_LEVEL } from 'constants/env' +import { ENV_TYPE } from 'constants/type' import checkForBraveBrowser from 'utils/checkForBraveBrowser' +ENV_LEVEL == ENV_TYPE.ADPR && + captureMessage('Injected window.ethereum', { level: 'info', extra: { 'window.ethereum': window.ethereum } }) + export const getIsInjected = () => Boolean(window.ethereum) const allNonMetamaskFlags = [ @@ -13,6 +18,7 @@ const allNonMetamaskFlags = [ 'isCoin98', 'isKrystal', 'isKrystalWallet', + 'isBlocto', ] as const export const getIsMetaMaskWallet = () => Boolean(window.ethereum?.isMetaMask && !allNonMetamaskFlags.some(flag => window.ethereum?.[flag])) @@ -20,8 +26,7 @@ export const getIsMetaMaskWallet = () => export const getIsRabbyWallet = () => Boolean(window.ethereum?.isRabby) export const getIsBloctoWallet = () => { - captureMessage('blocto eth:', { level: 'info', extra: { 'window.ethereum': window.ethereum } }) - return Boolean(window.ethereum?.isRabby) + return Boolean(window.ethereum?.isBlocto) } export const getIsKrystalWallet = () => @@ -47,6 +52,7 @@ export const getIsGenericInjector = () => !getIsC98Wallet() && !getIsRabbyWallet() && !getIsKrystalWallet() && + !getIsBloctoWallet() && !getIsTrustWallet() // https://eips.ethereum.org/EIPS/eip-1193#provider-errors diff --git a/src/react-app-env.d.ts b/src/react-app-env.d.ts index c2cb2e63aa..6d6bd5fa48 100644 --- a/src/react-app-env.d.ts +++ b/src/react-app-env.d.ts @@ -14,6 +14,7 @@ interface Window { isTrust?: boolean isTrustWallet?: boolean isRabby?: boolean + isBlocto?: boolean isLedgerConnect?: boolean isKrystal?: boolean isKrystalWallet?: boolean From 7935cbdae293d36e2fea89bfdc8d7e005fa74be0 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Thu, 17 Aug 2023 15:58:34 +0700 Subject: [PATCH 08/58] fix(kyber-AI): remove referral link ellipsis (#2175) --- src/pages/TrueSightV2/pages/RegisterWhitelist/styled.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/TrueSightV2/pages/RegisterWhitelist/styled.tsx b/src/pages/TrueSightV2/pages/RegisterWhitelist/styled.tsx index a9a3fc666d..94944148fc 100644 --- a/src/pages/TrueSightV2/pages/RegisterWhitelist/styled.tsx +++ b/src/pages/TrueSightV2/pages/RegisterWhitelist/styled.tsx @@ -23,7 +23,6 @@ export const Input = styled.input<{ $borderColor: string }>` background-color: ${({ theme }) => theme.buttonBlack}; transition: border 0.5s; border: ${({ theme, $borderColor }) => `1px solid ${$borderColor || theme.border}`}; - text-overflow: ellipsis; ::placeholder { color: ${({ theme }) => theme.border}; font-size: 12px; From 61a93119effe97dcf4faeb0d0dca3e0b039cb8ac Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Thu, 17 Aug 2023 16:04:20 +0700 Subject: [PATCH 09/58] feat: walletconnect modal theme (#2176) --- patches/@web3modal+core+2.4.7.patch | 12 ++++++++++++ src/assets/images/wc-bg.png | Bin 0 -> 24488 bytes .../svg/kyber/logo_kyberswap_with_padding.svg | 15 +++++++++++++++ src/constants/connectors/evm.ts | 7 +++++++ 4 files changed, 34 insertions(+) create mode 100644 patches/@web3modal+core+2.4.7.patch create mode 100644 src/assets/images/wc-bg.png create mode 100644 src/assets/svg/kyber/logo_kyberswap_with_padding.svg diff --git a/patches/@web3modal+core+2.4.7.patch b/patches/@web3modal+core+2.4.7.patch new file mode 100644 index 0000000000..35050b9ecd --- /dev/null +++ b/patches/@web3modal+core+2.4.7.patch @@ -0,0 +1,12 @@ +diff --git a/node_modules/@web3modal/core/dist/_types/src/types/controllerTypes.d.ts b/node_modules/@web3modal/core/dist/_types/src/types/controllerTypes.d.ts +index 57a1c75..c8d5687 100644 +--- a/node_modules/@web3modal/core/dist/_types/src/types/controllerTypes.d.ts ++++ b/node_modules/@web3modal/core/dist/_types/src/types/controllerTypes.d.ts +@@ -172,6 +172,7 @@ export interface ThemeCtrlState { + '--w3m-accent-fill-color'?: string; + '--w3m-background-color'?: string; + '--w3m-background-image-url'?: string; ++ '--w3m-color-bg-1'?: string; + '--w3m-logo-image-url'?: string; + '--w3m-background-border-radius'?: string; + '--w3m-container-border-radius'?: string; diff --git a/src/assets/images/wc-bg.png b/src/assets/images/wc-bg.png new file mode 100644 index 0000000000000000000000000000000000000000..4e1d19331632b8a8872956edfa6880a1894cc4ad GIT binary patch literal 24488 zcmV)3K+C_0P)NZG#p=nb81RFoPM{~D=ObpQk)@QpF<&=c4<`H^?&;zZWrXUauoH9ndl*ciEq+L z^_2EaFfsx$8&1w1xPS+qdj=O@d=dTS8&LBe zx;L9P$`F37_$D3IoBC(CUh7qgW81LT?Qx`{TqJvFQ)pKgWV)}?K8$_F^hD}kEtKhx zgPz4s4^eGDqaO0{8~RA~;aZTl>p~hG`V_t|y=cRZnho(fI2{`LS`X>$xnWbQGrM&g zYv@jGK;3r%KmA|-eVjaf2A})J?_j6DYs)*gaUY(%|2ga&?&0pU`9H)T{rWHC;KpstZ*K#; z`{?%$fWtX((4#lMgZ>zu(B^ljrm{NJJ6$qk!So+>m)D)pN33room!#B%|lSM21vF5 zTmqX`+Ps_`=y*PPel1{>0J2r~vO%*!%*#G1NEhWa(uXlvDNcFxRa!9&S249>WoIeV zHuIw@00EPshD8$aj)V}0W0AoTGZ1E^<{rv=6#(8;!-9e;+iO0Y@87zDi*H?Zbr=Rr zubm;`0L|=8s22xcDHP*D3HtPF zQEkN=eMRNvL_+z0X@PW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03)p*B!lG2lz_d}X9;jL+q?u(UU=@3O2F2qmp))kKF + + + + + + + + + + + + + + diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index 3619c5b665..06e875faf1 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -6,6 +6,8 @@ import { GnosisSafe } from '@web3-react/gnosis-safe' import { MetaMask } from '@web3-react/metamask' import { WalletConnect as WalletConnectV2 } from '@web3-react/walletconnect-v2' +import WC_BG from 'assets/images/wc-bg.png' +import Kyber from 'assets/svg/kyber/logo_kyberswap_with_padding.svg' import { WALLETCONNECT_PROJECT_ID } from 'constants/env' import { NETWORKS_INFO, @@ -48,6 +50,11 @@ export const [walletConnectV2, walletConnectV2Hooks] = initializeConnector Date: Thu, 17 Aug 2023 16:25:26 +0700 Subject: [PATCH 10/58] add log --- src/constants/connectors/utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index f5deb17df0..c131f78abd 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -4,8 +4,10 @@ import { ENV_LEVEL } from 'constants/env' import { ENV_TYPE } from 'constants/type' import checkForBraveBrowser from 'utils/checkForBraveBrowser' -ENV_LEVEL == ENV_TYPE.ADPR && +if (ENV_LEVEL == ENV_TYPE.ADPR) { + console.log('capturing Injected window.ethereum', { level: 'info', extra: { 'window.ethereum': window.ethereum } }) captureMessage('Injected window.ethereum', { level: 'info', extra: { 'window.ethereum': window.ethereum } }) +} export const getIsInjected = () => Boolean(window.ethereum) From e6554a20fbd972a99b1060e177a31c49463e08de Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Thu, 17 Aug 2023 16:39:42 +0700 Subject: [PATCH 11/58] timeout capture --- src/constants/connectors/utils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index c131f78abd..ecc2a1f73d 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -5,8 +5,10 @@ import { ENV_TYPE } from 'constants/type' import checkForBraveBrowser from 'utils/checkForBraveBrowser' if (ENV_LEVEL == ENV_TYPE.ADPR) { - console.log('capturing Injected window.ethereum', { level: 'info', extra: { 'window.ethereum': window.ethereum } }) - captureMessage('Injected window.ethereum', { level: 'info', extra: { 'window.ethereum': window.ethereum } }) + setTimeout(() => { + console.log('capturing Injected window.ethereum', { level: 'info', extra: { 'window.ethereum': window.ethereum } }) + captureMessage('Injected window.ethereum', { level: 'info', extra: { 'window.ethereum': window.ethereum } }) + }, 2000) } export const getIsInjected = () => Boolean(window.ethereum) From b728a8510e8a6f1050bff991ea429749409218ca Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Thu, 17 Aug 2023 16:53:13 +0700 Subject: [PATCH 12/58] add Phantom --- src/constants/connectors/evm.ts | 1 + src/constants/connectors/utils.ts | 8 +++++--- src/constants/wallets.ts | 13 ++++++++++++- src/react-app-env.d.ts | 1 + 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index 06e875faf1..d662269933 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -17,6 +17,7 @@ import { } from 'constants/networks' export const [injected, injectedHooks] = initializeConnector(actions => new MetaMask({ actions })) +export const [phantom, phantomHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [rabby, rabbyHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [krystal, krystalHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [metaMask, metamaskHooks] = initializeConnector(actions => new MetaMask({ actions })) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index ecc2a1f73d..263ac784aa 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -22,6 +22,7 @@ const allNonMetamaskFlags = [ 'isCoin98', 'isKrystal', 'isKrystalWallet', + 'isPhantom', 'isBlocto', ] as const export const getIsMetaMaskWallet = () => @@ -29,9 +30,9 @@ export const getIsMetaMaskWallet = () => export const getIsRabbyWallet = () => Boolean(window.ethereum?.isRabby) -export const getIsBloctoWallet = () => { - return Boolean(window.ethereum?.isBlocto) -} +export const getIsPhantomWallet = () => Boolean(window.ethereum?.isPhantom) + +export const getIsBloctoWallet = () => Boolean(window.ethereum?.isBlocto) export const getIsKrystalWallet = () => Boolean(window.ethereum?.isKrystalWallet || (window.ethereum?.isKrystal && !getIsTrustWallet())) @@ -57,6 +58,7 @@ export const getIsGenericInjector = () => !getIsRabbyWallet() && !getIsKrystalWallet() && !getIsBloctoWallet() && + !getIsPhantomWallet() && !getIsTrustWallet() // https://eips.ethereum.org/EIPS/eip-1193#provider-errors diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index 7014100e69..f17396dab8 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -35,6 +35,8 @@ import { krystalHooks, metaMask, metamaskHooks, + phantom, + phantomHooks, rabby, rabbyHooks, trustWallet, @@ -58,6 +60,7 @@ import { getIsGenericInjector, getIsKrystalWallet, getIsMetaMaskWallet, + getIsPhantomWallet, getIsRabbyWallet, getIsTrustWallet, } from 'constants/connectors/utils' @@ -78,6 +81,11 @@ const detectBlocto = (): WalletReadyState => { return WalletReadyState.NotDetected } +const detectPhantom = (): WalletReadyState => { + if (getIsPhantomWallet()) return WalletReadyState.Installed + return WalletReadyState.NotDetected +} + const detectSafe = (): WalletReadyState => { // todo namgold: WIP return WalletReadyState.Installed @@ -254,13 +262,16 @@ export const SUPPORTED_WALLETS = { readyStateSolana: () => solflareAdapter.readyState, } as SolanaWalletInfo, PHANTOM: { + connector: phantom, + hooks: phantomHooks, adapter: phantomAdapter, name: 'Phantom', icon: PHANTOM, iconLight: PHANTOM, installLink: phantomAdapter.url, + readyState: detectPhantom, readyStateSolana: detectPhantomWallet, - } as SolanaWalletInfo, + } as EVMWalletInfo & SolanaWalletInfo, SLOPE: { adapter: slopeAdapter, name: 'Slope Wallet', diff --git a/src/react-app-env.d.ts b/src/react-app-env.d.ts index 6d6bd5fa48..fb1fae39a2 100644 --- a/src/react-app-env.d.ts +++ b/src/react-app-env.d.ts @@ -10,6 +10,7 @@ interface Window { isMetaMask?: boolean isCoin98?: boolean isBraveWallet?: any + isPhantom?: any isCoinbaseWallet?: boolean isTrust?: boolean isTrustWallet?: boolean From c9accbdcca58fed1b9c7d521a9e3f3006e805f45 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Fri, 18 Aug 2023 14:37:04 +0700 Subject: [PATCH 13/58] detect phantom --- src/constants/connectors/utils.ts | 2 +- src/react-app-env.d.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index 263ac784aa..968c2140bf 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -30,7 +30,7 @@ export const getIsMetaMaskWallet = () => export const getIsRabbyWallet = () => Boolean(window.ethereum?.isRabby) -export const getIsPhantomWallet = () => Boolean(window.ethereum?.isPhantom) +export const getIsPhantomWallet = () => Boolean(window.ethereum?.isPhantom && window.phantom?.ethereum?.isPhantom) export const getIsBloctoWallet = () => Boolean(window.ethereum?.isBlocto) diff --git a/src/react-app-env.d.ts b/src/react-app-env.d.ts index fb1fae39a2..2faf628ad2 100644 --- a/src/react-app-env.d.ts +++ b/src/react-app-env.d.ts @@ -10,7 +10,7 @@ interface Window { isMetaMask?: boolean isCoin98?: boolean isBraveWallet?: any - isPhantom?: any + isPhantom?: boolean isCoinbaseWallet?: boolean isTrust?: boolean isTrustWallet?: boolean @@ -31,6 +31,9 @@ interface Window { providers?: any[] autoRefreshOnNetworkChange?: boolean } + phantom?: { + ethereum?: { isPhantom?: boolean } + } web3?: { currentProvider?: { isCoinbaseBrowser: boolean From 8e08d9a80834491d00bb3099f0401b544df651bc Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Fri, 18 Aug 2023 14:39:23 +0700 Subject: [PATCH 14/58] env prod --- .github/workflows/pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 4fc367b68b..4c33edc8ab 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -114,7 +114,7 @@ jobs: VITE_TAG: ${{ needs.prepare.outputs.image_tag }} CURRENT_BRANCH: ${{ needs.prepare.outputs.current_branch }} NODE_OPTIONS: '--max_old_space_size=4096' - run: yarn build-adpr + run: yarn build-prod # todo: revert - name: Docker build and push uses: docker/build-push-action@v2 From 49f4529700e8c9b65b7c5bc9adbb6eac84b24b1c Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Mon, 21 Aug 2023 16:54:51 +0700 Subject: [PATCH 15/58] debug safe --- src/constants/connectors/evm.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index d662269933..73b6aedc6a 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -1,4 +1,5 @@ import { ChainId } from '@kyberswap/ks-sdk-core' +import SafeAppsSDK from '@safe-global/safe-apps-sdk' import { OPTIONAL_EVENTS } from '@walletconnect/ethereum-provider' import { CoinbaseWallet } from '@web3-react/coinbase-wallet' import { initializeConnector } from '@web3-react/core' @@ -16,6 +17,25 @@ import { WALLET_CONNECT_SUPPORTED_CHAIN_IDS, } from 'constants/networks' +type Opts = { + allowedDomains?: RegExp[] + debug?: boolean +} + +const opts: Opts = { + allowedDomains: [/kyberengineering.io$/, /kyberswap.com$/], + debug: true, +} + +const appsSdk = new SafeAppsSDK(opts) +;(async () => { + const envInfo = await appsSdk.safe.getEnvironmentInfo() + console.log('safe envInfo', { envInfo }) + const info = await appsSdk.safe.getInfo() + console.log('safe info', { info }) + const requestAddressBook = await appsSdk.safe.requestAddressBook() + console.log('safe requestAddressBook', { requestAddressBook }) +})() export const [injected, injectedHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [phantom, phantomHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [rabby, rabbyHooks] = initializeConnector(actions => new MetaMask({ actions })) @@ -56,7 +76,7 @@ export const [walletConnectV2, walletConnectV2Hooks] = initializeConnector Date: Mon, 21 Aug 2023 21:12:59 +0700 Subject: [PATCH 16/58] update debug safe & rm phantom --- .../Header/web3/NetworkModal/Networks.tsx | 21 ++++++++++-------- src/constants/connectors/evm.ts | 22 +++++++++++++------ src/constants/connectors/utils.ts | 3 --- src/constants/wallets.ts | 13 +---------- src/react-app-env.d.ts | 3 --- src/utils/errorMessage.ts | 2 +- yarn.lock | 2 +- 7 files changed, 30 insertions(+), 36 deletions(-) diff --git a/src/components/Header/web3/NetworkModal/Networks.tsx b/src/components/Header/web3/NetworkModal/Networks.tsx index bf18992af7..2d3e95e050 100644 --- a/src/components/Header/web3/NetworkModal/Networks.tsx +++ b/src/components/Header/web3/NetworkModal/Networks.tsx @@ -123,13 +123,12 @@ const Networks = ({ customToggleModal?: () => void disabledMsg?: string }) => { - const { chainId: currentChainId, isWrongNetwork } = useActiveWeb3React() + const { chainId: currentChainId, isWrongNetwork, walletEVM, walletSolana } = useActiveWeb3React() const { changeNetwork } = useChangeNetwork() const qs = useParsedQueryString() const navigate = useNavigate() const isDarkMode = useIsDarkMode() const theme = useTheme() - const { walletEVM, walletSolana } = useActiveWeb3React() const onSelect = (chainId: ChainId) => { customToggleModal?.() if (customOnSelectNetwork) { @@ -160,20 +159,24 @@ const Networks = ({ return ( - {MAINNET_NETWORKS.map((key: ChainId, i: number) => { - const { iconDark, icon, name } = NETWORKS_INFO[key] - const disabled = !isAcceptedTerm || (activeChainIds ? !activeChainIds?.includes(key) : false) - const selected = selectedId === key && !isWrongNetwork + {MAINNET_NETWORKS.map((itemChainId: ChainId, i: number) => { + const { iconDark, icon, name } = NETWORKS_INFO[itemChainId] + const disabled = !isAcceptedTerm || (activeChainIds ? !activeChainIds?.includes(itemChainId) : false) + const selected = selectedId === itemChainId && !isWrongNetwork const imgSrc = (isDarkMode ? iconDark : icon) || icon const walletKey = - key === ChainId.SOLANA ? walletSolana.walletKey : walletEVM.chainId === key ? walletEVM.walletKey : null + itemChainId === ChainId.SOLANA + ? walletSolana.walletKey + : walletEVM.chainId === itemChainId + ? walletEVM.walletKey + : null return ( - + !selected && onSelect(key)} + onClick={() => !selected && onSelect(itemChainId)} data-testid="network-button" disabled={disabled} > diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index 73b6aedc6a..c02cc9478c 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -29,15 +29,23 @@ const opts: Opts = { const appsSdk = new SafeAppsSDK(opts) ;(async () => { - const envInfo = await appsSdk.safe.getEnvironmentInfo() - console.log('safe envInfo', { envInfo }) - const info = await appsSdk.safe.getInfo() - console.log('safe info', { info }) - const requestAddressBook = await appsSdk.safe.requestAddressBook() - console.log('safe requestAddressBook', { requestAddressBook }) + const getSafeInfo = async (fn: 'getEnvironmentInfo' | 'getInfo' | 'requestAddressBook') => { + try { + console.log('safe ' + fn + ' start') + const promise = appsSdk.safe[fn]() + console.log('safe ' + fn + ' promise', { promise }) + const result = await promise + console.log('safe ' + fn + ' result', { result }) + } catch (error) { + console.log('safe' + fn + ' error', { error }) + } + } + getSafeInfo('getEnvironmentInfo') + getSafeInfo('getInfo') + getSafeInfo('requestAddressBook') })() + export const [injected, injectedHooks] = initializeConnector(actions => new MetaMask({ actions })) -export const [phantom, phantomHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [rabby, rabbyHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [krystal, krystalHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [metaMask, metamaskHooks] = initializeConnector(actions => new MetaMask({ actions })) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index 968c2140bf..48aa5edef8 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -30,8 +30,6 @@ export const getIsMetaMaskWallet = () => export const getIsRabbyWallet = () => Boolean(window.ethereum?.isRabby) -export const getIsPhantomWallet = () => Boolean(window.ethereum?.isPhantom && window.phantom?.ethereum?.isPhantom) - export const getIsBloctoWallet = () => Boolean(window.ethereum?.isBlocto) export const getIsKrystalWallet = () => @@ -58,7 +56,6 @@ export const getIsGenericInjector = () => !getIsRabbyWallet() && !getIsKrystalWallet() && !getIsBloctoWallet() && - !getIsPhantomWallet() && !getIsTrustWallet() // https://eips.ethereum.org/EIPS/eip-1193#provider-errors diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index f17396dab8..7014100e69 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -35,8 +35,6 @@ import { krystalHooks, metaMask, metamaskHooks, - phantom, - phantomHooks, rabby, rabbyHooks, trustWallet, @@ -60,7 +58,6 @@ import { getIsGenericInjector, getIsKrystalWallet, getIsMetaMaskWallet, - getIsPhantomWallet, getIsRabbyWallet, getIsTrustWallet, } from 'constants/connectors/utils' @@ -81,11 +78,6 @@ const detectBlocto = (): WalletReadyState => { return WalletReadyState.NotDetected } -const detectPhantom = (): WalletReadyState => { - if (getIsPhantomWallet()) return WalletReadyState.Installed - return WalletReadyState.NotDetected -} - const detectSafe = (): WalletReadyState => { // todo namgold: WIP return WalletReadyState.Installed @@ -262,16 +254,13 @@ export const SUPPORTED_WALLETS = { readyStateSolana: () => solflareAdapter.readyState, } as SolanaWalletInfo, PHANTOM: { - connector: phantom, - hooks: phantomHooks, adapter: phantomAdapter, name: 'Phantom', icon: PHANTOM, iconLight: PHANTOM, installLink: phantomAdapter.url, - readyState: detectPhantom, readyStateSolana: detectPhantomWallet, - } as EVMWalletInfo & SolanaWalletInfo, + } as SolanaWalletInfo, SLOPE: { adapter: slopeAdapter, name: 'Slope Wallet', diff --git a/src/react-app-env.d.ts b/src/react-app-env.d.ts index 2faf628ad2..9b5b595417 100644 --- a/src/react-app-env.d.ts +++ b/src/react-app-env.d.ts @@ -31,9 +31,6 @@ interface Window { providers?: any[] autoRefreshOnNetworkChange?: boolean } - phantom?: { - ethereum?: { isPhantom?: boolean } - } web3?: { currentProvider?: { isCoinbaseBrowser: boolean diff --git a/src/utils/errorMessage.ts b/src/utils/errorMessage.ts index 99246bcdd1..655cc736ed 100644 --- a/src/utils/errorMessage.ts +++ b/src/utils/errorMessage.ts @@ -8,7 +8,7 @@ function capitalizeFirstLetter(string: string) { function parseKnownPattern(text: string): string | undefined { const error = text?.toLowerCase?.() || '' - console.info('parseError:', { text, error }) + if (!error || error.includes('router: expired')) return 'An error occurred. Refresh the page and try again ' if ( diff --git a/yarn.lock b/yarn.lock index 600d495c34..05dba94fb7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16843,7 +16843,7 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== -typescript@^4.6.2, typescript@4.8.4: +typescript@4.8.4, typescript@^4.6.2: version "4.8.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== From c7c2016c87016a24bca7d869435183da6e806b74 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Mon, 21 Aug 2023 21:41:28 +0700 Subject: [PATCH 17/58] disable whitelist domain --- src/constants/connectors/evm.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index c02cc9478c..1dc15e4a04 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -23,7 +23,7 @@ type Opts = { } const opts: Opts = { - allowedDomains: [/kyberengineering.io$/, /kyberswap.com$/], + // allowedDomains: [/kyberengineering.io$/, /kyberswap.com$/], debug: true, } From d0d2ac3669520e65cca9974c19c17fbfd3e2635f Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Mon, 21 Aug 2023 23:55:18 +0700 Subject: [PATCH 18/58] detect safe --- src/constants/connectors/evm.ts | 29 ----------------------------- src/constants/wallets.ts | 14 ++++++++++---- 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index 1dc15e4a04..0c05df5aeb 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -1,5 +1,4 @@ import { ChainId } from '@kyberswap/ks-sdk-core' -import SafeAppsSDK from '@safe-global/safe-apps-sdk' import { OPTIONAL_EVENTS } from '@walletconnect/ethereum-provider' import { CoinbaseWallet } from '@web3-react/coinbase-wallet' import { initializeConnector } from '@web3-react/core' @@ -17,34 +16,6 @@ import { WALLET_CONNECT_SUPPORTED_CHAIN_IDS, } from 'constants/networks' -type Opts = { - allowedDomains?: RegExp[] - debug?: boolean -} - -const opts: Opts = { - // allowedDomains: [/kyberengineering.io$/, /kyberswap.com$/], - debug: true, -} - -const appsSdk = new SafeAppsSDK(opts) -;(async () => { - const getSafeInfo = async (fn: 'getEnvironmentInfo' | 'getInfo' | 'requestAddressBook') => { - try { - console.log('safe ' + fn + ' start') - const promise = appsSdk.safe[fn]() - console.log('safe ' + fn + ' promise', { promise }) - const result = await promise - console.log('safe ' + fn + ' result', { result }) - } catch (error) { - console.log('safe' + fn + ' error', { error }) - } - } - getSafeInfo('getEnvironmentInfo') - getSafeInfo('getInfo') - getSafeInfo('requestAddressBook') -})() - export const [injected, injectedHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [rabby, rabbyHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [krystal, krystalHooks] = initializeConnector(actions => new MetaMask({ actions })) diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index 7014100e69..9eeaaffa4c 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -1,3 +1,4 @@ +import SafeAppsSDK from '@safe-global/safe-apps-sdk' import { BaseMessageSignerWalletAdapter, WalletReadyState } from '@solana/wallet-adapter-base' import { Web3ReactHooks } from '@web3-react/core' import { Connector } from '@web3-react/types' @@ -78,11 +79,16 @@ const detectBlocto = (): WalletReadyState => { return WalletReadyState.NotDetected } +let isSafe = false +const appsSdk = new SafeAppsSDK({}) +;(async () => { + try { + const result = await appsSdk.safe.getEnvironmentInfo() + if (result) isSafe = true + } catch (error) {} +})() const detectSafe = (): WalletReadyState => { - // todo namgold: WIP - return WalletReadyState.Installed - // if (getIsGenericInjector()) return WalletReadyState.Installed - // return WalletReadyState.NotDetected + return isSafe ? WalletReadyState.Installed : WalletReadyState.NotDetected } const detectRabby = (): WalletReadyState => { From 8b8b6e13568c2f6a1fd2a9bb5be7ee441bfe3116 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 22 Aug 2023 00:15:59 +0700 Subject: [PATCH 19/58] add comment --- src/hooks/web3/useChangeNetwork.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/web3/useChangeNetwork.ts b/src/hooks/web3/useChangeNetwork.ts index 3039ecb17f..67ed9cf694 100644 --- a/src/hooks/web3/useChangeNetwork.ts +++ b/src/hooks/web3/useChangeNetwork.ts @@ -36,7 +36,7 @@ export function useChangeNetwork() { const successCallback = useCallback( async (desiredChainId: ChainId, waitUtilUpdatedChainId: boolean, customSuccessCallback?: () => void) => { const initialChainId = latestChainId - /** although change chain successfully, but it take 1-2s for chainId has a new value + /** although change chain successfully, but it take 1-2s for chainId has a new value | update: or never change chain but still return success, e.g: safe, phantom evm * => this option will wait util chainId has actually update to new value to prevent some edge case */ while (waitUtilUpdatedChainId) { @@ -163,7 +163,7 @@ export function useChangeNetwork() { desiredChainId: ChainId, customSuccessCallback?: () => void, customFailureCallback?: (error: Error) => void, - waitUtilUpdatedChainId = false, + waitUtilUpdatedChainId = false, //todo: force all to true isAddNetworkIfPossible = true, ) => { const wrappedSuccessCallback = () => From f9d387c4c2830ea20ab3d52c249aaaf6da6ce7fa Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 22 Aug 2023 00:19:11 +0700 Subject: [PATCH 20/58] add debug --- src/constants/connectors/evm.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index 0c05df5aeb..2079b24fc8 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -1,4 +1,5 @@ import { ChainId } from '@kyberswap/ks-sdk-core' +import SafeAppsSDK from '@safe-global/safe-apps-sdk' import { OPTIONAL_EVENTS } from '@walletconnect/ethereum-provider' import { CoinbaseWallet } from '@web3-react/coinbase-wallet' import { initializeConnector } from '@web3-react/core' @@ -16,6 +17,35 @@ import { WALLET_CONNECT_SUPPORTED_CHAIN_IDS, } from 'constants/networks' +type Opts = { + allowedDomains?: RegExp[] + debug?: boolean +} + +const opts: Opts = { + // allowedDomains: [/kyberengineering.io$/, /kyberswap.com$/], + debug: true, +} + +const appsSdk = new SafeAppsSDK(opts) +;(async () => { + const getSafeInfo = async (fn: 'getEnvironmentInfo' | 'getInfo' | 'requestAddressBook' | 'getChainInfo') => { + try { + console.log('safe ' + fn + ' start') + const promise = appsSdk.safe[fn]() + console.log('safe ' + fn + ' promise', { promise }) + const result = await promise + console.log('safe ' + fn + ' result', { result }) + } catch (error) { + console.log('safe' + fn + ' error', { error }) + } + } + getSafeInfo('getEnvironmentInfo') + getSafeInfo('getInfo') + getSafeInfo('requestAddressBook') + getSafeInfo('getChainInfo') +})() + export const [injected, injectedHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [rabby, rabbyHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [krystal, krystalHooks] = initializeConnector(actions => new MetaMask({ actions })) From 5832d08ab877f6405c82ad4c50e125335ef70ea8 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 22 Aug 2023 00:19:21 +0700 Subject: [PATCH 21/58] clean --- src/components/SwapForm/SwapActionButton/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SwapForm/SwapActionButton/index.tsx b/src/components/SwapForm/SwapActionButton/index.tsx index 4a69dfc999..ea3a45c67f 100644 --- a/src/components/SwapForm/SwapActionButton/index.tsx +++ b/src/components/SwapForm/SwapActionButton/index.tsx @@ -136,7 +136,7 @@ const SwapActionButton: React.FC = ({ const toggleApprovalModal = useToggleModal(ApplicationModal.SWAP_APPROVAL) const handleApproveClick = () => { - if (walletKey && ['METAMASK', 'TRUST_WALLET'].includes(walletKey?.toString())) { + if (walletKey && ['METAMASK', 'TRUST_WALLET'].includes(walletKey)) { approveCallback() } else { toggleApprovalModal() From 9daa90531de25bf3ebd123e7097c9bdde277b8b2 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 22 Aug 2023 00:20:04 +0700 Subject: [PATCH 22/58] gnosis chains --- src/hooks/web3/useWalletSupportedChains.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hooks/web3/useWalletSupportedChains.ts b/src/hooks/web3/useWalletSupportedChains.ts index 6b5429c39f..b5b7afec26 100644 --- a/src/hooks/web3/useWalletSupportedChains.ts +++ b/src/hooks/web3/useWalletSupportedChains.ts @@ -1,7 +1,7 @@ import { ChainId } from '@kyberswap/ks-sdk-core' import { WalletConnect as WalletConnectV2 } from '@web3-react/walletconnect-v2' -import { walletConnectV2 } from 'constants/connectors/evm' +import { gnosisSafe, walletConnectV2 } from 'constants/connectors/evm' import { SUPPORTED_NETWORKS } from 'constants/networks' import { useWeb3React } from 'hooks' @@ -16,13 +16,15 @@ function getChainsFromEIP155Accounts(accounts?: string[]): ChainId[] { } export function useWalletSupportedChains() { - const { connector } = useWeb3React() + const { connector, chainId } = useWeb3React() switch (connector) { case walletConnectV2: return [ ...getChainsFromEIP155Accounts((connector as WalletConnectV2).provider?.session?.namespaces?.eip155?.accounts), ] + case gnosisSafe: + return [chainId] default: return SUPPORTED_NETWORKS } From d6635039035246a484bd7864fa5589dbe992a6fc Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 22 Aug 2023 00:26:26 +0700 Subject: [PATCH 23/58] lint --- src/hooks/web3/useWalletSupportedChains.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/web3/useWalletSupportedChains.ts b/src/hooks/web3/useWalletSupportedChains.ts index b5b7afec26..843b798364 100644 --- a/src/hooks/web3/useWalletSupportedChains.ts +++ b/src/hooks/web3/useWalletSupportedChains.ts @@ -15,7 +15,7 @@ function getChainsFromEIP155Accounts(accounts?: string[]): ChainId[] { .filter(x => x !== undefined) as ChainId[] } -export function useWalletSupportedChains() { +export function useWalletSupportedChains(): ChainId[] { const { connector, chainId } = useWeb3React() switch (connector) { @@ -24,7 +24,7 @@ export function useWalletSupportedChains() { ...getChainsFromEIP155Accounts((connector as WalletConnectV2).provider?.session?.namespaces?.eip155?.accounts), ] case gnosisSafe: - return [chainId] + return chainId ? [chainId] : SUPPORTED_NETWORKS default: return SUPPORTED_NETWORKS } From b389de19c0ebbabb5b7142e267d85af6b8ede28c Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 22 Aug 2023 13:15:08 +0700 Subject: [PATCH 24/58] rm debug --- src/constants/connectors/evm.ts | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index 2079b24fc8..0c05df5aeb 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -1,5 +1,4 @@ import { ChainId } from '@kyberswap/ks-sdk-core' -import SafeAppsSDK from '@safe-global/safe-apps-sdk' import { OPTIONAL_EVENTS } from '@walletconnect/ethereum-provider' import { CoinbaseWallet } from '@web3-react/coinbase-wallet' import { initializeConnector } from '@web3-react/core' @@ -17,35 +16,6 @@ import { WALLET_CONNECT_SUPPORTED_CHAIN_IDS, } from 'constants/networks' -type Opts = { - allowedDomains?: RegExp[] - debug?: boolean -} - -const opts: Opts = { - // allowedDomains: [/kyberengineering.io$/, /kyberswap.com$/], - debug: true, -} - -const appsSdk = new SafeAppsSDK(opts) -;(async () => { - const getSafeInfo = async (fn: 'getEnvironmentInfo' | 'getInfo' | 'requestAddressBook' | 'getChainInfo') => { - try { - console.log('safe ' + fn + ' start') - const promise = appsSdk.safe[fn]() - console.log('safe ' + fn + ' promise', { promise }) - const result = await promise - console.log('safe ' + fn + ' result', { result }) - } catch (error) { - console.log('safe' + fn + ' error', { error }) - } - } - getSafeInfo('getEnvironmentInfo') - getSafeInfo('getInfo') - getSafeInfo('requestAddressBook') - getSafeInfo('getChainInfo') -})() - export const [injected, injectedHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [rabby, rabbyHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [krystal, krystalHooks] = initializeConnector(actions => new MetaMask({ actions })) From 8c50abe3e1ec64d333947faef3c2c6668a21491e Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 22 Aug 2023 14:06:09 +0700 Subject: [PATCH 25/58] fix name --- src/components/SwapForm/SwapActionButton/index.tsx | 6 +++--- src/constants/wallets.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/SwapForm/SwapActionButton/index.tsx b/src/components/SwapForm/SwapActionButton/index.tsx index ea3a45c67f..bd418a4a99 100644 --- a/src/components/SwapForm/SwapActionButton/index.tsx +++ b/src/components/SwapForm/SwapActionButton/index.tsx @@ -136,10 +136,10 @@ const SwapActionButton: React.FC = ({ const toggleApprovalModal = useToggleModal(ApplicationModal.SWAP_APPROVAL) const handleApproveClick = () => { - if (walletKey && ['METAMASK', 'TRUST_WALLET'].includes(walletKey)) { - approveCallback() - } else { + if (['COIN98', 'BRAVE', 'COINBASE'].includes(walletKey)) { toggleApprovalModal() + } else { + approveCallback() } } diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index 9eeaaffa4c..b2224ab419 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -190,7 +190,7 @@ export const SUPPORTED_WALLETS = { installLink: 'https://safe.global/wallet', readyState: detectSafe, } as EVMWalletInfo, - RABBBY: { + RABBY: { connector: rabby, hooks: rabbyHooks, name: 'Rabby', @@ -298,7 +298,7 @@ export const INJECTED_KEYS = [ 'COINBASE', 'TRUST_WALLET', 'KRYSTAL', - 'RABBBY', + 'RABBY', 'INJECTED', ] as const export type INJECTED_KEY = typeof INJECTED_KEYS[number] From 67d52543b3610fda2b3db796438eed4254cca7d4 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Wed, 23 Aug 2023 14:50:43 +0700 Subject: [PATCH 26/58] blocto --- package.json | 11 +++--- .../SwapForm/SlippageSettingGroup.tsx | 8 ++--- src/constants/connectors/evm.ts | 10 +++++- src/constants/connectors/utils.ts | 4 +-- src/constants/wallets.ts | 20 +++++++++-- src/hooks/web3/useChangeNetwork.ts | 2 +- yarn.lock | 36 ++++++++++++++----- 7 files changed, 66 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 5084fd80da..d975265007 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "dependencies": { "@0xsquid/sdk": "^1.4.1", "@apollo/client": "^3.7.1", + "@blocto/web3-react-connector": "^1.0.0", "@datadog/browser-rum": "^4.23.3", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@kybernetwork/oauth2": "1.0.0", @@ -69,11 +70,11 @@ "@solana/wallet-adapter-wallets": "^0.19.5", "@solana/web3.js": "^1.66.2", "@use-gesture/react": "^10.2.27", - "@web3-react/coinbase-wallet": "^8.2.0", - "@web3-react/core": "^8.2.0", - "@web3-react/gnosis-safe": "^8.2.0", + "@web3-react/coinbase-wallet": "8.2.0", + "@web3-react/core": "8.2.0", + "@web3-react/gnosis-safe": "8.2.0", "@web3-react/metamask": "^8.2.1", - "@web3-react/types": "^8.2.0", + "@web3-react/types": "8.2.0", "@web3-react/walletconnect-v2": "^8.3.3", "@web3-react/walletlink-connector": "^6.2.14", "aos": "^2.3.4", @@ -207,4 +208,4 @@ "@lingui/core": "3.14.0", "@lingui/conf": "3.16.0" } -} \ No newline at end of file +} diff --git a/src/components/SwapForm/SlippageSettingGroup.tsx b/src/components/SwapForm/SlippageSettingGroup.tsx index 978ee0f1dd..bccf93cbd8 100644 --- a/src/components/SwapForm/SlippageSettingGroup.tsx +++ b/src/components/SwapForm/SlippageSettingGroup.tsx @@ -64,11 +64,9 @@ export default function SlippageSettingGroup({ > - {upToXXSmall ? null : ( - - Add MEV Protection - - )} + + {upToXXSmall ? MEV Protection : Add MEV Protection} + ) : null diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index 0c05df5aeb..7577726ff7 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -1,3 +1,4 @@ +import { BloctoConnector } from '@blocto/web3-react-connector' import { ChainId } from '@kyberswap/ks-sdk-core' import { OPTIONAL_EVENTS } from '@walletconnect/ethereum-provider' import { CoinbaseWallet } from '@web3-react/coinbase-wallet' @@ -24,7 +25,14 @@ export const [gnosisSafe, gnosisSafeHooks] = initializeConnector(act export const [coin98, coin98Hooks] = initializeConnector(actions => new MetaMask({ actions })) export const [brave, braveHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [trustWallet, trustWalletHooks] = initializeConnector(actions => new MetaMask({ actions })) -export const [blocto, bloctoHooks] = initializeConnector(actions => new MetaMask({ actions })) +export const [bloctoInjected, bloctoInjectedHooks] = initializeConnector(actions => new MetaMask({ actions })) +export const [blocto, bloctoHooks] = initializeConnector( + actions => + new BloctoConnector({ + actions, + options: { chainId: ChainId.ARBITRUM, rpc: NETWORKS_INFO[ChainId.ARBITRUM].defaultRpcUrl }, + }), +) const darkmode = Boolean(window.matchMedia('(prefers-color-scheme: dark)')) export const [walletConnectV2, walletConnectV2Hooks] = initializeConnector( diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index 48aa5edef8..26fd00f947 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -33,12 +33,12 @@ export const getIsRabbyWallet = () => Boolean(window.ethereum?.isRabby) export const getIsBloctoWallet = () => Boolean(window.ethereum?.isBlocto) export const getIsKrystalWallet = () => - Boolean(window.ethereum?.isKrystalWallet || (window.ethereum?.isKrystal && !getIsTrustWallet())) + Boolean((window.ethereum?.isKrystalWallet || window.ethereum?.isKrystal) && !getIsTrustWallet()) export const getIsCoinbaseWallet = () => Boolean( (window.ethereum?.isCoinbaseWallet || window.ethereum?.providers?.some(p => p?.isCoinbaseWallet)) && - !window.ethereum?.isKrystalWallet, + !getIsTrustWallet(), ) export const getIsBraveWallet = () => Boolean(checkForBraveBrowser() && window.ethereum?.isBraveWallet) diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index b2224ab419..32cb728e4b 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -22,6 +22,8 @@ import INJECTED_LIGHT_ICON from 'assets/wallets/browser-wallet-light.svg' import { blocto, bloctoHooks, + bloctoInjected, + bloctoInjectedHooks, brave, braveHooks, coin98, @@ -74,9 +76,14 @@ const detectMetamask = (): WalletReadyState => { return WalletReadyState.NotDetected } -const detectBlocto = (): WalletReadyState => { +const detectBloctoInjected = (): WalletReadyState => { if (getIsBloctoWallet()) return WalletReadyState.Installed - return WalletReadyState.NotDetected + return WalletReadyState.Unsupported +} + +const detectBlocto = (): WalletReadyState => { + if (getIsBloctoWallet()) return WalletReadyState.Unsupported + return WalletReadyState.Installed } let isSafe = false @@ -181,6 +188,15 @@ export const SUPPORTED_WALLETS = { installLink: 'https://www.blocto.io/download', readyState: detectBlocto, } as EVMWalletInfo, + BLOCTO_INJECTED: { + connector: bloctoInjected, + hooks: bloctoInjectedHooks, + name: 'Blocto', + icon: BLOCTO, + iconLight: BLOCTO, + installLink: 'https://www.blocto.io/download', + readyState: detectBloctoInjected, + } as EVMWalletInfo, SAFE: { connector: gnosisSafe, hooks: gnosisSafeHooks, diff --git a/src/hooks/web3/useChangeNetwork.ts b/src/hooks/web3/useChangeNetwork.ts index 67ed9cf694..1c87e7c43f 100644 --- a/src/hooks/web3/useChangeNetwork.ts +++ b/src/hooks/web3/useChangeNetwork.ts @@ -4,7 +4,7 @@ import { captureException } from '@sentry/react' import { useCallback } from 'react' import { NotificationType } from 'components/Announcement/type' -import { walletConnectV2 } from 'constants/connectors/evm' +import { blocto, walletConnectV2 } from 'constants/connectors/evm' import { didUserReject } from 'constants/connectors/utils' import { NETWORKS_INFO, isEVM, isSolana } from 'constants/networks' import { useActiveWeb3React, useWeb3React } from 'hooks' diff --git a/yarn.lock b/yarn.lock index 05dba94fb7..6d1ca82b1c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -517,6 +517,24 @@ eip1193-provider "^1.0.1" js-sha3 "^0.8.0" +"@blocto/sdk@^0.5.5": + version "0.5.5" + resolved "https://registry.yarnpkg.com/@blocto/sdk/-/sdk-0.5.5.tgz#807b9eaeee924c3eb0c5517c6b32891025f1f6b0" + integrity sha512-u7bbAYmYDCf0QWvXleVOTeGFRbo8evT3uacsLJ6dv01HspmLDKZWjFyu7i3ARebJTpenHvwM78XHV7KTvBqTRg== + dependencies: + bs58 "^5.0.0" + buffer "^6.0.3" + eip1193-provider "^1.0.1" + js-sha3 "^0.8.0" + +"@blocto/web3-react-connector@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@blocto/web3-react-connector/-/web3-react-connector-1.0.0.tgz#22c62918c260fe2df5a8fbe1f79deef685998689" + integrity sha512-p3lo7K4Y86P50d6LxbxbSiN4ungg1wNmU85F0OEYDUK8NW8l/opG2EeeodFYSOo+MB7BgiaGMN9m+vPzrn+4pQ== + dependencies: + "@blocto/sdk" "^0.5.5" + "@web3-react/types" "^8.1.2-beta.0" + "@censo-custody/solana-wallet-adapter@^0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@censo-custody/solana-wallet-adapter/-/solana-wallet-adapter-0.1.0.tgz#064adae9f216dc4b726c1cc45b6b24cf0c734f07" @@ -5636,14 +5654,14 @@ dependencies: "@web3-react/types" "^6.0.7" -"@web3-react/coinbase-wallet@^8.2.0": +"@web3-react/coinbase-wallet@8.2.0": version "8.2.0" resolved "https://registry.yarnpkg.com/@web3-react/coinbase-wallet/-/coinbase-wallet-8.2.0.tgz#038bb9e915834046320621aa49db5ba79130e488" integrity sha512-SFPrsRbyw1gECyKJmE/TAB3iMhHAqh9DTa8X2FKPMgPyNPVPcha4+G0SuWy55rysh0MO6TJbj9pofX3HvXaYpw== dependencies: "@web3-react/types" "^8.2.0" -"@web3-react/core@^8.2.0": +"@web3-react/core@8.2.0": version "8.2.0" resolved "https://registry.yarnpkg.com/@web3-react/core/-/core-8.2.0.tgz#95fb615bb283be520e6f61b5e48cfb0047943808" integrity sha512-r7dmK2E8Jrpvm/DF93hGMB+8lECHSI3Oo0NrHbhxkisK6in6rdgAXeYFhZtM48LBAm9py6fQvLzjCM6Qx9q0oQ== @@ -5654,7 +5672,7 @@ optionalDependencies: "@ethersproject/providers" "^5" -"@web3-react/gnosis-safe@^8.2.0": +"@web3-react/gnosis-safe@8.2.0": version "8.2.0" resolved "https://registry.yarnpkg.com/@web3-react/gnosis-safe/-/gnosis-safe-8.2.0.tgz#003e7f5b335751b6699152be301256c989631b51" integrity sha512-52Z1uHcnIVsyfEPjj2C+cDF21wNCMrCT6kr1JTFXkvLMfZ3LvfWOX1j+C9lOBGUyZRBe5ZtkjiLiogGqRqZYmA== @@ -5680,18 +5698,18 @@ "@web3-react/types" "^8.2.0" zustand "^4.3.5" -"@web3-react/types@^6.0.7": - version "6.0.7" - resolved "https://registry.yarnpkg.com/@web3-react/types/-/types-6.0.7.tgz#34a6204224467eedc6123abaf55fbb6baeb2809f" - integrity sha512-ofGmfDhxmNT1/P/MgVa8IKSkCStFiyvXe+U5tyZurKdrtTDFU+wJ/LxClPDtFerWpczNFPUSrKcuhfPX1sI6+A== - -"@web3-react/types@^8.2.0": +"@web3-react/types@8.2.0", "@web3-react/types@^8.1.2-beta.0", "@web3-react/types@^8.2.0": version "8.2.0" resolved "https://registry.yarnpkg.com/@web3-react/types/-/types-8.2.0.tgz#195464ebb94cb417e6dc3c16951573f9b6b3832a" integrity sha512-TBYTFlqJZaEpVbuAAKRJFX5PZc3lI1TqDZzY94zwCrCh4GBepwwK7+PxmRAppMFuNa5x0vFX/ghLEC44e6TCFg== dependencies: zustand "^4.3.5" +"@web3-react/types@^6.0.7": + version "6.0.7" + resolved "https://registry.yarnpkg.com/@web3-react/types/-/types-6.0.7.tgz#34a6204224467eedc6123abaf55fbb6baeb2809f" + integrity sha512-ofGmfDhxmNT1/P/MgVa8IKSkCStFiyvXe+U5tyZurKdrtTDFU+wJ/LxClPDtFerWpczNFPUSrKcuhfPX1sI6+A== + "@web3-react/walletconnect-v2@^8.3.3": version "8.3.3" resolved "https://registry.yarnpkg.com/@web3-react/walletconnect-v2/-/walletconnect-v2-8.3.3.tgz#c5c7be5f7717e273d8b113351b16f44e424f542f" From f3b5f524ce2468de28d33f32b9dfe461f5ce9b95 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Wed, 23 Aug 2023 15:06:31 +0700 Subject: [PATCH 27/58] lint --- src/hooks/web3/useChangeNetwork.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/web3/useChangeNetwork.ts b/src/hooks/web3/useChangeNetwork.ts index 1c87e7c43f..67ed9cf694 100644 --- a/src/hooks/web3/useChangeNetwork.ts +++ b/src/hooks/web3/useChangeNetwork.ts @@ -4,7 +4,7 @@ import { captureException } from '@sentry/react' import { useCallback } from 'react' import { NotificationType } from 'components/Announcement/type' -import { blocto, walletConnectV2 } from 'constants/connectors/evm' +import { walletConnectV2 } from 'constants/connectors/evm' import { didUserReject } from 'constants/connectors/utils' import { NETWORKS_INFO, isEVM, isSolana } from 'constants/networks' import { useActiveWeb3React, useWeb3React } from 'hooks' From 8ee835dad475fe22a840449ae9bd8968f09ace22 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Wed, 23 Aug 2023 15:29:18 +0700 Subject: [PATCH 28/58] blocto injected --- src/constants/wallets.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index 32cb728e4b..0127d95696 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -82,7 +82,6 @@ const detectBloctoInjected = (): WalletReadyState => { } const detectBlocto = (): WalletReadyState => { - if (getIsBloctoWallet()) return WalletReadyState.Unsupported return WalletReadyState.Installed } @@ -191,7 +190,7 @@ export const SUPPORTED_WALLETS = { BLOCTO_INJECTED: { connector: bloctoInjected, hooks: bloctoInjectedHooks, - name: 'Blocto', + name: 'Blocto Injected', icon: BLOCTO, iconLight: BLOCTO, installLink: 'https://www.blocto.io/download', From 37ba09c0c501f9a941227e17d02af7efa2bb3d2e Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Wed, 23 Aug 2023 16:34:33 +0700 Subject: [PATCH 29/58] focus lock blocto --- src/components/Header/web3/WalletModal/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Header/web3/WalletModal/index.tsx b/src/components/Header/web3/WalletModal/index.tsx index f7045d15b5..b2597d2a5e 100644 --- a/src/components/Header/web3/WalletModal/index.tsx +++ b/src/components/Header/web3/WalletModal/index.tsx @@ -437,8 +437,8 @@ export default function WalletModal() { minHeight={false} maxHeight={90} maxWidth={600} - bypassScrollLock={walletView === WALLET_VIEWS.PENDING && pendingWalletKey === 'WALLET_CONNECT'} - bypassFocusLock={walletView === WALLET_VIEWS.PENDING && pendingWalletKey === 'WALLET_CONNECT'} + bypassScrollLock={walletView === WALLET_VIEWS.PENDING && ['WALLET_CONNECT'].includes(pendingWalletKey)} + bypassFocusLock={walletView === WALLET_VIEWS.PENDING && ['WALLET_CONNECT', 'BLOCTO'].includes(pendingWalletKey)} > {getModalContent()} From b02f317e5dc8ceb9a1087468d37c7a8ae6f9e6d1 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Wed, 23 Aug 2023 16:37:59 +0700 Subject: [PATCH 30/58] detect blocto --- src/hooks/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hooks/index.ts b/src/hooks/index.ts index e9fe91cf0d..059a00291a 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -7,7 +7,7 @@ import { useEffect, useMemo } from 'react' import { useSelector } from 'react-redux' import { useSearchParams } from 'react-router-dom' -import { gnosisSafe, metaMask, walletConnectV2 } from 'constants/connectors/evm' +import { blocto, gnosisSafe, metaMask, walletConnectV2 } from 'constants/connectors/evm' import { MOCK_ACCOUNT_EVM, MOCK_ACCOUNT_SOLANA } from 'constants/env' import { NETWORKS_INFO, isSupportedChainId } from 'constants/networks' import { NetworkInfo } from 'constants/networks/type' @@ -63,6 +63,9 @@ export function useActiveWeb3React(): { if (connectedConnectorEVM === gnosisSafe) { return 'SAFE' } + if (connectedConnectorEVM === blocto) { + return 'BLOCTO' + } const detectedWallet = detectInjectedType() return ( From 15cee5af57a6d841d685dfdae9ee4a755bddea24 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Wed, 23 Aug 2023 17:13:45 +0700 Subject: [PATCH 31/58] clean unused package --- package.json | 3 +- yarn.lock | 373 +++------------------------------------------------ 2 files changed, 18 insertions(+), 358 deletions(-) diff --git a/package.json b/package.json index ac4e6e711b..6808ee1639 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,6 @@ "@web3-react/metamask": "^8.2.1", "@web3-react/types": "8.2.0", "@web3-react/walletconnect-v2": "^8.3.3", - "@web3-react/walletlink-connector": "^6.2.14", "aos": "^2.3.4", "axios": "1.2.1", "base64-js": "^1.5.1", @@ -206,4 +205,4 @@ "@lingui/core": "3.14.0", "@lingui/conf": "3.16.0" } -} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 87c491551d..2bd648e25d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -63,7 +63,7 @@ dependencies: "@babel/highlight" "^7.18.6" -"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.22.0": +"@babel/compat-data@^7.22.0": version "7.22.3" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.3.tgz#cd502a6a0b6e37d7ad72ce7e71a7160a3ae36f7e" integrity sha512-aNtko9OPOwVESUFp3MZfD8Uzxl7JzSeJpd7npIoxCasU37PFbAQRpKglkaKwlHOyeJdrREpo8TW8ldrkYWwvIQ== @@ -161,18 +161,6 @@ "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" "@babel/helper-split-export-declaration" "^7.18.6" -"@babel/helper-define-polyfill-provider@^0.3.3": - version "0.3.3" - resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz#8612e55be5d51f0cd1f36b4a5a83924e89884b7a" - integrity sha512-z5aQKU4IzbqCC1XH0nAqfsFLMVSo22SBKUc0BxGrLkolTdPTructy0ToNnlO2zA4j9Q/7pjMZf0DSY+DSTYzww== - dependencies: - "@babel/helper-compilation-targets" "^7.17.7" - "@babel/helper-plugin-utils" "^7.16.7" - debug "^4.1.1" - lodash.debounce "^4.0.8" - resolve "^1.14.2" - semver "^6.1.2" - "@babel/helper-environment-visitor@^7.16.7", "@babel/helper-environment-visitor@^7.18.9", "@babel/helper-environment-visitor@^7.22.1": version "7.22.1" resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.1.tgz#ac3a56dbada59ed969d712cf527bd8271fe3eba8" @@ -228,7 +216,7 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.20.2": +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.20.2": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.21.5.tgz#345f2377d05a720a4e5ecfa39cbf4474a4daed56" integrity sha512-0WDaIlXKOX/3KfBK/dwP1oQGiPh6rjMkT7HIRv7i5RR2VUMwrx5ZL0dwBkKx7+SW1zwNdgjHd34IMk5ZjTeHVg== @@ -389,18 +377,6 @@ "@babel/helper-annotate-as-pure" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-runtime@^7.5.5": - version "7.19.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.19.6.tgz#9d2a9dbf4e12644d6f46e5e75bfbf02b5d6e9194" - integrity sha512-PRH37lz4JU156lYFW1p8OxE5i7d6Sl/zV58ooyr+q1J1lnQPyg5tIiXlIwNVhJaY4W3TmOtdc8jqdXQcB1v5Yw== - dependencies: - "@babel/helper-module-imports" "^7.18.6" - "@babel/helper-plugin-utils" "^7.19.0" - babel-plugin-polyfill-corejs2 "^0.3.3" - babel-plugin-polyfill-corejs3 "^0.6.0" - babel-plugin-polyfill-regenerator "^0.4.1" - semver "^6.3.0" - "@babel/plugin-transform-typescript@^7.21.3": version "7.21.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.21.3.tgz#316c5be579856ea890a57ebc5116c5d064658f2b" @@ -545,29 +521,6 @@ eventemitter3 "^4.0.7" uuid "^8.3.2" -"@coinbase/wallet-sdk@^3.0.4": - version "3.6.2" - resolved "https://registry.yarnpkg.com/@coinbase/wallet-sdk/-/wallet-sdk-3.6.2.tgz#e8633001136e0236a746f6462c0dff2f881db343" - integrity sha512-HzxajB+qS+G9//c+th5uJ8KSt+jQ6/U+cgL9Sv89Wx6Mif+Lg5HxGtc6JQcIdHuYk9AFX+nXNSXtTGRdpHkdDg== - dependencies: - "@metamask/safe-event-emitter" "2.0.0" - "@solana/web3.js" "1.52.0" - bind-decorator "^1.0.11" - bn.js "^5.1.1" - buffer "^6.0.3" - clsx "^1.1.0" - eth-block-tracker "4.4.3" - eth-json-rpc-filters "4.2.2" - eth-rpc-errors "4.0.2" - json-rpc-engine "6.1.0" - keccak "^3.0.1" - preact "^10.5.9" - qs "^6.10.3" - rxjs "^6.6.3" - sha.js "^2.4.11" - stream-browserify "^3.0.0" - util "^0.12.4" - "@colors/colors@1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" @@ -1187,7 +1140,7 @@ "@ethersproject/bytes" "^5.7.0" "@ethersproject/logger" "^5.7.0" -"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.5.0", "@ethersproject/sha2@^5.7.0": +"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== @@ -2315,11 +2268,6 @@ resolved "https://registry.yarnpkg.com/@metamask/detect-provider/-/detect-provider-1.2.0.tgz#3667a7531f2a682e3c3a43eaf3a1958bdb42a696" integrity sha512-ocA76vt+8D0thgXZ7LxFPyqw3H7988qblgzddTDA6B8a/yU0uKV42QR/DhA+Jh11rJjxW0jKvwb5htA6krNZDQ== -"@metamask/safe-event-emitter@2.0.0", "@metamask/safe-event-emitter@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-2.0.0.tgz#af577b477c683fad17c619a78208cede06f9605c" - integrity sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q== - "@motionone/animation@^10.15.1": version "10.15.1" resolved "https://registry.yarnpkg.com/@motionone/animation/-/animation-10.15.1.tgz#4a85596c31cbc5100ae8eb8b34c459fb0ccf6807" @@ -3400,29 +3348,6 @@ dependencies: "@solana/wallet-adapter-base" "^0.9.19" -"@solana/web3.js@1.52.0": - version "1.52.0" - resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.52.0.tgz#71bd5c322a31e3e2fa8cda2261c594846810b8ea" - integrity sha512-oG1+BX4nVYZ0OBzmk6DRrY8oBYMsbXVQEf9N9JOfKm+wXSmjxVEEo8v3IPV8mKwR0JvUWuE8lOn3IUDiMlRLgg== - dependencies: - "@babel/runtime" "^7.12.5" - "@ethersproject/sha2" "^5.5.0" - "@solana/buffer-layout" "^4.0.0" - bigint-buffer "^1.1.5" - bn.js "^5.0.0" - borsh "^0.7.0" - bs58 "^4.0.1" - buffer "6.0.1" - fast-stable-stringify "^1.0.0" - jayson "^3.4.4" - js-sha3 "^0.8.0" - node-fetch "2" - react-native-url-polyfill "^1.3.0" - rpc-websockets "^7.5.0" - secp256k1 "^4.0.2" - superstruct "^0.14.2" - tweetnacl "^1.0.3" - "@solana/web3.js@^1.17.0", "@solana/web3.js@^1.21.0", "@solana/web3.js@^1.32.0", "@solana/web3.js@^1.36.0", "@solana/web3.js@^1.44.3", "@solana/web3.js@^1.66.2": version "1.70.1" resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.70.1.tgz#4a2df47cc32a0f67be5161e772b2ceb6512281fa" @@ -4062,13 +3987,6 @@ resolved "https://registry.yarnpkg.com/@types/big.js/-/big.js-6.1.6.tgz#3d417e758483d55345a03a087f7e0c87137ca444" integrity sha512-0r9J+Zz9rYm2hOTwiMAVkm3XFQ4u5uTK37xrQMhc9bysn/sf/okzovWMYYIBMFTn/yrEZ11pusgLEaoarTlQbA== -"@types/bn.js@^4.11.3": - version "4.11.6" - resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-4.11.6.tgz#c306c70d9358aaea33cd4eda092a742b9505967c" - integrity sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg== - dependencies: - "@types/node" "*" - "@types/bn.js@^5.1.0": version "5.1.1" resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.1.tgz#b51e1b55920a4ca26e9285ff79936bbdec910682" @@ -5561,13 +5479,6 @@ "@walletconnect/window-getters" "^1.0.1" tslib "1.14.1" -"@web3-react/abstract-connector@^6.0.7": - version "6.0.7" - resolved "https://registry.yarnpkg.com/@web3-react/abstract-connector/-/abstract-connector-6.0.7.tgz#401b3c045f1e0fab04256311be49d5144e9badc6" - integrity sha512-RhQasA4Ox8CxUC0OENc1AJJm8UTybu/oOCM61Zjg6y0iF7Z0sqv1Ai1VdhC33hrQpA8qSBgoXN9PaP8jKmtdqg== - dependencies: - "@web3-react/types" "^6.0.7" - "@web3-react/coinbase-wallet@8.2.0": version "8.2.0" resolved "https://registry.yarnpkg.com/@web3-react/coinbase-wallet/-/coinbase-wallet-8.2.0.tgz#038bb9e915834046320621aa49db5ba79130e488" @@ -5619,11 +5530,6 @@ dependencies: zustand "^4.3.5" -"@web3-react/types@^6.0.7": - version "6.0.7" - resolved "https://registry.yarnpkg.com/@web3-react/types/-/types-6.0.7.tgz#34a6204224467eedc6123abaf55fbb6baeb2809f" - integrity sha512-ofGmfDhxmNT1/P/MgVa8IKSkCStFiyvXe+U5tyZurKdrtTDFU+wJ/LxClPDtFerWpczNFPUSrKcuhfPX1sI6+A== - "@web3-react/walletconnect-v2@^8.3.3": version "8.3.3" resolved "https://registry.yarnpkg.com/@web3-react/walletconnect-v2/-/walletconnect-v2-8.3.3.tgz#c5c7be5f7717e273d8b113351b16f44e424f542f" @@ -5634,15 +5540,6 @@ "@web3-react/types" "^8.2.0" eventemitter3 "^4.0.7" -"@web3-react/walletlink-connector@^6.2.14": - version "6.2.14" - resolved "https://registry.yarnpkg.com/@web3-react/walletlink-connector/-/walletlink-connector-6.2.14.tgz#4adf7b94de5d7018a9fc9e3b6009e78cd33d6e15" - integrity sha512-F2v1Uu7Nhptt7AaUEJpz69+NVUJxyUfDEA5B/Vr1HkqAL1aJM5gv6B1m4M/VdXKLpmjZ9Kg6X0+VUEyAx1eQ4w== - dependencies: - "@coinbase/wallet-sdk" "^3.0.4" - "@web3-react/abstract-connector" "^6.0.7" - "@web3-react/types" "^6.0.7" - "@web3modal/core@2.4.7": version "2.4.7" resolved "https://registry.yarnpkg.com/@web3modal/core/-/core-2.4.7.tgz#e128be449bc5f6f23f6fb32f12021c096b5e7a07" @@ -6128,13 +6025,6 @@ astral-regex@^2.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== -async-mutex@^0.2.6: - version "0.2.6" - resolved "https://registry.yarnpkg.com/async-mutex/-/async-mutex-0.2.6.tgz#0d7a3deb978bc2b984d5908a2038e1ae2e54ff40" - integrity sha512-Hs4R+4SPgamu6rSGW8C7cV9gaWUKEHykfzCCvIRuaVv636Ju10ZdeUbvb4TBEW0INuq2DHZqXbK4Nd3yG4RaRw== - dependencies: - tslib "^2.0.0" - async-mutex@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/async-mutex/-/async-mutex-0.4.0.tgz#ae8048cd4d04ace94347507504b3cf15e631c25f" @@ -6297,30 +6187,6 @@ babel-plugin-macros@^3.0.1, babel-plugin-macros@^3.1.0: cosmiconfig "^7.0.0" resolve "^1.19.0" -babel-plugin-polyfill-corejs2@^0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz#5d1bd3836d0a19e1b84bbf2d9640ccb6f951c122" - integrity sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q== - dependencies: - "@babel/compat-data" "^7.17.7" - "@babel/helper-define-polyfill-provider" "^0.3.3" - semver "^6.1.1" - -babel-plugin-polyfill-corejs3@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.6.0.tgz#56ad88237137eade485a71b52f72dbed57c6230a" - integrity sha512-+eHqR6OPcBhJOGgsIar7xoAB1GcSwVUA3XjAd7HJNzOXT4wv6/H7KIdA/Nc60cvUlDbKApmqNvD1B1bzOt4nyA== - dependencies: - "@babel/helper-define-polyfill-provider" "^0.3.3" - core-js-compat "^3.25.1" - -babel-plugin-polyfill-regenerator@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.4.1.tgz#390f91c38d90473592ed43351e801a9d3e0fd747" - integrity sha512-NtQGmyQDXjQqQ+IzRkBVwEOz9lQ4zxAQZgoAYEtU9dJjnl1Oc98qnN7jcp+bE7O7aYzVpavXE3/VKXNzUbh7aw== - dependencies: - "@babel/helper-define-polyfill-provider" "^0.3.3" - babel-plugin-react-generate-property@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/babel-plugin-react-generate-property/-/babel-plugin-react-generate-property-1.1.2.tgz#2f861e2661795a242b80284af32573bb2c6cdf3b" @@ -6488,11 +6354,6 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== -bind-decorator@^1.0.11: - version "1.0.11" - resolved "https://registry.yarnpkg.com/bind-decorator/-/bind-decorator-1.0.11.tgz#e41bc06a1f65dd9cec476c91c5daf3978488252f" - integrity sha512-yzkH0uog6Vv/vQ9+rhSKxecnqGUZHYncg7qS7voz3Q76+TAi1SGiOKk2mlOvusQnFz9Dc4BC/NMkeXu11YgjJg== - bindings@^1.3.0, bindings@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" @@ -6558,7 +6419,7 @@ bmp-js@^0.1.0: resolved "https://registry.yarnpkg.com/bmp-js/-/bmp-js-0.1.0.tgz#e05a63f796a6c1ff25f4771ec7adadc148c07233" integrity sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw== -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.0, bn.js@^4.11.8, bn.js@^4.11.9: +bn.js@^4.0.0, bn.js@^4.1.0, 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" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== @@ -6710,7 +6571,7 @@ browserify-sign@^4.0.0: readable-stream "^3.6.0" safe-buffer "^5.2.0" -browserslist@^4.21.3, browserslist@^4.21.4: +browserslist@^4.21.3: version "4.21.4" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.4.tgz#e7496bbc67b9e39dd0f98565feccdcb0d4ff6987" integrity sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw== @@ -6743,11 +6604,6 @@ bs58check@^2.1.2: create-hash "^1.1.0" safe-buffer "^5.1.2" -btoa@^1.2.1: - version "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" @@ -7211,12 +7067,7 @@ clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== -clone@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" - integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w== - -clsx@^1.1.0, clsx@^1.1.1, clsx@^1.2.1: +clsx@^1.1.1, clsx@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12" integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg== @@ -7566,13 +7417,6 @@ copy-to-clipboard@^3.2.0, copy-to-clipboard@^3.3.1: dependencies: toggle-selection "^1.0.6" -core-js-compat@^3.25.1: - version "3.26.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.26.1.tgz#0e710b09ebf689d719545ac36e49041850f943df" - integrity sha512-622/KzTudvXCDLRw70iHW4KKs1aGpcRcowGWyYJr2DEBfRrd6hNJybxSWJFuZYD4ma86xhrwDDHxmDaIq4EA8A== - dependencies: - browserslist "^4.21.4" - core-js-pure@^3.30.2: version "3.30.2" resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.30.2.tgz#005a82551f4af3250dcfb46ed360fad32ced114e" @@ -9252,84 +9096,13 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== -eth-block-tracker@4.4.3: - version "4.4.3" - resolved "https://registry.yarnpkg.com/eth-block-tracker/-/eth-block-tracker-4.4.3.tgz#766a0a0eb4a52c867a28328e9ae21353812cf626" - integrity sha512-A8tG4Z4iNg4mw5tP1Vung9N9IjgMNqpiMoJ/FouSFwNCGHv2X0mmOYwtQOJzki6XN7r7Tyo01S29p7b224I4jw== - dependencies: - "@babel/plugin-transform-runtime" "^7.5.5" - "@babel/runtime" "^7.5.5" - eth-query "^2.1.0" - json-rpc-random-id "^1.0.1" - pify "^3.0.0" - safe-event-emitter "^1.0.1" - -eth-json-rpc-filters@4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/eth-json-rpc-filters/-/eth-json-rpc-filters-4.2.2.tgz#eb35e1dfe9357ace8a8908e7daee80b2cd60a10d" - integrity sha512-DGtqpLU7bBg63wPMWg1sCpkKCf57dJ+hj/k3zF26anXMzkmtSBDExL8IhUu7LUd34f0Zsce3PYNO2vV2GaTzaw== - dependencies: - "@metamask/safe-event-emitter" "^2.0.0" - async-mutex "^0.2.6" - eth-json-rpc-middleware "^6.0.0" - eth-query "^2.1.2" - json-rpc-engine "^6.1.0" - pify "^5.0.0" - -eth-json-rpc-middleware@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/eth-json-rpc-middleware/-/eth-json-rpc-middleware-6.0.0.tgz#4fe16928b34231a2537856f08a5ebbc3d0c31175" - integrity sha512-qqBfLU2Uq1Ou15Wox1s+NX05S9OcAEL4JZ04VZox2NS0U+RtCMjSxzXhLFWekdShUPZ+P8ax3zCO2xcPrp6XJQ== - dependencies: - btoa "^1.2.1" - clone "^2.1.1" - eth-query "^2.1.2" - eth-rpc-errors "^3.0.0" - eth-sig-util "^1.4.2" - ethereumjs-util "^5.1.2" - json-rpc-engine "^5.3.0" - json-stable-stringify "^1.0.1" - node-fetch "^2.6.1" - pify "^3.0.0" - safe-event-emitter "^1.0.1" - -eth-query@^2.1.0, eth-query@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/eth-query/-/eth-query-2.1.2.tgz#d6741d9000106b51510c72db92d6365456a6da5e" - integrity sha512-srES0ZcvwkR/wd5OQBRA1bIJMww1skfGS0s8wlwK3/oNP4+wnds60krvu5R1QbpRQjMmpG5OMIWro5s7gvDPsA== - dependencies: - json-rpc-random-id "^1.0.0" - xtend "^4.0.1" - -eth-rpc-errors@4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-4.0.2.tgz#11bc164e25237a679061ac05b7da7537b673d3b7" - integrity sha512-n+Re6Gu8XGyfFy1it0AwbD1x0MUzspQs0D5UiPs1fFPCr6WAwZM+vbIhXheBFrpgosqN9bs5PqlB4Q61U/QytQ== - dependencies: - fast-safe-stringify "^2.0.6" - -eth-rpc-errors@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-3.0.0.tgz#d7b22653c70dbf9defd4ef490fd08fe70608ca10" - integrity sha512-iPPNHPrLwUlR9xCSYm7HHQjWBasor3+KZfRvwEWxMz3ca0yqnlBeJrnyphkGIXZ4J7AMAaOLmwy4AWhnxOiLxg== - dependencies: - fast-safe-stringify "^2.0.6" - -eth-rpc-errors@^4.0.2, eth-rpc-errors@^4.0.3: +eth-rpc-errors@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-4.0.3.tgz#6ddb6190a4bf360afda82790bb7d9d5e724f423a" integrity sha512-Z3ymjopaoft7JDoxZcEb3pwdGh7yiYMhOwm2doUt6ASXlMavpNlK6Cre0+IMl2VSGyEU9rkiperQhp5iRxn5Pg== dependencies: fast-safe-stringify "^2.0.6" -eth-sig-util@^1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-1.4.2.tgz#8d958202c7edbaae839707fba6f09ff327606210" - integrity sha512-iNZ576iTOGcfllftB73cPB5AN+XUQAT/T8xzsILsghXC1o8gJUqe3RHlcDqagu+biFpYQ61KQrZZJza8eRSYqw== - dependencies: - ethereumjs-abi "git+https://github.com/ethereumjs/ethereumjs-abi.git" - ethereumjs-util "^5.1.1" - ethereum-cryptography@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" @@ -9351,39 +9124,6 @@ ethereum-cryptography@^0.1.3: secp256k1 "^4.0.1" setimmediate "^1.0.5" -"ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git": - version "0.6.8" - resolved "git+https://github.com/ethereumjs/ethereumjs-abi.git#ee3994657fa7a427238e6ba92a84d0b529bbcde0" - dependencies: - bn.js "^4.11.8" - ethereumjs-util "^6.0.0" - -ethereumjs-util@^5.1.1, ethereumjs-util@^5.1.2: - version "5.2.1" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-5.2.1.tgz#a833f0e5fca7e5b361384dc76301a721f537bf65" - integrity sha512-v3kT+7zdyCm1HIqWlLNrHGqHGLpGYIhjeHxQjnDXjLT2FyGJDsd3LWMYUo7pAFRrk86CR3nUJfhC81CCoJNNGQ== - dependencies: - bn.js "^4.11.0" - create-hash "^1.1.2" - elliptic "^6.5.2" - ethereum-cryptography "^0.1.3" - ethjs-util "^0.1.3" - rlp "^2.0.0" - safe-buffer "^5.1.1" - -ethereumjs-util@^6.0.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz#fcb4e4dd5ceacb9d2305426ab1a5cd93e3163b69" - integrity sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw== - dependencies: - "@types/bn.js" "^4.11.3" - bn.js "^4.11.0" - create-hash "^1.1.2" - elliptic "^6.5.2" - ethereum-cryptography "^0.1.3" - ethjs-util "0.1.6" - rlp "^2.2.3" - ethereumjs-util@^7.1.5: version "7.1.5" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz#9ecf04861e4fbbeed7465ece5f23317ad1129181" @@ -9453,14 +9193,6 @@ etherscan-api@^10.3.0: gh-pages "4.0.0" querystring "0.2.1" -ethjs-util@0.1.6, ethjs-util@^0.1.3: - version "0.1.6" - resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" - integrity sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w== - dependencies: - is-hex-prefixed "1.0.0" - strip-hex-prefix "1.0.0" - event-stream@=3.3.4: version "3.3.4" resolved "https://registry.yarnpkg.com/event-stream/-/event-stream-3.3.4.tgz#4ab4c9a0f5a54db9338b4c34d86bfce8f4b35571" @@ -9484,7 +9216,7 @@ eventemitter3@^4.0.0, eventemitter3@^4.0.1, eventemitter3@^4.0.4, eventemitter3@ resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== -events@^3.0.0, events@^3.3.0: +events@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== @@ -11309,11 +11041,6 @@ is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: dependencies: is-extglob "^2.1.1" -is-hex-prefixed@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554" - integrity sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA== - is-inside-container@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-inside-container/-/is-inside-container-1.0.0.tgz#e81fba699662eb31dbdaf26766a61d4814717ea4" @@ -11864,23 +11591,7 @@ json-parse-even-better-errors@^2.3.0: resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== -json-rpc-engine@6.1.0, json-rpc-engine@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/json-rpc-engine/-/json-rpc-engine-6.1.0.tgz#bf5ff7d029e1c1bf20cb6c0e9f348dcd8be5a393" - integrity sha512-NEdLrtrq1jUZyfjkr9OCz9EzCNhnRyWtt1PAnvnhwy6e8XETS0Dtc+ZNCO2gvuAoKsIn2+vCSowXTYE4CkgnAQ== - dependencies: - "@metamask/safe-event-emitter" "^2.0.0" - eth-rpc-errors "^4.0.2" - -json-rpc-engine@^5.3.0: - version "5.4.0" - resolved "https://registry.yarnpkg.com/json-rpc-engine/-/json-rpc-engine-5.4.0.tgz#75758609d849e1dba1e09021ae473f3ab63161e5" - integrity sha512-rAffKbPoNDjuRnXkecTjnsE3xLLrb00rEkdgalINhaYVYIxDwWtvYBr9UFbhTvPB1B2qUOLoFd/cV6f4Q7mh7g== - dependencies: - eth-rpc-errors "^3.0.0" - safe-event-emitter "^1.0.1" - -json-rpc-random-id@^1.0.0, json-rpc-random-id@^1.0.1: +json-rpc-random-id@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-rpc-random-id/-/json-rpc-random-id-1.0.1.tgz#ba49d96aded1444dbb8da3d203748acbbcdec8c8" integrity sha512-RJ9YYNCkhVDBuP4zN5BBtYAzEl03yq/jIIsyif0JY9qyJuQQZNeDK7anAPKKlyEtLSj2s8h6hNh2F8zO5q7ScA== @@ -11978,7 +11689,7 @@ jsqr@^1.2.0: array-includes "^3.1.5" object.assign "^4.1.3" -keccak@^3.0.0, keccak@^3.0.1, keccak@^3.0.2: +keccak@^3.0.0, keccak@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.2.tgz#4c2c6e8c54e04f2670ee49fa734eb9da152206e0" integrity sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ== @@ -13714,11 +13425,6 @@ pify@^4.0.1: resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== -pify@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-5.0.0.tgz#1f5eca3f5e87ebec28cc6d54a0e4aaf00acc127f" - integrity sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA== - pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" @@ -13961,11 +13667,6 @@ preact@10.4.1: resolved "https://registry.yarnpkg.com/preact/-/preact-10.4.1.tgz#9b3ba020547673a231c6cf16f0fbaef0e8863431" integrity sha512-WKrRpCSwL2t3tpOOGhf2WfTpcmbpxaWtDbdJdKdjd0aEiTkvOmS4NBkG6kzlaAHI9AkQ3iVqbFWM3Ei7mZ4o1Q== -preact@^10.5.9: - version "10.11.3" - resolved "https://registry.yarnpkg.com/preact/-/preact-10.11.3.tgz#8a7e4ba19d3992c488b0785afcc0f8aa13c78d19" - integrity sha512-eY93IVpod/zG3uMF22Unl8h9KkrcKIRs2EGar8hwLZZDU1lkjph303V9HZBwufh2s736U6VXuhD109LYqPoffg== - prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -14273,7 +13974,7 @@ qrcode@1.5.3: pngjs "^5.0.0" yargs "^15.3.1" -qs@6.11.0, qs@^6.10.3: +qs@6.11.0: version "6.11.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== @@ -14593,13 +14294,6 @@ react-modal@^3.12.1: react-lifecycles-compat "^3.0.0" warning "^4.0.3" -react-native-url-polyfill@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/react-native-url-polyfill/-/react-native-url-polyfill-1.3.0.tgz#c1763de0f2a8c22cc3e959b654c8790622b6ef6a" - integrity sha512-w9JfSkvpqqlix9UjDvJjm1EjSt652zVQ6iwCIj1cVVkwXf4jQhQgTNXY6EVTwuAmUjg6BC6k9RHCBynoLFo3IQ== - dependencies: - whatwg-url-without-unicode "8.0.0-3" - react-popper@^2.2.3: version "2.3.0" resolved "https://registry.yarnpkg.com/react-popper/-/react-popper-2.3.0.tgz#17891c620e1320dce318bad9fede46a5f71c70ba" @@ -15170,7 +14864,7 @@ resolve@^1.1.6, resolve@^1.10.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -resolve@^1.12.0, resolve@^1.14.2, resolve@^1.19.0: +resolve@^1.12.0, resolve@^1.19.0: version "1.22.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== @@ -15260,7 +14954,7 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" -rlp@^2.0.0, rlp@^2.2.3, rlp@^2.2.4: +rlp@^2.2.4: version "2.2.7" resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz#33f31c4afac81124ac4b283e2bd4d9720b30beaf" integrity sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ== @@ -15364,13 +15058,6 @@ safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== -safe-event-emitter@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/safe-event-emitter/-/safe-event-emitter-1.0.1.tgz#5b692ef22329ed8f69fdce607e50ca734f6f20af" - integrity sha512-e1wFe99A91XYYxoQbcq2ZJUWurxEyP8vfz7A7vuUe1s95q8r5ebraVaA1BukYJcpM6V16ugWoD9vngi8Ccu5fg== - dependencies: - events "^3.0.0" - safe-json-utils@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/safe-json-utils/-/safe-json-utils-1.1.1.tgz#0e883874467d95ab914c3f511096b89bfb3e63b1" @@ -15462,7 +15149,7 @@ secp256k1@^3.8.0: nan "^2.14.0" safe-buffer "^5.1.2" -secp256k1@^4.0.1, secp256k1@^4.0.2: +secp256k1@^4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.3.tgz#c4559ecd1b8d3c1827ed2d1b94190d69ce267303" integrity sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA== @@ -15516,7 +15203,7 @@ semver@7.5.0, semver@^7.3.4: dependencies: lru-cache "^6.0.0" -semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0: +semver@^6.0.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -16203,13 +15890,6 @@ strip-final-newline@^3.0.0: resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd" integrity sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw== -strip-hex-prefix@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz#0c5f155fef1151373377de9dbb588da05500e36f" - integrity sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A== - dependencies: - is-hex-prefixed "1.0.0" - strip-indent@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-3.0.0.tgz#c32e1cee940b6b3432c771bc2c54bcce73cd3001" @@ -16670,11 +16350,6 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== -tweetnacl@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" - integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== - type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" @@ -16989,7 +16664,7 @@ util.promisify@1.0.0: define-properties "^1.1.2" object.getownpropertydescriptors "^2.0.3" -util@^0.12.0, util@^0.12.3, util@^0.12.4, util@^0.12.5: +util@^0.12.0, util@^0.12.3, util@^0.12.5: version "0.12.5" resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc" integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA== @@ -17283,11 +16958,6 @@ webidl-conversions@^3.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== -webidl-conversions@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff" - integrity sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA== - webpack-dev-middleware@^5.3.1: version "5.3.3" resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz#efae67c2793908e7311f1d9b06f2a08dcc97e51f" @@ -17365,15 +17035,6 @@ websocket-extensions@>=0.1.1: resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42" integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg== -whatwg-url-without-unicode@8.0.0-3: - version "8.0.0-3" - resolved "https://registry.yarnpkg.com/whatwg-url-without-unicode/-/whatwg-url-without-unicode-8.0.0-3.tgz#ab6df4bf6caaa6c85a59f6e82c026151d4bb376b" - integrity sha512-HoKuzZrUlgpz35YO27XgD28uh/WJH4B0+3ttFqRo//lmq+9T/mIOJ6kqmINI9HpUpz1imRC/nR/lxKpJiv0uig== - dependencies: - buffer "^5.4.3" - punycode "^2.1.1" - webidl-conversions "^5.0.0" - whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" @@ -17621,7 +17282,7 @@ xregexp@2.0.0: resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-2.0.0.tgz#52a63e56ca0b84a7f3a5f3d61872f126ad7a5943" integrity sha512-xl/50/Cf32VsGq/1R8jJE5ajH1yMCQkpmoS10QbFZWl2Oor4H0Me64Pu2yxvsRWK3m6soJbmGfzSR7BYmDcWAA== -xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1: +xtend@^4.0.0, xtend@~4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== From e242aeb65ff52f78375c1cf2a8735bba028cdf04 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Wed, 23 Aug 2023 18:08:07 +0700 Subject: [PATCH 32/58] blocto prevent change chain --- package.json | 1 + src/hooks/web3/useWalletSupportedChains.ts | 4 +- yarn.lock | 253 ++++++++++++++++++++- 3 files changed, 251 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 6808ee1639..5647a05080 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "@apollo/client": "^3.7.1", "@blocto/web3-react-connector": "^1.0.0", "@datadog/browser-rum": "^4.23.3", + "@coinbase/wallet-sdk": "^3.0.4", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@kybernetwork/oauth2": "1.0.0", "@kyberswap/ks-sdk-classic": "^1.0.3", diff --git a/src/hooks/web3/useWalletSupportedChains.ts b/src/hooks/web3/useWalletSupportedChains.ts index 843b798364..c7c0077c0f 100644 --- a/src/hooks/web3/useWalletSupportedChains.ts +++ b/src/hooks/web3/useWalletSupportedChains.ts @@ -1,7 +1,7 @@ import { ChainId } from '@kyberswap/ks-sdk-core' import { WalletConnect as WalletConnectV2 } from '@web3-react/walletconnect-v2' -import { gnosisSafe, walletConnectV2 } from 'constants/connectors/evm' +import { blocto, bloctoInjected, gnosisSafe, walletConnectV2 } from 'constants/connectors/evm' import { SUPPORTED_NETWORKS } from 'constants/networks' import { useWeb3React } from 'hooks' @@ -24,6 +24,8 @@ export function useWalletSupportedChains(): ChainId[] { ...getChainsFromEIP155Accounts((connector as WalletConnectV2).provider?.session?.namespaces?.eip155?.accounts), ] case gnosisSafe: + case blocto: + case bloctoInjected: return chainId ? [chainId] : SUPPORTED_NETWORKS default: return SUPPORTED_NETWORKS diff --git a/yarn.lock b/yarn.lock index 2bd648e25d..b8bc24c669 100644 --- a/yarn.lock +++ b/yarn.lock @@ -425,6 +425,13 @@ dependencies: regenerator-runtime "^0.13.11" +"@babel/runtime@^7.22.6": + version "7.22.10" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.10.tgz#ae3e9631fd947cb7e3610d3e9d8fef5f76696682" + integrity sha512-21t/fkKLMZI4pqP2wlmsQAWnYW1PDyKyyUV4vCi+B25ydmdaYTKXPwCj0BzSUnZf4seIiYvSA3jcZ3gdsMFkLQ== + dependencies: + regenerator-runtime "^0.14.0" + "@babel/template@^7.16.7", "@babel/template@^7.20.7", "@babel/template@^7.21.9": version "7.21.9" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.21.9.tgz#bf8dad2859130ae46088a99c1f265394877446fb" @@ -521,6 +528,29 @@ eventemitter3 "^4.0.7" uuid "^8.3.2" +"@coinbase/wallet-sdk@^3.0.4": + version "3.7.1" + resolved "https://registry.yarnpkg.com/@coinbase/wallet-sdk/-/wallet-sdk-3.7.1.tgz#44b3b7a925ff5cc974e4cbf7a44199ffdcf03541" + integrity sha512-LjyoDCB+7p0waQXfK+fUgcAs3Ezk6S6e+LYaoFjpJ6c9VTop3NyZF40Pi7df4z7QJohCwzuIDjz0Rhtig6Y7Pg== + dependencies: + "@metamask/safe-event-emitter" "2.0.0" + "@solana/web3.js" "^1.70.1" + bind-decorator "^1.0.11" + bn.js "^5.1.1" + buffer "^6.0.3" + clsx "^1.1.0" + eth-block-tracker "6.1.0" + eth-json-rpc-filters "5.1.0" + eth-rpc-errors "4.0.2" + json-rpc-engine "6.1.0" + keccak "^3.0.1" + preact "^10.5.9" + qs "^6.10.3" + rxjs "^6.6.3" + sha.js "^2.4.11" + stream-browserify "^3.0.0" + util "^0.12.4" + "@colors/colors@1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" @@ -2268,6 +2298,21 @@ resolved "https://registry.yarnpkg.com/@metamask/detect-provider/-/detect-provider-1.2.0.tgz#3667a7531f2a682e3c3a43eaf3a1958bdb42a696" integrity sha512-ocA76vt+8D0thgXZ7LxFPyqw3H7988qblgzddTDA6B8a/yU0uKV42QR/DhA+Jh11rJjxW0jKvwb5htA6krNZDQ== +"@metamask/safe-event-emitter@2.0.0", "@metamask/safe-event-emitter@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-2.0.0.tgz#af577b477c683fad17c619a78208cede06f9605c" + integrity sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q== + +"@metamask/utils@^3.0.1": + version "3.6.0" + resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-3.6.0.tgz#b218b969a05ca7a8093b5d1670f6625061de707d" + integrity sha512-9cIRrfkWvHblSiNDVXsjivqa9Ak0RYo/1H6tqTqTbAx+oBK2Sva0lWDHxGchOqA7bySGUJKAWSNJvH6gdHZ0gQ== + dependencies: + "@types/debug" "^4.1.7" + debug "^4.3.4" + semver "^7.3.8" + superstruct "^1.0.3" + "@motionone/animation@^10.15.1": version "10.15.1" resolved "https://registry.yarnpkg.com/@motionone/animation/-/animation-10.15.1.tgz#4a85596c31cbc5100ae8eb8b34c459fb0ccf6807" @@ -2362,6 +2407,13 @@ dependencies: "@noble/hashes" "1.3.0" +"@noble/curves@^1.0.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.1.0.tgz#f13fc667c89184bc04cccb9b11e8e7bae27d8c3d" + integrity sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA== + dependencies: + "@noble/hashes" "1.3.1" + "@noble/ed25519@^1.7.0": version "1.7.1" resolved "https://registry.yarnpkg.com/@noble/ed25519/-/ed25519-1.7.1.tgz#6899660f6fbb97798a6fbd227227c4589a454724" @@ -2377,6 +2429,11 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.0.tgz#085fd70f6d7d9d109671090ccae1d3bec62554a1" integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg== +"@noble/hashes@1.3.1", "@noble/hashes@^1.3.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.1.tgz#8831ef002114670c603c458ab8b11328406953a9" + integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA== + "@noble/secp256k1@1.7.1", "@noble/secp256k1@^1.6.3": version "1.7.1" resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c" @@ -3369,6 +3426,27 @@ rpc-websockets "^7.5.0" superstruct "^0.14.2" +"@solana/web3.js@^1.70.1": + version "1.78.4" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.78.4.tgz#e8ca9abe4ec2af5fc540c1d272efee24aaffedb3" + integrity sha512-up5VG1dK+GPhykmuMIozJZBbVqpm77vbOG6/r5dS7NBGZonwHfTLdBbsYc3rjmaQ4DpCXUa3tUc4RZHRORvZrw== + dependencies: + "@babel/runtime" "^7.22.6" + "@noble/curves" "^1.0.0" + "@noble/hashes" "^1.3.1" + "@solana/buffer-layout" "^4.0.0" + agentkeepalive "^4.3.0" + bigint-buffer "^1.1.5" + bn.js "^5.2.1" + borsh "^0.7.0" + bs58 "^4.0.1" + buffer "6.0.3" + fast-stable-stringify "^1.0.0" + jayson "^4.1.0" + node-fetch "^2.6.12" + rpc-websockets "^7.5.1" + superstruct "^0.14.2" + "@solflare-wallet/sdk@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@solflare-wallet/sdk/-/sdk-1.1.0.tgz#300e2784720e11bef8910b54057bb1c1c8c284a0" @@ -4294,6 +4372,13 @@ "@types/d3-transition" "*" "@types/d3-zoom" "*" +"@types/debug@^4.1.7": + version "4.1.8" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.8.tgz#cef723a5d0a90990313faec2d1e22aee5eecb317" + integrity sha512-/vPO1EPOs306Cvhwv7KfVfYvOJqA/S/AXjaHQiJboCZzcNDb+TIJFN9/2C9DZ//ijSKWioNyUxD792QmDJ+HKQ== + dependencies: + "@types/ms" "*" + "@types/estree@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.0.tgz#5fb2e536c1ae9bf35366eed879e827fa59ca41c2" @@ -4434,6 +4519,11 @@ resolved "https://registry.yarnpkg.com/@types/mixpanel-browser/-/mixpanel-browser-2.38.0.tgz#b3e28e1ba06c10a9f88510b88f1ac9d1b2adfc42" integrity sha512-TR8rvsILnqXA7oiiGOxuMGXwvDeCoQDonXJB5UR+TYvEAFpiK8ReFj5LhZT+Xhm3NpI9aPoju30jB2ssorSUww== +"@types/ms@*": + version "0.7.31" + resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" + integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== + "@types/multicodec@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@types/multicodec/-/multicodec-1.0.0.tgz#9c9c2df84ea5006c65a048873600f71c4565a397" @@ -5662,6 +5752,13 @@ agent-base@6, agent-base@^6.0.0, agent-base@^6.0.2: dependencies: debug "4" +agentkeepalive@^4.3.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.5.0.tgz#2673ad1389b3c418c5a20c5d7364f93ca04be923" + integrity sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew== + dependencies: + humanize-ms "^1.2.1" + aggregate-error@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" @@ -6025,6 +6122,13 @@ astral-regex@^2.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== +async-mutex@^0.2.6: + version "0.2.6" + resolved "https://registry.yarnpkg.com/async-mutex/-/async-mutex-0.2.6.tgz#0d7a3deb978bc2b984d5908a2038e1ae2e54ff40" + integrity sha512-Hs4R+4SPgamu6rSGW8C7cV9gaWUKEHykfzCCvIRuaVv636Ju10ZdeUbvb4TBEW0INuq2DHZqXbK4Nd3yG4RaRw== + dependencies: + tslib "^2.0.0" + async-mutex@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/async-mutex/-/async-mutex-0.4.0.tgz#ae8048cd4d04ace94347507504b3cf15e631c25f" @@ -6354,6 +6458,11 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== +bind-decorator@^1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/bind-decorator/-/bind-decorator-1.0.11.tgz#e41bc06a1f65dd9cec476c91c5daf3978488252f" + integrity sha512-yzkH0uog6Vv/vQ9+rhSKxecnqGUZHYncg7qS7voz3Q76+TAi1SGiOKk2mlOvusQnFz9Dc4BC/NMkeXu11YgjJg== + bindings@^1.3.0, bindings@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" @@ -7067,7 +7176,7 @@ clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== -clsx@^1.1.1, clsx@^1.2.1: +clsx@^1.1.0, clsx@^1.1.1, clsx@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12" integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg== @@ -9096,7 +9205,43 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== -eth-rpc-errors@^4.0.3: +eth-block-tracker@6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/eth-block-tracker/-/eth-block-tracker-6.1.0.tgz#0481f97bbb88a100b9d45806fe7e37af741cbefc" + integrity sha512-K9SY8+/xMBi4M5HHTDdxnpEqEEGjbNpzHFqvxyjMZej8InV/B+CkFRKM6W+uvrFJ7m8Zd1E0qUkseU3vdIDFYQ== + dependencies: + "@metamask/safe-event-emitter" "^2.0.0" + "@metamask/utils" "^3.0.1" + json-rpc-random-id "^1.0.1" + pify "^3.0.0" + +eth-json-rpc-filters@5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/eth-json-rpc-filters/-/eth-json-rpc-filters-5.1.0.tgz#f0c2aeaec2a45e2dc6ca1b9843d8e85447821427" + integrity sha512-fos+9xmoa1A2Ytsc9eYof17r81BjdJOUcGcgZn4K/tKdCCTb+a8ytEtwlu1op5qsXFDlgGmstTELFrDEc89qEQ== + dependencies: + "@metamask/safe-event-emitter" "^2.0.0" + async-mutex "^0.2.6" + eth-query "^2.1.2" + json-rpc-engine "^6.1.0" + pify "^5.0.0" + +eth-query@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/eth-query/-/eth-query-2.1.2.tgz#d6741d9000106b51510c72db92d6365456a6da5e" + integrity sha512-srES0ZcvwkR/wd5OQBRA1bIJMww1skfGS0s8wlwK3/oNP4+wnds60krvu5R1QbpRQjMmpG5OMIWro5s7gvDPsA== + dependencies: + json-rpc-random-id "^1.0.0" + xtend "^4.0.1" + +eth-rpc-errors@4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-4.0.2.tgz#11bc164e25237a679061ac05b7da7537b673d3b7" + integrity sha512-n+Re6Gu8XGyfFy1it0AwbD1x0MUzspQs0D5UiPs1fFPCr6WAwZM+vbIhXheBFrpgosqN9bs5PqlB4Q61U/QytQ== + dependencies: + fast-safe-stringify "^2.0.6" + +eth-rpc-errors@^4.0.2, eth-rpc-errors@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-4.0.3.tgz#6ddb6190a4bf360afda82790bb7d9d5e724f423a" integrity sha512-Z3ymjopaoft7JDoxZcEb3pwdGh7yiYMhOwm2doUt6ASXlMavpNlK6Cre0+IMl2VSGyEU9rkiperQhp5iRxn5Pg== @@ -10676,6 +10821,13 @@ human-signals@^4.3.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2" integrity sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ== +humanize-ms@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" + integrity sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ== + dependencies: + ms "^2.0.0" + hyphenate-style-name@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz#691879af8e220aea5750e8827db4ef62a54e361d" @@ -11458,6 +11610,24 @@ jayson@^3.4.4: uuid "^8.3.2" ws "^7.4.5" +jayson@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/jayson/-/jayson-4.1.0.tgz#60dc946a85197317f2b1439d672a8b0a99cea2f9" + integrity sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A== + dependencies: + "@types/connect" "^3.4.33" + "@types/node" "^12.12.54" + "@types/ws" "^7.4.4" + JSONStream "^1.3.5" + commander "^2.20.3" + delay "^5.0.0" + es6-promisify "^5.0.0" + eyes "^0.1.8" + isomorphic-ws "^4.0.1" + json-stringify-safe "^5.0.1" + uuid "^8.3.2" + ws "^7.4.5" + jest-diff@^25.2.1: version "25.5.0" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-25.5.0.tgz#1dd26ed64f96667c068cef026b677dfa01afcfa9" @@ -11591,7 +11761,15 @@ json-parse-even-better-errors@^2.3.0: resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== -json-rpc-random-id@^1.0.1: +json-rpc-engine@6.1.0, json-rpc-engine@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/json-rpc-engine/-/json-rpc-engine-6.1.0.tgz#bf5ff7d029e1c1bf20cb6c0e9f348dcd8be5a393" + integrity sha512-NEdLrtrq1jUZyfjkr9OCz9EzCNhnRyWtt1PAnvnhwy6e8XETS0Dtc+ZNCO2gvuAoKsIn2+vCSowXTYE4CkgnAQ== + dependencies: + "@metamask/safe-event-emitter" "^2.0.0" + eth-rpc-errors "^4.0.2" + +json-rpc-random-id@^1.0.0, json-rpc-random-id@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-rpc-random-id/-/json-rpc-random-id-1.0.1.tgz#ba49d96aded1444dbb8da3d203748acbbcdec8c8" integrity sha512-RJ9YYNCkhVDBuP4zN5BBtYAzEl03yq/jIIsyif0JY9qyJuQQZNeDK7anAPKKlyEtLSj2s8h6hNh2F8zO5q7ScA== @@ -11698,6 +11876,15 @@ keccak@^3.0.0, keccak@^3.0.2: node-gyp-build "^4.2.0" readable-stream "^3.6.0" +keccak@^3.0.1: + version "3.0.3" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.3.tgz#4bc35ad917be1ef54ff246f904c2bbbf9ac61276" + integrity sha512-JZrLIAJWuZxKbCilMpNz5Vj7Vtb4scDG3dMXLOsbzBmQGyjwE61BbW7bJkfKKCShXiQZt3T6sBgALRtmd+nZaQ== + dependencies: + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + readable-stream "^3.6.0" + keyv@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.0.0.tgz#44923ba39e68b12a7cec7df6c3268c031f2ef373" @@ -12440,7 +12627,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@2.1.3, ms@^2.1.1: +ms@2.1.3, ms@^2.0.0, ms@^2.1.1: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -12612,6 +12799,13 @@ node-fetch@3.3.1: fetch-blob "^3.1.4" formdata-polyfill "^4.0.10" +node-fetch@^2.6.12: + version "2.6.13" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.13.tgz#a20acbbec73c2e09f9007de5cda17104122e0010" + integrity sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA== + dependencies: + whatwg-url "^5.0.0" + node-fetch@^2.6.7: version "2.6.11" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.11.tgz#cde7fc71deef3131ef80a738919f999e6edfff25" @@ -13425,6 +13619,11 @@ pify@^4.0.1: resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== +pify@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-5.0.0.tgz#1f5eca3f5e87ebec28cc6d54a0e4aaf00acc127f" + integrity sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA== + pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" @@ -13667,6 +13866,11 @@ preact@10.4.1: resolved "https://registry.yarnpkg.com/preact/-/preact-10.4.1.tgz#9b3ba020547673a231c6cf16f0fbaef0e8863431" integrity sha512-WKrRpCSwL2t3tpOOGhf2WfTpcmbpxaWtDbdJdKdjd0aEiTkvOmS4NBkG6kzlaAHI9AkQ3iVqbFWM3Ei7mZ4o1Q== +preact@^10.5.9: + version "10.17.1" + resolved "https://registry.yarnpkg.com/preact/-/preact-10.17.1.tgz#0a1b3c658c019e759326b9648c62912cf5c2dde1" + integrity sha512-X9BODrvQ4Ekwv9GURm9AKAGaomqXmip7NQTZgY7gcNmr7XE83adOMJvd3N42id1tMFU7ojiynRsYnY6/BRFxLA== + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -13981,6 +14185,13 @@ qs@6.11.0: dependencies: side-channel "^1.0.4" +qs@^6.10.3: + version "6.11.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9" + integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA== + dependencies: + side-channel "^1.0.4" + qs@~6.10.3: version "6.10.5" resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.5.tgz#974715920a80ff6a262264acd2c7e6c2a53282b4" @@ -14701,6 +14912,11 @@ regenerator-runtime@^0.13.11, regenerator-runtime@^0.13.3: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== +regenerator-runtime@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" + integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA== + regexp.prototype.flags@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz#87cab30f80f66660181a3bb7bf5981a872b367ac" @@ -14986,6 +15202,19 @@ rpc-websockets@^7.5.0: bufferutil "^4.0.1" utf-8-validate "^5.0.2" +rpc-websockets@^7.5.1: + version "7.6.0" + resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-7.6.0.tgz#d3f4c0dac108ca35566b0e31552c32e58928cd04" + integrity sha512-Jgcs8q6t8Go98dEulww1x7RysgTkzpCMelVxZW4hvuyFtOGpeUz9prpr2KjUa/usqxgFCd9Tu3+yhHEP9GVmiQ== + dependencies: + "@babel/runtime" "^7.17.2" + eventemitter3 "^4.0.7" + uuid "^8.3.2" + ws "^8.5.0" + optionalDependencies: + bufferutil "^4.0.1" + utf-8-validate "^5.0.2" + rtcpeerconnection-shim@^1.2.15: version "1.2.15" resolved "https://registry.yarnpkg.com/rtcpeerconnection-shim/-/rtcpeerconnection-shim-1.2.15.tgz#e7cc189a81b435324c4949aa3dfb51888684b243" @@ -15222,6 +15451,13 @@ semver@^7.3.7: dependencies: lru-cache "^6.0.0" +semver@^7.3.8: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" + send@0.18.0: version "0.18.0" resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" @@ -15964,6 +16200,11 @@ superstruct@^0.15.4: resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-0.15.5.tgz#0f0a8d3ce31313f0d84c6096cd4fa1bfdedc9dab" integrity sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ== +superstruct@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-1.0.3.tgz#de626a5b49c6641ff4d37da3c7598e7a87697046" + integrity sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg== + supports-color@^5.3.0, supports-color@^5.5.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -16664,7 +16905,7 @@ util.promisify@1.0.0: define-properties "^1.1.2" object.getownpropertydescriptors "^2.0.3" -util@^0.12.0, util@^0.12.3, util@^0.12.5: +util@^0.12.0, util@^0.12.3, util@^0.12.4, util@^0.12.5: version "0.12.5" resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc" integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA== @@ -17282,7 +17523,7 @@ xregexp@2.0.0: resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-2.0.0.tgz#52a63e56ca0b84a7f3a5f3d61872f126ad7a5943" integrity sha512-xl/50/Cf32VsGq/1R8jJE5ajH1yMCQkpmoS10QbFZWl2Oor4H0Me64Pu2yxvsRWK3m6soJbmGfzSR7BYmDcWAA== -xtend@^4.0.0, xtend@~4.0.1: +xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== From 7561c8e927256adb965fe061c77d166e5293881f Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Thu, 24 Aug 2023 15:03:01 +0700 Subject: [PATCH 33/58] add cmt --- src/constants/connectors/evm.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index 7577726ff7..e4e12c31c5 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -30,7 +30,7 @@ export const [blocto, bloctoHooks] = initializeConnector( actions => new BloctoConnector({ actions, - options: { chainId: ChainId.ARBITRUM, rpc: NETWORKS_INFO[ChainId.ARBITRUM].defaultRpcUrl }, + options: { chainId: ChainId.ARBITRUM, rpc: NETWORKS_INFO[ChainId.ARBITRUM].defaultRpcUrl }, // todo namgold: change this to eth }), ) From 22efffd6dc2b99792eeab0e71f6f514caed6adea Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Thu, 24 Aug 2023 16:32:20 +0700 Subject: [PATCH 34/58] fix blocto networks --- src/constants/connectors/evm.ts | 3 +- src/constants/connectors/utils.ts | 3 -- src/constants/networks.ts | 8 ++++ src/constants/wallets.ts | 17 ------- src/hooks/web3/useChangeNetwork.ts | 56 ++++++++++++++-------- src/hooks/web3/useWalletSupportedChains.ts | 8 ++-- 6 files changed, 50 insertions(+), 45 deletions(-) diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index e4e12c31c5..65ddb2f23a 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -25,12 +25,11 @@ export const [gnosisSafe, gnosisSafeHooks] = initializeConnector(act export const [coin98, coin98Hooks] = initializeConnector(actions => new MetaMask({ actions })) export const [brave, braveHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [trustWallet, trustWalletHooks] = initializeConnector(actions => new MetaMask({ actions })) -export const [bloctoInjected, bloctoInjectedHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [blocto, bloctoHooks] = initializeConnector( actions => new BloctoConnector({ actions, - options: { chainId: ChainId.ARBITRUM, rpc: NETWORKS_INFO[ChainId.ARBITRUM].defaultRpcUrl }, // todo namgold: change this to eth + options: { chainId: ChainId.MATIC, rpc: NETWORKS_INFO[ChainId.MATIC].defaultRpcUrl }, }), ) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index 26fd00f947..e27d4bf738 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -30,8 +30,6 @@ export const getIsMetaMaskWallet = () => export const getIsRabbyWallet = () => Boolean(window.ethereum?.isRabby) -export const getIsBloctoWallet = () => Boolean(window.ethereum?.isBlocto) - export const getIsKrystalWallet = () => Boolean((window.ethereum?.isKrystalWallet || window.ethereum?.isKrystal) && !getIsTrustWallet()) @@ -55,7 +53,6 @@ export const getIsGenericInjector = () => !getIsC98Wallet() && !getIsRabbyWallet() && !getIsKrystalWallet() && - !getIsBloctoWallet() && !getIsTrustWallet() // https://eips.ethereum.org/EIPS/eip-1193#provider-errors diff --git a/src/constants/networks.ts b/src/constants/networks.ts index 22c3e92ae1..0db8e42b81 100644 --- a/src/constants/networks.ts +++ b/src/constants/networks.ts @@ -220,3 +220,11 @@ export const COMING_SOON_NETWORKS_FOR_MY_EARNINGS_CLASSIC: ChainId[] = [ ChainId.AURORA, ChainId.OASIS, ] +export const BLOCTO_SUPPORTED_NETWORKS: ChainId[] = [ + ChainId.MAINNET, + ChainId.ARBITRUM, + ChainId.OPTIMISM, + ChainId.MATIC, + ChainId.BSCMAINNET, + ChainId.AVAXMAINNET, +] diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index 0127d95696..4b8340c4cc 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -22,8 +22,6 @@ import INJECTED_LIGHT_ICON from 'assets/wallets/browser-wallet-light.svg' import { blocto, bloctoHooks, - bloctoInjected, - bloctoInjectedHooks, brave, braveHooks, coin98, @@ -54,7 +52,6 @@ import { solflareAdapter, } from 'constants/connectors/solana' import { - getIsBloctoWallet, getIsBraveWallet, getIsC98Wallet, getIsCoinbaseWallet, @@ -76,11 +73,6 @@ const detectMetamask = (): WalletReadyState => { return WalletReadyState.NotDetected } -const detectBloctoInjected = (): WalletReadyState => { - if (getIsBloctoWallet()) return WalletReadyState.Installed - return WalletReadyState.Unsupported -} - const detectBlocto = (): WalletReadyState => { return WalletReadyState.Installed } @@ -187,15 +179,6 @@ export const SUPPORTED_WALLETS = { installLink: 'https://www.blocto.io/download', readyState: detectBlocto, } as EVMWalletInfo, - BLOCTO_INJECTED: { - connector: bloctoInjected, - hooks: bloctoInjectedHooks, - name: 'Blocto Injected', - icon: BLOCTO, - iconLight: BLOCTO, - installLink: 'https://www.blocto.io/download', - readyState: detectBloctoInjected, - } as EVMWalletInfo, SAFE: { connector: gnosisSafe, hooks: gnosisSafeHooks, diff --git a/src/hooks/web3/useChangeNetwork.ts b/src/hooks/web3/useChangeNetwork.ts index 67ed9cf694..c46556bc04 100644 --- a/src/hooks/web3/useChangeNetwork.ts +++ b/src/hooks/web3/useChangeNetwork.ts @@ -132,30 +132,48 @@ export function useChangeNetwork() { blockExplorerUrls: [NETWORKS_INFO[desiredChainId].etherscanUrl], } console.info('Add new network', { addChainParameter }) - const activeProvider = library?.provider ?? window.ethereum - if (activeProvider && activeProvider.request) { - try { - await activeProvider.request({ - method: 'wallet_addEthereumChain', - params: [addChainParameter], - }) - wrappedSuccessCallback() - } catch (error) { - console.error('Add new network failed', { addChainParameter, error }) + try { + await connector.activate(addChainParameter) + } catch (error) { + if (didUserReject(error)) { failureCallback(desiredChainId, error, customFailureCallback, customTexts) - if (!didUserReject(error)) { - const e = new Error(`[Wallet] ${error.message}`) - e.name = 'Add new network Error' - e.stack = '' - captureException(e, { - level: 'warning', - extra: { error, wallet: walletEVM.walletKey, chainId, addChainParameter }, - }) + } else { + try { + const activeProvider = library?.provider ?? window.ethereum + if (activeProvider?.request) { + await activeProvider.request({ + method: 'wallet_addEthereumChain', + params: [addChainParameter], + }) + wrappedSuccessCallback() + } else { + throw error + } + } catch (error) { + console.error('Add new network failed', { addChainParameter, error }) + failureCallback(desiredChainId, error, customFailureCallback, customTexts) + if (!didUserReject(error)) { + const e = new Error(`[Wallet] ${error.message}`) + e.name = 'Add new network Error' + e.stack = '' + captureException(e, { + level: 'warning', + extra: { error, wallet: walletEVM.walletKey, chainId, addChainParameter }, + }) + } } } } }, - [library?.provider, chainId, failureCallback, fetchKyberswapConfig, successCallback, walletEVM.walletKey], + [ + library?.provider, + chainId, + failureCallback, + fetchKyberswapConfig, + successCallback, + walletEVM.walletKey, + connector, + ], ) const changeNetwork = useCallback( diff --git a/src/hooks/web3/useWalletSupportedChains.ts b/src/hooks/web3/useWalletSupportedChains.ts index c7c0077c0f..af8f8b2809 100644 --- a/src/hooks/web3/useWalletSupportedChains.ts +++ b/src/hooks/web3/useWalletSupportedChains.ts @@ -1,8 +1,8 @@ import { ChainId } from '@kyberswap/ks-sdk-core' import { WalletConnect as WalletConnectV2 } from '@web3-react/walletconnect-v2' -import { blocto, bloctoInjected, gnosisSafe, walletConnectV2 } from 'constants/connectors/evm' -import { SUPPORTED_NETWORKS } from 'constants/networks' +import { blocto, gnosisSafe, walletConnectV2 } from 'constants/connectors/evm' +import { BLOCTO_SUPPORTED_NETWORKS, SUPPORTED_NETWORKS } from 'constants/networks' import { useWeb3React } from 'hooks' function getChainsFromEIP155Accounts(accounts?: string[]): ChainId[] { @@ -24,9 +24,9 @@ export function useWalletSupportedChains(): ChainId[] { ...getChainsFromEIP155Accounts((connector as WalletConnectV2).provider?.session?.namespaces?.eip155?.accounts), ] case gnosisSafe: - case blocto: - case bloctoInjected: return chainId ? [chainId] : SUPPORTED_NETWORKS + case blocto: + return BLOCTO_SUPPORTED_NETWORKS default: return SUPPORTED_NETWORKS } From 5bf32fceb3778c76febc72a91e94abc1ebd383e0 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Thu, 24 Aug 2023 16:39:25 +0700 Subject: [PATCH 35/58] tooltip width --- src/components/Header/web3/NetworkModal/Networks.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/Header/web3/NetworkModal/Networks.tsx b/src/components/Header/web3/NetworkModal/Networks.tsx index 2d3e95e050..1d549d3239 100644 --- a/src/components/Header/web3/NetworkModal/Networks.tsx +++ b/src/components/Header/web3/NetworkModal/Networks.tsx @@ -172,7 +172,12 @@ const Networks = ({ ? walletEVM.walletKey : null return ( - + Date: Thu, 24 Aug 2023 18:59:39 +0700 Subject: [PATCH 36/58] try fix safe --- src/hooks/web3/useEagerConnect.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hooks/web3/useEagerConnect.ts b/src/hooks/web3/useEagerConnect.ts index bef23a9456..a852db9808 100644 --- a/src/hooks/web3/useEagerConnect.ts +++ b/src/hooks/web3/useEagerConnect.ts @@ -38,6 +38,7 @@ export function useEagerConnect() { try { await tryActivation('SAFE', true) activated = true + tried = true } catch {} const lastWalletKeyEVM = localStorage.getItem(LOCALSTORAGE_LAST_WALLETKEY_EVM) const lastWalletKeySolana = localStorage.getItem(LOCALSTORAGE_LAST_WALLETKEY_SOLANA) From a07d3a45f87063ed78442514a2ea9f8e4490e0d2 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Fri, 25 Aug 2023 00:58:59 +0700 Subject: [PATCH 37/58] eager with safe --- src/components/Web3ReactManager/index.tsx | 4 ++-- src/hooks/web3/useEagerConnect.ts | 19 ++++++++++--------- .../web3/useSyncNetworkParamWithStore.ts | 9 +++++---- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/components/Web3ReactManager/index.tsx b/src/components/Web3ReactManager/index.tsx index 8b66d41e37..dd4fe8f573 100644 --- a/src/components/Web3ReactManager/index.tsx +++ b/src/components/Web3ReactManager/index.tsx @@ -21,12 +21,12 @@ export default function Web3ReactManager({ children }: { children: JSX.Element } const dispatch = useDispatch() /** On user change network from wallet, update chainId in store, only work on EVM wallet */ useEffect(() => { - if (triedEager && chainIdEVM && chainIdState !== chainIdEVM && active && isEVM) { + if (triedEager.current && chainIdEVM && chainIdState !== chainIdEVM && active && isEVM) { dispatch(updateChainId(chainIdEVM)) } // Only run on change network from wallet // eslint-disable-next-line react-hooks/exhaustive-deps - }, [chainIdEVM, triedEager, active]) + }, [chainIdEVM, triedEager.current, active]) // on page load, do nothing until we've tried to connect to the injected connector if (isEVM && !triedEager) { diff --git a/src/hooks/web3/useEagerConnect.ts b/src/hooks/web3/useEagerConnect.ts index a852db9808..5cf46d6074 100644 --- a/src/hooks/web3/useEagerConnect.ts +++ b/src/hooks/web3/useEagerConnect.ts @@ -10,7 +10,7 @@ import useDisconnectWallet from './useDisconnectWallet' // make sure this hook will be ran only once globally let trying = false -let tried = false +const tried = { current: false } // global ref export function useEagerConnect() { const { active } = useWeb3React() const disconnect = useDisconnectWallet() @@ -19,7 +19,8 @@ export function useEagerConnect() { const { tryActivation } = useActivationWallet() const setTried = () => { - tried = true + tried.current = true + Object.freeze(tried) reRender({}) } @@ -32,13 +33,13 @@ export function useEagerConnect() { return } try { - if (trying || tried) return + if (trying || tried.current) return trying = true - let activated = false + let activatedSuccess = false try { await tryActivation('SAFE', true) - activated = true - tried = true + activatedSuccess = true + setTried() } catch {} const lastWalletKeyEVM = localStorage.getItem(LOCALSTORAGE_LAST_WALLETKEY_EVM) const lastWalletKeySolana = localStorage.getItem(LOCALSTORAGE_LAST_WALLETKEY_SOLANA) @@ -46,17 +47,17 @@ export function useEagerConnect() { (async () => { if (lastWalletKeyEVM) { await tryActivation(lastWalletKeyEVM, true) - activated = true + activatedSuccess = true } })(), (async () => { if (lastWalletKeySolana) { await tryActivation(lastWalletKeySolana) - activated = true + activatedSuccess = true } })(), ]) - if (!activated) { + if (!activatedSuccess) { if (isMobile && window.ethereum) { await tryActivation('INJECTED', true) } diff --git a/src/hooks/web3/useSyncNetworkParamWithStore.ts b/src/hooks/web3/useSyncNetworkParamWithStore.ts index 78d52492b1..1b24eb12ec 100644 --- a/src/hooks/web3/useSyncNetworkParamWithStore.ts +++ b/src/hooks/web3/useSyncNetworkParamWithStore.ts @@ -18,13 +18,14 @@ export function useSyncNetworkParamWithStore() { const location = useLocation() const [requestingNetwork, setRequestingNetwork] = useState() const triedSync = useRef(false) + const tried = triedEager.current useEffect(() => { if (!paramChainId) { triedSync.current = true return } - if (!triedEager) { + if (!tried) { return } @@ -46,7 +47,7 @@ export function useSyncNetworkParamWithStore() { } }) })() - }, [changeNetwork, location, navigate, networkInfo.route, networkParam, paramChainId, triedEager]) + }, [changeNetwork, location, navigate, networkInfo.route, networkParam, paramChainId, tried]) useEffect(() => { if (NETWORKS_INFO[chainId].route === requestingNetwork) setRequestingNetwork(undefined) @@ -61,12 +62,12 @@ export function useSyncNetworkParamWithStore() { networkParam && networkInfo.route !== networkParam && triedSync.current && - triedEager + tried ) { navigate( { ...location, pathname: location.pathname.replace(encodeURIComponent(networkParam), networkInfo.route) }, { replace: true }, ) } - }, [location, networkInfo.route, navigate, triedEager, networkParam, requestingNetwork]) + }, [location, networkInfo.route, navigate, tried, networkParam, requestingNetwork]) } From 3a1efa0e56f1f2e9071800a5000a7640b3e1ded6 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Fri, 25 Aug 2023 01:11:43 +0700 Subject: [PATCH 38/58] catch freeze --- src/hooks/web3/useEagerConnect.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hooks/web3/useEagerConnect.ts b/src/hooks/web3/useEagerConnect.ts index 5cf46d6074..fc4a7cbf26 100644 --- a/src/hooks/web3/useEagerConnect.ts +++ b/src/hooks/web3/useEagerConnect.ts @@ -19,8 +19,10 @@ export function useEagerConnect() { const { tryActivation } = useActivationWallet() const setTried = () => { - tried.current = true - Object.freeze(tried) + try { + tried.current = true + Object.freeze(tried) + } catch {} reRender({}) } From 4fb297c0a3739e2ba75fd8d8d166e391b3e1384b Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Fri, 25 Aug 2023 10:14:57 +0700 Subject: [PATCH 39/58] success callback after activate success --- src/hooks/web3/useChangeNetwork.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hooks/web3/useChangeNetwork.ts b/src/hooks/web3/useChangeNetwork.ts index c46556bc04..f36f084e33 100644 --- a/src/hooks/web3/useChangeNetwork.ts +++ b/src/hooks/web3/useChangeNetwork.ts @@ -134,6 +134,7 @@ export function useChangeNetwork() { console.info('Add new network', { addChainParameter }) try { await connector.activate(addChainParameter) + wrappedSuccessCallback() } catch (error) { if (didUserReject(error)) { failureCallback(desiredChainId, error, customFailureCallback, customTexts) From f26fdbc798f71ee0568cd52a87649ffc38241eeb Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Fri, 25 Aug 2023 11:55:49 +0700 Subject: [PATCH 40/58] disable select network if cant change --- src/components/Header/web3/SelectNetwork.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/Header/web3/SelectNetwork.tsx b/src/components/Header/web3/SelectNetwork.tsx index f3ecfd7ee1..cee6ad5043 100644 --- a/src/components/Header/web3/SelectNetwork.tsx +++ b/src/components/Header/web3/SelectNetwork.tsx @@ -7,6 +7,7 @@ import { ReactComponent as DropdownSvg } from 'assets/svg/down.svg' import Card from 'components/Card' import NetworkModal from 'components/Header/web3/NetworkModal' import Row from 'components/Row' +import { MouseoverTooltip } from 'components/Tooltip' import { TutorialIds } from 'components/Tutorial/TutorialSwap/constant' import { NativeCurrencies } from 'constants/tokens' import { useActiveWeb3React } from 'hooks' @@ -82,10 +83,11 @@ function SelectNetwork(): JSX.Element | null { return `${balanceFixed} ${NativeCurrencies[chainId].symbol}` }, [userEthBalance, chainId, networkInfo]) const walletSupportsChain = useWalletSupportedChains() + const disableSelectNetwork = walletSupportsChain.length <= 1 - return ( + const button = ( toggleNetworkModal()} + onClick={() => (disableSelectNetwork ? null : toggleNetworkModal())} role="button" id={TutorialIds.SELECT_NETWORK} data-testid="select-network" @@ -108,6 +110,11 @@ function SelectNetwork(): JSX.Element | null { /> ) + if (disableSelectNetwork) + return ( + {button} + ) + return button } export default SelectNetwork From 3ea4d9a7294ae0765c4208e3beb27d7a5fec9f11 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Fri, 25 Aug 2023 14:37:50 +0700 Subject: [PATCH 41/58] improve debug --- src/hooks/web3/useChangeNetwork.ts | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/hooks/web3/useChangeNetwork.ts b/src/hooks/web3/useChangeNetwork.ts index f36f084e33..fded9968d3 100644 --- a/src/hooks/web3/useChangeNetwork.ts +++ b/src/hooks/web3/useChangeNetwork.ts @@ -11,6 +11,7 @@ import { useActiveWeb3React, useWeb3React } from 'hooks' import { useNotify } from 'state/application/hooks' import { useAppDispatch } from 'state/hooks' import { updateChainId } from 'state/user/actions' +import { friendlyError } from 'utils/errorMessage' import { wait } from 'utils/retry' import { useLazyKyberswapConfig } from '../useKyberSwapConfig' @@ -150,16 +151,24 @@ export function useChangeNetwork() { } else { throw error } - } catch (error) { - console.error('Add new network failed', { addChainParameter, error }) - failureCallback(desiredChainId, error, customFailureCallback, customTexts) - if (!didUserReject(error)) { - const e = new Error(`[Wallet] ${error.message}`) + } catch (error2) { + console.error('Add new network failed', { addChainParameter, error: error2 }) + failureCallback(desiredChainId, error2, customFailureCallback, customTexts) + if (!didUserReject(error2)) { + const e = new Error(`[Add network] ${walletEVM.walletKey} ${friendlyError(error2.message)}`) e.name = 'Add new network Error' e.stack = '' captureException(e, { level: 'warning', - extra: { error, wallet: walletEVM.walletKey, chainId, addChainParameter }, + extra: { + wallet: walletEVM.walletKey, + chainId, + addChainParameter, + friendlyMessage1: friendlyError(error.message), + friendlyMessage2: friendlyError(error2.message), + rawError1: error, + rawError2: error2, + }, }) } } From 0364c0c213d07b31126e9ce77b5865b49f4ba94c Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Fri, 25 Aug 2023 15:37:59 +0700 Subject: [PATCH 42/58] fix krystal change wallet --- src/hooks/web3/useChangeNetwork.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/hooks/web3/useChangeNetwork.ts b/src/hooks/web3/useChangeNetwork.ts index fded9968d3..3341e12778 100644 --- a/src/hooks/web3/useChangeNetwork.ts +++ b/src/hooks/web3/useChangeNetwork.ts @@ -133,24 +133,24 @@ export function useChangeNetwork() { blockExplorerUrls: [NETWORKS_INFO[desiredChainId].etherscanUrl], } console.info('Add new network', { addChainParameter }) + try { - await connector.activate(addChainParameter) - wrappedSuccessCallback() + const activeProvider = library?.provider ?? window.ethereum + if (activeProvider?.request) { + await activeProvider.request({ + method: 'wallet_addEthereumChain', + params: [addChainParameter], + }) + wrappedSuccessCallback() + } else { + throw new Error('empty request function') + } } catch (error) { if (didUserReject(error)) { failureCallback(desiredChainId, error, customFailureCallback, customTexts) } else { try { - const activeProvider = library?.provider ?? window.ethereum - if (activeProvider?.request) { - await activeProvider.request({ - method: 'wallet_addEthereumChain', - params: [addChainParameter], - }) - wrappedSuccessCallback() - } else { - throw error - } + await connector.activate(addChainParameter) } catch (error2) { console.error('Add new network failed', { addChainParameter, error: error2 }) failureCallback(desiredChainId, error2, customFailureCallback, customTexts) From 1ec399a83cb65d64eb641cdaf0f9d68fad49e5c8 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Fri, 25 Aug 2023 16:58:29 +0700 Subject: [PATCH 43/58] add multiple prefered solutions to add new network --- src/hooks/web3/useChangeNetwork.ts | 93 ++++++++++++++++++------------ 1 file changed, 55 insertions(+), 38 deletions(-) diff --git a/src/hooks/web3/useChangeNetwork.ts b/src/hooks/web3/useChangeNetwork.ts index 3341e12778..5650808fc3 100644 --- a/src/hooks/web3/useChangeNetwork.ts +++ b/src/hooks/web3/useChangeNetwork.ts @@ -117,8 +117,9 @@ export function useChangeNetwork() { customFailureCallback?: (error: Error) => void, waitUtilUpdatedChainId = false, ) => { - const wrappedSuccessCallback = () => + const wrappedSuccessCallback = () => { successCallback(desiredChainId, waitUtilUpdatedChainId, customSuccessCallback) + } const { rpc } = customRpc ? { rpc: customRpc } : await fetchKyberswapConfig(desiredChainId) const addChainParameter = { @@ -132,48 +133,64 @@ export function useChangeNetwork() { }, blockExplorerUrls: [NETWORKS_INFO[desiredChainId].etherscanUrl], } - console.info('Add new network', { addChainParameter }) - try { - const activeProvider = library?.provider ?? window.ethereum - if (activeProvider?.request) { - await activeProvider.request({ - method: 'wallet_addEthereumChain', - params: [addChainParameter], - }) + enum Solution { + web3_react, + provider_request, + } + const solutions = { + [Solution.web3_react]: async () => await connector.activate(addChainParameter), + [Solution.provider_request]: async () => { + const activeProvider = library?.provider ?? window.ethereum + if (activeProvider?.request) { + await activeProvider.request({ + method: 'wallet_addEthereumChain', + params: [addChainParameter], + }) + } else { + throw new Error('empty request function') + } + }, + } + + let solutionPrefer = [solutions[Solution.provider_request], solutions[Solution.web3_react]] + if (walletEVM.walletKey === 'KRYSTAL') { + // Krystal break when call by web3-react + solutionPrefer = [solutions[Solution.provider_request]] + } else if (walletEVM.walletKey === 'BLOCTO') { + // Blocto break when call by provider.request + solutionPrefer = [solutions[Solution.web3_react]] + } + + const errors: Error[] = [] + for (let i = 0; i < solutionPrefer.length; i++) { + try { + await solutionPrefer[i]() wrappedSuccessCallback() - } else { - throw new Error('empty request function') - } - } catch (error) { - if (didUserReject(error)) { - failureCallback(desiredChainId, error, customFailureCallback, customTexts) - } else { - try { - await connector.activate(addChainParameter) - } catch (error2) { - console.error('Add new network failed', { addChainParameter, error: error2 }) - failureCallback(desiredChainId, error2, customFailureCallback, customTexts) - if (!didUserReject(error2)) { - const e = new Error(`[Add network] ${walletEVM.walletKey} ${friendlyError(error2.message)}`) - e.name = 'Add new network Error' - e.stack = '' - captureException(e, { - level: 'warning', - extra: { - wallet: walletEVM.walletKey, - chainId, - addChainParameter, - friendlyMessage1: friendlyError(error.message), - friendlyMessage2: friendlyError(error2.message), - rawError1: error, - rawError2: error2, - }, - }) - } + return + } catch (error) { + if (didUserReject(error)) { + failureCallback(desiredChainId, error, customFailureCallback, customTexts) + return } + errors.push(error) } } + + failureCallback(desiredChainId, errors.at(-1), customFailureCallback, customTexts) + const e = new Error(`[Add network] ${walletEVM.walletKey} ${friendlyError(errors.at(-1) || '')}`) + e.name = 'Add new network Error' + e.stack = '' + captureException(e, { + level: 'warning', + extra: { + wallet: walletEVM.walletKey, + chainId, + addChainParameter, + friendlyMessages: errors.map(friendlyError), + errors, + }, + }) }, [ library?.provider, From a86899ae85f90521bd53feeb6986a9fc432e5e9d Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Fri, 25 Aug 2023 16:58:48 +0700 Subject: [PATCH 44/58] fix detect rejected --- src/constants/connectors/utils.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index e27d4bf738..91b99c0fe3 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -79,9 +79,10 @@ const rejectedPhrases: string[] = ['user rejected transaction', 'user denied tra export function didUserReject(error: any): boolean { return ( - error?.code === ErrorCode.USER_REJECTED_REQUEST || - error?.code === ErrorCode.ACTION_REJECTED || - error?.code === ErrorCode.ALPHA_WALLET_REJECTED_CODE || + error?.code?.toString() === ErrorCode.USER_REJECTED_REQUEST.toString() || + error?.code?.toString() === ErrorCode.ACTION_REJECTED || + error?.code?.toString() === ErrorCode.ALPHA_WALLET_REJECTED_CODE.toString() || + error?.message?.toString() === ErrorCode.USER_REJECTED_REQUEST.toString() || error?.message === ErrorCode.ALPHA_WALLET_REJECTED || error?.message === ErrorCode.WALLETCONNECT_MODAL_CLOSED || error?.message === ErrorCode.WALLETCONNECT_CANCELED || From 28bed4f2dff66fca06584bcd8d688db59d884317 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Fri, 25 Aug 2023 16:59:04 +0700 Subject: [PATCH 45/58] fix eager connect key is overriden --- src/hooks/web3/useEagerConnect.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hooks/web3/useEagerConnect.ts b/src/hooks/web3/useEagerConnect.ts index fc4a7cbf26..7cd3bef043 100644 --- a/src/hooks/web3/useEagerConnect.ts +++ b/src/hooks/web3/useEagerConnect.ts @@ -38,13 +38,16 @@ export function useEagerConnect() { if (trying || tried.current) return trying = true let activatedSuccess = false + // must retrieve this before activate safe, or will be overriden to SAFE + const lastWalletKeyEVM = localStorage.getItem(LOCALSTORAGE_LAST_WALLETKEY_EVM) + const lastWalletKeySolana = localStorage.getItem(LOCALSTORAGE_LAST_WALLETKEY_SOLANA) + try { await tryActivation('SAFE', true) activatedSuccess = true setTried() } catch {} - const lastWalletKeyEVM = localStorage.getItem(LOCALSTORAGE_LAST_WALLETKEY_EVM) - const lastWalletKeySolana = localStorage.getItem(LOCALSTORAGE_LAST_WALLETKEY_SOLANA) + await Promise.all([ (async () => { if (lastWalletKeyEVM) { From 9980f169d78f1512a14eb87ae9d483e846ef0b1d Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Fri, 25 Aug 2023 17:08:25 +0700 Subject: [PATCH 46/58] improve reject detect --- src/constants/connectors/utils.ts | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index 91b99c0fe3..b0c89ff148 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -79,14 +79,24 @@ const rejectedPhrases: string[] = ['user rejected transaction', 'user denied tra export function didUserReject(error: any): boolean { return ( - error?.code?.toString() === ErrorCode.USER_REJECTED_REQUEST.toString() || - error?.code?.toString() === ErrorCode.ACTION_REJECTED || - error?.code?.toString() === ErrorCode.ALPHA_WALLET_REJECTED_CODE.toString() || - error?.message?.toString() === ErrorCode.USER_REJECTED_REQUEST.toString() || - error?.message === ErrorCode.ALPHA_WALLET_REJECTED || - error?.message === ErrorCode.WALLETCONNECT_MODAL_CLOSED || - error?.message === ErrorCode.WALLETCONNECT_CANCELED || - error?.message === ErrorCode.WALLETCONNECT_MODAL_CLOSED || + [ + ErrorCode.USER_REJECTED_REQUEST, + ErrorCode.CHAIN_NOT_ADDED, + ErrorCode.ACTION_REJECTED, + ErrorCode.ALPHA_WALLET_REJECTED_CODE, + ] + .map(String) + .includes(error?.code?.toString()) || + [ + ErrorCode.USER_REJECTED_REQUEST, + ErrorCode.CHAIN_NOT_ADDED, + ErrorCode.ALPHA_WALLET_REJECTED, + ErrorCode.WALLETCONNECT_MODAL_CLOSED, + ErrorCode.WALLETCONNECT_CANCELED, + ErrorCode.WALLETCONNECT_MODAL_CLOSED, + ] + .map(String) + .includes(error?.message?.toString()) || rejectedPhrases.some(phrase => error?.message?.toLowerCase?.()?.includes?.(phrase.toLowerCase())) ) } From ac66dfd3b1c3a6ff7890df3b8a144e232a4f7156 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Sat, 26 Aug 2023 23:21:38 +0700 Subject: [PATCH 47/58] improve message --- .../TransactionConfirmationModal/index.tsx | 2 +- src/constants/connectors/utils.ts | 15 +++++++++++---- src/pages/RemoveLiquidity/TokenPair.tsx | 2 +- src/utils/errorMessage.ts | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/components/TransactionConfirmationModal/index.tsx b/src/components/TransactionConfirmationModal/index.tsx index cf6ccc8e87..5b3a9aad75 100644 --- a/src/components/TransactionConfirmationModal/index.tsx +++ b/src/components/TransactionConfirmationModal/index.tsx @@ -260,7 +260,7 @@ export function TransactionErrorContent({ confirmText?: string }) { const theme = useTheme() - const [showDetail, setShowDetail] = useState(true) + const [showDetail, setShowDetail] = useState(false) return ( diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index b0c89ff148..817f516fbc 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -75,9 +75,16 @@ export enum ErrorCode { ALPHA_WALLET_REJECTED = 'Request rejected', } -const rejectedPhrases: string[] = ['user rejected transaction', 'user denied transaction', 'you must accept'] +const rejectedPhrases: readonly string[] = [ + 'user rejected transaction', + 'user denied transaction', + 'you must accept', +].map(phrase => phrase.toLowerCase()) export function didUserReject(error: any): boolean { + const message = ( + typeof error === 'string' ? error : error?.message || error?.code || error?.errorMessage || '' + ).toLowerCase() return ( [ ErrorCode.USER_REJECTED_REQUEST, @@ -86,7 +93,7 @@ export function didUserReject(error: any): boolean { ErrorCode.ALPHA_WALLET_REJECTED_CODE, ] .map(String) - .includes(error?.code?.toString()) || + .includes(error?.code?.toString?.()) || [ ErrorCode.USER_REJECTED_REQUEST, ErrorCode.CHAIN_NOT_ADDED, @@ -96,7 +103,7 @@ export function didUserReject(error: any): boolean { ErrorCode.WALLETCONNECT_MODAL_CLOSED, ] .map(String) - .includes(error?.message?.toString()) || - rejectedPhrases.some(phrase => error?.message?.toLowerCase?.()?.includes?.(phrase.toLowerCase())) + .includes(message) || + rejectedPhrases.some(phrase => message?.includes?.(phrase)) ) } diff --git a/src/pages/RemoveLiquidity/TokenPair.tsx b/src/pages/RemoveLiquidity/TokenPair.tsx index a1cf53837a..9e0b968a48 100644 --- a/src/pages/RemoveLiquidity/TokenPair.tsx +++ b/src/pages/RemoveLiquidity/TokenPair.tsx @@ -582,7 +582,7 @@ export default function TokenPair({ ) : ( strin getMessage: match => match[1], }, { pattern: /^([\w ]*\w+) \(.+?\)$/, getMessage: match => match[1] }, + { pattern: /"message": ?"[^"]+?"/, getMessage: match => match[1] }, ] function parseKnownRegexPattern(text: string): string | undefined { const pattern = patterns.find(pattern => pattern.pattern.exec(text)) From c3c52fbe56963e462279fc5d7e4f778b695ab7db Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Mon, 28 Aug 2023 10:26:58 +0700 Subject: [PATCH 48/58] fix crash string --- src/constants/connectors/utils.ts | 4 ++-- src/hooks/web3/useChangeNetwork.ts | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index 817f516fbc..897fcc75bb 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -82,8 +82,8 @@ const rejectedPhrases: readonly string[] = [ ].map(phrase => phrase.toLowerCase()) export function didUserReject(error: any): boolean { - const message = ( - typeof error === 'string' ? error : error?.message || error?.code || error?.errorMessage || '' + const message = String( + typeof error === 'string' ? error : error?.message || error?.code || error?.errorMessage || '', ).toLowerCase() return ( [ diff --git a/src/hooks/web3/useChangeNetwork.ts b/src/hooks/web3/useChangeNetwork.ts index 5650808fc3..f54e069298 100644 --- a/src/hooks/web3/useChangeNetwork.ts +++ b/src/hooks/web3/useChangeNetwork.ts @@ -153,14 +153,16 @@ export function useChangeNetwork() { }, } - let solutionPrefer = [solutions[Solution.provider_request], solutions[Solution.web3_react]] - if (walletEVM.walletKey === 'KRYSTAL') { - // Krystal break when call by web3-react - solutionPrefer = [solutions[Solution.provider_request]] - } else if (walletEVM.walletKey === 'BLOCTO') { - // Blocto break when call by provider.request - solutionPrefer = [solutions[Solution.web3_react]] - } + const solutionPrefer: readonly (() => Promise)[] = (() => { + if (walletEVM.walletKey === 'KRYSTAL') { + // Krystal break when call by web3-react .activate + return [solutions[Solution.provider_request]] + } else if (walletEVM.walletKey === 'BLOCTO') { + // Blocto break when call by provider.request + return [solutions[Solution.web3_react]] + } + return [solutions[Solution.provider_request], solutions[Solution.web3_react]] + })() const errors: Error[] = [] for (let i = 0; i < solutionPrefer.length; i++) { From cb756983e30f2c01ac3a9a881aadeca32e31abdc Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Mon, 28 Aug 2023 10:38:32 +0700 Subject: [PATCH 49/58] lint --- src/constants/connectors/utils.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index 897fcc75bb..eb00e5858b 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -94,16 +94,16 @@ export function didUserReject(error: any): boolean { ] .map(String) .includes(error?.code?.toString?.()) || - [ - ErrorCode.USER_REJECTED_REQUEST, - ErrorCode.CHAIN_NOT_ADDED, - ErrorCode.ALPHA_WALLET_REJECTED, - ErrorCode.WALLETCONNECT_MODAL_CLOSED, - ErrorCode.WALLETCONNECT_CANCELED, - ErrorCode.WALLETCONNECT_MODAL_CLOSED, - ] - .map(String) - .includes(message) || + ( + [ + ErrorCode.USER_REJECTED_REQUEST, + ErrorCode.CHAIN_NOT_ADDED, + ErrorCode.ALPHA_WALLET_REJECTED, + ErrorCode.WALLETCONNECT_MODAL_CLOSED, + ErrorCode.WALLETCONNECT_CANCELED, + ErrorCode.WALLETCONNECT_MODAL_CLOSED, + ].map(String) as ErrorCode[] + ).includes(message) || rejectedPhrases.some(phrase => message?.includes?.(phrase)) ) } From 0b7bdc1f293b6c2a08aab749ab2f697ca00723f9 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Mon, 28 Aug 2023 10:39:56 +0700 Subject: [PATCH 50/58] add rule rejected --- src/constants/connectors/utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index eb00e5858b..af10575218 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -77,6 +77,7 @@ export enum ErrorCode { const rejectedPhrases: readonly string[] = [ 'user rejected transaction', + 'User declined to send the transaction', 'user denied transaction', 'you must accept', ].map(phrase => phrase.toLowerCase()) From b212b64a75680f0957f1220b5b0d473101e9b7b2 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Mon, 28 Aug 2023 12:51:31 +0700 Subject: [PATCH 51/58] fix rejected --- src/constants/connectors/utils.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index af10575218..39d20b698f 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -87,18 +87,12 @@ export function didUserReject(error: any): boolean { typeof error === 'string' ? error : error?.message || error?.code || error?.errorMessage || '', ).toLowerCase() return ( - [ - ErrorCode.USER_REJECTED_REQUEST, - ErrorCode.CHAIN_NOT_ADDED, - ErrorCode.ACTION_REJECTED, - ErrorCode.ALPHA_WALLET_REJECTED_CODE, - ] + [ErrorCode.USER_REJECTED_REQUEST, ErrorCode.ACTION_REJECTED, ErrorCode.ALPHA_WALLET_REJECTED_CODE] .map(String) .includes(error?.code?.toString?.()) || ( [ ErrorCode.USER_REJECTED_REQUEST, - ErrorCode.CHAIN_NOT_ADDED, ErrorCode.ALPHA_WALLET_REJECTED, ErrorCode.WALLETCONNECT_MODAL_CLOSED, ErrorCode.WALLETCONNECT_CANCELED, From 07e59cccaab07b820cfc202c53e631adf3b867ac Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Mon, 28 Aug 2023 16:42:14 +0700 Subject: [PATCH 52/58] improve logs --- src/hooks/web3/useChangeNetwork.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/hooks/web3/useChangeNetwork.ts b/src/hooks/web3/useChangeNetwork.ts index f54e069298..a2b584de53 100644 --- a/src/hooks/web3/useChangeNetwork.ts +++ b/src/hooks/web3/useChangeNetwork.ts @@ -85,9 +85,8 @@ export function useChangeNetwork() { message = t`Your wallet not support chain ${NETWORKS_INFO[desiredChainId].name}` } else { message = error?.message || message - const e = new Error(`[Wallet] ${error.message}`) - e.name = 'Activate chain fail' - e.stack = '' + const e = new Error(`[Activate chain] ${walletEVM.walletKey} ${message}`) + e.name = 'Activate chain error' captureException(e, { level: 'warning', extra: { error, wallet: walletEVM.walletKey, chainId, desiredChainId, message }, @@ -172,9 +171,14 @@ export function useChangeNetwork() { return } catch (error) { if (didUserReject(error)) { + console.error('Add network rejected', JSON.stringify({ message: friendlyError(error) }, null, 2)) failureCallback(desiredChainId, error, customFailureCallback, customTexts) return } + console.error( + 'Add network error', + JSON.stringify({ i, message: friendlyError(error), error, addChainParameter }, null, 2), + ) errors.push(error) } } @@ -237,7 +241,10 @@ export function useChangeNetwork() { console.info('Switch network success', { desiredChainId }) changeNetworkHandler(desiredChainId, wrappedSuccessCallback) } catch (error) { - console.error('Switch network failed', { desiredChainId, error }) + console.error( + 'Switch network error', + JSON.stringify({ desiredChainId, error, didUserReject: didUserReject(error) }, null, 2), + ) // walletconnect v2 not support add network, so halt execution here if (didUserReject(error) || connector === walletConnectV2) { From 8258f72d156d43f4e48d968909ab022f2374f5e4 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Mon, 28 Aug 2023 18:28:19 +0700 Subject: [PATCH 53/58] improve logs --- src/hooks/web3/useChangeNetwork.ts | 66 ++++++++++++++++++------------ src/index.tsx | 1 + 2 files changed, 41 insertions(+), 26 deletions(-) diff --git a/src/hooks/web3/useChangeNetwork.ts b/src/hooks/web3/useChangeNetwork.ts index a2b584de53..f9f8437e99 100644 --- a/src/hooks/web3/useChangeNetwork.ts +++ b/src/hooks/web3/useChangeNetwork.ts @@ -134,8 +134,8 @@ export function useChangeNetwork() { } enum Solution { - web3_react, - provider_request, + web3_react = 'web3_react', + provider_request = 'provider_request', } const solutions = { [Solution.web3_react]: async () => await connector.activate(addChainParameter), @@ -152,33 +152,55 @@ export function useChangeNetwork() { }, } - const solutionPrefer: readonly (() => Promise)[] = (() => { + const solutionPrefer: readonly Solution[] = (() => { if (walletEVM.walletKey === 'KRYSTAL') { // Krystal break when call by web3-react .activate - return [solutions[Solution.provider_request]] + return [Solution.provider_request] } else if (walletEVM.walletKey === 'BLOCTO') { // Blocto break when call by provider.request - return [solutions[Solution.web3_react]] + return [Solution.web3_react] } - return [solutions[Solution.provider_request], solutions[Solution.web3_react]] + return [Solution.provider_request, Solution.web3_react] })() const errors: Error[] = [] for (let i = 0; i < solutionPrefer.length; i++) { try { - await solutionPrefer[i]() + console.info('[Add network] start:', { + wallet: walletEVM.walletKey, + solution: solutionPrefer[i], + addChainParameter, + }) + await solutions[solutionPrefer[i]]() + console.info('[Add network] success:', { + wallet: walletEVM.walletKey, + solution: solutionPrefer[i], + addChainParameter, + }) wrappedSuccessCallback() return } catch (error) { + console.error( + '[Add network] error:', + JSON.stringify( + { + wallet: walletEVM.walletKey, + desiredChainId, + solution: solutionPrefer[i], + message: friendlyError(error), + error, + addChainParameter, + didUserReject: didUserReject(error), + }, + null, + 2, + ), + ) + if (didUserReject(error)) { - console.error('Add network rejected', JSON.stringify({ message: friendlyError(error) }, null, 2)) failureCallback(desiredChainId, error, customFailureCallback, customTexts) return } - console.error( - 'Add network error', - JSON.stringify({ i, message: friendlyError(error), error, addChainParameter }, null, 2), - ) errors.push(error) } } @@ -188,25 +210,17 @@ export function useChangeNetwork() { e.name = 'Add new network Error' e.stack = '' captureException(e, { - level: 'warning', + level: 'error', extra: { wallet: walletEVM.walletKey, - chainId, + desiredChainId, addChainParameter, friendlyMessages: errors.map(friendlyError), errors, }, }) }, - [ - library?.provider, - chainId, - failureCallback, - fetchKyberswapConfig, - successCallback, - walletEVM.walletKey, - connector, - ], + [library?.provider, failureCallback, fetchKyberswapConfig, successCallback, walletEVM.walletKey, connector], ) const changeNetwork = useCallback( @@ -236,13 +250,13 @@ export function useChangeNetwork() { if (isEVM(desiredChainId)) { try { - console.info('Switch network', { desiredChainId }) + console.info('[Switch network] start:', { desiredChainId }) await connector.activate(desiredChainId) - console.info('Switch network success', { desiredChainId }) + console.info('[Switch network] success:', { desiredChainId }) changeNetworkHandler(desiredChainId, wrappedSuccessCallback) } catch (error) { console.error( - 'Switch network error', + '[Switch network] error:', JSON.stringify({ desiredChainId, error, didUserReject: didUserReject(error) }, null, 2), ) diff --git a/src/index.tsx b/src/index.tsx index b52945aefd..83d858d17d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -70,6 +70,7 @@ if (ENV_LEVEL > ENV_TYPE.LOCAL) { ignoreErrors: ['AbortError'], integrations: [new BrowserTracing()], tracesSampleRate: 0.1, + normalizeDepth: 5, }) Sentry.configureScope(scope => { scope.setTag('request_id', sentryRequestId) From 921adfec86785be0815b9ada4b0fe26cef6ef3ed Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 29 Aug 2023 10:27:59 +0700 Subject: [PATCH 54/58] disable blocto --- src/constants/connectors/utils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index 39d20b698f..0dc819fea1 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -41,6 +41,8 @@ export const getIsCoinbaseWallet = () => export const getIsBraveWallet = () => Boolean(checkForBraveBrowser() && window.ethereum?.isBraveWallet) +export const getIsBloctoWallet = () => Boolean(window.ethereum?.isBlocto) + export const getIsC98Wallet = () => Boolean(window.ethereum?.isCoin98 && window.coin98) export const getIsTrustWallet = () => Boolean(window.ethereum?.isTrustWallet || window.ethereum?.isTrust) @@ -52,6 +54,7 @@ export const getIsGenericInjector = () => !getIsBraveWallet() && !getIsC98Wallet() && !getIsRabbyWallet() && + !getIsBloctoWallet() && !getIsKrystalWallet() && !getIsTrustWallet() From c8bef78db363f1a947cd9e4c08228513f873ec01 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 29 Aug 2023 10:48:29 +0700 Subject: [PATCH 55/58] blocto injected --- src/constants/connectors/evm.ts | 3 ++- src/constants/wallets.ts | 26 ++++++++++++++++++---- src/hooks/web3/useWalletSupportedChains.ts | 3 ++- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index 65ddb2f23a..707ecef9d8 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -24,7 +24,7 @@ export const [metaMask, metamaskHooks] = initializeConnector(actions = export const [gnosisSafe, gnosisSafeHooks] = initializeConnector(actions => new GnosisSafe({ actions })) export const [coin98, coin98Hooks] = initializeConnector(actions => new MetaMask({ actions })) export const [brave, braveHooks] = initializeConnector(actions => new MetaMask({ actions })) -export const [trustWallet, trustWalletHooks] = initializeConnector(actions => new MetaMask({ actions })) +export const [trust, trustHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [blocto, bloctoHooks] = initializeConnector( actions => new BloctoConnector({ @@ -32,6 +32,7 @@ export const [blocto, bloctoHooks] = initializeConnector( options: { chainId: ChainId.MATIC, rpc: NETWORKS_INFO[ChainId.MATIC].defaultRpcUrl }, }), ) +export const [bloctoInject, bloctoInjectHooks] = initializeConnector(actions => new MetaMask({ actions })) const darkmode = Boolean(window.matchMedia('(prefers-color-scheme: dark)')) export const [walletConnectV2, walletConnectV2Hooks] = initializeConnector( diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index 4b8340c4cc..41b7a79354 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -22,6 +22,8 @@ import INJECTED_LIGHT_ICON from 'assets/wallets/browser-wallet-light.svg' import { blocto, bloctoHooks, + bloctoInject, + bloctoInjectHooks, brave, braveHooks, coin98, @@ -38,8 +40,8 @@ import { metamaskHooks, rabby, rabbyHooks, - trustWallet, - trustWalletHooks, + trust, + trustHooks, walletConnectV2, walletConnectV2Hooks, } from 'constants/connectors/evm' @@ -52,6 +54,7 @@ import { solflareAdapter, } from 'constants/connectors/solana' import { + getIsBloctoWallet, getIsBraveWallet, getIsC98Wallet, getIsCoinbaseWallet, @@ -74,9 +77,15 @@ const detectMetamask = (): WalletReadyState => { } const detectBlocto = (): WalletReadyState => { + if (getIsBloctoWallet()) return WalletReadyState.NotDetected return WalletReadyState.Installed } +const detectBloctoInjected = (): WalletReadyState => { + if (getIsBloctoWallet()) return WalletReadyState.Installed + return WalletReadyState.NotDetected +} + let isSafe = false const appsSdk = new SafeAppsSDK({}) ;(async () => { @@ -179,6 +188,15 @@ export const SUPPORTED_WALLETS = { installLink: 'https://www.blocto.io/download', readyState: detectBlocto, } as EVMWalletInfo, + BLOCTO_INJECTED: { + connector: bloctoInject, + hooks: bloctoInjectHooks, + name: 'Blocto', + icon: BLOCTO, + iconLight: BLOCTO, + installLink: 'https://www.blocto.io/download', + readyState: detectBloctoInjected, + } as EVMWalletInfo, SAFE: { connector: gnosisSafe, hooks: gnosisSafeHooks, @@ -274,8 +292,8 @@ export const SUPPORTED_WALLETS = { readyStateSolana: () => (isMobile ? WalletReadyState.Unsupported : slopeAdapter.readyState), } as SolanaWalletInfo, TRUST_WALLET: { - connector: trustWallet, - hooks: trustWalletHooks, + connector: trust, + hooks: trustHooks, name: 'Trust Wallet', icon: TRUSTWALLET, iconLight: TRUSTWALLET, diff --git a/src/hooks/web3/useWalletSupportedChains.ts b/src/hooks/web3/useWalletSupportedChains.ts index af8f8b2809..5817060ff2 100644 --- a/src/hooks/web3/useWalletSupportedChains.ts +++ b/src/hooks/web3/useWalletSupportedChains.ts @@ -1,7 +1,7 @@ import { ChainId } from '@kyberswap/ks-sdk-core' import { WalletConnect as WalletConnectV2 } from '@web3-react/walletconnect-v2' -import { blocto, gnosisSafe, walletConnectV2 } from 'constants/connectors/evm' +import { blocto, bloctoInject, gnosisSafe, walletConnectV2 } from 'constants/connectors/evm' import { BLOCTO_SUPPORTED_NETWORKS, SUPPORTED_NETWORKS } from 'constants/networks' import { useWeb3React } from 'hooks' @@ -26,6 +26,7 @@ export function useWalletSupportedChains(): ChainId[] { case gnosisSafe: return chainId ? [chainId] : SUPPORTED_NETWORKS case blocto: + case bloctoInject: return BLOCTO_SUPPORTED_NETWORKS default: return SUPPORTED_NETWORKS From 7cb7a484dbcc06b47778c3404ab5dfcfa56645ae Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 29 Aug 2023 11:12:12 +0700 Subject: [PATCH 56/58] revert env --- .github/workflows/pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 4c33edc8ab..4fc367b68b 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -114,7 +114,7 @@ jobs: VITE_TAG: ${{ needs.prepare.outputs.image_tag }} CURRENT_BRANCH: ${{ needs.prepare.outputs.current_branch }} NODE_OPTIONS: '--max_old_space_size=4096' - run: yarn build-prod # todo: revert + run: yarn build-adpr - name: Docker build and push uses: docker/build-push-action@v2 From 78f2809ffabece2f9953ced7c136e309247ccce4 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 29 Aug 2023 11:38:48 +0700 Subject: [PATCH 57/58] hide injected blocto --- src/constants/wallets.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index 41b7a79354..539017d106 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -83,7 +83,7 @@ const detectBlocto = (): WalletReadyState => { const detectBloctoInjected = (): WalletReadyState => { if (getIsBloctoWallet()) return WalletReadyState.Installed - return WalletReadyState.NotDetected + return WalletReadyState.Unsupported } let isSafe = false From 9a719e7183cbc6617d4bf7f3a6d149c06faaa06b Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 29 Aug 2023 12:17:57 +0700 Subject: [PATCH 58/58] fix tried eager --- src/components/Web3ReactManager/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Web3ReactManager/index.tsx b/src/components/Web3ReactManager/index.tsx index dd4fe8f573..fecea0a448 100644 --- a/src/components/Web3ReactManager/index.tsx +++ b/src/components/Web3ReactManager/index.tsx @@ -17,7 +17,7 @@ export default function Web3ReactManager({ children }: { children: JSX.Element } const triedEager = useEagerConnect() // when there's no account connected, react to logins (broadly speaking) on the injected provider, if it exists - useInactiveListener(!triedEager) + useInactiveListener(!triedEager.current) const dispatch = useDispatch() /** On user change network from wallet, update chainId in store, only work on EVM wallet */ useEffect(() => { @@ -29,7 +29,7 @@ export default function Web3ReactManager({ children }: { children: JSX.Element } }, [chainIdEVM, triedEager.current, active]) // on page load, do nothing until we've tried to connect to the injected connector - if (isEVM && !triedEager) { + if (isEVM && !triedEager.current) { return }