@show-karma/karma-gap-sdk 0.3.31 → 0.3.33

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.
@@ -1,7 +1,7 @@
1
- import { Hex, IAttestation, JSONStr, MultiAttestData, SignerOrProvider, TNetwork } from '../types';
2
- import { Schema } from './Schema';
3
- import { SchemaItem, SchemaValue } from '@ethereum-attestation-service/eas-sdk';
4
- import { GapSchema } from './GapSchema';
1
+ import { Hex, IAttestation, JSONStr, MultiAttestData, SignerOrProvider, TNetwork } from "../types";
2
+ import { Schema } from "./Schema";
3
+ import { SchemaItem, SchemaValue } from "@ethereum-attestation-service/eas-sdk";
4
+ import { GapSchema } from "./GapSchema";
5
5
  export interface AttestationArgs<T = unknown, S extends Schema = Schema> {
6
6
  data: T | string;
7
7
  schema: S;
@@ -88,7 +88,7 @@ export declare class Attestation<T = unknown, S extends Schema = GapSchema> impl
88
88
  * @param signer
89
89
  * @returns
90
90
  */
91
- revoke(signer: SignerOrProvider): Promise<any>;
91
+ revoke(signer: SignerOrProvider, callback?: Function): Promise<void>;
92
92
  /**
93
93
  * Attests the data using the specified signer and schema.
94
94
  * @param signer - The signer or provider to use for attestation.
@@ -72,7 +72,7 @@ class Attestation {
72
72
  setValues(values) {
73
73
  const isJsonSchema = this.schema.isJsonSchema();
74
74
  if (isJsonSchema)
75
- this.schema.setValue('json', JSON.stringify(values));
75
+ this.schema.setValue("json", JSON.stringify(values));
76
76
  this._data = values;
77
77
  Object.entries(values).forEach(([key, value]) => {
78
78
  this[key] = value;
@@ -92,7 +92,7 @@ class Attestation {
92
92
  * @returns
93
93
  */
94
94
  fromDecodedSchema(data) {
95
- return typeof data === 'string'
95
+ return typeof data === "string"
96
96
  ? Attestation.fromDecodedSchema(data)
97
97
  : data;
98
98
  }
@@ -102,8 +102,9 @@ class Attestation {
102
102
  * @param signer
103
103
  * @returns
104
104
  */
105
- revoke(signer) {
105
+ async revoke(signer, callback) {
106
106
  try {
107
+ callback?.("preparing");
107
108
  return GapContract_1.GapContract.multiRevoke(signer, [
108
109
  {
109
110
  data: [
@@ -114,11 +115,13 @@ class Attestation {
114
115
  ],
115
116
  schema: this.schema.uid,
116
117
  },
117
- ]);
118
+ ]).then(() => {
119
+ callback?.("confirmed");
120
+ });
118
121
  }
119
122
  catch (error) {
120
123
  console.error(error);
121
- throw new SchemaError_1.SchemaError('REVOKE_ERROR', 'Error revoking attestation.');
124
+ throw new SchemaError_1.SchemaError("REVOKE_ERROR", "Error revoking attestation.");
122
125
  }
123
126
  }
124
127
  /**
@@ -129,7 +132,9 @@ class Attestation {
129
132
  * @throws An `AttestationError` if an error occurs during attestation.
130
133
  */
131
134
  async attest(signer, ...args) {
132
- const callback = typeof args[args.length - 1] === 'function' ? args.pop() : null;
135
+ const callback = typeof args[args.length - 1] === "function"
136
+ ? args.pop()
137
+ : null;
133
138
  console.log(`Attesting ${this.schema.name}`);
134
139
  try {
135
140
  const uid = await this.schema.attest({
@@ -137,14 +142,14 @@ class Attestation {
137
142
  to: this.recipient,
138
143
  refUID: this.refUID,
139
144
  signer,
140
- callback: callback
145
+ callback: callback,
141
146
  });
142
147
  this._uid = uid;
143
148
  console.log(`Attested ${this.schema.name} with UID ${uid}`);
144
149
  }
145
150
  catch (error) {
146
151
  console.error(error);
147
- throw new SchemaError_1.AttestationError('ATTEST_ERROR', 'Error during attestation.');
152
+ throw new SchemaError_1.AttestationError("ATTEST_ERROR", "Error during attestation.");
148
153
  }
149
154
  }
150
155
  /**
@@ -194,12 +199,12 @@ class Attestation {
194
199
  const { remoteClient } = GAP_1.GAP;
195
200
  if (this.type) {
196
201
  this._data.type = this.type;
197
- this.schema.setValue('json', JSON.stringify(this._data));
202
+ this.schema.setValue("json", JSON.stringify(this._data));
198
203
  }
199
204
  if (remoteClient && JSON.stringify(this._data)?.length > 1500) {
200
205
  const cid = await remoteClient.save(this._data, this.schema.name);
201
206
  const encodedData = remoteClient.encode(cid);
202
- this.schema.setValue('json', JSON.stringify(encodedData));
207
+ this.schema.setValue("json", JSON.stringify(encodedData));
203
208
  }
204
209
  }
205
210
  const payload = (encode = true) => ({
@@ -234,17 +239,17 @@ class Attestation {
234
239
  const parsed = JSON.parse(data);
235
240
  if (data.length < 2 && !/\{.*\}/gim.test(data))
236
241
  return {};
237
- if (parsed.length === 1 && parsed[0].name === 'json') {
242
+ if (parsed.length === 1 && parsed[0].name === "json") {
238
243
  const { value } = parsed[0];
239
- return (typeof value.value === 'string'
244
+ return (typeof value.value === "string"
240
245
  ? JSON.parse(value.value)
241
246
  : value.value);
242
247
  }
243
248
  if (parsed && Array.isArray(parsed)) {
244
249
  return parsed.reduce((acc, curr) => {
245
250
  const { value } = curr.value;
246
- if (curr.type.includes('uint')) {
247
- acc[curr.name] = ['string', 'bigint'].includes(typeof value)
251
+ if (curr.type.includes("uint")) {
252
+ acc[curr.name] = ["string", "bigint"].includes(typeof value)
248
253
  ? BigInt(value)
249
254
  : Number(value);
250
255
  }
@@ -253,11 +258,11 @@ class Attestation {
253
258
  return acc;
254
259
  }, {});
255
260
  }
256
- throw new SchemaError_1.SchemaError('INVALID_DATA', 'Data must be a valid JSON array string.');
261
+ throw new SchemaError_1.SchemaError("INVALID_DATA", "Data must be a valid JSON array string.");
257
262
  }
258
263
  catch (error) {
259
264
  console.error(error);
260
- throw new SchemaError_1.SchemaError('INVALID_DATA', 'Data must be a valid JSON string.');
265
+ throw new SchemaError_1.SchemaError("INVALID_DATA", "Data must be a valid JSON string.");
261
266
  }
262
267
  }
263
268
  /**
@@ -289,10 +294,10 @@ class Attestation {
289
294
  assert(args, strict = false) {
290
295
  const { schema, uid } = args;
291
296
  if (!schema || !(schema instanceof Schema_1.Schema)) {
292
- throw new SchemaError_1.SchemaError('MISSING_FIELD', 'Schema must be an array.');
297
+ throw new SchemaError_1.SchemaError("MISSING_FIELD", "Schema must be an array.");
293
298
  }
294
299
  if (!uid) {
295
- throw new SchemaError_1.SchemaError('MISSING_FIELD', 'Schema uid is required');
300
+ throw new SchemaError_1.SchemaError("MISSING_FIELD", "Schema uid is required");
296
301
  }
297
302
  if (strict)
298
303
  Schema_1.Schema.validate(this.schema.gap.network);
@@ -323,7 +328,7 @@ class Attestation {
323
328
  recipient: to,
324
329
  attester: from,
325
330
  schema,
326
- uid: '0x0',
331
+ uid: "0x0",
327
332
  createdAt: new Date(),
328
333
  chainID: consts_1.Networks[schema.gap.network].chainId,
329
334
  });
@@ -1,12 +1,12 @@
1
1
  import { ethers } from "ethers";
2
- import { NFTStorage } from "nft.storage";
2
+ import pinataSDK from "@pinata/sdk";
3
3
  export declare class AlloBase {
4
4
  private signer;
5
5
  private contract;
6
6
  private static ipfsClient;
7
7
  private allo;
8
- constructor(signer: ethers.Signer, ipfsStorage: NFTStorage, chainId: number);
9
- saveAndGetCID(data: any): Promise<import("nft.storage").CIDString>;
8
+ constructor(signer: ethers.Signer, ipfsStorage: pinataSDK, chainId: number);
9
+ saveAndGetCID(data: any): Promise<string>;
10
10
  encodeStrategyInitData(applicationStart: number, applicationEnd: number, roundStart: number, roundEnd: number, payoutToken: string): Promise<string>;
11
11
  createGrant(args: any): Promise<{
12
12
  poolId: string;
@@ -18,11 +18,8 @@ class AlloBase {
18
18
  }
19
19
  async saveAndGetCID(data) {
20
20
  try {
21
- const blob = new Blob([JSON.stringify(data)], {
22
- type: "application/json",
23
- });
24
- const cid = await AlloBase.ipfsClient.storeBlob(blob);
25
- return cid;
21
+ const res = await AlloBase.ipfsClient.pinJSONToIPFS(data);
22
+ return res.IpfsHash;
26
23
  }
27
24
  catch (error) {
28
25
  throw new Error(`Error adding data to IPFS: ${error}`);
@@ -31,12 +28,12 @@ class AlloBase {
31
28
  async encodeStrategyInitData(applicationStart, applicationEnd, roundStart, roundEnd, payoutToken) {
32
29
  const encoder = new ethers_2.AbiCoder();
33
30
  const initStrategyData = encoder.encode(["bool", "bool", "uint256", "uint256", "uint256", "uint256", "address[]"], [
34
- false, // useRegistryAnchor
35
- true, // metadataRequired
36
- applicationStart, // Eg. Curr + 1 hour later registrationStartTime
37
- applicationEnd, // Eg. Curr + 5 days later registrationEndTime
38
- roundStart, // Eg. Curr + 2 hours later allocationStartTime
39
- roundEnd, // Eg. Curr + 10 days later allocaitonEndTime
31
+ false,
32
+ true,
33
+ applicationStart,
34
+ applicationEnd,
35
+ roundStart,
36
+ roundEnd,
40
37
  [payoutToken],
41
38
  ]);
42
39
  return initStrategyData;
@@ -58,7 +55,7 @@ class AlloBase {
58
55
  const createPoolArgs = {
59
56
  profileId: args.profileId,
60
57
  strategy: args.strategy,
61
- initStrategyData: initStrategyData, // unique to the strategy
58
+ initStrategyData: initStrategyData,
62
59
  token: args.payoutToken,
63
60
  amount: BigInt(args.matchingFundAmt),
64
61
  metadata: metadata,
@@ -1,11 +1,11 @@
1
1
  import { ethers } from "ethers";
2
2
  import { ProfileMetadata } from "../types/allo";
3
- import { NFTStorage } from "nft.storage";
3
+ import pinataSDK from "@pinata/sdk";
4
4
  export declare class AlloRegistry {
5
5
  private contract;
6
6
  private static ipfsClient;
7
- constructor(signer: ethers.Signer, ipfsStorage: NFTStorage);
8
- saveAndGetCID(data: any): Promise<import("nft.storage").CIDString>;
7
+ constructor(signer: ethers.Signer, ipfsStorage: pinataSDK);
8
+ saveAndGetCID(data: any): Promise<string>;
9
9
  createProgram(nonce: number, name: string, profileMetadata: ProfileMetadata, owner: string, members: string[]): Promise<{
10
10
  profileId: any;
11
11
  txHash: any;
@@ -14,11 +14,8 @@ class AlloRegistry {
14
14
  }
15
15
  async saveAndGetCID(data) {
16
16
  try {
17
- const blob = new Blob([JSON.stringify(data)], {
18
- type: "application/json",
19
- });
20
- const cid = await AlloRegistry.ipfsClient.storeBlob(blob);
21
- return cid;
17
+ const res = await AlloRegistry.ipfsClient.pinJSONToIPFS(data);
18
+ return res.IpfsHash;
22
19
  }
23
20
  catch (error) {
24
21
  throw new Error(`Error adding data to IPFS: ${error}`);
@@ -140,23 +140,21 @@ export declare abstract class Schema<T extends string = string> implements Schem
140
140
  * @param {Object} param0 - An object containing the schema and other optional settings.
141
141
  * @returns {Object} An object containing the attestation results, including the CID if 'ipfsKey' is enabled.
142
142
  */
143
- attest<T>({ data, to, signer, refUID, callback }: AttestArgs<T> & {
144
- callback?: (status: string) => void;
145
- }): Promise<Hex>;
143
+ attest<T>({ data, to, signer, refUID, callback, }: AttestArgs<T>): Promise<Hex>;
146
144
  /**
147
145
  * Bulk attest a set of attestations.
148
146
  * @param signer
149
147
  * @param entities
150
148
  * @returns
151
149
  */
152
- multiAttest(signer: SignerOrProvider, entities?: Attestation[], callback?: Function): Promise<string[]>;
150
+ multiAttest(signer: SignerOrProvider, entities?: Attestation[], callback?: Function): Promise<void>;
153
151
  /**
154
152
  * Revokes a set of attestations by their UIDs.
155
153
  * @param signer
156
154
  * @param uids
157
155
  * @returns
158
156
  */
159
- multiRevoke(signer: SignerOrProvider, toRevoke: MultiRevokeArgs[]): Promise<void>;
157
+ multiRevoke(signer: SignerOrProvider, toRevoke: MultiRevokeArgs[], callback?: Function): Promise<void>;
160
158
  static exists(name: string, network: TNetwork): Schema<string>;
161
159
  /**
162
160
  * Adds the schema signature to a shares list. Use Schema.get("SchemaName") to get the schema.
@@ -219,7 +219,7 @@ class Schema {
219
219
  * @param {Object} param0 - An object containing the schema and other optional settings.
220
220
  * @returns {Object} An object containing the attestation results, including the CID if 'ipfsKey' is enabled.
221
221
  */
222
- async attest({ data, to, signer, refUID, callback }) {
222
+ async attest({ data, to, signer, refUID, callback, }) {
223
223
  const eas = this.gap.eas.connect(signer);
224
224
  if (this.references && !refUID)
225
225
  throw new SchemaError_1.AttestationError("INVALID_REFERENCE", "Attestation schema references another schema but no reference UID was provided.");
@@ -258,19 +258,18 @@ class Schema {
258
258
  },
259
259
  },
260
260
  };
261
+ callback?.("preparing");
261
262
  if (consts_1.useDefaultAttestation.includes(this.name)) {
262
263
  const tx = await eas.attest({
263
264
  schema: this.uid,
264
265
  data: payload.data.payload,
265
266
  });
266
- if (callback)
267
- callback('pending');
267
+ callback?.("pending");
268
268
  const txResult = await tx.wait();
269
- if (callback)
270
- callback('completed');
269
+ callback?.("confirmed");
271
270
  return txResult;
272
271
  }
273
- const uid = await GapContract_1.GapContract.attest(signer, payload);
272
+ const uid = await GapContract_1.GapContract.attest(signer, payload, callback);
274
273
  return uid;
275
274
  }
276
275
  /**
@@ -301,14 +300,17 @@ class Schema {
301
300
  expirationTime: 0n,
302
301
  })),
303
302
  }));
303
+ if (callback)
304
+ callback("preparing");
304
305
  const tx = await eas.multiAttest(payload, {
305
306
  gasLimit: 5000000n,
306
307
  });
307
308
  if (callback)
308
- callback('pending');
309
- return tx.wait();
310
- if (callback)
311
- callback('completed');
309
+ callback("pending");
310
+ return tx.wait().then(() => {
311
+ if (callback)
312
+ callback("confirmed");
313
+ });
312
314
  }
313
315
  /**
314
316
  * Revokes a set of attestations by their UIDs.
@@ -316,7 +318,8 @@ class Schema {
316
318
  * @param uids
317
319
  * @returns
318
320
  */
319
- async multiRevoke(signer, toRevoke) {
321
+ async multiRevoke(signer, toRevoke, callback) {
322
+ callback?.("preparing");
320
323
  const groupBySchema = toRevoke.reduce((acc, { uid, schemaId }) => {
321
324
  if (!acc[schemaId])
322
325
  acc[schemaId] = [];
@@ -331,7 +334,10 @@ class Schema {
331
334
  const tx = await eas.multiRevoke(payload, {
332
335
  gasLimit: 5000000n,
333
336
  });
334
- return tx.wait();
337
+ callback?.("pending");
338
+ return tx.wait().then(() => {
339
+ callback?.("confirmed");
340
+ });
335
341
  }
336
342
  static exists(name, network) {
337
343
  return this.schemas[network].find((schema) => schema.name === name);
@@ -455,11 +461,11 @@ class Schema {
455
461
  }
456
462
  exports.Schema = Schema;
457
463
  Schema.schemas = {
458
- 'optimism-sepolia': [],
464
+ "optimism-sepolia": [],
459
465
  // "optimism-goerli": [],
460
466
  optimism: [],
461
467
  sepolia: [],
462
468
  arbitrum: [],
463
469
  celo: [],
464
- 'base-sepolia': [],
470
+ "base-sepolia": [],
465
471
  };
@@ -1,4 +1,4 @@
1
- import { Hex, RawAttestationPayload, RawMultiAttestPayload, SignerOrProvider } from "core/types";
1
+ import { CallbackStatus, Hex, RawAttestationPayload, RawMultiAttestPayload, SignerOrProvider } from "core/types";
2
2
  import { MultiRevocationRequest } from "@ethereum-attestation-service/eas-sdk";
3
3
  export declare class GapContract {
4
4
  static nonces: {
@@ -30,7 +30,7 @@ export declare class GapContract {
30
30
  * @param payload
31
31
  * @returns
32
32
  */
33
- static attest(signer: SignerOrProvider, payload: RawAttestationPayload): Promise<`0x${string}`>;
33
+ static attest(signer: SignerOrProvider, payload: RawAttestationPayload, callback?: ((status: CallbackStatus) => void) & ((status: string) => void)): Promise<`0x${string}`>;
34
34
  static attestBySig(signer: SignerOrProvider, payload: RawAttestationPayload): Promise<`0x${string}`>;
35
35
  /**
36
36
  * Performs a referenced multi attestation.
@@ -72,16 +72,23 @@ class GapContract {
72
72
  * @param payload
73
73
  * @returns
74
74
  */
75
- static async attest(signer, payload) {
75
+ static async attest(signer, payload, callback) {
76
76
  const contract = await GAP_1.GAP.getMulticall(signer);
77
77
  if (GAP_1.GAP.gelatoOpts?.useGasless) {
78
78
  return this.attestBySig(signer, payload);
79
79
  }
80
- const tx = await contract.attest({
80
+ callback?.("preparing");
81
+ const tx = await contract
82
+ .attest({
81
83
  schema: payload.schema,
82
84
  data: payload.data.payload,
85
+ })
86
+ .then((res) => {
87
+ callback?.("pending");
88
+ return res;
83
89
  });
84
90
  const result = await tx.wait?.();
91
+ callback?.("confirmed");
85
92
  const attestations = (0, eas_sdk_1.getUIDsFromAttestReceipt)(result)[0];
86
93
  return attestations;
87
94
  }
@@ -115,12 +122,14 @@ class GapContract {
115
122
  if (GAP_1.GAP.gelatoOpts?.useGasless) {
116
123
  return this.multiAttestBySig(signer, payload);
117
124
  }
125
+ if (callback)
126
+ callback("preparing");
118
127
  const tx = await contract.multiSequentialAttest(payload.map((p) => p.payload));
119
128
  if (callback)
120
- callback('pending');
129
+ callback("pending");
121
130
  const result = await tx.wait?.();
122
131
  if (callback)
123
- callback('completed');
132
+ callback("confirmed");
124
133
  const attestations = (0, eas_sdk_1.getUIDsFromAttestReceipt)(result);
125
134
  return attestations;
126
135
  }
@@ -1,9 +1,9 @@
1
- import { Attestation } from '../Attestation';
2
- import { CommunityDetails, ICommunityDetails } from '../types/attestations';
3
- import { Project } from './Project';
4
- import { MultiAttestPayload, SignerOrProvider, TNetwork } from 'core/types';
5
- import { Grant } from './Grant';
6
- import { ICommunityResponse } from '../karma-indexer/api/types';
1
+ import { Attestation } from "../Attestation";
2
+ import { CommunityDetails, ICommunityDetails } from "../types/attestations";
3
+ import { Project } from "./Project";
4
+ import { MultiAttestPayload, SignerOrProvider, TNetwork } from "core/types";
5
+ import { Grant } from "./Grant";
6
+ import { ICommunityResponse } from "../karma-indexer/api/types";
7
7
  export interface ICommunity {
8
8
  community: true;
9
9
  }
@@ -41,8 +41,10 @@ class Community extends Attestation_1.Attestation {
41
41
  * @param details
42
42
  */
43
43
  async attest(signer, details, callback) {
44
- console.log('Attesting community');
44
+ console.log("Attesting community");
45
45
  try {
46
+ if (callback)
47
+ callback("preparing");
46
48
  this._uid = await this.schema.attest({
47
49
  signer,
48
50
  to: this.recipient,
@@ -51,22 +53,22 @@ class Community extends Attestation_1.Attestation {
51
53
  });
52
54
  console.log(this.uid);
53
55
  if (callback)
54
- callback('pending');
56
+ callback("pending");
55
57
  if (details) {
56
58
  const communityDetails = new attestations_1.CommunityDetails({
57
59
  data: details,
58
60
  recipient: this.recipient,
59
61
  refUID: this.uid,
60
- schema: this.schema.gap.findSchema('CommunityDetails'),
62
+ schema: this.schema.gap.findSchema("CommunityDetails"),
61
63
  });
62
64
  await communityDetails.attest(signer);
63
65
  }
64
66
  if (callback)
65
- callback('completed');
67
+ callback("confirmed");
66
68
  }
67
69
  catch (error) {
68
70
  console.error(error);
69
- throw new SchemaError_1.AttestationError('ATTEST_ERROR', 'Error during attestation.');
71
+ throw new SchemaError_1.AttestationError("ATTEST_ERROR", "Error during attestation.");
70
72
  }
71
73
  }
72
74
  static from(attestations, network) {
@@ -76,7 +78,7 @@ class Community extends Attestation_1.Attestation {
76
78
  data: {
77
79
  community: true,
78
80
  },
79
- schema: GapSchema_1.GapSchema.find('Community', network),
81
+ schema: GapSchema_1.GapSchema.find("Community", network),
80
82
  chainID: attestation.chainID,
81
83
  });
82
84
  if (attestation.details) {
@@ -86,7 +88,7 @@ class Community extends Attestation_1.Attestation {
86
88
  data: {
87
89
  ...details.data,
88
90
  },
89
- schema: GapSchema_1.GapSchema.find('CommunityDetails', network),
91
+ schema: GapSchema_1.GapSchema.find("CommunityDetails", network),
90
92
  chainID: attestation.chainID,
91
93
  });
92
94
  }
@@ -1,5 +1,5 @@
1
- import { SignerOrProvider, TNetwork } from '../../../core/types';
2
- import { Attestation } from '../Attestation';
1
+ import { SignerOrProvider, TNetwork } from "../../../core/types";
2
+ import { Attestation } from "../Attestation";
3
3
  export interface _IGrantUpdate extends GrantUpdate {
4
4
  }
5
5
  export interface IGrantUpdate {
@@ -7,7 +7,7 @@ export interface IGrantUpdate {
7
7
  text: string;
8
8
  type?: string;
9
9
  }
10
- type IStatus = 'verified';
10
+ type IStatus = "verified";
11
11
  export interface IGrantUpdateStatus {
12
12
  type: `grant-update-${IStatus}`;
13
13
  reason?: string;
@@ -19,6 +19,8 @@ class GrantUpdate extends Attestation_1.Attestation {
19
19
  async attestStatus(signer, schema, callback) {
20
20
  const eas = this.schema.gap.eas.connect(signer);
21
21
  try {
22
+ if (callback)
23
+ callback("preparing");
22
24
  const tx = await eas.attest({
23
25
  schema: schema.uid,
24
26
  data: {
@@ -30,15 +32,15 @@ class GrantUpdate extends Attestation_1.Attestation {
30
32
  },
31
33
  });
32
34
  if (callback)
33
- callback('pending');
35
+ callback("pending");
34
36
  const uid = await tx.wait();
35
37
  if (callback)
36
- callback('completed');
38
+ callback("confirmed");
37
39
  console.log(uid);
38
40
  }
39
41
  catch (error) {
40
42
  console.error(error);
41
- throw new SchemaError_1.AttestationError('ATTEST_ERROR', error.message);
43
+ throw new SchemaError_1.AttestationError("ATTEST_ERROR", error.message);
42
44
  }
43
45
  }
44
46
  /**
@@ -47,17 +49,17 @@ class GrantUpdate extends Attestation_1.Attestation {
47
49
  * @param signer
48
50
  * @param reason
49
51
  */
50
- async verify(signer, reason = '', callback) {
51
- console.log('Verifying');
52
- const schema = this.schema.gap.findSchema('GrantUpdateStatus');
53
- schema.setValue('type', 'grant-update-verified');
54
- schema.setValue('reason', reason);
55
- console.log('Before attest grant update verified');
52
+ async verify(signer, reason = "", callback) {
53
+ console.log("Verifying");
54
+ const schema = this.schema.gap.findSchema("GrantUpdateStatus");
55
+ schema.setValue("type", "grant-update-verified");
56
+ schema.setValue("reason", reason);
57
+ console.log("Before attest grant update verified");
56
58
  await this.attestStatus(signer, schema, callback);
57
- console.log('After attest grant update verified');
59
+ console.log("After attest grant update verified");
58
60
  this.verified.push(new GrantUpdateStatus({
59
61
  data: {
60
- type: 'grant-update-verified',
62
+ type: "grant-update-verified",
61
63
  reason,
62
64
  },
63
65
  refUID: this.uid,
@@ -72,16 +74,16 @@ class GrantUpdate extends Attestation_1.Attestation {
72
74
  data: {
73
75
  ...attestation.data,
74
76
  },
75
- schema: new AllGapSchemas_1.AllGapSchemas().findSchema('GrantUpdate', consts_1.chainIdToNetwork[attestation.chainID]),
77
+ schema: new AllGapSchemas_1.AllGapSchemas().findSchema("GrantUpdate", consts_1.chainIdToNetwork[attestation.chainID]),
76
78
  chainID: attestation.chainID,
77
79
  });
78
80
  if (attestation.verified?.length > 0) {
79
- grantUpdate.verified = attestation.verified.map(m => new GrantUpdateStatus({
81
+ grantUpdate.verified = attestation.verified.map((m) => new GrantUpdateStatus({
80
82
  ...m,
81
83
  data: {
82
84
  ...m.data,
83
85
  },
84
- schema: new AllGapSchemas_1.AllGapSchemas().findSchema('GrantUpdateStatus', consts_1.chainIdToNetwork[attestation.chainID]),
86
+ schema: new AllGapSchemas_1.AllGapSchemas().findSchema("GrantUpdateStatus", consts_1.chainIdToNetwork[attestation.chainID]),
85
87
  chainID: attestation.chainID,
86
88
  }));
87
89
  }
@@ -6,6 +6,6 @@ export interface IMemberOf {
6
6
  }
7
7
  export declare class MemberOf extends Attestation<IMemberOf> {
8
8
  details?: MemberDetails;
9
- multiAttestPayload(currentPayload?: MultiAttestPayload, projectIdx?: number): Promise<[Attestation<unknown, import("core").GapSchema>, import("core/types").RawMultiAttestPayload][]>;
9
+ multiAttestPayload(currentPayload?: MultiAttestPayload, projectIdx?: number): Promise<[Attestation<unknown, import("..").GapSchema>, import("core/types").RawMultiAttestPayload][]>;
10
10
  attest(signer: SignerOrProvider, callback?: Function): Promise<void>;
11
11
  }
@@ -1,8 +1,8 @@
1
- import { MultiAttestPayload, SignerOrProvider, TNetwork } from '../../types';
2
- import { Attestation } from '../Attestation';
3
- import { GapSchema } from '../GapSchema';
4
- import { IMilestoneResponse } from '../karma-indexer/api/types';
5
- import { MilestoneCompleted } from '../types/attestations';
1
+ import { MultiAttestPayload, SignerOrProvider, TNetwork } from "../../types";
2
+ import { Attestation } from "../Attestation";
3
+ import { GapSchema } from "../GapSchema";
4
+ import { IMilestoneResponse } from "../karma-indexer/api/types";
5
+ import { MilestoneCompleted } from "../types/attestations";
6
6
  export interface IMilestone {
7
7
  title: string;
8
8
  startsAt?: number;
@@ -52,13 +52,13 @@ export declare class Milestone extends Attestation<IMilestone> implements IMiles
52
52
  * @param signer
53
53
  * @param reason
54
54
  */
55
- complete(signer: SignerOrProvider, reason?: string): Promise<void>;
55
+ complete(signer: SignerOrProvider, reason?: string, callback?: Function): Promise<void>;
56
56
  /**
57
57
  * Revokes the completed status of the milestone. If the milestone is not completed,
58
58
  * it will throw an error.
59
59
  * @param signer
60
60
  */
61
- revokeCompletion(signer: SignerOrProvider): Promise<void>;
61
+ revokeCompletion(signer: SignerOrProvider, callback?: Function): Promise<void>;
62
62
  /**
63
63
  * Creates the payload for a multi-attestation.
64
64
  *
@@ -80,10 +80,10 @@ export declare class Milestone extends Attestation<IMilestone> implements IMiles
80
80
  private attestStatus;
81
81
  static from(attestations: IMilestoneResponse[], network: TNetwork): Milestone[];
82
82
  /**
83
- * Verify this milestone. If the milestone is not completed or already verified,
84
- * it will throw an error.
85
- * @param signer
86
- * @param reason
87
- */
83
+ * Verify this milestone. If the milestone is not completed or already verified,
84
+ * it will throw an error.
85
+ * @param signer
86
+ * @param reason
87
+ */
88
88
  verify(signer: SignerOrProvider, reason?: string, callback?: Function): Promise<void>;
89
89
  }