diff --git a/.changeset/famous-dodos-exercise.md b/.changeset/famous-dodos-exercise.md new file mode 100644 index 000000000..aa7906a10 --- /dev/null +++ b/.changeset/famous-dodos-exercise.md @@ -0,0 +1,5 @@ +--- +"create-eth": patch +--- + +Template for externalContracts.ts diff --git a/templates/base/packages/nextjs/contracts/externalContracts.ts b/templates/base/packages/nextjs/contracts/externalContracts.ts deleted file mode 100644 index ab6daa86d..000000000 --- a/templates/base/packages/nextjs/contracts/externalContracts.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; - -/** - * @example - * const externalContracts = { - * 1: { - * DAI: { - * address: "0x...", - * abi: [...], - * }, - * }, - * } as const; - */ -const externalContracts = {} as const; - -export default externalContracts satisfies GenericContractsDeclaration; diff --git a/templates/base/packages/nextjs/contracts/externalContracts.ts.template.mjs b/templates/base/packages/nextjs/contracts/externalContracts.ts.template.mjs new file mode 100644 index 000000000..a82813c39 --- /dev/null +++ b/templates/base/packages/nextjs/contracts/externalContracts.ts.template.mjs @@ -0,0 +1,24 @@ +import { withDefaults } from '../../../../utils.js' + +const contents = ({ externalContracts }) => +`import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; + +/** + * @example + * const externalContracts = { + * 1: { + * DAI: { + * address: "0x...", + * abi: [...], + * }, + * }, + * } as const; + */ +const externalContracts = ${JSON.stringify(externalContracts[0])} as const; + +export default externalContracts satisfies GenericContractsDeclaration; +` + +export default withDefaults(contents, { + externalContracts: {} +})