forked from scaffold-eth/scaffold-eth-2
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Template for externalContracts.ts (#138)
- Loading branch information
Showing
3 changed files
with
29 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"create-eth": patch | ||
--- | ||
|
||
Template for externalContracts.ts |
16 changes: 0 additions & 16 deletions
16
templates/base/packages/nextjs/contracts/externalContracts.ts
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
templates/base/packages/nextjs/contracts/externalContracts.ts.template.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: {} | ||
}) |