@show-karma/karma-gap-sdk 0.1.29
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/abi/MultiAttester.json +676 -0
- package/core/class/Attestation.d.ts +169 -0
- package/core/class/Attestation.js +311 -0
- package/core/class/Fetcher.d.ts +132 -0
- package/core/class/Fetcher.js +7 -0
- package/core/class/GAP.d.ts +212 -0
- package/core/class/GAP.js +206 -0
- package/core/class/GapSchema.d.ts +33 -0
- package/core/class/GapSchema.js +61 -0
- package/core/class/Gelato/Gelato.d.ts +0 -0
- package/core/class/Gelato/Gelato.js +263 -0
- package/core/class/GraphQL/AxiosGQL.d.ts +6 -0
- package/core/class/GraphQL/AxiosGQL.js +25 -0
- package/core/class/GraphQL/EASClient.d.ts +16 -0
- package/core/class/GraphQL/EASClient.js +26 -0
- package/core/class/GraphQL/Fetcher.d.ts +132 -0
- package/core/class/GraphQL/Fetcher.js +7 -0
- package/core/class/GraphQL/GAPFetcher.d.ts +160 -0
- package/core/class/GraphQL/GAPFetcher.js +516 -0
- package/core/class/GraphQL/GapEasClient.d.ts +63 -0
- package/core/class/GraphQL/GapEasClient.js +420 -0
- package/core/class/GraphQL/index.d.ts +3 -0
- package/core/class/GraphQL/index.js +19 -0
- package/core/class/Schema.d.ts +213 -0
- package/core/class/Schema.js +434 -0
- package/core/class/SchemaError.d.ts +26 -0
- package/core/class/SchemaError.js +34 -0
- package/core/class/contract/GapContract.d.ts +55 -0
- package/core/class/contract/GapContract.js +176 -0
- package/core/class/contract/MultiAttest.d.ts +10 -0
- package/core/class/contract/MultiAttest.js +19 -0
- package/core/class/entities/Community.d.ts +36 -0
- package/core/class/entities/Community.js +88 -0
- package/core/class/entities/Grant.d.ts +53 -0
- package/core/class/entities/Grant.js +194 -0
- package/core/class/entities/MemberOf.d.ts +11 -0
- package/core/class/entities/MemberOf.js +31 -0
- package/core/class/entities/Milestone.d.ts +63 -0
- package/core/class/entities/Milestone.js +171 -0
- package/core/class/entities/Project.d.ts +73 -0
- package/core/class/entities/Project.js +243 -0
- package/core/class/entities/index.d.ts +5 -0
- package/core/class/entities/index.js +21 -0
- package/core/class/index.d.ts +7 -0
- package/core/class/index.js +23 -0
- package/core/class/karma-indexer/GapIndexerClient.d.ts +28 -0
- package/core/class/karma-indexer/GapIndexerClient.js +137 -0
- package/core/class/types/attestations.d.ts +108 -0
- package/core/class/types/attestations.js +55 -0
- package/core/consts.d.ts +19 -0
- package/core/consts.js +228 -0
- package/core/index.d.ts +7 -0
- package/core/index.js +23 -0
- package/core/types.d.ts +107 -0
- package/core/types.js +13 -0
- package/core/utils/gelato/index.d.ts +3 -0
- package/core/utils/gelato/index.js +19 -0
- package/core/utils/gelato/send-gelato-txn.d.ts +54 -0
- package/core/utils/gelato/send-gelato-txn.js +99 -0
- package/core/utils/gelato/sponsor-handler.d.ts +9 -0
- package/core/utils/gelato/sponsor-handler.js +60 -0
- package/core/utils/gelato/watch-gelato-txn.d.ts +7 -0
- package/core/utils/gelato/watch-gelato-txn.js +55 -0
- package/core/utils/get-date.d.ts +1 -0
- package/core/utils/get-date.js +7 -0
- package/core/utils/gql-queries.d.ts +12 -0
- package/core/utils/gql-queries.js +90 -0
- package/core/utils/index.d.ts +6 -0
- package/core/utils/index.js +22 -0
- package/core/utils/map-filter.d.ts +8 -0
- package/core/utils/map-filter.js +20 -0
- package/core/utils/serialize-bigint.d.ts +1 -0
- package/core/utils/serialize-bigint.js +8 -0
- package/core/utils/to-unix.d.ts +1 -0
- package/core/utils/to-unix.js +25 -0
- package/index.d.ts +1 -0
- package/index.js +17 -0
- package/package.json +37 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GapIndexerClient = void 0;
|
|
4
|
+
const Attestation_1 = require("../Attestation");
|
|
5
|
+
const GapSchema_1 = require("../GapSchema");
|
|
6
|
+
const Fetcher_1 = require("../Fetcher");
|
|
7
|
+
const entities_1 = require("../entities");
|
|
8
|
+
const Endpoints = {
|
|
9
|
+
attestations: {
|
|
10
|
+
all: () => "/attestations",
|
|
11
|
+
byUid: (uid) => `/attestations/${uid}`,
|
|
12
|
+
},
|
|
13
|
+
communities: {
|
|
14
|
+
all: () => "/communities",
|
|
15
|
+
byUidOrSlug: (uidOrSlug) => `/communities/${uidOrSlug}`,
|
|
16
|
+
grants: (uidOrSlug) => `/communities/${uidOrSlug}/grants`,
|
|
17
|
+
},
|
|
18
|
+
grantees: {
|
|
19
|
+
all: () => "/grantees",
|
|
20
|
+
byAddress: (address) => `/grantees/${address}`,
|
|
21
|
+
grants: (address) => `/grantees/${address}/grants`,
|
|
22
|
+
projects: (address) => `/grantees/${address}/projects`,
|
|
23
|
+
},
|
|
24
|
+
grants: {
|
|
25
|
+
all: () => "/grants",
|
|
26
|
+
byUid: (uid) => `/grants/${uid}`,
|
|
27
|
+
},
|
|
28
|
+
project: {
|
|
29
|
+
all: () => "/projects",
|
|
30
|
+
byUidOrSlug: (uidOrSlug) => `/projects/${uidOrSlug}`,
|
|
31
|
+
grants: (uidOrSlug) => `/projects/${uidOrSlug}/grants`,
|
|
32
|
+
milestones: (uidOrSlug) => `/projects/${uidOrSlug}/milestones`,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
class GapIndexerClient extends Fetcher_1.Fetcher {
|
|
36
|
+
async attestation(uid) {
|
|
37
|
+
const { data } = await this.client.get(Endpoints.attestations.byUid(uid));
|
|
38
|
+
if (!data)
|
|
39
|
+
throw new Error("Attestation not found");
|
|
40
|
+
return Attestation_1.Attestation.fromInterface([data])[0];
|
|
41
|
+
}
|
|
42
|
+
async attestations(schemaName, search) {
|
|
43
|
+
const { data } = await this.client.get(Endpoints.attestations.all(), {
|
|
44
|
+
params: {
|
|
45
|
+
"filter[schemaUID]": GapSchema_1.GapSchema.get(schemaName).uid,
|
|
46
|
+
"filter[data]": search,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
return data || [];
|
|
50
|
+
}
|
|
51
|
+
async attestationsOf(schemaName, attester) {
|
|
52
|
+
const { data } = await this.client.get(Endpoints.attestations.all(), {
|
|
53
|
+
params: {
|
|
54
|
+
"filter[schemaUID]": GapSchema_1.GapSchema.get(schemaName).uid,
|
|
55
|
+
"filter[recipient]": attester,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
return data || [];
|
|
59
|
+
}
|
|
60
|
+
attestationsTo(schemaName, recipient) {
|
|
61
|
+
return this.attestationsOf(schemaName, recipient);
|
|
62
|
+
}
|
|
63
|
+
async communities(search) {
|
|
64
|
+
const { data } = await this.client.get(Endpoints.communities.all(), {
|
|
65
|
+
params: {
|
|
66
|
+
"filter[name]": search,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
return entities_1.Community.from(data);
|
|
70
|
+
}
|
|
71
|
+
communitiesByIds(uids) {
|
|
72
|
+
throw new Error("Method not implemented.");
|
|
73
|
+
}
|
|
74
|
+
async communityBySlug(slug) {
|
|
75
|
+
const { data } = await this.client.get(Endpoints.communities.byUidOrSlug(slug));
|
|
76
|
+
return entities_1.Community.from([data])[0];
|
|
77
|
+
}
|
|
78
|
+
communityById(uid) {
|
|
79
|
+
return this.communityBySlug(uid);
|
|
80
|
+
}
|
|
81
|
+
async projectBySlug(slug) {
|
|
82
|
+
const { data } = await this.client.get(Endpoints.project.byUidOrSlug(slug));
|
|
83
|
+
return entities_1.Project.from([data])[0];
|
|
84
|
+
}
|
|
85
|
+
projectById(uid) {
|
|
86
|
+
return this.projectBySlug(uid);
|
|
87
|
+
}
|
|
88
|
+
async projects(name) {
|
|
89
|
+
const { data } = await this.client.get(Endpoints.project.all(), {
|
|
90
|
+
params: {
|
|
91
|
+
"filter[title]": name,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
return entities_1.Project.from(data);
|
|
95
|
+
}
|
|
96
|
+
async projectsOf(grantee) {
|
|
97
|
+
const { data } = await this.client.get(Endpoints.grantees.projects(grantee));
|
|
98
|
+
return entities_1.Project.from(data);
|
|
99
|
+
}
|
|
100
|
+
async grantee(address) {
|
|
101
|
+
const { data } = await this.client.get(Endpoints.grantees.byAddress(address));
|
|
102
|
+
return data;
|
|
103
|
+
}
|
|
104
|
+
async grantees() {
|
|
105
|
+
const { data } = await this.client.get(Endpoints.grantees.all());
|
|
106
|
+
return data;
|
|
107
|
+
}
|
|
108
|
+
async grantsOf(grantee, withCommunity) {
|
|
109
|
+
const { data } = await this.client.get(Endpoints.grantees.grants(grantee));
|
|
110
|
+
return entities_1.Grant.from(data);
|
|
111
|
+
}
|
|
112
|
+
async grantsFor(projects, withCommunity) {
|
|
113
|
+
const { data } = await this.client.get(Endpoints.project.grants(projects[0].uid));
|
|
114
|
+
return entities_1.Grant.from(data);
|
|
115
|
+
}
|
|
116
|
+
async grantsByCommunity(uid) {
|
|
117
|
+
const { data } = await this.client.get(Endpoints.communities.grants(uid));
|
|
118
|
+
return entities_1.Grant.from(data);
|
|
119
|
+
}
|
|
120
|
+
async milestonesOf(grants) {
|
|
121
|
+
const { data } = await this.client.get(Endpoints.project.milestones(grants[0].uid));
|
|
122
|
+
return entities_1.Milestone.from(data);
|
|
123
|
+
}
|
|
124
|
+
async membersOf(projects) {
|
|
125
|
+
throw new Error("Method not implemented.");
|
|
126
|
+
}
|
|
127
|
+
async slugExists(slug) {
|
|
128
|
+
try {
|
|
129
|
+
await this.client.get(Endpoints.project.byUidOrSlug(slug));
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.GapIndexerClient = GapIndexerClient;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Attestation } from '../Attestation';
|
|
2
|
+
import { Hex } from 'core/types';
|
|
3
|
+
import { Project } from '../entities/Project';
|
|
4
|
+
/** Attestation interfaces */
|
|
5
|
+
export type ExternalLink = {
|
|
6
|
+
type: string;
|
|
7
|
+
url: string;
|
|
8
|
+
}[];
|
|
9
|
+
export interface ICommunityDetails {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
imageURL: string;
|
|
13
|
+
slug?: string;
|
|
14
|
+
links?: ExternalLink;
|
|
15
|
+
}
|
|
16
|
+
export declare class CommunityDetails extends Attestation<ICommunityDetails> implements ICommunityDetails {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
imageURL: string;
|
|
20
|
+
links: ExternalLink;
|
|
21
|
+
slug?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface IGrantDetails {
|
|
24
|
+
title: string;
|
|
25
|
+
amount?: string;
|
|
26
|
+
proposalURL: string;
|
|
27
|
+
assetAndChainId?: [Hex, number];
|
|
28
|
+
payoutAddress?: Hex;
|
|
29
|
+
description?: string;
|
|
30
|
+
season?: string;
|
|
31
|
+
cycle?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare class GrantDetails extends Attestation<IGrantDetails> implements IGrantDetails {
|
|
34
|
+
title: string;
|
|
35
|
+
proposalURL: string;
|
|
36
|
+
payoutAddress?: Hex;
|
|
37
|
+
amount?: string;
|
|
38
|
+
assetAndChainId?: [Hex, number];
|
|
39
|
+
description?: string;
|
|
40
|
+
season?: string;
|
|
41
|
+
cycle?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface IGrantRound {
|
|
44
|
+
name: string;
|
|
45
|
+
}
|
|
46
|
+
export declare class GrantRound extends Attestation<IGrantRound> implements IGrantRound {
|
|
47
|
+
name: string;
|
|
48
|
+
}
|
|
49
|
+
export interface IGrantVerified {
|
|
50
|
+
verified: boolean;
|
|
51
|
+
}
|
|
52
|
+
export declare class GrantVerified extends Attestation<IGrantVerified> implements IGrantVerified {
|
|
53
|
+
verified: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface IMemberDetails {
|
|
56
|
+
name: string;
|
|
57
|
+
profilePictureURL: string;
|
|
58
|
+
}
|
|
59
|
+
export declare class MemberDetails extends Attestation<IMemberDetails> implements IMemberDetails {
|
|
60
|
+
name: string;
|
|
61
|
+
profilePictureURL: string;
|
|
62
|
+
}
|
|
63
|
+
export interface IMilestoneCompleted {
|
|
64
|
+
type: 'approved' | 'rejected' | 'completed';
|
|
65
|
+
reason?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare class MilestoneCompleted extends Attestation<IMilestoneCompleted> implements IMilestoneCompleted {
|
|
68
|
+
type: 'approved' | 'rejected' | 'completed';
|
|
69
|
+
reason?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface ITag {
|
|
72
|
+
name: string;
|
|
73
|
+
}
|
|
74
|
+
export declare class Tag extends Attestation<ITag> implements ITag {
|
|
75
|
+
name: string;
|
|
76
|
+
}
|
|
77
|
+
export interface IProjectDetails {
|
|
78
|
+
title: string;
|
|
79
|
+
description: string;
|
|
80
|
+
imageURL: string;
|
|
81
|
+
links?: ExternalLink;
|
|
82
|
+
tags?: ITag[];
|
|
83
|
+
slug?: string;
|
|
84
|
+
}
|
|
85
|
+
export declare class ProjectDetails extends Attestation<IProjectDetails> implements IProjectDetails {
|
|
86
|
+
title: string;
|
|
87
|
+
description: string;
|
|
88
|
+
imageURL: string;
|
|
89
|
+
links: ExternalLink;
|
|
90
|
+
tags: ITag[];
|
|
91
|
+
slug: string;
|
|
92
|
+
}
|
|
93
|
+
export declare class Grantee {
|
|
94
|
+
address: string;
|
|
95
|
+
projects: Project[];
|
|
96
|
+
constructor(address: Hex, projects?: Project[]);
|
|
97
|
+
}
|
|
98
|
+
export interface IGrantUpdate {
|
|
99
|
+
title: string;
|
|
100
|
+
text: string;
|
|
101
|
+
type?: string;
|
|
102
|
+
}
|
|
103
|
+
export declare class GrantUpdate extends Attestation<IGrantUpdate> implements IGrantUpdate {
|
|
104
|
+
title: string;
|
|
105
|
+
text: string;
|
|
106
|
+
}
|
|
107
|
+
export declare class GrantCompleted extends GrantUpdate {
|
|
108
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GrantCompleted = exports.GrantUpdate = exports.Grantee = exports.ProjectDetails = exports.Tag = exports.MilestoneCompleted = exports.MemberDetails = exports.GrantVerified = exports.GrantRound = exports.GrantDetails = exports.CommunityDetails = void 0;
|
|
4
|
+
const Attestation_1 = require("../Attestation");
|
|
5
|
+
class CommunityDetails extends Attestation_1.Attestation {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.links = [];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.CommunityDetails = CommunityDetails;
|
|
12
|
+
class GrantDetails extends Attestation_1.Attestation {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.amount = '0';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.GrantDetails = GrantDetails;
|
|
19
|
+
class GrantRound extends Attestation_1.Attestation {
|
|
20
|
+
}
|
|
21
|
+
exports.GrantRound = GrantRound;
|
|
22
|
+
class GrantVerified extends Attestation_1.Attestation {
|
|
23
|
+
}
|
|
24
|
+
exports.GrantVerified = GrantVerified;
|
|
25
|
+
class MemberDetails extends Attestation_1.Attestation {
|
|
26
|
+
}
|
|
27
|
+
exports.MemberDetails = MemberDetails;
|
|
28
|
+
class MilestoneCompleted extends Attestation_1.Attestation {
|
|
29
|
+
}
|
|
30
|
+
exports.MilestoneCompleted = MilestoneCompleted;
|
|
31
|
+
class Tag extends Attestation_1.Attestation {
|
|
32
|
+
}
|
|
33
|
+
exports.Tag = Tag;
|
|
34
|
+
class ProjectDetails extends Attestation_1.Attestation {
|
|
35
|
+
constructor() {
|
|
36
|
+
super(...arguments);
|
|
37
|
+
this.links = [];
|
|
38
|
+
this.tags = [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ProjectDetails = ProjectDetails;
|
|
42
|
+
class Grantee {
|
|
43
|
+
constructor(address, projects = []) {
|
|
44
|
+
this.projects = [];
|
|
45
|
+
this.address = address;
|
|
46
|
+
this.projects = projects;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.Grantee = Grantee;
|
|
50
|
+
class GrantUpdate extends Attestation_1.Attestation {
|
|
51
|
+
}
|
|
52
|
+
exports.GrantUpdate = GrantUpdate;
|
|
53
|
+
class GrantCompleted extends GrantUpdate {
|
|
54
|
+
}
|
|
55
|
+
exports.GrantCompleted = GrantCompleted;
|
package/core/consts.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EASNetworkConfig, SchemaInterface, TNetwork, TSchemaName } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Schemas that should use default EAS attestation
|
|
4
|
+
* instead of the custom contract.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useDefaultAttestation: TSchemaName[];
|
|
7
|
+
export declare const nullRef = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
8
|
+
export declare const nullResolver = "0x0000000000000000000000000000000000000000";
|
|
9
|
+
export declare const zeroAddress = "0x0000000000000000000000000000000000000000";
|
|
10
|
+
/**
|
|
11
|
+
* The networks that are supported by the EAS
|
|
12
|
+
*/
|
|
13
|
+
export declare const Networks: Record<TNetwork, EASNetworkConfig>;
|
|
14
|
+
/**
|
|
15
|
+
* Mounts the schemas for the given network and return all the settings
|
|
16
|
+
* @param network
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
export declare const MountEntities: (network: EASNetworkConfig) => Record<TSchemaName, SchemaInterface<TSchemaName>>;
|
package/core/consts.js
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MountEntities = exports.Networks = exports.zeroAddress = exports.nullResolver = exports.nullRef = exports.useDefaultAttestation = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Schemas that should use default EAS attestation
|
|
6
|
+
* instead of the custom contract.
|
|
7
|
+
*/
|
|
8
|
+
exports.useDefaultAttestation = [
|
|
9
|
+
"MilestoneApproved",
|
|
10
|
+
"MilestoneCompleted",
|
|
11
|
+
"GrantVerified",
|
|
12
|
+
"Community",
|
|
13
|
+
];
|
|
14
|
+
exports.nullRef = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
15
|
+
// TODO: Remove null resolver and change usage to zero address
|
|
16
|
+
exports.nullResolver = "0x0000000000000000000000000000000000000000";
|
|
17
|
+
exports.zeroAddress = exports.nullResolver;
|
|
18
|
+
// resolver for dependents = 0xed081ABE885bc3575f810c904052A1f685A85903
|
|
19
|
+
/**
|
|
20
|
+
* The networks that are supported by the EAS
|
|
21
|
+
*/
|
|
22
|
+
exports.Networks = {
|
|
23
|
+
// mainnet: {
|
|
24
|
+
// url: "https://easscan.org/graphql",
|
|
25
|
+
// chainId: 1,
|
|
26
|
+
// contracts: {
|
|
27
|
+
// eas: "0xA1207F3BBa224E2c9c3c6D5aF63D0eb1582Ce587",
|
|
28
|
+
// schema: "0xA7b39296258348C78294F95B872b282326A97BDF",
|
|
29
|
+
// multicall:''
|
|
30
|
+
// },
|
|
31
|
+
// schemas: {
|
|
32
|
+
// Grant: "",
|
|
33
|
+
// GrantVerified: "",
|
|
34
|
+
// MemberOf: "",
|
|
35
|
+
// MilestoneApproved: "",
|
|
36
|
+
// MilestoneCompleted: "",
|
|
37
|
+
// Project: "",
|
|
38
|
+
// },
|
|
39
|
+
// },
|
|
40
|
+
// "base-goerli": {
|
|
41
|
+
// chainId: 5,
|
|
42
|
+
// url: "https://base-goerli.easscan.org/graphql",
|
|
43
|
+
// contracts: {
|
|
44
|
+
// eas: "0xAcfE09Fd03f7812F022FBf636700AdEA18Fd2A7A",
|
|
45
|
+
// schema: "0x720c2bA66D19A725143FBf5fDC5b4ADA2742682E",
|
|
46
|
+
// multicall:''
|
|
47
|
+
// },
|
|
48
|
+
// schemas: {
|
|
49
|
+
// Grant: "",
|
|
50
|
+
// GrantVerified: "",
|
|
51
|
+
// MemberOf: "",
|
|
52
|
+
// MilestoneApproved: "",
|
|
53
|
+
// MilestoneCompleted: "",
|
|
54
|
+
// Project: "",
|
|
55
|
+
// },
|
|
56
|
+
// },
|
|
57
|
+
optimism: {
|
|
58
|
+
chainId: 10,
|
|
59
|
+
url: "https://optimism.easscan.org/graphql",
|
|
60
|
+
contracts: {
|
|
61
|
+
eas: "0x4200000000000000000000000000000000000021",
|
|
62
|
+
schema: "0x4200000000000000000000000000000000000020",
|
|
63
|
+
multicall: "0xd2eD366393FDfd243931Fe48e9fb65A192B0018c", //proxy
|
|
64
|
+
},
|
|
65
|
+
schemas: {
|
|
66
|
+
Community: "0x721c17b065dccc5c916e0c2708d0ef50f1810591b76d0402ff6fe5accbd8488f",
|
|
67
|
+
Details: "0x70a3f615f738fc6a4f56100692ada93d947c028b840940d97af7e7d6f0fa0577",
|
|
68
|
+
Grant: "0x12837231f48acbca4e1e7f4416f684f3353bd4d71d4f03a09d29e5ffa6f21a50",
|
|
69
|
+
GrantVerified: "0x13adc8df8a7324b1651e8bcec948b3e2d4fcfa2a88a52136206cb9ea44836e93",
|
|
70
|
+
MemberOf: "0x7fbb8a65924d8ad2ae12356e04b1418043e8361ba3b1b6c917de2e23df3ec81c",
|
|
71
|
+
MilestoneApproved: "0x13adc8df8a7324b1651e8bcec948b3e2d4fcfa2a88a52136206cb9ea44836e93",
|
|
72
|
+
MilestoneCompleted: "0x13adc8df8a7324b1651e8bcec948b3e2d4fcfa2a88a52136206cb9ea44836e93",
|
|
73
|
+
Project: "0x5b873b6e7a16207b526dde366e8164e95bcda2f009272306519667c5e94d2191",
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
"optimism-goerli": {
|
|
77
|
+
chainId: 420,
|
|
78
|
+
url: "https://optimism-goerli-bedrock.easscan.org/graphql",
|
|
79
|
+
contracts: {
|
|
80
|
+
eas: "0x4200000000000000000000000000000000000021",
|
|
81
|
+
schema: "0x4200000000000000000000000000000000000020",
|
|
82
|
+
multicall: "0x5D5a8032b2FA06652804c33F60DcEA00e389B732", //proxy
|
|
83
|
+
},
|
|
84
|
+
schemas: {
|
|
85
|
+
Community: "0xc1aade58410b3fd807c19845181996721248459c5f042284f27d21cec12a38d1",
|
|
86
|
+
// "0x14b016a56b56db47ee2cdda6963a3481374a75e1471dafd85a17e6e5c23d2a11",
|
|
87
|
+
Details: "0xfe590d9582957e10affbabcdc34a201785a1d4f77982d6616b736cce1a91ae43",
|
|
88
|
+
Grant: "0xd6ce374765c355687101ba70b3f8824d555c12716d2bdad71a08ccad1ded3218",
|
|
89
|
+
GrantVerified: "0xf544fbd9721ac50863d32dc0eed5992051e7fb270b38ab2ce062327cc0ae26ea",
|
|
90
|
+
MemberOf: "0x78c811e506849d414a91a56dab91f07f7ed108f0bf27f550796f13e7bb2e2f2d",
|
|
91
|
+
MilestoneApproved: "0xf544fbd9721ac50863d32dc0eed5992051e7fb270b38ab2ce062327cc0ae26ea",
|
|
92
|
+
MilestoneCompleted: "0xf544fbd9721ac50863d32dc0eed5992051e7fb270b38ab2ce062327cc0ae26ea",
|
|
93
|
+
Project: "0xec77990a252b54b17673955c774b9712766de5eecb22ca5aa2c440e0e93257fb",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
// arbitrum: {
|
|
97
|
+
// chainId: 42161,
|
|
98
|
+
// url: "https://arbitrum.easscan.org/graphql",
|
|
99
|
+
// contracts: {
|
|
100
|
+
// eas: "0xbD75f629A22Dc1ceD33dDA0b68c546A1c035c458",
|
|
101
|
+
// schema: "0xA310da9c5B885E7fb3fbA9D66E9Ba6Df512b78eB",
|
|
102
|
+
// multicall:''
|
|
103
|
+
// },
|
|
104
|
+
// schemas: {
|
|
105
|
+
// Grant: "",
|
|
106
|
+
// GrantVerified: "",
|
|
107
|
+
// MemberOf: "",
|
|
108
|
+
// MilestoneApproved: "",
|
|
109
|
+
// MilestoneCompleted: "",
|
|
110
|
+
// Project: "",
|
|
111
|
+
// },
|
|
112
|
+
// },
|
|
113
|
+
sepolia: {
|
|
114
|
+
chainId: 11155111,
|
|
115
|
+
url: "https://sepolia.easscan.org/graphql",
|
|
116
|
+
contracts: {
|
|
117
|
+
eas: "0xC2679fBD37d54388Ce493F1DB75320D236e1815e",
|
|
118
|
+
schema: "0x0a7E2Ff54e76B8E6659aedc9103FB21c038050D0",
|
|
119
|
+
multicall: "0x00Ee8a5082567c3da8f3D34D33ac8D788C4Cd754", // enhanced
|
|
120
|
+
// multicall: "0x04D6BB799f5A8c76882C4372d1FC39Cd0DDA0A4c",// original
|
|
121
|
+
},
|
|
122
|
+
schemas: {
|
|
123
|
+
Community: "0xf3d790c7fdab6c1b1f25ffcc9289e5be2792eb596d2851a4d059c8aae1bc8b2e",
|
|
124
|
+
// "0x1954572e3fe21bf4334afdaf1358ed7098af1ed136e76dc93c2fdc25e83934c1", // original without resolver
|
|
125
|
+
Details: "0x2c270e35bfcdc4d611f0e9d3d2ab6924ec6c673505abc22a1dd07e19b67211af",
|
|
126
|
+
Grant: "0x09697aeeb3ae71de1cc19e388fd74264f11af5fba3016094764553ac341fdc72",
|
|
127
|
+
GrantVerified: "0x0be8952e2dd74ffd63a02f4d55b20b603fe7a60130cb9d70de31feb9c52fdd37",
|
|
128
|
+
MemberOf: "0xdd87b3500457931252424f4439365534ba72a367503a8805ff3482353fb90301",
|
|
129
|
+
MilestoneApproved: "0xcdef0e492d2e7ad25d0b0fdb868f6dcd1f5e5c30e42fd5fa0debdc12f7618322",
|
|
130
|
+
MilestoneCompleted: "0xcdef0e492d2e7ad25d0b0fdb868f6dcd1f5e5c30e42fd5fa0debdc12f7618322",
|
|
131
|
+
Project: "0xec77990a252b54b17673955c774b9712766de5eecb22ca5aa2c440e0e93257fb",
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
const DetailsSchema = [{ type: "string", name: "json", value: null }];
|
|
136
|
+
/**
|
|
137
|
+
* Mounts the schemas for the given network and return all the settings
|
|
138
|
+
* @param network
|
|
139
|
+
* @returns
|
|
140
|
+
*/
|
|
141
|
+
const MountEntities = (network) => ({
|
|
142
|
+
Community: {
|
|
143
|
+
name: "Community",
|
|
144
|
+
schema: [{ type: "bool", name: "community", value: true }],
|
|
145
|
+
uid: network.schemas.Community,
|
|
146
|
+
},
|
|
147
|
+
CommunityDetails: {
|
|
148
|
+
name: "CommunityDetails",
|
|
149
|
+
schema: DetailsSchema,
|
|
150
|
+
uid: network.schemas.Details,
|
|
151
|
+
references: "Community",
|
|
152
|
+
},
|
|
153
|
+
Project: {
|
|
154
|
+
name: "Project",
|
|
155
|
+
schema: [{ type: "bool", name: "project", value: true }],
|
|
156
|
+
uid: network.schemas.Project,
|
|
157
|
+
},
|
|
158
|
+
ProjectDetails: {
|
|
159
|
+
name: "ProjectDetails",
|
|
160
|
+
schema: DetailsSchema,
|
|
161
|
+
uid: network.schemas.Details,
|
|
162
|
+
references: "Project",
|
|
163
|
+
},
|
|
164
|
+
MemberOf: {
|
|
165
|
+
name: "MemberOf",
|
|
166
|
+
schema: [{ type: "bool", name: "memberOf", value: true }],
|
|
167
|
+
uid: network.schemas.MemberOf,
|
|
168
|
+
references: "Project",
|
|
169
|
+
},
|
|
170
|
+
MemberDetails: {
|
|
171
|
+
name: "MemberDetails",
|
|
172
|
+
schema: DetailsSchema,
|
|
173
|
+
uid: network.schemas.Details,
|
|
174
|
+
references: "MemberOf",
|
|
175
|
+
},
|
|
176
|
+
Grant: {
|
|
177
|
+
name: "Grant",
|
|
178
|
+
schema: [{ type: "bytes32", name: "communityUID", value: true }],
|
|
179
|
+
// schema: [{ type: "bool", name: "grant", value: true }],
|
|
180
|
+
uid: network.schemas.Grant,
|
|
181
|
+
references: "Project",
|
|
182
|
+
},
|
|
183
|
+
GrantDetails: {
|
|
184
|
+
name: "GrantDetails",
|
|
185
|
+
schema: DetailsSchema,
|
|
186
|
+
uid: network.schemas.Details,
|
|
187
|
+
references: "Grant",
|
|
188
|
+
},
|
|
189
|
+
GrantVerified: {
|
|
190
|
+
name: "GrantVerified",
|
|
191
|
+
schema: [
|
|
192
|
+
{ type: "string", name: "type", value: null },
|
|
193
|
+
{ type: "string", name: "reason", value: "" },
|
|
194
|
+
],
|
|
195
|
+
uid: network.schemas.GrantVerified,
|
|
196
|
+
references: "Grant",
|
|
197
|
+
},
|
|
198
|
+
Milestone: {
|
|
199
|
+
name: "Milestone",
|
|
200
|
+
schema: DetailsSchema,
|
|
201
|
+
uid: network.schemas.Details,
|
|
202
|
+
references: "Grant",
|
|
203
|
+
},
|
|
204
|
+
MilestoneApproved: {
|
|
205
|
+
name: "MilestoneApproved",
|
|
206
|
+
schema: [
|
|
207
|
+
{ type: "string", name: "type", value: null },
|
|
208
|
+
{ type: "string", name: "reason", value: "" },
|
|
209
|
+
],
|
|
210
|
+
uid: network.schemas.MilestoneApproved,
|
|
211
|
+
references: "Milestone",
|
|
212
|
+
},
|
|
213
|
+
MilestoneCompleted: {
|
|
214
|
+
name: "MilestoneCompleted",
|
|
215
|
+
schema: [
|
|
216
|
+
{ type: "string", name: "type", value: null },
|
|
217
|
+
{ type: "string", name: "reason", value: "" },
|
|
218
|
+
],
|
|
219
|
+
uid: network.schemas.MilestoneCompleted,
|
|
220
|
+
references: "Milestone",
|
|
221
|
+
},
|
|
222
|
+
Details: {
|
|
223
|
+
schema: DetailsSchema,
|
|
224
|
+
name: " schema",
|
|
225
|
+
uid: network.schemas.Details,
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
exports.MountEntities = MountEntities;
|
package/core/index.d.ts
ADDED
package/core/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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("./consts"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
__exportStar(require("./utils"), exports);
|
|
20
|
+
__exportStar(require("./class/GAP"), exports);
|
|
21
|
+
__exportStar(require("./class/GapSchema"), exports);
|
|
22
|
+
__exportStar(require("./class/types/attestations"), exports);
|
|
23
|
+
__exportStar(require("./class/entities"), exports);
|
package/core/types.d.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { BytesLike } from "ethers";
|
|
2
|
+
import { AttestationRequestData, EAS, MultiAttestationRequest, SchemaItem } from "@ethereum-attestation-service/eas-sdk";
|
|
3
|
+
import { SignerOrProvider as EASSigner } from "@ethereum-attestation-service/eas-sdk/dist/transaction";
|
|
4
|
+
import { Attestation } from "./class";
|
|
5
|
+
import { Fetcher } from "./class/Fetcher";
|
|
6
|
+
export type Hex = `0x${string}`;
|
|
7
|
+
export type SignerOrProvider = EASSigner & {
|
|
8
|
+
address?: Hex;
|
|
9
|
+
_address?: Hex;
|
|
10
|
+
getAddress?: () => Promise<Hex>;
|
|
11
|
+
};
|
|
12
|
+
export interface SchemaInterface<T extends string = string> {
|
|
13
|
+
name: string;
|
|
14
|
+
schema: SchemaItem[];
|
|
15
|
+
references?: T;
|
|
16
|
+
uid: Hex;
|
|
17
|
+
revocable?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface MultiRevokeArgs {
|
|
20
|
+
uid: Hex;
|
|
21
|
+
schemaId: Hex;
|
|
22
|
+
}
|
|
23
|
+
export interface AttestArgs<T = unknown> {
|
|
24
|
+
to: Hex;
|
|
25
|
+
data: T;
|
|
26
|
+
refUID?: Hex;
|
|
27
|
+
signer: SignerOrProvider;
|
|
28
|
+
}
|
|
29
|
+
export type TSchemaName = "Community" | "CommunityDetails" | "Grant" | "GrantDetails" | "GrantVerified" | "MemberOf" | "MemberDetails" | "Milestone" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "ProjectDetails" | "Details";
|
|
30
|
+
export type TResolvedSchemaNames = "Community" | "Grant" | "GrantVerified" | "MemberOf" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "Details";
|
|
31
|
+
export type TExternalLink = "twitter" | "github" | "website" | "linkedin" | "discord";
|
|
32
|
+
export type TNetwork = "optimism" | "optimism-goerli" | "sepolia";
|
|
33
|
+
/**
|
|
34
|
+
* Generic GAP Facade interface.
|
|
35
|
+
* This supplies the GAP class with the necessary properties.
|
|
36
|
+
*/
|
|
37
|
+
export declare abstract class Facade {
|
|
38
|
+
abstract readonly network: TNetwork;
|
|
39
|
+
abstract readonly schemas: SchemaInterface[];
|
|
40
|
+
abstract readonly fetch: Fetcher;
|
|
41
|
+
protected static _eas: EAS;
|
|
42
|
+
static get eas(): EAS;
|
|
43
|
+
}
|
|
44
|
+
export interface RawAttestationPayload {
|
|
45
|
+
schema: Hex;
|
|
46
|
+
data: {
|
|
47
|
+
payload: AttestationRequestData;
|
|
48
|
+
raw: AttestationRequestData;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export interface RawMultiAttestPayload {
|
|
52
|
+
payload: MultiAttestData;
|
|
53
|
+
raw: MultiAttestData;
|
|
54
|
+
}
|
|
55
|
+
export interface MultiAttestData {
|
|
56
|
+
uid?: Hex;
|
|
57
|
+
multiRequest: MultiAttestationRequest;
|
|
58
|
+
refIdx: number;
|
|
59
|
+
}
|
|
60
|
+
export type MultiAttestPayload = [Attestation, RawMultiAttestPayload][];
|
|
61
|
+
export interface EASNetworkConfig {
|
|
62
|
+
url: string;
|
|
63
|
+
chainId: number;
|
|
64
|
+
contracts: {
|
|
65
|
+
eas: Hex;
|
|
66
|
+
schema: Hex;
|
|
67
|
+
multicall: Hex;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* A tuple containing the schema name and it's UID for that network
|
|
71
|
+
*/
|
|
72
|
+
schemas: Record<TResolvedSchemaNames, Hex>;
|
|
73
|
+
}
|
|
74
|
+
export type IGapSchema = SchemaInterface<TSchemaName>;
|
|
75
|
+
export type JSONStr = string;
|
|
76
|
+
export interface Schemata {
|
|
77
|
+
uid: Hex;
|
|
78
|
+
schema: string;
|
|
79
|
+
}
|
|
80
|
+
export interface SchemataRes {
|
|
81
|
+
schemata: Schemata[];
|
|
82
|
+
}
|
|
83
|
+
export interface IAttestation {
|
|
84
|
+
uid: Hex;
|
|
85
|
+
attester: Hex;
|
|
86
|
+
data: BytesLike;
|
|
87
|
+
decodedDataJson: JSONStr;
|
|
88
|
+
recipient: Hex;
|
|
89
|
+
revoked: boolean;
|
|
90
|
+
createdAt: number;
|
|
91
|
+
refUID?: Hex;
|
|
92
|
+
isOffchain: boolean;
|
|
93
|
+
revocable: boolean;
|
|
94
|
+
revocationTime?: number;
|
|
95
|
+
schemaId: Hex;
|
|
96
|
+
}
|
|
97
|
+
export interface AttestationRes {
|
|
98
|
+
attestation: IAttestation;
|
|
99
|
+
}
|
|
100
|
+
export interface AttestationsRes {
|
|
101
|
+
attestations: IAttestation[];
|
|
102
|
+
}
|
|
103
|
+
export interface SchemaRes {
|
|
104
|
+
schema: {
|
|
105
|
+
attestations: IAttestation[];
|
|
106
|
+
};
|
|
107
|
+
}
|