Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ src/data/eips.json
.vscode/*
!.vscode/extensions.json
.idea
.zed
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
*.sw?
2 changes: 1 addition & 1 deletion src/components/PublicNetworkUpgradePage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { Link, useLocation } from 'react-router-dom';
import eipsData from '../data/eips.json';
import { eipsData } from '../data/eips';
import { useMetaTags } from '../hooks/useMetaTags';
import { useAnalytics } from '../hooks/useAnalytics';
import { EIP, ClientTeamPerspective } from '../types';
Expand Down
9 changes: 7 additions & 2 deletions src/components/RankPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import {
getLaymanTitle,
getProposalPrefix,
getHeadlinerLayer,
getInclusionStage,
} from "../utils/eip";
import { useAnalytics } from "../hooks/useAnalytics";
import eipsData from "../data/eips.json";
import { eipsData } from "../data/eips";
import ThemeToggle from "./ui/ThemeToggle";

interface TierItem {
Expand Down Expand Up @@ -165,7 +166,11 @@ const RankPage: React.FC = () => {
// Initialize with Glamsterdam headliner EIPs
useEffect(() => {
const glamsterdamHeadliners = eipsData
.filter((eip) => eip.forkRelationships.some((fork) => fork.forkName.toLowerCase() === "glamsterdam" && (fork.status === "Proposed" || fork.status === "Considered")))
.filter((eip) =>
["Proposed for Inclusion", "Considered for Inclusion"].includes(
getInclusionStage(eip, "glamsterdam")
)
)
.filter((eip) => !isHeadliner(eip, "glamsterdam"))
.map((eip) => ({
id: `eip-${eip.id}`,
Expand Down
4 changes: 4 additions & 0 deletions src/data/eips.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { EIP } from '../types/eip';
import eipsDataRaw from './eips.json';

export const eipsData = eipsDataRaw as EIP[];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason for the type assertion is because typescript won't infer the union types inside the new statusHistory field.

i believe it's safer to keep the union and do a type assertion than use a string and leave it to inference. we can always strengthen safety in the future with a compile time check (eg. in compile-eips.mjs).

7 changes: 6 additions & 1 deletion src/types/eip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export interface ClientTeamPerspective {

export interface ForkRelationship {
forkName: string;
status: string;
statusHistory: Array<{
status: 'Proposed' | 'Considered' | 'Scheduled' | 'Declined' | 'Included' | 'Withdrawn';
call?: `${'acdc' | 'acde' | 'acdt'}/${number}`;
date?: string;
}>; // Ordered oldest -> newest
isHeadliner?: boolean;
wasHeadlinerCandidate?: boolean;
headlinerDiscussionLink?: string;
Expand Down Expand Up @@ -62,6 +66,7 @@ export type InclusionStage =
| 'Scheduled for Inclusion'
| 'Declined for Inclusion'
| 'Included'
| 'Withdrawn'
| 'Unknown';

export type ProposalType = 'EIP' | 'RIP';
8 changes: 6 additions & 2 deletions src/utils/eip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ export const getInclusionStage = (eip: EIP, forkName?: string): InclusionStage =
fork.forkName.toLowerCase() === forkName.toLowerCase()
);

if (!forkRelationship) return 'Unknown';
if (!forkRelationship || !forkRelationship.statusHistory.length) return 'Unknown';

switch (forkRelationship.status) {
const status = forkRelationship.statusHistory[forkRelationship.statusHistory.length - 1].status;

switch (status) {
case 'Proposed':
return 'Proposed for Inclusion';
case 'Considered':
Expand All @@ -23,6 +25,8 @@ export const getInclusionStage = (eip: EIP, forkName?: string): InclusionStage =
return 'Declined for Inclusion';
case 'Included':
return 'Included';
case 'Withdrawn':
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added Withdrawn because i noticed it in several EIP json files, and felt Declined would be inaccurate:

6873.json - withdrawn
7667.json - withdrawn
7999.json - withdrawn

return 'Withdrawn';
default:
return 'Unknown';
}
Expand Down