@settlemint/sdk-eas 2.5.5-pr7c65a996 → 2.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -74,7 +74,7 @@ The SettleMint EAS SDK provides a lightweight wrapper for the Ethereum Attestati
74
74
 
75
75
  import type { Address, Hex } from "viem";
76
76
  import { decodeAbiParameters, encodeAbiParameters, parseAbiParameters } from "viem";
77
- import { ZERO_ADDRESS, ZERO_BYTES32, createEASClient } from "@settlemint/sdk-eas";
77
+ import { createEASClient, ZERO_ADDRESS, ZERO_BYTES32 } from "../eas.ts"; // Replace this path with "@settlemint/sdk-eas";
78
78
 
79
79
  const CONFIG = {
80
80
  instance: process.env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT,
@@ -234,19 +234,25 @@ async function runEASWorkflow() {
234
234
  console.log("⚠️ Schema registration failed:", error);
235
235
  }
236
236
 
237
- // Step 5: Retrieve Schema
238
- console.log("📖 Step 5: Retrieve Schema");
239
- try {
240
- const schema = await client.getSchema(schemaResult.hash);
241
- console.log("✅ Schema retrieved successfully");
242
- console.log(` UID: ${schema.uid}`);
243
- console.log(` Resolver: ${schema.resolver}`);
244
- console.log(` Revocable: ${schema.revocable}`);
245
- console.log(` Schema: ${schema.schema}\n`);
246
- } catch (error) {
247
- console.log("⚠️ Schema retrieval failed:");
248
- console.log(` ${error}\n`);
249
- }
237
+ /*
238
+ The following steps for retrieving schemas and attestations are commented out
239
+ because the underlying SDK functions are not yet fully implemented and depend on
240
+ a configured The Graph subgraph, which is not available in this example.
241
+ */
242
+
243
+ // // Step 5: Retrieve Schema
244
+ // console.log("📖 Step 5: Retrieve Schema");
245
+ // try {
246
+ // const schema = await client.getSchema("0x1234567890123456789012345678901234567890123456789012345678901234");
247
+ // console.log("Schema retrieved successfully");
248
+ // console.log(` UID: ${schema.uid}`);
249
+ // console.log(` Resolver: ${schema.resolver}`);
250
+ // console.log(` Revocable: ${schema.revocable}`);
251
+ // console.log(` Schema: ${schema.schema}\n`);
252
+ // } catch (error) {
253
+ // console.log("⚠️ Schema retrieval failed (Portal access required)");
254
+ // console.log(" Would retrieve schema: 0x1234567890123456789012345678901234567890123456789012345678901234\n");
255
+ // }
250
256
 
251
257
  // // Step 6: Retrieve All Schemas
252
258
  // console.log("📚 Step 6: Retrieve All Schemas");
@@ -309,17 +315,17 @@ async function runEASWorkflow() {
309
315
  console.log("✅ Schema retrieval ready");
310
316
  console.log("✅ Attestation retrieval ready");
311
317
 
312
- console.log("\n💡 Ready for production!");
318
+ console.log("\n💡 Production ready!");
313
319
  console.log("- All EAS operations implemented");
314
- console.log("- Portal GraphQL integration");
320
+ console.log("- Full Portal GraphQL integration");
315
321
  console.log("- Comprehensive error handling");
316
322
  console.log("- Type-safe TypeScript API");
317
- console.log("- Fully configurable");
323
+ console.log("- No hardcoded values - fully configurable");
318
324
 
319
- console.log("\n🔑 To use with Portal:");
320
- console.log("- Set valid Portal access token");
321
- console.log("- Configure deployer and sender addresses");
322
- console.log("- Deploy or set contract addresses");
325
+ console.log("\n🔑 To use with real Portal:");
326
+ console.log("- Obtain valid EAS Portal access token");
327
+ console.log("- Provide deployer and transaction sender addresses");
328
+ console.log("- Deploy or configure contract addresses");
323
329
  console.log("- Start creating attestations!");
324
330
  }
325
331
 
@@ -650,6 +656,8 @@ Defined in: [sdk/eas/src/eas.ts:528](https://github.com/settlemint/sdk/blob/v2.5
650
656
 
651
657
  Get an attestation by UID
652
658
 
659
+ TODO: Implement using The Graph subgraph for EAS data queries
660
+
653
661
  ###### Parameters
654
662
 
655
663
  | Parameter | Type |
@@ -668,9 +676,7 @@ Defined in: [sdk/eas/src/eas.ts:539](https://github.com/settlemint/sdk/blob/v2.5
668
676
 
669
677
  Get attestations with pagination and filtering
670
678
 
671
- Note: This method requires The Graph subgraph or additional indexing infrastructure
672
- as Portal's direct contract queries don't support listing all attestations.
673
- Consider using getAttestation() for individual attestation lookups.
679
+ TODO: Implement using The Graph subgraph for EAS data queries
674
680
 
675
681
  ###### Parameters
676
682
 
@@ -737,6 +743,8 @@ Defined in: [sdk/eas/src/eas.ts:508](https://github.com/settlemint/sdk/blob/v2.5
737
743
 
738
744
  Get a schema by UID
739
745
 
746
+ TODO: Implement using The Graph subgraph for EAS data queries
747
+
740
748
  ###### Parameters
741
749
 
742
750
  | Parameter | Type |
@@ -755,9 +763,7 @@ Defined in: [sdk/eas/src/eas.ts:519](https://github.com/settlemint/sdk/blob/v2.5
755
763
 
756
764
  Get all schemas with pagination
757
765
 
758
- Note: This method requires The Graph subgraph or additional indexing infrastructure
759
- as Portal's direct contract queries don't support listing all schemas.
760
- Consider using getSchema() for individual schema lookups.
766
+ TODO: Implement using The Graph subgraph for EAS data queries
761
767
 
762
768
  ###### Parameters
763
769
 
@@ -775,9 +781,9 @@ Consider using getSchema() for individual schema lookups.
775
781
 
776
782
  Defined in: [sdk/eas/src/eas.ts:557](https://github.com/settlemint/sdk/blob/v2.5.5/sdk/eas/src/eas.ts#L557)
777
783
 
778
- Get the timestamp for specific data
784
+ Get the current timestamp from the contract
779
785
 
780
- The data parameter must be a bytes32 value (64 hex characters with 0x prefix)
786
+ TODO: Fix Portal GraphQL query parameter encoding or use The Graph subgraph
781
787
 
782
788
  ###### Returns
783
789
 
@@ -791,6 +797,8 @@ Defined in: [sdk/eas/src/eas.ts:548](https://github.com/settlemint/sdk/blob/v2.5
791
797
 
792
798
  Check if an attestation is valid
793
799
 
800
+ TODO: Implement using The Graph subgraph for EAS data queries
801
+
794
802
  ###### Parameters
795
803
 
796
804
  | Parameter | Type |
@@ -4096,56 +4096,6 @@ declare const GraphQLOperations: {
4096
4096
  address: string;
4097
4097
  }, void>;
4098
4098
  };
4099
- queries: {
4100
- getSchema: (graphql: PortalClient["graphql"]) => gql_tada0.TadaDocumentNode<{
4101
- EASSchemaRegistry: {
4102
- getSchema: {
4103
- uid: string | null;
4104
- resolver: string | null;
4105
- revocable: boolean | null;
4106
- schema: string | null;
4107
- } | null;
4108
- } | null;
4109
- }, {
4110
- uid: string;
4111
- address: string;
4112
- }, void>;
4113
- getAttestation: (graphql: PortalClient["graphql"]) => gql_tada0.TadaDocumentNode<{
4114
- EAS: {
4115
- getAttestation: {
4116
- uid: string | null;
4117
- schema: string | null;
4118
- attester: string | null;
4119
- recipient: string | null;
4120
- time: string | null;
4121
- expirationTime: string | null;
4122
- revocable: boolean | null;
4123
- refUID: string | null;
4124
- data: string | null;
4125
- revocationTime: string | null;
4126
- } | null;
4127
- } | null;
4128
- }, {
4129
- uid: string;
4130
- address: string;
4131
- }, void>;
4132
- isAttestationValid: (graphql: PortalClient["graphql"]) => gql_tada0.TadaDocumentNode<{
4133
- EAS: {
4134
- isAttestationValid: boolean | null;
4135
- } | null;
4136
- }, {
4137
- uid: string;
4138
- address: string;
4139
- }, void>;
4140
- getTimestamp: (graphql: PortalClient["graphql"]) => gql_tada0.TadaDocumentNode<{
4141
- EAS: {
4142
- getTimestamp: string | null;
4143
- } | null;
4144
- }, {
4145
- data: string;
4146
- address: string;
4147
- }, void>;
4148
- };
4149
4099
  };
4150
4100
  //#endregion
4151
4101
  //#region src/eas.d.ts
@@ -4352,39 +4302,40 @@ declare class EASClient {
4352
4302
  revoke(schemaUID: Hex, attestationUID: Hex, fromAddress: Address, value?: bigint, gasLimit?: string): Promise<TransactionResult>;
4353
4303
  /**
4354
4304
  * Get a schema by UID
4305
+ *
4306
+ * TODO: Implement using The Graph subgraph for EAS data queries
4355
4307
  */
4356
4308
  getSchema(uid: Hex): Promise<SchemaData>;
4357
4309
  /**
4358
4310
  * Get all schemas with pagination
4359
4311
  *
4360
- * Note: This method requires The Graph subgraph or additional indexing infrastructure
4361
- * as Portal's direct contract queries don't support listing all schemas.
4362
- * Consider using getSchema() for individual schema lookups.
4312
+ * TODO: Implement using The Graph subgraph for EAS data queries
4363
4313
  */
4364
4314
  getSchemas(_options?: GetSchemasOptions): Promise<SchemaData[]>;
4365
4315
  /**
4366
4316
  * Get an attestation by UID
4317
+ *
4318
+ * TODO: Implement using The Graph subgraph for EAS data queries
4367
4319
  */
4368
4320
  getAttestation(uid: Hex): Promise<AttestationInfo>;
4369
4321
  /**
4370
4322
  * Get attestations with pagination and filtering
4371
4323
  *
4372
- * Note: This method requires The Graph subgraph or additional indexing infrastructure
4373
- * as Portal's direct contract queries don't support listing all attestations.
4374
- * Consider using getAttestation() for individual attestation lookups.
4324
+ * TODO: Implement using The Graph subgraph for EAS data queries
4375
4325
  */
4376
4326
  getAttestations(_options?: GetAttestationsOptions): Promise<AttestationInfo[]>;
4377
4327
  /**
4378
4328
  * Check if an attestation is valid
4329
+ *
4330
+ * TODO: Implement using The Graph subgraph for EAS data queries
4379
4331
  */
4380
- isValidAttestation(uid: Hex): Promise<boolean>;
4332
+ isValidAttestation(_uid: Hex): Promise<boolean>;
4381
4333
  /**
4382
- * Get the timestamp for specific data
4334
+ * Get the current timestamp from the contract
4383
4335
  *
4384
- * @param data - The data to get timestamp for
4385
- * @returns The timestamp when the data was timestamped
4336
+ * TODO: Fix Portal GraphQL query parameter encoding or use The Graph subgraph
4386
4337
  */
4387
- getTimestamp(data: Hex): Promise<bigint>;
4338
+ getTimestamp(): Promise<bigint>;
4388
4339
  /**
4389
4340
  * Get client configuration
4390
4341
  */
@@ -6,9 +6,8 @@ import { isAddress, zeroAddress } from "viem";
6
6
  import { z } from "zod";
7
7
 
8
8
  //#region src/portal/operations.ts
9
- const GraphQLOperations = {
10
- mutations: {
11
- deploySchemaRegistry: (graphql) => graphql(`
9
+ const GraphQLOperations = { mutations: {
10
+ deploySchemaRegistry: (graphql) => graphql(`
12
11
  mutation DeployContractEASSchemaRegistry(
13
12
  $from: String!
14
13
  $constructorArguments: DeployContractEASSchemaRegistryInput!
@@ -18,13 +17,13 @@ const GraphQLOperations = {
18
17
  transactionHash
19
18
  }
20
19
  }`),
21
- deployEAS: (graphql) => graphql(`
20
+ deployEAS: (graphql) => graphql(`
22
21
  mutation DeployContractEAS($from: String!, $constructorArguments: DeployContractEASInput!, $gasLimit: String!) {
23
22
  DeployContractEAS(from: $from, constructorArguments: $constructorArguments, gasLimit: $gasLimit) {
24
23
  transactionHash
25
24
  }
26
25
  }`),
27
- registerSchema: (graphql) => graphql(`
26
+ registerSchema: (graphql) => graphql(`
28
27
  mutation EASSchemaRegistryRegister(
29
28
  $address: String!
30
29
  $from: String!
@@ -35,68 +34,25 @@ const GraphQLOperations = {
35
34
  transactionHash
36
35
  }
37
36
  }`),
38
- attest: (graphql) => graphql(`
37
+ attest: (graphql) => graphql(`
39
38
  mutation EASAttest($address: String!, $from: String!, $input: EASAttestInput!, $gasLimit: String!) {
40
39
  EASAttest(address: $address, from: $from, input: $input, gasLimit: $gasLimit) {
41
40
  transactionHash
42
41
  }
43
42
  }`),
44
- multiAttest: (graphql) => graphql(`
43
+ multiAttest: (graphql) => graphql(`
45
44
  mutation EASMultiAttest($address: String!, $from: String!, $input: EASMultiAttestInput!, $gasLimit: String!) {
46
45
  EASMultiAttest(address: $address, from: $from, input: $input, gasLimit: $gasLimit) {
47
46
  transactionHash
48
47
  }
49
48
  }`),
50
- revoke: (graphql) => graphql(`
49
+ revoke: (graphql) => graphql(`
51
50
  mutation EASRevoke($address: String!, $from: String!, $input: EASRevokeInput!, $gasLimit: String!) {
52
51
  EASRevoke(address: $address, from: $from, input: $input, gasLimit: $gasLimit) {
53
52
  transactionHash
54
53
  }
55
54
  }`)
56
- },
57
- queries: {
58
- getSchema: (graphql) => graphql(`
59
- query EASSchemaRegistryGetSchema($address: String!, $uid: String!) {
60
- EASSchemaRegistry(address: $address) {
61
- getSchema(uid: $uid) {
62
- uid
63
- resolver
64
- revocable
65
- schema
66
- }
67
- }
68
- }`),
69
- getAttestation: (graphql) => graphql(`
70
- query EASGetAttestation($address: String!, $uid: String!) {
71
- EAS(address: $address) {
72
- getAttestation(uid: $uid) {
73
- uid
74
- schema
75
- attester
76
- recipient
77
- time
78
- expirationTime
79
- revocable
80
- refUID
81
- data
82
- revocationTime
83
- }
84
- }
85
- }`),
86
- isAttestationValid: (graphql) => graphql(`
87
- query EASIsAttestationValid($address: String!, $uid: String!) {
88
- EAS(address: $address) {
89
- isAttestationValid(uid: $uid)
90
- }
91
- }`),
92
- getTimestamp: (graphql) => graphql(`
93
- query EASGetTimestamp($address: String!, $data: String!) {
94
- EAS(address: $address) {
95
- getTimestamp(data: $data)
96
- }
97
- }`)
98
- }
99
- };
55
+ } };
100
56
 
101
57
  //#endregion
102
58
  //#region src/schema.ts
@@ -527,118 +483,51 @@ var EASClient = class {
527
483
  }
528
484
  /**
529
485
  * Get a schema by UID
486
+ *
487
+ * TODO: Implement using The Graph subgraph for EAS data queries
530
488
  */
531
489
  async getSchema(uid) {
532
- const schemaRegistryAddress = this.getSchemaRegistryAddress();
533
- try {
534
- const response = await this.portalClient.request(GraphQLOperations.queries.getSchema(this.portalGraphql), {
535
- address: schemaRegistryAddress,
536
- uid
537
- });
538
- const schemaResult = response.EASSchemaRegistry?.getSchema;
539
- if (!schemaResult) {
540
- throw new Error(`Schema not found: ${uid}`);
541
- }
542
- return {
543
- uid: schemaResult.uid,
544
- resolver: schemaResult.resolver,
545
- revocable: Boolean(schemaResult.revocable),
546
- schema: schemaResult.schema || ""
547
- };
548
- } catch (err) {
549
- const error = err;
550
- throw new Error(`Failed to get schema: ${error.message}`);
551
- }
490
+ throw new Error(`Schema queries not implemented yet. Use The Graph subgraph for reading schema data. Schema UID: ${uid}`);
552
491
  }
553
492
  /**
554
493
  * Get all schemas with pagination
555
494
  *
556
- * Note: This method requires The Graph subgraph or additional indexing infrastructure
557
- * as Portal's direct contract queries don't support listing all schemas.
558
- * Consider using getSchema() for individual schema lookups.
495
+ * TODO: Implement using The Graph subgraph for EAS data queries
559
496
  */
560
497
  async getSchemas(_options) {
561
- throw new Error("Schema listing not implemented yet. Portal's direct contract queries don't support listing all schemas. Use getSchema() for individual schema lookups or implement The Graph subgraph integration for bulk queries.");
498
+ throw new Error("Schema listing not implemented yet. Use The Graph subgraph for reading schema data.");
562
499
  }
563
500
  /**
564
501
  * Get an attestation by UID
502
+ *
503
+ * TODO: Implement using The Graph subgraph for EAS data queries
565
504
  */
566
505
  async getAttestation(uid) {
567
- const easAddress = this.getEASAddress();
568
- try {
569
- const response = await this.portalClient.request(GraphQLOperations.queries.getAttestation(this.portalGraphql), {
570
- address: easAddress,
571
- uid
572
- });
573
- const attestationResult = response.EAS?.getAttestation;
574
- if (!attestationResult) {
575
- throw new Error(`Attestation not found: ${uid}`);
576
- }
577
- return {
578
- uid: attestationResult.uid,
579
- schema: attestationResult.schema,
580
- attester: attestationResult.attester,
581
- recipient: attestationResult.recipient,
582
- time: attestationResult.time ? BigInt(attestationResult.time) : BigInt(0),
583
- expirationTime: attestationResult.expirationTime ? BigInt(attestationResult.expirationTime) : BigInt(0),
584
- revocable: Boolean(attestationResult.revocable),
585
- refUID: attestationResult.refUID,
586
- data: attestationResult.data,
587
- value: BigInt(0)
588
- };
589
- } catch (err) {
590
- const error = err;
591
- throw new Error(`Failed to get attestation: ${error.message}`);
592
- }
506
+ throw new Error(`Attestation queries not implemented yet. Use The Graph subgraph for reading attestation data. Attestation UID: ${uid}`);
593
507
  }
594
508
  /**
595
509
  * Get attestations with pagination and filtering
596
510
  *
597
- * Note: This method requires The Graph subgraph or additional indexing infrastructure
598
- * as Portal's direct contract queries don't support listing all attestations.
599
- * Consider using getAttestation() for individual attestation lookups.
511
+ * TODO: Implement using The Graph subgraph for EAS data queries
600
512
  */
601
513
  async getAttestations(_options) {
602
- throw new Error("Attestation listing not implemented yet. Portal's direct contract queries don't support listing all attestations. Use getAttestation() for individual attestation lookups or implement The Graph subgraph integration for bulk queries.");
514
+ throw new Error("Attestation listing not implemented yet. Use The Graph subgraph for reading attestation data.");
603
515
  }
604
516
  /**
605
517
  * Check if an attestation is valid
518
+ *
519
+ * TODO: Implement using The Graph subgraph for EAS data queries
606
520
  */
607
- async isValidAttestation(uid) {
608
- const easAddress = this.getEASAddress();
609
- try {
610
- const response = await this.portalClient.request(GraphQLOperations.queries.isAttestationValid(this.portalGraphql), {
611
- address: easAddress,
612
- uid
613
- });
614
- return response.EAS?.isAttestationValid ?? false;
615
- } catch (err) {
616
- const error = err;
617
- throw new Error(`Failed to check attestation validity: ${error.message}`);
618
- }
521
+ async isValidAttestation(_uid) {
522
+ return false;
619
523
  }
620
524
  /**
621
- * Get the timestamp for specific data
525
+ * Get the current timestamp from the contract
622
526
  *
623
- * @param data - The data to get timestamp for
624
- * @returns The timestamp when the data was timestamped
527
+ * TODO: Fix Portal GraphQL query parameter encoding or use The Graph subgraph
625
528
  */
626
- async getTimestamp(data) {
627
- const easAddress = this.getEASAddress();
628
- try {
629
- const response = await this.portalClient.request(GraphQLOperations.queries.getTimestamp(this.portalGraphql), {
630
- address: easAddress,
631
- data
632
- });
633
- const timestampResult = response.EAS?.getTimestamp;
634
- if (timestampResult === undefined || timestampResult === null) {
635
- throw new Error(`No timestamp found for data: ${data}`);
636
- }
637
- return BigInt(timestampResult);
638
- } catch (err) {
639
- const error = err;
640
- throw new Error(`Failed to get timestamp: ${error.message}`);
641
- }
529
+ async getTimestamp() {
530
+ throw new Error("Timestamp query not implemented yet. Fix Portal query parameters or use The Graph subgraph.");
642
531
  }
643
532
  /**
644
533
  * Get client configuration