@show-karma/karma-gap-sdk 0.4.15 → 0.4.16
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/.cursorrules +43 -0
- package/core/abi/AirdropNFT.json +1 -1
- package/core/abi/Allo.json +860 -860
- package/core/abi/AlloRegistry.json +578 -578
- package/core/abi/CommunityResolverABI.json +506 -506
- package/core/abi/Donations.json +251 -251
- package/core/abi/EAS.json +1 -1
- package/core/abi/MultiAttester.json +746 -746
- package/core/abi/ProjectResolver.json +574 -574
- package/core/abi/SchemaRegistry.json +1 -1
- package/core/abi/index.ts +21 -0
- package/core/class/AllGapSchemas.ts +21 -0
- package/core/class/Attestation.ts +429 -0
- package/core/class/Fetcher.ts +224 -0
- package/core/class/GAP.ts +481 -0
- package/core/class/GapSchema.ts +93 -0
- package/core/class/Gelato/{Gelato.js → Gelato.ts} +23 -0
- package/core/class/GrantProgramRegistry/Allo.ts +188 -0
- package/core/class/GrantProgramRegistry/AlloRegistry.ts +101 -0
- package/core/class/GraphQL/AxiosGQL.ts +29 -0
- package/core/class/GraphQL/EASClient.ts +34 -0
- package/core/class/GraphQL/GapEasClient.ts +869 -0
- package/core/class/Schema.ts +659 -0
- package/core/class/SchemaError.ts +42 -0
- package/core/class/contract/GapContract.ts +457 -0
- package/core/class/entities/Community.ts +148 -0
- package/core/class/entities/ContributorProfile.ts +108 -0
- package/core/class/entities/Grant.ts +321 -0
- package/core/class/entities/GrantUpdate.ts +187 -0
- package/core/class/entities/MemberOf.ts +52 -0
- package/core/class/entities/Milestone.ts +898 -0
- package/core/class/entities/Project.ts +672 -0
- package/core/class/entities/ProjectImpact.ts +170 -0
- package/core/class/entities/ProjectMilestone.ts +254 -0
- package/core/class/entities/ProjectPointer.ts +39 -0
- package/core/class/entities/ProjectUpdate.ts +176 -0
- package/core/class/entities/Track.ts +32 -0
- package/core/class/karma-indexer/GapIndexerClient.ts +383 -0
- package/core/class/karma-indexer/api/GapIndexerApi.ts +446 -0
- package/core/class/karma-indexer/api/types.ts +313 -0
- package/core/class/remote-storage/IpfsStorage.ts +76 -0
- package/core/class/remote-storage/RemoteStorage.ts +65 -0
- package/core/class/types/allo.ts +93 -0
- package/core/class/types/attestations.ts +223 -0
- package/core/consts.ts +775 -0
- package/core/scripts/create-grant.ts +102 -0
- package/core/scripts/create-program.ts +43 -0
- package/core/scripts/create-schemas.ts +65 -0
- package/core/scripts/deploy.ts +65 -0
- package/core/scripts/index.ts +1 -0
- package/core/scripts/milestone-multi-grants.ts +125 -0
- package/core/shared/types.ts +13 -0
- package/core/types.ts +224 -0
- package/core/utils/gelato/send-gelato-txn.ts +114 -0
- package/core/utils/gelato/sponsor-handler.ts +77 -0
- package/core/utils/gelato/watch-gelato-txn.ts +67 -0
- package/core/utils/get-date.ts +3 -0
- package/core/utils/get-ipfs-data.ts +13 -0
- package/core/utils/get-web3-provider.ts +18 -0
- package/core/utils/gql-queries.ts +133 -0
- package/core/utils/map-filter.ts +21 -0
- package/core/utils/serialize-bigint.ts +7 -0
- package/core/utils/to-unix.ts +18 -0
- package/create-community-example.ts +119 -0
- package/csv-upload/README.md +74 -0
- package/csv-upload/config.ts +41 -0
- package/csv-upload/example.csv +2 -0
- package/csv-upload/keys.example.json +8 -0
- package/csv-upload/scripts/run.ts +417 -0
- package/csv-upload/types.ts +39 -0
- package/docs/.gitkeep +0 -0
- package/docs/images/attestation-architecture.png +0 -0
- package/docs/images/dfd-get-projects.png +0 -0
- package/gap-schema.yaml +155 -0
- package/milestone-workflow-example.ts +353 -0
- package/package.json +45 -39
- package/readme.md +872 -0
- package/schemas/.gitkeep +0 -0
- package/schemas/GAP-schemas-1692135812877.json +33 -0
- package/test-file-indexer-api.ts +25 -0
- package/tsconfig.json +26 -0
- package/core/abi/index.d.ts +0 -1114
- package/core/abi/index.js +0 -26
- package/core/class/AllGapSchemas.d.ts +0 -9
- package/core/class/AllGapSchemas.js +0 -19
- package/core/class/Attestation.d.ts +0 -173
- package/core/class/Attestation.js +0 -333
- package/core/class/Fetcher.d.ts +0 -175
- package/core/class/Fetcher.js +0 -13
- package/core/class/GAP.d.ts +0 -254
- package/core/class/GAP.js +0 -289
- package/core/class/GapSchema.d.ts +0 -34
- package/core/class/GapSchema.js +0 -62
- package/core/class/GrantProgramRegistry/Allo.d.ts +0 -17
- package/core/class/GrantProgramRegistry/Allo.js +0 -137
- package/core/class/GrantProgramRegistry/AlloRegistry.d.ts +0 -15
- package/core/class/GrantProgramRegistry/AlloRegistry.js +0 -70
- package/core/class/GraphQL/AxiosGQL.d.ts +0 -6
- package/core/class/GraphQL/AxiosGQL.js +0 -25
- package/core/class/GraphQL/EASClient.d.ts +0 -16
- package/core/class/GraphQL/EASClient.js +0 -26
- package/core/class/GraphQL/GapEasClient.d.ts +0 -71
- package/core/class/GraphQL/GapEasClient.js +0 -451
- package/core/class/GraphQL/index.js +0 -19
- package/core/class/Schema.d.ts +0 -233
- package/core/class/Schema.js +0 -488
- package/core/class/SchemaError.d.ts +0 -30
- package/core/class/SchemaError.js +0 -39
- package/core/class/contract/GapContract.d.ts +0 -102
- package/core/class/contract/GapContract.js +0 -285
- package/core/class/entities/Community.d.ts +0 -34
- package/core/class/entities/Community.js +0 -109
- package/core/class/entities/ContributorProfile.d.ts +0 -41
- package/core/class/entities/ContributorProfile.js +0 -69
- package/core/class/entities/Grant.d.ts +0 -54
- package/core/class/entities/Grant.js +0 -223
- package/core/class/entities/GrantUpdate.d.ts +0 -40
- package/core/class/entities/GrantUpdate.js +0 -114
- package/core/class/entities/MemberOf.d.ts +0 -11
- package/core/class/entities/MemberOf.js +0 -33
- package/core/class/entities/Milestone.d.ts +0 -168
- package/core/class/entities/Milestone.js +0 -657
- package/core/class/entities/Project.d.ts +0 -92
- package/core/class/entities/Project.js +0 -418
- package/core/class/entities/ProjectImpact.d.ts +0 -50
- package/core/class/entities/ProjectImpact.js +0 -112
- package/core/class/entities/ProjectMilestone.d.ts +0 -60
- package/core/class/entities/ProjectMilestone.js +0 -174
- package/core/class/entities/ProjectPointer.d.ts +0 -12
- package/core/class/entities/ProjectPointer.js +0 -22
- package/core/class/entities/ProjectUpdate.d.ts +0 -50
- package/core/class/entities/ProjectUpdate.js +0 -110
- package/core/class/entities/Track.d.ts +0 -16
- package/core/class/entities/Track.js +0 -21
- package/core/class/entities/index.js +0 -26
- package/core/class/index.js +0 -26
- package/core/class/karma-indexer/GapIndexerClient.d.ts +0 -66
- package/core/class/karma-indexer/GapIndexerClient.js +0 -207
- package/core/class/karma-indexer/api/GapIndexerApi.d.ts +0 -73
- package/core/class/karma-indexer/api/GapIndexerApi.js +0 -256
- package/core/class/karma-indexer/api/types.d.ts +0 -295
- package/core/class/karma-indexer/api/types.js +0 -2
- package/core/class/remote-storage/IpfsStorage.d.ts +0 -23
- package/core/class/remote-storage/IpfsStorage.js +0 -56
- package/core/class/remote-storage/RemoteStorage.d.ts +0 -41
- package/core/class/remote-storage/RemoteStorage.js +0 -38
- package/core/class/types/allo.d.ts +0 -78
- package/core/class/types/allo.js +0 -2
- package/core/class/types/attestations.d.ts +0 -168
- package/core/class/types/attestations.js +0 -66
- package/core/consts.d.ts +0 -48
- package/core/consts.js +0 -641
- package/core/index.js +0 -24
- package/core/shared/types.d.ts +0 -6
- package/core/shared/types.js +0 -2
- package/core/types.d.ts +0 -131
- package/core/types.js +0 -13
- package/core/utils/gelato/index.js +0 -19
- package/core/utils/gelato/send-gelato-txn.d.ts +0 -55
- package/core/utils/gelato/send-gelato-txn.js +0 -100
- package/core/utils/gelato/sponsor-handler.d.ts +0 -9
- package/core/utils/gelato/sponsor-handler.js +0 -60
- package/core/utils/gelato/watch-gelato-txn.d.ts +0 -7
- package/core/utils/gelato/watch-gelato-txn.js +0 -63
- package/core/utils/get-date.d.ts +0 -1
- package/core/utils/get-date.js +0 -7
- package/core/utils/get-ipfs-data.d.ts +0 -1
- package/core/utils/get-ipfs-data.js +0 -20
- package/core/utils/get-web3-provider.d.ts +0 -2
- package/core/utils/get-web3-provider.js +0 -18
- package/core/utils/gql-queries.d.ts +0 -12
- package/core/utils/gql-queries.js +0 -90
- package/core/utils/index.js +0 -23
- package/core/utils/map-filter.d.ts +0 -8
- package/core/utils/map-filter.js +0 -20
- package/core/utils/serialize-bigint.d.ts +0 -1
- package/core/utils/serialize-bigint.js +0 -8
- package/core/utils/to-unix.d.ts +0 -1
- package/core/utils/to-unix.js +0 -25
- package/index.js +0 -17
- /package/core/class/GraphQL/{index.d.ts → index.ts} +0 -0
- /package/core/class/entities/{index.d.ts → index.ts} +0 -0
- /package/core/class/{index.d.ts → index.ts} +0 -0
- /package/core/{index.d.ts → index.ts} +0 -0
- /package/core/utils/gelato/{index.d.ts → index.ts} +0 -0
- /package/core/utils/{index.d.ts → index.ts} +0 -0
- /package/{core/class/Gelato/Gelato.d.ts → csv-upload/.gitkeep} +0 -0
- /package/{index.d.ts → index.ts} +0 -0
package/core/class/Fetcher.d.ts
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
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
|
-
export declare abstract class Fetcher extends AxiosGQL {
|
|
8
|
-
protected gap: GAP;
|
|
9
|
-
constructor(url: string);
|
|
10
|
-
set gapInstance(gap: GAP);
|
|
11
|
-
/**
|
|
12
|
-
* Fetch a single attestation by its UID.
|
|
13
|
-
* @param uid
|
|
14
|
-
*/
|
|
15
|
-
abstract attestation<T = unknown>(uid: Hex): Promise<Attestation<T>>;
|
|
16
|
-
/**
|
|
17
|
-
* Fetch attestations of a schema.
|
|
18
|
-
* @param schemaName
|
|
19
|
-
* @param search if set, will search decodedDataJson by the value.
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
abstract attestations(schemaName: TSchemaName, search?: string): Promise<IAttestation[]>;
|
|
23
|
-
/**
|
|
24
|
-
* Fetch attestations of a schema.
|
|
25
|
-
* @param schemaName
|
|
26
|
-
* @param recipient
|
|
27
|
-
* @returns
|
|
28
|
-
*/
|
|
29
|
-
abstract attestationsOf(schemaName: TSchemaName, recipient: Hex): Promise<IAttestation[]>;
|
|
30
|
-
/**
|
|
31
|
-
* Fetch attestations of a schema for a specific recipient.
|
|
32
|
-
* @param schemaName
|
|
33
|
-
* @param recipient
|
|
34
|
-
* @returns
|
|
35
|
-
*/
|
|
36
|
-
abstract attestationsTo(schemaName: TSchemaName, recipient: Hex): Promise<IAttestation[]>;
|
|
37
|
-
/**
|
|
38
|
-
* Fetch all available communities with details and grantees uids.
|
|
39
|
-
*
|
|
40
|
-
* If search is defined, will try to find communities by the search string.
|
|
41
|
-
* @param search
|
|
42
|
-
* @returns
|
|
43
|
-
*/
|
|
44
|
-
abstract communities(search?: string): Promise<Community[]>;
|
|
45
|
-
/**
|
|
46
|
-
* Fetch all available communities with details for a grantee;
|
|
47
|
-
*
|
|
48
|
-
* If search is defined, will try to find communities by the search string.
|
|
49
|
-
* @param address grantee address
|
|
50
|
-
* @param withGrants if true, will get community grants.
|
|
51
|
-
* @returns
|
|
52
|
-
*/
|
|
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[]>;
|
|
63
|
-
/**
|
|
64
|
-
* Fetch a set of communities by their ids.
|
|
65
|
-
* @param uids
|
|
66
|
-
* @returns
|
|
67
|
-
*/
|
|
68
|
-
abstract communitiesByIds(uids: Hex[]): Promise<Community[]>;
|
|
69
|
-
/**
|
|
70
|
-
* Fetch a community by its name with details, grants and milestones.
|
|
71
|
-
*
|
|
72
|
-
* It is possible that the resulted community is not the one you are looking for.
|
|
73
|
-
* @param name
|
|
74
|
-
* @returns
|
|
75
|
-
*/
|
|
76
|
-
abstract communityBySlug(slug: string): Promise<Community>;
|
|
77
|
-
/**
|
|
78
|
-
* Fetch a community by its id. This method will also return the
|
|
79
|
-
* community details and projects.
|
|
80
|
-
*/
|
|
81
|
-
abstract communityById(uid: Hex): Promise<Community>;
|
|
82
|
-
/**
|
|
83
|
-
* Fetch a project by its id.
|
|
84
|
-
* @param uid
|
|
85
|
-
* @returns
|
|
86
|
-
*/
|
|
87
|
-
abstract projectById(uid: Hex): Promise<Project>;
|
|
88
|
-
/**
|
|
89
|
-
* Fetch a project by its slug.
|
|
90
|
-
* @param slug
|
|
91
|
-
* @returns
|
|
92
|
-
*/
|
|
93
|
-
abstract projectBySlug(slug: string): Promise<Project>;
|
|
94
|
-
/**
|
|
95
|
-
* Search projects and communities by name. This method will return a list of projects and a list of communities
|
|
96
|
-
* __Must be implemented by the indexer__
|
|
97
|
-
* @param query
|
|
98
|
-
*/
|
|
99
|
-
abstract search(query: string): Promise<{
|
|
100
|
-
projects: Project[];
|
|
101
|
-
communities: Community[];
|
|
102
|
-
}>;
|
|
103
|
-
/**
|
|
104
|
-
* Search projects by name. This method will return a list of projects
|
|
105
|
-
* __Must be implemented by the indexer__
|
|
106
|
-
* @param query
|
|
107
|
-
*/
|
|
108
|
-
abstract searchProjects(query: string): Promise<Project[]>;
|
|
109
|
-
/**
|
|
110
|
-
* Fetch projects with details and members.
|
|
111
|
-
* @param name if set, will search by the name.
|
|
112
|
-
* @returns
|
|
113
|
-
*/
|
|
114
|
-
abstract projects(name?: string): Promise<Project[]>;
|
|
115
|
-
/**
|
|
116
|
-
* Fetch projects with details and members.
|
|
117
|
-
* @param grantee the public address of the grantee
|
|
118
|
-
* @returns
|
|
119
|
-
*/
|
|
120
|
-
abstract projectsOf(grantee: Hex): Promise<Project[]>;
|
|
121
|
-
/**
|
|
122
|
-
* Fetch Grantee with details and projects.
|
|
123
|
-
* @param address
|
|
124
|
-
* @param withProjects if true, will get grantee project details.
|
|
125
|
-
* @returns
|
|
126
|
-
*/
|
|
127
|
-
abstract grantee(address: Hex): Promise<Grantee>;
|
|
128
|
-
/**
|
|
129
|
-
* Fetch all Grantees with details.
|
|
130
|
-
* @returns
|
|
131
|
-
*/
|
|
132
|
-
abstract grantees(): Promise<Grantee[]>;
|
|
133
|
-
/**
|
|
134
|
-
* Fetches the grantes related to a grantee address (recipient).
|
|
135
|
-
* @param grantee grantee address
|
|
136
|
-
* @returns
|
|
137
|
-
*/
|
|
138
|
-
abstract grantsOf(grantee: Hex, withCommunity?: boolean): Promise<Grant[]>;
|
|
139
|
-
/**
|
|
140
|
-
* Fetch grants for an array of projects with milestones.
|
|
141
|
-
* @param projects
|
|
142
|
-
* @returns
|
|
143
|
-
*/
|
|
144
|
-
abstract grantsFor(projects: Project[], withCommunity?: boolean): Promise<Grant[]>;
|
|
145
|
-
/**
|
|
146
|
-
* Fetch a grants that belongs to a community.
|
|
147
|
-
* @param uid community uid
|
|
148
|
-
* @returns
|
|
149
|
-
*/
|
|
150
|
-
abstract grantsByCommunity(uid: Hex, page?: number, pageLimit?: number): any;
|
|
151
|
-
/**
|
|
152
|
-
* Fetch all milestones related to an array of Grants.
|
|
153
|
-
* @param grants
|
|
154
|
-
* @returns
|
|
155
|
-
*/
|
|
156
|
-
abstract milestonesOf(grants: Grant[]): Promise<Milestone[]>;
|
|
157
|
-
/**
|
|
158
|
-
* Bulk fetch members with details of an array of Projects.
|
|
159
|
-
* @param projects
|
|
160
|
-
* @returns
|
|
161
|
-
*/
|
|
162
|
-
abstract membersOf(projects: Project[]): Promise<MemberOf[]>;
|
|
163
|
-
/**
|
|
164
|
-
* Check if a name is already in use.
|
|
165
|
-
* @param slug
|
|
166
|
-
* @returns
|
|
167
|
-
*/
|
|
168
|
-
abstract slugExists(slug: string): Promise<boolean>;
|
|
169
|
-
/**
|
|
170
|
-
* Get grants for a project by an external uid
|
|
171
|
-
* > Works only for the indexed projects
|
|
172
|
-
* @param projectExtId
|
|
173
|
-
*/
|
|
174
|
-
abstract grantsForExtProject(projectExtId: string): Promise<Grant[]>;
|
|
175
|
-
}
|
package/core/class/Fetcher.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Fetcher = void 0;
|
|
4
|
-
const AxiosGQL_1 = require("./GraphQL/AxiosGQL");
|
|
5
|
-
class Fetcher extends AxiosGQL_1.AxiosGQL {
|
|
6
|
-
constructor(url) {
|
|
7
|
-
super(url);
|
|
8
|
-
}
|
|
9
|
-
set gapInstance(gap) {
|
|
10
|
-
this.gap = gap;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.Fetcher = Fetcher;
|
package/core/class/GAP.d.ts
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { ethers } from "ethers";
|
|
2
|
-
import { AttestArgs, Facade, SchemaInterface, SignerOrProvider, TNetwork, TSchemaName } from "../types";
|
|
3
|
-
import { Fetcher } from "./Fetcher";
|
|
4
|
-
import { GapSchema } from "./GapSchema";
|
|
5
|
-
import { RemoteStorage } from "./remote-storage/RemoteStorage";
|
|
6
|
-
interface GAPArgs {
|
|
7
|
-
network: TNetwork;
|
|
8
|
-
globalSchemas?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Custom API Client to be used to fetch attestation data.
|
|
11
|
-
* If not defined, will use the default EAS Client and rely on EAS's GraphQL API.
|
|
12
|
-
*/
|
|
13
|
-
apiClient?: Fetcher;
|
|
14
|
-
schemas?: SchemaInterface<TSchemaName>[];
|
|
15
|
-
/**
|
|
16
|
-
* Defined if the transactions will be gasless or not.
|
|
17
|
-
*
|
|
18
|
-
* In case of true, the transactions will be sent through [Gelato](https://gelato.network)
|
|
19
|
-
* and an API key is needed.
|
|
20
|
-
*
|
|
21
|
-
* > __Note that to safely transact through Gelato, the user must
|
|
22
|
-
* have set a handlerUrl and not expose gelato api in the frontend.__
|
|
23
|
-
*/
|
|
24
|
-
gelatoOpts?: {
|
|
25
|
-
/**
|
|
26
|
-
* Endpoint in which the transaction will be sent.
|
|
27
|
-
* A custom endpoint will ensure that the transaction will be sent through Gelato
|
|
28
|
-
* and api keys won't be exposed in the frontend.
|
|
29
|
-
*
|
|
30
|
-
* __If coding a backend, you can use `apiKey` prop instead.__
|
|
31
|
-
*
|
|
32
|
-
* `core/utils/gelato/sponsor-handler.ts` is a base handler that can be used
|
|
33
|
-
* together with NextJS API routes.
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
*
|
|
37
|
-
* ```ts
|
|
38
|
-
* // pages/api/gelato.ts
|
|
39
|
-
* import { handler as sponsorHandler } from "core/utils/gelato/sponsor-handler";
|
|
40
|
-
*
|
|
41
|
-
* export default const handler(req, res) => sponsorHandler(req, res, "GELATO_API_KEY_ENV_VARIABLE");
|
|
42
|
-
*
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
sponsorUrl?: string;
|
|
46
|
-
/**
|
|
47
|
-
* If true, env_gelatoApiKey will be marked as required.
|
|
48
|
-
* This means that the endpoint at sponsorUrl is contained in this application.
|
|
49
|
-
*
|
|
50
|
-
* E.g. Next.JS api route.
|
|
51
|
-
*/
|
|
52
|
-
contained?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* The env key of gelato api key that will be used in the handler.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
*
|
|
58
|
-
* ```
|
|
59
|
-
* // .env
|
|
60
|
-
* GELATO_API_KEY=1234567890
|
|
61
|
-
*
|
|
62
|
-
* // sponsor-handler.ts
|
|
63
|
-
*
|
|
64
|
-
* export async function handler(req, res) {
|
|
65
|
-
* // ...code
|
|
66
|
-
*
|
|
67
|
-
* const { env_gelatoApiKey } = GAP.gelatoOpts;
|
|
68
|
-
*
|
|
69
|
-
* // Will be used to get the key from environment.
|
|
70
|
-
* const { [env_gelatoApiKey]: apiKey } = process.env;
|
|
71
|
-
*
|
|
72
|
-
* // send txn
|
|
73
|
-
* // res.send(result);
|
|
74
|
-
* }
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
env_gelatoApiKey?: string;
|
|
78
|
-
/**
|
|
79
|
-
* API key to be used in the handler.
|
|
80
|
-
*
|
|
81
|
-
* @deprecated Use this only if you have no option of setting a backend, next/nuxt api route
|
|
82
|
-
* or if this application is a backend.
|
|
83
|
-
*
|
|
84
|
-
* > __This will expose the api key if used in the frontend.__
|
|
85
|
-
*/
|
|
86
|
-
apiKey?: string;
|
|
87
|
-
/**
|
|
88
|
-
* If true, will use gelato to send transactions.
|
|
89
|
-
*/
|
|
90
|
-
useGasless?: boolean;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Defines a remote storage client to be used to store data.
|
|
94
|
-
* If defined, all the details data from an attestation will
|
|
95
|
-
* be stored in the remote storage, e.g. IPFS.
|
|
96
|
-
*/
|
|
97
|
-
remoteStorage?: RemoteStorage;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* GAP SDK Facade.
|
|
101
|
-
*
|
|
102
|
-
* This is the main class that is used to interact with the GAP SDK.
|
|
103
|
-
*
|
|
104
|
-
* This class implements the singleton pattern to ensure only one instance exists
|
|
105
|
-
* throughout the application lifecycle.
|
|
106
|
-
*
|
|
107
|
-
* Using this class, the user will be able to:
|
|
108
|
-
*
|
|
109
|
-
* - Create and manage attestations
|
|
110
|
-
* - Create and manage schemas
|
|
111
|
-
* - Fetch data from the EAS
|
|
112
|
-
*
|
|
113
|
-
* #### Features
|
|
114
|
-
* - EAS Client: used to interact with EAS contracts
|
|
115
|
-
* - EAS Fetcher: used to fetch data from the EAS GraphQL API, providing methods for:
|
|
116
|
-
* - Get projects
|
|
117
|
-
* - Get grants with its details
|
|
118
|
-
* - Get grantees
|
|
119
|
-
* - Get members
|
|
120
|
-
* - Get tags
|
|
121
|
-
* - Get external links
|
|
122
|
-
* - Get schemas
|
|
123
|
-
* - Get attestations by pair, attester, recipient, schema, or UID
|
|
124
|
-
* - Get dependent attestations
|
|
125
|
-
* - Schema: used to create and manage schemas
|
|
126
|
-
* - Attestation: used to create and manage attestations
|
|
127
|
-
* - Replace schemas: used to replace the schema list with a new list
|
|
128
|
-
* - Replace single schema: used to replace a single schema from the schema list
|
|
129
|
-
*
|
|
130
|
-
* ---
|
|
131
|
-
* @example
|
|
132
|
-
* ```ts
|
|
133
|
-
* import { GAP } from "./core/class/GAP";
|
|
134
|
-
* import { GapSchema } from "./core/class/GapSchema";
|
|
135
|
-
* import { Schema } from "./core/class/Schema";
|
|
136
|
-
* import { MountEntities, Networks } from "./core/consts";
|
|
137
|
-
*
|
|
138
|
-
* const schemas = MountEntities(Networks.sepolia);
|
|
139
|
-
*
|
|
140
|
-
* // Initialize the singleton instance
|
|
141
|
-
* const gap = GAP.getInstance({
|
|
142
|
-
* network: "sepolia",
|
|
143
|
-
* owner: "0xd7d1DB401EA825b0325141Cd5e6cd7C2d01825f2",
|
|
144
|
-
* schemas: Object.values(schemas),
|
|
145
|
-
* });
|
|
146
|
-
*
|
|
147
|
-
* // Later in the code, get the same instance
|
|
148
|
-
* const sameGap = GAP.getInstance();
|
|
149
|
-
*
|
|
150
|
-
* gap.fetcher
|
|
151
|
-
* .fetchProjects()
|
|
152
|
-
* .then((res) => {
|
|
153
|
-
* console.log(JSON.stringify(res, null, 2));
|
|
154
|
-
* })
|
|
155
|
-
*
|
|
156
|
-
* ```
|
|
157
|
-
*/
|
|
158
|
-
export declare class GAP extends Facade {
|
|
159
|
-
private static remoteStorage?;
|
|
160
|
-
private static instances;
|
|
161
|
-
readonly fetch: Fetcher;
|
|
162
|
-
readonly network: TNetwork;
|
|
163
|
-
private _schemas;
|
|
164
|
-
private static _gelatoOpts;
|
|
165
|
-
/**
|
|
166
|
-
* Get the singleton instance of GAP for a specific network.
|
|
167
|
-
* If no instance exists for the network, creates one with the provided args.
|
|
168
|
-
* @param args Optional initialization arguments
|
|
169
|
-
* @returns The singleton instance of GAP for the specified network
|
|
170
|
-
*/
|
|
171
|
-
static getInstance(args?: GAPArgs): GAP;
|
|
172
|
-
/**
|
|
173
|
-
* Creates a new instance of GAP.
|
|
174
|
-
* You can either use this constructor directly or use the singleton pattern via getInstance().
|
|
175
|
-
* @param args Initialization arguments
|
|
176
|
-
*/
|
|
177
|
-
constructor(args: GAPArgs);
|
|
178
|
-
private assertGelatoOpts;
|
|
179
|
-
/**
|
|
180
|
-
* Creates the attestation payload using a specific schema.
|
|
181
|
-
* @param from
|
|
182
|
-
* @param to
|
|
183
|
-
* @param data
|
|
184
|
-
* @param schema
|
|
185
|
-
*/
|
|
186
|
-
attest<T>(attestation: AttestArgs<T> & {
|
|
187
|
-
schemaName: TSchemaName;
|
|
188
|
-
}): Promise<import("..").AttestationWithTx>;
|
|
189
|
-
/**
|
|
190
|
-
* Replaces the schema list with a new list.
|
|
191
|
-
* @param schemas
|
|
192
|
-
*/
|
|
193
|
-
replaceSchemas(schemas: GapSchema[]): void;
|
|
194
|
-
/**
|
|
195
|
-
* Replaces a schema from the schema list.
|
|
196
|
-
* @throws {SchemaError} if desired schema name does not exist.
|
|
197
|
-
*/
|
|
198
|
-
replaceSingleSchema(schema: GapSchema): void;
|
|
199
|
-
/**
|
|
200
|
-
* Generates a slug from a text.
|
|
201
|
-
* @param text
|
|
202
|
-
* @returns
|
|
203
|
-
*/
|
|
204
|
-
generateSlug: (text: string) => Promise<string>;
|
|
205
|
-
/**
|
|
206
|
-
* Returns a copy of the original schema with no pointers.
|
|
207
|
-
* @param name
|
|
208
|
-
* @returns
|
|
209
|
-
*/
|
|
210
|
-
findSchema(name: TSchemaName): GapSchema;
|
|
211
|
-
/**
|
|
212
|
-
* Find many schemas by name and return their copies as an array in the same order.
|
|
213
|
-
* @param names
|
|
214
|
-
* @returns
|
|
215
|
-
*/
|
|
216
|
-
findManySchemas(names: TSchemaName[]): GapSchema[];
|
|
217
|
-
/**
|
|
218
|
-
* Get the multicall contract
|
|
219
|
-
* @param signer
|
|
220
|
-
*/
|
|
221
|
-
static getMulticall(signer: SignerOrProvider): Promise<ethers.Contract>;
|
|
222
|
-
/**
|
|
223
|
-
* Get the multicall contract
|
|
224
|
-
* @param signer
|
|
225
|
-
*/
|
|
226
|
-
static getProjectResolver(signer: SignerOrProvider & {
|
|
227
|
-
getChainId?: () => Promise<number>;
|
|
228
|
-
}, chainId?: number): Promise<ethers.Contract>;
|
|
229
|
-
/**
|
|
230
|
-
* Get the multicall contract
|
|
231
|
-
* @param signer
|
|
232
|
-
*/
|
|
233
|
-
static getCommunityResolver(signer: SignerOrProvider & {
|
|
234
|
-
getChainId?: () => Promise<number>;
|
|
235
|
-
}, chainId?: number): Promise<ethers.Contract>;
|
|
236
|
-
get schemas(): GapSchema[];
|
|
237
|
-
/**
|
|
238
|
-
* Defined if the transactions will be gasless or not.
|
|
239
|
-
*
|
|
240
|
-
* In case of true, the transactions will be sent through [Gelato](https://gelato.network)
|
|
241
|
-
* and an API key is needed.
|
|
242
|
-
*/
|
|
243
|
-
private static set gelatoOpts(value);
|
|
244
|
-
/**
|
|
245
|
-
* Defined if the transactions will be gasless or not.
|
|
246
|
-
*
|
|
247
|
-
* In case of true, the transactions will be sent through [Gelato](https://gelato.network)
|
|
248
|
-
* and an API key is needed.
|
|
249
|
-
*/
|
|
250
|
-
static get gelatoOpts(): GAPArgs["gelatoOpts"];
|
|
251
|
-
static set useGasLess(useGasLess: boolean);
|
|
252
|
-
static get remoteClient(): RemoteStorage<unknown>;
|
|
253
|
-
}
|
|
254
|
-
export {};
|