-
Notifications
You must be signed in to change notification settings - Fork 80
/
index.ts
32 lines (27 loc) · 1.36 KB
/
index.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
import { schema } from "normalizr";
export const accountSchema = new schema.Entity("accounts", {}, { idAttribute: (value) => `${value.address}-${value.daoAvatarAddress}` });
export const daoSchema = new schema.Entity("daos", {}, { idAttribute: "address" });
export const proposalSchema = new schema.Entity("proposals", {}, { idAttribute: "proposalId" });
export const redemptionSchema = new schema.Entity("redemptions", {}, { idAttribute: (value) => `${value.proposalId}-${value.accountAddress}` });
export const stakeSchema = new schema.Entity("stakes", {}, { idAttribute: (value) => `${value.proposalId}-${value.stakerAddress}` });
export const voteSchema = new schema.Entity("votes", {}, { idAttribute: (value) => `${value.proposalId}-${value.voterAddress}` });
export const accountList = new schema.Array(accountSchema);
export const daoList = new schema.Array(daoSchema);
export const proposalList = new schema.Array(proposalSchema);
export const redemptionList = new schema.Array(redemptionSchema);
export const stakeList = new schema.Array(stakeSchema);
export const voteList = new schema.Array(voteSchema);
accountSchema.define({
redemptions: redemptionList,
stakes: stakeList,
votes: voteList
});
daoSchema.define({
members: accountList,
proposals: proposalList
});
proposalSchema.define({
redemptions: redemptionList,
stakes: stakeList,
votes: voteList
});