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

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/core/abi/AirdropNFT.json +1 -1
  2. package/core/abi/Allo.json +860 -860
  3. package/core/abi/AlloRegistry.json +578 -578
  4. package/core/abi/CommunityResolverABI.json +506 -506
  5. package/core/abi/Donations.json +251 -251
  6. package/core/abi/EAS.json +1 -1
  7. package/core/abi/MultiAttester.json +746 -746
  8. package/core/abi/ProjectResolver.json +574 -574
  9. package/core/abi/SchemaRegistry.json +1 -1
  10. package/core/abi/index.d.ts +1114 -0
  11. package/core/abi/index.js +26 -0
  12. package/core/class/AllGapSchemas.d.ts +9 -0
  13. package/core/class/AllGapSchemas.js +19 -0
  14. package/core/class/Attestation.d.ts +173 -0
  15. package/core/class/Attestation.js +333 -0
  16. package/core/class/Fetcher.d.ts +175 -0
  17. package/core/class/Fetcher.js +13 -0
  18. package/core/class/GAP.d.ts +254 -0
  19. package/core/class/GAP.js +289 -0
  20. package/core/class/GapSchema.d.ts +34 -0
  21. package/core/class/GapSchema.js +62 -0
  22. package/core/class/Gelato/{Gelato.ts → Gelato.js} +0 -23
  23. package/core/class/GrantProgramRegistry/Allo.d.ts +17 -0
  24. package/core/class/GrantProgramRegistry/Allo.js +137 -0
  25. package/core/class/GrantProgramRegistry/AlloRegistry.d.ts +15 -0
  26. package/core/class/GrantProgramRegistry/AlloRegistry.js +70 -0
  27. package/core/class/GraphQL/AxiosGQL.d.ts +6 -0
  28. package/core/class/GraphQL/AxiosGQL.js +25 -0
  29. package/core/class/GraphQL/EASClient.d.ts +16 -0
  30. package/core/class/GraphQL/EASClient.js +26 -0
  31. package/core/class/GraphQL/GapEasClient.d.ts +71 -0
  32. package/core/class/GraphQL/GapEasClient.js +451 -0
  33. package/core/class/GraphQL/index.js +19 -0
  34. package/core/class/Schema.d.ts +233 -0
  35. package/core/class/Schema.js +490 -0
  36. package/core/class/SchemaError.d.ts +30 -0
  37. package/core/class/SchemaError.js +39 -0
  38. package/core/class/contract/GapContract.d.ts +102 -0
  39. package/core/class/contract/GapContract.js +285 -0
  40. package/core/class/entities/Community.d.ts +34 -0
  41. package/core/class/entities/Community.js +109 -0
  42. package/core/class/entities/ContributorProfile.d.ts +41 -0
  43. package/core/class/entities/ContributorProfile.js +69 -0
  44. package/core/class/entities/Grant.d.ts +54 -0
  45. package/core/class/entities/Grant.js +223 -0
  46. package/core/class/entities/GrantUpdate.d.ts +62 -0
  47. package/core/class/entities/GrantUpdate.js +114 -0
  48. package/core/class/entities/MemberOf.d.ts +11 -0
  49. package/core/class/entities/MemberOf.js +33 -0
  50. package/core/class/entities/Milestone.d.ts +168 -0
  51. package/core/class/entities/Milestone.js +657 -0
  52. package/core/class/entities/Project.d.ts +92 -0
  53. package/core/class/entities/Project.js +418 -0
  54. package/core/class/entities/ProjectImpact.d.ts +50 -0
  55. package/core/class/entities/ProjectImpact.js +112 -0
  56. package/core/class/entities/ProjectMilestone.d.ts +60 -0
  57. package/core/class/entities/ProjectMilestone.js +174 -0
  58. package/core/class/entities/ProjectPointer.d.ts +12 -0
  59. package/core/class/entities/ProjectPointer.js +22 -0
  60. package/core/class/entities/ProjectUpdate.d.ts +50 -0
  61. package/core/class/entities/ProjectUpdate.js +110 -0
  62. package/core/class/entities/Track.d.ts +16 -0
  63. package/core/class/entities/Track.js +21 -0
  64. package/core/class/entities/index.js +26 -0
  65. package/core/class/index.js +26 -0
  66. package/core/class/karma-indexer/GapIndexerClient.d.ts +66 -0
  67. package/core/class/karma-indexer/GapIndexerClient.js +207 -0
  68. package/core/class/karma-indexer/api/GapIndexerApi.d.ts +73 -0
  69. package/core/class/karma-indexer/api/GapIndexerApi.js +256 -0
  70. package/core/class/karma-indexer/api/types.d.ts +309 -0
  71. package/core/class/karma-indexer/api/types.js +2 -0
  72. package/core/class/remote-storage/IpfsStorage.d.ts +23 -0
  73. package/core/class/remote-storage/IpfsStorage.js +56 -0
  74. package/core/class/remote-storage/RemoteStorage.d.ts +41 -0
  75. package/core/class/remote-storage/RemoteStorage.js +38 -0
  76. package/core/class/types/allo.d.ts +78 -0
  77. package/core/class/types/allo.js +2 -0
  78. package/core/class/types/attestations.d.ts +173 -0
  79. package/core/class/types/attestations.js +66 -0
  80. package/core/consts.d.ts +50 -0
  81. package/core/consts.js +699 -0
  82. package/core/index.js +24 -0
  83. package/core/shared/types.d.ts +13 -0
  84. package/core/shared/types.js +2 -0
  85. package/core/types.d.ts +131 -0
  86. package/core/types.js +13 -0
  87. package/core/utils/gelato/index.js +19 -0
  88. package/core/utils/gelato/send-gelato-txn.d.ts +55 -0
  89. package/core/utils/gelato/send-gelato-txn.js +100 -0
  90. package/core/utils/gelato/sponsor-handler.d.ts +9 -0
  91. package/core/utils/gelato/sponsor-handler.js +60 -0
  92. package/core/utils/gelato/watch-gelato-txn.d.ts +7 -0
  93. package/core/utils/gelato/watch-gelato-txn.js +63 -0
  94. package/core/utils/get-date.d.ts +1 -0
  95. package/core/utils/get-date.js +7 -0
  96. package/core/utils/get-ipfs-data.d.ts +1 -0
  97. package/core/utils/get-ipfs-data.js +20 -0
  98. package/core/utils/get-web3-provider.d.ts +2 -0
  99. package/core/utils/get-web3-provider.js +18 -0
  100. package/core/utils/gql-queries.d.ts +12 -0
  101. package/core/utils/gql-queries.js +90 -0
  102. package/core/utils/index.js +23 -0
  103. package/core/utils/map-filter.d.ts +8 -0
  104. package/core/utils/map-filter.js +20 -0
  105. package/core/utils/serialize-bigint.d.ts +1 -0
  106. package/core/utils/serialize-bigint.js +8 -0
  107. package/core/utils/to-unix.d.ts +1 -0
  108. package/core/utils/to-unix.js +25 -0
  109. package/index.js +17 -0
  110. package/package.json +45 -45
  111. package/.cursorrules +0 -43
  112. package/core/abi/index.ts +0 -21
  113. package/core/class/AllGapSchemas.ts +0 -21
  114. package/core/class/Attestation.ts +0 -429
  115. package/core/class/Fetcher.ts +0 -224
  116. package/core/class/GAP.ts +0 -481
  117. package/core/class/GapSchema.ts +0 -93
  118. package/core/class/GrantProgramRegistry/Allo.ts +0 -188
  119. package/core/class/GrantProgramRegistry/AlloRegistry.ts +0 -101
  120. package/core/class/GraphQL/AxiosGQL.ts +0 -29
  121. package/core/class/GraphQL/EASClient.ts +0 -34
  122. package/core/class/GraphQL/GapEasClient.ts +0 -869
  123. package/core/class/Schema.ts +0 -659
  124. package/core/class/SchemaError.ts +0 -42
  125. package/core/class/contract/GapContract.ts +0 -457
  126. package/core/class/entities/Community.ts +0 -148
  127. package/core/class/entities/ContributorProfile.ts +0 -108
  128. package/core/class/entities/Grant.ts +0 -321
  129. package/core/class/entities/GrantUpdate.ts +0 -187
  130. package/core/class/entities/MemberOf.ts +0 -52
  131. package/core/class/entities/Milestone.ts +0 -898
  132. package/core/class/entities/Project.ts +0 -672
  133. package/core/class/entities/ProjectImpact.ts +0 -170
  134. package/core/class/entities/ProjectMilestone.ts +0 -254
  135. package/core/class/entities/ProjectPointer.ts +0 -39
  136. package/core/class/entities/ProjectUpdate.ts +0 -176
  137. package/core/class/entities/Track.ts +0 -32
  138. package/core/class/karma-indexer/GapIndexerClient.ts +0 -383
  139. package/core/class/karma-indexer/api/GapIndexerApi.ts +0 -446
  140. package/core/class/karma-indexer/api/types.ts +0 -313
  141. package/core/class/remote-storage/IpfsStorage.ts +0 -76
  142. package/core/class/remote-storage/RemoteStorage.ts +0 -65
  143. package/core/class/types/allo.ts +0 -93
  144. package/core/class/types/attestations.ts +0 -223
  145. package/core/consts.ts +0 -775
  146. package/core/scripts/create-grant.ts +0 -102
  147. package/core/scripts/create-program.ts +0 -43
  148. package/core/scripts/create-schemas.ts +0 -65
  149. package/core/scripts/deploy.ts +0 -65
  150. package/core/scripts/index.ts +0 -1
  151. package/core/scripts/milestone-multi-grants.ts +0 -125
  152. package/core/shared/types.ts +0 -13
  153. package/core/types.ts +0 -224
  154. package/core/utils/gelato/send-gelato-txn.ts +0 -114
  155. package/core/utils/gelato/sponsor-handler.ts +0 -77
  156. package/core/utils/gelato/watch-gelato-txn.ts +0 -67
  157. package/core/utils/get-date.ts +0 -3
  158. package/core/utils/get-ipfs-data.ts +0 -13
  159. package/core/utils/get-web3-provider.ts +0 -18
  160. package/core/utils/gql-queries.ts +0 -133
  161. package/core/utils/map-filter.ts +0 -21
  162. package/core/utils/serialize-bigint.ts +0 -7
  163. package/core/utils/to-unix.ts +0 -18
  164. package/create-community-example.ts +0 -119
  165. package/csv-upload/README.md +0 -74
  166. package/csv-upload/config.ts +0 -41
  167. package/csv-upload/example.csv +0 -2
  168. package/csv-upload/keys.example.json +0 -8
  169. package/csv-upload/scripts/run.ts +0 -417
  170. package/csv-upload/types.ts +0 -39
  171. package/docs/.gitkeep +0 -0
  172. package/docs/images/attestation-architecture.png +0 -0
  173. package/docs/images/dfd-get-projects.png +0 -0
  174. package/gap-schema.yaml +0 -155
  175. package/milestone-workflow-example.ts +0 -353
  176. package/readme.md +0 -872
  177. package/schemas/.gitkeep +0 -0
  178. package/schemas/GAP-schemas-1692135812877.json +0 -33
  179. package/test-file-indexer-api.ts +0 -25
  180. package/tsconfig.json +0 -26
  181. /package/{csv-upload/.gitkeep → core/class/Gelato/Gelato.d.ts} +0 -0
  182. /package/core/class/GraphQL/{index.ts → index.d.ts} +0 -0
  183. /package/core/class/entities/{index.ts → index.d.ts} +0 -0
  184. /package/core/class/{index.ts → index.d.ts} +0 -0
  185. /package/core/{index.ts → index.d.ts} +0 -0
  186. /package/core/utils/gelato/{index.ts → index.d.ts} +0 -0
  187. /package/core/utils/{index.ts → index.d.ts} +0 -0
  188. /package/{index.ts → index.d.ts} +0 -0
@@ -1,383 +0,0 @@
1
- import { TSchemaName, IAttestation, TNetwork, Hex } from "core/types";
2
- import { Attestation } from "../Attestation";
3
- import { GapSchema } from "../GapSchema";
4
- import { Fetcher } from "../Fetcher";
5
- import {
6
- Community,
7
- Project,
8
- Grant,
9
- Milestone,
10
- MemberOf,
11
- Track,
12
- } from "../entities";
13
- import { Grantee } from "../types/attestations";
14
- import { GapIndexerApi } from "./api/GapIndexerApi";
15
- import { ICommunityAdminsResponse, ICommunityResponse } from "./api/types";
16
- import { ProjectMilestone } from "../entities/ProjectMilestone";
17
-
18
- const Endpoints = {
19
- attestations: {
20
- all: () => "/attestations",
21
- byUid: (uid: Hex) => `/attestations/${uid}`,
22
- },
23
- communities: {
24
- all: () => "/communities",
25
- byUidOrSlug: (uidOrSlug: string) => `/communities/${uidOrSlug}`,
26
- grants: (uidOrSlug: string) => `/communities/${uidOrSlug}/grants`,
27
- },
28
- grantees: {
29
- all: () => "/grantees",
30
- byAddress: (address: Hex) => `/grantees/${address}`,
31
- grants: (address: Hex) => `/grantees/${address}/grants`,
32
- projects: (address: Hex) => `/grantees/${address}/projects`,
33
- communities: (address: Hex, withGrants) =>
34
- `/grantees/${address}/communities${withGrants ? "?withGrants=true" : ""}`,
35
- communitiesAdmin: (address: Hex, withGrants) =>
36
- `/grantees/${address}/communities/admin${
37
- withGrants ? "?withGrants=true" : ""
38
- }`,
39
- },
40
- grants: {
41
- all: () => "/grants",
42
- byUid: (uid: Hex) => `/grants/${uid}`,
43
- byExternalId: (id: string) => `/grants/external-id/${id}`,
44
- },
45
- project: {
46
- all: () => "/projects",
47
- byUidOrSlug: (uidOrSlug: string) => `/projects/${uidOrSlug}`,
48
- grants: (uidOrSlug: string) => `/projects/${uidOrSlug}/grants`,
49
- milestones: (uidOrSlug: string) => `/projects/${uidOrSlug}/milestones`,
50
- },
51
- };
52
-
53
- export class GapIndexerClient extends Fetcher {
54
- private apiClient: GapIndexerApi;
55
- constructor(params) {
56
- super(params);
57
- this.apiClient = new GapIndexerApi(params);
58
- }
59
-
60
- async attestation<T = unknown>(
61
- uid: `0x${string}`
62
- ): Promise<Attestation<T, GapSchema>> {
63
- const { data } = await this.apiClient.attestation(uid);
64
-
65
- if (!data) throw new Error("Attestation not found");
66
- return Attestation.fromInterface<Attestation<T>>(
67
- [data],
68
- this.gap.network
69
- )[0];
70
- }
71
-
72
- async attestations(
73
- schemaName: TSchemaName,
74
- search?: string
75
- ): Promise<IAttestation[]> {
76
- const schemaUID = this.gap.findSchema(schemaName).uid;
77
- const { data } = await this.apiClient.attestations(schemaUID, search);
78
-
79
- return data || [];
80
- }
81
-
82
- async attestationsOf(
83
- schemaName: TSchemaName,
84
- attester: `0x${string}`
85
- ): Promise<IAttestation[]> {
86
- const schemaUID = this.gap.findSchema(schemaName).uid;
87
- const { data } = await this.apiClient.attestationsOf(schemaUID, attester);
88
-
89
- return data || [];
90
- }
91
-
92
- attestationsTo(
93
- schemaName: TSchemaName,
94
- recipient: `0x${string}`
95
- ): Promise<IAttestation[]> {
96
- return this.attestationsOf(schemaName, recipient);
97
- }
98
-
99
- async communities(search?: string): Promise<Community[]> {
100
- const { data } = await this.apiClient.communities(search);
101
-
102
- return Community.from(data, this.gap.network);
103
- }
104
-
105
- async communitiesOf(address: Hex, withGrants: boolean): Promise<Community[]> {
106
- const { data } = await this.apiClient.communitiesOf(address, withGrants);
107
-
108
- return Community.from(data, this.gap.network);
109
- }
110
-
111
- async adminOf(address: Hex): Promise<Community[]> {
112
- const { data } = await this.apiClient.adminOf(address);
113
-
114
- return Community.from(data, this.gap.network);
115
- }
116
-
117
- async communitiesAdminOf(
118
- address: Hex,
119
- withGrants: boolean
120
- ): Promise<Community[]> {
121
- const { data } = await this.client.get<Community[]>(
122
- Endpoints.grantees.communitiesAdmin(address, withGrants)
123
- );
124
-
125
- return Community.from(
126
- data as any as ICommunityResponse[],
127
- this.gap.network
128
- );
129
- }
130
-
131
- communitiesByIds(uids: `0x${string}`[]): Promise<Community[]> {
132
- throw new Error("Method not implemented.");
133
- }
134
-
135
- async communityBySlug(slug: string): Promise<Community> {
136
- const { data } = await this.apiClient.communityBySlug(slug);
137
-
138
- return Community.from([data], this.gap.network)[0];
139
- }
140
-
141
- communityById(uid: `0x${string}`): Promise<Community> {
142
- return this.communityBySlug(uid);
143
- }
144
-
145
- async communityAdmins(uid: `0x${string}`): Promise<ICommunityAdminsResponse> {
146
- const { data } = await this.apiClient.communityAdmins(uid);
147
- return data;
148
- }
149
-
150
- async projectBySlug(slug: string): Promise<Project> {
151
- const { data } = await this.apiClient.projectBySlug(slug);
152
-
153
- return Project.from([data], this.gap.network)[0];
154
- }
155
-
156
- projectById(uid: `0x${string}`): Promise<Project> {
157
- return this.projectBySlug(uid);
158
- }
159
-
160
- async search(
161
- query: string
162
- ): Promise<{ projects: Project[]; communities: Community[] }> {
163
- const { data } = await this.apiClient.search(query);
164
-
165
- return { data } as unknown as {
166
- projects: Project[];
167
- communities: Community[];
168
- };
169
- }
170
-
171
- async searchProjects(query: string): Promise<Project[]> {
172
- const { data } = await this.apiClient.searchProjects(query);
173
-
174
- return Project.from(data, this.gap.network);
175
- }
176
-
177
- async projects(name?: string): Promise<Project[]> {
178
- const { data } = await this.apiClient.projects(name);
179
-
180
- return Project.from(data, this.gap.network);
181
- }
182
-
183
- async projectsOf(grantee: `0x${string}`): Promise<Project[]> {
184
- const { data } = await this.apiClient.projectsOf(grantee);
185
-
186
- return Project.from(data, this.gap.network);
187
- }
188
-
189
- async projectMilestones(uidOrSlug: string): Promise<ProjectMilestone[]> {
190
- const { data } = await this.apiClient.projectMilestones(uidOrSlug);
191
-
192
- return ProjectMilestone.from(data, this.gap.network);
193
- }
194
-
195
- async grantee(address: `0x${string}`): Promise<Grantee> {
196
- const { data } = await this.apiClient.grantee(address);
197
-
198
- return data as Grantee;
199
- }
200
-
201
- async grantees(): Promise<Grantee[]> {
202
- const { data } = await this.apiClient.grantees();
203
-
204
- return data as any as Grantee[]; // TODO: Remove this casting after the api is fixed
205
- }
206
-
207
- async grantsOf(
208
- grantee: `0x${string}`,
209
- withCommunity?: boolean
210
- ): Promise<Grant[]> {
211
- const { data } = await this.apiClient.grantsOf(grantee, withCommunity);
212
-
213
- return Grant.from(data, this.gap.network);
214
- }
215
-
216
- async grantsFor(
217
- projects: Project[],
218
- withCommunity?: boolean
219
- ): Promise<Grant[]> {
220
- const { data } = await this.apiClient.grantsFor(
221
- projects[0].uid,
222
- withCommunity
223
- );
224
-
225
- return Grant.from(data, this.gap.network);
226
- }
227
-
228
- async grantsForExtProject(projectExtId: string): Promise<Grant[]> {
229
- const { data } = await this.apiClient.grantsForExtProject(projectExtId);
230
-
231
- return Grant.from(data, this.gap.network);
232
- }
233
-
234
- async grantsByCommunity(
235
- uid: `0x${string}`,
236
- page: number = 0,
237
- pageLimit: number = 100
238
- ) {
239
- const { data } = await this.apiClient.grantsByCommunity(
240
- uid,
241
- page,
242
- pageLimit
243
- );
244
- const grants = data.data;
245
-
246
- return Grant.from(grants, this.gap.network);
247
- }
248
-
249
- async milestonesOf(grants: Grant[]): Promise<Milestone[]> {
250
- const { data } = await this.apiClient.milestonesOf(grants[0].uid);
251
-
252
- return Milestone.from(data, this.gap.network);
253
- }
254
-
255
- async membersOf(projects: Project[]): Promise<MemberOf[]> {
256
- throw new Error("Method not implemented.");
257
- }
258
-
259
- async slugExists(slug: string): Promise<boolean> {
260
- return await this.apiClient.slugExists(slug);
261
- }
262
-
263
- /**
264
- * Track related methods
265
- */
266
-
267
- async getTracks(
268
- communityUID: string,
269
- includeArchived: boolean = false
270
- ): Promise<Track[]> {
271
- const { data } = await this.apiClient.getTracks(
272
- communityUID,
273
- includeArchived
274
- );
275
- return Track.from(data, this.gap.network);
276
- }
277
-
278
- async getTrackById(id: string): Promise<Track> {
279
- const { data } = await this.apiClient.getTrackById(id);
280
- return Track.from([data], this.gap.network)[0];
281
- }
282
-
283
- async createTrack(trackData: {
284
- name: string;
285
- description?: string;
286
- communityUID: string;
287
- }): Promise<Track> {
288
- const { data } = await this.apiClient.createTrack(trackData);
289
- return Track.from([data], this.gap.network)[0];
290
- }
291
-
292
- async updateTrack(
293
- id: string,
294
- trackData: { name?: string; description?: string; communityUID?: string }
295
- ): Promise<Track> {
296
- const { data } = await this.apiClient.updateTrack(id, trackData);
297
- return Track.from([data], this.gap.network)[0];
298
- }
299
-
300
- async archiveTrack(id: string): Promise<Track> {
301
- const { data } = await this.apiClient.archiveTrack(id);
302
- return Track.from([data], this.gap.network)[0];
303
- }
304
-
305
- async assignTracksToProgram(
306
- programId: string,
307
- trackIds: string[]
308
- ): Promise<any[]> {
309
- const { data } = await this.apiClient.assignTracksToProgram(
310
- programId,
311
- trackIds
312
- );
313
- return data;
314
- }
315
-
316
- async unassignTrackFromProgram(
317
- programId: string,
318
- trackId: string
319
- ): Promise<any> {
320
- const { data } = await this.apiClient.unassignTrackFromProgram(
321
- programId,
322
- trackId
323
- );
324
- return data;
325
- }
326
-
327
- async getTracksForProgram(programId: string): Promise<Track[]> {
328
- const { data } = await this.apiClient.getTracksForProgram(programId);
329
- return Track.from(data, this.gap.network);
330
- }
331
-
332
- async getTracksForProject(
333
- projectId: string,
334
- programId: string,
335
- activeOnly: boolean = true
336
- ): Promise<Track[]> {
337
- const { data } = await this.apiClient.getTracksForProject(
338
- projectId,
339
- programId,
340
- activeOnly
341
- );
342
- return Track.from(data, this.gap.network);
343
- }
344
-
345
- async assignTracksToProject(
346
- projectId: string,
347
- programId: string,
348
- trackIds: string[]
349
- ): Promise<any[]> {
350
- const { data } = await this.apiClient.assignTracksToProject(
351
- projectId,
352
- programId,
353
- trackIds
354
- );
355
- return data;
356
- }
357
-
358
- async unassignTracksFromProject(
359
- projectId: string,
360
- programId: string,
361
- trackIds: string[]
362
- ): Promise<any[]> {
363
- const { data } = await this.apiClient.unassignTracksFromProject(
364
- projectId,
365
- programId,
366
- trackIds
367
- );
368
- return data;
369
- }
370
-
371
- async getProjectsByTrack(
372
- communityId: string,
373
- programId: string,
374
- trackId?: string
375
- ): Promise<any[]> {
376
- const { data } = await this.apiClient.getProjectsByTrack(
377
- communityId,
378
- programId,
379
- trackId
380
- );
381
- return data;
382
- }
383
- }