Skip to content

Commit

Permalink
dev: upgrade deps
Browse files Browse the repository at this point in the history
  • Loading branch information
dcposch committed Sep 25, 2024
1 parent c812162 commit 55a466e
Show file tree
Hide file tree
Showing 36 changed files with 17,420 additions and 14,138 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:

jobs:
api-deploy:
# master and prod only, no tags
if: startsWith(github.ref, 'refs/heads/')
name: API Deploy
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions apps/daimo-clippy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dev": "echo Use 'npm start' for Clippy dev",
"start": "tsx src/index.ts",
"lint": "npm run lint:deps && npm run lint:style",
"lint:deps": "npx depcheck --ignores @tsconfig/node20,@types/tape,ts-node",
"lint:deps": "npx depcheck --ignores @tsconfig/node20,@types/tape",
"lint:style": "eslint . --max-warnings=0"
},
"license": "GPL-3.0-or-later",
Expand All @@ -17,6 +17,6 @@
"@slack/bolt": "^3.17.1",
"@trpc/client": "^11.0.0-next-beta.318",
"dotenv": "^16.4.5",
"viem": "^1.19.15"
"viem": "^2.18.2"
}
}
12 changes: 6 additions & 6 deletions apps/daimo-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@babel/core": "^7.20.0",
"@craftzdog/react-native-buffer": "^6.0.5",
"@daimo/api": "*",
"@daimo/auth-client": "^0.1.0",
"@daimo/auth-client": "*",
"@daimo/common": "*",
"@daimo/contract": "*",
"@daimo/expo-app-delegate": "*",
Expand Down Expand Up @@ -61,7 +61,7 @@
"depcheck": "^1.4.3",
"eslint": "^8.44.0",
"eslint-config-universe": "^11.3.0",
"expo": "^50.0.11",
"expo": "*",
"expo-application": "~5.8.3",
"expo-av": "^13.10.5",
"expo-barcode-scanner": "~12.9.3",
Expand All @@ -85,9 +85,9 @@
"immutable": "^5.0.0-beta.5",
"jest": "^29.5.0",
"jest-expo": "~50.0.3",
"react": "18.2.0",
"react": "*",
"react-error-boundary": "^4.0.12",
"react-native": "0.73.4",
"react-native": "*",
"react-native-email-link": "^1.15.0",
"react-native-gesture-handler": "~2.14.0",
"react-native-get-random-values": "~1.8.0",
Expand All @@ -103,8 +103,8 @@
"stream-browserify": "^3.0.0",
"text-encoding-polyfill": "^0.6.7",
"ts-unused-exports": "^9.0.4",
"typescript": "^5.3.0",
"viem": "^1.19.15",
"typescript": "5.3.3",
"viem": "^2.18.2",
"zod": "^3.23.8"
},
"eslintConfig": {
Expand Down
4 changes: 2 additions & 2 deletions apps/daimo-mobile/src/logic/key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SlotType,
signWithMnemonic,
} from "@daimo/common";
import { daimoAccountABI } from "@daimo/contract";
import { daimoAccountAbi } from "@daimo/contract";
import * as ExpoEnclave from "@daimo/expo-enclave";
import { SigningCallback } from "@daimo/userop";
import { base64urlnopad } from "@scure/base";
Expand Down Expand Up @@ -83,7 +83,7 @@ function wrapRawSignerAsWebauthn(
const responseTypeLocation = BigInt(clientDataJSON.indexOf('"type":'));

const signatureStruct = getAbiItem({
abi: daimoAccountABI,
abi: daimoAccountAbi,
name: "signatureStruct",
}).inputs;

Expand Down
4 changes: 2 additions & 2 deletions apps/daimo-mobile/src/logic/passkey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getSlotType,
parseAndNormalizeSig,
} from "@daimo/common";
import { DaimoChain, daimoAccountABI } from "@daimo/contract";
import { DaimoChain, daimoAccountAbi } from "@daimo/contract";
import * as ExpoPasskeys from "@daimo/expo-passkeys";
import { SigningCallback } from "@daimo/userop";
import { base64 } from "@scure/base";
Expand Down Expand Up @@ -98,7 +98,7 @@ export function getWrappedPasskeySigner(
const { r, s } = parseAndNormalizeSig(derSig);

const signatureStruct = getAbiItem({
abi: daimoAccountABI,
abi: daimoAccountAbi,
name: "signatureStruct",
}).inputs;

Expand Down
8 changes: 4 additions & 4 deletions apps/daimo-testbed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"@daimo/userop": "*",
"@ethersproject/shims": "^5.7.0",
"@types/react": "~18.2.45",
"expo": "^50.0.11",
"expo": "*",
"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.73.4",
"typescript": "^5.3.0"
"react": "*",
"react-native": "*",
"typescript": "5.3.3"
}
}
13 changes: 6 additions & 7 deletions apps/daimo-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
"@daimo/contract": "*",
"@headlessui/react": "^1.7.18",
"@neynar/nodejs-sdk": "^1.12.0",
"@rainbow-me/rainbowkit": "^1.1.1",
"@rainbow-me/rainbowkit": "^2.1.6",
"@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",
Expand All @@ -26,14 +25,14 @@
"lru-cache": "^10.2.0",
"next": "^13.5.4",
"pino-pretty": "^10.2.3",
"react": "18.2.0",
"react-dom": "^18.2.0",
"react": "*",
"react-dom": "18.2.0",
"sharp": "0.32.6",
"tailwindcss": "^3.3.3",
"tailwindcss": "^3.4.1",
"ts-loader": "^9.5.0",
"use-debounce": "^10.0.0",
"viem": "^1.19.15",
"wagmi": "^1.4.12",
"viem": "^2.18.2",
"wagmi": "^2.12.0",
"zod": "^3.23.8"
},
"scripts": {
Expand Down
55 changes: 28 additions & 27 deletions apps/daimo-web/src/components/ConnectWalletFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,18 @@ import {
getNoteClaimSignatureFromSeed,
} from "@daimo/common";
import {
daimoEphemeralNotesAbi,
daimoEphemeralNotesV2Abi,
daimoRequestAbi,
daimoRequestAddress,
daimoRequestABI,
daimoEphemeralNotesV2ABI,
notesV2AddressMap,
daimoEphemeralNotesABI,
erc20Abi,
notesV1AddressMap,
notesV2AddressMap,
} from "@daimo/contract";
import { ConnectButton } from "@rainbow-me/rainbowkit";
import { useMemo, useEffect, useState } from "react";
import { useEffect, useMemo, useState } from "react";
import { Address, Hex, InsufficientFundsError, parseUnits } from "viem";
import {
useNetwork,
usePrepareContractWrite,
useContractWrite,
useAccount,
erc20ABI,
} from "wagmi";
import { useAccount, useSimulateContract, useWriteContract } from "wagmi";

import { SecondaryButton, TextButton } from "./buttons";
import { chainConfig } from "../env";
Expand Down Expand Up @@ -132,9 +127,15 @@ function WagmiButton({
}) {
const i18n = useI18N();
const i18 = i18n.components.connectWallet;
const { chain } = useNetwork();
const { config, error } = usePrepareContractWrite(wagmiPrep);
const { data, isLoading, isSuccess, write } = useContractWrite(config);
const { chain } = useAccount();
const { data, error } = useSimulateContract(wagmiPrep);
const {
writeContract,
isPending,
isSuccess,
data: txHash,
} = useWriteContract();
// const { data, isLoading, isSuccess, write } = usweWrite(wagmiPrep);

const humanReadableError = useMemo(() => {
if (!error || !error.message) return undefined;
Expand All @@ -156,26 +157,26 @@ function WagmiButton({
}, [isSuccess, incrementStep]);

useEffect(() => {
if (isLoading || isSuccess) setSecondary();
}, [isLoading, isSuccess, setSecondary]);
if (isPending || isSuccess) setSecondary();
}, [isPending, isSuccess, setSecondary]);

return (
<>
{humanReadableError === undefined && (
<>
<SecondaryButton
disabled={!write || isLoading}
disabled={writeContract == null || isPending}
onClick={() => {
if (isSuccess && data?.hash)
if (isSuccess && txHash != null)
window.open(
chain?.blockExplorers!.default.url + "/tx/" + data?.hash,
chain?.blockExplorers!.default.url + "/tx/" + txHash,
"_blank"
);
else write?.();
else writeContract(data!.request);
}}
buttonType={isSuccess ? "success" : undefined}
>
{isLoading
{isPending
? i18.misc.sending()
: isSuccess && !incrementStep
? i18.misc.viewInExplorer()
Expand Down Expand Up @@ -304,7 +305,7 @@ async function linkStatusToAction(
return [
{
address: chainConfig.tokenAddress,
abi: erc20ABI as readonly unknown[],
abi: erc20Abi as readonly unknown[],
functionName: "transfer" as const,
args: [recipient.addr, parsedAmount] as const,
},
Expand All @@ -321,13 +322,13 @@ async function linkStatusToAction(
return [
{
address: chainConfig.tokenAddress,
abi: erc20ABI as readonly unknown[],
abi: erc20Abi as readonly unknown[],
functionName: "approve" as const,
args: [daimoRequestAddress, parsedAmount] as const,
},
{
address: daimoRequestAddress,
abi: daimoRequestABI,
abi: daimoRequestAbi,
functionName: "fulfillRequest" as const,
args: [id] as const,
},
Expand All @@ -351,7 +352,7 @@ async function linkStatusToAction(
);
return [
{
abi: daimoEphemeralNotesV2ABI,
abi: daimoEphemeralNotesV2Abi,
address: assertNotNull(notesV2AddressMap.get(chainId)),
functionName: "claimNoteRecipient" as const,
args: [ephemeralOwner, selfAddress, signature] as const,
Expand All @@ -360,7 +361,7 @@ async function linkStatusToAction(
} else {
return [
{
abi: daimoEphemeralNotesABI,
abi: daimoEphemeralNotesAbi,
address: assertNotNull(notesV1AddressMap.get(chainId)),
functionName: "claimNote" as const,
args: [ephemeralOwner, signature] as const,
Expand Down
36 changes: 14 additions & 22 deletions apps/daimo-web/src/components/Providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import {
connectorsForWallets,
getDefaultWallets,
} from "@rainbow-me/rainbowkit";
import { ConnectorsForWalletsParameters } from "@rainbow-me/rainbowkit/dist/wallets/connectorsForWallets";
import * as React from "react";
import { useMemo } from "react";
import { Chain } from "viem/chains";
import { WagmiConfig, configureChains, createConfig } from "wagmi";
import { publicProvider } from "wagmi/providers/public";
import { createConfig, WagmiProvider } from "wagmi";

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

export const chainsDaimoL2 = [chainConfig.chainL2];
export const chainsDaimoL2 = [chainConfig.chainL2] as const;

const appInfo = {
appName: "Daimo",
Expand All @@ -24,40 +24,32 @@ export function Providers({
chains,
children,
}: {
chains: Chain[];
chains: readonly [Chain, ...Chain[]];
children: React.ReactNode;
}) {
const [mounted, setMounted] = React.useState(false);
React.useEffect(() => setMounted(true), []);

const wagmiConfig = useMemo(() => {
const { publicClient, webSocketPublicClient } = configureChains(chains, [
publicProvider(),
]);

const walletConnectProjectId = "06d134eadbbacc1f9dd4575541dda90c";

const { wallets } = getDefaultWallets({
const walletConnectParams: ConnectorsForWalletsParameters = {
appName: "Daimo",
projectId: walletConnectProjectId,
chains,
});

const connectors = connectorsForWallets([...wallets]);
projectId: "06d134eadbbacc1f9dd4575541dda90c",
};
const { wallets } = getDefaultWallets(walletConnectParams);
const connectors = connectorsForWallets([...wallets], walletConnectParams);

return createConfig({
autoConnect: true,
connectors,
publicClient,
webSocketPublicClient,
chains,
transports: [],
});
}, [chains]);

return (
<WagmiConfig config={wagmiConfig}>
<RainbowKitProvider chains={chains} appInfo={appInfo}>
<WagmiProvider config={wagmiConfig}>
<RainbowKitProvider appInfo={appInfo}>
{mounted && children}
</RainbowKitProvider>
</WagmiConfig>
</WagmiProvider>
);
}
8 changes: 4 additions & 4 deletions apps/scratchpad/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
"@scure/base": "^1.1.3",
"@trpc/client": "^11.0.0-next-beta.318",
"@trpc/server": "^11.0.0-next-beta.318",
"@tsconfig/node20": "^20.1.0",
"@tsconfig/node20": "^20.1.4",
"@types/lodash": "^4.17.0",
"@types/tape": "^5.6.0",
"csvtojson": "^2.0.10",
"depcheck": "^1.4.3",
"eslint": "^8.44.0",
"lodash": "^4.17.21",
"tape": "^5.6.3",
"ts-node": "^10.9.1",
"ts-node": "^10.9.2",
"userop": "^0.3.2",
"viem": "^1.19.15",
"viem": "^2.18.2",
"zod": "^3.23.8"
},
"devDependencies": {
"typescript": "^5.3.0"
"typescript": "5.3.3"
}
}
4 changes: 2 additions & 2 deletions apps/scratchpad/src/checkAccount.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { erc20ABI, nameRegistryProxyConfig } from "@daimo/contract";
import { erc20Abi, nameRegistryProxyConfig } from "@daimo/contract";
import { Constants } from "userop";
import {
Address,
Expand Down Expand Up @@ -54,7 +54,7 @@ export async function checkAccount() {

// Get balance from coin contract
const bal = await publicClient.readContract({
abi: erc20ABI,
abi: erc20Abi,
address: chainConfig.tokenAddress,
functionName: "balanceOf",
args: [addr],
Expand Down
Loading

0 comments on commit 55a466e

Please sign in to comment.