@show-karma/karma-gap-sdk 0.2.5 → 0.2.8

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.
@@ -78,6 +78,12 @@ export declare abstract class Fetcher extends AxiosGQL {
78
78
  * @returns
79
79
  */
80
80
  abstract projectBySlug(slug: string): Promise<Project>;
81
+ /**
82
+ * Search projects by name. This method will return a list of projects
83
+ * __Must be implemented by the indexer__
84
+ * @param query
85
+ */
86
+ abstract searchProjects(query: string): Promise<Project[]>;
81
87
  /**
82
88
  * Fetch projects with details and members.
83
89
  * @param name if set, will search by the name.
@@ -44,6 +44,7 @@ export declare class GapEasClient extends Fetcher {
44
44
  projectById(uid: Hex): Promise<Project>;
45
45
  projectBySlug(slug: string): Promise<Project>;
46
46
  slugExists(slug: string): Promise<boolean>;
47
+ searchProjects(query: string): Promise<Project[]>;
47
48
  projects(name?: string): Promise<Project[]>;
48
49
  projectsOf(grantee: Hex): Promise<Project[]>;
49
50
  grantee(address: Hex): Promise<Grantee>;
@@ -229,6 +229,9 @@ class GapEasClient extends Fetcher_1.Fetcher {
229
229
  const { schema: { attestations }, } = await this.query(query);
230
230
  return attestations.some((a) => a.decodedDataJson.includes(slug));
231
231
  }
232
+ searchProjects(query) {
233
+ throw new Error('Method not implemented.');
234
+ }
232
235
  async projects(name) {
233
236
  const result = await this.attestations('Project', name);
234
237
  if (!result.length)
@@ -151,6 +151,9 @@ class Grant extends Attestation_1.Attestation {
151
151
  },
152
152
  schema: GapSchema_1.GapSchema.find('GrantDetails'),
153
153
  });
154
+ if (details.data?.questions) {
155
+ Object.assign(grant.details, { questions: details.data.questions });
156
+ }
154
157
  }
155
158
  if (attestation.milestones) {
156
159
  const { milestones } = attestation;
@@ -16,6 +16,7 @@ export declare class GapIndexerClient extends Fetcher {
16
16
  communityById(uid: `0x${string}`): Promise<Community>;
17
17
  projectBySlug(slug: string): Promise<Project>;
18
18
  projectById(uid: `0x${string}`): Promise<Project>;
19
+ searchProjects(query: string): Promise<Project[]>;
19
20
  projects(name?: string): Promise<Project[]>;
20
21
  projectsOf(grantee: `0x${string}`): Promise<Project[]>;
21
22
  grantee(address: `0x${string}`): Promise<Grantee>;
@@ -91,6 +91,14 @@ class GapIndexerClient extends Fetcher_1.Fetcher {
91
91
  projectById(uid) {
92
92
  return this.projectBySlug(uid);
93
93
  }
94
+ async searchProjects(query) {
95
+ const { data } = await this.client.get(Endpoints.project.all(), {
96
+ params: {
97
+ q: query,
98
+ },
99
+ });
100
+ return entities_1.Project.from(data);
101
+ }
94
102
  async projects(name) {
95
103
  const { data } = await this.client.get(Endpoints.project.all(), {
96
104
  params: {
@@ -29,6 +29,7 @@ export interface IGrantDetails {
29
29
  description?: string;
30
30
  season?: string;
31
31
  cycle?: string;
32
+ questions?: IGrantDetailsQuestion[];
32
33
  }
33
34
  export declare class GrantDetails extends Attestation<IGrantDetails> implements IGrantDetails {
34
35
  title: string;
@@ -39,6 +40,7 @@ export declare class GrantDetails extends Attestation<IGrantDetails> implements
39
40
  description?: string;
40
41
  season?: string;
41
42
  cycle?: string;
43
+ questions?: IGrantDetailsQuestion[];
42
44
  }
43
45
  export interface IGrantRound {
44
46
  name: string;
@@ -106,3 +108,8 @@ export declare class GrantUpdate extends Attestation<IGrantUpdate> implements IG
106
108
  }
107
109
  export declare class GrantCompleted extends GrantUpdate {
108
110
  }
111
+ export interface IGrantDetailsQuestion {
112
+ query: string;
113
+ explanation: string;
114
+ type: string;
115
+ }
@@ -10,6 +10,10 @@ class CommunityDetails extends Attestation_1.Attestation {
10
10
  }
11
11
  exports.CommunityDetails = CommunityDetails;
12
12
  class GrantDetails extends Attestation_1.Attestation {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.questions = [];
16
+ }
13
17
  }
14
18
  exports.GrantDetails = GrantDetails;
15
19
  class GrantRound extends Attestation_1.Attestation {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.2.5",
6
+ "version": "0.2.8",
7
7
  "description": "Simple and easy interface between EAS and Karma GAP.",
8
8
  "main": "./index.js",
9
9
  "author": "KarmaHQ",