Skip to content
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
7 changes: 5 additions & 2 deletions src/data/stages.derived.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
// It contains mainly the support types and values that are derived from
// the manually entered values.

import { NeverForEmpty } from "../types/NeverForEmpty";
import { TuplifyUnionAnyOrder } from "../types/unionToTuple";
import { bridgedChainIds, stages } from "./stages";
import { bridgedChains, stages } from "./stages";

export type Stages = typeof stages;

export type StageId = keyof Stages;

export type StageIdsOrder = TuplifyUnionAnyOrder<StageId>;

export type BridgedChainId = (typeof bridgedChainIds)[number];
export type BridgedChains = typeof bridgedChains;

export type BridgedChainId = NeverForEmpty<keyof BridgedChains>;

export type BridgedChainIdsOrder = TuplifyUnionAnyOrder<BridgedChainId>;
6 changes: 3 additions & 3 deletions src/data/stages.internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
// definitions of the data.

import { BridgedChainId } from "./stages.derived";
import { Stage } from "./stages.types";
import { GeneralBridgedChainInfo, Stage } from "./stages.types";

// Any stages, but each must have same bridged chains.
export type StagesShape = Record<string, Stage<BridgedChainId>>;

// Any shape of a list of bridged chain ids.
export type BridgedChainIdsShape = string[];
// Any shape of a list of global bridged chain info.
export type BridgedChainsShape = Record<string, GeneralBridgedChainInfo>;
4 changes: 2 additions & 2 deletions src/data/stages.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BridgedChainIdsOrder, StageIdsOrder } from "./stages.derived";
import { BridgedChainIdsShape, StagesShape } from "./stages.internal";
import { BridgedChainsShape, StagesShape } from "./stages.internal";

// Wait for announcements!
export const bridgedChainIds = [] as const satisfies BridgedChainIdsShape;
export const bridgedChains = {} as const satisfies BridgedChainsShape;

export const stages = {
mainnet: {
Expand Down
4 changes: 4 additions & 0 deletions src/data/stages.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ export type Stage<BridgedChainIds extends string> = {
humanode: HumanodeChainInfo;
bridged: Record<BridgedChainIds, BridgedChainInfo>;
};

export type GeneralBridgedChainInfo = {
generalDisplayName: string;
};
1 change: 1 addition & 0 deletions src/types/NeverForEmpty.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type NeverForEmpty<T> = T extends object ? never : T;