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