-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnapshotTypes.ts
201 lines (188 loc) · 3.44 KB
/
SnapshotTypes.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
192
193
194
195
196
197
198
199
200
201
export interface SpaceMetric {
categories?: string[];
followers?: number;
proposals?: number;
name: string;
network: string;
networks: string[];
}
export interface SpaceInfo {
name: string;
about: string;
avatar: string;
network: string;
proposalsCount: number;
followersCount: number;
voting: {
hideAbstain: boolean;
};
symbol: string;
validation: {
name: string;
params: any;
};
voteValidation: {
name: string;
params: any;
};
}
export interface SpaceSettings {
name: string;
avatar: string;
about: string;
network: string;
symbol: string;
website: string;
twitter: string;
github: string;
coingecko: string;
domain: string;
skin: string;
guidelines: string;
template: string;
private: boolean;
moderators: string[];
members: string[];
admins: string[];
categories: string[];
plugins: {
hal: {};
};
parent: string;
children: string[];
voting: {
delay: number;
hideAbstain: boolean;
period: number;
quorum: number;
type: string;
privacy: string;
};
strategies: {
name: string;
network: string;
params: {
symbol: string;
};
}[];
validation: {
name: string;
params: {};
};
filters: {
onlyMembers: boolean;
};
voteValidation: {
name: string;
params: {};
};
treasuries: string[];
}
export interface SpaceSearch {
id: string;
name: string;
avatar: string;
admins: string[];
moderators: string[];
}
export interface AllSpacesResponse {
[spaceId: string]: SpaceMetric;
}
export interface FollowedSpacesData {
id: string;
name: string;
activeProposals: number;
}
export enum SnapshotVotingType {
BASIC = "basic", // For Against Abstain
SINGLE_CHOICE = "single-choice",
APPROVAL = "approval", // Approve/Disapprove on multiple options
RANKED_CHOICE = "ranked-choice",
QUADRATIC = "quadratic",
WEIGHTED = "weighted", // give explicit weight
}
// Model for a single proposal
export interface SnapshotProposal {
id: string;
// content
author: string;
title: string;
body: string;
// metadata
type: string;
state: string;
created: number;
start: number;
end: number;
ipfs: string; // bafkreiete6tryrhksyt5gowckreabilu57zl4shjrl6kptkfy7oiowqd44
snapshot: string; // 16922147
// voting
choices: string[];
scores: number[];
votes: number;
quorum: number;
scores_total: number;
}
export interface ProposalOverviewQueryModel {
proposals: {
id: string;
state: string;
quorum: number;
scores_total: number;
}[];
votes: {
id: string;
proposal: {
id: string;
};
}[];
}
export interface SnapshotProposalsOverview {
[id: string]: {
// active closed pending
state: string;
// under quorum?
scores_total: number;
quorum: number;
// voted?
voted: boolean;
};
}
export interface SnapshotSpaceWithVotesCount {
id: string;
name: string;
votes: number;
}
export interface AllVotes {
total: number;
for: number;
against: number;
abstain: number;
}
// Model for a single vote
export interface SnapshotVote {
id: string;
// metadata
app: string;
created: number;
// voting
voter: string;
choice: any;
vp: number;
reason: string;
}
export type SnapshotVotedData = Omit<
SnapshotVote & {
proposal: {
id: string;
choices: string[];
type: string;
title: string;
};
space: {
id: string;
name: string;
};
},
"voter"
>;