@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.d.cts CHANGED
@@ -3816,7 +3816,7 @@ type PortalClient = ReturnType<typeof createPortalClient<{
3816
3816
  //#endregion
3817
3817
  //#region src/utils/validation.d.ts
3818
3818
  /**
3819
- * @description Zod schema for EASClientOptions.
3819
+ * Zod schema for EASClientOptions.
3820
3820
  */
3821
3821
  declare const EASClientOptionsSchema: z.ZodObject<{
3822
3822
  instance: z.ZodString;
@@ -3988,6 +3988,7 @@ interface DeploymentResult {
3988
3988
  }
3989
3989
  /**
3990
3990
  * @deprecated Use SchemaRequest instead
3991
+ * @internal
3991
3992
  */
3992
3993
  interface RegisterSchemaOptions extends SchemaRequest {}
3993
3994
  //#endregion
@@ -4119,6 +4120,11 @@ declare class EASClient {
4119
4120
  private readonly portalClient;
4120
4121
  private readonly portalGraphql;
4121
4122
  private deployedAddresses?;
4123
+ /**
4124
+ * Create a new EAS client instance
4125
+ *
4126
+ * @param options - Configuration options for the EAS client
4127
+ */
4122
4128
  constructor(options: EASClientOptions);
4123
4129
  /**
4124
4130
  * Deploy EAS contracts via Portal
package/dist/eas.d.ts CHANGED
@@ -3816,7 +3816,7 @@ type PortalClient = ReturnType<typeof createPortalClient<{
3816
3816
  //#endregion
3817
3817
  //#region src/utils/validation.d.ts
3818
3818
  /**
3819
- * @description Zod schema for EASClientOptions.
3819
+ * Zod schema for EASClientOptions.
3820
3820
  */
3821
3821
  declare const EASClientOptionsSchema: z.ZodObject<{
3822
3822
  instance: z.ZodString;
@@ -3988,6 +3988,7 @@ interface DeploymentResult {
3988
3988
  }
3989
3989
  /**
3990
3990
  * @deprecated Use SchemaRequest instead
3991
+ * @internal
3991
3992
  */
3992
3993
  interface RegisterSchemaOptions extends SchemaRequest {}
3993
3994
  //#endregion
@@ -4119,6 +4120,11 @@ declare class EASClient {
4119
4120
  private readonly portalClient;
4120
4121
  private readonly portalGraphql;
4121
4122
  private deployedAddresses?;
4123
+ /**
4124
+ * Create a new EAS client instance
4125
+ *
4126
+ * @param options - Configuration options for the EAS client
4127
+ */
4122
4128
  constructor(options: EASClientOptions);
4123
4129
  /**
4124
4130
  * Deploy EAS contracts via Portal
package/dist/eas.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "node:module";
2
2
  import { createPortalClient, waitForTransactionReceipt } from "@settlemint/sdk-portal";
3
3
  import { createLogger, requestLogger } from "@settlemint/sdk-utils/logging";
4
- import { ApplicationAccessTokenSchema, validate } from "@settlemint/sdk-utils/validation";
4
+ import { ApplicationAccessTokenSchema, UrlSchema, validate } from "@settlemint/sdk-utils/validation";
5
5
  import { isAddress, zeroAddress } from "viem";
6
6
 
7
7
  //#region rolldown:runtime
@@ -10854,10 +10854,10 @@ var v4_default = classic_default;
10854
10854
  //#region src/utils/validation.ts
10855
10855
  const ethAddressSchema = custom((val) => typeof val === "string" && isAddress(val), "Invalid Ethereum address");
10856
10856
  /**
10857
- * @description Zod schema for EASClientOptions.
10857
+ * Zod schema for EASClientOptions.
10858
10858
  */
10859
10859
  const EASClientOptionsSchema = object({
10860
- instance: string$1().url("Invalid instance URL"),
10860
+ instance: UrlSchema,
10861
10861
  accessToken: ApplicationAccessTokenSchema.optional(),
10862
10862
  easContractAddress: ethAddressSchema.optional(),
10863
10863
  schemaRegistryContractAddress: ethAddressSchema.optional(),
@@ -10867,6 +10867,7 @@ const EASClientOptionsSchema = object({
10867
10867
  //#endregion
10868
10868
  //#region src/eas.ts
10869
10869
  const LOGGER = createLogger();
10870
+ const DEFAULT_GAS_LIMIT = "0x3d0900";
10870
10871
  /**
10871
10872
  * Main EAS client class for interacting with Ethereum Attestation Service via Portal
10872
10873
  *
@@ -10889,6 +10890,11 @@ var EASClient = class {
10889
10890
  portalClient;
10890
10891
  portalGraphql;
10891
10892
  deployedAddresses;
10893
+ /**
10894
+ * Create a new EAS client instance
10895
+ *
10896
+ * @param options - Configuration options for the EAS client
10897
+ */
10892
10898
  constructor(options) {
10893
10899
  this.options = validate(EASClientOptionsSchema, options);
10894
10900
  const { client: portalClient, graphql: portalGraphql } = createPortalClient({
@@ -10929,12 +10935,11 @@ var EASClient = class {
10929
10935
  const defaultForwarder = forwarderAddress || ZERO_ADDRESS;
10930
10936
  const defaultGasLimit = gasLimit || "0x7a1200";
10931
10937
  try {
10932
- const schemaRegistryResult = await this.portalClient.request(GraphQLOperations.mutations.deploySchemaRegistry(this.portalGraphql), {
10938
+ const schemaRegistryResponse = await this.portalClient.request(GraphQLOperations.mutations.deploySchemaRegistry(this.portalGraphql), {
10933
10939
  from: deployerAddress,
10934
10940
  constructorArguments: { forwarder: defaultForwarder },
10935
10941
  gasLimit: defaultGasLimit
10936
10942
  });
10937
- const schemaRegistryResponse = schemaRegistryResult;
10938
10943
  if (!schemaRegistryResponse.DeployContractEASSchemaRegistry?.transactionHash) {
10939
10944
  throw new Error("Schema Registry deployment failed - no transaction hash returned");
10940
10945
  }
@@ -10956,11 +10961,10 @@ var EASClient = class {
10956
10961
  },
10957
10962
  gasLimit: defaultGasLimit
10958
10963
  });
10959
- const easResult = easResponse;
10960
- if (!easResult.DeployContractEAS?.transactionHash) {
10964
+ if (!easResponse.DeployContractEAS?.transactionHash) {
10961
10965
  throw new Error("EAS deployment failed - no transaction hash returned");
10962
10966
  }
10963
- const easTxHash = easResult.DeployContractEAS.transactionHash;
10967
+ const easTxHash = easResponse.DeployContractEAS.transactionHash;
10964
10968
  const easTransaction = await waitForTransactionReceipt(easTxHash, {
10965
10969
  portalGraphqlEndpoint: this.options.instance,
10966
10970
  accessToken: this.options.accessToken,
@@ -11021,7 +11025,7 @@ var EASClient = class {
11021
11025
  throw new Error("Schema string is required. Provide either 'schema' or 'fields'.");
11022
11026
  }
11023
11027
  try {
11024
- const result = await this.portalClient.request(GraphQLOperations.mutations.registerSchema(this.portalGraphql), {
11028
+ const response = await this.portalClient.request(GraphQLOperations.mutations.registerSchema(this.portalGraphql), {
11025
11029
  address: schemaRegistryAddress,
11026
11030
  from: fromAddress,
11027
11031
  input: {
@@ -11029,9 +11033,8 @@ var EASClient = class {
11029
11033
  resolver: request.resolver,
11030
11034
  revocable: request.revocable
11031
11035
  },
11032
- gasLimit: gasLimit || "0x3d0900"
11036
+ gasLimit: gasLimit || DEFAULT_GAS_LIMIT
11033
11037
  });
11034
- const response = result;
11035
11038
  const transactionHash = response.EASSchemaRegistryRegister?.transactionHash;
11036
11039
  if (!transactionHash) {
11037
11040
  throw new Error("No transaction hash returned from Portal");
@@ -11083,7 +11086,7 @@ var EASClient = class {
11083
11086
  async attest(request, fromAddress, gasLimit) {
11084
11087
  const easAddress = this.getEASAddress();
11085
11088
  try {
11086
- const result = await this.portalClient.request(GraphQLOperations.mutations.attest(this.portalGraphql), {
11089
+ const response = await this.portalClient.request(GraphQLOperations.mutations.attest(this.portalGraphql), {
11087
11090
  address: easAddress,
11088
11091
  from: fromAddress,
11089
11092
  input: { request: {
@@ -11097,9 +11100,8 @@ var EASClient = class {
11097
11100
  value: request.data.value?.toString() || "0"
11098
11101
  }
11099
11102
  } },
11100
- gasLimit: gasLimit || "0x3d0900"
11103
+ gasLimit: gasLimit || DEFAULT_GAS_LIMIT
11101
11104
  });
11102
- const response = result;
11103
11105
  const transactionHash = response.EASAttest?.transactionHash;
11104
11106
  if (!transactionHash) {
11105
11107
  throw new Error("No transaction hash returned from Portal");
@@ -11167,7 +11169,7 @@ var EASClient = class {
11167
11169
  }
11168
11170
  const easAddress = this.getEASAddress();
11169
11171
  try {
11170
- const result = await this.portalClient.request(GraphQLOperations.mutations.multiAttest(this.portalGraphql), {
11172
+ const response = await this.portalClient.request(GraphQLOperations.mutations.multiAttest(this.portalGraphql), {
11171
11173
  address: easAddress,
11172
11174
  from: fromAddress,
11173
11175
  input: { multiRequests: requests.map((req) => ({
@@ -11181,9 +11183,8 @@ var EASClient = class {
11181
11183
  value: req.data.value?.toString() || "0"
11182
11184
  }]
11183
11185
  })) },
11184
- gasLimit: gasLimit || "0x3d0900"
11186
+ gasLimit: gasLimit || DEFAULT_GAS_LIMIT
11185
11187
  });
11186
- const response = result;
11187
11188
  const transactionHash = response.EASMultiAttest?.transactionHash;
11188
11189
  if (!transactionHash) {
11189
11190
  throw new Error("No transaction hash returned from Portal");
@@ -11227,9 +11228,8 @@ var EASClient = class {
11227
11228
  * ```
11228
11229
  */
11229
11230
  async revoke(schemaUID, attestationUID, fromAddress, value, gasLimit) {
11230
- const easAddress = this.getEASAddress();
11231
11231
  try {
11232
- const result = await this.portalClient.request(GraphQLOperations.mutations.revoke(this.portalGraphql), {
11232
+ const response = await this.portalClient.request(GraphQLOperations.mutations.revoke(this.portalGraphql), {
11233
11233
  address: this.getEASAddress(),
11234
11234
  from: fromAddress,
11235
11235
  input: { request: {
@@ -11239,9 +11239,8 @@ var EASClient = class {
11239
11239
  value: value?.toString() || "0"
11240
11240
  }
11241
11241
  } },
11242
- gasLimit: gasLimit || "0x3d0900"
11242
+ gasLimit: gasLimit || DEFAULT_GAS_LIMIT
11243
11243
  });
11244
- const response = result;
11245
11244
  const transactionHash = response.EASRevoke?.transactionHash;
11246
11245
  if (!transactionHash) {
11247
11246
  throw new Error("No transaction hash returned from Portal");