@show-karma/karma-gap-sdk 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/abi/MultiAttester.json +188 -134
- package/core/abi/ProjectResolver.json +471 -0
- package/core/class/Attestation.d.ts +2 -0
- package/core/class/Attestation.js +1 -0
- package/core/class/GAP.d.ts +5 -0
- package/core/class/GAP.js +12 -1
- package/core/class/contract/GapContract.d.ts +16 -1
- package/core/class/contract/GapContract.js +24 -0
- package/core/class/entities/Project.d.ts +7 -5
- package/core/class/entities/Project.js +21 -15
- package/core/consts.d.ts +1 -1
- package/core/consts.js +99 -86
- package/core/types.d.ts +3 -1
- package/core/types.js +2 -0
- package/core/utils/get-web3-provider.d.ts +4 -0
- package/core/utils/get-web3-provider.js +18 -0
- package/package.json +3 -2
|
@@ -47,6 +47,12 @@ class Project extends Attestation_1.Attestation {
|
|
|
47
47
|
payload[index][0].uid = uid;
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
+
async transferOwnership(signer, newOwner) {
|
|
51
|
+
await GapContract_1.GapContract.transferProjectOwnership(signer, this.uid, newOwner);
|
|
52
|
+
}
|
|
53
|
+
isOwner(signer) {
|
|
54
|
+
return GapContract_1.GapContract.isProjectOwner(signer, this.uid, this.chainID);
|
|
55
|
+
}
|
|
50
56
|
/**
|
|
51
57
|
* Add new members to the project.
|
|
52
58
|
* If any member in the array already exists in the project
|
|
@@ -57,7 +63,7 @@ class Project extends Attestation_1.Attestation {
|
|
|
57
63
|
this.members.push(...(0, utils_1.mapFilter)(members, (member) => !!this.members.find((m) => m.recipient === member), (member) => new MemberOf_1.MemberOf({
|
|
58
64
|
data: { memberOf: true },
|
|
59
65
|
refUID: this.uid,
|
|
60
|
-
schema: GapSchema_1.GapSchema.find(
|
|
66
|
+
schema: GapSchema_1.GapSchema.find('MemberOf'),
|
|
61
67
|
recipient: member,
|
|
62
68
|
uid: consts_1.nullRef,
|
|
63
69
|
})));
|
|
@@ -78,7 +84,7 @@ class Project extends Attestation_1.Attestation {
|
|
|
78
84
|
const member = new MemberOf_1.MemberOf({
|
|
79
85
|
data: { memberOf: true },
|
|
80
86
|
refUID: this.uid,
|
|
81
|
-
schema: GapSchema_1.GapSchema.find(
|
|
87
|
+
schema: GapSchema_1.GapSchema.find('MemberOf'),
|
|
82
88
|
createdAt: Date.now(),
|
|
83
89
|
recipient: details.recipient,
|
|
84
90
|
uid: consts_1.nullRef,
|
|
@@ -86,11 +92,11 @@ class Project extends Attestation_1.Attestation {
|
|
|
86
92
|
return { member, details };
|
|
87
93
|
});
|
|
88
94
|
if (!newMembers.length) {
|
|
89
|
-
throw new SchemaError_1.AttestationError(
|
|
95
|
+
throw new SchemaError_1.AttestationError('ATTEST_ERROR', 'No new members to add.');
|
|
90
96
|
}
|
|
91
97
|
console.log(`Creating ${newMembers.length} new members`);
|
|
92
98
|
const attestedMembers = await this.schema.multiAttest(signer, newMembers.map((m) => m.member));
|
|
93
|
-
console.log(
|
|
99
|
+
console.log('attested-members', attestedMembers);
|
|
94
100
|
newMembers.forEach(({ member, details }, idx) => {
|
|
95
101
|
Object.assign(member, { uid: attestedMembers[idx] });
|
|
96
102
|
if (!details)
|
|
@@ -113,12 +119,12 @@ class Project extends Attestation_1.Attestation {
|
|
|
113
119
|
member.details &&
|
|
114
120
|
member.details?.refUID !== entity.refUID), (member) => member.uid);
|
|
115
121
|
if (toRevoke.length) {
|
|
116
|
-
console.log(
|
|
122
|
+
console.log('Revoking details');
|
|
117
123
|
await this.cleanDetails(signer, toRevoke);
|
|
118
124
|
}
|
|
119
125
|
console.log(`Creating ${entities.length} new member details`);
|
|
120
126
|
const attestedEntities = (await this.schema.multiAttest(signer, entities));
|
|
121
|
-
console.log(
|
|
127
|
+
console.log('attested-entities', attestedEntities);
|
|
122
128
|
entities.forEach((entity, idx) => {
|
|
123
129
|
const member = this.members.find((member) => member.uid === entity.refUID);
|
|
124
130
|
if (!member)
|
|
@@ -134,9 +140,9 @@ class Project extends Attestation_1.Attestation {
|
|
|
134
140
|
*/
|
|
135
141
|
async cleanDetails(signer, uids) {
|
|
136
142
|
if (!uids.length) {
|
|
137
|
-
throw new SchemaError_1.AttestationError(
|
|
143
|
+
throw new SchemaError_1.AttestationError('ATTEST_ERROR', 'No details to clean.');
|
|
138
144
|
}
|
|
139
|
-
const memberDetails = GapSchema_1.GapSchema.find(
|
|
145
|
+
const memberDetails = GapSchema_1.GapSchema.find('MemberDetails');
|
|
140
146
|
await this.schema.multiRevoke(signer, uids.map((uid) => ({ schemaId: memberDetails.uid, uid })));
|
|
141
147
|
this.members.forEach((member) => {
|
|
142
148
|
if (!member.details)
|
|
@@ -154,9 +160,9 @@ class Project extends Attestation_1.Attestation {
|
|
|
154
160
|
*/
|
|
155
161
|
async removeMembers(signer, uids) {
|
|
156
162
|
if (!uids.length) {
|
|
157
|
-
throw new SchemaError_1.AttestationError(
|
|
163
|
+
throw new SchemaError_1.AttestationError('ATTEST_ERROR', 'No members to remove.');
|
|
158
164
|
}
|
|
159
|
-
const memberOf = GapSchema_1.GapSchema.find(
|
|
165
|
+
const memberOf = GapSchema_1.GapSchema.find('MemberOf');
|
|
160
166
|
const details = (0, utils_1.mapFilter)(this.members, (m) => uids.includes(m.uid) && !!m.details, (m) => m.details?.uid);
|
|
161
167
|
if (details.length) {
|
|
162
168
|
await this.cleanDetails(signer, details);
|
|
@@ -171,7 +177,7 @@ class Project extends Attestation_1.Attestation {
|
|
|
171
177
|
async removeAllMembers(signer) {
|
|
172
178
|
const members = (0, utils_1.mapFilter)(this.members, (m) => !!m.uid, (m) => m.uid);
|
|
173
179
|
if (!members.length) {
|
|
174
|
-
throw new SchemaError_1.AttestationError(
|
|
180
|
+
throw new SchemaError_1.AttestationError('REVOKATION_ERROR', 'No members to revoke.');
|
|
175
181
|
}
|
|
176
182
|
const details = (0, utils_1.mapFilter)(this.members, (m) => !!m.details, (m) => m.details?.uid);
|
|
177
183
|
if (details.length) {
|
|
@@ -187,7 +193,7 @@ class Project extends Attestation_1.Attestation {
|
|
|
187
193
|
data: {
|
|
188
194
|
project: true,
|
|
189
195
|
},
|
|
190
|
-
schema: GapSchema_1.GapSchema.find(
|
|
196
|
+
schema: GapSchema_1.GapSchema.find('Project'),
|
|
191
197
|
});
|
|
192
198
|
if (attestation.details) {
|
|
193
199
|
const { details } = attestation;
|
|
@@ -196,7 +202,7 @@ class Project extends Attestation_1.Attestation {
|
|
|
196
202
|
data: {
|
|
197
203
|
...details.data,
|
|
198
204
|
},
|
|
199
|
-
schema: GapSchema_1.GapSchema.find(
|
|
205
|
+
schema: GapSchema_1.GapSchema.find('ProjectDetails'),
|
|
200
206
|
});
|
|
201
207
|
project.details.links = details.data.links || [];
|
|
202
208
|
project.details.tags = details.data.tags || [];
|
|
@@ -214,7 +220,7 @@ class Project extends Attestation_1.Attestation {
|
|
|
214
220
|
data: {
|
|
215
221
|
memberOf: true,
|
|
216
222
|
},
|
|
217
|
-
schema: GapSchema_1.GapSchema.find(
|
|
223
|
+
schema: GapSchema_1.GapSchema.find('MemberOf'),
|
|
218
224
|
});
|
|
219
225
|
if (m.details) {
|
|
220
226
|
const { details } = m;
|
|
@@ -223,7 +229,7 @@ class Project extends Attestation_1.Attestation {
|
|
|
223
229
|
data: {
|
|
224
230
|
...details.data,
|
|
225
231
|
},
|
|
226
|
-
schema: GapSchema_1.GapSchema.find(
|
|
232
|
+
schema: GapSchema_1.GapSchema.find('MemberDetails'),
|
|
227
233
|
});
|
|
228
234
|
}
|
|
229
235
|
return member;
|
package/core/consts.d.ts
CHANGED
package/core/consts.js
CHANGED
|
@@ -6,14 +6,14 @@ exports.MountEntities = exports.Networks = exports.zeroAddress = exports.nullRes
|
|
|
6
6
|
* instead of the custom contract.
|
|
7
7
|
*/
|
|
8
8
|
exports.useDefaultAttestation = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
'MilestoneApproved',
|
|
10
|
+
'MilestoneCompleted',
|
|
11
|
+
'GrantVerified',
|
|
12
|
+
'Community',
|
|
13
13
|
];
|
|
14
|
-
exports.nullRef =
|
|
14
|
+
exports.nullRef = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
15
15
|
// TODO: Remove null resolver and change usage to zero address
|
|
16
|
-
exports.nullResolver =
|
|
16
|
+
exports.nullResolver = '0x0000000000000000000000000000000000000000';
|
|
17
17
|
exports.zeroAddress = exports.nullResolver;
|
|
18
18
|
// resolver for dependents = 0xed081ABE885bc3575f810c904052A1f685A85903
|
|
19
19
|
/**
|
|
@@ -56,41 +56,45 @@ exports.Networks = {
|
|
|
56
56
|
// },
|
|
57
57
|
optimism: {
|
|
58
58
|
chainId: 10,
|
|
59
|
-
url:
|
|
59
|
+
url: 'https://optimism.easscan.org/graphql',
|
|
60
|
+
rpcUrl: 'https://opt-mainnet.g.alchemy.com/v2/fx2SlVDrPbXwPMQT4v0lRT1PABA16Myl',
|
|
60
61
|
contracts: {
|
|
61
|
-
eas:
|
|
62
|
-
schema:
|
|
63
|
-
multicall:
|
|
62
|
+
eas: '0x4200000000000000000000000000000000000021',
|
|
63
|
+
schema: '0x4200000000000000000000000000000000000020',
|
|
64
|
+
multicall: '0xd2eD366393FDfd243931Fe48e9fb65A192B0018c',
|
|
65
|
+
projectResolver: '0x7177AdC0f924b695C0294A40C4C5FEFf5EE1E141',
|
|
64
66
|
},
|
|
65
67
|
schemas: {
|
|
66
|
-
Community:
|
|
67
|
-
Details:
|
|
68
|
-
Grant:
|
|
69
|
-
GrantVerified:
|
|
70
|
-
MemberOf:
|
|
71
|
-
MilestoneApproved:
|
|
72
|
-
MilestoneCompleted:
|
|
73
|
-
Project:
|
|
68
|
+
Community: '0x721c17b065dccc5c916e0c2708d0ef50f1810591b76d0402ff6fe5accbd8488f',
|
|
69
|
+
Details: '0x70a3f615f738fc6a4f56100692ada93d947c028b840940d97af7e7d6f0fa0577',
|
|
70
|
+
Grant: '0x12837231f48acbca4e1e7f4416f684f3353bd4d71d4f03a09d29e5ffa6f21a50',
|
|
71
|
+
GrantVerified: '0x13adc8df8a7324b1651e8bcec948b3e2d4fcfa2a88a52136206cb9ea44836e93',
|
|
72
|
+
MemberOf: '0x7fbb8a65924d8ad2ae12356e04b1418043e8361ba3b1b6c917de2e23df3ec81c',
|
|
73
|
+
MilestoneApproved: '0x13adc8df8a7324b1651e8bcec948b3e2d4fcfa2a88a52136206cb9ea44836e93',
|
|
74
|
+
MilestoneCompleted: '0x13adc8df8a7324b1651e8bcec948b3e2d4fcfa2a88a52136206cb9ea44836e93',
|
|
75
|
+
Project: '0x5b873b6e7a16207b526dde366e8164e95bcda2f009272306519667c5e94d2191',
|
|
74
76
|
},
|
|
75
77
|
},
|
|
76
|
-
|
|
78
|
+
'optimism-goerli': {
|
|
77
79
|
chainId: 420,
|
|
78
|
-
url:
|
|
80
|
+
url: 'https://optimism-goerli-bedrock.easscan.org/graphql',
|
|
81
|
+
rpcUrl: 'https://opt-goerli.g.alchemy.com/v2/94gBUTVw7SbDxxdeB8gi3KQmgQSD7SHi',
|
|
79
82
|
contracts: {
|
|
80
|
-
eas:
|
|
81
|
-
schema:
|
|
82
|
-
multicall:
|
|
83
|
+
eas: '0x4200000000000000000000000000000000000021',
|
|
84
|
+
schema: '0x4200000000000000000000000000000000000020',
|
|
85
|
+
multicall: '0x5D5a8032b2FA06652804c33F60DcEA00e389B732',
|
|
86
|
+
projectResolver: '0xbCf8910Bc3971eA59D93256357b76E846CF2e1F8',
|
|
83
87
|
},
|
|
84
88
|
schemas: {
|
|
85
|
-
Community:
|
|
89
|
+
Community: '0xc1aade58410b3fd807c19845181996721248459c5f042284f27d21cec12a38d1',
|
|
86
90
|
// "0x14b016a56b56db47ee2cdda6963a3481374a75e1471dafd85a17e6e5c23d2a11",
|
|
87
|
-
Details:
|
|
88
|
-
Grant:
|
|
89
|
-
GrantVerified:
|
|
90
|
-
MemberOf:
|
|
91
|
-
MilestoneApproved:
|
|
92
|
-
MilestoneCompleted:
|
|
93
|
-
Project:
|
|
91
|
+
Details: '0xfe590d9582957e10affbabcdc34a201785a1d4f77982d6616b736cce1a91ae43',
|
|
92
|
+
Grant: '0xd6ce374765c355687101ba70b3f8824d555c12716d2bdad71a08ccad1ded3218',
|
|
93
|
+
GrantVerified: '0xf544fbd9721ac50863d32dc0eed5992051e7fb270b38ab2ce062327cc0ae26ea',
|
|
94
|
+
MemberOf: '0x78c811e506849d414a91a56dab91f07f7ed108f0bf27f550796f13e7bb2e2f2d',
|
|
95
|
+
MilestoneApproved: '0xf544fbd9721ac50863d32dc0eed5992051e7fb270b38ab2ce062327cc0ae26ea',
|
|
96
|
+
MilestoneCompleted: '0xf544fbd9721ac50863d32dc0eed5992051e7fb270b38ab2ce062327cc0ae26ea',
|
|
97
|
+
Project: '0xa727441596f5a9878552d3ad6c53c31629a709451e6081ba01bff0f73bf1af5a',
|
|
94
98
|
},
|
|
95
99
|
},
|
|
96
100
|
// arbitrum: {
|
|
@@ -110,29 +114,38 @@ exports.Networks = {
|
|
|
110
114
|
// Project: "",
|
|
111
115
|
// },
|
|
112
116
|
// },
|
|
113
|
-
sepolia: {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
117
|
+
// sepolia: {
|
|
118
|
+
// chainId: 11155111,
|
|
119
|
+
// url: 'https://sepolia.easscan.org/graphql',
|
|
120
|
+
// contracts: {
|
|
121
|
+
// eas: '0xC2679fBD37d54388Ce493F1DB75320D236e1815e',
|
|
122
|
+
// schema: '0x0a7E2Ff54e76B8E6659aedc9103FB21c038050D0',
|
|
123
|
+
// multicall: '0x00Ee8a5082567c3da8f3D34D33ac8D788C4Cd754', // enhanced
|
|
124
|
+
// // multicall: "0x04D6BB799f5A8c76882C4372d1FC39Cd0DDA0A4c",// original,
|
|
125
|
+
// projectResolver: '0x7177AdC0f924b695C0294A40C4C5FEFf5EE1E141',
|
|
126
|
+
// },
|
|
127
|
+
// schemas: {
|
|
128
|
+
// Community:
|
|
129
|
+
// '0xf3d790c7fdab6c1b1f25ffcc9289e5be2792eb596d2851a4d059c8aae1bc8b2e', //test with resolver
|
|
130
|
+
// // "0x1954572e3fe21bf4334afdaf1358ed7098af1ed136e76dc93c2fdc25e83934c1", // original without resolver
|
|
131
|
+
// Details:
|
|
132
|
+
// '0x2c270e35bfcdc4d611f0e9d3d2ab6924ec6c673505abc22a1dd07e19b67211af',
|
|
133
|
+
// Grant:
|
|
134
|
+
// '0x09697aeeb3ae71de1cc19e388fd74264f11af5fba3016094764553ac341fdc72', // with communityUID/resolver
|
|
135
|
+
// GrantVerified:
|
|
136
|
+
// '0x0be8952e2dd74ffd63a02f4d55b20b603fe7a60130cb9d70de31feb9c52fdd37',
|
|
137
|
+
// MemberOf:
|
|
138
|
+
// '0xdd87b3500457931252424f4439365534ba72a367503a8805ff3482353fb90301',
|
|
139
|
+
// MilestoneApproved:
|
|
140
|
+
// '0xcdef0e492d2e7ad25d0b0fdb868f6dcd1f5e5c30e42fd5fa0debdc12f7618322',
|
|
141
|
+
// MilestoneCompleted:
|
|
142
|
+
// '0xcdef0e492d2e7ad25d0b0fdb868f6dcd1f5e5c30e42fd5fa0debdc12f7618322',
|
|
143
|
+
// Project:
|
|
144
|
+
// '0xec77990a252b54b17673955c774b9712766de5eecb22ca5aa2c440e0e93257fb',
|
|
145
|
+
// },
|
|
146
|
+
// },
|
|
134
147
|
};
|
|
135
|
-
const DetailsSchema = [{ type:
|
|
148
|
+
const DetailsSchema = [{ type: 'string', name: 'json', value: null }];
|
|
136
149
|
/**
|
|
137
150
|
* Mounts the schemas for the given network and return all the settings
|
|
138
151
|
* @param network
|
|
@@ -140,88 +153,88 @@ const DetailsSchema = [{ type: "string", name: "json", value: null }];
|
|
|
140
153
|
*/
|
|
141
154
|
const MountEntities = (network) => ({
|
|
142
155
|
Community: {
|
|
143
|
-
name:
|
|
144
|
-
schema: [{ type:
|
|
156
|
+
name: 'Community',
|
|
157
|
+
schema: [{ type: 'bool', name: 'community', value: true }],
|
|
145
158
|
uid: network.schemas.Community,
|
|
146
159
|
},
|
|
147
160
|
CommunityDetails: {
|
|
148
|
-
name:
|
|
161
|
+
name: 'CommunityDetails',
|
|
149
162
|
schema: DetailsSchema,
|
|
150
163
|
uid: network.schemas.Details,
|
|
151
|
-
references:
|
|
164
|
+
references: 'Community',
|
|
152
165
|
},
|
|
153
166
|
Project: {
|
|
154
|
-
name:
|
|
155
|
-
schema: [{ type:
|
|
167
|
+
name: 'Project',
|
|
168
|
+
schema: [{ type: 'bool', name: 'project', value: true }],
|
|
156
169
|
uid: network.schemas.Project,
|
|
157
170
|
},
|
|
158
171
|
ProjectDetails: {
|
|
159
|
-
name:
|
|
172
|
+
name: 'ProjectDetails',
|
|
160
173
|
schema: DetailsSchema,
|
|
161
174
|
uid: network.schemas.Details,
|
|
162
|
-
references:
|
|
175
|
+
references: 'Project',
|
|
163
176
|
},
|
|
164
177
|
MemberOf: {
|
|
165
|
-
name:
|
|
166
|
-
schema: [{ type:
|
|
178
|
+
name: 'MemberOf',
|
|
179
|
+
schema: [{ type: 'bool', name: 'memberOf', value: true }],
|
|
167
180
|
uid: network.schemas.MemberOf,
|
|
168
|
-
references:
|
|
181
|
+
references: 'Project',
|
|
169
182
|
},
|
|
170
183
|
MemberDetails: {
|
|
171
|
-
name:
|
|
184
|
+
name: 'MemberDetails',
|
|
172
185
|
schema: DetailsSchema,
|
|
173
186
|
uid: network.schemas.Details,
|
|
174
|
-
references:
|
|
187
|
+
references: 'MemberOf',
|
|
175
188
|
},
|
|
176
189
|
Grant: {
|
|
177
|
-
name:
|
|
178
|
-
schema: [{ type:
|
|
190
|
+
name: 'Grant',
|
|
191
|
+
schema: [{ type: 'bytes32', name: 'communityUID', value: true }],
|
|
179
192
|
// schema: [{ type: "bool", name: "grant", value: true }],
|
|
180
193
|
uid: network.schemas.Grant,
|
|
181
|
-
references:
|
|
194
|
+
references: 'Project',
|
|
182
195
|
},
|
|
183
196
|
GrantDetails: {
|
|
184
|
-
name:
|
|
197
|
+
name: 'GrantDetails',
|
|
185
198
|
schema: DetailsSchema,
|
|
186
199
|
uid: network.schemas.Details,
|
|
187
|
-
references:
|
|
200
|
+
references: 'Grant',
|
|
188
201
|
},
|
|
189
202
|
GrantVerified: {
|
|
190
|
-
name:
|
|
203
|
+
name: 'GrantVerified',
|
|
191
204
|
schema: [
|
|
192
|
-
{ type:
|
|
193
|
-
{ type:
|
|
205
|
+
{ type: 'string', name: 'type', value: null },
|
|
206
|
+
{ type: 'string', name: 'reason', value: '' },
|
|
194
207
|
],
|
|
195
208
|
uid: network.schemas.GrantVerified,
|
|
196
|
-
references:
|
|
209
|
+
references: 'Grant',
|
|
197
210
|
},
|
|
198
211
|
Milestone: {
|
|
199
|
-
name:
|
|
212
|
+
name: 'Milestone',
|
|
200
213
|
schema: DetailsSchema,
|
|
201
214
|
uid: network.schemas.Details,
|
|
202
|
-
references:
|
|
215
|
+
references: 'Grant',
|
|
203
216
|
},
|
|
204
217
|
MilestoneApproved: {
|
|
205
|
-
name:
|
|
218
|
+
name: 'MilestoneApproved',
|
|
206
219
|
schema: [
|
|
207
|
-
{ type:
|
|
208
|
-
{ type:
|
|
220
|
+
{ type: 'string', name: 'type', value: null },
|
|
221
|
+
{ type: 'string', name: 'reason', value: '' },
|
|
209
222
|
],
|
|
210
223
|
uid: network.schemas.MilestoneApproved,
|
|
211
|
-
references:
|
|
224
|
+
references: 'Milestone',
|
|
212
225
|
},
|
|
213
226
|
MilestoneCompleted: {
|
|
214
|
-
name:
|
|
227
|
+
name: 'MilestoneCompleted',
|
|
215
228
|
schema: [
|
|
216
|
-
{ type:
|
|
217
|
-
{ type:
|
|
229
|
+
{ type: 'string', name: 'type', value: null },
|
|
230
|
+
{ type: 'string', name: 'reason', value: '' },
|
|
218
231
|
],
|
|
219
232
|
uid: network.schemas.MilestoneCompleted,
|
|
220
|
-
references:
|
|
233
|
+
references: 'Milestone',
|
|
221
234
|
},
|
|
222
235
|
Details: {
|
|
223
236
|
schema: DetailsSchema,
|
|
224
|
-
name:
|
|
237
|
+
name: ' schema',
|
|
225
238
|
uid: network.schemas.Details,
|
|
226
239
|
},
|
|
227
240
|
});
|
package/core/types.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface AttestArgs<T = unknown> {
|
|
|
29
29
|
export type TSchemaName = 'Community' | 'CommunityDetails' | 'Grant' | 'GrantDetails' | 'GrantVerified' | 'MemberOf' | 'MemberDetails' | 'Milestone' | 'MilestoneCompleted' | 'MilestoneApproved' | 'Project' | 'ProjectDetails' | 'Details';
|
|
30
30
|
export type TResolvedSchemaNames = 'Community' | 'Grant' | 'GrantVerified' | 'MemberOf' | 'MilestoneCompleted' | 'MilestoneApproved' | 'Project' | 'Details';
|
|
31
31
|
export type TExternalLink = 'twitter' | 'github' | 'website' | 'linkedin' | 'discord';
|
|
32
|
-
export type TNetwork = 'optimism' | 'optimism-goerli'
|
|
32
|
+
export type TNetwork = 'optimism' | 'optimism-goerli';
|
|
33
33
|
/**
|
|
34
34
|
* Generic GAP Facade interface.
|
|
35
35
|
* This supplies the GAP class with the necessary properties.
|
|
@@ -60,11 +60,13 @@ export interface MultiAttestData {
|
|
|
60
60
|
export type MultiAttestPayload = [Attestation, RawMultiAttestPayload][];
|
|
61
61
|
export interface EASNetworkConfig {
|
|
62
62
|
url: string;
|
|
63
|
+
rpcUrl: string;
|
|
63
64
|
chainId: number;
|
|
64
65
|
contracts: {
|
|
65
66
|
eas: Hex;
|
|
66
67
|
schema: Hex;
|
|
67
68
|
multicall: Hex;
|
|
69
|
+
projectResolver: Hex;
|
|
68
70
|
};
|
|
69
71
|
/**
|
|
70
72
|
* A tuple containing the schema name and it's UID for that network
|
package/core/types.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWeb3Provider = void 0;
|
|
4
|
+
const consts_1 = require("../consts");
|
|
5
|
+
const ethers_1 = require("ethers");
|
|
6
|
+
const providers = {};
|
|
7
|
+
const getWeb3Provider = (chainId) => {
|
|
8
|
+
const rpcUrl = Object.values(consts_1.Networks).find((n) => n.chainId === chainId)
|
|
9
|
+
?.rpcUrl;
|
|
10
|
+
if (!rpcUrl) {
|
|
11
|
+
throw new Error(`No rpcUrl found for chainId ${chainId}`);
|
|
12
|
+
}
|
|
13
|
+
if (!providers[chainId]) {
|
|
14
|
+
providers[chainId] = new ethers_1.ethers.providers.JsonRpcProvider(rpcUrl);
|
|
15
|
+
}
|
|
16
|
+
return providers[chainId];
|
|
17
|
+
};
|
|
18
|
+
exports.getWeb3Provider = getWeb3Provider;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.2.
|
|
6
|
+
"version": "0.2.5",
|
|
7
7
|
"description": "Simple and easy interface between EAS and Karma GAP.",
|
|
8
8
|
"main": "./index.js",
|
|
9
9
|
"author": "KarmaHQ",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"deploy": "npx ts-node ./core/scripts/deploy.ts",
|
|
18
|
-
"csv-upload": "npx ts-node ./csv-upload/scripts/run.ts"
|
|
18
|
+
"csv-upload": "npx ts-node ./csv-upload/scripts/run.ts",
|
|
19
|
+
"publish-npm": "npm version patch && tsc && cd .dist && npm publish --scope=@show-karma/karma-gap-sdk --access public"
|
|
19
20
|
},
|
|
20
21
|
"dependencies": {
|
|
21
22
|
"@ethereum-attestation-service/eas-sdk": "^1.1.0-beta.2",
|