@show-karma/karma-gap-sdk 0.3.29 → 0.3.31
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/GrantProgramRegistry/Allo.d.ts +2 -2
- package/core/class/GrantProgramRegistry/Allo.js +15 -0
- package/core/class/entities/ProjectImpact.d.ts +6 -4
- package/core/class/entities/ProjectImpact.js +14 -14
- package/core/class/karma-indexer/api/types.d.ts +2 -1
- package/core/consts.js +14 -8
- package/core/types.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ethers } from "ethers";
|
|
2
|
-
import { GrantArgs } from "../types/allo";
|
|
3
2
|
import { NFTStorage } from "nft.storage";
|
|
4
3
|
export declare class AlloBase {
|
|
5
4
|
private signer;
|
|
@@ -9,8 +8,9 @@ export declare class AlloBase {
|
|
|
9
8
|
constructor(signer: ethers.Signer, ipfsStorage: NFTStorage, chainId: number);
|
|
10
9
|
saveAndGetCID(data: any): Promise<import("nft.storage").CIDString>;
|
|
11
10
|
encodeStrategyInitData(applicationStart: number, applicationEnd: number, roundStart: number, roundEnd: number, payoutToken: string): Promise<string>;
|
|
12
|
-
createGrant(args:
|
|
11
|
+
createGrant(args: any): Promise<{
|
|
13
12
|
poolId: string;
|
|
14
13
|
txHash: string;
|
|
15
14
|
}>;
|
|
15
|
+
updatePoolMetadata(poolId: string, poolMetadata: any): Promise<any>;
|
|
16
16
|
}
|
|
@@ -82,5 +82,20 @@ class AlloBase {
|
|
|
82
82
|
console.error(`Failed to create pool: ${error}`);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
+
async updatePoolMetadata(poolId, poolMetadata) {
|
|
86
|
+
try {
|
|
87
|
+
const metadata_cid = await this.saveAndGetCID(poolMetadata);
|
|
88
|
+
const metadata = {
|
|
89
|
+
protocol: 1,
|
|
90
|
+
pointer: metadata_cid,
|
|
91
|
+
};
|
|
92
|
+
const tx = await this.contract.updatePoolMetadata(poolId, metadata);
|
|
93
|
+
const receipt = await tx.wait();
|
|
94
|
+
return receipt;
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.error(`Failed to update pool metadata: ${error}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
85
100
|
}
|
|
86
101
|
exports.AlloBase = AlloBase;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { SignerOrProvider, TNetwork } from
|
|
2
|
-
import { Attestation, AttestationArgs } from
|
|
3
|
-
import { GapSchema } from
|
|
1
|
+
import { SignerOrProvider, TNetwork } from "../../types";
|
|
2
|
+
import { Attestation, AttestationArgs } from "../Attestation";
|
|
3
|
+
import { GapSchema } from "../GapSchema";
|
|
4
4
|
export interface _IProjectImpact extends ProjectImpact {
|
|
5
5
|
}
|
|
6
|
-
type IStatus =
|
|
6
|
+
type IStatus = "verified";
|
|
7
7
|
export interface IProjectImpactStatus {
|
|
8
8
|
type: `project-impact-${IStatus}`;
|
|
9
9
|
reason?: string;
|
|
@@ -16,6 +16,7 @@ export interface IProjectImpact {
|
|
|
16
16
|
work: string;
|
|
17
17
|
impact: string;
|
|
18
18
|
proof: string;
|
|
19
|
+
startedAt?: number;
|
|
19
20
|
completedAt: number;
|
|
20
21
|
type?: string;
|
|
21
22
|
}
|
|
@@ -23,6 +24,7 @@ export declare class ProjectImpact extends Attestation<IProjectImpact> implement
|
|
|
23
24
|
work: string;
|
|
24
25
|
impact: string;
|
|
25
26
|
proof: string;
|
|
27
|
+
startedAt?: number;
|
|
26
28
|
completedAt: number;
|
|
27
29
|
type?: string;
|
|
28
30
|
verified: ProjectImpactStatus[];
|
|
@@ -31,15 +31,15 @@ class ProjectImpact extends Attestation_1.Attestation {
|
|
|
31
31
|
},
|
|
32
32
|
});
|
|
33
33
|
if (callback)
|
|
34
|
-
callback(
|
|
34
|
+
callback("pending");
|
|
35
35
|
const uid = await tx.wait();
|
|
36
36
|
if (callback)
|
|
37
|
-
callback(
|
|
37
|
+
callback("completed");
|
|
38
38
|
console.log(uid);
|
|
39
39
|
}
|
|
40
40
|
catch (error) {
|
|
41
41
|
console.error(error);
|
|
42
|
-
throw new SchemaError_1.AttestationError(
|
|
42
|
+
throw new SchemaError_1.AttestationError("ATTEST_ERROR", error.message);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
@@ -48,17 +48,17 @@ class ProjectImpact extends Attestation_1.Attestation {
|
|
|
48
48
|
* @param signer
|
|
49
49
|
* @param reason
|
|
50
50
|
*/
|
|
51
|
-
async verify(signer, reason =
|
|
52
|
-
console.log(
|
|
53
|
-
const schema = this.schema.gap.findSchema(
|
|
54
|
-
schema.setValue(
|
|
55
|
-
schema.setValue(
|
|
56
|
-
console.log(
|
|
51
|
+
async verify(signer, reason = "", callback) {
|
|
52
|
+
console.log("Verifying ProjectImpact");
|
|
53
|
+
const schema = this.schema.gap.findSchema("GrantUpdateStatus");
|
|
54
|
+
schema.setValue("type", "project-impact-verified");
|
|
55
|
+
schema.setValue("reason", reason);
|
|
56
|
+
console.log("Before attest project impact verified");
|
|
57
57
|
await this.attestStatus(signer, schema, callback);
|
|
58
|
-
console.log(
|
|
58
|
+
console.log("After attest project impact verified");
|
|
59
59
|
this.verified.push(new ProjectImpactStatus({
|
|
60
60
|
data: {
|
|
61
|
-
type:
|
|
61
|
+
type: "project-impact-verified",
|
|
62
62
|
reason,
|
|
63
63
|
},
|
|
64
64
|
refUID: this.uid,
|
|
@@ -73,16 +73,16 @@ class ProjectImpact extends Attestation_1.Attestation {
|
|
|
73
73
|
data: {
|
|
74
74
|
...attestation.data,
|
|
75
75
|
},
|
|
76
|
-
schema: new AllGapSchemas_1.AllGapSchemas().findSchema(
|
|
76
|
+
schema: new AllGapSchemas_1.AllGapSchemas().findSchema("ProjectImpact", consts_1.chainIdToNetwork[attestation.chainID]),
|
|
77
77
|
chainID: attestation.chainID,
|
|
78
78
|
});
|
|
79
79
|
if (attestation.verified?.length > 0) {
|
|
80
|
-
projectImpact.verified = attestation.verified.map(m => new ProjectImpactStatus({
|
|
80
|
+
projectImpact.verified = attestation.verified.map((m) => new ProjectImpactStatus({
|
|
81
81
|
...m,
|
|
82
82
|
data: {
|
|
83
83
|
...m.data,
|
|
84
84
|
},
|
|
85
|
-
schema: new AllGapSchemas_1.AllGapSchemas().findSchema(
|
|
85
|
+
schema: new AllGapSchemas_1.AllGapSchemas().findSchema("GrantUpdateStatus", consts_1.chainIdToNetwork[attestation.chainID]),
|
|
86
86
|
chainID: attestation.chainID,
|
|
87
87
|
}));
|
|
88
88
|
}
|
|
@@ -116,6 +116,7 @@ export interface IProjectImpact extends IAttestationResponse {
|
|
|
116
116
|
work: string;
|
|
117
117
|
impact: string;
|
|
118
118
|
proof: string;
|
|
119
|
+
startedAt?: number;
|
|
119
120
|
completedAt: number;
|
|
120
121
|
type: "project-impact";
|
|
121
122
|
};
|
|
@@ -124,7 +125,7 @@ export interface IProjectEndorsement extends IAttestationResponse {
|
|
|
124
125
|
type: "ProjectEndorsement";
|
|
125
126
|
data: {
|
|
126
127
|
comment?: string;
|
|
127
|
-
type?:
|
|
128
|
+
type?: "project-endorsement";
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
131
|
export interface IProjectResponse extends IAttestationResponse {
|
package/core/consts.js
CHANGED
|
@@ -13,12 +13,12 @@ exports.useDefaultAttestation = [
|
|
|
13
13
|
"GrantUpdateStatus",
|
|
14
14
|
];
|
|
15
15
|
exports.chainIdToNetwork = {
|
|
16
|
-
11155420:
|
|
17
|
-
42161:
|
|
18
|
-
10:
|
|
19
|
-
11155111:
|
|
20
|
-
84532:
|
|
21
|
-
42220:
|
|
16
|
+
11155420: "optimism-sepolia",
|
|
17
|
+
42161: "arbitrum",
|
|
18
|
+
10: "optimism",
|
|
19
|
+
11155111: "sepolia",
|
|
20
|
+
84532: "base-sepolia",
|
|
21
|
+
42220: "celo",
|
|
22
22
|
};
|
|
23
23
|
exports.nullRef = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
24
24
|
// TODO: Remove null resolver and change usage to zero address
|
|
@@ -39,6 +39,7 @@ exports.Networks = {
|
|
|
39
39
|
multicall: "0xd2eD366393FDfd243931Fe48e9fb65A192B0018c", //proxy,
|
|
40
40
|
projectResolver: "0x7177AdC0f924b695C0294A40C4C5FEFf5EE1E141",
|
|
41
41
|
communityResolver: "0x6dC1D6b864e8BEf815806f9e4677123496e12026",
|
|
42
|
+
donations: "0x021896771412C1D3f31BC7B01fFA3a6A17c5dA30",
|
|
42
43
|
},
|
|
43
44
|
schemas: {
|
|
44
45
|
Community: "0x721c17b065dccc5c916e0c2708d0ef50f1810591b76d0402ff6fe5accbd8488f",
|
|
@@ -62,6 +63,7 @@ exports.Networks = {
|
|
|
62
63
|
multicall: "0xC891F8eBA218f5034bf3a472528408BE19E1130E",
|
|
63
64
|
projectResolver: "0x832931F23ea4e3c70957DA71a7eB50F5B7efA93D",
|
|
64
65
|
schema: "0x4200000000000000000000000000000000000020",
|
|
66
|
+
donations: "0x3caF83Ed040501f1f439fb22E198bB5a67Bc2884",
|
|
65
67
|
},
|
|
66
68
|
schemas: {
|
|
67
69
|
Community: "0x314bb1c3c9b5311c1b813a3ad123b6ac5a03902b987795056dd2e4ff38e833ea",
|
|
@@ -85,6 +87,7 @@ exports.Networks = {
|
|
|
85
87
|
multicall: "0x6dC1D6b864e8BEf815806f9e4677123496e12026", //proxy,
|
|
86
88
|
projectResolver: "0x28BE0b0515be8BB8822aF1467A6613795E74717b",
|
|
87
89
|
communityResolver: "0xD534C4704F82494aBbc901560046fB62Ac63E9C4",
|
|
90
|
+
donations: "0x475F3E915601d975c792E6116791FBe9ACdBE902",
|
|
88
91
|
},
|
|
89
92
|
schemas: {
|
|
90
93
|
Community: "0xc604f0661cfd522583835ed2b2c644b80e068139d287f93c7f1680888894bacc",
|
|
@@ -108,6 +111,7 @@ exports.Networks = {
|
|
|
108
111
|
multicall: "0xec8d7BFe344790FD860920C41B46B259c005727A",
|
|
109
112
|
projectResolver: "0x099787D5a5aC92779A519CfD925ACB0Dc7E8bd23",
|
|
110
113
|
communityResolver: "0xa9E55D9F52d7B47792d2Db15F6A9674c56ccc5C9",
|
|
114
|
+
donations: "0xb2021F7550b8B07cA71696159B592C1F713593e4",
|
|
111
115
|
},
|
|
112
116
|
schemas: {
|
|
113
117
|
Community: "0xf3d790c7fdab6c1b1f25ffcc9289e5be2792eb596d2851a4d059c8aae1bc8b2e", //test with resolver
|
|
@@ -132,6 +136,7 @@ exports.Networks = {
|
|
|
132
136
|
multicall: "0x4Ca7230fB6b78875bdd1B1e4F665B7B7f1891239",
|
|
133
137
|
projectResolver: "0xC891F8eBA218f5034bf3a472528408BE19E1130E",
|
|
134
138
|
communityResolver: "0x009dC7dF3Ea3b23CE80Fd3Ba811d5bA5675934A1",
|
|
139
|
+
donations: "0x61eD6D070EE996698fB35B909e45111402336645",
|
|
135
140
|
},
|
|
136
141
|
schemas: {
|
|
137
142
|
Community: "0xe130107659909d20cbd75a2c82e1988b09b1c08fd39ad6f4397ce27c089e0e95",
|
|
@@ -145,7 +150,7 @@ exports.Networks = {
|
|
|
145
150
|
Project: "0x5ddd6b7a11406771308431ca9bd146cc717848b74b52993a532dc1aad0ccc83f",
|
|
146
151
|
},
|
|
147
152
|
},
|
|
148
|
-
|
|
153
|
+
celo: {
|
|
149
154
|
chainId: 42220,
|
|
150
155
|
url: "https://celo.easscan.org/graphql",
|
|
151
156
|
rpcUrl: "https://forno.celo.org",
|
|
@@ -155,6 +160,7 @@ exports.Networks = {
|
|
|
155
160
|
multicall: "0x8791Ac8c099314bB1D1514D76de13a1E80275950",
|
|
156
161
|
projectResolver: "0x6dC1D6b864e8BEf815806f9e4677123496e12026",
|
|
157
162
|
communityResolver: "0xfddb660F2F1C27d219372210745BB9f73431856E",
|
|
163
|
+
donations: "0xf373467c21841DF20529FAA8bE49381106DBc258",
|
|
158
164
|
},
|
|
159
165
|
schemas: {
|
|
160
166
|
Community: "0x3c2231024f4f17f3718b5bd9ed9ff29cc323dea5449f9ceba11a9888bfbdd0e1",
|
|
@@ -167,7 +173,7 @@ exports.Networks = {
|
|
|
167
173
|
GrantUpdateStatus: "0xf45fdf2c064073f0623416571c2746085d785cde5a57fd0696ff88bdf78bcbdc",
|
|
168
174
|
Project: "0xf3f753b41e04d1052b5a5ec7624d1dfdb6c2da288a985120e477ddbcac071022",
|
|
169
175
|
},
|
|
170
|
-
}
|
|
176
|
+
},
|
|
171
177
|
};
|
|
172
178
|
const DetailsSchema = [{ type: "string", name: "json", value: null }];
|
|
173
179
|
/**
|
package/core/types.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface AttestArgs<T = unknown> {
|
|
|
25
25
|
export type TSchemaName = "Community" | "CommunityDetails" | "Grant" | "GrantDetails" | "GrantVerified" | "MemberOf" | "MemberDetails" | "Milestone" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "ProjectDetails" | "Details" | "ProjectImpact" | "GrantUpdate" | "GrantUpdateStatus" | "ProjectEndorsement";
|
|
26
26
|
export type TResolvedSchemaNames = "Community" | "Grant" | "GrantVerified" | "MemberOf" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "Details" | "GrantUpdateStatus";
|
|
27
27
|
export type TExternalLink = "twitter" | "github" | "website" | "linkedin" | "discord";
|
|
28
|
-
export type TNetwork = "optimism" |
|
|
28
|
+
export type TNetwork = "optimism" | "celo" | "optimism-sepolia" | "arbitrum" | "sepolia" | "base-sepolia";
|
|
29
29
|
/**
|
|
30
30
|
* Generic GAP Facade interface.
|
|
31
31
|
* This supplies the GAP class with the necessary properties.
|
|
@@ -64,6 +64,7 @@ export interface EASNetworkConfig {
|
|
|
64
64
|
multicall: Hex;
|
|
65
65
|
projectResolver: Hex;
|
|
66
66
|
communityResolver: Hex;
|
|
67
|
+
donations: Hex;
|
|
67
68
|
};
|
|
68
69
|
/**
|
|
69
70
|
* A tuple containing the schema name and it's UID for that network
|