@settlemint/sdk-eas 2.3.14-pr77cf5949 → 2.3.14-pr7faa2137

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.cjs CHANGED
@@ -10872,10 +10872,10 @@ var v4_default = classic_default;
10872
10872
  //#region src/utils/validation.ts
10873
10873
  const ethAddressSchema = custom((val) => typeof val === "string" && (0, viem.isAddress)(val), "Invalid Ethereum address");
10874
10874
  /**
10875
- * @description Zod schema for EASClientOptions.
10875
+ * Zod schema for EASClientOptions.
10876
10876
  */
10877
10877
  const EASClientOptionsSchema = object({
10878
- instance: string$1().url("Invalid instance URL"),
10878
+ instance: __settlemint_sdk_utils_validation.UrlSchema,
10879
10879
  accessToken: __settlemint_sdk_utils_validation.ApplicationAccessTokenSchema.optional(),
10880
10880
  easContractAddress: ethAddressSchema.optional(),
10881
10881
  schemaRegistryContractAddress: ethAddressSchema.optional(),
@@ -10885,6 +10885,7 @@ const EASClientOptionsSchema = object({
10885
10885
  //#endregion
10886
10886
  //#region src/eas.ts
10887
10887
  const LOGGER = (0, __settlemint_sdk_utils_logging.createLogger)();
10888
+ const DEFAULT_GAS_LIMIT = "0x3d0900";
10888
10889
  /**
10889
10890
  * Main EAS client class for interacting with Ethereum Attestation Service via Portal
10890
10891
  *
@@ -10907,6 +10908,11 @@ var EASClient = class {
10907
10908
  portalClient;
10908
10909
  portalGraphql;
10909
10910
  deployedAddresses;
10911
+ /**
10912
+ * Create a new EAS client instance
10913
+ *
10914
+ * @param options - Configuration options for the EAS client
10915
+ */
10910
10916
  constructor(options) {
10911
10917
  this.options = (0, __settlemint_sdk_utils_validation.validate)(EASClientOptionsSchema, options);
10912
10918
  const { client: portalClient, graphql: portalGraphql } = (0, __settlemint_sdk_portal.createPortalClient)({
@@ -10947,12 +10953,11 @@ var EASClient = class {
10947
10953
  const defaultForwarder = forwarderAddress || ZERO_ADDRESS;
10948
10954
  const defaultGasLimit = gasLimit || "0x7a1200";
10949
10955
  try {
10950
- const schemaRegistryResult = await this.portalClient.request(GraphQLOperations.mutations.deploySchemaRegistry(this.portalGraphql), {
10956
+ const schemaRegistryResponse = await this.portalClient.request(GraphQLOperations.mutations.deploySchemaRegistry(this.portalGraphql), {
10951
10957
  from: deployerAddress,
10952
10958
  constructorArguments: { forwarder: defaultForwarder },
10953
10959
  gasLimit: defaultGasLimit
10954
10960
  });
10955
- const schemaRegistryResponse = schemaRegistryResult;
10956
10961
  if (!schemaRegistryResponse.DeployContractEASSchemaRegistry?.transactionHash) {
10957
10962
  throw new Error("Schema Registry deployment failed - no transaction hash returned");
10958
10963
  }
@@ -10974,11 +10979,10 @@ var EASClient = class {
10974
10979
  },
10975
10980
  gasLimit: defaultGasLimit
10976
10981
  });
10977
- const easResult = easResponse;
10978
- if (!easResult.DeployContractEAS?.transactionHash) {
10982
+ if (!easResponse.DeployContractEAS?.transactionHash) {
10979
10983
  throw new Error("EAS deployment failed - no transaction hash returned");
10980
10984
  }
10981
- const easTxHash = easResult.DeployContractEAS.transactionHash;
10985
+ const easTxHash = easResponse.DeployContractEAS.transactionHash;
10982
10986
  const easTransaction = await (0, __settlemint_sdk_portal.waitForTransactionReceipt)(easTxHash, {
10983
10987
  portalGraphqlEndpoint: this.options.instance,
10984
10988
  accessToken: this.options.accessToken,
@@ -11039,7 +11043,7 @@ var EASClient = class {
11039
11043
  throw new Error("Schema string is required. Provide either 'schema' or 'fields'.");
11040
11044
  }
11041
11045
  try {
11042
- const result = await this.portalClient.request(GraphQLOperations.mutations.registerSchema(this.portalGraphql), {
11046
+ const response = await this.portalClient.request(GraphQLOperations.mutations.registerSchema(this.portalGraphql), {
11043
11047
  address: schemaRegistryAddress,
11044
11048
  from: fromAddress,
11045
11049
  input: {
@@ -11047,9 +11051,8 @@ var EASClient = class {
11047
11051
  resolver: request.resolver,
11048
11052
  revocable: request.revocable
11049
11053
  },
11050
- gasLimit: gasLimit || "0x3d0900"
11054
+ gasLimit: gasLimit || DEFAULT_GAS_LIMIT
11051
11055
  });
11052
- const response = result;
11053
11056
  const transactionHash = response.EASSchemaRegistryRegister?.transactionHash;
11054
11057
  if (!transactionHash) {
11055
11058
  throw new Error("No transaction hash returned from Portal");
@@ -11101,7 +11104,7 @@ var EASClient = class {
11101
11104
  async attest(request, fromAddress, gasLimit) {
11102
11105
  const easAddress = this.getEASAddress();
11103
11106
  try {
11104
- const result = await this.portalClient.request(GraphQLOperations.mutations.attest(this.portalGraphql), {
11107
+ const response = await this.portalClient.request(GraphQLOperations.mutations.attest(this.portalGraphql), {
11105
11108
  address: easAddress,
11106
11109
  from: fromAddress,
11107
11110
  input: { request: {
@@ -11115,9 +11118,8 @@ var EASClient = class {
11115
11118
  value: request.data.value?.toString() || "0"
11116
11119
  }
11117
11120
  } },
11118
- gasLimit: gasLimit || "0x3d0900"
11121
+ gasLimit: gasLimit || DEFAULT_GAS_LIMIT
11119
11122
  });
11120
- const response = result;
11121
11123
  const transactionHash = response.EASAttest?.transactionHash;
11122
11124
  if (!transactionHash) {
11123
11125
  throw new Error("No transaction hash returned from Portal");
@@ -11185,7 +11187,7 @@ var EASClient = class {
11185
11187
  }
11186
11188
  const easAddress = this.getEASAddress();
11187
11189
  try {
11188
- const result = await this.portalClient.request(GraphQLOperations.mutations.multiAttest(this.portalGraphql), {
11190
+ const response = await this.portalClient.request(GraphQLOperations.mutations.multiAttest(this.portalGraphql), {
11189
11191
  address: easAddress,
11190
11192
  from: fromAddress,
11191
11193
  input: { multiRequests: requests.map((req) => ({
@@ -11199,9 +11201,8 @@ var EASClient = class {
11199
11201
  value: req.data.value?.toString() || "0"
11200
11202
  }]
11201
11203
  })) },
11202
- gasLimit: gasLimit || "0x3d0900"
11204
+ gasLimit: gasLimit || DEFAULT_GAS_LIMIT
11203
11205
  });
11204
- const response = result;
11205
11206
  const transactionHash = response.EASMultiAttest?.transactionHash;
11206
11207
  if (!transactionHash) {
11207
11208
  throw new Error("No transaction hash returned from Portal");
@@ -11245,9 +11246,8 @@ var EASClient = class {
11245
11246
  * ```
11246
11247
  */
11247
11248
  async revoke(schemaUID, attestationUID, fromAddress, value, gasLimit) {
11248
- const easAddress = this.getEASAddress();
11249
11249
  try {
11250
- const result = await this.portalClient.request(GraphQLOperations.mutations.revoke(this.portalGraphql), {
11250
+ const response = await this.portalClient.request(GraphQLOperations.mutations.revoke(this.portalGraphql), {
11251
11251
  address: this.getEASAddress(),
11252
11252
  from: fromAddress,
11253
11253
  input: { request: {
@@ -11257,9 +11257,8 @@ var EASClient = class {
11257
11257
  value: value?.toString() || "0"
11258
11258
  }
11259
11259
  } },
11260
- gasLimit: gasLimit || "0x3d0900"
11260
+ gasLimit: gasLimit || DEFAULT_GAS_LIMIT
11261
11261
  });
11262
- const response = result;
11263
11262
  const transactionHash = response.EASRevoke?.transactionHash;
11264
11263
  if (!transactionHash) {
11265
11264
  throw new Error("No transaction hash returned from Portal");