@show-karma/karma-gap-sdk 0.1.29

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.
Files changed (78) hide show
  1. package/core/abi/MultiAttester.json +676 -0
  2. package/core/class/Attestation.d.ts +169 -0
  3. package/core/class/Attestation.js +311 -0
  4. package/core/class/Fetcher.d.ts +132 -0
  5. package/core/class/Fetcher.js +7 -0
  6. package/core/class/GAP.d.ts +212 -0
  7. package/core/class/GAP.js +206 -0
  8. package/core/class/GapSchema.d.ts +33 -0
  9. package/core/class/GapSchema.js +61 -0
  10. package/core/class/Gelato/Gelato.d.ts +0 -0
  11. package/core/class/Gelato/Gelato.js +263 -0
  12. package/core/class/GraphQL/AxiosGQL.d.ts +6 -0
  13. package/core/class/GraphQL/AxiosGQL.js +25 -0
  14. package/core/class/GraphQL/EASClient.d.ts +16 -0
  15. package/core/class/GraphQL/EASClient.js +26 -0
  16. package/core/class/GraphQL/Fetcher.d.ts +132 -0
  17. package/core/class/GraphQL/Fetcher.js +7 -0
  18. package/core/class/GraphQL/GAPFetcher.d.ts +160 -0
  19. package/core/class/GraphQL/GAPFetcher.js +516 -0
  20. package/core/class/GraphQL/GapEasClient.d.ts +63 -0
  21. package/core/class/GraphQL/GapEasClient.js +420 -0
  22. package/core/class/GraphQL/index.d.ts +3 -0
  23. package/core/class/GraphQL/index.js +19 -0
  24. package/core/class/Schema.d.ts +213 -0
  25. package/core/class/Schema.js +434 -0
  26. package/core/class/SchemaError.d.ts +26 -0
  27. package/core/class/SchemaError.js +34 -0
  28. package/core/class/contract/GapContract.d.ts +55 -0
  29. package/core/class/contract/GapContract.js +176 -0
  30. package/core/class/contract/MultiAttest.d.ts +10 -0
  31. package/core/class/contract/MultiAttest.js +19 -0
  32. package/core/class/entities/Community.d.ts +36 -0
  33. package/core/class/entities/Community.js +88 -0
  34. package/core/class/entities/Grant.d.ts +53 -0
  35. package/core/class/entities/Grant.js +194 -0
  36. package/core/class/entities/MemberOf.d.ts +11 -0
  37. package/core/class/entities/MemberOf.js +31 -0
  38. package/core/class/entities/Milestone.d.ts +63 -0
  39. package/core/class/entities/Milestone.js +171 -0
  40. package/core/class/entities/Project.d.ts +73 -0
  41. package/core/class/entities/Project.js +243 -0
  42. package/core/class/entities/index.d.ts +5 -0
  43. package/core/class/entities/index.js +21 -0
  44. package/core/class/index.d.ts +7 -0
  45. package/core/class/index.js +23 -0
  46. package/core/class/karma-indexer/GapIndexerClient.d.ts +28 -0
  47. package/core/class/karma-indexer/GapIndexerClient.js +137 -0
  48. package/core/class/types/attestations.d.ts +108 -0
  49. package/core/class/types/attestations.js +55 -0
  50. package/core/consts.d.ts +19 -0
  51. package/core/consts.js +228 -0
  52. package/core/index.d.ts +7 -0
  53. package/core/index.js +23 -0
  54. package/core/types.d.ts +107 -0
  55. package/core/types.js +13 -0
  56. package/core/utils/gelato/index.d.ts +3 -0
  57. package/core/utils/gelato/index.js +19 -0
  58. package/core/utils/gelato/send-gelato-txn.d.ts +54 -0
  59. package/core/utils/gelato/send-gelato-txn.js +99 -0
  60. package/core/utils/gelato/sponsor-handler.d.ts +9 -0
  61. package/core/utils/gelato/sponsor-handler.js +60 -0
  62. package/core/utils/gelato/watch-gelato-txn.d.ts +7 -0
  63. package/core/utils/gelato/watch-gelato-txn.js +55 -0
  64. package/core/utils/get-date.d.ts +1 -0
  65. package/core/utils/get-date.js +7 -0
  66. package/core/utils/gql-queries.d.ts +12 -0
  67. package/core/utils/gql-queries.js +90 -0
  68. package/core/utils/index.d.ts +6 -0
  69. package/core/utils/index.js +22 -0
  70. package/core/utils/map-filter.d.ts +8 -0
  71. package/core/utils/map-filter.js +20 -0
  72. package/core/utils/serialize-bigint.d.ts +1 -0
  73. package/core/utils/serialize-bigint.js +8 -0
  74. package/core/utils/to-unix.d.ts +1 -0
  75. package/core/utils/to-unix.js +25 -0
  76. package/index.d.ts +1 -0
  77. package/index.js +17 -0
  78. package/package.json +37 -0
@@ -0,0 +1,434 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Schema = void 0;
4
+ const eas_sdk_1 = require("@ethereum-attestation-service/eas-sdk");
5
+ const SchemaError_1 = require("./SchemaError");
6
+ const ethers_1 = require("ethers");
7
+ const consts_1 = require("../consts");
8
+ const GAP_1 = require("./GAP");
9
+ const GapContract_1 = require("./contract/GapContract");
10
+ /**
11
+ * Represents the EAS Schema and provides methods to encode and decode the schema,
12
+ * and validate the schema references.
13
+ *
14
+ * Also provides a set of static methods to manage the schema list.
15
+ *
16
+ * @example
17
+ * ```
18
+ * // You may or not attribute a schema to a variable.
19
+ * new Schema({
20
+ * name: "Grantee",
21
+ * schema: [{ type: "bool", name: "grantee", value: true }],
22
+ * uid: "0x000000000
23
+ * });
24
+ *
25
+ * const granteeDetails = new Schema({
26
+ * name: "GranteeDetails",
27
+ * schema: [
28
+ * { type: "bool", name: "name", value: null }
29
+ * { type: "bool", name: "description", value: null }
30
+ * { type: "bool", name: "imageURL", value: null }
31
+ * ],
32
+ * uid: "0x000000000,
33
+ * references: "Grantee"
34
+ * });
35
+ *
36
+ * // Validate if references are correct and all of them exist.
37
+ * Schema.validate();
38
+ *
39
+ * // Gets the schema by name.
40
+ * const grantee = Schema.get("Grantee");
41
+ *
42
+ * // Sets a single schema value.
43
+ * grantee.setValue("grantee", true);
44
+ *
45
+ * // Sets multiple schema values.
46
+ * granteeDetails.setValues({ name: "John Doe", description: "A description", imageURL: "https://example.com/image.png" });
47
+ *
48
+ * // Gets the schema encoded data, used to create an attestation.
49
+ * const encodedGrantee = grantee.encode();
50
+ *
51
+ * // Verify if schema exists
52
+ * Schema.exists("Grantee"); // true
53
+ * Schema.exists("GranteeDetails"); // true
54
+ * Schema.exists("GranteeDetails2"); // false
55
+ *
56
+ * // Get all schemas.
57
+ * Schema.getAll(); // [grantee, granteeDetails]
58
+ *
59
+ * // Get all schema names.
60
+ * Schema.getNames(); // ["Grantee", "GranteeDetails"]
61
+ *
62
+ * // Get many schemas by name. Throws an error if schema does not exist.
63
+ * Schema.getMany(["Grantee", "GranteeDetails"]); // [grantee, granteeDetails]
64
+ *
65
+ * // Replace all schemas. Throws an error if schema does not exist.
66
+ * Schema.replaceAll([grantee, granteeDetails]);
67
+ *
68
+ * // Replace one schema. This will replace a schema using the inbound schema name.. Throws an error if schema does not exist.
69
+ * Schema.replaceOne(grantee);
70
+ *
71
+ * // Converts a raw schema string (e.g. "uint256 id, string name") to a SchemaItem[].
72
+ * const schema = Schema.rawToObject("uint256 id, string name");
73
+ * ```
74
+ */
75
+ class Schema {
76
+ /**
77
+ * Creates a new schema instance
78
+ * @param args
79
+ * @param strict If true, will throw an error if schema reference is not valid. With this option, user should add schemas
80
+ * in a strict order.
81
+ */
82
+ constructor(args, strict = false, ignoreSchema = false) {
83
+ this._schema = [];
84
+ this.assert(args, strict);
85
+ this._schema = args.schema;
86
+ this.uid = args.uid;
87
+ this.name = args.name;
88
+ this.references = args.references;
89
+ this.revocable = args.revocable || true;
90
+ this.encoder = new eas_sdk_1.SchemaEncoder(this.raw);
91
+ }
92
+ /**
93
+ * Encode the schema to be used as payload in the attestation
94
+ * @returns
95
+ */
96
+ encode(schema) {
97
+ return this.encoder.encodeData(schema || this.schema);
98
+ }
99
+ /**
100
+ * Set a schema field value.
101
+ * @param key
102
+ * @param value
103
+ */
104
+ setValue(key, value) {
105
+ const idx = this._schema.findIndex((item) => item.name === key);
106
+ if (!~idx)
107
+ throw new SchemaError_1.SchemaError("INVALID_SCHEMA_FIELD", `Field ${key} not found in schema ${this.name}`);
108
+ this.assertField(this._schema[idx], value);
109
+ this._schema[idx].value = value;
110
+ }
111
+ /**
112
+ * Tests if the current schema is a JSON Schema.
113
+ *
114
+ * @returns boolean
115
+ */
116
+ isJsonSchema() {
117
+ return !!this.schema.find((s) => s.name === "json" && s.type === "string");
118
+ }
119
+ assertField(item, value) {
120
+ const { type, name } = item;
121
+ if (type.includes("uint") && /\D/.test(value)) {
122
+ throw new SchemaError_1.SchemaError("INVALID_SCHEMA_FIELD", `Field ${name} is of type ${type} but value is not a number.`);
123
+ }
124
+ if (type.includes("address") &&
125
+ !ethers_1.ethers.utils.isAddress(value) &&
126
+ value !== consts_1.zeroAddress) {
127
+ throw new SchemaError_1.SchemaError("INVALID_SCHEMA_FIELD", `Field ${name} is of type ${type} but value is not a valid address.`);
128
+ }
129
+ if (type.includes("bytes") && !value.startsWith("0x")) {
130
+ throw new SchemaError_1.SchemaError("INVALID_SCHEMA_FIELD", `Field ${name} is of type ${type} but value is not a valid hex string.`);
131
+ }
132
+ if (type.includes("bool") &&
133
+ (!["true", "false", true, false].includes(value) ||
134
+ typeof value !== "boolean")) {
135
+ throw new SchemaError_1.SchemaError("INVALID_SCHEMA_FIELD", `Field ${name} is of type ${type} but value is not a valid boolean.`);
136
+ }
137
+ if (type.includes("tuple") && !Array.isArray(value)) {
138
+ throw new SchemaError_1.SchemaError("INVALID_SCHEMA_FIELD", `Field ${name} is of type ${type} but value is not a valid array.`);
139
+ }
140
+ if (type === "string" && name === "json") {
141
+ try {
142
+ JSON.parse(value);
143
+ }
144
+ catch (error) {
145
+ throw new SchemaError_1.SchemaError("INVALID_SCHEMA_FIELD", `Field ${name} is of type ${type} but value is not a valid JSON string.`);
146
+ }
147
+ }
148
+ }
149
+ /**
150
+ * Asserts if schema is valid.
151
+ * > Does not check references if `strict = false`. To check references use `Schema.validate()`
152
+ * @param args
153
+ */
154
+ assert(args, strict = false) {
155
+ const { name, schema, uid, references } = args;
156
+ if (!name) {
157
+ throw new SchemaError_1.SchemaError("MISSING_FIELD", "Schema name is required");
158
+ }
159
+ if (!schema && !Array.isArray(schema)) {
160
+ throw new SchemaError_1.SchemaError("MISSING_FIELD", "Schema must be an array.");
161
+ }
162
+ // if (!uid) {
163
+ // throw new SchemaError("MISSING_FIELD", "Schema uid is required");
164
+ // }
165
+ if (strict && references && !Schema.exists(references)) {
166
+ throw new SchemaError_1.SchemaError("INVALID_REFERENCE", `Schema ${name} references ${references} but it does not exist.`);
167
+ }
168
+ }
169
+ /**
170
+ * Attest off chain data
171
+ * @returns
172
+ */
173
+ async attestOffchain({ data, signer, to, refUID }) {
174
+ const eas = await GAP_1.GAP.eas.getOffchain();
175
+ const payload = {
176
+ data,
177
+ version: eas.version,
178
+ revocable: this.revocable,
179
+ expirationTime: 0n,
180
+ recipient: to,
181
+ refUID,
182
+ schema: this.raw,
183
+ time: BigInt((Date.now() / 1000).toFixed(0)),
184
+ };
185
+ return eas.signOffchainAttestation(payload, signer);
186
+ }
187
+ /**
188
+ * Revokes one off chain attestation by its UID.
189
+ * @param uid
190
+ * @param signer
191
+ * @returns
192
+ */
193
+ async revokeOffchain(uid, signer) {
194
+ const eas = GAP_1.GAP.eas.connect(signer);
195
+ return eas.revokeOffchain(uid);
196
+ }
197
+ /**
198
+ * Revokes multiple off chain attestations by their UIDs.
199
+ * @param uids
200
+ * @param signer
201
+ * @returns
202
+ */
203
+ async multiRevokeOffchain(uids, signer) {
204
+ const eas = GAP_1.GAP.eas.connect(signer);
205
+ return eas.multiRevokeOffchain(uids);
206
+ }
207
+ /**
208
+ * Attest for a schema.
209
+ * @param param0
210
+ * @returns
211
+ */
212
+ async attest({ data, to, signer, refUID }) {
213
+ const eas = GAP_1.GAP.eas.connect(signer);
214
+ if (this.references && !refUID)
215
+ throw new SchemaError_1.AttestationError("INVALID_REFERENCE", "Attestation schema references another schema but no reference UID was provided.");
216
+ if (this.isJsonSchema()) {
217
+ this.setValue("json", JSON.stringify(data));
218
+ }
219
+ else {
220
+ Object.entries(data).forEach(([key, value]) => {
221
+ this.setValue(key, value);
222
+ });
223
+ }
224
+ const payload = {
225
+ schema: this.uid,
226
+ data: {
227
+ raw: {
228
+ recipient: to,
229
+ expirationTime: 0n,
230
+ revocable: true,
231
+ data: this.schema,
232
+ refUID,
233
+ value: 0n,
234
+ },
235
+ payload: {
236
+ recipient: to,
237
+ expirationTime: 0n,
238
+ revocable: true,
239
+ data: this.encode(this.schema),
240
+ refUID,
241
+ value: 0n,
242
+ },
243
+ },
244
+ };
245
+ if (consts_1.useDefaultAttestation.includes(this.name)) {
246
+ const tx = await eas.attest({
247
+ schema: this.uid,
248
+ data: payload.data.payload,
249
+ });
250
+ return tx.wait();
251
+ }
252
+ const uid = await GapContract_1.GapContract.attest(signer, payload);
253
+ return uid;
254
+ }
255
+ /**
256
+ * Bulk attest a set of attestations.
257
+ * @param signer
258
+ * @param entities
259
+ * @returns
260
+ */
261
+ async multiAttest(signer, entities = []) {
262
+ entities.forEach((entity) => {
263
+ if (this.references && !entity.refUID)
264
+ throw new SchemaError_1.SchemaError("INVALID_REF_UID", `Entity ${entity.schema.name} references another schema but no reference UID was provided.`);
265
+ });
266
+ const eas = GAP_1.GAP.eas.connect(signer);
267
+ const entityBySchema = entities.reduce((acc, entity) => {
268
+ const schema = entity.schema.uid;
269
+ if (!acc[schema])
270
+ acc[schema] = [];
271
+ acc[schema].push(entity);
272
+ return acc;
273
+ }, {});
274
+ const payload = Object.entries(entityBySchema).map(([schema, ents]) => ({
275
+ schema,
276
+ data: ents.map((e) => ({
277
+ data: e.schema.encode(),
278
+ refUID: e.refUID,
279
+ recipient: e.recipient,
280
+ expirationTime: 0n,
281
+ })),
282
+ }));
283
+ const tx = await eas.multiAttest(payload, {
284
+ gasLimit: 5000000n,
285
+ });
286
+ return tx.wait();
287
+ }
288
+ /**
289
+ * Revokes a set of attestations by their UIDs.
290
+ * @param signer
291
+ * @param uids
292
+ * @returns
293
+ */
294
+ async multiRevoke(signer, toRevoke) {
295
+ const groupBySchema = toRevoke.reduce((acc, { uid, schemaId }) => {
296
+ if (!acc[schemaId])
297
+ acc[schemaId] = [];
298
+ acc[schemaId].push(uid);
299
+ return acc;
300
+ }, {});
301
+ const eas = GAP_1.GAP.eas.connect(signer);
302
+ const payload = Object.entries(groupBySchema).map(([schema, uids]) => ({
303
+ schema,
304
+ data: uids.map((uid) => ({ uid })),
305
+ }));
306
+ const tx = await eas.multiRevoke(payload, {
307
+ gasLimit: 5000000n,
308
+ });
309
+ return tx.wait();
310
+ }
311
+ static exists(name) {
312
+ return this.schemas.find((schema) => schema.name === name);
313
+ }
314
+ /**
315
+ * Adds the schema signature to a shares list. Use Schema.get("SchemaName") to get the schema.
316
+ *
317
+ * __Note that this will make the schema available to all instances
318
+ * of the class AND its data can be overriden by any changes.__
319
+ * @param schemas
320
+ */
321
+ static add(...schemas) {
322
+ schemas.forEach((schema) => {
323
+ if (!this.exists(schema.name))
324
+ this.schemas.push(schema);
325
+ else
326
+ throw new SchemaError_1.SchemaError("SCHEMA_ALREADY_EXISTS", `Schema ${schema.name} already exists.`);
327
+ });
328
+ }
329
+ static getAll() {
330
+ return this.schemas;
331
+ }
332
+ static get(name) {
333
+ const schema = this.schemas.find((schema) => schema.name === name || schema.uid === name);
334
+ if (!schema)
335
+ throw new SchemaError_1.SchemaError("SCHEMA_NOT_FOUND", `Schema ${name} not found. Available schemas: ${Schema.getNames()}`);
336
+ return schema;
337
+ }
338
+ /**
339
+ * Find many schemas by name and return them as an array in the same order.
340
+ * @param names
341
+ * @returns
342
+ */
343
+ static getMany(names) {
344
+ return names.map((name) => this.get(name));
345
+ }
346
+ static getNames() {
347
+ return Schema.schemas.map((schema) => schema.name);
348
+ }
349
+ /**
350
+ * Validade references
351
+ * @throws {SchemaError} if any reference is not valid
352
+ * @returns {true} if references are valid
353
+ */
354
+ static validate() {
355
+ const errors = [];
356
+ this.schemas.forEach((schema) => {
357
+ if (!schema.references || Schema.exists(schema.references))
358
+ return;
359
+ else
360
+ errors.push(new SchemaError_1.SchemaError("INVALID_REFERENCE", `Schema ${schema.name} references ${schema.references} but it does not exist.`));
361
+ });
362
+ if (errors.length)
363
+ throw errors;
364
+ return true;
365
+ }
366
+ /**
367
+ * Replaces the schema list with a new list.
368
+ * @param schemas
369
+ */
370
+ static replaceAll(schemas) {
371
+ this.schemas = schemas;
372
+ }
373
+ /**
374
+ * Replaces a schema from the schema list.
375
+ * @throws {SchemaError} if desired schema name does not exist.
376
+ */
377
+ static replaceOne(schema) {
378
+ const idx = this.schemas.findIndex((item) => schema.name === item.name);
379
+ if (!~idx)
380
+ throw new SchemaError_1.SchemaError("SCHEMA_NOT_FOUND", `Schema ${schema.name} not found.`);
381
+ this.schemas[idx] = schema;
382
+ }
383
+ /**
384
+ * Transforms the given raw schema to SchemaItem[]
385
+ *
386
+ * @example
387
+ * ```
388
+ * const schema = Schema.rawToObject("uint256 id, string name");
389
+ * // schema = [{ type: "uint256", name: "id", value: null }, { type: "string", name: "name", value: null }]
390
+ * ```
391
+ * @param abi
392
+ * @returns
393
+ */
394
+ static rawToObject(abi) {
395
+ const items = abi.trim().replace(/,\s+/gim, ",").split(",");
396
+ const schema = items.map((item) => {
397
+ const [type, name] = item.split(" ");
398
+ return { type, name, value: null };
399
+ });
400
+ return schema;
401
+ }
402
+ /**
403
+ * Returns the raw schema string.
404
+ * @example
405
+ * ```ts
406
+ * const schema = new Schema({ name: "Grantee", schema: [{ type: "bool", name: "grantee", value: true }], uid: "0x000000000" });
407
+ * schema.raw; // "bool grantee"
408
+ * ```
409
+ */
410
+ get raw() {
411
+ return this.schema.map((item) => `${item.type} ${item.name}`).join(",");
412
+ }
413
+ get schema() {
414
+ return this._schema;
415
+ }
416
+ /**
417
+ * Get all schemas that references this schema. Note that this
418
+ * will return a reference to the original schema and all
419
+ * the changes made to it will reflect the original instance.
420
+ */
421
+ get children() {
422
+ return Schema.schemas.filter((schema) => schema.references === this.name || schema.references === this.uid);
423
+ }
424
+ /**
425
+ * Asserts and sets the schema value.
426
+ */
427
+ set schema(schema) {
428
+ schema.forEach((item) => {
429
+ this.setValue(item.name, item.value);
430
+ });
431
+ }
432
+ }
433
+ exports.Schema = Schema;
434
+ Schema.schemas = [];
@@ -0,0 +1,26 @@
1
+ declare const SchemaErrorCodes: {
2
+ INVALID_SCHEMA: number;
3
+ INVALID_SCHEMA_NAME: number;
4
+ INVALID_SCHEMA_TYPE: number;
5
+ SCHEMA_ALREADY_EXISTS: number;
6
+ SCHEMA_NOT_FOUND: number;
7
+ SCHEMA_NOT_CREATED: number;
8
+ MISSING_FIELD: number;
9
+ INVALID_REFERENCE: number;
10
+ INVALID_SCHEMA_FIELD: number;
11
+ INVALID_DATA: number;
12
+ REVOKE_ERROR: number;
13
+ ATTEST_ERROR: number;
14
+ INVALID_REF_UID: number;
15
+ REVOKATION_ERROR: number;
16
+ NOT_REVOCABLE: number;
17
+ };
18
+ export declare class SchemaError extends Error {
19
+ readonly code: number;
20
+ private readonly _message;
21
+ constructor(code: keyof typeof SchemaErrorCodes, append?: string);
22
+ get message(): string;
23
+ }
24
+ export declare class AttestationError extends SchemaError {
25
+ }
26
+ export {};
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AttestationError = exports.SchemaError = void 0;
4
+ const SchemaErrorCodes = {
5
+ INVALID_SCHEMA: 50001,
6
+ INVALID_SCHEMA_NAME: 50002,
7
+ INVALID_SCHEMA_TYPE: 50003,
8
+ SCHEMA_ALREADY_EXISTS: 50004,
9
+ SCHEMA_NOT_FOUND: 50005,
10
+ SCHEMA_NOT_CREATED: 50006,
11
+ MISSING_FIELD: 50007,
12
+ INVALID_REFERENCE: 50008,
13
+ INVALID_SCHEMA_FIELD: 50009,
14
+ INVALID_DATA: 50010,
15
+ REVOKE_ERROR: 50011,
16
+ ATTEST_ERROR: 50012,
17
+ INVALID_REF_UID: 50013,
18
+ REVOKATION_ERROR: 50014,
19
+ NOT_REVOCABLE: 50015,
20
+ };
21
+ class SchemaError extends Error {
22
+ constructor(code, append) {
23
+ super(`${code}${append ? `: ${append}` : ""}`);
24
+ this._message = append || code.replace(/_/g, " ");
25
+ this.code = SchemaErrorCodes[code];
26
+ }
27
+ get message() {
28
+ return this._message;
29
+ }
30
+ }
31
+ exports.SchemaError = SchemaError;
32
+ class AttestationError extends SchemaError {
33
+ }
34
+ exports.AttestationError = AttestationError;
@@ -0,0 +1,55 @@
1
+ import { Hex, RawAttestationPayload, RawMultiAttestPayload, SignerOrProvider } from 'core/types';
2
+ import { MultiRevocationRequest } from '@ethereum-attestation-service/eas-sdk';
3
+ export declare class GapContract {
4
+ static nonces: {
5
+ [key: string]: number;
6
+ };
7
+ /**
8
+ * Signs a message for the delegated attestation.
9
+ * @param signer
10
+ * @param payload
11
+ * @returns r,s,v signature
12
+ */
13
+ private static signAttestation;
14
+ /**
15
+ * Returns the r, s, v values of a signature
16
+ * @param signature
17
+ * @returns
18
+ */
19
+ private static getRSV;
20
+ private static getSignerAddress;
21
+ /**
22
+ * Get nonce for the transaction
23
+ * @param address
24
+ * @returns
25
+ */
26
+ private static getNonce;
27
+ /**
28
+ * Send a single attestation
29
+ * @param signer
30
+ * @param payload
31
+ * @returns
32
+ */
33
+ static attest(signer: SignerOrProvider, payload: RawAttestationPayload): Promise<`0x${string}`>;
34
+ static attestBySig(signer: SignerOrProvider, payload: RawAttestationPayload): Promise<`0x${string}`>;
35
+ /**
36
+ * Performs a referenced multi attestation.
37
+ *
38
+ * @returns an array with the attestation UIDs.
39
+ */
40
+ static multiAttest(signer: SignerOrProvider, payload: RawMultiAttestPayload[]): Promise<Hex[]>;
41
+ /**
42
+ * Performs a referenced multi attestation.
43
+ *
44
+ * @returns an array with the attestation UIDs.
45
+ */
46
+ static multiAttestBySig(signer: SignerOrProvider, payload: RawMultiAttestPayload[]): Promise<Hex[]>;
47
+ static multiRevoke(signer: SignerOrProvider, payload: MultiRevocationRequest[]): Promise<any>;
48
+ /**
49
+ * Performs a referenced multi attestation.
50
+ *
51
+ * @returns an array with the attestation UIDs.
52
+ */
53
+ static multiRevokeBySig(signer: SignerOrProvider, payload: MultiRevocationRequest[]): Promise<void>;
54
+ private static getTransactionLogs;
55
+ }