@show-karma/karma-gap-sdk 0.4.14 → 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 (189) 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/AlloCaller.json +0 -117
  83. package/core/abi/index.d.ts +0 -1114
  84. package/core/abi/index.js +0 -26
  85. package/core/class/AllGapSchemas.d.ts +0 -9
  86. package/core/class/AllGapSchemas.js +0 -19
  87. package/core/class/Attestation.d.ts +0 -173
  88. package/core/class/Attestation.js +0 -333
  89. package/core/class/Fetcher.d.ts +0 -175
  90. package/core/class/Fetcher.js +0 -13
  91. package/core/class/GAP.d.ts +0 -254
  92. package/core/class/GAP.js +0 -289
  93. package/core/class/GapSchema.d.ts +0 -34
  94. package/core/class/GapSchema.js +0 -62
  95. package/core/class/GrantProgramRegistry/Allo.d.ts +0 -17
  96. package/core/class/GrantProgramRegistry/Allo.js +0 -137
  97. package/core/class/GrantProgramRegistry/AlloRegistry.d.ts +0 -15
  98. package/core/class/GrantProgramRegistry/AlloRegistry.js +0 -70
  99. package/core/class/GraphQL/AxiosGQL.d.ts +0 -6
  100. package/core/class/GraphQL/AxiosGQL.js +0 -25
  101. package/core/class/GraphQL/EASClient.d.ts +0 -16
  102. package/core/class/GraphQL/EASClient.js +0 -26
  103. package/core/class/GraphQL/GapEasClient.d.ts +0 -71
  104. package/core/class/GraphQL/GapEasClient.js +0 -451
  105. package/core/class/GraphQL/index.js +0 -19
  106. package/core/class/Schema.d.ts +0 -233
  107. package/core/class/Schema.js +0 -488
  108. package/core/class/SchemaError.d.ts +0 -30
  109. package/core/class/SchemaError.js +0 -39
  110. package/core/class/contract/GapContract.d.ts +0 -102
  111. package/core/class/contract/GapContract.js +0 -285
  112. package/core/class/entities/Community.d.ts +0 -34
  113. package/core/class/entities/Community.js +0 -109
  114. package/core/class/entities/ContributorProfile.d.ts +0 -41
  115. package/core/class/entities/ContributorProfile.js +0 -69
  116. package/core/class/entities/Grant.d.ts +0 -54
  117. package/core/class/entities/Grant.js +0 -223
  118. package/core/class/entities/GrantUpdate.d.ts +0 -40
  119. package/core/class/entities/GrantUpdate.js +0 -114
  120. package/core/class/entities/MemberOf.d.ts +0 -11
  121. package/core/class/entities/MemberOf.js +0 -33
  122. package/core/class/entities/Milestone.d.ts +0 -168
  123. package/core/class/entities/Milestone.js +0 -657
  124. package/core/class/entities/Project.d.ts +0 -92
  125. package/core/class/entities/Project.js +0 -418
  126. package/core/class/entities/ProjectImpact.d.ts +0 -50
  127. package/core/class/entities/ProjectImpact.js +0 -112
  128. package/core/class/entities/ProjectMilestone.d.ts +0 -60
  129. package/core/class/entities/ProjectMilestone.js +0 -174
  130. package/core/class/entities/ProjectPointer.d.ts +0 -12
  131. package/core/class/entities/ProjectPointer.js +0 -22
  132. package/core/class/entities/ProjectUpdate.d.ts +0 -50
  133. package/core/class/entities/ProjectUpdate.js +0 -110
  134. package/core/class/entities/Track.d.ts +0 -16
  135. package/core/class/entities/Track.js +0 -21
  136. package/core/class/entities/index.js +0 -26
  137. package/core/class/index.js +0 -26
  138. package/core/class/karma-indexer/GapIndexerClient.d.ts +0 -66
  139. package/core/class/karma-indexer/GapIndexerClient.js +0 -207
  140. package/core/class/karma-indexer/api/GapIndexerApi.d.ts +0 -73
  141. package/core/class/karma-indexer/api/GapIndexerApi.js +0 -256
  142. package/core/class/karma-indexer/api/types.d.ts +0 -295
  143. package/core/class/karma-indexer/api/types.js +0 -2
  144. package/core/class/remote-storage/IpfsStorage.d.ts +0 -23
  145. package/core/class/remote-storage/IpfsStorage.js +0 -56
  146. package/core/class/remote-storage/RemoteStorage.d.ts +0 -41
  147. package/core/class/remote-storage/RemoteStorage.js +0 -38
  148. package/core/class/types/allo.d.ts +0 -78
  149. package/core/class/types/allo.js +0 -2
  150. package/core/class/types/attestations.d.ts +0 -168
  151. package/core/class/types/attestations.js +0 -66
  152. package/core/consts.d.ts +0 -48
  153. package/core/consts.js +0 -641
  154. package/core/index.js +0 -24
  155. package/core/shared/types.d.ts +0 -6
  156. package/core/shared/types.js +0 -2
  157. package/core/types.d.ts +0 -131
  158. package/core/types.js +0 -13
  159. package/core/utils/gelato/index.js +0 -19
  160. package/core/utils/gelato/send-gelato-txn.d.ts +0 -55
  161. package/core/utils/gelato/send-gelato-txn.js +0 -100
  162. package/core/utils/gelato/sponsor-handler.d.ts +0 -9
  163. package/core/utils/gelato/sponsor-handler.js +0 -60
  164. package/core/utils/gelato/watch-gelato-txn.d.ts +0 -7
  165. package/core/utils/gelato/watch-gelato-txn.js +0 -63
  166. package/core/utils/get-date.d.ts +0 -1
  167. package/core/utils/get-date.js +0 -7
  168. package/core/utils/get-ipfs-data.d.ts +0 -1
  169. package/core/utils/get-ipfs-data.js +0 -20
  170. package/core/utils/get-web3-provider.d.ts +0 -2
  171. package/core/utils/get-web3-provider.js +0 -18
  172. package/core/utils/gql-queries.d.ts +0 -12
  173. package/core/utils/gql-queries.js +0 -90
  174. package/core/utils/index.js +0 -23
  175. package/core/utils/map-filter.d.ts +0 -8
  176. package/core/utils/map-filter.js +0 -20
  177. package/core/utils/serialize-bigint.d.ts +0 -1
  178. package/core/utils/serialize-bigint.js +0 -8
  179. package/core/utils/to-unix.d.ts +0 -1
  180. package/core/utils/to-unix.js +0 -25
  181. package/index.js +0 -17
  182. /package/core/class/GraphQL/{index.d.ts → index.ts} +0 -0
  183. /package/core/class/entities/{index.d.ts → index.ts} +0 -0
  184. /package/core/class/{index.d.ts → index.ts} +0 -0
  185. /package/core/{index.d.ts → index.ts} +0 -0
  186. /package/core/utils/gelato/{index.d.ts → index.ts} +0 -0
  187. /package/core/utils/{index.d.ts → index.ts} +0 -0
  188. /package/{core/class/Gelato/Gelato.d.ts → csv-upload/.gitkeep} +0 -0
  189. /package/{index.d.ts → index.ts} +0 -0
@@ -1,295 +0,0 @@
1
- import { IGrantUpdateBase } from "core/shared/types";
2
- export type Hex = `0x${string}`;
3
- export type JSONStr = string;
4
- export type ExternalLink = {
5
- type: string;
6
- url: string;
7
- };
8
- export interface ITag {
9
- name: string;
10
- }
11
- export interface IAttestationResponse {
12
- id: string;
13
- uid: Hex;
14
- schemaUID: Hex;
15
- refUID: Hex;
16
- attester: Hex;
17
- recipient: Hex;
18
- revoked: boolean;
19
- revocationTime?: number;
20
- createdAt: any;
21
- updatedAt: any;
22
- chainID: number;
23
- type: string;
24
- data: any;
25
- decodedDataJson: JSONStr;
26
- isOffchain: any;
27
- revocable: any;
28
- schemaId: Hex;
29
- }
30
- export interface ISummaryProject {
31
- title: string;
32
- slug?: string;
33
- uid: Hex;
34
- }
35
- export interface IMilestoneCompleted extends IAttestationResponse {
36
- type: "MilestoneStatus";
37
- data: {
38
- type: "approved" | "rejected" | "completed";
39
- reason?: string;
40
- proofOfWork?: string;
41
- };
42
- }
43
- export interface IMilestoneResponse extends IAttestationResponse {
44
- type: "Milestone";
45
- completed?: IMilestoneCompleted;
46
- approved?: IMilestoneCompleted;
47
- rejected?: IMilestoneCompleted;
48
- verified?: IMilestoneCompleted[];
49
- data: {
50
- title: string;
51
- description: string;
52
- endsAt: number;
53
- startsAt?: number;
54
- type: "milestone";
55
- priority?: number;
56
- };
57
- }
58
- export interface IGrantUpdateStatus extends IAttestationResponse {
59
- type: `grant-update-${IStatus}`;
60
- reason?: string;
61
- data: {
62
- type: "approved" | "rejected" | "completed";
63
- reason?: string;
64
- };
65
- }
66
- export interface IGrantUpdate extends IAttestationResponse {
67
- data: IGrantUpdateBase & {
68
- type: "grant-update";
69
- };
70
- verified?: IGrantUpdateStatus[];
71
- }
72
- export interface IProjectUpdateStatus extends IAttestationResponse {
73
- type: `project-update-${IStatus}`;
74
- reason?: string;
75
- data: {
76
- type: "approved" | "rejected" | "completed";
77
- reason?: string;
78
- };
79
- }
80
- export interface IProjectUpdate extends IAttestationResponse {
81
- data: {
82
- title: string;
83
- text: string;
84
- startDate?: Date;
85
- endDate?: Date;
86
- grants?: string[];
87
- indicators?: {
88
- name: string;
89
- indicatorId: string;
90
- }[];
91
- deliverables?: {
92
- name: string;
93
- proof: string;
94
- description: string;
95
- }[];
96
- type: "project-update";
97
- };
98
- verified?: IProjectUpdateStatus[];
99
- }
100
- export interface IProjectMilestoneStatus extends IAttestationResponse {
101
- type: `project-milestone-verified`;
102
- reason?: string;
103
- data: {
104
- type: "approved" | "rejected" | "completed";
105
- reason?: string;
106
- };
107
- }
108
- export interface IProjectMilestoneResponse extends IAttestationResponse {
109
- data: {
110
- text: string;
111
- title: string;
112
- type: "project-milestone";
113
- };
114
- verified?: IProjectMilestoneStatus[];
115
- completed?: IMilestoneCompleted;
116
- }
117
- export interface IProjectPointer extends IAttestationResponse {
118
- data: {
119
- ogProjectUID: string;
120
- type: "project-pointer";
121
- };
122
- }
123
- export interface IGrantDetails extends IAttestationResponse {
124
- type: "GrantDetails";
125
- data: {
126
- title: string;
127
- amount: string;
128
- description: string;
129
- proposalURL: string;
130
- assetAndChainId?: [Hex, number];
131
- payoutAddress: Hex;
132
- questions: {
133
- type: string;
134
- query: string;
135
- explanation: string;
136
- }[];
137
- startDate: number;
138
- programId?: string;
139
- type: "grant-details";
140
- fundUsage?: string;
141
- selectedTrackIds?: string[];
142
- };
143
- }
144
- export interface IGrantResponse extends IAttestationResponse {
145
- type: "Grant";
146
- data: {
147
- communityUID: Hex;
148
- };
149
- details?: IGrantDetails;
150
- milestones: IMilestoneResponse[];
151
- completed?: IGrantUpdate;
152
- project: IProjectResponse;
153
- updates: IGrantUpdate[];
154
- community: ICommunityResponse;
155
- members: Hex[];
156
- categories?: string[];
157
- externalAddresses?: {
158
- [key: string]: string;
159
- };
160
- external?: {
161
- [key: string]: string[];
162
- };
163
- }
164
- export interface IMemberDetails extends IAttestationResponse {
165
- name: string;
166
- profilePictureURL: string;
167
- }
168
- export interface IMemberOf extends IAttestationResponse {
169
- type: "MemberOf";
170
- data: {
171
- memberOf: true;
172
- };
173
- details?: IMemberDetails;
174
- }
175
- export interface IProjectDetails extends IAttestationResponse {
176
- type: "ProjectDetails";
177
- data: {
178
- title: string;
179
- description: string;
180
- problem?: string;
181
- solution?: string;
182
- missionSummary?: string;
183
- locationOfImpact?: string;
184
- imageURL: string;
185
- links?: ExternalLink[];
186
- tags?: ITag[];
187
- slug?: string;
188
- type: "project-details";
189
- businessModel?: string;
190
- stageIn?: string;
191
- raisedMoney?: string;
192
- pathToTake?: string;
193
- };
194
- }
195
- type IStatus = "verified";
196
- export interface IProjectImpactStatus extends IAttestationResponse {
197
- type: `project-impact-${IStatus}`;
198
- reason?: string;
199
- }
200
- export interface IProjectImpact extends IAttestationResponse {
201
- type: "ProjectImpact";
202
- data: {
203
- work: string;
204
- impact: string;
205
- proof: string;
206
- startedAt?: number;
207
- completedAt: number;
208
- type: "project-impact";
209
- };
210
- verified: IProjectImpactStatus[];
211
- }
212
- export interface IProjectEndorsement extends IAttestationResponse {
213
- type: "ProjectEndorsement";
214
- data: {
215
- comment?: string;
216
- type?: "project-endorsement";
217
- };
218
- }
219
- export interface IProjectResponse extends IAttestationResponse {
220
- type: "Project";
221
- data: {
222
- project: true;
223
- };
224
- details?: IProjectDetails;
225
- members: IMemberOf[];
226
- grants: IGrantResponse[];
227
- grantee: any;
228
- impacts: IProjectImpact[];
229
- updates: IProjectUpdate[];
230
- pointers: IProjectPointer[];
231
- symlinks: Hex[];
232
- endorsements: IProjectEndorsement[];
233
- milestones: IProjectMilestoneResponse[];
234
- }
235
- export interface ICommunityDetails extends IAttestationResponse {
236
- type: "CommunityDetails";
237
- data: {
238
- name: string;
239
- description: string;
240
- imageURL: string;
241
- links: ExternalLink[];
242
- slug?: string;
243
- };
244
- }
245
- export interface ICommunityResponse extends IAttestationResponse {
246
- type: "Community";
247
- data: {
248
- community: true;
249
- };
250
- details?: ICommunityDetails;
251
- grants: IGrantResponse[];
252
- }
253
- export interface ICommunityAdminsResponse {
254
- id: string;
255
- admins: {
256
- user: {
257
- id: string;
258
- };
259
- }[];
260
- }
261
- export interface ISearchResponse {
262
- projects: IProjectResponse[];
263
- communities: ICommunityResponse[];
264
- }
265
- export interface ITrackResponse {
266
- id: string;
267
- name: string;
268
- description?: string;
269
- communityUID: string;
270
- isArchived: boolean;
271
- createdAt: string;
272
- updatedAt: string;
273
- programId?: string;
274
- isActive?: boolean;
275
- chainID?: number;
276
- }
277
- export interface ITrackAssignmentResponse {
278
- id: string;
279
- programId: string;
280
- chainID: number;
281
- trackId: string;
282
- track: ITrackResponse;
283
- }
284
- export interface IProjectTrackResponse {
285
- projectUID: string;
286
- chainID: number;
287
- programId: string;
288
- track: ITrackResponse;
289
- project: {
290
- uid: string;
291
- chainID: number;
292
- details: any;
293
- };
294
- }
295
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,23 +0,0 @@
1
- import { RemoteStorage } from "./RemoteStorage";
2
- import { TRemoteStorageOutput } from "core/types";
3
- export interface IpfsStorageOptions {
4
- token: string;
5
- }
6
- export declare class IpfsStorage extends RemoteStorage {
7
- private pinataJWTToken;
8
- constructor(opts: IpfsStorageOptions,
9
- /**
10
- * If set, will send request to another server instead of
11
- * using the local instance
12
- */
13
- sponsor?: RemoteStorage["sponsor"]);
14
- private assert;
15
- save<T = unknown>(data: T): Promise<string>;
16
- encode(data: string): TRemoteStorageOutput<string>;
17
- get<T = unknown>(args: {
18
- cid: string;
19
- }): Promise<T>;
20
- saveAndGetCID(data: any, pinataMetadata?: {
21
- name: string;
22
- }): Promise<any>;
23
- }
@@ -1,56 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.IpfsStorage = void 0;
7
- const RemoteStorage_1 = require("./RemoteStorage");
8
- const SchemaError_1 = require("../SchemaError");
9
- const utils_1 = require("../../utils");
10
- const axios_1 = __importDefault(require("axios"));
11
- class IpfsStorage extends RemoteStorage_1.RemoteStorage {
12
- constructor(opts,
13
- /**
14
- * If set, will send request to another server instead of
15
- * using the local instance
16
- */
17
- sponsor) {
18
- super(0 /* STORAGE_TYPE.IPFS */, sponsor);
19
- this.assert(opts);
20
- this.pinataJWTToken = opts.token;
21
- }
22
- assert(opts) { }
23
- async save(data) {
24
- try {
25
- const cid = await this.saveAndGetCID(data);
26
- return cid;
27
- }
28
- catch (error) {
29
- throw new SchemaError_1.RemoteStorageError("REMOTE_STORAGE_UPLOAD", `Error adding data to IPFS`);
30
- }
31
- }
32
- encode(data) {
33
- return { hash: data, storageType: this.storageType };
34
- }
35
- async get(args) {
36
- return (0, utils_1.getIPFSData)(args.cid);
37
- }
38
- async saveAndGetCID(data, pinataMetadata = { name: "via karma-gap-sdk" }) {
39
- try {
40
- const res = await axios_1.default.post("https://api.pinata.cloud/pinning/pinJSONToIPFS", {
41
- pinataContent: data,
42
- pinataMetadata: pinataMetadata,
43
- }, {
44
- headers: {
45
- "Content-Type": "application/json",
46
- Authorization: `Bearer ${this.pinataJWTToken}`,
47
- },
48
- });
49
- return res.data.IpfsHash;
50
- }
51
- catch (error) {
52
- throw new SchemaError_1.RemoteStorageError("REMOTE_STORAGE_UPLOAD", `Error adding data to IPFS`);
53
- }
54
- }
55
- }
56
- exports.IpfsStorage = IpfsStorage;
@@ -1,41 +0,0 @@
1
- import { STORAGE_TYPE, TRemoteStorageOutput } from 'core/types';
2
- interface SponsoredRemote {
3
- url: string;
4
- responseParser: (response: any) => string;
5
- }
6
- export declare abstract class RemoteStorage<C = unknown> {
7
- protected client: C;
8
- readonly storageType: number;
9
- readonly sponsor?: SponsoredRemote;
10
- constructor(storageType: STORAGE_TYPE,
11
- /**
12
- * If set, will try to POST request to another server instead of
13
- * using the local instance.
14
- *
15
- * > If a response parser is not set, it will try to get { cid: string }.
16
- */
17
- sponsor: SponsoredRemote);
18
- /**
19
- * Try to save data to remote storage and return the CID.
20
- * IF sponsorUrl is set, this method will be automatically
21
- * intercepted and will send a POST request to the sponsorUrl
22
- * with the contents: `{ data: T, type: "<AttestationType>" }`
23
- */
24
- abstract save<T = unknown>(data: T, schemaName: string): Promise<string>;
25
- /**
26
- * Encodes the data according to the remote storage type parameters
27
- * OR returns the data as is if no encoding is required
28
- */
29
- abstract encode(data: unknown): TRemoteStorageOutput;
30
- /**
31
- * Get data from Remote Storage
32
- */
33
- abstract get<T = unknown>(args: unknown): Promise<T>;
34
- /**
35
- * If sponsorUrl is set, intercept the save method and send a POST request
36
- * to the sponsorUrl instead of using the local instance.
37
- * @returns
38
- */
39
- private interceptRemoteStorage;
40
- }
41
- export {};
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.RemoteStorage = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- class RemoteStorage {
9
- constructor(storageType,
10
- /**
11
- * If set, will try to POST request to another server instead of
12
- * using the local instance.
13
- *
14
- * > If a response parser is not set, it will try to get { cid: string }.
15
- */
16
- sponsor) {
17
- this.storageType = storageType;
18
- this.sponsor = sponsor;
19
- this.interceptRemoteStorage();
20
- }
21
- /**
22
- * If sponsorUrl is set, intercept the save method and send a POST request
23
- * to the sponsorUrl instead of using the local instance.
24
- * @returns
25
- */
26
- interceptRemoteStorage() {
27
- if (!this.sponsor?.url)
28
- return;
29
- this.save = async (data, schemaName) => {
30
- const { data: response } = await axios_1.default.post(this.sponsor.url, {
31
- data: data,
32
- type: schemaName,
33
- });
34
- return this.sponsor.responseParser?.(response) || response.cid;
35
- };
36
- }
37
- }
38
- exports.RemoteStorage = RemoteStorage;
@@ -1,78 +0,0 @@
1
- export type RoundMetadata = {
2
- name: string;
3
- support: {
4
- info: string;
5
- type: string;
6
- };
7
- roundType: "public" | string;
8
- eligibility: {
9
- description: string;
10
- requirements: Array<{
11
- requirement: string;
12
- }>;
13
- };
14
- feesAddress: string;
15
- feesPercentage: number;
16
- programContractAddress: string;
17
- quadraticFundingConfig?: {
18
- matchingCap: boolean;
19
- sybilDefense: boolean;
20
- matchingCapAmount: number;
21
- minDonationThreshold: boolean;
22
- matchingFundsAvailable: number;
23
- minDonationThresholdAmount: number;
24
- };
25
- category: string;
26
- source: string;
27
- };
28
- export type Address = `0x${string}`;
29
- export type GrantArgs = {
30
- profileId: Address;
31
- roundMetadata: RoundMetadata;
32
- applicationStart: number;
33
- applicationEnd: number;
34
- roundStart: number;
35
- roundEnd: number;
36
- matchingFundAmt: number;
37
- applicationMetadata: ApplicationMetadata;
38
- managers: Address[];
39
- strategy: Address;
40
- payoutToken: Address;
41
- };
42
- export type ApplicationMetadata = {
43
- version: string;
44
- lastUpdatedOn: number;
45
- applicationSchema: {
46
- questions: Array<{
47
- id: number;
48
- info: string;
49
- type: "email" | "short-answer" | "link" | "number" | "paragraph" | "address" | "checkbox" | "multiple-choice";
50
- title: string;
51
- hidden: boolean;
52
- choices?: string[];
53
- required: boolean;
54
- encrypted: boolean;
55
- }>;
56
- requirements: {
57
- github: {
58
- required: boolean;
59
- verification: boolean;
60
- };
61
- twitter: {
62
- required: boolean;
63
- verification: boolean;
64
- };
65
- };
66
- };
67
- };
68
- export type ProfileMetadata = {
69
- title: string;
70
- description: string;
71
- website: string;
72
- projectTwitter: string;
73
- logoImg: string;
74
- bannerImg: string;
75
- logoImgData: any;
76
- bannerImgData: any;
77
- createdAt: number;
78
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,168 +0,0 @@
1
- import { Attestation, AttestationArgs } from "../Attestation";
2
- import { Hex } from "core/types";
3
- import { Project } from "../entities/Project";
4
- import { GapSchema } from "../GapSchema";
5
- import { GrantUpdate } from "../entities/GrantUpdate";
6
- import { Transaction } from "ethers";
7
- /** Attestation interfaces */
8
- export type AttestationWithTx = {
9
- uids: Hex[];
10
- tx: Transaction[];
11
- };
12
- export type ExternalLink = {
13
- type: string;
14
- url: string;
15
- }[];
16
- export interface ICommunityDetails {
17
- name: string;
18
- description: string;
19
- imageURL: string;
20
- slug?: string;
21
- links?: ExternalLink;
22
- type?: string;
23
- externalId?: string;
24
- }
25
- export declare class CommunityDetails extends Attestation<ICommunityDetails> implements ICommunityDetails {
26
- name: string;
27
- description: string;
28
- imageURL: string;
29
- links: ExternalLink;
30
- slug?: string;
31
- type: string;
32
- externalId?: string;
33
- }
34
- export interface IGrantDetails {
35
- title: string;
36
- amount?: string;
37
- proposalURL: string;
38
- assetAndChainId?: [Hex, number];
39
- payoutAddress?: Hex;
40
- description?: string;
41
- season?: string;
42
- cycle?: string;
43
- questions?: IGrantDetailsQuestion[];
44
- type?: string;
45
- startDate?: number;
46
- programId?: string;
47
- fundUsage?: string;
48
- selectedTrackIds?: string[];
49
- }
50
- export declare class GrantDetails extends Attestation<IGrantDetails> implements IGrantDetails {
51
- title: string;
52
- proposalURL: string;
53
- programId?: string;
54
- payoutAddress?: Hex;
55
- amount?: string;
56
- assetAndChainId?: [Hex, number];
57
- description?: string;
58
- season?: string;
59
- cycle?: string;
60
- questions?: IGrantDetailsQuestion[];
61
- type: string;
62
- startDate?: number;
63
- fundUsage?: string;
64
- selectedTrackIds?: string[];
65
- }
66
- export interface IGrantRound {
67
- name: string;
68
- }
69
- export declare class GrantRound extends Attestation<IGrantRound> implements IGrantRound {
70
- name: string;
71
- }
72
- export interface IGrantVerified {
73
- verified: boolean;
74
- }
75
- export declare class GrantVerified extends Attestation<IGrantVerified> implements IGrantVerified {
76
- verified: boolean;
77
- }
78
- export interface IMemberDetails {
79
- name: string;
80
- profilePictureURL: string;
81
- }
82
- export declare class MemberDetails extends Attestation<IMemberDetails> implements IMemberDetails {
83
- name: string;
84
- profilePictureURL: string;
85
- }
86
- export interface IMilestoneCompleted {
87
- type?: "approved" | "rejected" | "completed" | "verified";
88
- reason?: string;
89
- proofOfWork?: string;
90
- }
91
- export declare class MilestoneCompleted extends Attestation<IMilestoneCompleted> implements IMilestoneCompleted {
92
- type: "approved" | "rejected" | "completed" | "verified";
93
- reason?: string;
94
- proofOfWork?: string;
95
- }
96
- export interface ITag {
97
- name: string;
98
- }
99
- export declare class Tag extends Attestation<ITag> implements ITag {
100
- name: string;
101
- }
102
- export interface IProjectDetails {
103
- title: string;
104
- description: string;
105
- problem?: string;
106
- solution?: string;
107
- missionSummary?: string;
108
- locationOfImpact?: string;
109
- imageURL: string;
110
- links?: ExternalLink;
111
- tags?: ITag[];
112
- externalIds?: string[];
113
- slug?: string;
114
- type?: string;
115
- businessModel?: string;
116
- stageIn?: string;
117
- raisedMoney?: string;
118
- pathToTake?: string;
119
- }
120
- export declare class ProjectDetails extends Attestation<IProjectDetails> implements IProjectDetails {
121
- title: string;
122
- description: string;
123
- problem?: string;
124
- solution?: string;
125
- missionSummary?: string;
126
- locationOfImpact?: string;
127
- imageURL: string;
128
- links: ExternalLink;
129
- tags: ITag[];
130
- slug: string;
131
- type: string;
132
- externalIds: string[];
133
- businessModel?: string;
134
- stageIn?: string;
135
- raisedMoney?: string;
136
- pathToTake?: string;
137
- }
138
- export declare class Grantee {
139
- address: string;
140
- projects: Project[];
141
- constructor(address: Hex, projects?: Project[]);
142
- }
143
- export declare class GrantCompleted extends GrantUpdate {
144
- }
145
- export interface IGrantDetailsQuestion {
146
- query: string;
147
- explanation: string;
148
- type: string;
149
- }
150
- export interface IProjectEndorsement {
151
- comment?: string;
152
- type?: string;
153
- }
154
- export declare class ProjectEndorsement extends Attestation<IProjectEndorsement> implements IProjectEndorsement {
155
- comment?: string;
156
- type?: string;
157
- constructor(data: AttestationArgs<IProjectEndorsement, GapSchema>);
158
- }
159
- export interface IProjectMilestoneCompleted {
160
- type?: "approved" | "rejected" | "completed" | "verified";
161
- reason?: string;
162
- proofOfWork?: string;
163
- }
164
- export declare class ProjectMilestoneCompleted extends Attestation<IProjectMilestoneCompleted> implements IProjectMilestoneCompleted {
165
- type: "approved" | "rejected" | "completed" | "verified";
166
- reason?: string;
167
- proofOfWork?: string;
168
- }