diff --git a/.changeset/light-sloths-crash.md b/.changeset/light-sloths-crash.md new file mode 100644 index 000000000..856923219 --- /dev/null +++ b/.changeset/light-sloths-crash.md @@ -0,0 +1,7 @@ +--- +"create-eth": patch +--- + +- fix: BigInt parsing losing precision in IntegerInput (https://github.com/scaffold-eth/scaffold-eth-2/pull/893) +- feat: bundler module resolution (https://github.com/scaffold-eth/scaffold-eth-2/pull/885) +- fix: ignore strings starting with 0 (https://github.com/scaffold-eth/scaffold-eth-2/pull/894) diff --git a/.changeset/tender-foxes-compare.md b/.changeset/tender-foxes-compare.md new file mode 100644 index 000000000..bf7f7d50b --- /dev/null +++ b/.changeset/tender-foxes-compare.md @@ -0,0 +1,5 @@ +--- +"create-eth": patch +--- + +cli: don't prompt for install + remove prettier plugins (#80) diff --git a/templates/base/packages/nextjs/app/debug/_components/contract/utilsContract.tsx b/templates/base/packages/nextjs/app/debug/_components/contract/utilsContract.tsx index 023efe875..217012ce3 100644 --- a/templates/base/packages/nextjs/app/debug/_components/contract/utilsContract.tsx +++ b/templates/base/packages/nextjs/app/debug/_components/contract/utilsContract.tsx @@ -18,16 +18,31 @@ const isJsonString = (str: string) => { } }; +const isBigInt = (str: string) => { + if (str.trim().length === 0 || str.startsWith("0")) return false; + try { + BigInt(str); + return true; + } catch (e) { + return false; + } +}; + // Recursive function to deeply parse JSON strings, correctly handling nested arrays and encoded JSON strings const deepParseValues = (value: any): any => { if (typeof value === "string") { + // first try with bigInt because we losse precision with JSON.parse + if (isBigInt(value)) { + return BigInt(value); + } + if (isJsonString(value)) { const parsed = JSON.parse(value); return deepParseValues(parsed); - } else { - // It's a string but not a JSON string, return as is - return value; } + + // It's a string but not a JSON string, return as is + return value; } else if (Array.isArray(value)) { // If it's an array, recursively parse each element return value.map(element => deepParseValues(element)); diff --git a/templates/base/packages/nextjs/package.json b/templates/base/packages/nextjs/package.json index 461524e99..f51ad59c7 100644 --- a/templates/base/packages/nextjs/package.json +++ b/templates/base/packages/nextjs/package.json @@ -32,8 +32,8 @@ "react-hot-toast": "~2.4.0", "use-debounce": "~8.0.4", "usehooks-ts": "2.13.0", - "viem": "2.13.6", - "wagmi": "2.9.8", + "viem": "2.17.4", + "wagmi": "2.10.10", "zustand": "~4.1.2" }, "devDependencies": { @@ -43,7 +43,7 @@ "@types/react": "^18.0.21", "@types/react-copy-to-clipboard": "^5.0.4", "@typescript-eslint/eslint-plugin": "~5.40.0", - "abitype": "1.0.2", + "abitype": "1.0.5", "autoprefixer": "~10.4.12", "eslint": "~8.24.0", "eslint-config-next": "~14.0.4", @@ -53,7 +53,7 @@ "prettier": "~3.3.2", "tailwindcss": "~3.4.3", "type-fest": "~4.6.0", - "typescript": "5.1.6", + "typescript": "5.5.3", "vercel": "~32.4.1" } } diff --git a/templates/base/packages/nextjs/tsconfig.json b/templates/base/packages/nextjs/tsconfig.json index 7d1e6d928..69290112d 100644 --- a/templates/base/packages/nextjs/tsconfig.json +++ b/templates/base/packages/nextjs/tsconfig.json @@ -9,7 +9,7 @@ "noEmit": true, "esModuleInterop": true, "module": "esnext", - "moduleResolution": "node", + "moduleResolution": "Bundler", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", diff --git a/templates/base/packages/nextjs/types/abitype/abi.d.ts b/templates/base/packages/nextjs/types/abitype/abi.d.ts index c216a079b..57144d736 100644 --- a/templates/base/packages/nextjs/types/abitype/abi.d.ts +++ b/templates/base/packages/nextjs/types/abitype/abi.d.ts @@ -7,15 +7,3 @@ declare module "abitype" { AddressType: AddressType; } } - -declare module "viem/node_modules/abitype" { - export interface Register { - AddressType: AddressType; - } -} - -declare module "wagmi/node_moudles/abitype" { - export interface Register { - AddressType: AddressType; - } -}