Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backmerge 10-26-24 #146

Merged
merged 10 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/tiny-bikes-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"create-eth": patch
---

- feat: update uniswap deps (https://github.com/scaffold-eth/scaffold-eth-2/pull/956)
- feat: update envfile (https://github.com/scaffold-eth/scaffold-eth-2/pull/958)
- Update usehooks-ts, remove use-debounce (https://github.com/scaffold-eth/scaffold-eth-2/pull/957)
- Update other packages (https://github.com/scaffold-eth/scaffold-eth-2/pull/960)
- feat: wagmi and viem (https://github.com/scaffold-eth/scaffold-eth-2/pull/971)
- Update ts, eslint, prettier (https://github.com/scaffold-eth/scaffold-eth-2/pull/963)
- feat: update husky and lintstaged (https://github.com/scaffold-eth/scaffold-eth-2/pull/959)
3 changes: 0 additions & 3 deletions templates/base/.husky/pre-commit
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged --verbose
8 changes: 3 additions & 5 deletions templates/base/packages/nextjs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"parser": "@typescript-eslint/parser",
"extends": ["next/core-web-vitals", "plugin:prettier/recommended", "plugin:@typescript-eslint/recommended"],
"extends": ["next/core-web-vitals", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
"rules": {
"@typescript-eslint/no-unused-vars": ["error"],
"@typescript-eslint/no-explicit-any": ["off"],
"@typescript-eslint/ban-ts-comment": ["off"],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
"prettier/prettier": [
"warn",
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
module.exports = {
"arrowParens": "avoid",
"printWidth": 120,
"tabWidth": 2,
"trailingComma": "all",
"importOrder": ["^react$", "^next/(.*)$", "<THIRD_PARTY_MODULES>", "^@heroicons/(.*)$", "^~~/(.*)$"],
"importOrderSortSpecifiers": true
"importOrderSortSpecifiers": true,
"plugins": [require.resolve("@trivago/prettier-plugin-sort-imports")],
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@ export const TupleArray = ({ abiTupleParameter, setParentForm, parentStateObject

useEffect(() => {
// Extract and group fields based on index prefix
const groupedFields = Object.keys(form).reduce((acc, key) => {
const [indexPrefix, ...restArray] = key.split("_");
const componentName = restArray.join("_");
if (!acc[indexPrefix]) {
acc[indexPrefix] = {};
}
acc[indexPrefix][componentName] = form[key];
return acc;
}, {} as Record<string, Record<string, any>>);
const groupedFields = Object.keys(form).reduce(
(acc, key) => {
const [indexPrefix, ...restArray] = key.split("_");
const componentName = restArray.join("_");
if (!acc[indexPrefix]) {
acc[indexPrefix] = {};
}
acc[indexPrefix][componentName] = form[key];
return acc;
},
{} as Record<string, Record<string, any>>,
);

let argsArray: Array<Record<string, any>> = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const isJsonString = (str: string) => {
try {
JSON.parse(str);
return true;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
return false;
}
Expand All @@ -23,6 +24,7 @@ const isBigInt = (str: string) => {
try {
BigInt(str);
return true;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export const isValidInteger = (dataType: IntegerVariant, value: string) => {
let valueAsBigInt;
try {
valueAsBigInt = BigInt(value);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {}
if (typeof valueAsBigInt !== "bigint") {
if (!value || typeof value !== "string") {
Expand Down
1 change: 0 additions & 1 deletion templates/base/packages/nextjs/hooks/scaffold-eth/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from "./useAnimationConfig";
export * from "./useBurnerWallet";
export * from "./useContractLogs";
export * from "./useDeployedContractInfo";
export * from "./useFetchBlocks";
Expand Down
146 changes: 0 additions & 146 deletions templates/base/packages/nextjs/hooks/scaffold-eth/useBurnerWallet.ts

This file was deleted.

35 changes: 17 additions & 18 deletions templates/base/packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,41 @@
"dependencies": {
"@heroicons/react": "~2.1.5",
"@rainbow-me/rainbowkit": "2.1.6",
"@tanstack/react-query": "~5.28.6",
"@uniswap/sdk-core": "~4.0.1",
"@uniswap/v2-sdk": "~3.0.1",
"blo": "~1.0.1",
"@tanstack/react-query": "~5.59.15",
"@uniswap/sdk-core": "~5.8.2",
"@uniswap/v2-sdk": "~4.6.1",
"blo": "~1.2.0",
"burner-connector": "~0.0.8",
"daisyui": "4.12.10",
"next": "~14.2.11",
"next-nprogress-bar": "~2.3.13",
"next-themes": "~0.3.0",
"qrcode.react": "~3.1.0",
"qrcode.react": "~4.0.1",
"react": "~18.3.1",
"react-copy-to-clipboard": "~5.1.0",
"react-dom": "~18.3.1",
"react-hot-toast": "~2.4.0",
"use-debounce": "~8.0.4",
"usehooks-ts": "2.13.0",
"viem": "2.21.7",
"wagmi": "2.12.11",
"zustand": "~4.1.2"
"usehooks-ts": "~3.1.0",
"viem": "2.21.32",
"wagmi": "2.12.23",
"zustand": "~5.0.0"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "~4.1.1",
"@trivago/prettier-plugin-sort-imports": "~4.3.0",
"@types/node": "~18.19.50",
"@types/react": "~18.3.5",
"@typescript-eslint/eslint-plugin": "~5.40.0",
"abitype": "1.0.6",
"autoprefixer": "~10.4.20",
"eslint": "~8.24.0",
"eslint-config-next": "~14.0.4",
"eslint-config-prettier": "~8.5.0",
"eslint-plugin-prettier": "~4.2.1",
"eslint": "~8.57.1",
"eslint-config-next": "~14.2.15",
"eslint-config-prettier": "~8.10.0",
"eslint-plugin-prettier": "~5.2.1",
"postcss": "~8.4.45",
"prettier": "~2.8.4",
"prettier": "~3.3.3",
"tailwindcss": "~3.4.11",
"type-fest": "~4.6.0",
"typescript": "5.5.3",
"type-fest": "~4.26.1",
"typescript": "<5.6.0",
"vercel": "~37.4.2"
}
}
2 changes: 1 addition & 1 deletion templates/base/packages/nextjs/services/store/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import create from "zustand";
import { create } from "zustand";
import scaffoldConfig from "~~/scaffold.config";
import { ChainWithAttributes } from "~~/utils/scaffold-eth";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { withDefaults } from "../../../utils.js";
const contents = ({ lightTheme, darkTheme, extendTheme }) => `/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./app/**/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}", "./utils/**/*.{js,ts,jsx,tsx}"],
// eslint-disable-next-line @typescript-eslint/no-require-imports
plugins: [require("daisyui")],
darkTheme: "dark",
darkMode: ["selector", "[data-theme='dark']"],
Expand Down
27 changes: 14 additions & 13 deletions templates/base/packages/nextjs/utils/scaffold-eth/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,17 @@ type OptionalTuple<T> = T extends readonly [infer H, ...infer R] ? readonly [H |
type UseScaffoldArgsParam<
TContractName extends ContractName,
TFunctionName extends ExtractAbiFunctionNames<ContractAbi<TContractName>>,
> = TFunctionName extends FunctionNamesWithInputs<TContractName>
? {
args: OptionalTuple<UnionToIntersection<AbiFunctionArguments<ContractAbi<TContractName>, TFunctionName>>>;
value?: ExtractAbiFunction<ContractAbi<TContractName>, TFunctionName>["stateMutability"] extends "payable"
? bigint | undefined
: undefined;
}
: {
args?: never;
};
> =
TFunctionName extends FunctionNamesWithInputs<TContractName>
? {
args: OptionalTuple<UnionToIntersection<AbiFunctionArguments<ContractAbi<TContractName>, TFunctionName>>>;
value?: ExtractAbiFunction<ContractAbi<TContractName>, TFunctionName>["stateMutability"] extends "payable"
? bigint | undefined
: undefined;
}
: {
args?: never;
};

export type UseScaffoldReadConfig<
TContractName extends ContractName,
Expand Down Expand Up @@ -305,9 +306,9 @@ export type UseScaffoldEventHistoryData<
IndexedOnly: false;
}
>;
block: TBlockData extends true ? Block<bigint, true> : null;
receipt: TReceiptData extends true ? GetTransactionReturnType : null;
transaction: TTransactionData extends true ? GetTransactionReceiptReturnType : null;
blockData: TBlockData extends true ? Block<bigint, true> : null;
receiptData: TReceiptData extends true ? GetTransactionReturnType : null;
transactionData: TTransactionData extends true ? GetTransactionReceiptReturnType : null;
}[]
>
| undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"parser": "@typescript-eslint/parser",
"extends": ["plugin:prettier/recommended", "plugin:@typescript-eslint/recommended"],
"rules": {
"@typescript-eslint/no-unused-vars": ["error"],
"@typescript-eslint/no-explicit-any": ["off"],
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "off",
"prettier/prettier": [
"warn",
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ cache-zk
# deployments
deployments/localhost

# typescript
*.tsbuildinfo

# other
temp`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const generateTsAbis: DeployFunction = async function () {
}
fs.writeFileSync(
`${TARGET_DIR}deployedContracts.ts`,
prettier.format(
await prettier.format(
`${generatedContractComment} import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; \n\n
const deployedContracts = {${fileContent}} as const; \n\n export default deployedContracts satisfies GenericContractsDeclaration`,
{
Expand Down
Loading
Loading