Skip to content

Commit

Permalink
Update expo 49 -> 50 (daimo-eth#820)
Browse files Browse the repository at this point in the history
* Update expo to 50 and run ios app

* Update android projects

* Check if res.rowCount exists

* Make web successfull build at any cost ;-;

* Fix typescript version

* Update types/react

* Im sorry idk any better rn

* trpc v11 for react 18 support, rebase master

* Update package-lock

* Fix sharp

* Some ts-ignore in daimo-api

* eas: use node 21, JDK 17 image

* typecheck API

* api: fix types

---------

Co-authored-by: Nalin Bhardwaj <[email protected]>
  • Loading branch information
wojtus7 and nalinbhardwaj authored Mar 20, 2024
1 parent 9de0595 commit 9aad9e4
Show file tree
Hide file tree
Showing 35 changed files with 15,340 additions and 9,903 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ git clone [email protected]:daimo-eth/daimo --recurse-submodules
Build the app.

```sh
node --version # ensure you have node 20+
node --version # ensure you have node 21+
npm i
npm run build
```
Expand Down
5 changes: 2 additions & 3 deletions apps/daimo-bot/api/trpcClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { AppRouter } from "@daimo/api";
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";
import { createTRPCClient, httpBatchLink } from "@trpc/client";

const BASE_CHAIN_ID = "8453";
const BASE_SEPOLIA_CHAIN_ID = "84532";
Expand All @@ -11,8 +11,7 @@ function getApiUrl() {
return `${url}/chain/${BASE_SEPOLIA_CHAIN_ID}` as const;
}

// @ts-expect-error: non-blocking AppRouter TypeError. types still populate
export const trpcClient = createTRPCProxyClient<AppRouter>({
export const trpcClient = createTRPCClient<AppRouter>({
links: [
httpBatchLink({
url: getApiUrl(),
Expand Down
6 changes: 3 additions & 3 deletions apps/daimo-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"@daimo/api": "*",
"@daimo/common": "*",
"@neynar/nodejs-sdk": "^1.12.0",
"@trpc/client": "^10.43.2",
"@trpc/server": "^10.43.2",
"@trpc/client": "^11.0.0-next-beta.318",
"@trpc/server": "^11.0.0-next-beta.318",
"@tsconfig/node20": "^20.1.0",
"axios": "^1.6.7",
"body-parser": "^1.20.2",
Expand All @@ -31,6 +31,6 @@
"ts-jest": "^29.1.2",
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
"typescript": "5.2.2"
"typescript": "^5.3.0"
}
}
2 changes: 1 addition & 1 deletion apps/daimo-mobile/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo", "module:metro-react-native-babel-preset"],
presets: ["babel-preset-expo"],
plugins: [
"react-native-reanimated/plugin",
"transform-inline-environment-variables",
Expand Down
26 changes: 14 additions & 12 deletions apps/daimo-mobile/eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,46 @@
"appVersionSource": "remote"
},
"build": {
"base": {
"resourceClass": "large",
"node": "21.2.0",
"android": {
"image": "ubuntu-22.04-jdk-17-ndk-r21e"
},
"env": {
"DAIMO_DOMAIN": "daimo.com",
"DAIMO_PASSKEY_DOMAIN": "daimo.com"
}
},
"sim": {
"node": "20.3.0",
"extends": "base",
"ios": {
"buildConfiguration": "Debug",
"resourceClass": "large",
"simulator": true
},
"env": {
"DAIMO_DOMAIN": "daimo.com",
"DAIMO_PASSKEY_DOMAIN": "daimo.com",
"DAIMO_APP_VARIANT": "sim"
}
},
"dev": {
"extends": "base",
"distribution": "internal",
"resourceClass": "large",
"node": "20.3.0",
"android": {
"gradleCommand": ":app:assembleDebug"
},
"ios": {
"buildConfiguration": "Debug"
},
"env": {
"DAIMO_DOMAIN": "daimo.com",
"DAIMO_PASSKEY_DOMAIN": "daimo.com",
"DAIMO_APP_VARIANT": "dev"
}
},
"production": {
"resourceClass": "large",
"node": "20.3.0",
"extends": "base",
"autoIncrement": true,
"env": {
"DAIMO_APP_API_URL_MAINNET": "https://daimo-api-prod.onrender.com",
"DAIMO_APP_API_URL_TESTNET": "https://daimo-api-testnet.onrender.com",
"DAIMO_DOMAIN": "daimo.com",
"DAIMO_PASSKEY_DOMAIN": "daimo.com",
"DAIMO_APP_VARIANT": "prod"
}
}
Expand Down
73 changes: 36 additions & 37 deletions apps/daimo-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,66 +39,65 @@
"@expo/config": "^8.5.4",
"@expo/config-plugins": "^7.2.5",
"@expo/ngrok": "^4.1.0",
"@expo/vector-icons": "^13.0.0",
"@gorhom/bottom-sheet": "^4",
"@expo/vector-icons": "^14.0.0",
"@gorhom/bottom-sheet": "^4.6.1",
"@react-native-segmented-control/segmented-control": "2.4.1",
"@react-navigation/bottom-tabs": "^6.5.14",
"@react-navigation/native": "^6.1.6",
"@react-navigation/native-stack": "^6.9.12",
"@react-navigation/stack": "^6.3.20",
"@scure/base": "^1.1.3",
"@tanstack/react-query": "^4.36.1",
"@trpc/client": "^10.43.2",
"@trpc/react-query": "^10.43.2",
"@tanstack/react-query": "^5.28.4",
"@trpc/client": "^11.0.0-next-beta.318",
"@trpc/react-query": "^11.0.0-next-beta.318",
"@types/jest": "^29.5.2",
"@types/react": "^18.2.15",
"@types/react": "~18.2.45",
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
"cbor": "^9.0.1",
"cbor-rn-prereqs": "^9.0.0",
"depcheck": "^1.4.3",
"eslint": "^8.44.0",
"eslint-config-universe": "^11.3.0",
"expo": "^49.0.7",
"expo-application": "^5.1.1",
"expo-av": "~13.4.1",
"expo-barcode-scanner": "^12.3.2",
"expo-build-properties": "~0.8.3",
"expo-clipboard": "~4.3.1",
"expo-contacts": "^12.4.0",
"expo-crypto": "^12.6.0",
"expo-dev-client": "~2.4.8",
"expo-device": "^5.2.1",
"expo-file-system": "~15.4.5",
"expo": "^50.0.11",
"expo-application": "~5.8.3",
"expo-av": "^13.10.5",
"expo-barcode-scanner": "~12.9.3",
"expo-build-properties": "~0.11.1",
"expo-clipboard": "~5.0.1",
"expo-contacts": "~12.8.2",
"expo-crypto": "~12.8.1",
"expo-dev-client": "~3.3.9",
"expo-device": "~5.9.3",
"expo-file-system": "~16.0.8",
"expo-font": "^11.4.0",
"expo-haptics": "~12.4.0",
"expo-image": "~1.3.5",
"expo-linking": "~5.0.2",
"expo-local-authentication": "~13.4.1",
"expo-localization": "^14.3.0",
"expo-notifications": "^0.20.1",
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "~1.6.0",
"expo-system-ui": "~2.4.0",
"expo-haptics": "~12.8.1",
"expo-image": "^1.10.6",
"expo-linking": "~6.2.2",
"expo-local-authentication": "~13.8.0",
"expo-localization": "~14.8.3",
"expo-notifications": "~0.27.6",
"expo-splash-screen": "~0.26.4",
"expo-status-bar": "~1.11.1",
"expo-system-ui": "~2.9.3",
"jest": "^29.5.0",
"jest-expo": "^49.0.0",
"jest-expo": "~50.0.3",
"react": "18.2.0",
"react-error-boundary": "^4.0.12",
"react-native": "0.72.4",
"react-native": "0.73.4",
"react-native-email-link": "^1.15.0",
"react-native-gesture-handler": "~2.12.0",
"react-native-get-random-values": "~1.9.0",
"react-native-gesture-handler": "~2.14.0",
"react-native-get-random-values": "~1.8.0",
"react-native-mmkv": "^2.8.0",
"react-native-qrcode-svg": "^6.2.0",
"react-native-reanimated": "~3.3.0",
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "^3.27.0",
"react-native-shake": "^5.5.2",
"react-native-svg": "13.9.0",
"react-native-url-polyfill": "^2.0.0",
"react-native-reanimated": "~3.6.2",
"react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.29.0",
"react-native-shake": "^5.6.0",
"react-native-svg": "14.1.0",
"stream-browserify": "^3.0.0",
"text-encoding-polyfill": "^0.6.7",
"ts-unused-exports": "^9.0.4",
"typescript": "5.2.2",
"typescript": "^5.3.0",
"viem": "^1.19.15"
},
"eslintConfig": {
Expand Down
16 changes: 5 additions & 11 deletions apps/daimo-mobile/src/logic/trpc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { AppRouter } from "@daimo/api";
import { assert } from "@daimo/common";
import { DaimoChain } from "@daimo/contract";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";
import { createTRPCClient, httpBatchLink } from "@trpc/client";
import { createTRPCReact } from "@trpc/react-query";
import { nativeApplicationVersion, nativeBuildVersion } from "expo-application";
import { ReactNode, createContext } from "react";
Expand All @@ -20,10 +20,7 @@ const apiUrlMainnetWithChain = `${apiUrlM}/chain/8453`;
function createRpcHook() {
const reactQueryContext = createContext<QueryClient | undefined>(undefined);
return {
trpc: createTRPCReact<AppRouter>({
context: createContext(null),
reactQueryContext,
}),
trpc: createTRPCReact<AppRouter>({}),
reactQueryContext,
queryClient: new QueryClient({
defaultOptions: {
Expand Down Expand Up @@ -126,8 +123,8 @@ const rpcHookTestnetClient = rpcHookTestnet.trpc.createClient(optsTestnet);

type RpcClient = typeof rpcHookMainnetClient | typeof rpcHookTestnetClient;

const rpcFuncMainnet = createTRPCProxyClient<AppRouter>(optsMainnet);
const rpcFuncTestnet = createTRPCProxyClient<AppRouter>(optsTestnet);
const rpcFuncMainnet = createTRPCClient<AppRouter>(optsMainnet);
const rpcFuncTestnet = createTRPCClient<AppRouter>(optsTestnet);

export function getRpcFunc(daimoChain: DaimoChain) {
return chooseChain({
Expand Down Expand Up @@ -157,10 +154,7 @@ function ChainRpcProvider({
}) {
return (
<rpcHook.trpc.Provider queryClient={rpcHook.queryClient} client={rpcClient}>
<QueryClientProvider
client={rpcHook.queryClient}
context={rpcHook.reactQueryContext}
>
<QueryClientProvider client={rpcHook.queryClient}>
{children}
</QueryClientProvider>
</rpcHook.trpc.Provider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
TouchableHighlight,
View,
} from "react-native";
import "react-native-url-polyfill/auto";

import { WithdrawScreen } from "./WithdrawScreen";
import { useNav } from "../../../common/nav";
Expand Down
16 changes: 8 additions & 8 deletions apps/daimo-testbed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
},
"dependencies": {
"@babel/core": "^7.20.0",
"@types/react": "^18.2.15",
"@daimo/contract": "*",
"@daimo/expo-enclave": "*",
"@daimo/userop": "*",
"@daimo/contract": "*",
"@ethersproject/shims": "^5.7.0",
"expo": "^49.0.7",
"expo-build-properties": "~0.8.3",
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "~1.6.0",
"@types/react": "~18.2.45",
"expo": "^50.0.11",
"expo-build-properties": "~0.11.1",
"expo-splash-screen": "~0.26.4",
"expo-status-bar": "~1.11.1",
"fast-text-encoding": "^1.0.6",
"react": "18.2.0",
"react-native": "0.72.4",
"typescript": "5.2.2"
"react-native": "0.73.4",
"typescript": "^5.3.0"
}
}
10 changes: 5 additions & 5 deletions apps/daimo-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"@headlessui/react": "^1.7.18",
"@lifi/widget": "^2.9.0",
"@rainbow-me/rainbowkit": "^1.1.1",
"@tanstack/react-query": "^4.36.1",
"@trpc/client": "^10.43.2",
"@trpc/react-query": "^10.43.2",
"@trpc/server": "^10.43.2",
"@types/react": "^18.2.15",
"@tanstack/react-query": "^5.28.4",
"@trpc/client": "^11.0.0-next-beta.318",
"@trpc/react-query": "^11.0.0-next-beta.318",
"@trpc/server": "^11.0.0-next-beta.318",
"@types/react": "~18.2.45",
"@types/react-dom": "^18.2.7",
"@vercel/og": "^0.6.2",
"autoprefixer": "^10.4.14",
Expand Down
4 changes: 2 additions & 2 deletions apps/daimo-web/src/app/pos/PointOfSalePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ function NewOrderForm({
<button
className="bg-grayLight rounded-lg p-4 flex flex-col items-center disabled:opacity-25"
onClick={placeOrder}
disabled={mut.isLoading || mut.isSuccess || order.length === 0}
disabled={mut.isPending || mut.isSuccess || order.length === 0}
>
<TextH1>Place Order</TextH1>
</button>
<Spacer h={8} />
<center>
{mut.isIdle && <TextBold>&nbsp;</TextBold>}
{mut.isLoading && <TextBold>...</TextBold>}
{mut.isPending && <TextBold>...</TextBold>}
{mut.isSuccess && <TextBold>✅ ordered</TextBold>}
{mut.isError && <TextBold>{mut.error.message}</TextBold>}
</center>
Expand Down
6 changes: 3 additions & 3 deletions apps/daimo-web/src/utils/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { AppRouter } from "@daimo/api";
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";
import { AppRouter } from "@daimo/api";
import { createTRPCClient, httpBatchLink } from "@trpc/client";

import { chainConfig } from "../env";

const apiUrl = process.env.NEXT_PUBLIC_DAIMO_API_URL || "http://localhost:3000";
export const apiUrlWithChain = `${apiUrl}/chain/${chainConfig.chainL2.id}`;

export const rpc = createTRPCProxyClient<AppRouter>({
export const rpc = createTRPCClient<AppRouter>({
links: [httpBatchLink({ url: apiUrlWithChain })],
});
10 changes: 2 additions & 8 deletions apps/daimo-web/src/utils/rpcHook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import { apiUrlWithChain } from "./rpc";
function createRpcHook() {
const reactQueryContext = createContext<QueryClient | undefined>(undefined);
return {
trpc: createTRPCReact<AppRouter>({
context: createContext(null),
reactQueryContext,
}),
trpc: createTRPCReact<AppRouter>({}),
reactQueryContext,
queryClient: new QueryClient({
defaultOptions: {
Expand All @@ -36,10 +33,7 @@ const rpcClient = rpcHook.trpc.createClient({
export function RpcHookProvider({ children }: { children: ReactNode }) {
return (
<rpcHook.trpc.Provider queryClient={rpcHook.queryClient} client={rpcClient}>
<QueryClientProvider
client={rpcHook.queryClient}
context={rpcHook.reactQueryContext}
>
<QueryClientProvider client={rpcHook.queryClient}>
{children}
</QueryClientProvider>
</rpcHook.trpc.Provider>
Expand Down
Loading

0 comments on commit 9aad9e4

Please sign in to comment.