-
Notifications
You must be signed in to change notification settings - Fork 17
/
ProposalService.js
79 lines (75 loc) · 1.45 KB
/
ProposalService.js
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
import { Storage } from 'aws-amplify';
import { gql } from 'apollo-boost';
export const GetMetaData = async (id) => {
const uri = await Storage.get(`proposal_${id}.json`);
try {
const res = await fetch(uri);
if (!res.ok) {
throw new Error(res.statusText);
}
return res.json();
} catch (err) {
return { error: err };
}
};
export const GET_PROPOSALS_QUERY = gql`
query {
proposals(orderBy: proposalIndex, orderDirection: desc) {
id
timestamp
startingPeriod
tokenTribute
sharesRequested
yesVotes
noVotes
applicantAddress
proposalIndex
didPass
aborted
details
processed
status @client
gracePeriod @client
votingEnds @client
votingStarts @client
readyForProcessing @client
votes {
memberAddress
uintVote
member {
shares
}
}
}
}
`;
export const GET_PROPOSAL_QUERY = gql`
query proposal($id: String!) {
proposal(id: $id) {
id
timestamp
tokenTribute
sharesRequested
startingPeriod
applicantAddress
yesVotes
noVotes
didPass
aborted
details
processed
status @client
gracePeriod @client
votingEnds @client
votingStarts @client
readyForProcessing @client
votes {
memberAddress
uintVote
member {
shares
}
}
}
}
`;