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