-
Notifications
You must be signed in to change notification settings - Fork 6
/
registry.ts
65 lines (60 loc) · 1.8 KB
/
registry.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { betfair } from "./betfair";
import { fantasyscotus } from "./fantasyscotus";
import { foretold } from "./foretold";
import { givewellopenphil } from "./givewellopenphil";
import { goodjudgment } from "./goodjudgment";
import { goodjudgmentopen } from "./goodjudgmentopen";
import { guesstimate } from "./guesstimate";
import { Platform, PlatformConfig } from "./index";
import { infer } from "./infer";
import { insight } from "./insight";
import { kalshi } from "./kalshi";
import { manifold } from "./manifold";
import { metaculus } from "./metaculus";
import { polymarket } from "./polymarket";
import { predictit } from "./predictit";
import { rootclaim } from "./rootclaim";
import { smarkets } from "./smarkets";
import { wildeford } from "./wildeford";
import { xrisk } from "./xrisk";
// function instead of const array, this helps to fight circular dependencies
export const getPlatforms = (): Platform<string>[] => {
return [
betfair,
fantasyscotus,
foretold,
givewellopenphil,
goodjudgment,
goodjudgmentopen,
guesstimate,
infer,
insight,
kalshi,
manifold,
metaculus,
polymarket,
predictit,
rootclaim,
smarkets,
wildeford,
xrisk,
];
};
let _nameToLabelCache: { [k: string]: string } | undefined;
export function platformNameToLabel(name: string): string {
if (!_nameToLabelCache) {
_nameToLabelCache = Object.fromEntries(
getPlatforms().map((platform) => [platform.name, platform.label])
);
}
return _nameToLabelCache[name] || name;
}
// get frontend-safe version of platforms data
export const getPlatformsConfig = (): PlatformConfig[] => {
const platformsConfig = getPlatforms().map((platform) => ({
name: platform.name,
label: platform.label,
color: platform.color,
}));
return platformsConfig;
};