diff --git a/app.vue b/app.vue
index ef3f5a6d..ea43d67f 100644
--- a/app.vue
+++ b/app.vue
@@ -21,7 +21,7 @@ const { addProviderEvents, removeProviderEvents } =
const { disconnect } = useBaseProvider()
const { cacheValue } = useCache()
const { currencyList } = storeToRefs(useCurrencyStore())
-const { initProvider, reconnect } = useWalletConnectProvider()
+const { initProvider, connect } = useWalletConnectProvider()
const { formatMessage } = useIntl()
const { gridChainId, tempGrids } = storeToRefs(useGridStore())
@@ -35,13 +35,7 @@ const setupTranslations = () => {
* RPC - from RPC endpoint
*/
const setupWeb3Instances = async () => {
- // reconnect wallet connect
- if (isWalletConnect.value) {
- await initProvider()
- await reconnect()
- }
-
- // set injected provider
+ // set web3 for injected provider
if (INJECTED_PROVIDER) {
// for chain interactions through dapp
addWeb3(PROVIDERS.INJECTED, INJECTED_PROVIDER)
@@ -58,6 +52,12 @@ const setupWeb3Instances = async () => {
// expose web3 instance to global scope for console access
window.web3 = getWeb3(PROVIDERS.RPC)
}
+
+ // reconnect wallet connect
+ if (isWalletConnect.value) {
+ await initProvider()
+ await connect()
+ }
}
/**
@@ -108,7 +108,6 @@ const setupNetwork = async () => {
const network = useRouter().currentRoute.value.query?.network
if (!network) {
- await checkNetwork()
return
}
@@ -119,9 +118,6 @@ const setupNetwork = async () => {
if (gridChainId.value !== selectedChainId.value) {
tempGrids.value = {}
}
-
- gridChainId.value = selectedChainId.value
- await checkNetwork()
} else {
console.warn(
`Invalid network: ${network}, valid networks are ${SUPPORTED_NETWORK_IDS.join(
@@ -193,16 +189,20 @@ const resetDataProvider = () => {
}
onMounted(async () => {
- setupTranslations()
- setupNetwork()
- await setupWeb3Instances()
- checkConnectionExpiry()
- await setupConnectedProfile()
- resetDataProvider()
- isLoadedApp.value = true
- await setupCurrencies()
- window.scrollTo(0, 0)
- checkBuyLyx()
+ try {
+ setupTranslations()
+ setupNetwork()
+ await setupWeb3Instances()
+ checkConnectionExpiry()
+ await setupConnectedProfile()
+ resetDataProvider()
+ isLoadedApp.value = true
+ await setupCurrencies()
+ window.scrollTo(0, 0)
+ checkBuyLyx()
+ } catch (error) {
+ console.error(error)
+ }
})
onUnmounted(() => {
diff --git a/components/ModalTemplateConnectWallet.vue b/components/ModalTemplateConnectWallet.vue
index c1bf81a5..34e78e45 100644
--- a/components/ModalTemplateConnectWallet.vue
+++ b/components/ModalTemplateConnectWallet.vue
@@ -78,11 +78,11 @@ const handleToggleMobile = () => {
)
}}
-