Skip to content

Commit

Permalink
revert #875
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 committed Aug 9, 2024
1 parent f11b9de commit 60973f7
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 234 deletions.
14 changes: 8 additions & 6 deletions packages/hardhat/deploy/99_generateTsAbis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,16 @@ const generateTsAbis: DeployFunction = async function () {
if (!fs.existsSync(TARGET_DIR)) {
fs.mkdirSync(TARGET_DIR);
}
const formattedContent = await prettier.format(
`${generatedContractComment} import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; \n\n
fs.writeFileSync(
`${TARGET_DIR}deployedContracts.ts`,
prettier.format(
`${generatedContractComment} import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; \n\n
const deployedContracts = {${fileContent}} as const; \n\n export default deployedContracts satisfies GenericContractsDeclaration`,
{
parser: "typescript",
},
{
parser: "typescript",
},
),
);
fs.writeFileSync(`${TARGET_DIR}deployedContracts.ts`, formattedContent);

console.log(`📝 Updated TypeScript contract definition file on ${TARGET_DIR}deployedContracts.ts`);
};
Expand Down
6 changes: 3 additions & 3 deletions packages/hardhat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
"@typescript-eslint/parser": "latest",
"chai": "^4.3.6",
"eslint": "^8.26.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"ethers": "^6.10.0",
"hardhat": "^2.19.4",
"hardhat-deploy": "^0.11.45",
"hardhat-deploy-ethers": "^0.4.1",
"hardhat-gas-reporter": "^1.0.9",
"prettier": "^3.3.2",
"prettier": "^2.8.4",
"solidity-coverage": "^0.8.5",
"ts-node": "^10.9.1",
"typechain": "^8.1.0",
Expand Down
1 change: 0 additions & 1 deletion packages/nextjs/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"arrowParens": "avoid",
"printWidth": 120,
"tabWidth": 2,
Expand Down
21 changes: 9 additions & 12 deletions packages/nextjs/app/debug/_components/contract/TupleArray.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,15 @@ 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
8 changes: 4 additions & 4 deletions packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"zustand": "^4.1.2"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@types/node": "^17.0.35",
"@types/nprogress": "^0",
"@types/react": "^18.0.9",
Expand All @@ -47,10 +47,10 @@
"autoprefixer": "^10.4.12",
"eslint": "^8.15.0",
"eslint-config-next": "^14.0.4",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"postcss": "^8.4.16",
"prettier": "^3.3.2",
"prettier": "^2.8.4",
"tailwindcss": "^3.4.3",
"type-fest": "^4.6.0",
"typescript": "5.5.3",
Expand Down
21 changes: 10 additions & 11 deletions packages/nextjs/utils/scaffold-eth/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,16 @@ type OptionalTupple<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: OptionalTupple<UnionToIntersection<AbiFunctionArguments<ContractAbi<TContractName>, TFunctionName>>>;
value?: ExtractAbiFunction<ContractAbi<TContractName>, TFunctionName>["stateMutability"] extends "payable"
? bigint | undefined
: undefined;
}
: {
args?: never;
};
> = TFunctionName extends FunctionNamesWithInputs<TContractName>
? {
args: OptionalTupple<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
Loading

0 comments on commit 60973f7

Please sign in to comment.