Skip to content

Commit

Permalink
Fixes after Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutoshpw committed Nov 4, 2024
1 parent d2dce05 commit 85bb729
Show file tree
Hide file tree
Showing 3 changed files with 291 additions and 75 deletions.
96 changes: 48 additions & 48 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,59 +101,59 @@ const App: React.FC = () => {
}}
>
<WagmiProvider config={wagmiConfig}>
<TanStackQueryClientProvider client={tsQueryClient}>
<QueryClientProvider client={queryClient}>
<ActionSheetProvider>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<Box bgcolor="primary.dark" position="absolute" width="100%">
<Router>
<ScrollToTop />
<Switch>
<Route path="/creator">
<CreatorProvider>
<ThemeProvider theme={legacyTheme}>
<DAOCreatorRouter />
</ThemeProvider>
</CreatorProvider>
{/* <WarningFooter
{/* <TanStackQueryClientProvider client={tsQueryClient}> */}
<QueryClientProvider client={queryClient}>
<ActionSheetProvider>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<Box bgcolor="primary.dark" position="absolute" width="100%">
<Router>
<ScrollToTop />
<Switch>
<Route path="/creator">
<CreatorProvider>
<ThemeProvider theme={legacyTheme}>
<DAOCreatorRouter />
</ThemeProvider>
</CreatorProvider>
{/* <WarningFooter
text={
"The Homebase contract can't transfer FA1.2 tokens. Please make sure any and all tokens you send to the DAO treasury are implementing the FA2 standard."
}
/> */}
</Route>
<Route path="/lite">
<ThemeProvider theme={legacyTheme}>
<CommunityCreator />
</ThemeProvider>
</Route>
<Route path="/explorer">
<TZKTSubscriptionsProvider>
<DAOExplorerRouter />
</TZKTSubscriptionsProvider>
</Route>
<Route path="/lite">
<ThemeProvider theme={legacyTheme}>
<CommunityCreator />
</ThemeProvider>
</Route>
<Route path="/explorer">
<TZKTSubscriptionsProvider>
<DAOExplorerRouter />
</TZKTSubscriptionsProvider>

{window.location.href.indexOf(HUMANITEZ_DAO) !== -1 ? (
<>
{/* Special case for this DAO which was created before FA1.2 fix was created for the smart contract */}
<WarningFooter
text={
"The Homebase contract can't transfer FA1.2 tokens. Please make sure any and all tokens you send to the DAO treasury are implementing the FA2 standard."
}
/>
</>
) : null}
<ExplorerFooter></ExplorerFooter>
</Route>
<Route path="/faq">
<FAQ />
</Route>
<Redirect to="/explorer" />
</Switch>
</Router>
</Box>
</LocalizationProvider>
</ActionSheetProvider>
</QueryClientProvider>
</TanStackQueryClientProvider>
{window.location.href.indexOf(HUMANITEZ_DAO) !== -1 ? (
<>
{/* Special case for this DAO which was created before FA1.2 fix was created for the smart contract */}
<WarningFooter
text={
"The Homebase contract can't transfer FA1.2 tokens. Please make sure any and all tokens you send to the DAO treasury are implementing the FA2 standard."
}
/>
</>
) : null}
<ExplorerFooter></ExplorerFooter>
</Route>
<Route path="/faq">
<FAQ />
</Route>
<Redirect to="/explorer" />
</Switch>
</Router>
</Box>
</LocalizationProvider>
</ActionSheetProvider>
</QueryClientProvider>
{/* </TanStackQueryClientProvider> */}
</WagmiProvider>
</SnackbarProvider>
</ThemeProvider>
Expand Down
28 changes: 15 additions & 13 deletions src/services/beacon/hooks/useTezos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import mixpanel from "mixpanel-browser"
import { BeaconWallet } from "@taquito/beacon-wallet"
import { EtherlinkContext } from "services/wagmi/context"
import { useNetwork } from "services/useNetwork"
import { useChainId } from "wagmi"

type WalletConnectReturn = {
tezos: TezosToolkit
Expand Down Expand Up @@ -36,14 +37,6 @@ export const useTezos = (): WalletConnectReturn => {
network: etherlinkNetwork
} = useContext(EtherlinkContext)

const chainId = useChainId()
const { address: ethAddress, isConnected } = useWagmiAccount()
const { connect: wagmiConnect, connectors } = useWagmiConnect()
// eslint-disable-next-line react-hooks/exhaustive-deps
const openEthWallet = () => {
wagmiConnect({ connector: connectors[0], chainId })
}

const queryClient = useQueryClient()

const handleEtherlinkNetworkChange = useCallback(
Expand All @@ -59,7 +52,7 @@ export const useTezos = (): WalletConnectReturn => {
}
})
},
[ethAccount?.address, dispatch, tezos, etherlinkNetwork, connectWithWagmi]
[dispatch, tezos]
)

const handleTezosNetworkChange = useCallback(
Expand Down Expand Up @@ -136,7 +129,7 @@ export const useTezos = (): WalletConnectReturn => {

return newTezos
},
[connectWithWagmi, network, dispatch]
[network, dispatch]
)

useEffect(() => {
Expand All @@ -163,11 +156,20 @@ export const useTezos = (): WalletConnectReturn => {
type: TezosActionType.RESET_TEZOS
})
}
}, [network, etherlinkNetwork, handleChangeNetwork, isEtherlinkConnected])
}, [
network,
etherlinkNetwork,
handleChangeNetwork,
isEtherlinkConnected,
wallet,
switchToNetwork,
dispatch,
disconnectEtherWallet
])

useEffect(() => {
setNetwork(network)
}, [network])
}, [network, setNetwork])

return {
tezos,
Expand Down Expand Up @@ -198,7 +200,7 @@ export const useTezos = (): WalletConnectReturn => {
dispatch({
type: TezosActionType.RESET_TEZOS
})
}, [dispatch, network, wallet, isEtherlinkConnected]),
}, [network, wallet, isEtherlinkConnected, dispatch, disconnectEtherWallet]),

changeNetwork: handleChangeNetwork,
account,
Expand Down
Loading

0 comments on commit 85bb729

Please sign in to comment.