@show-karma/karma-gap-sdk 0.3.40 → 0.3.42
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/Attestation.js +0 -9
- package/core/class/GAP.d.ts +6 -6
- package/core/class/GAP.js +10 -11
- package/core/class/Schema.js +0 -9
- package/core/class/entities/Project.d.ts +6 -0
- package/core/class/entities/Project.js +36 -0
- package/core/class/entities/ProjectPointer.d.ts +12 -0
- package/core/class/entities/ProjectPointer.js +22 -0
- package/core/class/entities/ProjectUpdate.d.ts +36 -0
- package/core/class/entities/ProjectUpdate.js +94 -0
- package/core/class/entities/index.d.ts +2 -0
- package/core/class/entities/index.js +2 -0
- package/core/class/karma-indexer/api/types.d.ts +25 -0
- package/core/class/remote-storage/IpfsStorage.js +1 -1
- package/core/consts.js +32 -2
- package/core/types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -6,7 +6,6 @@ const SchemaError_1 = require("./SchemaError");
|
|
|
6
6
|
const get_date_1 = require("../utils/get-date");
|
|
7
7
|
const consts_1 = require("../consts");
|
|
8
8
|
const GapContract_1 = require("./contract/GapContract");
|
|
9
|
-
const IpfsStorage_1 = require("./remote-storage/IpfsStorage");
|
|
10
9
|
/**
|
|
11
10
|
* Represents the EAS Attestation and provides methods to manage attestations.
|
|
12
11
|
* @example
|
|
@@ -196,18 +195,10 @@ class Attestation {
|
|
|
196
195
|
async payloadFor(refIdx) {
|
|
197
196
|
this.assertPayload();
|
|
198
197
|
if (this.schema.isJsonSchema()) {
|
|
199
|
-
const remoteClient = new IpfsStorage_1.IpfsStorage({
|
|
200
|
-
token: process.env.NEXT_PUBLIC_IPFS_TOKEN,
|
|
201
|
-
});
|
|
202
198
|
if (this.type) {
|
|
203
199
|
this._data.type = this.type;
|
|
204
200
|
this.schema.setValue("json", JSON.stringify(this._data));
|
|
205
201
|
}
|
|
206
|
-
if (remoteClient && JSON.stringify(this._data)?.length > 1500) {
|
|
207
|
-
const cid = await remoteClient.save(this._data);
|
|
208
|
-
const encodedData = remoteClient.encode(cid);
|
|
209
|
-
this.schema.setValue("json", JSON.stringify(encodedData));
|
|
210
|
-
}
|
|
211
202
|
}
|
|
212
203
|
const payload = (encode = true) => ({
|
|
213
204
|
uid: consts_1.nullRef,
|
package/core/class/GAP.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AttestArgs, Facade, SchemaInterface, TNetwork, TSchemaName, SignerOrProvider } from
|
|
2
|
-
import { GapSchema } from
|
|
3
|
-
import { ethers } from
|
|
4
|
-
import { Fetcher } from
|
|
5
|
-
import { RemoteStorage } from
|
|
1
|
+
import { AttestArgs, Facade, SchemaInterface, TNetwork, TSchemaName, SignerOrProvider } from "../types";
|
|
2
|
+
import { GapSchema } from "./GapSchema";
|
|
3
|
+
import { ethers } from "ethers";
|
|
4
|
+
import { Fetcher } from "./Fetcher";
|
|
5
|
+
import { RemoteStorage } from "./remote-storage/RemoteStorage";
|
|
6
6
|
interface GAPArgs {
|
|
7
7
|
network: TNetwork;
|
|
8
8
|
globalSchemas?: boolean;
|
|
@@ -229,7 +229,7 @@ export declare class GAP extends Facade {
|
|
|
229
229
|
* In case of true, the transactions will be sent through [Gelato](https://gelato.network)
|
|
230
230
|
* and an API key is needed.
|
|
231
231
|
*/
|
|
232
|
-
static get gelatoOpts(): GAPArgs[
|
|
232
|
+
static get gelatoOpts(): GAPArgs["gelatoOpts"];
|
|
233
233
|
static set useGasLess(useGasLess: boolean);
|
|
234
234
|
static get remoteClient(): RemoteStorage<unknown>;
|
|
235
235
|
}
|
package/core/class/GAP.js
CHANGED
|
@@ -81,16 +81,15 @@ class GAP extends types_1.Facade {
|
|
|
81
81
|
this.generateSlug = async (text) => {
|
|
82
82
|
let slug = text
|
|
83
83
|
.toLowerCase()
|
|
84
|
-
.replace(/ /g,
|
|
85
|
-
.replace(/[^\w-]+/g,
|
|
84
|
+
.replace(/ /g, "-")
|
|
85
|
+
.replace(/[^\w-]+/g, "");
|
|
86
86
|
const slugExists = await this.fetch.slugExists(slug);
|
|
87
87
|
if (slugExists) {
|
|
88
|
-
const parts = slug.split(
|
|
88
|
+
const parts = slug.split("-");
|
|
89
89
|
const counter = parts.pop();
|
|
90
|
-
slug = /\d+/g.test(counter) ? parts.join(
|
|
90
|
+
slug = /\d+/g.test(counter) ? parts.join("-") : slug;
|
|
91
91
|
// eslint-disable-next-line no-param-reassign
|
|
92
92
|
const nextSlug = `${slug}-${counter && /\d+/g.test(counter) ? +counter + 1 : 1}`;
|
|
93
|
-
console.log({ nextSlug, counter, slug });
|
|
94
93
|
return this.generateSlug(nextSlug);
|
|
95
94
|
}
|
|
96
95
|
return slug.toLowerCase();
|
|
@@ -114,18 +113,18 @@ class GAP extends types_1.Facade {
|
|
|
114
113
|
assertGelatoOpts(args) {
|
|
115
114
|
if (args.gelatoOpts &&
|
|
116
115
|
!(args.gelatoOpts.sponsorUrl || args.gelatoOpts.apiKey)) {
|
|
117
|
-
throw new Error(
|
|
116
|
+
throw new Error("You must provide a `sponsorUrl` or an `apiKey`.");
|
|
118
117
|
}
|
|
119
118
|
if (args.gelatoOpts?.sponsorUrl &&
|
|
120
119
|
args.gelatoOpts?.contained &&
|
|
121
120
|
!args.gelatoOpts.env_gelatoApiKey) {
|
|
122
|
-
throw new Error(
|
|
121
|
+
throw new Error("You must provide `env_gelatoApiKey` to be able to use it in a backend handler.");
|
|
123
122
|
}
|
|
124
123
|
if ((args.gelatoOpts?.env_gelatoApiKey ||
|
|
125
124
|
args.gelatoOpts?.apiKey ||
|
|
126
125
|
args.gelatoOpts?.sponsorUrl) &&
|
|
127
126
|
!args.gelatoOpts?.useGasless) {
|
|
128
|
-
console.warn(
|
|
127
|
+
console.warn("GAP::You are using gelatoOpts but not setting useGasless to true. This will send transactions through the normal provider.");
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
130
|
/**
|
|
@@ -219,11 +218,11 @@ class GAP extends types_1.Facade {
|
|
|
219
218
|
* and an API key is needed.
|
|
220
219
|
*/
|
|
221
220
|
static set gelatoOpts(gelatoOpts) {
|
|
222
|
-
if (typeof this._gelatoOpts ===
|
|
221
|
+
if (typeof this._gelatoOpts === "undefined") {
|
|
223
222
|
this._gelatoOpts = gelatoOpts;
|
|
224
223
|
}
|
|
225
224
|
else {
|
|
226
|
-
throw new Error(
|
|
225
|
+
throw new Error("Cannot change a readonly value gelatoOpts.");
|
|
227
226
|
}
|
|
228
227
|
}
|
|
229
228
|
/**
|
|
@@ -240,7 +239,7 @@ class GAP extends types_1.Facade {
|
|
|
240
239
|
!this._gelatoOpts?.apiKey &&
|
|
241
240
|
!this._gelatoOpts?.sponsorUrl &&
|
|
242
241
|
!this._gelatoOpts?.env_gelatoApiKey) {
|
|
243
|
-
throw new Error(
|
|
242
|
+
throw new Error("You must provide a `sponsorUrl` or an `apiKey` before using gasless transactions.");
|
|
244
243
|
}
|
|
245
244
|
this._gelatoOpts.useGasless = useGasLess;
|
|
246
245
|
}
|
package/core/class/Schema.js
CHANGED
|
@@ -6,7 +6,6 @@ const SchemaError_1 = require("./SchemaError");
|
|
|
6
6
|
const consts_1 = require("../consts");
|
|
7
7
|
const GapContract_1 = require("./contract/GapContract");
|
|
8
8
|
const ethers_1 = require("ethers");
|
|
9
|
-
const IpfsStorage_1 = require("./remote-storage/IpfsStorage");
|
|
10
9
|
/**
|
|
11
10
|
* Represents the EAS Schema and provides methods to encode and decode the schema,
|
|
12
11
|
* and validate the schema references.
|
|
@@ -224,14 +223,6 @@ class Schema {
|
|
|
224
223
|
if (this.references && !refUID)
|
|
225
224
|
throw new SchemaError_1.AttestationError("INVALID_REFERENCE", "Attestation schema references another schema but no reference UID was provided.");
|
|
226
225
|
if (this.isJsonSchema()) {
|
|
227
|
-
const remoteClient = new IpfsStorage_1.IpfsStorage({
|
|
228
|
-
token: process.env.NEXT_PUBLIC_IPFS_TOKEN,
|
|
229
|
-
});
|
|
230
|
-
if (remoteClient) {
|
|
231
|
-
const cid = await remoteClient.save(data);
|
|
232
|
-
const encodedData = remoteClient.encode(cid);
|
|
233
|
-
data = encodedData;
|
|
234
|
-
}
|
|
235
226
|
this.setValue("json", JSON.stringify(data));
|
|
236
227
|
}
|
|
237
228
|
else {
|
|
@@ -5,6 +5,8 @@ import { Grant } from "./Grant";
|
|
|
5
5
|
import { MemberOf } from "./MemberOf";
|
|
6
6
|
import { IProjectResponse } from "../karma-indexer/api/types";
|
|
7
7
|
import { ProjectImpact } from "./ProjectImpact";
|
|
8
|
+
import { ProjectUpdate } from "./ProjectUpdate";
|
|
9
|
+
import { ProjectPointer } from "./ProjectPointer";
|
|
8
10
|
export interface IProject {
|
|
9
11
|
project: true;
|
|
10
12
|
}
|
|
@@ -15,6 +17,8 @@ export declare class Project extends Attestation<IProject> {
|
|
|
15
17
|
grantee: Grantee;
|
|
16
18
|
impacts: ProjectImpact[];
|
|
17
19
|
endorsements: ProjectEndorsement[];
|
|
20
|
+
updates: ProjectUpdate[];
|
|
21
|
+
pointers: ProjectPointer[];
|
|
18
22
|
/**
|
|
19
23
|
* Creates the payload for a multi-attestation.
|
|
20
24
|
*
|
|
@@ -73,6 +77,8 @@ export declare class Project extends Attestation<IProject> {
|
|
|
73
77
|
*/
|
|
74
78
|
removeAllMembers(signer: SignerOrProvider): Promise<void>;
|
|
75
79
|
static from(attestations: IProjectResponse[], network: TNetwork): Project[];
|
|
80
|
+
attestUpdate(signer: SignerOrProvider, data: ProjectUpdate, callback?: Function): Promise<void>;
|
|
81
|
+
attestPointer(signer: SignerOrProvider, data: ProjectPointer, callback?: Function): Promise<void>;
|
|
76
82
|
attestImpact(signer: SignerOrProvider, data: ProjectImpact): Promise<void>;
|
|
77
83
|
attestEndorsement(signer: SignerOrProvider, data?: ProjectEndorsement): Promise<void>;
|
|
78
84
|
}
|
|
@@ -11,6 +11,8 @@ const MemberOf_1 = require("./MemberOf");
|
|
|
11
11
|
const GapContract_1 = require("../contract/GapContract");
|
|
12
12
|
const AllGapSchemas_1 = require("../AllGapSchemas");
|
|
13
13
|
const ProjectImpact_1 = require("./ProjectImpact");
|
|
14
|
+
const ProjectUpdate_1 = require("./ProjectUpdate");
|
|
15
|
+
const ProjectPointer_1 = require("./ProjectPointer");
|
|
14
16
|
class Project extends Attestation_1.Attestation {
|
|
15
17
|
constructor() {
|
|
16
18
|
super(...arguments);
|
|
@@ -18,6 +20,8 @@ class Project extends Attestation_1.Attestation {
|
|
|
18
20
|
this.grants = [];
|
|
19
21
|
this.impacts = [];
|
|
20
22
|
this.endorsements = [];
|
|
23
|
+
this.updates = [];
|
|
24
|
+
this.pointers = [];
|
|
21
25
|
}
|
|
22
26
|
/**
|
|
23
27
|
* Creates the payload for a multi-attestation.
|
|
@@ -250,6 +254,12 @@ class Project extends Attestation_1.Attestation {
|
|
|
250
254
|
if (attestation.impacts) {
|
|
251
255
|
project.impacts = ProjectImpact_1.ProjectImpact.from(attestation.impacts, network);
|
|
252
256
|
}
|
|
257
|
+
if (attestation.pointers) {
|
|
258
|
+
project.pointers = ProjectPointer_1.ProjectPointer.from(attestation.pointers, network);
|
|
259
|
+
}
|
|
260
|
+
if (attestation.updates) {
|
|
261
|
+
project.updates = ProjectUpdate_1.ProjectUpdate.from(attestation.updates, network);
|
|
262
|
+
}
|
|
253
263
|
if (attestation.endorsements) {
|
|
254
264
|
project.endorsements = attestation.endorsements.map((pi) => {
|
|
255
265
|
const endorsement = new attestations_1.ProjectEndorsement({
|
|
@@ -266,6 +276,32 @@ class Project extends Attestation_1.Attestation {
|
|
|
266
276
|
return project;
|
|
267
277
|
});
|
|
268
278
|
}
|
|
279
|
+
async attestUpdate(signer, data, callback) {
|
|
280
|
+
const projectUpdate = new ProjectUpdate_1.ProjectUpdate({
|
|
281
|
+
data: {
|
|
282
|
+
...data,
|
|
283
|
+
type: "project-update",
|
|
284
|
+
},
|
|
285
|
+
recipient: this.recipient,
|
|
286
|
+
refUID: this.uid,
|
|
287
|
+
schema: this.schema.gap.findSchema("ProjectUpdate"),
|
|
288
|
+
});
|
|
289
|
+
await projectUpdate.attest(signer, callback);
|
|
290
|
+
this.updates.push(projectUpdate);
|
|
291
|
+
}
|
|
292
|
+
async attestPointer(signer, data, callback) {
|
|
293
|
+
const projectPointer = new ProjectPointer_1.ProjectPointer({
|
|
294
|
+
data: {
|
|
295
|
+
...data,
|
|
296
|
+
type: "project-pointer",
|
|
297
|
+
},
|
|
298
|
+
recipient: this.recipient,
|
|
299
|
+
refUID: this.uid,
|
|
300
|
+
schema: this.schema.gap.findSchema("ProjectPointer"),
|
|
301
|
+
});
|
|
302
|
+
await projectPointer.attest(signer, callback);
|
|
303
|
+
this.pointers.push(projectPointer);
|
|
304
|
+
}
|
|
269
305
|
async attestImpact(signer, data) {
|
|
270
306
|
const projectImpact = new ProjectImpact_1.ProjectImpact({
|
|
271
307
|
data: {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TNetwork } from "../../../core/types";
|
|
2
|
+
import { Attestation } from "../Attestation";
|
|
3
|
+
export interface _IProjectPointer extends ProjectPointer {
|
|
4
|
+
}
|
|
5
|
+
export interface IProjectPointer {
|
|
6
|
+
ogProjectUID: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class ProjectPointer extends Attestation<IProjectPointer> implements IProjectPointer {
|
|
10
|
+
ogProjectUID: string;
|
|
11
|
+
static from(attestations: _IProjectPointer[], network: TNetwork): ProjectPointer[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProjectPointer = void 0;
|
|
4
|
+
const Attestation_1 = require("../Attestation");
|
|
5
|
+
const AllGapSchemas_1 = require("../AllGapSchemas");
|
|
6
|
+
const consts_1 = require("../../../core/consts");
|
|
7
|
+
class ProjectPointer extends Attestation_1.Attestation {
|
|
8
|
+
static from(attestations, network) {
|
|
9
|
+
return attestations.map((attestation) => {
|
|
10
|
+
const projectUpdate = new ProjectPointer({
|
|
11
|
+
...attestation,
|
|
12
|
+
data: {
|
|
13
|
+
...attestation.data,
|
|
14
|
+
},
|
|
15
|
+
schema: new AllGapSchemas_1.AllGapSchemas().findSchema("ProjectUpdate", consts_1.chainIdToNetwork[attestation.chainID]),
|
|
16
|
+
chainID: attestation.chainID,
|
|
17
|
+
});
|
|
18
|
+
return projectUpdate;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ProjectPointer = ProjectPointer;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SignerOrProvider, TNetwork } from "../../../core/types";
|
|
2
|
+
import { Attestation } from "../Attestation";
|
|
3
|
+
export interface _IProjectUpdate extends ProjectUpdate {
|
|
4
|
+
}
|
|
5
|
+
export interface IProjectUpdate {
|
|
6
|
+
title: string;
|
|
7
|
+
text: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
}
|
|
10
|
+
type IStatus = "verified";
|
|
11
|
+
export interface IProjectUpdateStatus {
|
|
12
|
+
type: `project-update-${IStatus}`;
|
|
13
|
+
reason?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class ProjectUpdateStatus extends Attestation<IProjectUpdateStatus> implements IProjectUpdateStatus {
|
|
16
|
+
type: `project-update-${IStatus}`;
|
|
17
|
+
reason?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class ProjectUpdate extends Attestation<IProjectUpdate> implements IProjectUpdate {
|
|
20
|
+
title: string;
|
|
21
|
+
text: string;
|
|
22
|
+
verified: ProjectUpdateStatus[];
|
|
23
|
+
/**
|
|
24
|
+
* Attest the status of the update as approved, rejected or completed.
|
|
25
|
+
*/
|
|
26
|
+
private attestStatus;
|
|
27
|
+
/**
|
|
28
|
+
* Verify this ProjectUpdate. If the ProjectUpdate is not already verified,
|
|
29
|
+
* it will throw an error.
|
|
30
|
+
* @param signer
|
|
31
|
+
* @param reason
|
|
32
|
+
*/
|
|
33
|
+
verify(signer: SignerOrProvider, reason?: string, callback?: Function): Promise<void>;
|
|
34
|
+
static from(attestations: _IProjectUpdate[], network: TNetwork): ProjectUpdate[];
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProjectUpdate = exports.ProjectUpdateStatus = void 0;
|
|
4
|
+
const Attestation_1 = require("../Attestation");
|
|
5
|
+
const SchemaError_1 = require("../SchemaError");
|
|
6
|
+
const AllGapSchemas_1 = require("../AllGapSchemas");
|
|
7
|
+
const consts_1 = require("../../../core/consts");
|
|
8
|
+
class ProjectUpdateStatus extends Attestation_1.Attestation {
|
|
9
|
+
}
|
|
10
|
+
exports.ProjectUpdateStatus = ProjectUpdateStatus;
|
|
11
|
+
class ProjectUpdate extends Attestation_1.Attestation {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.verified = [];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Attest the status of the update as approved, rejected or completed.
|
|
18
|
+
*/
|
|
19
|
+
async attestStatus(signer, schema, callback) {
|
|
20
|
+
const eas = this.schema.gap.eas.connect(signer);
|
|
21
|
+
try {
|
|
22
|
+
if (callback)
|
|
23
|
+
callback("preparing");
|
|
24
|
+
const tx = await eas.attest({
|
|
25
|
+
schema: schema.uid,
|
|
26
|
+
data: {
|
|
27
|
+
recipient: this.recipient,
|
|
28
|
+
data: schema.encode(),
|
|
29
|
+
refUID: this.uid,
|
|
30
|
+
expirationTime: 0n,
|
|
31
|
+
revocable: schema.revocable,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
if (callback)
|
|
35
|
+
callback("pending");
|
|
36
|
+
const uid = await tx.wait();
|
|
37
|
+
if (callback)
|
|
38
|
+
callback("confirmed");
|
|
39
|
+
console.log(uid);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.error(error);
|
|
43
|
+
throw new SchemaError_1.AttestationError("ATTEST_ERROR", error.message);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Verify this ProjectUpdate. If the ProjectUpdate is not already verified,
|
|
48
|
+
* it will throw an error.
|
|
49
|
+
* @param signer
|
|
50
|
+
* @param reason
|
|
51
|
+
*/
|
|
52
|
+
async verify(signer, reason = "", callback) {
|
|
53
|
+
console.log("Verifying");
|
|
54
|
+
const schema = this.schema.gap.findSchema("ProjectUpdateStatus");
|
|
55
|
+
schema.setValue("type", "project-update-verified");
|
|
56
|
+
schema.setValue("reason", reason);
|
|
57
|
+
console.log("Before attest project update verified");
|
|
58
|
+
await this.attestStatus(signer, schema, callback);
|
|
59
|
+
console.log("After attest project update verified");
|
|
60
|
+
this.verified.push(new ProjectUpdateStatus({
|
|
61
|
+
data: {
|
|
62
|
+
type: "project-update-verified",
|
|
63
|
+
reason,
|
|
64
|
+
},
|
|
65
|
+
refUID: this.uid,
|
|
66
|
+
schema: schema,
|
|
67
|
+
recipient: this.recipient,
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
static from(attestations, network) {
|
|
71
|
+
return attestations.map((attestation) => {
|
|
72
|
+
const projectUpdate = new ProjectUpdate({
|
|
73
|
+
...attestation,
|
|
74
|
+
data: {
|
|
75
|
+
...attestation.data,
|
|
76
|
+
},
|
|
77
|
+
schema: new AllGapSchemas_1.AllGapSchemas().findSchema("ProjectUpdate", consts_1.chainIdToNetwork[attestation.chainID]),
|
|
78
|
+
chainID: attestation.chainID,
|
|
79
|
+
});
|
|
80
|
+
if (attestation.verified?.length > 0) {
|
|
81
|
+
projectUpdate.verified = attestation.verified.map((m) => new ProjectUpdateStatus({
|
|
82
|
+
...m,
|
|
83
|
+
data: {
|
|
84
|
+
...m.data,
|
|
85
|
+
},
|
|
86
|
+
schema: new AllGapSchemas_1.AllGapSchemas().findSchema("ProjectUpdateStatus", consts_1.chainIdToNetwork[attestation.chainID]),
|
|
87
|
+
chainID: attestation.chainID,
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
return projectUpdate;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.ProjectUpdate = ProjectUpdate;
|
|
@@ -20,3 +20,5 @@ __exportStar(require("./Project"), exports);
|
|
|
20
20
|
__exportStar(require("./Community"), exports);
|
|
21
21
|
__exportStar(require("./MemberOf"), exports);
|
|
22
22
|
__exportStar(require("./GrantUpdate"), exports);
|
|
23
|
+
__exportStar(require("./ProjectUpdate"), exports);
|
|
24
|
+
__exportStar(require("./ProjectPointer"), exports);
|
|
@@ -68,6 +68,28 @@ export interface IGrantUpdate extends IAttestationResponse {
|
|
|
68
68
|
};
|
|
69
69
|
verified?: IGrantUpdateStatus[];
|
|
70
70
|
}
|
|
71
|
+
export interface IProjectUpdateStatus extends IAttestationResponse {
|
|
72
|
+
type: `project-update-${IStatus}`;
|
|
73
|
+
reason?: string;
|
|
74
|
+
data: {
|
|
75
|
+
type: "approved" | "rejected" | "completed";
|
|
76
|
+
reason?: string;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export interface IProjectUpdate extends IAttestationResponse {
|
|
80
|
+
data: {
|
|
81
|
+
text: string;
|
|
82
|
+
title: string;
|
|
83
|
+
type: "project-update";
|
|
84
|
+
};
|
|
85
|
+
verified?: IProjectUpdateStatus[];
|
|
86
|
+
}
|
|
87
|
+
export interface IProjectPointer extends IAttestationResponse {
|
|
88
|
+
data: {
|
|
89
|
+
ogProjectUID: string;
|
|
90
|
+
type: "project-pointer";
|
|
91
|
+
};
|
|
92
|
+
}
|
|
71
93
|
export interface IGrantDetails extends IAttestationResponse {
|
|
72
94
|
type: "GrantDetails";
|
|
73
95
|
data: {
|
|
@@ -165,6 +187,9 @@ export interface IProjectResponse extends IAttestationResponse {
|
|
|
165
187
|
grants: IGrantResponse[];
|
|
166
188
|
grantee: any;
|
|
167
189
|
impacts: IProjectImpact[];
|
|
190
|
+
updates: IProjectUpdate[];
|
|
191
|
+
pointers: IProjectPointer[];
|
|
192
|
+
symlinks: Hex[];
|
|
168
193
|
endorsements: IProjectEndorsement[];
|
|
169
194
|
}
|
|
170
195
|
export interface ICommunityDetails extends IAttestationResponse {
|
package/core/consts.js
CHANGED
|
@@ -11,6 +11,7 @@ exports.useDefaultAttestation = [
|
|
|
11
11
|
"GrantVerified",
|
|
12
12
|
"Community",
|
|
13
13
|
"GrantUpdateStatus",
|
|
14
|
+
"ProjectUpdateStatus",
|
|
14
15
|
];
|
|
15
16
|
exports.chainIdToNetwork = {
|
|
16
17
|
11155420: "optimism-sepolia",
|
|
@@ -53,6 +54,7 @@ exports.Networks = {
|
|
|
53
54
|
MilestoneCompleted: "0x13adc8df8a7324b1651e8bcec948b3e2d4fcfa2a88a52136206cb9ea44836e93",
|
|
54
55
|
GrantUpdateStatus: "0x13adc8df8a7324b1651e8bcec948b3e2d4fcfa2a88a52136206cb9ea44836e93",
|
|
55
56
|
Project: "0x5b873b6e7a16207b526dde366e8164e95bcda2f009272306519667c5e94d2191",
|
|
57
|
+
ProjectUpdateStatus: "0x13adc8df8a7324b1651e8bcec948b3e2d4fcfa2a88a52136206cb9ea44836e93",
|
|
56
58
|
},
|
|
57
59
|
},
|
|
58
60
|
"optimism-sepolia": {
|
|
@@ -77,6 +79,7 @@ exports.Networks = {
|
|
|
77
79
|
MilestoneCompleted: "0xf9ec600d61d88614c863365a79715a7ba29781ec67643ffeb9222dd8873ee3fa",
|
|
78
80
|
GrantUpdateStatus: "0xf9ec600d61d88614c863365a79715a7ba29781ec67643ffeb9222dd8873ee3fa",
|
|
79
81
|
Project: "0xf9bbd118dd100459a7d093403af21c6e7f847fd7f331b7a4e6bfb94a1366bd76",
|
|
82
|
+
ProjectUpdateStatus: "0xf9ec600d61d88614c863365a79715a7ba29781ec67643ffeb9222dd8873ee3fa",
|
|
80
83
|
},
|
|
81
84
|
},
|
|
82
85
|
arbitrum: {
|
|
@@ -101,6 +104,7 @@ exports.Networks = {
|
|
|
101
104
|
MilestoneCompleted: "0xd25ccdfbf87659a9081681eb90598d8b944ed28544da7d57c3ccbe6e6422cc15",
|
|
102
105
|
GrantUpdateStatus: "0xd25ccdfbf87659a9081681eb90598d8b944ed28544da7d57c3ccbe6e6422cc15",
|
|
103
106
|
Project: "0xac2a06e955a7e25e6729efe1a6532237e3435b21ccd3dc827ae3c94e624d25b3",
|
|
107
|
+
ProjectUpdateStatus: "0xd25ccdfbf87659a9081681eb90598d8b944ed28544da7d57c3ccbe6e6422cc15",
|
|
104
108
|
},
|
|
105
109
|
},
|
|
106
110
|
sepolia: {
|
|
@@ -126,6 +130,7 @@ exports.Networks = {
|
|
|
126
130
|
MilestoneCompleted: "0xcdef0e492d2e7ad25d0b0fdb868f6dcd1f5e5c30e42fd5fa0debdc12f7618322",
|
|
127
131
|
GrantUpdateStatus: "0xcdef0e492d2e7ad25d0b0fdb868f6dcd1f5e5c30e42fd5fa0debdc12f7618322",
|
|
128
132
|
Project: "0xec77990a252b54b17673955c774b9712766de5eecb22ca5aa2c440e0e93257fb",
|
|
133
|
+
ProjectUpdateStatus: "0xcdef0e492d2e7ad25d0b0fdb868f6dcd1f5e5c30e42fd5fa0debdc12f7618322",
|
|
129
134
|
},
|
|
130
135
|
},
|
|
131
136
|
"base-sepolia": {
|
|
@@ -150,6 +155,7 @@ exports.Networks = {
|
|
|
150
155
|
MilestoneCompleted: "0xe9cce07bd9295aafc78faa7afdd88a6fad6fd61834a048fb8c3dbc86cb471f81",
|
|
151
156
|
GrantUpdateStatus: "0xe9cce07bd9295aafc78faa7afdd88a6fad6fd61834a048fb8c3dbc86cb471f81",
|
|
152
157
|
Project: "0x5ddd6b7a11406771308431ca9bd146cc717848b74b52993a532dc1aad0ccc83f",
|
|
158
|
+
ProjectUpdateStatus: "0xe9cce07bd9295aafc78faa7afdd88a6fad6fd61834a048fb8c3dbc86cb471f81",
|
|
153
159
|
},
|
|
154
160
|
},
|
|
155
161
|
celo: {
|
|
@@ -174,9 +180,10 @@ exports.Networks = {
|
|
|
174
180
|
MilestoneCompleted: "0xf45fdf2c064073f0623416571c2746085d785cde5a57fd0696ff88bdf78bcbdc",
|
|
175
181
|
GrantUpdateStatus: "0xf45fdf2c064073f0623416571c2746085d785cde5a57fd0696ff88bdf78bcbdc",
|
|
176
182
|
Project: "0xf3f753b41e04d1052b5a5ec7624d1dfdb6c2da288a985120e477ddbcac071022",
|
|
183
|
+
ProjectUpdateStatus: "0xf45fdf2c064073f0623416571c2746085d785cde5a57fd0696ff88bdf78bcbdc",
|
|
177
184
|
},
|
|
178
185
|
},
|
|
179
|
-
|
|
186
|
+
sei: {
|
|
180
187
|
chainId: 1329,
|
|
181
188
|
url: "https://sei.easscan.org/graphql",
|
|
182
189
|
rpcUrl: "https://evm-rpc.sei-apis.com",
|
|
@@ -198,6 +205,7 @@ exports.Networks = {
|
|
|
198
205
|
MilestoneCompleted: "0x6edc90af92553109cfed1292a67a75b34e41880bd8a61e9d05db0473b69a2f9e",
|
|
199
206
|
GrantUpdateStatus: "0x6edc90af92553109cfed1292a67a75b34e41880bd8a61e9d05db0473b69a2f9e",
|
|
200
207
|
Project: "0xf6b89107f8096220051240b89a48abb66e0a23e529c914953b80f5a2bc5ea44c",
|
|
208
|
+
ProjectUpdateStatus: "0x6edc90af92553109cfed1292a67a75b34e41880bd8a61e9d05db0473b69a2f9e",
|
|
201
209
|
},
|
|
202
210
|
},
|
|
203
211
|
"sei-testnet": {
|
|
@@ -221,7 +229,8 @@ exports.Networks = {
|
|
|
221
229
|
MilestoneApproved: "0xb25551d21dc886be83a07c241c46de318704cb6f485191fdedcf80f4b8b28188",
|
|
222
230
|
MilestoneCompleted: "0xb25551d21dc886be83a07c241c46de318704cb6f485191fdedcf80f4b8b28188",
|
|
223
231
|
GrantUpdateStatus: "0xb25551d21dc886be83a07c241c46de318704cb6f485191fdedcf80f4b8b28188",
|
|
224
|
-
Project: "
|
|
232
|
+
Project: "0x9de9294fbb62391b393332a33bfc28b4e0e728dd094aee4bda3955df62f8401a5",
|
|
233
|
+
ProjectUpdateStatus: "0xb25551d21dc886be83a07c241c46de318704cb6f485191fdedcf80f4b8b28188",
|
|
225
234
|
},
|
|
226
235
|
},
|
|
227
236
|
};
|
|
@@ -344,6 +353,27 @@ const MountEntities = (network) => ({
|
|
|
344
353
|
uid: network.schemas.Details,
|
|
345
354
|
references: "Project",
|
|
346
355
|
},
|
|
356
|
+
ProjectUpdate: {
|
|
357
|
+
name: "ProjectUpdate",
|
|
358
|
+
schema: DetailsSchema,
|
|
359
|
+
uid: network.schemas.Details,
|
|
360
|
+
references: "Project",
|
|
361
|
+
},
|
|
362
|
+
ProjectUpdateStatus: {
|
|
363
|
+
name: "ProjectUpdateStatus",
|
|
364
|
+
schema: [
|
|
365
|
+
{ type: "string", name: "type", value: null },
|
|
366
|
+
{ type: "string", name: "reason", value: "" },
|
|
367
|
+
],
|
|
368
|
+
uid: network.schemas.ProjectUpdateStatus,
|
|
369
|
+
references: "ProjectUpdate",
|
|
370
|
+
},
|
|
371
|
+
ProjectPointer: {
|
|
372
|
+
name: "ProjectPointer",
|
|
373
|
+
schema: DetailsSchema,
|
|
374
|
+
uid: network.schemas.Details,
|
|
375
|
+
references: "Project",
|
|
376
|
+
},
|
|
347
377
|
});
|
|
348
378
|
exports.MountEntities = MountEntities;
|
|
349
379
|
exports.alloSupportedNetworks = {
|
package/core/types.d.ts
CHANGED
|
@@ -23,8 +23,8 @@ export interface AttestArgs<T = unknown> {
|
|
|
23
23
|
signer: SignerOrProvider;
|
|
24
24
|
callback?: (status: CallbackStatus) => void;
|
|
25
25
|
}
|
|
26
|
-
export type TSchemaName = "Community" | "CommunityDetails" | "Grant" | "GrantDetails" | "GrantVerified" | "MemberOf" | "MemberDetails" | "Milestone" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "ProjectDetails" | "Details" | "ProjectImpact" | "GrantUpdate" | "GrantUpdateStatus" | "ProjectEndorsement";
|
|
27
|
-
export type TResolvedSchemaNames = "Community" | "Grant" | "GrantVerified" | "MemberOf" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "Details" | "GrantUpdateStatus";
|
|
26
|
+
export type TSchemaName = "Community" | "CommunityDetails" | "Grant" | "GrantDetails" | "GrantVerified" | "MemberOf" | "MemberDetails" | "Milestone" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "ProjectDetails" | "Details" | "ProjectImpact" | "ProjectUpdate" | "ProjectUpdateStatus" | "ProjectPointer" | "GrantUpdate" | "GrantUpdateStatus" | "ProjectEndorsement";
|
|
27
|
+
export type TResolvedSchemaNames = "Community" | "Grant" | "GrantVerified" | "MemberOf" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "Details" | "ProjectUpdateStatus" | "GrantUpdateStatus" | "ProjectUpdateStatus";
|
|
28
28
|
export type TExternalLink = "twitter" | "github" | "website" | "linkedin" | "discord";
|
|
29
29
|
export type TNetwork = "optimism" | "celo" | "optimism-sepolia" | "arbitrum" | "sepolia" | "sei" | "sei-testnet" | "base-sepolia";
|
|
30
30
|
/**
|