@settlemint/sdk-eas 2.3.5-prfde1f9e5 → 2.3.6

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.cts CHANGED
@@ -1,11 +1,30 @@
1
- import { Abi, Address, Hex } from "viem";
2
1
  import { z } from "zod/v4";
3
2
 
4
- //#region src/schema.d.ts
3
+ //#region src/client-options.schema.d.ts
5
4
  /**
6
- * Supported field types for EAS schema fields.
7
- * Maps to the Solidity types that can be used in EAS schemas.
5
+ * Schema for validating EAS client configuration options.
6
+ * Extends the base Viem client options with EAS-specific requirements.
8
7
  */
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.
23
+ */
24
+ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
25
+
26
+ //#endregion
27
+ //#region src/types.d.ts
9
28
  /**
10
29
  * Supported field types for EAS schema fields.
11
30
  * Maps to the Solidity types that can be used in EAS schemas.
@@ -43,1030 +62,36 @@ interface RegisterSchemaOptions {
43
62
  resolverAddress: string;
44
63
  /** Whether attestations using this schema can be revoked */
45
64
  revocable: boolean;
46
- } //#endregion
47
- //#region src/portal-types.d.ts
48
- /**
49
- * Simple transaction event type for EAS Portal integration
50
- */
51
- interface TransactionEvent {
52
- /** The name of the event that was emitted */
53
- eventName: string;
54
- /** The arguments emitted by the event */
55
- args: Record<string, unknown>;
56
- /** Indexed event parameters used for filtering and searching */
57
- topics: Hex[];
58
- }
59
- /**
60
- * Simple transaction receipt type for EAS Portal integration
61
- */
62
- interface TransactionReceipt {
63
- /** The transaction hash */
64
- transactionHash: string;
65
- /** The block hash */
66
- blockHash: string;
67
- /** The block number */
68
- blockNumber: string;
69
- /** Transaction status */
70
- status: "Success" | "Reverted";
71
- /** Gas used */
72
- gasUsed: string;
73
- /** From address */
74
- from: string;
75
- /** To address */
76
- to?: string;
77
- /** Contract address (if contract deployment) */
78
- contractAddress?: string;
79
- /** Array of events emitted during the transaction */
80
- events: TransactionEvent[];
81
- /** The raw reason for transaction reversion, if applicable */
82
- revertReason?: string;
83
- /** Human-readable version of the revert reason */
84
- revertReasonDecoded?: string;
85
- }
86
- /**
87
- * Enhanced schema registration options for Portal integration
88
- */
89
- interface PortalRegisterSchemaOptions {
90
- /** Array of fields that make up the schema */
91
- fields: SchemaField[];
92
- /** Address of the resolver contract that will handle attestations */
93
- resolverAddress: Address;
94
- /** Whether attestations using this schema can be revoked */
95
- revocable: boolean;
96
- /** The address to send the transaction from */
97
- from: Address;
98
- /** Optional gas limit for the transaction */
99
- gasLimit?: string;
100
- /** Optional gas price for the transaction */
101
- gasPrice?: string;
102
- /** Optional metadata to store with the transaction */
103
- metadata?: Record<string, unknown>;
104
- /** Whether to simulate the transaction before sending */
105
- simulate?: boolean;
106
- }
107
- /**
108
- * Enhanced attestation creation options for Portal integration
109
- */
110
- interface PortalCreateAttestationOptions {
111
- /** The schema UID to attest against */
112
- schemaUID: string;
113
- /** The recipient of the attestation */
114
- recipient: Address;
115
- /** The attestation data (encoded) */
116
- data: string;
117
- /** Optional expiration time (timestamp) */
118
- expirationTime?: number;
119
- /** Whether this attestation can be revoked */
120
- revocable?: boolean;
121
- /** Optional reference to another attestation */
122
- refUID?: string;
123
- /** Optional value to send with the attestation */
124
- value?: string;
125
- /** The address to send the transaction from */
126
- from: Address;
127
- /** Optional gas limit for the transaction */
128
- gasLimit?: string;
129
- /** Optional gas price for the transaction */
130
- gasPrice?: string;
131
- /** Optional metadata to store with the transaction */
132
- metadata?: Record<string, unknown>;
133
- /** Whether to simulate the transaction before sending */
134
- simulate?: boolean;
135
- }
136
- /**
137
- * Enhanced revocation options for Portal integration
138
- */
139
- interface PortalRevokeAttestationOptions {
140
- /** The UID of the attestation to revoke */
141
- uid: string;
142
- /** The schema UID of the attestation */
143
- schemaUID: string;
144
- /** Optional value to send with the revocation */
145
- value?: string;
146
- /** The address to send the transaction from */
147
- from: Address;
148
- /** Optional gas limit for the transaction */
149
- gasLimit?: string;
150
- /** Optional gas price for the transaction */
151
- gasPrice?: string;
152
- /** Optional metadata to store with the transaction */
153
- metadata?: Record<string, unknown>;
154
- /** Whether to simulate the transaction before sending */
155
- simulate?: boolean;
156
- }
157
- /**
158
- * Result of a schema registration operation
159
- */
160
- interface SchemaRegistrationResult {
161
- /** The transaction hash */
162
- transactionHash: string;
163
- /** The schema UID (available after transaction confirmation) */
164
- schemaUID?: string;
165
- /** The transaction receipt (available after confirmation) */
166
- receipt?: TransactionReceipt;
167
- /** Events emitted during the transaction */
168
- events?: TransactionEvent[];
169
- }
170
- /**
171
- * Result of an attestation creation operation
172
- */
173
- interface AttestationResult {
174
- /** The transaction hash */
175
- transactionHash: string;
176
- /** The attestation UID (available after transaction confirmation) */
177
- attestationUID?: string;
178
- /** The transaction receipt (available after confirmation) */
179
- receipt?: TransactionReceipt;
180
- /** Events emitted during the transaction */
181
- events?: TransactionEvent[];
182
- }
183
- /**
184
- * Result of an attestation revocation operation
185
- */
186
- interface RevocationResult {
187
- /** The transaction hash */
188
- transactionHash: string;
189
- /** The transaction receipt (available after confirmation) */
190
- receipt?: TransactionReceipt;
191
- /** Events emitted during the transaction */
192
- events?: TransactionEvent[];
193
- }
194
- /**
195
- * Detailed schema information from Portal
196
- */
197
- interface SchemaDetails {
198
- /** The schema UID */
199
- uid: string;
200
- /** The resolver address */
201
- resolver: Address;
202
- /** Whether attestations can be revoked */
203
- revocable: boolean;
204
- /** The schema string */
205
- schema: string;
206
- /** Registration transaction hash */
207
- registrationTxHash?: string;
208
- /** Registration block number */
209
- registrationBlock?: number;
210
- /** Number of attestations using this schema */
211
- attestationCount?: number;
212
- }
213
- /**
214
- * Detailed attestation information from Portal
215
- */
216
- interface AttestationDetails {
217
- /** The attestation UID */
218
- uid: string;
219
- /** The schema UID */
220
- schema: string;
221
- /** Creation timestamp */
222
- time: number;
223
- /** Expiration timestamp (0 if no expiration) */
224
- expirationTime: number;
225
- /** Revocation timestamp (0 if not revoked) */
226
- revocationTime: number;
227
- /** Reference UID */
228
- refUID: string;
229
- /** Recipient address */
230
- recipient: Address;
231
- /** Attester address */
232
- attester: Address;
233
- /** Whether this attestation is revocable */
234
- revocable: boolean;
235
- /** The attestation data */
236
- data: string;
237
- /** Creation transaction hash */
238
- creationTxHash?: string;
239
- /** Revocation transaction hash (if revoked) */
240
- revocationTxHash?: string;
241
- }
242
- /**
243
- * Transaction status for real-time monitoring
244
- */
245
- interface TransactionStatus {
246
- /** The transaction hash */
247
- transactionHash: string;
248
- /** Current status */
249
- status: "pending" | "confirmed" | "failed";
250
- /** Transaction receipt (if confirmed) */
251
- receipt?: TransactionReceipt;
252
- /** Events emitted (if confirmed) */
253
- events?: TransactionEvent[];
254
- /** Error message (if failed) */
255
- error?: string;
256
- }
257
- /**
258
- * EAS-specific error codes
259
- */
260
- declare enum EASErrorCode {
261
- INVALID_SCHEMA = "INVALID_SCHEMA",
262
- SCHEMA_NOT_FOUND = "SCHEMA_NOT_FOUND",
263
- ATTESTATION_NOT_FOUND = "ATTESTATION_NOT_FOUND",
264
- UNAUTHORIZED = "UNAUTHORIZED",
265
- TRANSACTION_FAILED = "TRANSACTION_FAILED",
266
- INVALID_SIGNATURE = "INVALID_SIGNATURE",
267
- EXPIRED_ATTESTATION = "EXPIRED_ATTESTATION",
268
- NON_REVOCABLE = "NON_REVOCABLE",
269
- ALREADY_REVOKED = "ALREADY_REVOKED",
270
- PORTAL_ERROR = "PORTAL_ERROR",
271
- }
272
- /**
273
- * Enhanced error class for EAS Portal operations
274
- */
275
- declare class EASPortalError extends Error {
276
- readonly code: EASErrorCode;
277
- readonly transactionHash?: string;
278
- readonly revertReason?: string;
279
- readonly gasEstimate?: bigint;
280
- constructor(message: string, code: EASErrorCode, options?: {
281
- transactionHash?: string;
282
- revertReason?: string;
283
- gasEstimate?: bigint;
284
- cause?: Error;
285
- });
286
- }
287
- /**
288
- * Options for watching transaction status
289
- */
290
- interface WatchTransactionOptions {
291
- /** Timeout in milliseconds */
292
- timeout?: number;
293
- /** Polling interval in milliseconds */
294
- interval?: number;
295
- }
296
- /**
297
- * Configuration options for the EAS Portal client
298
- */
299
- interface PortalClientOptions {
300
- /** Portal instance URL or path */
301
- instance: string;
302
- /** Access token for Portal authentication */
303
- accessToken: string;
304
- /** The address of the EAS Attestation contract */
305
- easContractAddress: string;
306
- /** The address of the EAS Schema Registry contract */
307
- schemaRegistryContractAddress: string;
308
- /** ABI source configuration */
309
- abiSource: AbiSource$1;
310
- /** Optional WebSocket URL for real-time transaction monitoring */
311
- wsUrl?: string;
312
- /** Request timeout in milliseconds */
313
- timeout?: number;
314
- /** Enable debug logging */
315
- debug?: boolean;
316
- /** Optional cache configuration for GraphQL requests */
317
- cache?: "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
318
- }
319
- /**
320
- * ABI source configuration for EAS contracts
321
- */
322
- type AbiSource$1 = {
323
- type: "hardcoded";
324
- } | {
325
- type: "custom";
326
- easAbi: Abi;
327
- schemaRegistryAbi: Abi;
328
- } | {
329
- type: "predeployed";
330
- abiNames?: string[];
331
- };
332
- /**
333
- * Attestation request data structure
334
- */
335
- interface AttestationRequest {
336
- /** The schema UID to attest against */
337
- schema: Hex;
338
- /** The attestation data */
339
- data: {
340
- /** The recipient of the attestation */
341
- recipient: Address;
342
- /** Expiration time (0 for no expiration) */
343
- expirationTime: bigint;
344
- /** Whether this attestation is revocable */
345
- revocable: boolean;
346
- /** Reference UID (0x0 for no reference) */
347
- refUID: Hex;
348
- /** The attestation data (encoded) */
349
- data: Hex;
350
- /** Value to send with the attestation */
351
- value: bigint;
352
- };
353
- }
354
- /**
355
- * Schema registration request data structure
356
- * Supports both schema string and schema fields for enhanced developer experience
357
- */
358
- interface SchemaRequest {
359
- /** The schema string OR schema fields (one of these is required) */
360
- schema?: string;
361
- /** Array of schema fields (alternative to schema string) */
362
- fields?: SchemaField[];
363
- /** The resolver address */
364
- resolver: Address;
365
- /** Whether attestations using this schema can be revoked */
366
- revocable: boolean;
367
- }
368
- /**
369
- * Transaction result from Portal operations
370
- */
371
- interface TransactionResult {
372
- /** The transaction hash */
373
- hash: Hex;
374
- /** Whether the transaction was successful */
375
- success: boolean;
376
- /** Optional error message */
377
- error?: string;
378
- }
379
- /**
380
- * Attestation data structure returned from queries
381
- */
382
- interface AttestationData {
383
- /** The attestation UID */
384
- uid: Hex;
385
- /** The schema UID */
386
- schema: Hex;
387
- /** The attester address */
388
- attester: Address;
389
- /** The recipient address */
390
- recipient: Address;
391
- /** Creation timestamp */
392
- time: bigint;
393
- /** Expiration timestamp (0 if no expiration) */
394
- expirationTime: bigint;
395
- /** Whether this attestation is revocable */
396
- revocable: boolean;
397
- /** Reference UID */
398
- refUID: Hex;
399
- /** The attestation data */
400
- data: Hex;
401
- /** Value sent with the attestation */
402
- value: bigint;
403
- }
404
- /**
405
- * Schema data structure returned from queries
406
- */
407
- interface SchemaData {
408
- /** The schema UID */
409
- uid: Hex;
410
- /** The resolver address */
411
- resolver: Address;
412
- /** Whether attestations can be revoked */
413
- revocable: boolean;
414
- /** The schema string */
415
- schema: string;
416
- } //#endregion
417
- //#region src/eas-portal-client.d.ts
418
- /**
419
- * EAS Portal client for interacting with Ethereum Attestation Service contracts via Portal.
420
- * Supports multiple ABI sources with priority: hardcoded (default) > custom (user override) > predeployed (Portal's ABIs).
421
- */
422
- declare class EASPortalClient {
423
- private portalClient;
424
- private options;
425
- private easAbi;
426
- private schemaRegistryAbi;
427
- /**
428
- * Creates a new EAS Portal client instance.
429
- *
430
- * @param options - Configuration options for the client
431
- *
432
- * @example
433
- * ```typescript
434
- * import { EASPortalClient } from "@settlemint/sdk-eas";
435
- *
436
- * // Using default hardcoded ABIs
437
- * const client = new EASPortalClient({
438
- * instance: "https://portal.settlemint.com",
439
- * accessToken: "your-token",
440
- * easContractAddress: "0x...",
441
- * schemaRegistryContractAddress: "0x...",
442
- * });
443
- *
444
- * // Using custom ABIs
445
- * const clientWithCustomAbis = new EASPortalClient({
446
- * instance: "https://portal.settlemint.com",
447
- * accessToken: "your-token",
448
- * easContractAddress: "0x...",
449
- * schemaRegistryContractAddress: "0x...",
450
- * abiSource: {
451
- * type: "custom",
452
- * easAbi: customEasAbi,
453
- * schemaRegistryAbi: customSchemaRegistryAbi,
454
- * },
455
- * });
456
- *
457
- * // Using predeployed ABIs
458
- * const clientWithPredeployed = new EASPortalClient({
459
- * instance: "https://portal.settlemint.com",
460
- * accessToken: "your-token",
461
- * easContractAddress: "0x...",
462
- * schemaRegistryContractAddress: "0x...",
463
- * abiSource: {
464
- * type: "predeployed",
465
- * abiNames: ["eas"],
466
- * },
467
- * });
468
- * ```
469
- */
470
- constructor(options: PortalClientOptions);
471
- /**
472
- * Sets the ABIs based on the configured source priority.
473
- * Priority: hardcoded (default) > custom (user override) > predeployed (Portal's ABIs)
474
- */
475
- private setAbis;
476
- /**
477
- * Creates a new attestation on-chain.
478
- *
479
- * @param request - The attestation request data
480
- * @returns Promise resolving to transaction result
481
- * @throws EASPortalError if the operation fails
482
- */
483
- attest(request: AttestationRequest): Promise<TransactionResult>;
484
- /**
485
- * Creates multiple attestations in a single transaction.
486
- *
487
- * @param requests - Array of attestation requests
488
- * @returns Promise resolving to transaction result
489
- * @throws EASPortalError if the operation fails
490
- */
491
- multiAttest(requests: AttestationRequest[]): Promise<TransactionResult>;
492
- /**
493
- * Revokes an existing attestation.
494
- *
495
- * @param uid - The UID of the attestation to revoke
496
- * @param value - Optional ETH value to send with the transaction
497
- * @returns Promise resolving to transaction result
498
- * @throws EASPortalError if the operation fails
499
- */
500
- revoke(uid: Hex, value?: bigint): Promise<TransactionResult>;
501
- /**
502
- * Registers a new schema in the Schema Registry.
503
- * Supports both schema strings and schema fields with automatic validation.
504
- *
505
- * @param request - The schema registration request (schema string OR fields)
506
- * @returns Promise resolving to transaction result
507
- * @throws EASPortalError if the operation fails or validation fails
508
- *
509
- * @example
510
- * ```typescript
511
- * // Option 1: Using schema string
512
- * const result1 = await client.registerSchema({
513
- * schema: "address user, uint256 score",
514
- * resolver: "0x0000000000000000000000000000000000000000",
515
- * revocable: true,
516
- * });
517
- *
518
- * // Option 2: Using schema fields (with automatic validation)
519
- * const result2 = await client.registerSchema({
520
- * fields: [
521
- * { name: "user", type: "address", description: "User's wallet address" },
522
- * { name: "score", type: "uint256", description: "User's reputation score" }
523
- * ],
524
- * resolver: "0x0000000000000000000000000000000000000000",
525
- * revocable: true,
526
- * });
527
- * ```
528
- */
529
- registerSchema(request: SchemaRequest): Promise<TransactionResult>;
530
- /**
531
- * Retrieves an attestation by its UID.
532
- *
533
- * @param uid - The UID of the attestation
534
- * @returns Promise resolving to attestation data
535
- * @throws EASPortalError if the attestation is not found
536
- */
537
- getAttestation(uid: Hex): Promise<AttestationData>;
538
- /**
539
- * Retrieves a schema by its UID.
540
- *
541
- * @param uid - The UID of the schema
542
- * @returns Promise resolving to schema data
543
- * @throws EASPortalError if the schema is not found
544
- */
545
- getSchema(uid: Hex): Promise<SchemaData>;
546
- /**
547
- * Checks if an attestation is valid (exists and not revoked).
548
- *
549
- * @param uid - The UID of the attestation
550
- * @returns Promise resolving to boolean indicating validity
551
- */
552
- isValidAttestation(uid: Hex): Promise<boolean>;
553
- /**
554
- * Gets the current timestamp from the EAS contract.
555
- *
556
- * @returns Promise resolving to current timestamp
557
- */
558
- getTimestamp(): Promise<bigint>;
559
- /**
560
- * Executes a write operation on the EAS contract.
561
- *
562
- * @param functionName - The function name to call
563
- * @param args - The function arguments
564
- * @returns Promise resolving to transaction result
565
- */
566
- private executeContractWrite;
567
- /**
568
- * Executes a write operation on the Schema Registry contract.
569
- *
570
- * @param functionName - The function name to call
571
- * @param args - The function arguments
572
- * @returns Promise resolving to transaction result
573
- */
574
- private executeSchemaRegistryWrite;
575
- /**
576
- * Executes a read operation on the EAS contract.
577
- *
578
- * @param functionName - The function name to call
579
- * @param args - The function arguments
580
- * @returns Promise resolving to the result
581
- */
582
- private executeContractRead;
583
- /**
584
- * Executes a read operation on the Schema Registry contract.
585
- *
586
- * @param functionName - The function name to call
587
- * @param args - The function arguments
588
- * @returns Promise resolving to the result
589
- */
590
- private executeSchemaRegistryRead;
591
- /**
592
- * Creates a standardized EAS Portal error.
593
- *
594
- * @param code - Error code
595
- * @param message - Error message
596
- * @returns EASPortalError instance
597
- */
598
- private createError;
599
- /**
600
- * Gets the Portal client instance for advanced operations.
601
- *
602
- * @returns The underlying Portal client
603
- */
604
- getPortalClient(): unknown;
605
- /**
606
- * Gets the current configuration options.
607
- *
608
- * @returns The client configuration
609
- */
610
- getOptions(): PortalClientOptions;
611
- /**
612
- * Gets the currently configured ABIs.
613
- *
614
- * @returns Object containing the EAS and Schema Registry ABIs
615
- */
616
- getAbis(): {
617
- easAbi: Abi;
618
- schemaRegistryAbi: Abi;
619
- };
620
65
  }
621
66
 
622
- //#endregion
623
- //#region src/portal-client-options.schema.d.ts
624
- /**
625
- * ABI source configuration for EAS contracts.
626
- * Priority: hardcoded (default) > custom (user override) > predeployed (Portal's ABIs)
627
- */
628
- declare const abiSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
629
- type: z.ZodLiteral<"hardcoded">;
630
- }, z.core.$strip>, z.ZodObject<{
631
- type: z.ZodLiteral<"custom">;
632
- easAbi: z.ZodCustom<Abi, Abi>;
633
- schemaRegistryAbi: z.ZodCustom<Abi, Abi>;
634
- }, z.core.$strip>, z.ZodObject<{
635
- type: z.ZodLiteral<"predeployed">;
636
- abiNames: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
637
- }, z.core.$strip>]>;
638
- /**
639
- * Configuration options for the EAS Portal client
640
- */
641
- declare const portalClientOptionsSchema: z.ZodObject<{
642
- instance: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
643
- accessToken: z.ZodString;
644
- easContractAddress: z.ZodString;
645
- schemaRegistryContractAddress: z.ZodString;
646
- abiSource: z.ZodDefault<z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
647
- type: z.ZodLiteral<"hardcoded">;
648
- }, z.core.$strip>, z.ZodObject<{
649
- type: z.ZodLiteral<"custom">;
650
- easAbi: z.ZodCustom<Abi, Abi>;
651
- schemaRegistryAbi: z.ZodCustom<Abi, Abi>;
652
- }, z.core.$strip>, z.ZodObject<{
653
- type: z.ZodLiteral<"predeployed">;
654
- abiNames: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
655
- }, z.core.$strip>]>>>;
656
- wsUrl: z.ZodOptional<z.ZodString>;
657
- timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
658
- debug: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
659
- cache: z.ZodOptional<z.ZodEnum<{
660
- default: "default";
661
- "force-cache": "force-cache";
662
- "no-cache": "no-cache";
663
- "no-store": "no-store";
664
- "only-if-cached": "only-if-cached";
665
- reload: "reload";
666
- }>>;
667
- }, z.core.$strip>;
668
- type PortalClientOptions$1 = z.infer<typeof portalClientOptionsSchema>;
669
- type AbiSource = z.infer<typeof abiSourceSchema>;
670
- /**
671
- * Validates EAS Portal client options.
672
- *
673
- * @param options - The options to validate
674
- * @returns The validated options
675
- * @throws If validation fails
676
- *
677
- * @example
678
- * ```typescript
679
- * import { validatePortalClientOptions } from "@settlemint/sdk-eas";
680
- *
681
- * const options = validatePortalClientOptions({
682
- * instance: "https://portal.settlemint.com",
683
- * accessToken: "your-token",
684
- * easContractAddress: "0x...",
685
- * schemaRegistryContractAddress: "0x...",
686
- * });
687
- * ```
688
- */
689
- declare function validatePortalClientOptions(options: unknown): PortalClientOptions$1;
690
-
691
- //#endregion
692
- //#region src/utils/validation.d.ts
693
- declare function validateFieldName(name: string): void;
694
- declare function validateFieldType(type: string): asserts type is EASFieldType;
695
- declare function validateSchemaFields(fields: SchemaField[]): void;
696
- declare function buildSchemaString(fields: SchemaField[]): string;
697
-
698
- //#endregion
699
- //#region src/abis.d.ts
700
- /**
701
- * EAS Schema Registry ABI
702
- * Contains the essential functions for schema registration and retrieval
703
- */
704
- declare const SCHEMA_REGISTRY_ABI: readonly [{
705
- readonly type: "function";
706
- readonly name: "register";
707
- readonly inputs: readonly [{
708
- readonly name: "schema";
709
- readonly type: "string";
710
- readonly internalType: "string";
711
- }, {
712
- readonly name: "resolver";
713
- readonly type: "address";
714
- readonly internalType: "contract ISchemaResolver";
715
- }, {
716
- readonly name: "revocable";
717
- readonly type: "bool";
718
- readonly internalType: "bool";
719
- }];
720
- readonly outputs: readonly [{
721
- readonly name: "";
722
- readonly type: "bytes32";
723
- readonly internalType: "bytes32";
724
- }];
725
- readonly stateMutability: "nonpayable";
726
- }, {
727
- readonly type: "function";
728
- readonly name: "getSchema";
729
- readonly inputs: readonly [{
730
- readonly name: "uid";
731
- readonly type: "bytes32";
732
- readonly internalType: "bytes32";
733
- }];
734
- readonly outputs: readonly [{
735
- readonly name: "";
736
- readonly type: "tuple";
737
- readonly internalType: "struct SchemaRecord";
738
- readonly components: readonly [{
739
- readonly name: "uid";
740
- readonly type: "bytes32";
741
- readonly internalType: "bytes32";
742
- }, {
743
- readonly name: "resolver";
744
- readonly type: "address";
745
- readonly internalType: "contract ISchemaResolver";
746
- }, {
747
- readonly name: "revocable";
748
- readonly type: "bool";
749
- readonly internalType: "bool";
750
- }, {
751
- readonly name: "schema";
752
- readonly type: "string";
753
- readonly internalType: "string";
754
- }];
755
- }];
756
- readonly stateMutability: "view";
757
- }, {
758
- readonly type: "event";
759
- readonly name: "Registered";
760
- readonly inputs: readonly [{
761
- readonly name: "uid";
762
- readonly type: "bytes32";
763
- readonly indexed: true;
764
- readonly internalType: "bytes32";
765
- }, {
766
- readonly name: "registerer";
767
- readonly type: "address";
768
- readonly indexed: true;
769
- readonly internalType: "address";
770
- }, {
771
- readonly name: "schema";
772
- readonly type: "tuple";
773
- readonly indexed: false;
774
- readonly internalType: "struct SchemaRecord";
775
- readonly components: readonly [{
776
- readonly name: "uid";
777
- readonly type: "bytes32";
778
- readonly internalType: "bytes32";
779
- }, {
780
- readonly name: "resolver";
781
- readonly type: "address";
782
- readonly internalType: "contract ISchemaResolver";
783
- }, {
784
- readonly name: "revocable";
785
- readonly type: "bool";
786
- readonly internalType: "bool";
787
- }, {
788
- readonly name: "schema";
789
- readonly type: "string";
790
- readonly internalType: "string";
791
- }];
792
- }];
793
- readonly anonymous: false;
794
- }];
795
- /**
796
- * EAS Attestation Service ABI
797
- * Contains the essential functions for attestation creation, revocation, and retrieval
798
- */
799
- declare const EAS_ABI: readonly [{
800
- readonly type: "function";
801
- readonly name: "attest";
802
- readonly inputs: readonly [{
803
- readonly name: "request";
804
- readonly type: "tuple";
805
- readonly internalType: "struct AttestationRequest";
806
- readonly components: readonly [{
807
- readonly name: "schema";
808
- readonly type: "bytes32";
809
- readonly internalType: "bytes32";
810
- }, {
811
- readonly name: "data";
812
- readonly type: "tuple";
813
- readonly internalType: "struct AttestationRequestData";
814
- readonly components: readonly [{
815
- readonly name: "recipient";
816
- readonly type: "address";
817
- readonly internalType: "address";
818
- }, {
819
- readonly name: "expirationTime";
820
- readonly type: "uint64";
821
- readonly internalType: "uint64";
822
- }, {
823
- readonly name: "revocable";
824
- readonly type: "bool";
825
- readonly internalType: "bool";
826
- }, {
827
- readonly name: "refUID";
828
- readonly type: "bytes32";
829
- readonly internalType: "bytes32";
830
- }, {
831
- readonly name: "data";
832
- readonly type: "bytes";
833
- readonly internalType: "bytes";
834
- }, {
835
- readonly name: "value";
836
- readonly type: "uint256";
837
- readonly internalType: "uint256";
838
- }];
839
- }];
840
- }];
841
- readonly outputs: readonly [{
842
- readonly name: "";
843
- readonly type: "bytes32";
844
- readonly internalType: "bytes32";
845
- }];
846
- readonly stateMutability: "payable";
847
- }, {
848
- readonly type: "function";
849
- readonly name: "revoke";
850
- readonly inputs: readonly [{
851
- readonly name: "request";
852
- readonly type: "tuple";
853
- readonly internalType: "struct RevocationRequest";
854
- readonly components: readonly [{
855
- readonly name: "schema";
856
- readonly type: "bytes32";
857
- readonly internalType: "bytes32";
858
- }, {
859
- readonly name: "data";
860
- readonly type: "tuple";
861
- readonly internalType: "struct RevocationRequestData";
862
- readonly components: readonly [{
863
- readonly name: "uid";
864
- readonly type: "bytes32";
865
- readonly internalType: "bytes32";
866
- }, {
867
- readonly name: "value";
868
- readonly type: "uint256";
869
- readonly internalType: "uint256";
870
- }];
871
- }];
872
- }];
873
- readonly outputs: readonly [];
874
- readonly stateMutability: "payable";
875
- }, {
876
- readonly type: "function";
877
- readonly name: "getAttestation";
878
- readonly inputs: readonly [{
879
- readonly name: "uid";
880
- readonly type: "bytes32";
881
- readonly internalType: "bytes32";
882
- }];
883
- readonly outputs: readonly [{
884
- readonly name: "";
885
- readonly type: "tuple";
886
- readonly internalType: "struct Attestation";
887
- readonly components: readonly [{
888
- readonly name: "uid";
889
- readonly type: "bytes32";
890
- readonly internalType: "bytes32";
891
- }, {
892
- readonly name: "schema";
893
- readonly type: "bytes32";
894
- readonly internalType: "bytes32";
895
- }, {
896
- readonly name: "time";
897
- readonly type: "uint64";
898
- readonly internalType: "uint64";
899
- }, {
900
- readonly name: "expirationTime";
901
- readonly type: "uint64";
902
- readonly internalType: "uint64";
903
- }, {
904
- readonly name: "revocationTime";
905
- readonly type: "uint64";
906
- readonly internalType: "uint64";
907
- }, {
908
- readonly name: "refUID";
909
- readonly type: "bytes32";
910
- readonly internalType: "bytes32";
911
- }, {
912
- readonly name: "recipient";
913
- readonly type: "address";
914
- readonly internalType: "address";
915
- }, {
916
- readonly name: "attester";
917
- readonly type: "address";
918
- readonly internalType: "address";
919
- }, {
920
- readonly name: "revocable";
921
- readonly type: "bool";
922
- readonly internalType: "bool";
923
- }, {
924
- readonly name: "data";
925
- readonly type: "bytes";
926
- readonly internalType: "bytes";
927
- }];
928
- }];
929
- readonly stateMutability: "view";
930
- }, {
931
- readonly type: "event";
932
- readonly name: "Attested";
933
- readonly inputs: readonly [{
934
- readonly name: "recipient";
935
- readonly type: "address";
936
- readonly indexed: true;
937
- readonly internalType: "address";
938
- }, {
939
- readonly name: "attester";
940
- readonly type: "address";
941
- readonly indexed: true;
942
- readonly internalType: "address";
943
- }, {
944
- readonly name: "uid";
945
- readonly type: "bytes32";
946
- readonly indexed: false;
947
- readonly internalType: "bytes32";
948
- }, {
949
- readonly name: "schemaUID";
950
- readonly type: "bytes32";
951
- readonly indexed: true;
952
- readonly internalType: "bytes32";
953
- }];
954
- readonly anonymous: false;
955
- }, {
956
- readonly type: "event";
957
- readonly name: "Revoked";
958
- readonly inputs: readonly [{
959
- readonly name: "recipient";
960
- readonly type: "address";
961
- readonly indexed: true;
962
- readonly internalType: "address";
963
- }, {
964
- readonly name: "attester";
965
- readonly type: "address";
966
- readonly indexed: true;
967
- readonly internalType: "address";
968
- }, {
969
- readonly name: "uid";
970
- readonly type: "bytes32";
971
- readonly indexed: false;
972
- readonly internalType: "bytes32";
973
- }, {
974
- readonly name: "schemaUID";
975
- readonly type: "bytes32";
976
- readonly indexed: true;
977
- readonly internalType: "bytes32";
978
- }];
979
- readonly anonymous: false;
980
- }];
981
- /**
982
- * Default ABIs for EAS Portal integration
983
- */
984
- declare const DEFAULT_EAS_ABIS: readonly [{
985
- readonly name: "SchemaRegistry";
986
- readonly abi: string;
987
- }, {
988
- readonly name: "EAS";
989
- readonly abi: string;
990
- }];
991
-
992
67
  //#endregion
993
68
  //#region src/eas.d.ts
994
69
  /**
995
- * Creates an EAS client for interacting with the Ethereum Attestation Service via Portal.
996
- * This is the main entry point for the EAS SDK, now powered by Portal.
70
+ * Creates an EAS client for interacting with the Ethereum Attestation Service.
997
71
  *
998
- * @param options - Configuration options for the Portal-based client
999
- * @returns An EAS Portal client instance with enhanced methods
72
+ * @param options - Configuration options for the client
73
+ * @returns An object containing the EAS client instance
1000
74
  * @throws Will throw an error if the options fail validation
1001
75
  *
1002
76
  * @example
1003
77
  * ```ts
1004
78
  * import { createEASClient } from '@settlemint/sdk-eas';
1005
79
  *
1006
- * const eas = createEASClient({
1007
- * instance: "https://portal.settlemint.com",
80
+ * const client = createEASClient({
81
+ * schemaRegistryAddress: "0x1234567890123456789012345678901234567890",
82
+ * attestationAddress: "0x1234567890123456789012345678901234567890",
1008
83
  * accessToken: "your-access-token",
1009
- * easContractAddress: "0x1234567890123456789012345678901234567890",
1010
- * schemaRegistryContractAddress: "0x1234567890123456789012345678901234567890",
1011
- * });
1012
- *
1013
- * // Register a schema with string
1014
- * const result = await eas.registerSchema({
1015
- * schema: "address user, uint256 score",
1016
- * resolver: "0x0000000000000000000000000000000000000000",
1017
- * revocable: true,
1018
- * });
1019
- *
1020
- * // Or register schema with fields (automatic validation)
1021
- * const schemaResult = await eas.registerSchema({
1022
- * fields: [
1023
- * { name: "user", type: "address" },
1024
- * { name: "score", type: "uint256" }
1025
- * ],
1026
- * resolver: "0x0000000000000000000000000000000000000000",
1027
- * revocable: true,
1028
- * });
1029
- *
1030
- * // Create attestations
1031
- * const attestation = await eas.attest({
1032
- * schema: "0x...",
1033
- * data: {
1034
- * recipient: "0x...",
1035
- * expirationTime: 0n,
1036
- * revocable: true,
1037
- * refUID: "0x0000000000000000000000000000000000000000000000000000000000000000",
1038
- * data: "0x...",
1039
- * value: 0n,
1040
- * },
84
+ * chainId: "1",
85
+ * chainName: "Ethereum",
86
+ * rpcUrl: "http://localhost:8545"
1041
87
  * });
1042
88
  * ```
1043
89
  */
1044
- declare function createEASClient(options: PortalClientOptions): EASPortalClient;
1045
- /**
1046
- * Validates schema fields and builds a schema string without requiring a client instance.
1047
- * Useful for pre-validation or building schema strings for external use.
1048
- *
1049
- * @param fields - Array of schema fields to validate
1050
- * @returns The validated schema string
1051
- * @throws Error if validation fails
1052
- *
1053
- * @example
1054
- * ```typescript
1055
- * import { validateAndBuildSchema } from "@settlemint/sdk-eas";
1056
- *
1057
- * try {
1058
- * const schemaString = validateAndBuildSchema([
1059
- * { name: "user", type: "address", description: "User's wallet address" },
1060
- * { name: "score", type: "uint256", description: "User's reputation score" }
1061
- * ]);
1062
- * console.log("Schema is valid:", schemaString); // "address user, uint256 score"
1063
- * } catch (error) {
1064
- * console.error("Schema validation failed:", error.message);
1065
- * }
1066
- * ```
1067
- */
1068
- declare function validateAndBuildSchema(fields: SchemaField[]): string;
90
+ declare function createEASClient(options: ClientOptions): {
91
+ registerSchema: (options: RegisterSchemaOptions) => Promise<string>;
92
+ getSchema: (uid: string) => Promise<string>;
93
+ };
1069
94
 
1070
95
  //#endregion
1071
- export { PortalClientOptions as ClientOptions, DEFAULT_EAS_ABIS, EASErrorCode, EASFieldType, EASPortalClient, EASPortalError, EAS_ABI, EAS_FIELD_TYPES, RegisterSchemaOptions, SCHEMA_REGISTRY_ABI, SchemaField, buildSchemaString, createEASClient, validateAndBuildSchema, validatePortalClientOptions, validateSchemaFields };
96
+ export { ClientOptions, ClientOptionsSchema, EASFieldType, EAS_FIELD_TYPES, RegisterSchemaOptions, SchemaField, createEASClient };
1072
97
  //# sourceMappingURL=eas.d.cts.map