diff --git a/src/curated-extensions.ts b/src/curated-extensions.ts index 86a822041..98e500498 100644 --- a/src/curated-extensions.ts +++ b/src/curated-extensions.ts @@ -1,12 +1,27 @@ import { ExternalExtension } from "./types"; -import extensions from "./extensions.json"; +import curatedExtension from "./extensions.json"; + +type ExtensionJSON = { + extensionFlagValue: string; + repository: string; + branch?: string; + // fields usefull for scaffoldeth.io + description: string; + version?: string; // if not present we default to latest + name?: string; // human redable name, if not present we default to branch or extensionFlagValue on UI +}; + +const extensions: ExtensionJSON[] = curatedExtension; const CURATED_EXTENSIONS = extensions.reduce>((acc, ext) => { - if (!ext.branch || !ext.repository || !ext.description) { - throw new Error(`Extension missing required fields: ${JSON.stringify(ext)}`); + if (!ext.repository) { + throw new Error(`Extension must have 'repository': ${JSON.stringify(ext)}`); + } + if (!ext.extensionFlagValue) { + throw new Error(`Extension must have 'extensionFlagValue': ${JSON.stringify(ext)}`); } - acc[ext.branch] = { + acc[ext.extensionFlagValue] = { repository: ext.repository, branch: ext.branch, }; diff --git a/src/extensions.json b/src/extensions.json index 018f03007..514820450 100644 --- a/src/extensions.json +++ b/src/extensions.json @@ -1,35 +1,42 @@ [ { + "extensionFlagValue": "subgraph", "description": "This Scaffold-ETH 2 extension helps you build and test subgraphs locally for your contracts. It also enables interaction with the front-end and facilitates easy deployment to Subgraph Studio.", "repository": "https://github.com/scaffold-eth/create-eth-extensions", "branch": "subgraph" }, { + "extensionFlagValue": "eip-712", "description": "An implementation of EIP-712, allowing you to send, sign, and verify typed messages in a user-friendly manner.", "repository": "https://github.com/scaffold-eth/create-eth-extensions", "branch": "eip-712" }, { + "extensionFlagValue": "ponder", "description": "This Scaffold-ETH 2 extension comes pre-configured with ponder.sh, providing an example to help you get started quickly.", "repository": "https://github.com/scaffold-eth/create-eth-extensions", "branch": "ponder" }, { + "extensionFlagValue": "onchainkit", "description": "This Scaffold-ETH 2 extension comes pre-configured with onchainkit, providing an example to help you get started quickly.", "repository": "https://github.com/scaffold-eth/create-eth-extensions", "branch": "onchainkit" }, { + "extensionFlagValue": "erc-20", "description": "This extension introduces an ERC-20 token contract and demonstrates how to interact with it, including getting a holder balance and transferring tokens.", "repository": "https://github.com/scaffold-eth/create-eth-extensions", "branch": "erc-20" }, { + "extensionFlagValue": "eip-5792", "description": "This extension demonstrates on how to use EIP-5792 wallet capabilities. This EIP introduces new JSON-RPC methods for sending multiple calls from the user wallet, and checking their status", "repository": "https://github.com/scaffold-eth/create-eth-extensions", "branch": "eip-5792" }, { + "extensionFlagValue": "randao", "description": "This extension shows how to use on-chain randomness using RANDAO for truly on-chain unpredictable random sources.", "repository": "https://github.com/scaffold-eth/create-eth-extensions", "branch": "randao"