@show-karma/karma-gap-sdk 0.4.15 → 0.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/.cursorrules +43 -0
  2. package/core/abi/AirdropNFT.json +1 -1
  3. package/core/abi/Allo.json +860 -860
  4. package/core/abi/AlloRegistry.json +578 -578
  5. package/core/abi/CommunityResolverABI.json +506 -506
  6. package/core/abi/Donations.json +251 -251
  7. package/core/abi/EAS.json +1 -1
  8. package/core/abi/MultiAttester.json +746 -746
  9. package/core/abi/ProjectResolver.json +574 -574
  10. package/core/abi/SchemaRegistry.json +1 -1
  11. package/core/abi/index.ts +21 -0
  12. package/core/class/AllGapSchemas.ts +21 -0
  13. package/core/class/Attestation.ts +429 -0
  14. package/core/class/Fetcher.ts +224 -0
  15. package/core/class/GAP.ts +481 -0
  16. package/core/class/GapSchema.ts +93 -0
  17. package/core/class/Gelato/{Gelato.js → Gelato.ts} +23 -0
  18. package/core/class/GrantProgramRegistry/Allo.ts +188 -0
  19. package/core/class/GrantProgramRegistry/AlloRegistry.ts +101 -0
  20. package/core/class/GraphQL/AxiosGQL.ts +29 -0
  21. package/core/class/GraphQL/EASClient.ts +34 -0
  22. package/core/class/GraphQL/GapEasClient.ts +869 -0
  23. package/core/class/Schema.ts +659 -0
  24. package/core/class/SchemaError.ts +42 -0
  25. package/core/class/contract/GapContract.ts +457 -0
  26. package/core/class/entities/Community.ts +148 -0
  27. package/core/class/entities/ContributorProfile.ts +108 -0
  28. package/core/class/entities/Grant.ts +321 -0
  29. package/core/class/entities/GrantUpdate.ts +187 -0
  30. package/core/class/entities/MemberOf.ts +52 -0
  31. package/core/class/entities/Milestone.ts +898 -0
  32. package/core/class/entities/Project.ts +672 -0
  33. package/core/class/entities/ProjectImpact.ts +170 -0
  34. package/core/class/entities/ProjectMilestone.ts +254 -0
  35. package/core/class/entities/ProjectPointer.ts +39 -0
  36. package/core/class/entities/ProjectUpdate.ts +176 -0
  37. package/core/class/entities/Track.ts +32 -0
  38. package/core/class/karma-indexer/GapIndexerClient.ts +383 -0
  39. package/core/class/karma-indexer/api/GapIndexerApi.ts +446 -0
  40. package/core/class/karma-indexer/api/types.ts +313 -0
  41. package/core/class/remote-storage/IpfsStorage.ts +76 -0
  42. package/core/class/remote-storage/RemoteStorage.ts +65 -0
  43. package/core/class/types/allo.ts +93 -0
  44. package/core/class/types/attestations.ts +223 -0
  45. package/core/consts.ts +775 -0
  46. package/core/scripts/create-grant.ts +102 -0
  47. package/core/scripts/create-program.ts +43 -0
  48. package/core/scripts/create-schemas.ts +65 -0
  49. package/core/scripts/deploy.ts +65 -0
  50. package/core/scripts/index.ts +1 -0
  51. package/core/scripts/milestone-multi-grants.ts +125 -0
  52. package/core/shared/types.ts +13 -0
  53. package/core/types.ts +224 -0
  54. package/core/utils/gelato/send-gelato-txn.ts +114 -0
  55. package/core/utils/gelato/sponsor-handler.ts +77 -0
  56. package/core/utils/gelato/watch-gelato-txn.ts +67 -0
  57. package/core/utils/get-date.ts +3 -0
  58. package/core/utils/get-ipfs-data.ts +13 -0
  59. package/core/utils/get-web3-provider.ts +18 -0
  60. package/core/utils/gql-queries.ts +133 -0
  61. package/core/utils/map-filter.ts +21 -0
  62. package/core/utils/serialize-bigint.ts +7 -0
  63. package/core/utils/to-unix.ts +18 -0
  64. package/create-community-example.ts +119 -0
  65. package/csv-upload/README.md +74 -0
  66. package/csv-upload/config.ts +41 -0
  67. package/csv-upload/example.csv +2 -0
  68. package/csv-upload/keys.example.json +8 -0
  69. package/csv-upload/scripts/run.ts +417 -0
  70. package/csv-upload/types.ts +39 -0
  71. package/docs/.gitkeep +0 -0
  72. package/docs/images/attestation-architecture.png +0 -0
  73. package/docs/images/dfd-get-projects.png +0 -0
  74. package/gap-schema.yaml +155 -0
  75. package/milestone-workflow-example.ts +353 -0
  76. package/package.json +45 -39
  77. package/readme.md +872 -0
  78. package/schemas/.gitkeep +0 -0
  79. package/schemas/GAP-schemas-1692135812877.json +33 -0
  80. package/test-file-indexer-api.ts +25 -0
  81. package/tsconfig.json +26 -0
  82. package/core/abi/index.d.ts +0 -1114
  83. package/core/abi/index.js +0 -26
  84. package/core/class/AllGapSchemas.d.ts +0 -9
  85. package/core/class/AllGapSchemas.js +0 -19
  86. package/core/class/Attestation.d.ts +0 -173
  87. package/core/class/Attestation.js +0 -333
  88. package/core/class/Fetcher.d.ts +0 -175
  89. package/core/class/Fetcher.js +0 -13
  90. package/core/class/GAP.d.ts +0 -254
  91. package/core/class/GAP.js +0 -289
  92. package/core/class/GapSchema.d.ts +0 -34
  93. package/core/class/GapSchema.js +0 -62
  94. package/core/class/GrantProgramRegistry/Allo.d.ts +0 -17
  95. package/core/class/GrantProgramRegistry/Allo.js +0 -137
  96. package/core/class/GrantProgramRegistry/AlloRegistry.d.ts +0 -15
  97. package/core/class/GrantProgramRegistry/AlloRegistry.js +0 -70
  98. package/core/class/GraphQL/AxiosGQL.d.ts +0 -6
  99. package/core/class/GraphQL/AxiosGQL.js +0 -25
  100. package/core/class/GraphQL/EASClient.d.ts +0 -16
  101. package/core/class/GraphQL/EASClient.js +0 -26
  102. package/core/class/GraphQL/GapEasClient.d.ts +0 -71
  103. package/core/class/GraphQL/GapEasClient.js +0 -451
  104. package/core/class/GraphQL/index.js +0 -19
  105. package/core/class/Schema.d.ts +0 -233
  106. package/core/class/Schema.js +0 -488
  107. package/core/class/SchemaError.d.ts +0 -30
  108. package/core/class/SchemaError.js +0 -39
  109. package/core/class/contract/GapContract.d.ts +0 -102
  110. package/core/class/contract/GapContract.js +0 -285
  111. package/core/class/entities/Community.d.ts +0 -34
  112. package/core/class/entities/Community.js +0 -109
  113. package/core/class/entities/ContributorProfile.d.ts +0 -41
  114. package/core/class/entities/ContributorProfile.js +0 -69
  115. package/core/class/entities/Grant.d.ts +0 -54
  116. package/core/class/entities/Grant.js +0 -223
  117. package/core/class/entities/GrantUpdate.d.ts +0 -40
  118. package/core/class/entities/GrantUpdate.js +0 -114
  119. package/core/class/entities/MemberOf.d.ts +0 -11
  120. package/core/class/entities/MemberOf.js +0 -33
  121. package/core/class/entities/Milestone.d.ts +0 -168
  122. package/core/class/entities/Milestone.js +0 -657
  123. package/core/class/entities/Project.d.ts +0 -92
  124. package/core/class/entities/Project.js +0 -418
  125. package/core/class/entities/ProjectImpact.d.ts +0 -50
  126. package/core/class/entities/ProjectImpact.js +0 -112
  127. package/core/class/entities/ProjectMilestone.d.ts +0 -60
  128. package/core/class/entities/ProjectMilestone.js +0 -174
  129. package/core/class/entities/ProjectPointer.d.ts +0 -12
  130. package/core/class/entities/ProjectPointer.js +0 -22
  131. package/core/class/entities/ProjectUpdate.d.ts +0 -50
  132. package/core/class/entities/ProjectUpdate.js +0 -110
  133. package/core/class/entities/Track.d.ts +0 -16
  134. package/core/class/entities/Track.js +0 -21
  135. package/core/class/entities/index.js +0 -26
  136. package/core/class/index.js +0 -26
  137. package/core/class/karma-indexer/GapIndexerClient.d.ts +0 -66
  138. package/core/class/karma-indexer/GapIndexerClient.js +0 -207
  139. package/core/class/karma-indexer/api/GapIndexerApi.d.ts +0 -73
  140. package/core/class/karma-indexer/api/GapIndexerApi.js +0 -256
  141. package/core/class/karma-indexer/api/types.d.ts +0 -295
  142. package/core/class/karma-indexer/api/types.js +0 -2
  143. package/core/class/remote-storage/IpfsStorage.d.ts +0 -23
  144. package/core/class/remote-storage/IpfsStorage.js +0 -56
  145. package/core/class/remote-storage/RemoteStorage.d.ts +0 -41
  146. package/core/class/remote-storage/RemoteStorage.js +0 -38
  147. package/core/class/types/allo.d.ts +0 -78
  148. package/core/class/types/allo.js +0 -2
  149. package/core/class/types/attestations.d.ts +0 -168
  150. package/core/class/types/attestations.js +0 -66
  151. package/core/consts.d.ts +0 -48
  152. package/core/consts.js +0 -641
  153. package/core/index.js +0 -24
  154. package/core/shared/types.d.ts +0 -6
  155. package/core/shared/types.js +0 -2
  156. package/core/types.d.ts +0 -131
  157. package/core/types.js +0 -13
  158. package/core/utils/gelato/index.js +0 -19
  159. package/core/utils/gelato/send-gelato-txn.d.ts +0 -55
  160. package/core/utils/gelato/send-gelato-txn.js +0 -100
  161. package/core/utils/gelato/sponsor-handler.d.ts +0 -9
  162. package/core/utils/gelato/sponsor-handler.js +0 -60
  163. package/core/utils/gelato/watch-gelato-txn.d.ts +0 -7
  164. package/core/utils/gelato/watch-gelato-txn.js +0 -63
  165. package/core/utils/get-date.d.ts +0 -1
  166. package/core/utils/get-date.js +0 -7
  167. package/core/utils/get-ipfs-data.d.ts +0 -1
  168. package/core/utils/get-ipfs-data.js +0 -20
  169. package/core/utils/get-web3-provider.d.ts +0 -2
  170. package/core/utils/get-web3-provider.js +0 -18
  171. package/core/utils/gql-queries.d.ts +0 -12
  172. package/core/utils/gql-queries.js +0 -90
  173. package/core/utils/index.js +0 -23
  174. package/core/utils/map-filter.d.ts +0 -8
  175. package/core/utils/map-filter.js +0 -20
  176. package/core/utils/serialize-bigint.d.ts +0 -1
  177. package/core/utils/serialize-bigint.js +0 -8
  178. package/core/utils/to-unix.d.ts +0 -1
  179. package/core/utils/to-unix.js +0 -25
  180. package/index.js +0 -17
  181. /package/core/class/GraphQL/{index.d.ts → index.ts} +0 -0
  182. /package/core/class/entities/{index.d.ts → index.ts} +0 -0
  183. /package/core/class/{index.d.ts → index.ts} +0 -0
  184. /package/core/{index.d.ts → index.ts} +0 -0
  185. /package/core/utils/gelato/{index.d.ts → index.ts} +0 -0
  186. /package/core/utils/{index.d.ts → index.ts} +0 -0
  187. /package/{core/class/Gelato/Gelato.d.ts → csv-upload/.gitkeep} +0 -0
  188. /package/{index.d.ts → index.ts} +0 -0
@@ -1,207 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GapIndexerClient = void 0;
4
- const Attestation_1 = require("../Attestation");
5
- const Fetcher_1 = require("../Fetcher");
6
- const entities_1 = require("../entities");
7
- const GapIndexerApi_1 = require("./api/GapIndexerApi");
8
- const ProjectMilestone_1 = require("../entities/ProjectMilestone");
9
- const Endpoints = {
10
- attestations: {
11
- all: () => "/attestations",
12
- byUid: (uid) => `/attestations/${uid}`,
13
- },
14
- communities: {
15
- all: () => "/communities",
16
- byUidOrSlug: (uidOrSlug) => `/communities/${uidOrSlug}`,
17
- grants: (uidOrSlug) => `/communities/${uidOrSlug}/grants`,
18
- },
19
- grantees: {
20
- all: () => "/grantees",
21
- byAddress: (address) => `/grantees/${address}`,
22
- grants: (address) => `/grantees/${address}/grants`,
23
- projects: (address) => `/grantees/${address}/projects`,
24
- communities: (address, withGrants) => `/grantees/${address}/communities${withGrants ? "?withGrants=true" : ""}`,
25
- communitiesAdmin: (address, withGrants) => `/grantees/${address}/communities/admin${withGrants ? "?withGrants=true" : ""}`,
26
- },
27
- grants: {
28
- all: () => "/grants",
29
- byUid: (uid) => `/grants/${uid}`,
30
- byExternalId: (id) => `/grants/external-id/${id}`,
31
- },
32
- project: {
33
- all: () => "/projects",
34
- byUidOrSlug: (uidOrSlug) => `/projects/${uidOrSlug}`,
35
- grants: (uidOrSlug) => `/projects/${uidOrSlug}/grants`,
36
- milestones: (uidOrSlug) => `/projects/${uidOrSlug}/milestones`,
37
- },
38
- };
39
- class GapIndexerClient extends Fetcher_1.Fetcher {
40
- constructor(params) {
41
- super(params);
42
- this.apiClient = new GapIndexerApi_1.GapIndexerApi(params);
43
- }
44
- async attestation(uid) {
45
- const { data } = await this.apiClient.attestation(uid);
46
- if (!data)
47
- throw new Error("Attestation not found");
48
- return Attestation_1.Attestation.fromInterface([data], this.gap.network)[0];
49
- }
50
- async attestations(schemaName, search) {
51
- const schemaUID = this.gap.findSchema(schemaName).uid;
52
- const { data } = await this.apiClient.attestations(schemaUID, search);
53
- return data || [];
54
- }
55
- async attestationsOf(schemaName, attester) {
56
- const schemaUID = this.gap.findSchema(schemaName).uid;
57
- const { data } = await this.apiClient.attestationsOf(schemaUID, attester);
58
- return data || [];
59
- }
60
- attestationsTo(schemaName, recipient) {
61
- return this.attestationsOf(schemaName, recipient);
62
- }
63
- async communities(search) {
64
- const { data } = await this.apiClient.communities(search);
65
- return entities_1.Community.from(data, this.gap.network);
66
- }
67
- async communitiesOf(address, withGrants) {
68
- const { data } = await this.apiClient.communitiesOf(address, withGrants);
69
- return entities_1.Community.from(data, this.gap.network);
70
- }
71
- async adminOf(address) {
72
- const { data } = await this.apiClient.adminOf(address);
73
- return entities_1.Community.from(data, this.gap.network);
74
- }
75
- async communitiesAdminOf(address, withGrants) {
76
- const { data } = await this.client.get(Endpoints.grantees.communitiesAdmin(address, withGrants));
77
- return entities_1.Community.from(data, this.gap.network);
78
- }
79
- communitiesByIds(uids) {
80
- throw new Error("Method not implemented.");
81
- }
82
- async communityBySlug(slug) {
83
- const { data } = await this.apiClient.communityBySlug(slug);
84
- return entities_1.Community.from([data], this.gap.network)[0];
85
- }
86
- communityById(uid) {
87
- return this.communityBySlug(uid);
88
- }
89
- async communityAdmins(uid) {
90
- const { data } = await this.apiClient.communityAdmins(uid);
91
- return data;
92
- }
93
- async projectBySlug(slug) {
94
- const { data } = await this.apiClient.projectBySlug(slug);
95
- return entities_1.Project.from([data], this.gap.network)[0];
96
- }
97
- projectById(uid) {
98
- return this.projectBySlug(uid);
99
- }
100
- async search(query) {
101
- const { data } = await this.apiClient.search(query);
102
- return { data };
103
- }
104
- async searchProjects(query) {
105
- const { data } = await this.apiClient.searchProjects(query);
106
- return entities_1.Project.from(data, this.gap.network);
107
- }
108
- async projects(name) {
109
- const { data } = await this.apiClient.projects(name);
110
- return entities_1.Project.from(data, this.gap.network);
111
- }
112
- async projectsOf(grantee) {
113
- const { data } = await this.apiClient.projectsOf(grantee);
114
- return entities_1.Project.from(data, this.gap.network);
115
- }
116
- async projectMilestones(uidOrSlug) {
117
- const { data } = await this.apiClient.projectMilestones(uidOrSlug);
118
- return ProjectMilestone_1.ProjectMilestone.from(data, this.gap.network);
119
- }
120
- async grantee(address) {
121
- const { data } = await this.apiClient.grantee(address);
122
- return data;
123
- }
124
- async grantees() {
125
- const { data } = await this.apiClient.grantees();
126
- return data; // TODO: Remove this casting after the api is fixed
127
- }
128
- async grantsOf(grantee, withCommunity) {
129
- const { data } = await this.apiClient.grantsOf(grantee, withCommunity);
130
- return entities_1.Grant.from(data, this.gap.network);
131
- }
132
- async grantsFor(projects, withCommunity) {
133
- const { data } = await this.apiClient.grantsFor(projects[0].uid, withCommunity);
134
- return entities_1.Grant.from(data, this.gap.network);
135
- }
136
- async grantsForExtProject(projectExtId) {
137
- const { data } = await this.apiClient.grantsForExtProject(projectExtId);
138
- return entities_1.Grant.from(data, this.gap.network);
139
- }
140
- async grantsByCommunity(uid, page = 0, pageLimit = 100) {
141
- const { data } = await this.apiClient.grantsByCommunity(uid, page, pageLimit);
142
- const grants = data.data;
143
- return entities_1.Grant.from(grants, this.gap.network);
144
- }
145
- async milestonesOf(grants) {
146
- const { data } = await this.apiClient.milestonesOf(grants[0].uid);
147
- return entities_1.Milestone.from(data, this.gap.network);
148
- }
149
- async membersOf(projects) {
150
- throw new Error("Method not implemented.");
151
- }
152
- async slugExists(slug) {
153
- return await this.apiClient.slugExists(slug);
154
- }
155
- /**
156
- * Track related methods
157
- */
158
- async getTracks(communityUID, includeArchived = false) {
159
- const { data } = await this.apiClient.getTracks(communityUID, includeArchived);
160
- return entities_1.Track.from(data, this.gap.network);
161
- }
162
- async getTrackById(id) {
163
- const { data } = await this.apiClient.getTrackById(id);
164
- return entities_1.Track.from([data], this.gap.network)[0];
165
- }
166
- async createTrack(trackData) {
167
- const { data } = await this.apiClient.createTrack(trackData);
168
- return entities_1.Track.from([data], this.gap.network)[0];
169
- }
170
- async updateTrack(id, trackData) {
171
- const { data } = await this.apiClient.updateTrack(id, trackData);
172
- return entities_1.Track.from([data], this.gap.network)[0];
173
- }
174
- async archiveTrack(id) {
175
- const { data } = await this.apiClient.archiveTrack(id);
176
- return entities_1.Track.from([data], this.gap.network)[0];
177
- }
178
- async assignTracksToProgram(programId, trackIds) {
179
- const { data } = await this.apiClient.assignTracksToProgram(programId, trackIds);
180
- return data;
181
- }
182
- async unassignTrackFromProgram(programId, trackId) {
183
- const { data } = await this.apiClient.unassignTrackFromProgram(programId, trackId);
184
- return data;
185
- }
186
- async getTracksForProgram(programId) {
187
- const { data } = await this.apiClient.getTracksForProgram(programId);
188
- return entities_1.Track.from(data, this.gap.network);
189
- }
190
- async getTracksForProject(projectId, programId, activeOnly = true) {
191
- const { data } = await this.apiClient.getTracksForProject(projectId, programId, activeOnly);
192
- return entities_1.Track.from(data, this.gap.network);
193
- }
194
- async assignTracksToProject(projectId, programId, trackIds) {
195
- const { data } = await this.apiClient.assignTracksToProject(projectId, programId, trackIds);
196
- return data;
197
- }
198
- async unassignTracksFromProject(projectId, programId, trackIds) {
199
- const { data } = await this.apiClient.unassignTracksFromProject(projectId, programId, trackIds);
200
- return data;
201
- }
202
- async getProjectsByTrack(communityId, programId, trackId) {
203
- const { data } = await this.apiClient.getProjectsByTrack(communityId, programId, trackId);
204
- return data;
205
- }
206
- }
207
- exports.GapIndexerClient = GapIndexerClient;
@@ -1,73 +0,0 @@
1
- import { AxiosGQL } from "../../GraphQL/AxiosGQL";
2
- import { Hex, IAttestationResponse, ICommunityResponse, ICommunityAdminsResponse, IGrantResponse, IProjectResponse, ISearchResponse, IProjectMilestoneResponse, ITrackResponse, ITrackAssignmentResponse, IProjectTrackResponse } from "./types";
3
- export declare class GapIndexerApi extends AxiosGQL {
4
- constructor(url: string);
5
- attestation(uid: Hex): Promise<import("axios").AxiosResponse<IAttestationResponse, any>>;
6
- attestations(schemaUID: string, search?: string): Promise<import("axios").AxiosResponse<IAttestationResponse[], any>>;
7
- attestationsOf(schemaUID: string, attester: Hex): Promise<import("axios").AxiosResponse<IAttestationResponse[], any>>;
8
- /**
9
- * Community
10
- */
11
- communities(search?: string): Promise<import("axios").AxiosResponse<ICommunityResponse[], any>>;
12
- communitiesOf(address: Hex, withGrants: boolean): Promise<import("axios").AxiosResponse<ICommunityResponse[], any>>;
13
- adminOf(address: Hex): Promise<import("axios").AxiosResponse<ICommunityResponse[], any>>;
14
- communityBySlug(slug: string): Promise<import("axios").AxiosResponse<ICommunityResponse, any>>;
15
- communityAdmins(uid: Hex): Promise<import("axios").AxiosResponse<ICommunityAdminsResponse, any>>;
16
- /**
17
- * Project
18
- */
19
- projectBySlug(slug: string): Promise<import("axios").AxiosResponse<IProjectResponse, any>>;
20
- search(query: string): Promise<import("axios").AxiosResponse<ISearchResponse, any>>;
21
- searchProjects(query: string): Promise<import("axios").AxiosResponse<IProjectResponse[], any>>;
22
- projects(name?: string): Promise<import("axios").AxiosResponse<IProjectResponse[], any>>;
23
- projectsOf(grantee: Hex): Promise<import("axios").AxiosResponse<IProjectResponse[], any>>;
24
- projectMilestones(uidOrSlug: string): Promise<import("axios").AxiosResponse<IProjectMilestoneResponse[], any>>;
25
- /**
26
- * Grantee
27
- */
28
- grantee(address: Hex): Promise<import("axios").AxiosResponse<any, any>>;
29
- grantees(): Promise<import("axios").AxiosResponse<{
30
- [key: `0x${string}`]: {
31
- grants: number;
32
- projects: number;
33
- };
34
- }, any>>;
35
- /**
36
- * Grant
37
- */
38
- grantsOf(grantee: Hex, withCommunity?: boolean): Promise<import("axios").AxiosResponse<IGrantResponse[], any>>;
39
- grantsFor(uid: string, withCommunity?: boolean): Promise<import("axios").AxiosResponse<IGrantResponse[], any>>;
40
- grantsForExtProject(projectExtId: string): Promise<import("axios").AxiosResponse<IGrantResponse[], any>>;
41
- grantBySlug(slug: Hex): Promise<import("axios").AxiosResponse<IGrantResponse, any>>;
42
- grantsByCommunity(uid: Hex, page?: number, pageLimit?: number): Promise<import("axios").AxiosResponse<{
43
- data: IGrantResponse[];
44
- }, any>>;
45
- /**
46
- * Milestone
47
- */
48
- milestonesOf(uid: Hex): Promise<import("axios").AxiosResponse<any, any>>;
49
- slugExists(slug: string): Promise<boolean>;
50
- /**
51
- * Tracks
52
- */
53
- getTracks(communityUID: string, includeArchived?: boolean): Promise<import("axios").AxiosResponse<ITrackResponse[], any>>;
54
- getTrackById(id: string): Promise<import("axios").AxiosResponse<ITrackResponse, any>>;
55
- createTrack(data: {
56
- name: string;
57
- description?: string;
58
- communityUID: string;
59
- }): Promise<import("axios").AxiosResponse<ITrackResponse, any>>;
60
- updateTrack(id: string, data: {
61
- name?: string;
62
- description?: string;
63
- communityUID?: string;
64
- }): Promise<import("axios").AxiosResponse<ITrackResponse, any>>;
65
- archiveTrack(id: string): Promise<import("axios").AxiosResponse<ITrackResponse, any>>;
66
- assignTracksToProgram(programId: string, trackIds: string[]): Promise<import("axios").AxiosResponse<ITrackAssignmentResponse[], any>>;
67
- unassignTrackFromProgram(programId: string, trackId: string): Promise<import("axios").AxiosResponse<ITrackAssignmentResponse, any>>;
68
- getTracksForProgram(programId: string): Promise<import("axios").AxiosResponse<ITrackResponse[], any>>;
69
- getTracksForProject(projectId: string, programId: string, activeOnly?: boolean): Promise<import("axios").AxiosResponse<ITrackResponse[], any>>;
70
- assignTracksToProject(projectId: string, programId: string, trackIds: string[]): Promise<import("axios").AxiosResponse<any[], any>>;
71
- unassignTracksFromProject(projectId: string, programId: string, trackIds: string[]): Promise<import("axios").AxiosResponse<any[], any>>;
72
- getProjectsByTrack(communityId: string, programId: string, trackId?: string): Promise<import("axios").AxiosResponse<IProjectTrackResponse[], any>>;
73
- }
@@ -1,256 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GapIndexerApi = void 0;
4
- const AxiosGQL_1 = require("../../GraphQL/AxiosGQL");
5
- const Endpoints = {
6
- attestations: {
7
- all: () => "/attestations",
8
- byUid: (uid) => `/attestations/${uid}`,
9
- },
10
- communities: {
11
- all: () => "/communities",
12
- admins: (uid) => `/communities/${uid}/admins`,
13
- byUidOrSlug: (uidOrSlug) => `/communities/${uidOrSlug}`,
14
- grants: (uidOrSlug, page = 0, pageLimit = 100) => `/communities/${uidOrSlug}/grants?${page ? `page=${page}` : ""}${pageLimit ? `&pageLimit=${pageLimit}` : ""}`,
15
- },
16
- grantees: {
17
- all: () => "/grantees",
18
- byAddress: (address) => `/grantees/${address}`,
19
- grants: (address) => `/grantees/${address}/grants`,
20
- projects: (address) => `/grantees/${address}/projects`,
21
- communities: (address, withGrants) => `/grantees/${address}/communities${withGrants ? "?withGrants=true" : ""}`,
22
- adminOf: (address) => `/grantees/${address}/communities/admin`,
23
- },
24
- grants: {
25
- all: () => "/grants",
26
- byUid: (uid) => `/grants/${uid}`,
27
- byExternalId: (id) => `/grants/external-id/${id}`,
28
- },
29
- project: {
30
- all: () => "/projects",
31
- checkSlug: (slug) => `/projects/check-slug/${slug}`,
32
- byUidOrSlug: (uidOrSlug) => `/projects/${uidOrSlug}`,
33
- grants: (uidOrSlug) => `/projects/${uidOrSlug}/grants`,
34
- milestones: (uidOrSlug) => `/projects/${uidOrSlug}/milestones`,
35
- projectMilestones: (uidOrSlug) => `/projects/${uidOrSlug}/project-milestones`,
36
- },
37
- search: {
38
- all: () => "/search",
39
- },
40
- tracks: {
41
- all: () => "/tracks",
42
- byId: (id) => `/tracks/${id}`,
43
- byCommunity: (communityUID, includeArchived = false) => `/tracks?communityUID=${communityUID}${includeArchived ? "&includeArchived=true" : ""}`,
44
- },
45
- programs: {
46
- tracks: {
47
- all: (programId) => `/programs/${programId}/tracks`,
48
- assign: (programId) => `/programs/${programId}/tracks`,
49
- remove: (programId, trackId) => `/programs/${programId}/tracks/${trackId}`,
50
- },
51
- },
52
- projectTracks: {
53
- all: (projectId, programId, activeOnly = true) => `/programs/${programId}/projects/${projectId}/tracks${activeOnly ? "" : "?activeOnly=false"}`,
54
- assign: (projectId) => `/projects/${projectId}/tracks`,
55
- remove: (programId, projectId) => `/programs/${programId}/project/${projectId}/tracks`,
56
- },
57
- community: {
58
- programProjects: (communityId, programId, trackId) => `/community/${communityId}/program/${programId}/projects${trackId ? `?trackId=${trackId}` : ""}`,
59
- },
60
- };
61
- class GapIndexerApi extends AxiosGQL_1.AxiosGQL {
62
- constructor(url) {
63
- super(url);
64
- }
65
- async attestation(uid) {
66
- const response = await this.client.get(Endpoints.attestations.byUid(uid));
67
- return response;
68
- }
69
- async attestations(schemaUID, search) {
70
- const response = await this.client.get(Endpoints.attestations.all(), {
71
- params: {
72
- "filter[schemaUID]": schemaUID,
73
- "filter[data]": search,
74
- },
75
- });
76
- return response;
77
- }
78
- async attestationsOf(schemaUID, attester) {
79
- const response = await this.client.get(Endpoints.attestations.all(), {
80
- params: {
81
- "filter[schemaUID]": schemaUID,
82
- "filter[recipient]": attester,
83
- },
84
- });
85
- return response;
86
- }
87
- /**
88
- * Community
89
- */
90
- async communities(search) {
91
- const response = await this.client.get(Endpoints.communities.all(), {
92
- params: {
93
- "filter[name]": search,
94
- },
95
- });
96
- return response;
97
- }
98
- async communitiesOf(address, withGrants) {
99
- const response = await this.client.get(Endpoints.grantees.communities(address, withGrants));
100
- return response;
101
- }
102
- async adminOf(address) {
103
- const response = await this.client.get(Endpoints.grantees.adminOf(address));
104
- return response;
105
- }
106
- async communityBySlug(slug) {
107
- const response = await this.client.get(Endpoints.communities.byUidOrSlug(slug));
108
- return response;
109
- }
110
- async communityAdmins(uid) {
111
- const response = await this.client.get(Endpoints.communities.admins(uid));
112
- return response;
113
- }
114
- /**
115
- * Project
116
- */
117
- async projectBySlug(slug) {
118
- const response = await this.client.get(Endpoints.project.byUidOrSlug(slug));
119
- return response;
120
- }
121
- async search(query) {
122
- const response = await this.client.get(Endpoints.search.all(), {
123
- params: {
124
- q: query,
125
- },
126
- });
127
- return response;
128
- }
129
- async searchProjects(query) {
130
- const response = await this.client.get(Endpoints.project.all(), {
131
- params: {
132
- q: query,
133
- },
134
- });
135
- return response;
136
- }
137
- async projects(name) {
138
- const response = await this.client.get(Endpoints.project.all(), {
139
- params: {
140
- "filter[title]": name,
141
- },
142
- });
143
- return response;
144
- }
145
- async projectsOf(grantee) {
146
- const response = await this.client.get(Endpoints.grantees.projects(grantee));
147
- return response;
148
- }
149
- async projectMilestones(uidOrSlug) {
150
- const response = await this.client.get(Endpoints.project.projectMilestones(uidOrSlug));
151
- return response;
152
- }
153
- /**
154
- * Grantee
155
- */
156
- async grantee(address) {
157
- // TODO: update response type when the endpoint works
158
- const response = await this.client.get(Endpoints.grantees.byAddress(address));
159
- return response;
160
- }
161
- async grantees() {
162
- const response = await this.client.get(Endpoints.grantees.all());
163
- return response;
164
- }
165
- /**
166
- * Grant
167
- */
168
- async grantsOf(grantee, withCommunity) {
169
- const response = await this.client.get(Endpoints.grantees.grants(grantee));
170
- return response;
171
- }
172
- async grantsFor(uid, withCommunity) {
173
- const response = await this.client.get(Endpoints.project.grants(uid));
174
- return response;
175
- }
176
- async grantsForExtProject(projectExtId) {
177
- const response = await this.client.get(Endpoints.grants.byExternalId(projectExtId));
178
- return response;
179
- }
180
- async grantBySlug(slug) {
181
- const response = await this.client.get(Endpoints.grants.byUid(slug));
182
- return response;
183
- }
184
- async grantsByCommunity(uid, page = 0, pageLimit = 100) {
185
- const response = await this.client.get(Endpoints.communities.grants(uid, page, pageLimit));
186
- return response;
187
- }
188
- /**
189
- * Milestone
190
- */
191
- async milestonesOf(uid) {
192
- const response = await this.client.get(Endpoints.project.milestones(uid));
193
- return response;
194
- }
195
- async slugExists(slug) {
196
- try {
197
- await this.client.get(Endpoints.project.checkSlug(slug));
198
- return true;
199
- }
200
- catch (err) {
201
- return false;
202
- }
203
- }
204
- /**
205
- * Tracks
206
- */
207
- async getTracks(communityUID, includeArchived = false) {
208
- const response = await this.client.get(Endpoints.tracks.byCommunity(communityUID, includeArchived));
209
- return response;
210
- }
211
- async getTrackById(id) {
212
- const response = await this.client.get(Endpoints.tracks.byId(id));
213
- return response;
214
- }
215
- async createTrack(data) {
216
- const response = await this.client.post(Endpoints.tracks.all(), data);
217
- return response;
218
- }
219
- async updateTrack(id, data) {
220
- const response = await this.client.put(Endpoints.tracks.byId(id), data);
221
- return response;
222
- }
223
- async archiveTrack(id) {
224
- const response = await this.client.delete(Endpoints.tracks.byId(id));
225
- return response;
226
- }
227
- async assignTracksToProgram(programId, trackIds) {
228
- const response = await this.client.post(Endpoints.programs.tracks.assign(programId), { trackIds });
229
- return response;
230
- }
231
- async unassignTrackFromProgram(programId, trackId) {
232
- const response = await this.client.delete(Endpoints.programs.tracks.remove(programId, trackId));
233
- return response;
234
- }
235
- async getTracksForProgram(programId) {
236
- const response = await this.client.get(Endpoints.programs.tracks.all(programId));
237
- return response;
238
- }
239
- async getTracksForProject(projectId, programId, activeOnly = true) {
240
- const response = await this.client.get(Endpoints.projectTracks.all(projectId, programId, activeOnly));
241
- return response;
242
- }
243
- async assignTracksToProject(projectId, programId, trackIds) {
244
- const response = await this.client.post(Endpoints.projectTracks.assign(projectId), { trackIds, programId });
245
- return response;
246
- }
247
- async unassignTracksFromProject(projectId, programId, trackIds) {
248
- const response = await this.client.delete(Endpoints.projectTracks.remove(programId, projectId), { data: { trackIds } });
249
- return response;
250
- }
251
- async getProjectsByTrack(communityId, programId, trackId) {
252
- const response = await this.client.get(Endpoints.community.programProjects(communityId, programId, trackId));
253
- return response;
254
- }
255
- }
256
- exports.GapIndexerApi = GapIndexerApi;