Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove strict check for branch in curated json #161

Merged
merged 6 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/curated-extensions.ts
Original file line number Diff line number Diff line change
@@ -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<Record<string, ExternalExtension>>((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,
};
Expand Down
7 changes: 7 additions & 0 deletions src/extensions.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down