@show-karma/karma-gap-sdk 0.3.15 → 0.3.17
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.
- package/core/class/Fetcher.d.ts +9 -0
- package/core/class/GraphQL/GapEasClient.d.ts +1 -0
- package/core/class/GraphQL/GapEasClient.js +9 -0
- package/core/class/karma-indexer/GapIndexerClient.d.ts +1 -0
- package/core/class/karma-indexer/GapIndexerClient.js +5 -0
- package/core/class/types/attestations.d.ts +2 -0
- package/package.json +1 -1
package/core/class/Fetcher.d.ts
CHANGED
|
@@ -51,6 +51,15 @@ export declare abstract class Fetcher extends AxiosGQL {
|
|
|
51
51
|
* @returns
|
|
52
52
|
*/
|
|
53
53
|
abstract communitiesOf(address: Hex, withGrants?: boolean): Promise<Community[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Fetch all available communities (admin) with details for a grantee;
|
|
56
|
+
*
|
|
57
|
+
* If search is defined, will try to find communities by the search string.
|
|
58
|
+
* @param address grantee address
|
|
59
|
+
* @param withGrants if true, will get community grants.
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
abstract communitiesAdminOf(address: Hex, withGrants?: boolean): Promise<Community[]>;
|
|
54
63
|
/**
|
|
55
64
|
* Fetch a set of communities by their ids.
|
|
56
65
|
* @param uids
|
|
@@ -30,6 +30,7 @@ export declare class GapEasClient extends Fetcher {
|
|
|
30
30
|
dependentsOf(parentSchema: TSchemaName, parentUid: Hex): Promise<Attestation[]>;
|
|
31
31
|
communities(search?: string): Promise<Community[]>;
|
|
32
32
|
communitiesOf(address?: Hex): Promise<Community[]>;
|
|
33
|
+
communitiesAdminOf(address?: Hex): Promise<Community[]>;
|
|
33
34
|
communitiesByIds(uids: Hex[]): Promise<Community[]>;
|
|
34
35
|
communitiesDetails(communities: Community[]): Promise<Community[]>;
|
|
35
36
|
communityBySlug(slug: string): Promise<Community>;
|
|
@@ -91,6 +91,15 @@ class GapEasClient extends Fetcher_1.Fetcher {
|
|
|
91
91
|
return [];
|
|
92
92
|
return this.communitiesDetails(communities);
|
|
93
93
|
}
|
|
94
|
+
async communitiesAdminOf(address) {
|
|
95
|
+
const [community] = this.gap.findManySchemas(['Community']);
|
|
96
|
+
const query = gql_queries_1.gqlQueries.attestationsTo(community.uid, address);
|
|
97
|
+
const { schema: { attestations }, } = await this.query(query);
|
|
98
|
+
const communities = Attestation_1.Attestation.fromInterface(attestations, this.network.name);
|
|
99
|
+
if (!communities.length)
|
|
100
|
+
return [];
|
|
101
|
+
return this.communitiesDetails(communities);
|
|
102
|
+
}
|
|
94
103
|
async communitiesByIds(uids) {
|
|
95
104
|
if (!uids.length)
|
|
96
105
|
return [];
|
|
@@ -11,6 +11,7 @@ export declare class GapIndexerClient extends Fetcher {
|
|
|
11
11
|
attestationsTo(schemaName: TSchemaName, recipient: `0x${string}`): Promise<IAttestation[]>;
|
|
12
12
|
communities(search?: string): Promise<Community[]>;
|
|
13
13
|
communitiesOf(address: Hex, withGrants: boolean): Promise<Community[]>;
|
|
14
|
+
communitiesAdminOf(address: Hex, withGrants: boolean): Promise<Community[]>;
|
|
14
15
|
communitiesByIds(uids: `0x${string}`[]): Promise<Community[]>;
|
|
15
16
|
communityBySlug(slug: string): Promise<Community>;
|
|
16
17
|
communityById(uid: `0x${string}`): Promise<Community>;
|
|
@@ -20,6 +20,7 @@ const Endpoints = {
|
|
|
20
20
|
grants: (address) => `/grantees/${address}/grants`,
|
|
21
21
|
projects: (address) => `/grantees/${address}/projects`,
|
|
22
22
|
communities: (address, withGrants) => `/grantees/${address}/communities${withGrants ? '?withGrants=true' : ''}`,
|
|
23
|
+
communitiesAdmin: (address, withGrants) => `/grantees/${address}/communities/admin${withGrants ? '?withGrants=true' : ''}`,
|
|
23
24
|
},
|
|
24
25
|
grants: {
|
|
25
26
|
all: () => '/grants',
|
|
@@ -73,6 +74,10 @@ class GapIndexerClient extends Fetcher_1.Fetcher {
|
|
|
73
74
|
const { data } = await this.client.get(Endpoints.grantees.communities(address, withGrants));
|
|
74
75
|
return entities_1.Community.from(data, this.gap.network);
|
|
75
76
|
}
|
|
77
|
+
async communitiesAdminOf(address, withGrants) {
|
|
78
|
+
const { data } = await this.client.get(Endpoints.grantees.communitiesAdmin(address, withGrants));
|
|
79
|
+
return entities_1.Community.from(data, this.gap.network);
|
|
80
|
+
}
|
|
76
81
|
communitiesByIds(uids) {
|
|
77
82
|
throw new Error('Method not implemented.');
|
|
78
83
|
}
|
|
@@ -126,12 +126,14 @@ export interface IProjectImpact {
|
|
|
126
126
|
work: string;
|
|
127
127
|
impact: string;
|
|
128
128
|
proof: string;
|
|
129
|
+
completedAt: number;
|
|
129
130
|
type?: string;
|
|
130
131
|
}
|
|
131
132
|
export declare class ProjectImpact extends Attestation<IProjectImpact> implements IProjectImpact {
|
|
132
133
|
work: string;
|
|
133
134
|
impact: string;
|
|
134
135
|
proof: string;
|
|
136
|
+
completedAt: number;
|
|
135
137
|
type?: string;
|
|
136
138
|
constructor(data: AttestationArgs<IProjectImpact, GapSchema>);
|
|
137
139
|
}
|