@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/README.md +1072 -63
- package/dist/browser/eas.d.ts +7 -1
- package/dist/browser/eas.js +20 -21
- package/dist/browser/eas.js.map +1 -1
- package/dist/eas.cjs +19 -20
- package/dist/eas.cjs.map +1 -1
- package/dist/eas.d.cts +7 -1
- package/dist/eas.d.ts +7 -1
- package/dist/eas.js +20 -21
- 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
|
-
*
|
|
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/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, validate } from "@settlemint/sdk-utils/validation";
|
|
3
|
+
import { ApplicationAccessTokenSchema, UrlSchema, 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
|
-
*
|
|
10856
|
+
* Zod schema for EASClientOptions.
|
|
10857
10857
|
*/
|
|
10858
10858
|
const EASClientOptionsSchema = object({
|
|
10859
|
-
instance:
|
|
10859
|
+
instance: UrlSchema,
|
|
10860
10860
|
accessToken: ApplicationAccessTokenSchema.optional(),
|
|
10861
10861
|
easContractAddress: ethAddressSchema.optional(),
|
|
10862
10862
|
schemaRegistryContractAddress: ethAddressSchema.optional(),
|
|
@@ -10866,6 +10866,7 @@ const EASClientOptionsSchema = object({
|
|
|
10866
10866
|
//#endregion
|
|
10867
10867
|
//#region src/eas.ts
|
|
10868
10868
|
const LOGGER = createLogger();
|
|
10869
|
+
const DEFAULT_GAS_LIMIT = "0x3d0900";
|
|
10869
10870
|
/**
|
|
10870
10871
|
* Main EAS client class for interacting with Ethereum Attestation Service via Portal
|
|
10871
10872
|
*
|
|
@@ -10888,6 +10889,11 @@ var EASClient = class {
|
|
|
10888
10889
|
portalClient;
|
|
10889
10890
|
portalGraphql;
|
|
10890
10891
|
deployedAddresses;
|
|
10892
|
+
/**
|
|
10893
|
+
* Create a new EAS client instance
|
|
10894
|
+
*
|
|
10895
|
+
* @param options - Configuration options for the EAS client
|
|
10896
|
+
*/
|
|
10891
10897
|
constructor(options) {
|
|
10892
10898
|
this.options = validate(EASClientOptionsSchema, options);
|
|
10893
10899
|
const { client: portalClient, graphql: portalGraphql } = createPortalClient({
|
|
@@ -10928,12 +10934,11 @@ var EASClient = class {
|
|
|
10928
10934
|
const defaultForwarder = forwarderAddress || ZERO_ADDRESS;
|
|
10929
10935
|
const defaultGasLimit = gasLimit || "0x7a1200";
|
|
10930
10936
|
try {
|
|
10931
|
-
const
|
|
10937
|
+
const schemaRegistryResponse = await this.portalClient.request(GraphQLOperations.mutations.deploySchemaRegistry(this.portalGraphql), {
|
|
10932
10938
|
from: deployerAddress,
|
|
10933
10939
|
constructorArguments: { forwarder: defaultForwarder },
|
|
10934
10940
|
gasLimit: defaultGasLimit
|
|
10935
10941
|
});
|
|
10936
|
-
const schemaRegistryResponse = schemaRegistryResult;
|
|
10937
10942
|
if (!schemaRegistryResponse.DeployContractEASSchemaRegistry?.transactionHash) {
|
|
10938
10943
|
throw new Error("Schema Registry deployment failed - no transaction hash returned");
|
|
10939
10944
|
}
|
|
@@ -10955,11 +10960,10 @@ var EASClient = class {
|
|
|
10955
10960
|
},
|
|
10956
10961
|
gasLimit: defaultGasLimit
|
|
10957
10962
|
});
|
|
10958
|
-
|
|
10959
|
-
if (!easResult.DeployContractEAS?.transactionHash) {
|
|
10963
|
+
if (!easResponse.DeployContractEAS?.transactionHash) {
|
|
10960
10964
|
throw new Error("EAS deployment failed - no transaction hash returned");
|
|
10961
10965
|
}
|
|
10962
|
-
const easTxHash =
|
|
10966
|
+
const easTxHash = easResponse.DeployContractEAS.transactionHash;
|
|
10963
10967
|
const easTransaction = await waitForTransactionReceipt(easTxHash, {
|
|
10964
10968
|
portalGraphqlEndpoint: this.options.instance,
|
|
10965
10969
|
accessToken: this.options.accessToken,
|
|
@@ -11020,7 +11024,7 @@ var EASClient = class {
|
|
|
11020
11024
|
throw new Error("Schema string is required. Provide either 'schema' or 'fields'.");
|
|
11021
11025
|
}
|
|
11022
11026
|
try {
|
|
11023
|
-
const
|
|
11027
|
+
const response = await this.portalClient.request(GraphQLOperations.mutations.registerSchema(this.portalGraphql), {
|
|
11024
11028
|
address: schemaRegistryAddress,
|
|
11025
11029
|
from: fromAddress,
|
|
11026
11030
|
input: {
|
|
@@ -11028,9 +11032,8 @@ var EASClient = class {
|
|
|
11028
11032
|
resolver: request.resolver,
|
|
11029
11033
|
revocable: request.revocable
|
|
11030
11034
|
},
|
|
11031
|
-
gasLimit: gasLimit ||
|
|
11035
|
+
gasLimit: gasLimit || DEFAULT_GAS_LIMIT
|
|
11032
11036
|
});
|
|
11033
|
-
const response = result;
|
|
11034
11037
|
const transactionHash = response.EASSchemaRegistryRegister?.transactionHash;
|
|
11035
11038
|
if (!transactionHash) {
|
|
11036
11039
|
throw new Error("No transaction hash returned from Portal");
|
|
@@ -11082,7 +11085,7 @@ var EASClient = class {
|
|
|
11082
11085
|
async attest(request, fromAddress, gasLimit) {
|
|
11083
11086
|
const easAddress = this.getEASAddress();
|
|
11084
11087
|
try {
|
|
11085
|
-
const
|
|
11088
|
+
const response = await this.portalClient.request(GraphQLOperations.mutations.attest(this.portalGraphql), {
|
|
11086
11089
|
address: easAddress,
|
|
11087
11090
|
from: fromAddress,
|
|
11088
11091
|
input: { request: {
|
|
@@ -11096,9 +11099,8 @@ var EASClient = class {
|
|
|
11096
11099
|
value: request.data.value?.toString() || "0"
|
|
11097
11100
|
}
|
|
11098
11101
|
} },
|
|
11099
|
-
gasLimit: gasLimit ||
|
|
11102
|
+
gasLimit: gasLimit || DEFAULT_GAS_LIMIT
|
|
11100
11103
|
});
|
|
11101
|
-
const response = result;
|
|
11102
11104
|
const transactionHash = response.EASAttest?.transactionHash;
|
|
11103
11105
|
if (!transactionHash) {
|
|
11104
11106
|
throw new Error("No transaction hash returned from Portal");
|
|
@@ -11166,7 +11168,7 @@ var EASClient = class {
|
|
|
11166
11168
|
}
|
|
11167
11169
|
const easAddress = this.getEASAddress();
|
|
11168
11170
|
try {
|
|
11169
|
-
const
|
|
11171
|
+
const response = await this.portalClient.request(GraphQLOperations.mutations.multiAttest(this.portalGraphql), {
|
|
11170
11172
|
address: easAddress,
|
|
11171
11173
|
from: fromAddress,
|
|
11172
11174
|
input: { multiRequests: requests.map((req) => ({
|
|
@@ -11180,9 +11182,8 @@ var EASClient = class {
|
|
|
11180
11182
|
value: req.data.value?.toString() || "0"
|
|
11181
11183
|
}]
|
|
11182
11184
|
})) },
|
|
11183
|
-
gasLimit: gasLimit ||
|
|
11185
|
+
gasLimit: gasLimit || DEFAULT_GAS_LIMIT
|
|
11184
11186
|
});
|
|
11185
|
-
const response = result;
|
|
11186
11187
|
const transactionHash = response.EASMultiAttest?.transactionHash;
|
|
11187
11188
|
if (!transactionHash) {
|
|
11188
11189
|
throw new Error("No transaction hash returned from Portal");
|
|
@@ -11226,9 +11227,8 @@ var EASClient = class {
|
|
|
11226
11227
|
* ```
|
|
11227
11228
|
*/
|
|
11228
11229
|
async revoke(schemaUID, attestationUID, fromAddress, value, gasLimit) {
|
|
11229
|
-
const easAddress = this.getEASAddress();
|
|
11230
11230
|
try {
|
|
11231
|
-
const
|
|
11231
|
+
const response = await this.portalClient.request(GraphQLOperations.mutations.revoke(this.portalGraphql), {
|
|
11232
11232
|
address: this.getEASAddress(),
|
|
11233
11233
|
from: fromAddress,
|
|
11234
11234
|
input: { request: {
|
|
@@ -11238,9 +11238,8 @@ var EASClient = class {
|
|
|
11238
11238
|
value: value?.toString() || "0"
|
|
11239
11239
|
}
|
|
11240
11240
|
} },
|
|
11241
|
-
gasLimit: gasLimit ||
|
|
11241
|
+
gasLimit: gasLimit || DEFAULT_GAS_LIMIT
|
|
11242
11242
|
});
|
|
11243
|
-
const response = result;
|
|
11244
11243
|
const transactionHash = response.EASRevoke?.transactionHash;
|
|
11245
11244
|
if (!transactionHash) {
|
|
11246
11245
|
throw new Error("No transaction hash returned from Portal");
|