mirror of
https://github.com/Instadapp/assembly.git
synced 2024-07-29 22:37:06 +00:00
hide network selector in gnosis safe
This commit is contained in:
parent
7bc988ed9e
commit
83b93dcf13
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="relative w-1/2 md:w-[178px]" v-click-outside="hide">
|
||||
<div v-if="!isGnosisSafe" class="relative w-1/2 md:w-[178px]" v-click-outside="hide">
|
||||
<button
|
||||
type="button"
|
||||
class="bg-primary-blue-dark hover:bg-primary-blue-hover relative w-full border border-primary-blue-border rounded pl-2.5 pr-10 py-1.5 text-left focus:outline-none focus:ring-1 focus:ring-[#0846E4] focus:border-[#0846E4] sm:text-sm"
|
||||
|
@ -102,13 +102,18 @@
|
|||
import { defineComponent, nextTick, ref } from '@nuxtjs/composition-api'
|
||||
import { useNetwork } from '~/composables/useNetwork'
|
||||
import { useTenderly } from '~/composables/useTenderly'
|
||||
import { useWeb3 } from '@instadapp/vue-web3'
|
||||
import { gnosisSafe } from '~/connectors'
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const show = ref(false)
|
||||
|
||||
const { connector } = useWeb3()
|
||||
const { networks, activeNetworkId, activeNetwork, checkForNetworkMismatch } = useNetwork()
|
||||
const { stopSimulation } = useTenderly()
|
||||
|
||||
const isGnosisSafe = computed(() => connector.value === gnosisSafe)
|
||||
|
||||
const setActiveNetwork = async networkId => {
|
||||
await stopSimulation()
|
||||
|
@ -129,6 +134,7 @@ export default defineComponent({
|
|||
activeNetwork,
|
||||
setActiveNetwork,
|
||||
activeNetworkId,
|
||||
isGnosisSafe,
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
@ -2,18 +2,23 @@ import { useWeb3 } from "@instadapp/vue-web3";
|
|||
import { injected } from "../connectors";
|
||||
import { onMounted, ref, watch } from "@nuxtjs/composition-api";
|
||||
import { SafeAppConnector } from "@gnosis.pm/safe-apps-web3-react";
|
||||
import { useNetwork } from "./useNetwork";
|
||||
|
||||
export function useSafeAppConnection(connector?: SafeAppConnector) {
|
||||
const { activate, active } = useWeb3();
|
||||
const { activeNetworkId} = useNetwork();
|
||||
|
||||
const tried = ref(false);
|
||||
|
||||
onMounted(() => {
|
||||
connector?.isSafeApp().then((loadedInSafe: boolean) => {
|
||||
connector?.isSafeApp().then(async (loadedInSafe: boolean) => {
|
||||
if (loadedInSafe) {
|
||||
activate(connector, undefined, true).catch(() => {
|
||||
await activate(connector, undefined, true).catch(() => {
|
||||
tried.value = true;
|
||||
});
|
||||
|
||||
//@ts-ignore
|
||||
activeNetworkId.value = await connector.getChainId()
|
||||
} else {
|
||||
tried.value = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user