@show-karma/karma-gap-sdk 0.3.47 → 0.4.0

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.
@@ -1,9 +1,9 @@
1
- import { Hex, IAttestation, TSchemaName } from 'core/types';
2
- import { Attestation } from './Attestation';
3
- import { Community, Grant, MemberOf, Milestone, Project } from './entities';
4
- import { Grantee } from './types/attestations';
5
- import { AxiosGQL } from './GraphQL/AxiosGQL';
6
- import { GAP } from './GAP';
1
+ import { Hex, IAttestation, TSchemaName } from "core/types";
2
+ import { Attestation } from "./Attestation";
3
+ import { Community, Grant, MemberOf, Milestone, Project } from "./entities";
4
+ import { Grantee } from "./types/attestations";
5
+ import { AxiosGQL } from "./GraphQL/AxiosGQL";
6
+ import { GAP } from "./GAP";
7
7
  export declare abstract class Fetcher extends AxiosGQL {
8
8
  protected gap: GAP;
9
9
  constructor(url: string);
@@ -147,7 +147,7 @@ export declare abstract class Fetcher extends AxiosGQL {
147
147
  * @param uid community uid
148
148
  * @returns
149
149
  */
150
- abstract grantsByCommunity(uid: Hex): any;
150
+ abstract grantsByCommunity(uid: Hex, page?: number, pageLimit?: number): any;
151
151
  /**
152
152
  * Fetch all milestones related to an array of Grants.
153
153
  * @param grants
@@ -36,7 +36,7 @@ export declare class GapIndexerClient extends Fetcher {
36
36
  grantsOf(grantee: `0x${string}`, withCommunity?: boolean): Promise<Grant[]>;
37
37
  grantsFor(projects: Project[], withCommunity?: boolean): Promise<Grant[]>;
38
38
  grantsForExtProject(projectExtId: string): Promise<Grant[]>;
39
- grantsByCommunity(uid: `0x${string}`): Promise<Grant[]>;
39
+ grantsByCommunity(uid: `0x${string}`, page?: number, pageLimit?: number): Promise<Grant[]>;
40
40
  milestonesOf(grants: Grant[]): Promise<Milestone[]>;
41
41
  membersOf(projects: Project[]): Promise<MemberOf[]>;
42
42
  slugExists(slug: string): Promise<boolean>;
@@ -137,9 +137,10 @@ class GapIndexerClient extends Fetcher_1.Fetcher {
137
137
  const { data } = await this.apiClient.grantsForExtProject(projectExtId);
138
138
  return entities_1.Grant.from(data, this.gap.network);
139
139
  }
140
- async grantsByCommunity(uid) {
141
- const { data } = await this.apiClient.grantsByCommunity(uid);
142
- return entities_1.Grant.from(data, this.gap.network);
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);
143
144
  }
144
145
  async milestonesOf(grants) {
145
146
  const { data } = await this.apiClient.milestonesOf(grants[0].uid);
@@ -39,7 +39,9 @@ export declare class GapIndexerApi extends AxiosGQL {
39
39
  grantsFor(uid: string, withCommunity?: boolean): Promise<import("axios").AxiosResponse<IGrantResponse[], any>>;
40
40
  grantsForExtProject(projectExtId: string): Promise<import("axios").AxiosResponse<IGrantResponse[], any>>;
41
41
  grantBySlug(slug: Hex): Promise<import("axios").AxiosResponse<IGrantResponse, any>>;
42
- grantsByCommunity(uid: Hex): Promise<import("axios").AxiosResponse<IGrantResponse[], any>>;
42
+ grantsByCommunity(uid: Hex, page?: number, pageLimit?: number): Promise<import("axios").AxiosResponse<{
43
+ data: IGrantResponse[];
44
+ }, any>>;
43
45
  /**
44
46
  * Milestone
45
47
  */
@@ -11,7 +11,7 @@ const Endpoints = {
11
11
  all: () => "/communities",
12
12
  admins: (uid) => `/communities/${uid}/admins`,
13
13
  byUidOrSlug: (uidOrSlug) => `/communities/${uidOrSlug}`,
14
- grants: (uidOrSlug) => `/communities/${uidOrSlug}/grants`,
14
+ grants: (uidOrSlug, page = 0, pageLimit = 100) => `/communities/${uidOrSlug}/grants?${page ? `page=${page}` : ""}${pageLimit ? `&pageLimit=${pageLimit}` : ""}`,
15
15
  },
16
16
  grantees: {
17
17
  all: () => "/grantees",
@@ -160,8 +160,8 @@ class GapIndexerApi extends AxiosGQL_1.AxiosGQL {
160
160
  const response = await this.client.get(Endpoints.grants.byUid(slug));
161
161
  return response;
162
162
  }
163
- async grantsByCommunity(uid) {
164
- const response = await this.client.get(Endpoints.communities.grants(uid));
163
+ async grantsByCommunity(uid, page = 0, pageLimit = 100) {
164
+ const response = await this.client.get(Endpoints.communities.grants(uid, page, pageLimit));
165
165
  return response;
166
166
  }
167
167
  /**
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.47",
6
+ "version": "0.4.0",
7
7
  "description": "Simple and easy interface between EAS and Karma GAP.",
8
8
  "main": "./index.js",
9
9
  "author": "KarmaHQ",