diff --git a/app/_layout.tsx b/app/_layout.tsx
index e16237ebd..4241d3520 100644
--- a/app/_layout.tsx
+++ b/app/_layout.tsx
@@ -3,21 +3,20 @@ import "expo-webauthn";
import FontAwesome from "@expo/vector-icons/FontAwesome";
import InterBold from "@tamagui/font-inter/otf/Inter-Bold.otf";
import Inter from "@tamagui/font-inter/otf/Inter-Medium.otf";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { type FontSource, useFonts } from "expo-font";
import { Slot, SplashScreen } from "expo-router";
import { StatusBar } from "expo-status-bar";
-import React, { useEffect } from "react";
+import React, { useEffect, useState } from "react";
import * as Sentry from "sentry-expo";
import { TamaguiProvider } from "tamagui";
import { TextEncoder } from "text-encoding";
-import { WagmiConfig, configureChains, createConfig } from "wagmi";
-import { alchemyProvider } from "wagmi/providers/alchemy";
-import { publicProvider } from "wagmi/providers/public";
+import { WagmiProvider, createConfig, http } from "wagmi";
import metadata from "../package.json";
import tamaguiConfig from "../tamagui.config";
-import AlchemyConnector from "../utils/AlchemyConnector";
-import { alchemyAPIKey, chain } from "../utils/constants";
+import alchemyConnector from "../utils/alchemyConnector";
+import { chain, httpURL } from "../utils/constants";
export { ErrorBoundary } from "expo-router";
@@ -35,11 +34,12 @@ Sentry.init({
autoSessionTracking: true,
});
-const { publicClient, webSocketPublicClient } = configureChains(
- [chain],
- [alchemyAPIKey ? alchemyProvider({ apiKey: alchemyAPIKey }) : publicProvider()],
-);
-const wagmiConfig = createConfig({ connectors: [new AlchemyConnector()], publicClient, webSocketPublicClient });
+const wagmiConfig = createConfig({
+ chains: [chain],
+ connectors: [alchemyConnector()],
+ transports: { [chain.id]: http(httpURL) },
+});
+const queryClient = new QueryClient();
export default function RootLayout() {
const [loaded, error] = useFonts({
@@ -47,24 +47,28 @@ export default function RootLayout() {
InterBold: InterBold as FontSource,
...FontAwesome.font,
});
+ const [mounted, setMounted] = useState(false);
useEffect(() => {
if (error) throw error;
}, [error]);
useEffect(() => {
+ setMounted(true);
if (loaded) SplashScreen.hideAsync().catch(() => {});
}, [loaded]);
- if (!loaded) return;
+ if (!loaded || !mounted) return;
return (
<>
-
-
-
+
+
+
+
+
>
);
diff --git a/app/index.tsx b/app/index.tsx
index 4f3ff44f9..d7f5e02e3 100644
--- a/app/index.tsx
+++ b/app/index.tsx
@@ -4,7 +4,7 @@ import { deviceName } from "expo-device";
import React, { useCallback } from "react";
import { Button, Spinner, Text, XStack, YStack } from "tamagui";
import { UAParser } from "ua-parser-js";
-import { useAccount, useConnect, useDisconnect, usePrepareSendTransaction, useSendTransaction } from "wagmi";
+import { useAccount, useConnect, useDisconnect, useSendTransaction } from "wagmi";
import base64URLEncode from "../utils/base64URLEncode";
import { rpId, turnkeyAPIPublicKey, turnkeyAPIPrivateKey, turnkeyOrganizationId } from "../utils/constants";
@@ -14,13 +14,12 @@ import handleError from "../utils/handleError";
export default function Home() {
const {
connect,
- isLoading: isConnecting,
+ isPending: isConnecting,
connectors: [connector],
} = useConnect();
const { address } = useAccount();
const { disconnect } = useDisconnect();
- const { config: sendConfig } = usePrepareSendTransaction({ to: "0xE72185a9f4Ce3500d6dC7CCDCfC64cf66D823bE8" });
- const { sendTransaction, data: txHash, isLoading: isSending } = useSendTransaction(sendConfig);
+ const { sendTransaction, data: txHash, isPending: isSending } = useSendTransaction();
const createAccount = useCallback(() => {
const name = `exactly, ${new Date().toISOString()}`;
@@ -81,6 +80,7 @@ export default function Home() {
}, []);
const connectAccount = useCallback(() => {
+ if (!connector) throw new Error("no connector");
connect({ connector });
}, [connect, connector]);
@@ -89,7 +89,7 @@ export default function Home() {
}, [disconnect]);
const send = useCallback(() => {
- sendTransaction?.();
+ sendTransaction({ to: "0xE72185a9f4Ce3500d6dC7CCDCfC64cf66D823bE8" });
}, [sendTransaction]);
return (
@@ -97,7 +97,7 @@ export default function Home() {
{txHash}
-