forked from sismo-core/app-store
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
191 lines (172 loc) · 4.31 KB
/
types.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
import { Network } from "@/src/libs/contracts/networks";
import { AuthRequest, ClaimRequest } from "@sismo-core/sismo-connect-react";
export type SpaceConfig = {
metadata: {
name: string; // 80 characters max
description: string; // 300 characters max
image?: string; // 160x160px can be an url or local file
socialLinks?: {
type: SocialType;
link: string;
}[];
tags?: string[];
slug?: string; // spaces.sismo.io/[slug] - auto-generated with the filename
};
apps?: AppConfig[];
options?: {
hidden?: boolean; // default false
};
};
export type Env = "Demo" | "Prod";
export type AppConfig =
| ZkFormAppConfig
| ZkDropAppConfig
| ExternalAppConfig
| ZkBadgeAppConfig
| ZkTelegramBotAppConfig;
type SocialType = "twitter" | "discord" | "link" | "github" | "telegram";
// Every App will inherit this type
type AppCommonConfig = {
metadata: {
name: string; // 40 characters max
slug: string;
description: string; // 200 characters max
image: string; // 550x390px can be an url or local file
tags: string[];
createdAt: Date;
lastUpdateAt?: Date;
};
sismoConnectRequest: {
appId?: string;
claimRequests?: ClaimRequest[];
authRequests?: AuthRequest[];
impersonateAddresses?: string[];
};
options?: {
startDate?: Date;
endDate?: Date;
disabled?: boolean; // default false
isFeatured?: boolean; // default false
};
};
export type ExternalAppConfig = AppCommonConfig & {
type: "external";
templateConfig: {
link: string;
};
};
export type UserSelection = FirstComeFirstServed | Lottery;
export type Lottery = {
type: "Lottery";
maxNumberOfEntries: number;
numberOfWinners: number;
};
export type FirstComeFirstServed = {
type: "FCFS";
maxNumberOfUsers: number;
};
export type ZkBadgeChainName = Network.Gnosis | Network.Mumbai | Network.Sepolia;
export type ZkBadgeAppConfig = AppCommonConfig & {
type: "zkBadge";
templateConfig: {
step1CtaText?: string;
step2CtaText: string;
appDescription?: string;
tokenId: string;
badgeMetadata: {
name: string;
description: string;
image: string;
};
chains: [
{
name: ZkBadgeChainName;
relayerEnabled?: boolean;
}
];
};
};
export type ZkDropChainName = Network.Gnosis | Network.Mumbai | Network.Sepolia | Network.Polygon | Network.Mainnet |Network.Goerli | Network.Optimism | Network.Arbitrum;
export type ZkDropAppConfig = AppCommonConfig & {
type: "zkDrop";
templateConfig: {
owner?: `0x${string}`;
isTransferable: boolean;
nftMetadata: {
name: string;
description: string;
image: string;
symbol: string;
};
chains: {
contractAddress: string;
name: ZkDropChainName;
relayerEnabled?: boolean;
}[];
step1CtaText?: string;
step2CtaText: string;
appDescription?: string;
};
};
export type ZkFormAppConfig = AppCommonConfig & {
type: "zkForm";
templateConfig: {
step1CtaText?: string;
step2CtaText: string;
appDescription?: string;
fields?: Field[];
congratulationsMessage?: {
title: string;
description: string;
};
failedMessage?: {
title: string;
description: string;
};
userSelection?: UserSelection; // default none
output: {
destination: {
type: "google_sheet";
spreadsheetId: string;
};
saveAuths?: boolean;
saveClaims?: boolean;
};
};
};
export type ZkTelegramBotAppConfig = AppCommonConfig & {
type: "zkTelegramBot";
templateConfig: {
step1CtaText?: string;
step2CtaText: string;
appDescription?: string;
telegramGroupId: string;
telegramInviteLink: string;
};
};
export type Field = ShortText | LongText | Select | Number | Social;
export type ShortText = InputCommon & {
type: "short-text";
};
export type LongText = InputCommon & {
type: "long-text";
};
export type Select = InputCommon & {
type: "select";
values: { id: string; label: string }[];
};
export type Number = InputCommon & {
type: "number";
};
export type Social = InputCommon & {
type: "social";
socialType: SocialType;
};
type InputCommon = {
label: string;
placeholder?: string;
initialValue?: string;
helperText?: string; // 80 characters max
maxCharacter?: number;
isRequired?: boolean;
};