@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,60 +0,0 @@
1
- import { SignerOrProvider, TNetwork } from "../../../core/types";
2
- import { Attestation, AttestationArgs } from "../Attestation";
3
- import { GapSchema } from "../GapSchema";
4
- import { Transaction } from "ethers";
5
- import { IProjectMilestoneResponse } from "../karma-indexer/api/types";
6
- import { MilestoneCompleted as ProjectMilestoneCompleted } from "../types/attestations";
7
- export interface IProjectMilestone {
8
- title: string;
9
- text: string;
10
- type?: string;
11
- }
12
- type IStatus = "verified" | "completed";
13
- export interface IProjectMilestoneStatus {
14
- type?: `project-milestone-${IStatus}`;
15
- proofOfWork?: string;
16
- reason?: string;
17
- }
18
- export declare class ProjectMilestoneStatus extends Attestation<IProjectMilestoneStatus> implements IProjectMilestoneStatus {
19
- type: `project-milestone-${IStatus}`;
20
- reason?: string;
21
- }
22
- export declare class ProjectMilestone extends Attestation<IProjectMilestone> implements IProjectMilestone {
23
- title: string;
24
- text: string;
25
- verified: ProjectMilestoneStatus[];
26
- completed: ProjectMilestoneCompleted;
27
- constructor(data: AttestationArgs<IProjectMilestone, GapSchema>);
28
- /**
29
- * Attest the status of the update as approved, rejected or completed.
30
- */
31
- private attestStatus;
32
- /**
33
- * Verify this ProjectUpdate. If the ProjectUpdate is not already verified,
34
- * it will throw an error.
35
- * @param signer
36
- * @param reason
37
- */
38
- verify(signer: SignerOrProvider, data?: IProjectMilestoneStatus, callback?: Function): Promise<void>;
39
- /**
40
- * Marks a milestone as completed. If the milestone is already completed,
41
- * it will throw an error.
42
- * @param signer
43
- * @param reason
44
- */
45
- complete(signer: SignerOrProvider, data?: IProjectMilestoneStatus, callback?: Function): Promise<{
46
- tx: Transaction[];
47
- uids: `0x${string}`[];
48
- }>;
49
- /**
50
- * Revokes the completed status of the milestone. If the milestone is not completed,
51
- * it will throw an error.
52
- * @param signer
53
- */
54
- revokeCompletion(signer: SignerOrProvider, callback?: Function): Promise<{
55
- tx: Transaction[];
56
- uids: `0x${string}`[];
57
- }>;
58
- static from(attestations: IProjectMilestoneResponse[], network: TNetwork): ProjectMilestone[];
59
- }
60
- export {};
@@ -1,174 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProjectMilestone = exports.ProjectMilestoneStatus = void 0;
4
- const Attestation_1 = require("../Attestation");
5
- const SchemaError_1 = require("../SchemaError");
6
- const AllGapSchemas_1 = require("../AllGapSchemas");
7
- const consts_1 = require("../../../core/consts");
8
- const attestations_1 = require("../types/attestations");
9
- class ProjectMilestoneStatus extends Attestation_1.Attestation {
10
- }
11
- exports.ProjectMilestoneStatus = ProjectMilestoneStatus;
12
- class ProjectMilestone extends Attestation_1.Attestation {
13
- constructor(data) {
14
- data.data.type = "project-milestone";
15
- super(data);
16
- this.verified = [];
17
- }
18
- /**
19
- * Attest the status of the update as approved, rejected or completed.
20
- */
21
- async attestStatus(signer, schema, callback) {
22
- const eas = this.schema.gap.eas.connect(signer);
23
- try {
24
- if (callback)
25
- callback("preparing");
26
- const tx = await eas.attest({
27
- schema: schema.uid,
28
- data: {
29
- recipient: this.recipient,
30
- data: schema.encode(),
31
- refUID: this.uid,
32
- expirationTime: 0n,
33
- revocable: schema.revocable,
34
- },
35
- });
36
- if (callback)
37
- callback("pending");
38
- const uid = await tx.wait();
39
- if (callback)
40
- callback("confirmed");
41
- console.log(uid);
42
- return {
43
- tx: [
44
- {
45
- hash: tx.tx.hash,
46
- },
47
- ],
48
- uids: [uid],
49
- };
50
- }
51
- catch (error) {
52
- console.error(error);
53
- throw new SchemaError_1.AttestationError("ATTEST_ERROR", error.message, error);
54
- }
55
- }
56
- /**
57
- * Verify this ProjectUpdate. If the ProjectUpdate is not already verified,
58
- * it will throw an error.
59
- * @param signer
60
- * @param reason
61
- */
62
- async verify(signer, data, callback) {
63
- console.log("Verifying");
64
- const schema = this.schema.gap.findSchema("ProjectMilestoneStatus");
65
- if (this.schema.isJsonSchema()) {
66
- schema.setValue("json", JSON.stringify({
67
- type: "verified",
68
- reason: data?.reason || "",
69
- }));
70
- }
71
- else {
72
- schema.setValue("type", "project-milestone-verified");
73
- schema.setValue("reason", data?.reason || "");
74
- }
75
- console.log("Before attest project milestone verified");
76
- await this.attestStatus(signer, schema, callback);
77
- console.log("After attest project milestone verified");
78
- this.verified.push(new ProjectMilestoneStatus({
79
- data: {
80
- type: "project-milestone-verified",
81
- reason: data?.reason || "",
82
- },
83
- refUID: this.uid,
84
- schema: schema,
85
- recipient: this.recipient,
86
- }));
87
- }
88
- /**
89
- * Marks a milestone as completed. If the milestone is already completed,
90
- * it will throw an error.
91
- * @param signer
92
- * @param reason
93
- */
94
- async complete(signer, data, callback) {
95
- console.log("Completing");
96
- const schema = this.schema.gap.findSchema("ProjectMilestoneStatus");
97
- if (this.schema.isJsonSchema()) {
98
- schema.setValue("json", JSON.stringify({
99
- type: "project-milestone-completed",
100
- ...data,
101
- }));
102
- }
103
- else {
104
- schema.setValue("type", "project-milestone-completed");
105
- schema.setValue("proofOfWork", data?.proofOfWork || "");
106
- schema.setValue("reason", data?.reason || "");
107
- }
108
- console.log("Before attest project milestone completed");
109
- const { tx, uids } = await this.attestStatus(signer, schema, callback);
110
- console.log("After attest project milestone completed");
111
- this.completed = new attestations_1.MilestoneCompleted({
112
- data: {
113
- reason: data?.reason || "",
114
- },
115
- refUID: this.uid,
116
- schema: schema,
117
- recipient: this.recipient,
118
- });
119
- return { tx, uids };
120
- }
121
- /**
122
- * Revokes the completed status of the milestone. If the milestone is not completed,
123
- * it will throw an error.
124
- * @param signer
125
- */
126
- async revokeCompletion(signer, callback) {
127
- if (!this.completed)
128
- throw new SchemaError_1.AttestationError("ATTEST_ERROR", "Milestone is not completed");
129
- const { tx, uids } = await this.completed.schema.multiRevoke(signer, [
130
- {
131
- schemaId: this.completed.schema.uid,
132
- uid: this.completed.uid,
133
- },
134
- ], callback);
135
- return { tx, uids };
136
- }
137
- static from(attestations, network) {
138
- return attestations.map((attestation) => {
139
- const projectMilestone = new ProjectMilestone({
140
- ...attestation,
141
- data: {
142
- ...attestation.data,
143
- },
144
- schema: new AllGapSchemas_1.AllGapSchemas().findSchema("ProjectMilestone", consts_1.chainIdToNetwork[attestation.chainID]),
145
- chainID: attestation.chainID,
146
- });
147
- if (attestation.verified?.length > 0) {
148
- projectMilestone.verified = attestation.verified.map((m) => new ProjectMilestoneStatus({
149
- ...m,
150
- data: {
151
- ...m.data,
152
- type: m.data.type === "completed"
153
- ? "project-milestone-completed"
154
- : "project-milestone-verified",
155
- },
156
- schema: new AllGapSchemas_1.AllGapSchemas().findSchema("ProjectMilestoneStatus", consts_1.chainIdToNetwork[attestation.chainID]),
157
- chainID: attestation.chainID,
158
- }));
159
- }
160
- if (attestation.completed) {
161
- projectMilestone.completed = new attestations_1.MilestoneCompleted({
162
- ...attestation.completed,
163
- data: {
164
- ...attestation.completed.data,
165
- },
166
- schema: new AllGapSchemas_1.AllGapSchemas().findSchema("MilestoneCompleted", consts_1.chainIdToNetwork[attestation.chainID]),
167
- chainID: attestation.chainID,
168
- });
169
- }
170
- return projectMilestone;
171
- });
172
- }
173
- }
174
- exports.ProjectMilestone = ProjectMilestone;
@@ -1,12 +0,0 @@
1
- import { TNetwork } from "../../../core/types";
2
- import { Attestation } from "../Attestation";
3
- export interface _IProjectPointer extends ProjectPointer {
4
- }
5
- export interface IProjectPointer {
6
- ogProjectUID: string;
7
- type?: string;
8
- }
9
- export declare class ProjectPointer extends Attestation<IProjectPointer> implements IProjectPointer {
10
- ogProjectUID: string;
11
- static from(attestations: _IProjectPointer[], network: TNetwork): ProjectPointer[];
12
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProjectPointer = void 0;
4
- const Attestation_1 = require("../Attestation");
5
- const AllGapSchemas_1 = require("../AllGapSchemas");
6
- const consts_1 = require("../../../core/consts");
7
- class ProjectPointer extends Attestation_1.Attestation {
8
- static from(attestations, network) {
9
- return attestations.map((attestation) => {
10
- const projectUpdate = new ProjectPointer({
11
- ...attestation,
12
- data: {
13
- ...attestation.data,
14
- },
15
- schema: new AllGapSchemas_1.AllGapSchemas().findSchema("ProjectUpdate", consts_1.chainIdToNetwork[attestation.chainID]),
16
- chainID: attestation.chainID,
17
- });
18
- return projectUpdate;
19
- });
20
- }
21
- }
22
- exports.ProjectPointer = ProjectPointer;
@@ -1,50 +0,0 @@
1
- import { SignerOrProvider, TNetwork } from "../../../core/types";
2
- import { Attestation } from "../Attestation";
3
- export interface _IProjectUpdate extends ProjectUpdate {
4
- }
5
- export interface IProjectUpdate {
6
- title: string;
7
- text: string;
8
- startDate?: Date;
9
- endDate?: Date;
10
- type?: string;
11
- grants?: string[];
12
- indicators?: {
13
- name: string;
14
- indicatorId: string;
15
- }[];
16
- deliverables?: {
17
- name: string;
18
- proof: string;
19
- description: string;
20
- }[];
21
- }
22
- type IStatus = "verified";
23
- export interface IProjectUpdateStatus {
24
- type?: `project-update-${IStatus}`;
25
- reason?: string;
26
- proofOfWork?: string;
27
- }
28
- export declare class ProjectUpdateStatus extends Attestation<IProjectUpdateStatus> implements IProjectUpdateStatus {
29
- type: `project-update-${IStatus}`;
30
- reason?: string;
31
- proofOfWork?: string;
32
- }
33
- export declare class ProjectUpdate extends Attestation<IProjectUpdate> implements IProjectUpdate {
34
- title: string;
35
- text: string;
36
- verified: ProjectUpdateStatus[];
37
- /**
38
- * Attest the status of the update as approved, rejected or completed.
39
- */
40
- private attestStatus;
41
- /**
42
- * Verify this ProjectUpdate. If the ProjectUpdate is not already verified,
43
- * it will throw an error.
44
- * @param signer
45
- * @param reason
46
- */
47
- verify(signer: SignerOrProvider, data?: IProjectUpdateStatus, callback?: Function): Promise<void>;
48
- static from(attestations: _IProjectUpdate[], network: TNetwork): ProjectUpdate[];
49
- }
50
- export {};
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProjectUpdate = exports.ProjectUpdateStatus = void 0;
4
- const Attestation_1 = require("../Attestation");
5
- const SchemaError_1 = require("../SchemaError");
6
- const AllGapSchemas_1 = require("../AllGapSchemas");
7
- const consts_1 = require("../../../core/consts");
8
- class ProjectUpdateStatus extends Attestation_1.Attestation {
9
- }
10
- exports.ProjectUpdateStatus = ProjectUpdateStatus;
11
- class ProjectUpdate extends Attestation_1.Attestation {
12
- constructor() {
13
- super(...arguments);
14
- this.verified = [];
15
- }
16
- /**
17
- * Attest the status of the update as approved, rejected or completed.
18
- */
19
- async attestStatus(signer, schema, callback) {
20
- const eas = this.schema.gap.eas.connect(signer);
21
- try {
22
- if (callback)
23
- callback("preparing");
24
- const tx = await eas.attest({
25
- schema: schema.uid,
26
- data: {
27
- recipient: this.recipient,
28
- data: schema.encode(),
29
- refUID: this.uid,
30
- expirationTime: 0n,
31
- revocable: schema.revocable,
32
- },
33
- });
34
- if (callback)
35
- callback("pending");
36
- const uid = await tx.wait();
37
- if (callback)
38
- callback("confirmed");
39
- console.log(uid);
40
- return {
41
- tx: [
42
- {
43
- hash: tx.tx.hash,
44
- },
45
- ],
46
- uids: [uid],
47
- };
48
- }
49
- catch (error) {
50
- console.error(error);
51
- throw new SchemaError_1.AttestationError("ATTEST_ERROR", error.message, error);
52
- }
53
- }
54
- /**
55
- * Verify this ProjectUpdate. If the ProjectUpdate is not already verified,
56
- * it will throw an error.
57
- * @param signer
58
- * @param reason
59
- */
60
- async verify(signer, data, callback) {
61
- console.log("Verifying");
62
- const schema = this.schema.gap.findSchema("ProjectUpdateStatus");
63
- if (this.schema.isJsonSchema()) {
64
- schema.setValue("json", JSON.stringify({
65
- type: "verified",
66
- reason: data?.reason || "",
67
- }));
68
- }
69
- else {
70
- schema.setValue("type", "project-update-verified");
71
- schema.setValue("reason", data?.reason || "");
72
- }
73
- console.log("Before attest project update verified");
74
- await this.attestStatus(signer, schema, callback);
75
- console.log("After attest project update verified");
76
- this.verified.push(new ProjectUpdateStatus({
77
- data: {
78
- type: "project-update-verified",
79
- reason: data?.reason || "",
80
- },
81
- refUID: this.uid,
82
- schema: schema,
83
- recipient: this.recipient,
84
- }));
85
- }
86
- static from(attestations, network) {
87
- return attestations.map((attestation) => {
88
- const projectUpdate = new ProjectUpdate({
89
- ...attestation,
90
- data: {
91
- ...attestation.data,
92
- },
93
- schema: new AllGapSchemas_1.AllGapSchemas().findSchema("ProjectUpdate", consts_1.chainIdToNetwork[attestation.chainID]),
94
- chainID: attestation.chainID,
95
- });
96
- if (attestation.verified?.length > 0) {
97
- projectUpdate.verified = attestation.verified.map((m) => new ProjectUpdateStatus({
98
- ...m,
99
- data: {
100
- ...m.data,
101
- },
102
- schema: new AllGapSchemas_1.AllGapSchemas().findSchema("ProjectUpdateStatus", consts_1.chainIdToNetwork[attestation.chainID]),
103
- chainID: attestation.chainID,
104
- }));
105
- }
106
- return projectUpdate;
107
- });
108
- }
109
- }
110
- exports.ProjectUpdate = ProjectUpdate;
@@ -1,16 +0,0 @@
1
- import { TNetwork } from "core/types";
2
- import { ITrackResponse } from "../karma-indexer/api/types";
3
- export declare class Track {
4
- id: string;
5
- name: string;
6
- description?: string;
7
- communityUID: string;
8
- isArchived: boolean;
9
- createdAt: Date;
10
- updatedAt: Date;
11
- programId?: string;
12
- isActive?: boolean;
13
- network: TNetwork;
14
- constructor(data: any, network: TNetwork);
15
- static from(data: ITrackResponse[], network: TNetwork): Track[];
16
- }
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Track = void 0;
4
- class Track {
5
- constructor(data, network) {
6
- this.id = data.id;
7
- this.name = data.name;
8
- this.description = data.description;
9
- this.communityUID = data.communityUID;
10
- this.isArchived = data.isArchived ?? false;
11
- this.createdAt = new Date(data.createdAt);
12
- this.updatedAt = new Date(data.updatedAt);
13
- this.programId = data.programId;
14
- this.isActive = data.isActive;
15
- this.network = network;
16
- }
17
- static from(data, network) {
18
- return data.map((item) => new Track(item, network));
19
- }
20
- }
21
- exports.Track = Track;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Grant"), exports);
18
- __exportStar(require("./Milestone"), exports);
19
- __exportStar(require("./Project"), exports);
20
- __exportStar(require("./Community"), exports);
21
- __exportStar(require("./MemberOf"), exports);
22
- __exportStar(require("./GrantUpdate"), exports);
23
- __exportStar(require("./ProjectUpdate"), exports);
24
- __exportStar(require("./ProjectPointer"), exports);
25
- __exportStar(require("./ContributorProfile"), exports);
26
- __exportStar(require("./Track"), exports);
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Attestation"), exports);
18
- __exportStar(require("./GAP"), exports);
19
- __exportStar(require("./GapSchema"), exports);
20
- __exportStar(require("./Schema"), exports);
21
- __exportStar(require("./SchemaError"), exports);
22
- __exportStar(require("./entities"), exports);
23
- __exportStar(require("./Fetcher"), exports);
24
- __exportStar(require("./karma-indexer/GapIndexerClient"), exports);
25
- __exportStar(require("./remote-storage/IpfsStorage"), exports);
26
- __exportStar(require("./remote-storage/RemoteStorage"), exports);
@@ -1,66 +0,0 @@
1
- import { TSchemaName, IAttestation, Hex } from "core/types";
2
- import { Attestation } from "../Attestation";
3
- import { GapSchema } from "../GapSchema";
4
- import { Fetcher } from "../Fetcher";
5
- import { Community, Project, Grant, Milestone, MemberOf, Track } from "../entities";
6
- import { Grantee } from "../types/attestations";
7
- import { ICommunityAdminsResponse } from "./api/types";
8
- import { ProjectMilestone } from "../entities/ProjectMilestone";
9
- export declare class GapIndexerClient extends Fetcher {
10
- private apiClient;
11
- constructor(params: any);
12
- attestation<T = unknown>(uid: `0x${string}`): Promise<Attestation<T, GapSchema>>;
13
- attestations(schemaName: TSchemaName, search?: string): Promise<IAttestation[]>;
14
- attestationsOf(schemaName: TSchemaName, attester: `0x${string}`): Promise<IAttestation[]>;
15
- attestationsTo(schemaName: TSchemaName, recipient: `0x${string}`): Promise<IAttestation[]>;
16
- communities(search?: string): Promise<Community[]>;
17
- communitiesOf(address: Hex, withGrants: boolean): Promise<Community[]>;
18
- adminOf(address: Hex): Promise<Community[]>;
19
- communitiesAdminOf(address: Hex, withGrants: boolean): Promise<Community[]>;
20
- communitiesByIds(uids: `0x${string}`[]): Promise<Community[]>;
21
- communityBySlug(slug: string): Promise<Community>;
22
- communityById(uid: `0x${string}`): Promise<Community>;
23
- communityAdmins(uid: `0x${string}`): Promise<ICommunityAdminsResponse>;
24
- projectBySlug(slug: string): Promise<Project>;
25
- projectById(uid: `0x${string}`): Promise<Project>;
26
- search(query: string): Promise<{
27
- projects: Project[];
28
- communities: Community[];
29
- }>;
30
- searchProjects(query: string): Promise<Project[]>;
31
- projects(name?: string): Promise<Project[]>;
32
- projectsOf(grantee: `0x${string}`): Promise<Project[]>;
33
- projectMilestones(uidOrSlug: string): Promise<ProjectMilestone[]>;
34
- grantee(address: `0x${string}`): Promise<Grantee>;
35
- grantees(): Promise<Grantee[]>;
36
- grantsOf(grantee: `0x${string}`, withCommunity?: boolean): Promise<Grant[]>;
37
- grantsFor(projects: Project[], withCommunity?: boolean): Promise<Grant[]>;
38
- grantsForExtProject(projectExtId: string): Promise<Grant[]>;
39
- grantsByCommunity(uid: `0x${string}`, page?: number, pageLimit?: number): Promise<Grant[]>;
40
- milestonesOf(grants: Grant[]): Promise<Milestone[]>;
41
- membersOf(projects: Project[]): Promise<MemberOf[]>;
42
- slugExists(slug: string): Promise<boolean>;
43
- /**
44
- * Track related methods
45
- */
46
- getTracks(communityUID: string, includeArchived?: boolean): Promise<Track[]>;
47
- getTrackById(id: string): Promise<Track>;
48
- createTrack(trackData: {
49
- name: string;
50
- description?: string;
51
- communityUID: string;
52
- }): Promise<Track>;
53
- updateTrack(id: string, trackData: {
54
- name?: string;
55
- description?: string;
56
- communityUID?: string;
57
- }): Promise<Track>;
58
- archiveTrack(id: string): Promise<Track>;
59
- assignTracksToProgram(programId: string, trackIds: string[]): Promise<any[]>;
60
- unassignTrackFromProgram(programId: string, trackId: string): Promise<any>;
61
- getTracksForProgram(programId: string): Promise<Track[]>;
62
- getTracksForProject(projectId: string, programId: string, activeOnly?: boolean): Promise<Track[]>;
63
- assignTracksToProject(projectId: string, programId: string, trackIds: string[]): Promise<any[]>;
64
- unassignTracksFromProject(projectId: string, programId: string, trackIds: string[]): Promise<any[]>;
65
- getProjectsByTrack(communityId: string, programId: string, trackId?: string): Promise<any[]>;
66
- }