@show-karma/karma-gap-sdk 0.3.16 → 0.3.18
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/entities/Community.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 [];
|
|
@@ -50,6 +50,15 @@ class Community extends Attestation_1.Attestation {
|
|
|
50
50
|
data: this.data,
|
|
51
51
|
});
|
|
52
52
|
console.log(this.uid);
|
|
53
|
+
if (details) {
|
|
54
|
+
const communityDetails = new attestations_1.CommunityDetails({
|
|
55
|
+
data: details,
|
|
56
|
+
recipient: this.recipient,
|
|
57
|
+
refUID: this.uid,
|
|
58
|
+
schema: this.schema.gap.findSchema('CommunityDetails'),
|
|
59
|
+
});
|
|
60
|
+
await communityDetails.attest(signer);
|
|
61
|
+
}
|
|
53
62
|
}
|
|
54
63
|
catch (error) {
|
|
55
64
|
console.error(error);
|
|
@@ -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
|
}
|
|
@@ -14,6 +14,7 @@ export interface ICommunityDetails {
|
|
|
14
14
|
slug?: string;
|
|
15
15
|
links?: ExternalLink;
|
|
16
16
|
type?: string;
|
|
17
|
+
externalId?: string;
|
|
17
18
|
}
|
|
18
19
|
export declare class CommunityDetails extends Attestation<ICommunityDetails> implements ICommunityDetails {
|
|
19
20
|
name: string;
|
|
@@ -22,6 +23,7 @@ export declare class CommunityDetails extends Attestation<ICommunityDetails> imp
|
|
|
22
23
|
links: ExternalLink;
|
|
23
24
|
slug?: string;
|
|
24
25
|
type: string;
|
|
26
|
+
externalId?: string;
|
|
25
27
|
}
|
|
26
28
|
export interface IGrantDetails {
|
|
27
29
|
title: string;
|