diff --git a/app/+html.tsx b/app/+html.tsx
index eb12d94c8..b3e51b4bf 100644
--- a/app/+html.tsx
+++ b/app/+html.tsx
@@ -1,3 +1,4 @@
+// @ts-expect-error -- missing types
import { ScrollViewStyleReset } from "expo-router/html";
import React, { type ReactNode } from "react";
diff --git a/app/_layout.tsx b/app/_layout.tsx
index e16237ebd..f4059234d 100644
--- a/app/_layout.tsx
+++ b/app/_layout.tsx
@@ -1,8 +1,11 @@
import "expo-webauthn";
+import { AlchemyProvider } from "@alchemy/aa-alchemy";
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 { reconnect } from "@wagmi/core";
import { type FontSource, useFonts } from "expo-font";
import { Slot, SplashScreen } from "expo-router";
import { StatusBar } from "expo-status-bar";
@@ -10,14 +13,13 @@ import React, { useEffect } 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, custom } from "wagmi";
import metadata from "../package.json";
import tamaguiConfig from "../tamagui.config";
-import AlchemyConnector from "../utils/AlchemyConnector";
+import alchemyConnector from "../utils/alchemyConnector";
import { alchemyAPIKey, chain } from "../utils/constants";
+import handleError from "../utils/handleError";
export { ErrorBoundary } from "expo-router";
@@ -35,11 +37,13 @@ Sentry.init({
autoSessionTracking: true,
});
-const { publicClient, webSocketPublicClient } = configureChains(
- [chain],
- [alchemyAPIKey ? alchemyProvider({ apiKey: alchemyAPIKey }) : publicProvider()],
-);
-const wagmiConfig = createConfig({ connectors: [new AlchemyConnector()], publicClient, webSocketPublicClient });
+const provider = new AlchemyProvider({ apiKey: alchemyAPIKey, chain });
+const wagmiConfig = createConfig({
+ chains: [chain],
+ connectors: [alchemyConnector(provider)],
+ transports: { [chain.id]: custom(provider) },
+});
+const queryClient = new QueryClient();
export default function RootLayout() {
const [loaded, error] = useFonts({
@@ -53,6 +57,7 @@ export default function RootLayout() {
}, [error]);
useEffect(() => {
+ reconnect(wagmiConfig).catch(handleError);
if (loaded) SplashScreen.hideAsync().catch(() => {});
}, [loaded]);
@@ -62,9 +67,11 @@ export default function RootLayout() {
<>
-
-
-
+
+
+
+
+
>
);
diff --git a/app/index.tsx b/app/index.tsx
index 4f3ff44f9..23649efdd 100644
--- a/app/index.tsx
+++ b/app/index.tsx
@@ -4,23 +4,22 @@ 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";
+import { rpId, turnkeyAPIPrivateKey, turnkeyAPIPublicKey, turnkeyOrganizationId } from "../utils/constants";
import generateRandomBuffer from "../utils/generateRandomBuffer";
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}
-