@show-karma/karma-gap-sdk 0.4.9 → 0.4.12
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/AllGapSchemas.d.ts +2 -2
- package/core/class/AllGapSchemas.js +3 -3
- package/core/class/GAP.d.ts +22 -4
- package/core/class/GAP.js +44 -11
- package/core/class/Schema.js +1 -0
- package/core/class/entities/ContributorProfile.d.ts +2 -0
- package/core/class/entities/Grant.d.ts +2 -7
- package/core/class/entities/GrantUpdate.d.ts +3 -5
- package/core/class/entities/GrantUpdate.js +2 -2
- package/core/class/entities/Milestone.d.ts +71 -1
- package/core/class/entities/Milestone.js +335 -0
- package/core/class/entities/Project.js +6 -5
- package/core/class/entities/Track.d.ts +16 -0
- package/core/class/entities/Track.js +21 -0
- package/core/class/entities/index.d.ts +1 -0
- package/core/class/entities/index.js +1 -0
- package/core/class/karma-indexer/GapIndexerClient.d.ts +24 -1
- package/core/class/karma-indexer/GapIndexerClient.js +51 -0
- package/core/class/karma-indexer/api/GapIndexerApi.d.ts +24 -1
- package/core/class/karma-indexer/api/GapIndexerApi.js +73 -1
- package/core/class/karma-indexer/api/types.d.ts +34 -5
- package/core/class/types/attestations.d.ts +2 -0
- package/core/consts.d.ts +1 -0
- package/core/consts.js +29 -0
- package/core/shared/types.d.ts +6 -0
- package/core/shared/types.js +2 -0
- package/core/types.d.ts +2 -2
- package/package.json +3 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SchemaInterface, TNetwork, TSchemaName } from
|
|
2
|
-
import { GapSchema } from
|
|
1
|
+
import { SchemaInterface, TNetwork, TSchemaName } from "../types";
|
|
2
|
+
import { GapSchema } from "./GapSchema";
|
|
3
3
|
export declare class AllGapSchemas {
|
|
4
4
|
allSchemas: {
|
|
5
5
|
[network: string]: SchemaInterface<TSchemaName>[];
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AllGapSchemas = void 0;
|
|
4
4
|
const consts_1 = require("../../core/consts");
|
|
5
|
-
const GapSchema_1 = require("./GapSchema");
|
|
6
5
|
const GAP_1 = require("./GAP");
|
|
6
|
+
const GapSchema_1 = require("./GapSchema");
|
|
7
7
|
class AllGapSchemas {
|
|
8
8
|
constructor() {
|
|
9
9
|
this.allSchemas = {};
|
|
@@ -12,8 +12,8 @@ class AllGapSchemas {
|
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
findSchema(name, network) {
|
|
15
|
-
const schema = this.allSchemas[network].find(s => s.name === name);
|
|
16
|
-
return new GapSchema_1.GapSchema(schema,
|
|
15
|
+
const schema = this.allSchemas[network].find((s) => s.name === name);
|
|
16
|
+
return new GapSchema_1.GapSchema(schema, GAP_1.GAP.getInstance({ network }), false, false);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
exports.AllGapSchemas = AllGapSchemas;
|
package/core/class/GAP.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AttestArgs, Facade, SchemaInterface, TNetwork, TSchemaName, SignerOrProvider } from "../types";
|
|
2
|
-
import { GapSchema } from "./GapSchema";
|
|
3
1
|
import { ethers } from "ethers";
|
|
2
|
+
import { AttestArgs, Facade, SchemaInterface, SignerOrProvider, TNetwork, TSchemaName } from "../types";
|
|
4
3
|
import { Fetcher } from "./Fetcher";
|
|
4
|
+
import { GapSchema } from "./GapSchema";
|
|
5
5
|
import { RemoteStorage } from "./remote-storage/RemoteStorage";
|
|
6
6
|
interface GAPArgs {
|
|
7
7
|
network: TNetwork;
|
|
@@ -101,7 +101,8 @@ interface GAPArgs {
|
|
|
101
101
|
*
|
|
102
102
|
* This is the main class that is used to interact with the GAP SDK.
|
|
103
103
|
*
|
|
104
|
-
* This class
|
|
104
|
+
* This class implements the singleton pattern to ensure only one instance exists
|
|
105
|
+
* throughout the application lifecycle.
|
|
105
106
|
*
|
|
106
107
|
* Using this class, the user will be able to:
|
|
107
108
|
*
|
|
@@ -136,12 +137,16 @@ interface GAPArgs {
|
|
|
136
137
|
*
|
|
137
138
|
* const schemas = MountEntities(Networks.sepolia);
|
|
138
139
|
*
|
|
139
|
-
*
|
|
140
|
+
* // Initialize the singleton instance
|
|
141
|
+
* const gap = GAP.getInstance({
|
|
140
142
|
* network: "sepolia",
|
|
141
143
|
* owner: "0xd7d1DB401EA825b0325141Cd5e6cd7C2d01825f2",
|
|
142
144
|
* schemas: Object.values(schemas),
|
|
143
145
|
* });
|
|
144
146
|
*
|
|
147
|
+
* // Later in the code, get the same instance
|
|
148
|
+
* const sameGap = GAP.getInstance();
|
|
149
|
+
*
|
|
145
150
|
* gap.fetcher
|
|
146
151
|
* .fetchProjects()
|
|
147
152
|
* .then((res) => {
|
|
@@ -152,10 +157,23 @@ interface GAPArgs {
|
|
|
152
157
|
*/
|
|
153
158
|
export declare class GAP extends Facade {
|
|
154
159
|
private static remoteStorage?;
|
|
160
|
+
private static instances;
|
|
155
161
|
readonly fetch: Fetcher;
|
|
156
162
|
readonly network: TNetwork;
|
|
157
163
|
private _schemas;
|
|
158
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
|
+
*/
|
|
159
177
|
constructor(args: GAPArgs);
|
|
160
178
|
private assertGelatoOpts;
|
|
161
179
|
/**
|
package/core/class/GAP.js
CHANGED
|
@@ -4,24 +4,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.GAP = void 0;
|
|
7
|
+
const CommunityResolverABI_json_1 = __importDefault(require("../abi/CommunityResolverABI.json"));
|
|
7
8
|
const MultiAttester_json_1 = __importDefault(require("../abi/MultiAttester.json"));
|
|
8
9
|
const ProjectResolver_json_1 = __importDefault(require("../abi/ProjectResolver.json"));
|
|
9
|
-
const CommunityResolverABI_json_1 = __importDefault(require("../abi/CommunityResolverABI.json"));
|
|
10
|
-
const types_1 = require("../types");
|
|
11
|
-
const Schema_1 = require("./Schema");
|
|
12
|
-
const GapSchema_1 = require("./GapSchema");
|
|
13
10
|
const eas_sdk_1 = require("@ethereum-attestation-service/eas-sdk");
|
|
14
|
-
const consts_1 = require("../consts");
|
|
15
11
|
const ethers_1 = require("ethers");
|
|
16
12
|
const package_json_1 = require("../../package.json");
|
|
17
|
-
const
|
|
13
|
+
const consts_1 = require("../consts");
|
|
14
|
+
const types_1 = require("../types");
|
|
18
15
|
const get_web3_provider_1 = require("../utils/get-web3-provider");
|
|
16
|
+
const GapSchema_1 = require("./GapSchema");
|
|
17
|
+
const GraphQL_1 = require("./GraphQL");
|
|
18
|
+
const Schema_1 = require("./Schema");
|
|
19
19
|
/**
|
|
20
20
|
* GAP SDK Facade.
|
|
21
21
|
*
|
|
22
22
|
* This is the main class that is used to interact with the GAP SDK.
|
|
23
23
|
*
|
|
24
|
-
* This class
|
|
24
|
+
* This class implements the singleton pattern to ensure only one instance exists
|
|
25
|
+
* throughout the application lifecycle.
|
|
25
26
|
*
|
|
26
27
|
* Using this class, the user will be able to:
|
|
27
28
|
*
|
|
@@ -56,12 +57,16 @@ const get_web3_provider_1 = require("../utils/get-web3-provider");
|
|
|
56
57
|
*
|
|
57
58
|
* const schemas = MountEntities(Networks.sepolia);
|
|
58
59
|
*
|
|
59
|
-
*
|
|
60
|
+
* // Initialize the singleton instance
|
|
61
|
+
* const gap = GAP.getInstance({
|
|
60
62
|
* network: "sepolia",
|
|
61
63
|
* owner: "0xd7d1DB401EA825b0325141Cd5e6cd7C2d01825f2",
|
|
62
64
|
* schemas: Object.values(schemas),
|
|
63
65
|
* });
|
|
64
66
|
*
|
|
67
|
+
* // Later in the code, get the same instance
|
|
68
|
+
* const sameGap = GAP.getInstance();
|
|
69
|
+
*
|
|
65
70
|
* gap.fetcher
|
|
66
71
|
* .fetchProjects()
|
|
67
72
|
* .then((res) => {
|
|
@@ -71,6 +76,32 @@ const get_web3_provider_1 = require("../utils/get-web3-provider");
|
|
|
71
76
|
* ```
|
|
72
77
|
*/
|
|
73
78
|
class GAP extends types_1.Facade {
|
|
79
|
+
/**
|
|
80
|
+
* Get the singleton instance of GAP for a specific network.
|
|
81
|
+
* If no instance exists for the network, creates one with the provided args.
|
|
82
|
+
* @param args Optional initialization arguments
|
|
83
|
+
* @returns The singleton instance of GAP for the specified network
|
|
84
|
+
*/
|
|
85
|
+
static getInstance(args) {
|
|
86
|
+
if (!args) {
|
|
87
|
+
throw new Error("Network must be specified when getting GAP instance");
|
|
88
|
+
}
|
|
89
|
+
const existingInstance = GAP.instances.get(args.network);
|
|
90
|
+
if (existingInstance) {
|
|
91
|
+
return existingInstance;
|
|
92
|
+
}
|
|
93
|
+
if (!args) {
|
|
94
|
+
throw new Error("Initialization arguments required for first instance");
|
|
95
|
+
}
|
|
96
|
+
const newInstance = new GAP(args);
|
|
97
|
+
GAP.instances.set(args.network, newInstance);
|
|
98
|
+
return newInstance;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Creates a new instance of GAP.
|
|
102
|
+
* You can either use this constructor directly or use the singleton pattern via getInstance().
|
|
103
|
+
* @param args Initialization arguments
|
|
104
|
+
*/
|
|
74
105
|
constructor(args) {
|
|
75
106
|
super();
|
|
76
107
|
/**
|
|
@@ -82,13 +113,13 @@ class GAP extends types_1.Facade {
|
|
|
82
113
|
let slug = text
|
|
83
114
|
.toLowerCase()
|
|
84
115
|
// Remove emojis
|
|
85
|
-
.replace(/([\uE000-\uF8FF]|\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDDFF])/g,
|
|
116
|
+
.replace(/([\uE000-\uF8FF]|\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDDFF])/g, "")
|
|
86
117
|
// Remove basic text emoticons
|
|
87
|
-
.replace(/[:;=][()DP]/g,
|
|
118
|
+
.replace(/[:;=][()DP]/g, "")
|
|
88
119
|
.replace(/ /g, "-")
|
|
89
120
|
.replace(/[^\w-]+/g, "")
|
|
90
121
|
.trim()
|
|
91
|
-
.replace(/^-+|-+$/g,
|
|
122
|
+
.replace(/^-+|-+$/g, ""); // Remove leading and trailing hyphens
|
|
92
123
|
const checkSlug = async (currentSlug, counter = 0) => {
|
|
93
124
|
const slugToCheck = counter === 0 ? currentSlug : `${currentSlug}-${counter}`;
|
|
94
125
|
const slugExists = await this.fetch.slugExists(slugToCheck);
|
|
@@ -114,6 +145,7 @@ class GAP extends types_1.Facade {
|
|
|
114
145
|
this._schemas = schemas.map((schema) => new GapSchema_1.GapSchema(schema, this, false, args.globalSchemas ? !args.globalSchemas : false));
|
|
115
146
|
Schema_1.Schema.validate(this.network);
|
|
116
147
|
console.info(`Loaded GAP SDK v${package_json_1.version} for network ${this.network}`);
|
|
148
|
+
GAP.instances.set(this.network, this);
|
|
117
149
|
}
|
|
118
150
|
assertGelatoOpts(args) {
|
|
119
151
|
if (args.gelatoOpts &&
|
|
@@ -253,4 +285,5 @@ class GAP extends types_1.Facade {
|
|
|
253
285
|
}
|
|
254
286
|
}
|
|
255
287
|
exports.GAP = GAP;
|
|
288
|
+
GAP.instances = new Map();
|
|
256
289
|
GAP._gelatoOpts = null;
|
package/core/class/Schema.js
CHANGED
|
@@ -8,6 +8,7 @@ export interface IContributorProfile {
|
|
|
8
8
|
github?: string;
|
|
9
9
|
twitter?: string;
|
|
10
10
|
linkedin?: string;
|
|
11
|
+
farcaster?: string;
|
|
11
12
|
}
|
|
12
13
|
export declare class ContributorProfile extends Attestation<IContributorProfile> implements IContributorProfile {
|
|
13
14
|
name: string;
|
|
@@ -15,6 +16,7 @@ export declare class ContributorProfile extends Attestation<IContributorProfile>
|
|
|
15
16
|
github?: string;
|
|
16
17
|
twitter?: string;
|
|
17
18
|
linkedin?: string;
|
|
19
|
+
farcaster?: string;
|
|
18
20
|
constructor(data: AttestationArgs<IContributorProfile, GapSchema>);
|
|
19
21
|
/**
|
|
20
22
|
* Creates the payload for a multi-attestation.
|
|
@@ -4,16 +4,11 @@ import { IMilestone, Milestone } from "./Milestone";
|
|
|
4
4
|
import { GapSchema } from "../GapSchema";
|
|
5
5
|
import { Hex, MultiAttestPayload, SignerOrProvider, TNetwork } from "core/types";
|
|
6
6
|
import { Community } from "./Community";
|
|
7
|
-
import { IGrantResponse } from "../karma-indexer/api/types";
|
|
7
|
+
import { IGrantResponse, IProjectResponse, ISummaryProject } from "../karma-indexer/api/types";
|
|
8
8
|
import { GrantUpdate, IGrantUpdate } from "./GrantUpdate";
|
|
9
9
|
export interface IGrant {
|
|
10
10
|
communityUID: Hex;
|
|
11
11
|
}
|
|
12
|
-
export interface ISummaryProject {
|
|
13
|
-
title: string;
|
|
14
|
-
slug?: string;
|
|
15
|
-
uid: Hex;
|
|
16
|
-
}
|
|
17
12
|
export declare class Grant extends Attestation<IGrant> {
|
|
18
13
|
details?: GrantDetails;
|
|
19
14
|
communityUID: Hex;
|
|
@@ -24,7 +19,7 @@ export declare class Grant extends Attestation<IGrant> {
|
|
|
24
19
|
updates: GrantUpdate[];
|
|
25
20
|
members: string[];
|
|
26
21
|
completed?: GrantCompleted;
|
|
27
|
-
project?: ISummaryProject;
|
|
22
|
+
project?: IProjectResponse | ISummaryProject;
|
|
28
23
|
categories?: string[];
|
|
29
24
|
verify(signer: SignerOrProvider): Promise<void>;
|
|
30
25
|
/**
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
+
import { IGrantUpdateBase } from "core/shared/types";
|
|
2
|
+
import { Transaction } from "ethers";
|
|
1
3
|
import { SignerOrProvider, TNetwork } from "../../../core/types";
|
|
2
4
|
import { Attestation } from "../Attestation";
|
|
3
|
-
import { Transaction } from "ethers";
|
|
4
5
|
export interface _IGrantUpdate extends GrantUpdate {
|
|
5
6
|
}
|
|
6
|
-
export interface IGrantUpdate {
|
|
7
|
-
title: string;
|
|
8
|
-
text: string;
|
|
7
|
+
export interface IGrantUpdate extends IGrantUpdateBase {
|
|
9
8
|
type?: string;
|
|
10
|
-
proofOfWork?: string;
|
|
11
9
|
}
|
|
12
10
|
type IStatus = "verified";
|
|
13
11
|
export interface IGrantUpdateStatus {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GrantUpdate = exports.GrantUpdateStatus = void 0;
|
|
4
|
+
const consts_1 = require("../../../core/consts");
|
|
5
|
+
const AllGapSchemas_1 = require("../AllGapSchemas");
|
|
4
6
|
const Attestation_1 = require("../Attestation");
|
|
5
7
|
const SchemaError_1 = require("../SchemaError");
|
|
6
|
-
const AllGapSchemas_1 = require("../AllGapSchemas");
|
|
7
|
-
const consts_1 = require("../../../core/consts");
|
|
8
8
|
class GrantUpdateStatus extends Attestation_1.Attestation {
|
|
9
9
|
}
|
|
10
10
|
exports.GrantUpdateStatus = GrantUpdateStatus;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Transaction } from "ethers";
|
|
2
|
-
import { MultiAttestPayload, SignerOrProvider, TNetwork } from "../../types";
|
|
2
|
+
import { Hex, MultiAttestPayload, MultiRevokeArgs, SignerOrProvider, TNetwork } from "../../types";
|
|
3
3
|
import { Attestation } from "../Attestation";
|
|
4
4
|
import { GapSchema } from "../GapSchema";
|
|
5
5
|
import { IMilestoneResponse } from "../karma-indexer/api/types";
|
|
@@ -12,6 +12,16 @@ export interface IMilestone {
|
|
|
12
12
|
type?: string;
|
|
13
13
|
priority?: number;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Milestone class represents a milestone that can be attested to one or multiple grants.
|
|
17
|
+
*
|
|
18
|
+
* It provides methods to:
|
|
19
|
+
* - Create, complete, approve, reject, and verify milestones
|
|
20
|
+
* - Attest a milestone to a single grant
|
|
21
|
+
* - Attest a milestone to multiple grants in a single transaction
|
|
22
|
+
* - Complete, approve, and verify milestones across multiple grants
|
|
23
|
+
* - Revoke multiple milestone attestations at once
|
|
24
|
+
*/
|
|
15
25
|
export declare class Milestone extends Attestation<IMilestone> implements IMilestone {
|
|
16
26
|
title: string;
|
|
17
27
|
startsAt?: number;
|
|
@@ -30,6 +40,16 @@ export declare class Milestone extends Attestation<IMilestone> implements IMiles
|
|
|
30
40
|
* @param reason
|
|
31
41
|
*/
|
|
32
42
|
approve(signer: SignerOrProvider, data?: IMilestoneCompleted, callback?: Function): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Approves this milestone across multiple grants. If the milestones are not completed,
|
|
45
|
+
* it will throw an error.
|
|
46
|
+
* @param signer - The signer to use for attestation
|
|
47
|
+
* @param milestoneUIDs - Array of milestone UIDs to approve
|
|
48
|
+
* @param data - Optional approval data
|
|
49
|
+
* @param callback - Optional callback function for status updates
|
|
50
|
+
* @returns Promise with transaction and UIDs
|
|
51
|
+
*/
|
|
52
|
+
approveMultipleGrants(signer: SignerOrProvider, milestoneUIDs: Hex[], data?: IMilestoneCompleted, callback?: Function): Promise<AttestationWithTx>;
|
|
33
53
|
/**
|
|
34
54
|
* Revokes the approved status of the milestone. If the milestone is not approved,
|
|
35
55
|
* it will throw an error.
|
|
@@ -52,6 +72,16 @@ export declare class Milestone extends Attestation<IMilestone> implements IMiles
|
|
|
52
72
|
tx: Transaction[];
|
|
53
73
|
uids: `0x${string}`[];
|
|
54
74
|
}>;
|
|
75
|
+
/**
|
|
76
|
+
* Revokes multiple milestone attestations at once.
|
|
77
|
+
* This method can be used to revoke multiple milestone attestations in a single transaction.
|
|
78
|
+
*
|
|
79
|
+
* @param signer - The signer to use for revocation
|
|
80
|
+
* @param attestationsToRevoke - Array of objects containing schemaId and uid of attestations to revoke
|
|
81
|
+
* @param callback - Optional callback function for status updates
|
|
82
|
+
* @returns Promise with transaction and UIDs of revoked attestations
|
|
83
|
+
*/
|
|
84
|
+
revokeMultipleAttestations(signer: SignerOrProvider, attestationsToRevoke: MultiRevokeArgs[], callback?: Function): Promise<AttestationWithTx>;
|
|
55
85
|
/**
|
|
56
86
|
* Marks a milestone as completed. If the milestone is already completed,
|
|
57
87
|
* it will throw an error.
|
|
@@ -59,6 +89,16 @@ export declare class Milestone extends Attestation<IMilestone> implements IMiles
|
|
|
59
89
|
* @param reason
|
|
60
90
|
*/
|
|
61
91
|
complete(signer: SignerOrProvider, data?: IMilestoneCompleted, callback?: Function): Promise<AttestationWithTx>;
|
|
92
|
+
/**
|
|
93
|
+
* Marks a milestone as completed across multiple grants. If the milestone is already completed,
|
|
94
|
+
* it will throw an error.
|
|
95
|
+
* @param signer - The signer to use for attestation
|
|
96
|
+
* @param grantIndices - Array of grant indices to attest this milestone to, or array of milestone UIDs
|
|
97
|
+
* @param data - Optional completion data
|
|
98
|
+
* @param callback - Optional callback function for status updates
|
|
99
|
+
* @returns Promise with transaction and UIDs
|
|
100
|
+
*/
|
|
101
|
+
completeForMultipleGrants(signer: SignerOrProvider, grantIndicesOrMilestoneUIDs?: number[] | Hex[], data?: IMilestoneCompleted, callback?: Function): Promise<AttestationWithTx>;
|
|
62
102
|
/**
|
|
63
103
|
* Revokes the completed status of the milestone. If the milestone is not completed,
|
|
64
104
|
* it will throw an error.
|
|
@@ -79,6 +119,26 @@ export declare class Milestone extends Attestation<IMilestone> implements IMiles
|
|
|
79
119
|
* @param grantIdx
|
|
80
120
|
*/
|
|
81
121
|
multiAttestPayload(currentPayload?: MultiAttestPayload, grantIdx?: number): Promise<[Attestation<unknown, GapSchema>, import("../../types").RawMultiAttestPayload][]>;
|
|
122
|
+
/**
|
|
123
|
+
* Creates the payload for a multi-attestation across multiple grants.
|
|
124
|
+
*
|
|
125
|
+
* This method allows for the same milestone to be attested to multiple grants
|
|
126
|
+
* in a single transaction.
|
|
127
|
+
*
|
|
128
|
+
* @param currentPayload - Current payload to append to
|
|
129
|
+
* @param grantIndices - Array of grant indices to attest this milestone to
|
|
130
|
+
* @returns The multi-attest payload with all grant attestations
|
|
131
|
+
*/
|
|
132
|
+
multiGrantAttestPayload(currentPayload?: MultiAttestPayload, grantIndices?: number[]): Promise<[Attestation<unknown, GapSchema>, import("../../types").RawMultiAttestPayload][]>;
|
|
133
|
+
/**
|
|
134
|
+
* Attests this milestone to multiple grants in a single transaction.
|
|
135
|
+
*
|
|
136
|
+
* @param signer - The signer to use for attestation
|
|
137
|
+
* @param grantIndices - Array of grant indices to attest this milestone to, or array of grant UIDs
|
|
138
|
+
* @param callback - Optional callback function for status updates
|
|
139
|
+
* @returns Promise with transaction and UIDs
|
|
140
|
+
*/
|
|
141
|
+
attestToMultipleGrants(signer: SignerOrProvider, grantIndices?: number[] | Hex[], callback?: Function): Promise<AttestationWithTx>;
|
|
82
142
|
/**
|
|
83
143
|
* @inheritdoc
|
|
84
144
|
*/
|
|
@@ -95,4 +155,14 @@ export declare class Milestone extends Attestation<IMilestone> implements IMiles
|
|
|
95
155
|
* @param reason
|
|
96
156
|
*/
|
|
97
157
|
verify(signer: SignerOrProvider, data?: IMilestoneCompleted, callback?: Function): Promise<AttestationWithTx>;
|
|
158
|
+
/**
|
|
159
|
+
* Verifies this milestone across multiple grants. If the milestones are not completed,
|
|
160
|
+
* it will throw an error.
|
|
161
|
+
* @param signer - The signer to use for attestation
|
|
162
|
+
* @param milestoneUIDs - Array of milestone UIDs to verify
|
|
163
|
+
* @param data - Optional verification data
|
|
164
|
+
* @param callback - Optional callback function for status updates
|
|
165
|
+
* @returns Promise with transaction and UIDs
|
|
166
|
+
*/
|
|
167
|
+
verifyMultipleGrants(signer: SignerOrProvider, milestoneUIDs: Hex[], data?: IMilestoneCompleted, callback?: Function): Promise<AttestationWithTx>;
|
|
98
168
|
}
|
|
@@ -7,6 +7,16 @@ const Attestation_1 = require("../Attestation");
|
|
|
7
7
|
const SchemaError_1 = require("../SchemaError");
|
|
8
8
|
const GapContract_1 = require("../contract/GapContract");
|
|
9
9
|
const attestations_1 = require("../types/attestations");
|
|
10
|
+
/**
|
|
11
|
+
* Milestone class represents a milestone that can be attested to one or multiple grants.
|
|
12
|
+
*
|
|
13
|
+
* It provides methods to:
|
|
14
|
+
* - Create, complete, approve, reject, and verify milestones
|
|
15
|
+
* - Attest a milestone to a single grant
|
|
16
|
+
* - Attest a milestone to multiple grants in a single transaction
|
|
17
|
+
* - Complete, approve, and verify milestones across multiple grants
|
|
18
|
+
* - Revoke multiple milestone attestations at once
|
|
19
|
+
*/
|
|
10
20
|
class Milestone extends Attestation_1.Attestation {
|
|
11
21
|
constructor() {
|
|
12
22
|
super(...arguments);
|
|
@@ -45,6 +55,66 @@ class Milestone extends Attestation_1.Attestation {
|
|
|
45
55
|
recipient: this.recipient,
|
|
46
56
|
});
|
|
47
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Approves this milestone across multiple grants. If the milestones are not completed,
|
|
60
|
+
* it will throw an error.
|
|
61
|
+
* @param signer - The signer to use for attestation
|
|
62
|
+
* @param milestoneUIDs - Array of milestone UIDs to approve
|
|
63
|
+
* @param data - Optional approval data
|
|
64
|
+
* @param callback - Optional callback function for status updates
|
|
65
|
+
* @returns Promise with transaction and UIDs
|
|
66
|
+
*/
|
|
67
|
+
async approveMultipleGrants(signer, milestoneUIDs, data, callback) {
|
|
68
|
+
// Validate that all milestones are completed
|
|
69
|
+
if (!this.completed)
|
|
70
|
+
throw new SchemaError_1.AttestationError("ATTEST_ERROR", "Milestone is not completed");
|
|
71
|
+
const schema = this.schema.gap.findSchema("MilestoneCompleted");
|
|
72
|
+
if (this.schema.isJsonSchema()) {
|
|
73
|
+
schema.setValue("json", JSON.stringify({
|
|
74
|
+
type: "approved",
|
|
75
|
+
...data,
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
schema.setValue("type", "approved");
|
|
80
|
+
schema.setValue("reason", data?.reason || "");
|
|
81
|
+
schema.setValue("proofOfWork", data?.proofOfWork || "");
|
|
82
|
+
}
|
|
83
|
+
// Create approval attestations for each milestone
|
|
84
|
+
const approvalPayloads = [];
|
|
85
|
+
for (const milestoneUID of milestoneUIDs) {
|
|
86
|
+
const approved = new attestations_1.MilestoneCompleted({
|
|
87
|
+
data: {
|
|
88
|
+
type: "approved",
|
|
89
|
+
...data,
|
|
90
|
+
},
|
|
91
|
+
refUID: milestoneUID,
|
|
92
|
+
schema,
|
|
93
|
+
recipient: this.recipient,
|
|
94
|
+
});
|
|
95
|
+
// Add approval to the payload
|
|
96
|
+
approvalPayloads.push([
|
|
97
|
+
approved,
|
|
98
|
+
await approved.payloadFor(0), // Index doesn't matter for approval
|
|
99
|
+
]);
|
|
100
|
+
}
|
|
101
|
+
// Attest all approvals at once
|
|
102
|
+
const result = await GapContract_1.GapContract.multiAttest(signer, approvalPayloads.map((p) => p[1]), callback);
|
|
103
|
+
// Save the first approval to this milestone instance
|
|
104
|
+
if (result.uids.length > 0) {
|
|
105
|
+
this.approved = new attestations_1.MilestoneCompleted({
|
|
106
|
+
data: {
|
|
107
|
+
type: "approved",
|
|
108
|
+
...data,
|
|
109
|
+
},
|
|
110
|
+
refUID: milestoneUIDs[0],
|
|
111
|
+
uid: result.uids[0],
|
|
112
|
+
schema,
|
|
113
|
+
recipient: this.recipient,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
48
118
|
/**
|
|
49
119
|
* Revokes the approved status of the milestone. If the milestone is not approved,
|
|
50
120
|
* it will throw an error.
|
|
@@ -99,6 +169,42 @@ class Milestone extends Attestation_1.Attestation {
|
|
|
99
169
|
]);
|
|
100
170
|
return { tx, uids };
|
|
101
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Revokes multiple milestone attestations at once.
|
|
174
|
+
* This method can be used to revoke multiple milestone attestations in a single transaction.
|
|
175
|
+
*
|
|
176
|
+
* @param signer - The signer to use for revocation
|
|
177
|
+
* @param attestationsToRevoke - Array of objects containing schemaId and uid of attestations to revoke
|
|
178
|
+
* @param callback - Optional callback function for status updates
|
|
179
|
+
* @returns Promise with transaction and UIDs of revoked attestations
|
|
180
|
+
*/
|
|
181
|
+
async revokeMultipleAttestations(signer, attestationsToRevoke, callback) {
|
|
182
|
+
if (attestationsToRevoke.length === 0) {
|
|
183
|
+
throw new SchemaError_1.AttestationError("ATTEST_ERROR", "No attestations specified for revocation");
|
|
184
|
+
}
|
|
185
|
+
// Group the attestations by schema ID
|
|
186
|
+
const groupedAttestations = attestationsToRevoke.reduce((acc, { schemaId, uid }) => {
|
|
187
|
+
if (!acc[schemaId]) {
|
|
188
|
+
acc[schemaId] = [];
|
|
189
|
+
}
|
|
190
|
+
acc[schemaId].push(uid);
|
|
191
|
+
return acc;
|
|
192
|
+
}, {});
|
|
193
|
+
// Convert to the format expected by GapContract.multiRevoke
|
|
194
|
+
const revocationPayload = Object.entries(groupedAttestations).map(([schemaId, uids]) => ({
|
|
195
|
+
schema: schemaId,
|
|
196
|
+
data: uids.map((uid) => ({
|
|
197
|
+
uid,
|
|
198
|
+
value: 0n, // EAS contract requires a value field as BigInt
|
|
199
|
+
})),
|
|
200
|
+
}));
|
|
201
|
+
// Use GapContract.multiRevoke directly with the correct payload format
|
|
202
|
+
const result = await GapContract_1.GapContract.multiRevoke(signer, revocationPayload);
|
|
203
|
+
if (callback) {
|
|
204
|
+
callback("confirmed");
|
|
205
|
+
}
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
102
208
|
/**
|
|
103
209
|
* Marks a milestone as completed. If the milestone is already completed,
|
|
104
210
|
* it will throw an error.
|
|
@@ -130,6 +236,87 @@ class Milestone extends Attestation_1.Attestation {
|
|
|
130
236
|
});
|
|
131
237
|
return { tx, uids };
|
|
132
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* Marks a milestone as completed across multiple grants. If the milestone is already completed,
|
|
241
|
+
* it will throw an error.
|
|
242
|
+
* @param signer - The signer to use for attestation
|
|
243
|
+
* @param grantIndices - Array of grant indices to attest this milestone to, or array of milestone UIDs
|
|
244
|
+
* @param data - Optional completion data
|
|
245
|
+
* @param callback - Optional callback function for status updates
|
|
246
|
+
* @returns Promise with transaction and UIDs
|
|
247
|
+
*/
|
|
248
|
+
async completeForMultipleGrants(signer, grantIndicesOrMilestoneUIDs = [0], data, callback) {
|
|
249
|
+
// Check if we're dealing with UIDs instead of indices
|
|
250
|
+
const isUids = grantIndicesOrMilestoneUIDs.length > 0 &&
|
|
251
|
+
typeof grantIndicesOrMilestoneUIDs[0] === "string";
|
|
252
|
+
let milestoneUIDs = [];
|
|
253
|
+
if (isUids) {
|
|
254
|
+
// We already have milestone UIDs
|
|
255
|
+
milestoneUIDs = grantIndicesOrMilestoneUIDs;
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
// First attest the milestone to multiple grants if not already attested
|
|
259
|
+
const attestResult = await this.attestToMultipleGrants(signer, grantIndicesOrMilestoneUIDs, callback);
|
|
260
|
+
milestoneUIDs = attestResult.uids;
|
|
261
|
+
}
|
|
262
|
+
// Now complete the milestone for each attested milestone
|
|
263
|
+
const schema = this.schema.gap.findSchema("MilestoneCompleted");
|
|
264
|
+
if (this.schema.isJsonSchema()) {
|
|
265
|
+
schema.setValue("json", JSON.stringify({
|
|
266
|
+
type: "completed",
|
|
267
|
+
...data,
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
schema.setValue("type", "completed");
|
|
272
|
+
schema.setValue("reason", data?.reason || "");
|
|
273
|
+
schema.setValue("proofOfWork", data?.proofOfWork || "");
|
|
274
|
+
}
|
|
275
|
+
// Create completion attestations for each milestone
|
|
276
|
+
const completionPayloads = [];
|
|
277
|
+
for (let i = 0; i < milestoneUIDs.length; i++) {
|
|
278
|
+
const milestoneUID = milestoneUIDs[i];
|
|
279
|
+
// Only set this.uid if we're dealing with indices and need to update the current milestone
|
|
280
|
+
if (!isUids) {
|
|
281
|
+
this.uid = milestoneUID; // Set the current UID to the milestone being completed
|
|
282
|
+
}
|
|
283
|
+
const completed = new attestations_1.MilestoneCompleted({
|
|
284
|
+
data: {
|
|
285
|
+
type: "completed",
|
|
286
|
+
...data,
|
|
287
|
+
},
|
|
288
|
+
refUID: milestoneUID,
|
|
289
|
+
schema,
|
|
290
|
+
recipient: this.recipient,
|
|
291
|
+
});
|
|
292
|
+
// Add completed status to the payload
|
|
293
|
+
completionPayloads.push([completed, await completed.payloadFor(i)]);
|
|
294
|
+
}
|
|
295
|
+
// Attest all completions at once
|
|
296
|
+
const completionResult = await GapContract_1.GapContract.multiAttest(signer, completionPayloads.map((p) => p[1]), callback);
|
|
297
|
+
// Save the first completion to this milestone instance
|
|
298
|
+
if (completionResult.uids.length > 0 && !isUids) {
|
|
299
|
+
this.completed = new attestations_1.MilestoneCompleted({
|
|
300
|
+
data: {
|
|
301
|
+
type: "completed",
|
|
302
|
+
...data,
|
|
303
|
+
},
|
|
304
|
+
refUID: milestoneUIDs[0],
|
|
305
|
+
uid: completionResult.uids[0],
|
|
306
|
+
schema,
|
|
307
|
+
recipient: this.recipient,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
return isUids
|
|
311
|
+
? completionResult // If we're using UIDs directly, just return completion result
|
|
312
|
+
: {
|
|
313
|
+
tx: [
|
|
314
|
+
...(milestoneUIDs.length ? [{ hash: "" }] : []),
|
|
315
|
+
...completionResult.tx,
|
|
316
|
+
],
|
|
317
|
+
uids: [...milestoneUIDs, ...completionResult.uids],
|
|
318
|
+
};
|
|
319
|
+
}
|
|
133
320
|
/**
|
|
134
321
|
* Revokes the completed status of the milestone. If the milestone is not completed,
|
|
135
322
|
* it will throw an error.
|
|
@@ -176,6 +363,92 @@ class Milestone extends Attestation_1.Attestation {
|
|
|
176
363
|
}
|
|
177
364
|
return payload.slice(currentPayload.length, payload.length);
|
|
178
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* Creates the payload for a multi-attestation across multiple grants.
|
|
368
|
+
*
|
|
369
|
+
* This method allows for the same milestone to be attested to multiple grants
|
|
370
|
+
* in a single transaction.
|
|
371
|
+
*
|
|
372
|
+
* @param currentPayload - Current payload to append to
|
|
373
|
+
* @param grantIndices - Array of grant indices to attest this milestone to
|
|
374
|
+
* @returns The multi-attest payload with all grant attestations
|
|
375
|
+
*/
|
|
376
|
+
async multiGrantAttestPayload(currentPayload = [], grantIndices = [0]) {
|
|
377
|
+
this.assertPayload();
|
|
378
|
+
const payload = [...currentPayload];
|
|
379
|
+
const milestoneIndices = [];
|
|
380
|
+
// Create milestone attestation for each grant
|
|
381
|
+
for (const grantIdx of grantIndices) {
|
|
382
|
+
const milestoneIdx = payload.push([this, await this.payloadFor(grantIdx)]) - 1;
|
|
383
|
+
milestoneIndices.push(milestoneIdx);
|
|
384
|
+
}
|
|
385
|
+
// Add completed status if exists for each milestone
|
|
386
|
+
if (this.completed) {
|
|
387
|
+
for (const milestoneIdx of milestoneIndices) {
|
|
388
|
+
payload.push([
|
|
389
|
+
this.completed,
|
|
390
|
+
await this.completed.payloadFor(milestoneIdx),
|
|
391
|
+
]);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
// Add verifications if exist for each milestone
|
|
395
|
+
if (this.verified.length > 0) {
|
|
396
|
+
for (const milestoneIdx of milestoneIndices) {
|
|
397
|
+
await Promise.all(this.verified.map(async (m) => {
|
|
398
|
+
const payloadForMilestone = await m.payloadFor(milestoneIdx);
|
|
399
|
+
if (Array.isArray(payloadForMilestone)) {
|
|
400
|
+
payloadForMilestone.forEach((item) => payload.push(item));
|
|
401
|
+
}
|
|
402
|
+
}));
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return payload.slice(currentPayload.length, payload.length);
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Attests this milestone to multiple grants in a single transaction.
|
|
409
|
+
*
|
|
410
|
+
* @param signer - The signer to use for attestation
|
|
411
|
+
* @param grantIndices - Array of grant indices to attest this milestone to, or array of grant UIDs
|
|
412
|
+
* @param callback - Optional callback function for status updates
|
|
413
|
+
* @returns Promise with transaction and UIDs
|
|
414
|
+
*/
|
|
415
|
+
async attestToMultipleGrants(signer, grantIndices = [0], callback) {
|
|
416
|
+
this.assertPayload();
|
|
417
|
+
// Check if we're dealing with Hex UIDs instead of indices
|
|
418
|
+
const isUids = grantIndices.length > 0 && typeof grantIndices[0] === "string";
|
|
419
|
+
if (isUids) {
|
|
420
|
+
// Direct approach - create individual milestone instances for each grant UID
|
|
421
|
+
const grantUIDs = grantIndices;
|
|
422
|
+
const allPayloads = [];
|
|
423
|
+
for (const grantUID of grantUIDs) {
|
|
424
|
+
// Create a new milestone for each grant with direct reference
|
|
425
|
+
const grantMilestone = new Milestone({
|
|
426
|
+
schema: this.schema,
|
|
427
|
+
recipient: this.recipient,
|
|
428
|
+
data: this.data,
|
|
429
|
+
refUID: grantUID,
|
|
430
|
+
});
|
|
431
|
+
// Generate payload for this grant
|
|
432
|
+
const payload = await grantMilestone.multiAttestPayload();
|
|
433
|
+
// Add each item from payload to allPayloads
|
|
434
|
+
payload.forEach((item) => allPayloads.push(item));
|
|
435
|
+
}
|
|
436
|
+
// Attest all milestones in a single transaction
|
|
437
|
+
const result = await GapContract_1.GapContract.multiAttest(signer, allPayloads.map((p) => p[1]), callback);
|
|
438
|
+
return result;
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
// Original implementation using grantIndices
|
|
442
|
+
const payload = await this.multiGrantAttestPayload([], grantIndices);
|
|
443
|
+
const { uids, tx } = await GapContract_1.GapContract.multiAttest(signer, payload.map((p) => p[1]), callback);
|
|
444
|
+
if (Array.isArray(uids)) {
|
|
445
|
+
uids.forEach((uid, index) => {
|
|
446
|
+
payload[index][0].uid = uid;
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
return { tx, uids };
|
|
450
|
+
}
|
|
451
|
+
}
|
|
179
452
|
/**
|
|
180
453
|
* @inheritdoc
|
|
181
454
|
*/
|
|
@@ -318,5 +591,67 @@ class Milestone extends Attestation_1.Attestation {
|
|
|
318
591
|
}));
|
|
319
592
|
return { tx, uids };
|
|
320
593
|
}
|
|
594
|
+
/**
|
|
595
|
+
* Verifies this milestone across multiple grants. If the milestones are not completed,
|
|
596
|
+
* it will throw an error.
|
|
597
|
+
* @param signer - The signer to use for attestation
|
|
598
|
+
* @param milestoneUIDs - Array of milestone UIDs to verify
|
|
599
|
+
* @param data - Optional verification data
|
|
600
|
+
* @param callback - Optional callback function for status updates
|
|
601
|
+
* @returns Promise with transaction and UIDs
|
|
602
|
+
*/
|
|
603
|
+
async verifyMultipleGrants(signer, milestoneUIDs, data, callback) {
|
|
604
|
+
// Validate that all milestones are completed
|
|
605
|
+
if (!this.completed)
|
|
606
|
+
throw new SchemaError_1.AttestationError("ATTEST_ERROR", "Milestone is not completed");
|
|
607
|
+
const schema = this.schema.gap.findSchema("MilestoneCompleted");
|
|
608
|
+
if (this.schema.isJsonSchema()) {
|
|
609
|
+
schema.setValue("json", JSON.stringify({
|
|
610
|
+
type: "verified",
|
|
611
|
+
...data,
|
|
612
|
+
}));
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
schema.setValue("type", "verified");
|
|
616
|
+
schema.setValue("reason", data?.reason || "");
|
|
617
|
+
schema.setValue("proofOfWork", data?.proofOfWork || "");
|
|
618
|
+
}
|
|
619
|
+
// Create verification attestations for each milestone
|
|
620
|
+
const verificationPayloads = [];
|
|
621
|
+
for (const milestoneUID of milestoneUIDs) {
|
|
622
|
+
const verified = new attestations_1.MilestoneCompleted({
|
|
623
|
+
data: {
|
|
624
|
+
type: "verified",
|
|
625
|
+
...data,
|
|
626
|
+
},
|
|
627
|
+
refUID: milestoneUID,
|
|
628
|
+
schema,
|
|
629
|
+
recipient: this.recipient,
|
|
630
|
+
});
|
|
631
|
+
// Add verification to the payload
|
|
632
|
+
verificationPayloads.push([
|
|
633
|
+
verified,
|
|
634
|
+
await verified.payloadFor(0), // Index doesn't matter for verification
|
|
635
|
+
]);
|
|
636
|
+
}
|
|
637
|
+
// Attest all verifications at once
|
|
638
|
+
const result = await GapContract_1.GapContract.multiAttest(signer, verificationPayloads.map((p) => p[1]), callback);
|
|
639
|
+
// Save the verifications to this milestone instance
|
|
640
|
+
if (result.uids.length > 0) {
|
|
641
|
+
for (let i = 0; i < result.uids.length; i++) {
|
|
642
|
+
this.verified.push(new attestations_1.MilestoneCompleted({
|
|
643
|
+
data: {
|
|
644
|
+
type: "verified",
|
|
645
|
+
...data,
|
|
646
|
+
},
|
|
647
|
+
refUID: milestoneUIDs[i],
|
|
648
|
+
uid: result.uids[i],
|
|
649
|
+
schema,
|
|
650
|
+
recipient: this.recipient,
|
|
651
|
+
}));
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
return result;
|
|
655
|
+
}
|
|
321
656
|
}
|
|
322
657
|
exports.Milestone = Milestone;
|
|
@@ -206,13 +206,14 @@ class Project extends Attestation_1.Attestation {
|
|
|
206
206
|
this.members.splice(0, this.members.length);
|
|
207
207
|
}
|
|
208
208
|
static from(attestations, network) {
|
|
209
|
+
const allSchemas = new AllGapSchemas_1.AllGapSchemas();
|
|
209
210
|
return attestations.map((attestation) => {
|
|
210
211
|
const project = new Project({
|
|
211
212
|
...attestation,
|
|
212
213
|
data: {
|
|
213
214
|
project: true,
|
|
214
215
|
},
|
|
215
|
-
schema:
|
|
216
|
+
schema: allSchemas.findSchema("Project", consts_1.chainIdToNetwork[attestation.chainID]),
|
|
216
217
|
chainID: attestation.chainID,
|
|
217
218
|
});
|
|
218
219
|
if (attestation.details) {
|
|
@@ -222,7 +223,7 @@ class Project extends Attestation_1.Attestation {
|
|
|
222
223
|
data: {
|
|
223
224
|
...details.data,
|
|
224
225
|
},
|
|
225
|
-
schema:
|
|
226
|
+
schema: allSchemas.findSchema("ProjectDetails", consts_1.chainIdToNetwork[attestation.chainID]),
|
|
226
227
|
chainID: attestation.chainID,
|
|
227
228
|
});
|
|
228
229
|
project.details.links = details.data.links || [];
|
|
@@ -241,7 +242,7 @@ class Project extends Attestation_1.Attestation {
|
|
|
241
242
|
data: {
|
|
242
243
|
memberOf: true,
|
|
243
244
|
},
|
|
244
|
-
schema:
|
|
245
|
+
schema: allSchemas.findSchema("MemberOf", consts_1.chainIdToNetwork[attestation.chainID]),
|
|
245
246
|
chainID: attestation.chainID,
|
|
246
247
|
});
|
|
247
248
|
if (m.details) {
|
|
@@ -251,7 +252,7 @@ class Project extends Attestation_1.Attestation {
|
|
|
251
252
|
data: {
|
|
252
253
|
...details.data,
|
|
253
254
|
},
|
|
254
|
-
schema:
|
|
255
|
+
schema: allSchemas.findSchema("MemberDetails", consts_1.chainIdToNetwork[attestation.chainID]),
|
|
255
256
|
chainID: attestation.chainID,
|
|
256
257
|
});
|
|
257
258
|
}
|
|
@@ -280,7 +281,7 @@ class Project extends Attestation_1.Attestation {
|
|
|
280
281
|
data: {
|
|
281
282
|
...pi.data,
|
|
282
283
|
},
|
|
283
|
-
schema:
|
|
284
|
+
schema: allSchemas.findSchema("ProjectDetails", consts_1.chainIdToNetwork[attestation.chainID]),
|
|
284
285
|
chainID: attestation.chainID,
|
|
285
286
|
});
|
|
286
287
|
return endorsement;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TNetwork } from "core/types";
|
|
2
|
+
import { ITrackResponse } from "../karma-indexer/api/types";
|
|
3
|
+
export declare class Track {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
communityUID: string;
|
|
8
|
+
isArchived: boolean;
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
updatedAt: Date;
|
|
11
|
+
programId?: string;
|
|
12
|
+
isActive?: boolean;
|
|
13
|
+
network: TNetwork;
|
|
14
|
+
constructor(data: any, network: TNetwork);
|
|
15
|
+
static from(data: ITrackResponse[], network: TNetwork): Track[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Track = void 0;
|
|
4
|
+
class Track {
|
|
5
|
+
constructor(data, network) {
|
|
6
|
+
this.id = data.id;
|
|
7
|
+
this.name = data.name;
|
|
8
|
+
this.description = data.description;
|
|
9
|
+
this.communityUID = data.communityUID;
|
|
10
|
+
this.isArchived = data.isArchived ?? false;
|
|
11
|
+
this.createdAt = new Date(data.createdAt);
|
|
12
|
+
this.updatedAt = new Date(data.updatedAt);
|
|
13
|
+
this.programId = data.programId;
|
|
14
|
+
this.isActive = data.isActive;
|
|
15
|
+
this.network = network;
|
|
16
|
+
}
|
|
17
|
+
static from(data, network) {
|
|
18
|
+
return data.map((item) => new Track(item, network));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.Track = Track;
|
|
@@ -2,7 +2,7 @@ import { TSchemaName, IAttestation, Hex } from "core/types";
|
|
|
2
2
|
import { Attestation } from "../Attestation";
|
|
3
3
|
import { GapSchema } from "../GapSchema";
|
|
4
4
|
import { Fetcher } from "../Fetcher";
|
|
5
|
-
import { Community, Project, Grant, Milestone, MemberOf } from "../entities";
|
|
5
|
+
import { Community, Project, Grant, Milestone, MemberOf, Track } from "../entities";
|
|
6
6
|
import { Grantee } from "../types/attestations";
|
|
7
7
|
import { ICommunityAdminsResponse } from "./api/types";
|
|
8
8
|
import { ProjectMilestone } from "../entities/ProjectMilestone";
|
|
@@ -40,4 +40,27 @@ export declare class GapIndexerClient extends Fetcher {
|
|
|
40
40
|
milestonesOf(grants: Grant[]): Promise<Milestone[]>;
|
|
41
41
|
membersOf(projects: Project[]): Promise<MemberOf[]>;
|
|
42
42
|
slugExists(slug: string): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Track related methods
|
|
45
|
+
*/
|
|
46
|
+
getTracks(communityUID: string, includeArchived?: boolean): Promise<Track[]>;
|
|
47
|
+
getTrackById(id: string): Promise<Track>;
|
|
48
|
+
createTrack(trackData: {
|
|
49
|
+
name: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
communityUID: string;
|
|
52
|
+
}): Promise<Track>;
|
|
53
|
+
updateTrack(id: string, trackData: {
|
|
54
|
+
name?: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
communityUID?: string;
|
|
57
|
+
}): Promise<Track>;
|
|
58
|
+
archiveTrack(id: string): Promise<Track>;
|
|
59
|
+
assignTracksToProgram(programId: string, trackIds: string[]): Promise<any[]>;
|
|
60
|
+
unassignTrackFromProgram(programId: string, trackId: string): Promise<any>;
|
|
61
|
+
getTracksForProgram(programId: string): Promise<Track[]>;
|
|
62
|
+
getTracksForProject(projectId: string, programId: string, activeOnly?: boolean): Promise<Track[]>;
|
|
63
|
+
assignTracksToProject(projectId: string, programId: string, trackIds: string[]): Promise<any[]>;
|
|
64
|
+
unassignTracksFromProject(projectId: string, programId: string, trackIds: string[]): Promise<any[]>;
|
|
65
|
+
getProjectsByTrack(communityId: string, programId: string, trackId?: string): Promise<any[]>;
|
|
43
66
|
}
|
|
@@ -152,5 +152,56 @@ class GapIndexerClient extends Fetcher_1.Fetcher {
|
|
|
152
152
|
async slugExists(slug) {
|
|
153
153
|
return await this.apiClient.slugExists(slug);
|
|
154
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Track related methods
|
|
157
|
+
*/
|
|
158
|
+
async getTracks(communityUID, includeArchived = false) {
|
|
159
|
+
const { data } = await this.apiClient.getTracks(communityUID, includeArchived);
|
|
160
|
+
return entities_1.Track.from(data, this.gap.network);
|
|
161
|
+
}
|
|
162
|
+
async getTrackById(id) {
|
|
163
|
+
const { data } = await this.apiClient.getTrackById(id);
|
|
164
|
+
return entities_1.Track.from([data], this.gap.network)[0];
|
|
165
|
+
}
|
|
166
|
+
async createTrack(trackData) {
|
|
167
|
+
const { data } = await this.apiClient.createTrack(trackData);
|
|
168
|
+
return entities_1.Track.from([data], this.gap.network)[0];
|
|
169
|
+
}
|
|
170
|
+
async updateTrack(id, trackData) {
|
|
171
|
+
const { data } = await this.apiClient.updateTrack(id, trackData);
|
|
172
|
+
return entities_1.Track.from([data], this.gap.network)[0];
|
|
173
|
+
}
|
|
174
|
+
async archiveTrack(id) {
|
|
175
|
+
const { data } = await this.apiClient.archiveTrack(id);
|
|
176
|
+
return entities_1.Track.from([data], this.gap.network)[0];
|
|
177
|
+
}
|
|
178
|
+
async assignTracksToProgram(programId, trackIds) {
|
|
179
|
+
const { data } = await this.apiClient.assignTracksToProgram(programId, trackIds);
|
|
180
|
+
return data;
|
|
181
|
+
}
|
|
182
|
+
async unassignTrackFromProgram(programId, trackId) {
|
|
183
|
+
const { data } = await this.apiClient.unassignTrackFromProgram(programId, trackId);
|
|
184
|
+
return data;
|
|
185
|
+
}
|
|
186
|
+
async getTracksForProgram(programId) {
|
|
187
|
+
const { data } = await this.apiClient.getTracksForProgram(programId);
|
|
188
|
+
return entities_1.Track.from(data, this.gap.network);
|
|
189
|
+
}
|
|
190
|
+
async getTracksForProject(projectId, programId, activeOnly = true) {
|
|
191
|
+
const { data } = await this.apiClient.getTracksForProject(projectId, programId, activeOnly);
|
|
192
|
+
return entities_1.Track.from(data, this.gap.network);
|
|
193
|
+
}
|
|
194
|
+
async assignTracksToProject(projectId, programId, trackIds) {
|
|
195
|
+
const { data } = await this.apiClient.assignTracksToProject(projectId, programId, trackIds);
|
|
196
|
+
return data;
|
|
197
|
+
}
|
|
198
|
+
async unassignTracksFromProject(projectId, programId, trackIds) {
|
|
199
|
+
const { data } = await this.apiClient.unassignTracksFromProject(projectId, programId, trackIds);
|
|
200
|
+
return data;
|
|
201
|
+
}
|
|
202
|
+
async getProjectsByTrack(communityId, programId, trackId) {
|
|
203
|
+
const { data } = await this.apiClient.getProjectsByTrack(communityId, programId, trackId);
|
|
204
|
+
return data;
|
|
205
|
+
}
|
|
155
206
|
}
|
|
156
207
|
exports.GapIndexerClient = GapIndexerClient;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosGQL } from "../../GraphQL/AxiosGQL";
|
|
2
|
-
import { Hex, IAttestationResponse, ICommunityResponse, ICommunityAdminsResponse, IGrantResponse, IProjectResponse, ISearchResponse, IProjectMilestoneResponse } from "./types";
|
|
2
|
+
import { Hex, IAttestationResponse, ICommunityResponse, ICommunityAdminsResponse, IGrantResponse, IProjectResponse, ISearchResponse, IProjectMilestoneResponse, ITrackResponse, ITrackAssignmentResponse, IProjectTrackResponse } from "./types";
|
|
3
3
|
export declare class GapIndexerApi extends AxiosGQL {
|
|
4
4
|
constructor(url: string);
|
|
5
5
|
attestation(uid: Hex): Promise<import("axios").AxiosResponse<IAttestationResponse, any>>;
|
|
@@ -47,4 +47,27 @@ export declare class GapIndexerApi extends AxiosGQL {
|
|
|
47
47
|
*/
|
|
48
48
|
milestonesOf(uid: Hex): Promise<import("axios").AxiosResponse<any, any>>;
|
|
49
49
|
slugExists(slug: string): Promise<boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* Tracks
|
|
52
|
+
*/
|
|
53
|
+
getTracks(communityUID: string, includeArchived?: boolean): Promise<import("axios").AxiosResponse<ITrackResponse[], any>>;
|
|
54
|
+
getTrackById(id: string): Promise<import("axios").AxiosResponse<ITrackResponse, any>>;
|
|
55
|
+
createTrack(data: {
|
|
56
|
+
name: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
communityUID: string;
|
|
59
|
+
}): Promise<import("axios").AxiosResponse<ITrackResponse, any>>;
|
|
60
|
+
updateTrack(id: string, data: {
|
|
61
|
+
name?: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
communityUID?: string;
|
|
64
|
+
}): Promise<import("axios").AxiosResponse<ITrackResponse, any>>;
|
|
65
|
+
archiveTrack(id: string): Promise<import("axios").AxiosResponse<ITrackResponse, any>>;
|
|
66
|
+
assignTracksToProgram(programId: string, trackIds: string[]): Promise<import("axios").AxiosResponse<ITrackAssignmentResponse[], any>>;
|
|
67
|
+
unassignTrackFromProgram(programId: string, trackId: string): Promise<import("axios").AxiosResponse<ITrackAssignmentResponse, any>>;
|
|
68
|
+
getTracksForProgram(programId: string): Promise<import("axios").AxiosResponse<ITrackResponse[], any>>;
|
|
69
|
+
getTracksForProject(projectId: string, programId: string, activeOnly?: boolean): Promise<import("axios").AxiosResponse<ITrackResponse[], any>>;
|
|
70
|
+
assignTracksToProject(projectId: string, programId: string, trackIds: string[]): Promise<import("axios").AxiosResponse<any[], any>>;
|
|
71
|
+
unassignTracksFromProject(projectId: string, programId: string, trackIds: string[]): Promise<import("axios").AxiosResponse<any[], any>>;
|
|
72
|
+
getProjectsByTrack(communityId: string, programId: string, trackId?: string): Promise<import("axios").AxiosResponse<IProjectTrackResponse[], any>>;
|
|
50
73
|
}
|
|
@@ -28,6 +28,7 @@ const Endpoints = {
|
|
|
28
28
|
},
|
|
29
29
|
project: {
|
|
30
30
|
all: () => "/projects",
|
|
31
|
+
checkSlug: (slug) => `/projects/check-slug/${slug}`,
|
|
31
32
|
byUidOrSlug: (uidOrSlug) => `/projects/${uidOrSlug}`,
|
|
32
33
|
grants: (uidOrSlug) => `/projects/${uidOrSlug}/grants`,
|
|
33
34
|
milestones: (uidOrSlug) => `/projects/${uidOrSlug}/milestones`,
|
|
@@ -36,6 +37,26 @@ const Endpoints = {
|
|
|
36
37
|
search: {
|
|
37
38
|
all: () => "/search",
|
|
38
39
|
},
|
|
40
|
+
tracks: {
|
|
41
|
+
all: () => "/tracks",
|
|
42
|
+
byId: (id) => `/tracks/${id}`,
|
|
43
|
+
byCommunity: (communityUID, includeArchived = false) => `/tracks?communityUID=${communityUID}${includeArchived ? "&includeArchived=true" : ""}`,
|
|
44
|
+
},
|
|
45
|
+
programs: {
|
|
46
|
+
tracks: {
|
|
47
|
+
all: (programId) => `/programs/${programId}/tracks`,
|
|
48
|
+
assign: (programId) => `/programs/${programId}/tracks`,
|
|
49
|
+
remove: (programId, trackId) => `/programs/${programId}/tracks/${trackId}`,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
projectTracks: {
|
|
53
|
+
all: (projectId, programId, activeOnly = true) => `/programs/${programId}/projects/${projectId}/tracks${activeOnly ? "" : "?activeOnly=false"}`,
|
|
54
|
+
assign: (projectId) => `/projects/${projectId}/tracks`,
|
|
55
|
+
remove: (programId, projectId) => `/programs/${programId}/project/${projectId}/tracks`,
|
|
56
|
+
},
|
|
57
|
+
community: {
|
|
58
|
+
programProjects: (communityId, programId, trackId) => `/community/${communityId}/program/${programId}/projects${trackId ? `?trackId=${trackId}` : ""}`,
|
|
59
|
+
},
|
|
39
60
|
};
|
|
40
61
|
class GapIndexerApi extends AxiosGQL_1.AxiosGQL {
|
|
41
62
|
constructor(url) {
|
|
@@ -173,12 +194,63 @@ class GapIndexerApi extends AxiosGQL_1.AxiosGQL {
|
|
|
173
194
|
}
|
|
174
195
|
async slugExists(slug) {
|
|
175
196
|
try {
|
|
176
|
-
await this.client.get(Endpoints.project.
|
|
197
|
+
await this.client.get(Endpoints.project.checkSlug(slug));
|
|
177
198
|
return true;
|
|
178
199
|
}
|
|
179
200
|
catch (err) {
|
|
180
201
|
return false;
|
|
181
202
|
}
|
|
182
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Tracks
|
|
206
|
+
*/
|
|
207
|
+
async getTracks(communityUID, includeArchived = false) {
|
|
208
|
+
const response = await this.client.get(Endpoints.tracks.byCommunity(communityUID, includeArchived));
|
|
209
|
+
return response;
|
|
210
|
+
}
|
|
211
|
+
async getTrackById(id) {
|
|
212
|
+
const response = await this.client.get(Endpoints.tracks.byId(id));
|
|
213
|
+
return response;
|
|
214
|
+
}
|
|
215
|
+
async createTrack(data) {
|
|
216
|
+
const response = await this.client.post(Endpoints.tracks.all(), data);
|
|
217
|
+
return response;
|
|
218
|
+
}
|
|
219
|
+
async updateTrack(id, data) {
|
|
220
|
+
const response = await this.client.put(Endpoints.tracks.byId(id), data);
|
|
221
|
+
return response;
|
|
222
|
+
}
|
|
223
|
+
async archiveTrack(id) {
|
|
224
|
+
const response = await this.client.delete(Endpoints.tracks.byId(id));
|
|
225
|
+
return response;
|
|
226
|
+
}
|
|
227
|
+
async assignTracksToProgram(programId, trackIds) {
|
|
228
|
+
const response = await this.client.post(Endpoints.programs.tracks.assign(programId), { trackIds });
|
|
229
|
+
return response;
|
|
230
|
+
}
|
|
231
|
+
async unassignTrackFromProgram(programId, trackId) {
|
|
232
|
+
const response = await this.client.delete(Endpoints.programs.tracks.remove(programId, trackId));
|
|
233
|
+
return response;
|
|
234
|
+
}
|
|
235
|
+
async getTracksForProgram(programId) {
|
|
236
|
+
const response = await this.client.get(Endpoints.programs.tracks.all(programId));
|
|
237
|
+
return response;
|
|
238
|
+
}
|
|
239
|
+
async getTracksForProject(projectId, programId, activeOnly = true) {
|
|
240
|
+
const response = await this.client.get(Endpoints.projectTracks.all(projectId, programId, activeOnly));
|
|
241
|
+
return response;
|
|
242
|
+
}
|
|
243
|
+
async assignTracksToProject(projectId, programId, trackIds) {
|
|
244
|
+
const response = await this.client.post(Endpoints.projectTracks.assign(projectId), { trackIds, programId });
|
|
245
|
+
return response;
|
|
246
|
+
}
|
|
247
|
+
async unassignTracksFromProject(projectId, programId, trackIds) {
|
|
248
|
+
const response = await this.client.delete(Endpoints.projectTracks.remove(programId, projectId), { data: { trackIds } });
|
|
249
|
+
return response;
|
|
250
|
+
}
|
|
251
|
+
async getProjectsByTrack(communityId, programId, trackId) {
|
|
252
|
+
const response = await this.client.get(Endpoints.community.programProjects(communityId, programId, trackId));
|
|
253
|
+
return response;
|
|
254
|
+
}
|
|
183
255
|
}
|
|
184
256
|
exports.GapIndexerApi = GapIndexerApi;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IGrantUpdateBase } from "core/shared/types";
|
|
1
2
|
export type Hex = `0x${string}`;
|
|
2
3
|
export type JSONStr = string;
|
|
3
4
|
export type ExternalLink = {
|
|
@@ -63,11 +64,8 @@ export interface IGrantUpdateStatus extends IAttestationResponse {
|
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
export interface IGrantUpdate extends IAttestationResponse {
|
|
66
|
-
data: {
|
|
67
|
-
text: string;
|
|
68
|
-
title: string;
|
|
67
|
+
data: IGrantUpdateBase & {
|
|
69
68
|
type: "grant-update";
|
|
70
|
-
proofOfWork?: string;
|
|
71
69
|
};
|
|
72
70
|
verified?: IGrantUpdateStatus[];
|
|
73
71
|
}
|
|
@@ -140,6 +138,7 @@ export interface IGrantDetails extends IAttestationResponse {
|
|
|
140
138
|
programId?: string;
|
|
141
139
|
type: "grant-details";
|
|
142
140
|
fundUsage?: string;
|
|
141
|
+
selectedTrackIds?: string[];
|
|
143
142
|
};
|
|
144
143
|
}
|
|
145
144
|
export interface IGrantResponse extends IAttestationResponse {
|
|
@@ -150,7 +149,7 @@ export interface IGrantResponse extends IAttestationResponse {
|
|
|
150
149
|
details?: IGrantDetails;
|
|
151
150
|
milestones: IMilestoneResponse[];
|
|
152
151
|
completed?: IGrantUpdate;
|
|
153
|
-
project:
|
|
152
|
+
project: IProjectResponse;
|
|
154
153
|
updates: IGrantUpdate[];
|
|
155
154
|
community: ICommunityResponse;
|
|
156
155
|
members: Hex[];
|
|
@@ -263,4 +262,34 @@ export interface ISearchResponse {
|
|
|
263
262
|
projects: IProjectResponse[];
|
|
264
263
|
communities: ICommunityResponse[];
|
|
265
264
|
}
|
|
265
|
+
export interface ITrackResponse {
|
|
266
|
+
id: string;
|
|
267
|
+
name: string;
|
|
268
|
+
description?: string;
|
|
269
|
+
communityUID: string;
|
|
270
|
+
isArchived: boolean;
|
|
271
|
+
createdAt: string;
|
|
272
|
+
updatedAt: string;
|
|
273
|
+
programId?: string;
|
|
274
|
+
isActive?: boolean;
|
|
275
|
+
chainID?: number;
|
|
276
|
+
}
|
|
277
|
+
export interface ITrackAssignmentResponse {
|
|
278
|
+
id: string;
|
|
279
|
+
programId: string;
|
|
280
|
+
chainID: number;
|
|
281
|
+
trackId: string;
|
|
282
|
+
track: ITrackResponse;
|
|
283
|
+
}
|
|
284
|
+
export interface IProjectTrackResponse {
|
|
285
|
+
projectUID: string;
|
|
286
|
+
chainID: number;
|
|
287
|
+
programId: string;
|
|
288
|
+
track: ITrackResponse;
|
|
289
|
+
project: {
|
|
290
|
+
uid: string;
|
|
291
|
+
chainID: number;
|
|
292
|
+
details: any;
|
|
293
|
+
};
|
|
294
|
+
}
|
|
266
295
|
export {};
|
|
@@ -45,6 +45,7 @@ export interface IGrantDetails {
|
|
|
45
45
|
startDate?: number;
|
|
46
46
|
programId?: string;
|
|
47
47
|
fundUsage?: string;
|
|
48
|
+
selectedTrackIds?: string[];
|
|
48
49
|
}
|
|
49
50
|
export declare class GrantDetails extends Attestation<IGrantDetails> implements IGrantDetails {
|
|
50
51
|
title: string;
|
|
@@ -60,6 +61,7 @@ export declare class GrantDetails extends Attestation<IGrantDetails> implements
|
|
|
60
61
|
type: string;
|
|
61
62
|
startDate?: number;
|
|
62
63
|
fundUsage?: string;
|
|
64
|
+
selectedTrackIds?: string[];
|
|
63
65
|
}
|
|
64
66
|
export interface IGrantRound {
|
|
65
67
|
name: string;
|
package/core/consts.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const chainIdToNetwork: {
|
|
|
13
13
|
42220: string;
|
|
14
14
|
1328: string;
|
|
15
15
|
1329: string;
|
|
16
|
+
1135: string;
|
|
16
17
|
};
|
|
17
18
|
export declare const nullRef = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
18
19
|
export declare const nullResolver = "0x0000000000000000000000000000000000000000";
|
package/core/consts.js
CHANGED
|
@@ -26,6 +26,7 @@ exports.chainIdToNetwork = {
|
|
|
26
26
|
42220: "celo",
|
|
27
27
|
1328: "sei-testnet",
|
|
28
28
|
1329: "sei",
|
|
29
|
+
1135: "lisk",
|
|
29
30
|
};
|
|
30
31
|
exports.nullRef = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
31
32
|
// TODO: Remove null resolver and change usage to zero address
|
|
@@ -396,6 +397,34 @@ exports.Networks = {
|
|
|
396
397
|
ContributorProfile: "0x"
|
|
397
398
|
},
|
|
398
399
|
},
|
|
400
|
+
lisk: {
|
|
401
|
+
chainId: 1135,
|
|
402
|
+
url: "https://arbitrum.easscan.org/graphql",
|
|
403
|
+
rpcUrl: "https://arb-mainnet.g.alchemy.com/v2/okcKBSKXvLuSCbas6QWGvKuh-IcHHSOr",
|
|
404
|
+
contracts: {
|
|
405
|
+
eas: "0x4200000000000000000000000000000000000021",
|
|
406
|
+
schema: "0x4200000000000000000000000000000000000020",
|
|
407
|
+
multicall: "0x28BE0b0515be8BB8822aF1467A6613795E74717b",
|
|
408
|
+
projectResolver: "0x6dC1D6b864e8BEf815806f9e4677123496e12026",
|
|
409
|
+
communityResolver: "0xfddb660F2F1C27d219372210745BB9f73431856E",
|
|
410
|
+
donations: "0x28BE0b0515be8BB8822aF1467A6613795E74717b",
|
|
411
|
+
airdropNFT: null,
|
|
412
|
+
},
|
|
413
|
+
schemas: {
|
|
414
|
+
Community: "0x3c2231024f4f17f3718b5bd9ed9ff29cc323dea5449f9ceba11a9888bfbdd0e1",
|
|
415
|
+
Details: "0x16bfe4783b7a9c743c401222c56a07ecb77ed42afc84b61ff1f62f5936c0b9d7",
|
|
416
|
+
Grant: "0xea02ab33f9f4c92ba02c9bb21614b7410b98c940a0d8eb8ad3a20204d8b4bda5",
|
|
417
|
+
GrantVerified: "0xd88faddf8df50a07a4130fbe2131354831261440b2ca695c4e9b8f2ca9985346",
|
|
418
|
+
MemberOf: "0x5f430aec9d04f0dcb3729775c5dfe10752e436469a7607f8c64ae44ef996e477",
|
|
419
|
+
MilestoneApproved: "0xd88faddf8df50a07a4130fbe2131354831261440b2ca695c4e9b8f2ca9985346",
|
|
420
|
+
MilestoneCompleted: "0xd88faddf8df50a07a4130fbe2131354831261440b2ca695c4e9b8f2ca9985346",
|
|
421
|
+
GrantUpdateStatus: "0xd88faddf8df50a07a4130fbe2131354831261440b2ca695c4e9b8f2ca9985346",
|
|
422
|
+
Project: "0xf3f753b41e04d1052b5a5ec7624d1dfdb6c2da288a985120e477ddbcac071022",
|
|
423
|
+
ProjectUpdateStatus: "0xd88faddf8df50a07a4130fbe2131354831261440b2ca695c4e9b8f2ca9985346",
|
|
424
|
+
ProjectMilestoneStatus: "0xd88faddf8df50a07a4130fbe2131354831261440b2ca695c4e9b8f2ca9985346",
|
|
425
|
+
ContributorProfile: "0x80f0701853e862d920f87e8ae5b359a1625ad417a9523af2ed12bc3504b04088"
|
|
426
|
+
},
|
|
427
|
+
},
|
|
399
428
|
};
|
|
400
429
|
const DetailsSchema = [{ type: "string", name: "json", value: null }];
|
|
401
430
|
/**
|
package/core/types.d.ts
CHANGED
|
@@ -29,8 +29,8 @@ export interface AttestArgs<T = unknown> {
|
|
|
29
29
|
}
|
|
30
30
|
export type TSchemaName = "Community" | "CommunityDetails" | "Grant" | "GrantDetails" | "GrantVerified" | "MemberOf" | "MemberDetails" | "Milestone" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "ProjectDetails" | "Details" | "ProjectImpact" | "ProjectUpdate" | "ProjectUpdateStatus" | "ProjectPointer" | "GrantUpdate" | "GrantUpdateStatus" | "ProjectEndorsement" | "ProjectMilestone" | "ProjectMilestoneStatus" | "ContributorProfile";
|
|
31
31
|
export type TResolvedSchemaNames = "Community" | "Grant" | "GrantVerified" | "MemberOf" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "Details" | "ProjectUpdateStatus" | "GrantUpdateStatus" | "ProjectUpdateStatus" | "ProjectMilestoneStatus" | "ContributorProfile";
|
|
32
|
-
export type TExternalLink = "twitter" | "github" | "website" | "linkedin" | "discord";
|
|
33
|
-
export type TNetwork = "optimism" | "celo" | "optimism-sepolia" | "arbitrum" | "sepolia" | "sei" | "sei-testnet" | "base-sepolia";
|
|
32
|
+
export type TExternalLink = "twitter" | "github" | "website" | "linkedin" | "discord" | "pitchDeck" | "demoVideo" | "farcaster";
|
|
33
|
+
export type TNetwork = "optimism" | "celo" | "optimism-sepolia" | "arbitrum" | "sepolia" | "sei" | "sei-testnet" | "base-sepolia" | "lisk";
|
|
34
34
|
/**
|
|
35
35
|
* Generic GAP Facade interface.
|
|
36
36
|
* This supplies the GAP class with the necessary properties.
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.4.
|
|
6
|
+
"version": "0.4.12",
|
|
7
7
|
"description": "Simple and easy interface between EAS and Karma GAP.",
|
|
8
8
|
"main": "./index.js",
|
|
9
9
|
"author": "KarmaHQ",
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"deploy": "npx ts-node ./core/scripts/deploy.ts",
|
|
18
18
|
"csv-upload": "npx ts-node ./csv-upload/scripts/run.ts",
|
|
19
|
+
"test-file": "npx ts-node ./test-file-indexer-api.ts",
|
|
20
|
+
"test-milestone": "npx ts-node ./milestone-workflow-example.ts",
|
|
19
21
|
"publish-npm": "npm version patch && tsc && cd .dist && npm publish --scope=@show-karma/karma-gap-sdk --access public"
|
|
20
22
|
},
|
|
21
23
|
"dependencies": {
|