@settlemint/sdk-eas 2.3.5-pr43bb55ea → 2.3.5-pr63ad9083

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/dist/eas.d.ts CHANGED
@@ -1,30 +1,15 @@
1
- import { z } from "zod/v4";
1
+ import { createPortalClient } from "@settlemint/sdk-portal";
2
+ import { Address, Hex } from "viem";
2
3
 
3
- //#region src/client-options.schema.d.ts
4
+ //#region src/types.d.ts
4
5
  /**
5
- * Schema for validating EAS client configuration options.
6
- * Extends the base Viem client options with EAS-specific requirements.
6
+ * Common address constants
7
7
  */
8
8
  /**
9
- * Schema for validating EAS client configuration options.
10
- * Extends the base Viem client options with EAS-specific requirements.
11
- */
12
- declare const ClientOptionsSchema: z.ZodObject<{
13
- schemaRegistryAddress: z.ZodString;
14
- attestationAddress: z.ZodString;
15
- accessToken: z.ZodString;
16
- chainId: z.ZodString;
17
- chainName: z.ZodString;
18
- rpcUrl: z.ZodString;
19
- }, z.core.$strip>;
20
- /**
21
- * Configuration options for creating an EAS client.
22
- * Combines EAS-specific options with base Viem client options.
9
+ * Common address constants
23
10
  */
24
- type ClientOptions = z.infer<typeof ClientOptionsSchema>;
25
-
26
- //#endregion
27
- //#region src/types.d.ts
11
+ declare const ZERO_ADDRESS: Address;
12
+ declare const ZERO_BYTES32: Hex;
28
13
  /**
29
14
  * Supported field types for EAS schema fields.
30
15
  * Maps to the Solidity types that can be used in EAS schemas.
@@ -53,45 +38,349 @@ interface SchemaField {
53
38
  description?: string;
54
39
  }
55
40
  /**
56
- * Options for registering a new schema in the EAS Schema Registry.
41
+ * Configuration options for the EAS client
42
+ */
43
+ interface EASClientOptions {
44
+ /** Portal GraphQL endpoint URL */
45
+ instance: string;
46
+ /** Portal access token */
47
+ accessToken: string;
48
+ /** Optional EAS contract address (if already deployed) */
49
+ easContractAddress?: Address;
50
+ /** Optional Schema Registry contract address (if already deployed) */
51
+ schemaRegistryContractAddress?: Address;
52
+ /** Enable debug logging */
53
+ debug?: boolean;
54
+ }
55
+ /**
56
+ * Schema registration request
57
57
  */
58
- interface RegisterSchemaOptions {
59
- /** Array of fields that make up the schema */
60
- fields: SchemaField[];
61
- /** Address of the resolver contract that will handle attestations */
62
- resolverAddress: string;
58
+ interface SchemaRequest {
59
+ /** Schema fields (alternative to schema string) */
60
+ fields?: SchemaField[];
61
+ /** Raw schema string (alternative to fields) */
62
+ schema?: string;
63
+ /** Resolver contract address (use ZERO_ADDRESS for no resolver) */
64
+ resolver: Address;
63
65
  /** Whether attestations using this schema can be revoked */
64
66
  revocable: boolean;
65
67
  }
68
+ /**
69
+ * Attestation data structure
70
+ */
71
+ interface AttestationData {
72
+ /** Recipient of the attestation */
73
+ recipient: Address;
74
+ /** Expiration time (0 for no expiration) */
75
+ expirationTime: bigint;
76
+ /** Whether this attestation can be revoked */
77
+ revocable: boolean;
78
+ /** Reference UID (use ZERO_BYTES32 for no reference) */
79
+ refUID: Hex;
80
+ /** Encoded attestation data */
81
+ data: Hex;
82
+ /** Value sent with the attestation */
83
+ value: bigint;
84
+ }
85
+ /**
86
+ * Attestation request
87
+ */
88
+ interface AttestationRequest {
89
+ /** Schema UID to attest against */
90
+ schema: Hex;
91
+ /** Attestation data */
92
+ data: AttestationData;
93
+ }
94
+ /**
95
+ * Transaction result
96
+ */
97
+ interface TransactionResult {
98
+ /** Transaction hash */
99
+ hash: Hex;
100
+ /** Whether the transaction was successful */
101
+ success: boolean;
102
+ }
103
+ /**
104
+ * Schema information
105
+ */
106
+ interface SchemaData {
107
+ /** Schema UID */
108
+ uid: Hex;
109
+ /** Resolver contract address */
110
+ resolver: Address;
111
+ /** Whether attestations can be revoked */
112
+ revocable: boolean;
113
+ /** Schema string */
114
+ schema: string;
115
+ }
116
+ /**
117
+ * Attestation information
118
+ */
119
+ interface AttestationInfo {
120
+ /** Attestation UID */
121
+ uid: Hex;
122
+ /** Schema UID */
123
+ schema: Hex;
124
+ /** Address that created the attestation */
125
+ attester: Address;
126
+ /** Recipient of the attestation */
127
+ recipient: Address;
128
+ /** Creation timestamp */
129
+ time: bigint;
130
+ /** Expiration timestamp */
131
+ expirationTime: bigint;
132
+ /** Whether this attestation can be revoked */
133
+ revocable: boolean;
134
+ /** Reference UID */
135
+ refUID: Hex;
136
+ /** Encoded attestation data */
137
+ data: Hex;
138
+ /** Value sent with the attestation */
139
+ value: bigint;
140
+ }
141
+ /**
142
+ * Options for retrieving schemas
143
+ */
144
+ interface GetSchemasOptions {
145
+ /** Maximum number of schemas to return */
146
+ limit?: number;
147
+ /** Number of schemas to skip */
148
+ offset?: number;
149
+ }
150
+ /**
151
+ * Options for retrieving attestations
152
+ */
153
+ interface GetAttestationsOptions {
154
+ /** Maximum number of attestations to return */
155
+ limit?: number;
156
+ /** Number of attestations to skip */
157
+ offset?: number;
158
+ /** Filter by schema UID */
159
+ schema?: Hex;
160
+ /** Filter by attester address */
161
+ attester?: Address;
162
+ /** Filter by recipient address */
163
+ recipient?: Address;
164
+ }
165
+ /**
166
+ * Contract deployment result
167
+ */
168
+ interface DeploymentResult {
169
+ /** Deployed EAS contract address */
170
+ easAddress: Address;
171
+ /** Deployed Schema Registry contract address */
172
+ schemaRegistryAddress: Address;
173
+ /** EAS deployment transaction hash (when address not immediately available) */
174
+ easTransactionHash?: Hex;
175
+ /** Schema Registry deployment transaction hash (when address not immediately available) */
176
+ schemaRegistryTransactionHash?: Hex;
177
+ }
178
+ /**
179
+ * @deprecated Use SchemaRequest instead
180
+ */
181
+ interface RegisterSchemaOptions extends SchemaRequest {}
182
+ /**
183
+ * @internal
184
+ * Portal transaction response structure
185
+ */
186
+ interface PortalTransactionResponse {
187
+ transactionHash?: string;
188
+ contractAddress?: string;
189
+ }
190
+ /**
191
+ * @internal
192
+ * Portal schema response structure
193
+ */
194
+ interface PortalSchemaResponse {
195
+ EASSchemaRegistry?: {
196
+ getSchema?: {
197
+ uid: string;
198
+ resolver: string;
199
+ revocable: boolean;
200
+ schema: string;
201
+ };
202
+ };
203
+ }
204
+ /**
205
+ * @internal
206
+ * Portal attestation response structure
207
+ */
208
+ interface PortalAttestationResponse {
209
+ EAS?: {
210
+ getAttestation?: {
211
+ uid: string;
212
+ schema: string;
213
+ attester: string;
214
+ recipient: string;
215
+ time: string;
216
+ expirationTime: string;
217
+ revocable: boolean;
218
+ refUID: string;
219
+ data: string;
220
+ };
221
+ isAttestationValid?: boolean;
222
+ getTimestamp?: string;
223
+ };
224
+ }
225
+ /**
226
+ * @internal
227
+ * Portal contracts response structure
228
+ */
229
+ interface PortalContractsResponse {
230
+ getContractsEasSchemaRegistry?: {
231
+ count: number;
232
+ records: Array<{
233
+ address: string;
234
+ abiName: string;
235
+ createdAt: string;
236
+ }>;
237
+ };
238
+ getContractsEas?: {
239
+ count: number;
240
+ records: Array<{
241
+ address: string;
242
+ abiName: string;
243
+ createdAt: string;
244
+ }>;
245
+ };
246
+ } //#endregion
247
+ //#region src/utils/validation.d.ts
248
+ declare function validateFieldName(name: string): void;
249
+ declare function validateFieldType(type: string): asserts type is EASFieldType;
250
+ declare function validateSchemaFields(fields: SchemaField[]): void;
251
+ declare function buildSchemaString(fields: SchemaField[]): string;
66
252
 
67
253
  //#endregion
68
- //#region src/eas.d.ts
254
+ //#region src/graphql/operations.d.ts
255
+ declare const DEPLOY_SCHEMA_REGISTRY_MUTATION: string;
256
+ declare const DEPLOY_EAS_MUTATION: string;
257
+ declare const REGISTER_SCHEMA_MUTATION: string;
258
+ declare const ATTEST_MUTATION: string;
259
+ declare const MULTI_ATTEST_MUTATION: string;
260
+ declare const REVOKE_MUTATION: string;
261
+ declare const GET_SCHEMA_QUERY: string;
262
+ declare const GET_SCHEMAS_QUERY: string;
263
+ declare const GET_ATTESTATION_QUERY: string;
264
+ declare const IS_ATTESTATION_VALID_QUERY: string;
265
+ declare const GET_TIMESTAMP_QUERY: string;
266
+ declare const GET_ATTESTATIONS_QUERY: string;
69
267
  /**
70
- * Creates an EAS client for interacting with the Ethereum Attestation Service.
71
- *
72
- * @param options - Configuration options for the client
73
- * @returns An object containing the EAS client instance
74
- * @throws Will throw an error if the options fail validation
75
- *
76
- * @example
77
- * ```ts
78
- * import { createEASClient } from '@settlemint/sdk-eas';
79
- *
80
- * const client = createEASClient({
81
- * schemaRegistryAddress: "0x1234567890123456789012345678901234567890",
82
- * attestationAddress: "0x1234567890123456789012345678901234567890",
83
- * accessToken: "your-access-token",
84
- * chainId: "1",
85
- * chainName: "Ethereum",
86
- * rpcUrl: "http://localhost:8545"
87
- * });
88
- * ```
89
- */
90
- declare function createEASClient(options: ClientOptions): {
91
- registerSchema: (options: RegisterSchemaOptions) => Promise<string>;
92
- getSchema: (uid: string) => Promise<string>;
268
+ * All GraphQL operations organized by category
269
+ */
270
+ declare const GraphQLOperations: {
271
+ readonly mutations: {
272
+ readonly deploySchemaRegistry: string;
273
+ readonly deployEAS: string;
274
+ readonly registerSchema: string;
275
+ readonly attest: string;
276
+ readonly multiAttest: string;
277
+ readonly revoke: string;
278
+ };
279
+ readonly queries: {
280
+ readonly getSchema: string;
281
+ readonly getSchemas: string;
282
+ readonly getAttestation: string;
283
+ readonly getAttestations: string;
284
+ readonly isAttestationValid: string;
285
+ readonly getTimestamp: string;
286
+ };
93
287
  };
288
+ /**
289
+ * Type-safe access to GraphQL operations
290
+ */
291
+ type GraphQLMutations = typeof GraphQLOperations.mutations;
292
+ type GraphQLQueries = typeof GraphQLOperations.queries;
293
+
294
+ //#endregion
295
+ //#region src/eas.d.ts
296
+ /**
297
+ * Main EAS client class for interacting with Ethereum Attestation Service via Portal
298
+ */
299
+ declare class EASClient {
300
+ private options;
301
+ private portalClient;
302
+ private deployedAddresses?;
303
+ constructor(options: EASClientOptions);
304
+ /**
305
+ * Deploy EAS contracts via Portal
306
+ */
307
+ deploy(deployerAddress: Address, forwarderAddress?: Address, gasLimit?: string): Promise<DeploymentResult>;
308
+ /**
309
+ * Register a new schema in the EAS Schema Registry
310
+ */
311
+ registerSchema(request: SchemaRequest, fromAddress: Address, gasLimit?: string): Promise<TransactionResult>;
312
+ /**
313
+ * Create an attestation
314
+ */
315
+ attest(request: AttestationRequest, fromAddress: Address, gasLimit?: string): Promise<TransactionResult>;
316
+ /**
317
+ * Create multiple attestations in a single transaction
318
+ */
319
+ multiAttest(requests: AttestationRequest[], fromAddress: Address, gasLimit?: string): Promise<TransactionResult>;
320
+ /**
321
+ * Revoke an attestation
322
+ */
323
+ revoke(uid: Hex, fromAddress: Address, value?: bigint, gasLimit?: string): Promise<TransactionResult>;
324
+ /**
325
+ * Get a schema by UID
326
+ *
327
+ * TODO: Implement using The Graph subgraph for EAS data queries
328
+ */
329
+ getSchema(uid: Hex): Promise<SchemaData>;
330
+ /**
331
+ * Get all schemas with pagination
332
+ *
333
+ * TODO: Implement using The Graph subgraph for EAS data queries
334
+ */
335
+ getSchemas(options?: GetSchemasOptions): Promise<SchemaData[]>;
336
+ /**
337
+ * Get an attestation by UID
338
+ *
339
+ * TODO: Implement using The Graph subgraph for EAS data queries
340
+ */
341
+ getAttestation(uid: Hex): Promise<AttestationInfo>;
342
+ /**
343
+ * Get attestations with pagination and filtering
344
+ *
345
+ * TODO: Implement using The Graph subgraph for EAS data queries
346
+ */
347
+ getAttestations(options?: GetAttestationsOptions): Promise<AttestationInfo[]>;
348
+ /**
349
+ * Check if an attestation is valid
350
+ *
351
+ * TODO: Implement using The Graph subgraph for EAS data queries
352
+ */
353
+ isValidAttestation(uid: Hex): Promise<boolean>;
354
+ /**
355
+ * Get the current timestamp from the contract
356
+ *
357
+ * TODO: Fix Portal GraphQL query parameter encoding or use The Graph subgraph
358
+ */
359
+ getTimestamp(): Promise<bigint>;
360
+ /**
361
+ * Get client configuration
362
+ */
363
+ getOptions(): EASClientOptions;
364
+ /**
365
+ * Get the Portal client instance for advanced operations
366
+ */
367
+ getPortalClient(): ReturnType<typeof createPortalClient>["client"];
368
+ /**
369
+ * Get current contract addresses
370
+ */
371
+ getContractAddresses(): {
372
+ easAddress?: Address;
373
+ schemaRegistryAddress?: Address;
374
+ };
375
+ private getEASAddress;
376
+ private getSchemaRegistryAddress;
377
+ private buildSchemaString;
378
+ }
379
+ /**
380
+ * Create a new EAS client instance
381
+ */
382
+ declare function createEASClient(options: EASClientOptions): EASClient;
94
383
 
95
384
  //#endregion
96
- export { ClientOptions, ClientOptionsSchema, EASFieldType, EAS_FIELD_TYPES, RegisterSchemaOptions, SchemaField, createEASClient };
385
+ export { AttestationData, AttestationInfo, AttestationRequest, DeploymentResult, EASClient, EASClientOptions, EASFieldType, EAS_FIELD_TYPES, GetAttestationsOptions, GetSchemasOptions, GraphQLOperations, RegisterSchemaOptions, SchemaData, SchemaField, SchemaRequest, TransactionResult, ZERO_ADDRESS, ZERO_BYTES32, buildSchemaString, createEASClient, validateSchemaFields };
97
386
  //# sourceMappingURL=eas.d.ts.map