@settlemint/sdk-eas 2.3.5-pra3eb4e90 → 2.3.5-prb4784bd0
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 +132 -334
- package/dist/browser/eas.d.ts +53 -342
- package/dist/browser/eas.js +10319 -385
- package/dist/browser/eas.js.map +1 -1
- package/dist/eas.cjs +10321 -397
- package/dist/eas.cjs.map +1 -1
- package/dist/eas.d.cts +53 -342
- package/dist/eas.d.ts +53 -342
- package/dist/eas.js +10320 -385
- package/dist/eas.js.map +1 -1
- package/package.json +5 -4
package/dist/browser/eas.d.ts
CHANGED
|
@@ -1,15 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Address, Hex } from "viem";
|
|
1
|
+
import { z } from "zod/v4";
|
|
3
2
|
|
|
4
|
-
//#region src/
|
|
3
|
+
//#region src/client-options.schema.d.ts
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
5
|
+
* Schema for validating EAS client configuration options.
|
|
6
|
+
* Extends the base Viem client options with EAS-specific requirements.
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Schema for validating EAS client configuration options.
|
|
10
|
+
* Extends the base Viem client options with EAS-specific requirements.
|
|
11
|
+
*/
|
|
12
|
+
declare const ClientOptionsSchema: z.ZodObject<{
|
|
13
|
+
schemaRegistryAddress: z.ZodString;
|
|
14
|
+
attestationAddress: z.ZodString;
|
|
15
|
+
accessToken: z.ZodString;
|
|
16
|
+
chainId: z.ZodString;
|
|
17
|
+
chainName: z.ZodString;
|
|
18
|
+
rpcUrl: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
/**
|
|
21
|
+
* Configuration options for creating an EAS client.
|
|
22
|
+
* Combines EAS-specific options with base Viem client options.
|
|
10
23
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
24
|
+
type ClientOptions = z.infer<typeof ClientOptionsSchema>;
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/types.d.ts
|
|
13
28
|
/**
|
|
14
29
|
* Supported field types for EAS schema fields.
|
|
15
30
|
* Maps to the Solidity types that can be used in EAS schemas.
|
|
@@ -38,349 +53,45 @@ interface SchemaField {
|
|
|
38
53
|
description?: string;
|
|
39
54
|
}
|
|
40
55
|
/**
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
|
-
interface EASClientOptions {
|
|
44
|
-
/** Portal GraphQL endpoint URL */
|
|
45
|
-
instance: string;
|
|
46
|
-
/** Portal access token */
|
|
47
|
-
accessToken: string;
|
|
48
|
-
/** Optional EAS contract address (if already deployed) */
|
|
49
|
-
easContractAddress?: Address;
|
|
50
|
-
/** Optional Schema Registry contract address (if already deployed) */
|
|
51
|
-
schemaRegistryContractAddress?: Address;
|
|
52
|
-
/** Enable debug logging */
|
|
53
|
-
debug?: boolean;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Schema registration request
|
|
56
|
+
* Options for registering a new schema in the EAS Schema Registry.
|
|
57
57
|
*/
|
|
58
|
-
interface
|
|
59
|
-
/**
|
|
60
|
-
fields
|
|
61
|
-
/**
|
|
62
|
-
|
|
63
|
-
/** Resolver contract address (use ZERO_ADDRESS for no resolver) */
|
|
64
|
-
resolver: Address;
|
|
58
|
+
interface RegisterSchemaOptions {
|
|
59
|
+
/** Array of fields that make up the schema */
|
|
60
|
+
fields: SchemaField[];
|
|
61
|
+
/** Address of the resolver contract that will handle attestations */
|
|
62
|
+
resolverAddress: string;
|
|
65
63
|
/** Whether attestations using this schema can be revoked */
|
|
66
64
|
revocable: boolean;
|
|
67
65
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Attestation data structure
|
|
70
|
-
*/
|
|
71
|
-
interface AttestationData {
|
|
72
|
-
/** Recipient of the attestation */
|
|
73
|
-
recipient: Address;
|
|
74
|
-
/** Expiration time (0 for no expiration) */
|
|
75
|
-
expirationTime: bigint;
|
|
76
|
-
/** Whether this attestation can be revoked */
|
|
77
|
-
revocable: boolean;
|
|
78
|
-
/** Reference UID (use ZERO_BYTES32 for no reference) */
|
|
79
|
-
refUID: Hex;
|
|
80
|
-
/** Encoded attestation data */
|
|
81
|
-
data: Hex;
|
|
82
|
-
/** Value sent with the attestation */
|
|
83
|
-
value: bigint;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Attestation request
|
|
87
|
-
*/
|
|
88
|
-
interface AttestationRequest {
|
|
89
|
-
/** Schema UID to attest against */
|
|
90
|
-
schema: Hex;
|
|
91
|
-
/** Attestation data */
|
|
92
|
-
data: AttestationData;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Transaction result
|
|
96
|
-
*/
|
|
97
|
-
interface TransactionResult {
|
|
98
|
-
/** Transaction hash */
|
|
99
|
-
hash: Hex;
|
|
100
|
-
/** Whether the transaction was successful */
|
|
101
|
-
success: boolean;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Schema information
|
|
105
|
-
*/
|
|
106
|
-
interface SchemaData {
|
|
107
|
-
/** Schema UID */
|
|
108
|
-
uid: Hex;
|
|
109
|
-
/** Resolver contract address */
|
|
110
|
-
resolver: Address;
|
|
111
|
-
/** Whether attestations can be revoked */
|
|
112
|
-
revocable: boolean;
|
|
113
|
-
/** Schema string */
|
|
114
|
-
schema: string;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Attestation information
|
|
118
|
-
*/
|
|
119
|
-
interface AttestationInfo {
|
|
120
|
-
/** Attestation UID */
|
|
121
|
-
uid: Hex;
|
|
122
|
-
/** Schema UID */
|
|
123
|
-
schema: Hex;
|
|
124
|
-
/** Address that created the attestation */
|
|
125
|
-
attester: Address;
|
|
126
|
-
/** Recipient of the attestation */
|
|
127
|
-
recipient: Address;
|
|
128
|
-
/** Creation timestamp */
|
|
129
|
-
time: bigint;
|
|
130
|
-
/** Expiration timestamp */
|
|
131
|
-
expirationTime: bigint;
|
|
132
|
-
/** Whether this attestation can be revoked */
|
|
133
|
-
revocable: boolean;
|
|
134
|
-
/** Reference UID */
|
|
135
|
-
refUID: Hex;
|
|
136
|
-
/** Encoded attestation data */
|
|
137
|
-
data: Hex;
|
|
138
|
-
/** Value sent with the attestation */
|
|
139
|
-
value: bigint;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Options for retrieving schemas
|
|
143
|
-
*/
|
|
144
|
-
interface GetSchemasOptions {
|
|
145
|
-
/** Maximum number of schemas to return */
|
|
146
|
-
limit?: number;
|
|
147
|
-
/** Number of schemas to skip */
|
|
148
|
-
offset?: number;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Options for retrieving attestations
|
|
152
|
-
*/
|
|
153
|
-
interface GetAttestationsOptions {
|
|
154
|
-
/** Maximum number of attestations to return */
|
|
155
|
-
limit?: number;
|
|
156
|
-
/** Number of attestations to skip */
|
|
157
|
-
offset?: number;
|
|
158
|
-
/** Filter by schema UID */
|
|
159
|
-
schema?: Hex;
|
|
160
|
-
/** Filter by attester address */
|
|
161
|
-
attester?: Address;
|
|
162
|
-
/** Filter by recipient address */
|
|
163
|
-
recipient?: Address;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Contract deployment result
|
|
167
|
-
*/
|
|
168
|
-
interface DeploymentResult {
|
|
169
|
-
/** Deployed EAS contract address */
|
|
170
|
-
easAddress: Address;
|
|
171
|
-
/** Deployed Schema Registry contract address */
|
|
172
|
-
schemaRegistryAddress: Address;
|
|
173
|
-
/** EAS deployment transaction hash (when address not immediately available) */
|
|
174
|
-
easTransactionHash?: Hex;
|
|
175
|
-
/** Schema Registry deployment transaction hash (when address not immediately available) */
|
|
176
|
-
schemaRegistryTransactionHash?: Hex;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* @deprecated Use SchemaRequest instead
|
|
180
|
-
*/
|
|
181
|
-
interface RegisterSchemaOptions extends SchemaRequest {}
|
|
182
|
-
/**
|
|
183
|
-
* @internal
|
|
184
|
-
* Portal transaction response structure
|
|
185
|
-
*/
|
|
186
|
-
interface PortalTransactionResponse {
|
|
187
|
-
transactionHash?: string;
|
|
188
|
-
contractAddress?: string;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* @internal
|
|
192
|
-
* Portal schema response structure
|
|
193
|
-
*/
|
|
194
|
-
interface PortalSchemaResponse {
|
|
195
|
-
EASSchemaRegistry?: {
|
|
196
|
-
getSchema?: {
|
|
197
|
-
uid: string;
|
|
198
|
-
resolver: string;
|
|
199
|
-
revocable: boolean;
|
|
200
|
-
schema: string;
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* @internal
|
|
206
|
-
* Portal attestation response structure
|
|
207
|
-
*/
|
|
208
|
-
interface PortalAttestationResponse {
|
|
209
|
-
EAS?: {
|
|
210
|
-
getAttestation?: {
|
|
211
|
-
uid: string;
|
|
212
|
-
schema: string;
|
|
213
|
-
attester: string;
|
|
214
|
-
recipient: string;
|
|
215
|
-
time: string;
|
|
216
|
-
expirationTime: string;
|
|
217
|
-
revocable: boolean;
|
|
218
|
-
refUID: string;
|
|
219
|
-
data: string;
|
|
220
|
-
};
|
|
221
|
-
isAttestationValid?: boolean;
|
|
222
|
-
getTimestamp?: string;
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* @internal
|
|
227
|
-
* Portal contracts response structure
|
|
228
|
-
*/
|
|
229
|
-
interface PortalContractsResponse {
|
|
230
|
-
getContractsEasSchemaRegistry?: {
|
|
231
|
-
count: number;
|
|
232
|
-
records: Array<{
|
|
233
|
-
address: string;
|
|
234
|
-
abiName: string;
|
|
235
|
-
createdAt: string;
|
|
236
|
-
}>;
|
|
237
|
-
};
|
|
238
|
-
getContractsEas?: {
|
|
239
|
-
count: number;
|
|
240
|
-
records: Array<{
|
|
241
|
-
address: string;
|
|
242
|
-
abiName: string;
|
|
243
|
-
createdAt: string;
|
|
244
|
-
}>;
|
|
245
|
-
};
|
|
246
|
-
} //#endregion
|
|
247
|
-
//#region src/utils/validation.d.ts
|
|
248
|
-
declare function validateFieldName(name: string): void;
|
|
249
|
-
declare function validateFieldType(type: string): asserts type is EASFieldType;
|
|
250
|
-
declare function validateSchemaFields(fields: SchemaField[]): void;
|
|
251
|
-
declare function buildSchemaString(fields: SchemaField[]): string;
|
|
252
|
-
|
|
253
|
-
//#endregion
|
|
254
|
-
//#region src/graphql/operations.d.ts
|
|
255
|
-
declare const DEPLOY_SCHEMA_REGISTRY_MUTATION: string;
|
|
256
|
-
declare const DEPLOY_EAS_MUTATION: string;
|
|
257
|
-
declare const REGISTER_SCHEMA_MUTATION: string;
|
|
258
|
-
declare const ATTEST_MUTATION: string;
|
|
259
|
-
declare const MULTI_ATTEST_MUTATION: string;
|
|
260
|
-
declare const REVOKE_MUTATION: string;
|
|
261
|
-
declare const GET_SCHEMA_QUERY: string;
|
|
262
|
-
declare const GET_SCHEMAS_QUERY: string;
|
|
263
|
-
declare const GET_ATTESTATION_QUERY: string;
|
|
264
|
-
declare const IS_ATTESTATION_VALID_QUERY: string;
|
|
265
|
-
declare const GET_TIMESTAMP_QUERY: string;
|
|
266
|
-
declare const GET_ATTESTATIONS_QUERY: string;
|
|
267
|
-
/**
|
|
268
|
-
* All GraphQL operations organized by category
|
|
269
|
-
*/
|
|
270
|
-
declare const GraphQLOperations: {
|
|
271
|
-
readonly mutations: {
|
|
272
|
-
readonly deploySchemaRegistry: string;
|
|
273
|
-
readonly deployEAS: string;
|
|
274
|
-
readonly registerSchema: string;
|
|
275
|
-
readonly attest: string;
|
|
276
|
-
readonly multiAttest: string;
|
|
277
|
-
readonly revoke: string;
|
|
278
|
-
};
|
|
279
|
-
readonly queries: {
|
|
280
|
-
readonly getSchema: string;
|
|
281
|
-
readonly getSchemas: string;
|
|
282
|
-
readonly getAttestation: string;
|
|
283
|
-
readonly getAttestations: string;
|
|
284
|
-
readonly isAttestationValid: string;
|
|
285
|
-
readonly getTimestamp: string;
|
|
286
|
-
};
|
|
287
|
-
};
|
|
288
|
-
/**
|
|
289
|
-
* Type-safe access to GraphQL operations
|
|
290
|
-
*/
|
|
291
|
-
type GraphQLMutations = typeof GraphQLOperations.mutations;
|
|
292
|
-
type GraphQLQueries = typeof GraphQLOperations.queries;
|
|
293
66
|
|
|
294
67
|
//#endregion
|
|
295
68
|
//#region src/eas.d.ts
|
|
296
69
|
/**
|
|
297
|
-
*
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
* Revoke an attestation
|
|
322
|
-
*/
|
|
323
|
-
revoke(schemaUID: Hex, attestationUID: Hex, fromAddress: Address, value?: bigint, gasLimit?: string): Promise<TransactionResult>;
|
|
324
|
-
/**
|
|
325
|
-
* Get a schema by UID
|
|
326
|
-
*
|
|
327
|
-
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
328
|
-
*/
|
|
329
|
-
getSchema(uid: Hex): Promise<SchemaData>;
|
|
330
|
-
/**
|
|
331
|
-
* Get all schemas with pagination
|
|
332
|
-
*
|
|
333
|
-
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
334
|
-
*/
|
|
335
|
-
getSchemas(options?: GetSchemasOptions): Promise<SchemaData[]>;
|
|
336
|
-
/**
|
|
337
|
-
* Get an attestation by UID
|
|
338
|
-
*
|
|
339
|
-
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
340
|
-
*/
|
|
341
|
-
getAttestation(uid: Hex): Promise<AttestationInfo>;
|
|
342
|
-
/**
|
|
343
|
-
* Get attestations with pagination and filtering
|
|
344
|
-
*
|
|
345
|
-
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
346
|
-
*/
|
|
347
|
-
getAttestations(options?: GetAttestationsOptions): Promise<AttestationInfo[]>;
|
|
348
|
-
/**
|
|
349
|
-
* Check if an attestation is valid
|
|
350
|
-
*
|
|
351
|
-
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
352
|
-
*/
|
|
353
|
-
isValidAttestation(uid: Hex): Promise<boolean>;
|
|
354
|
-
/**
|
|
355
|
-
* Get the current timestamp from the contract
|
|
356
|
-
*
|
|
357
|
-
* TODO: Fix Portal GraphQL query parameter encoding or use The Graph subgraph
|
|
358
|
-
*/
|
|
359
|
-
getTimestamp(): Promise<bigint>;
|
|
360
|
-
/**
|
|
361
|
-
* Get client configuration
|
|
362
|
-
*/
|
|
363
|
-
getOptions(): EASClientOptions;
|
|
364
|
-
/**
|
|
365
|
-
* Get the Portal client instance for advanced operations
|
|
366
|
-
*/
|
|
367
|
-
getPortalClient(): ReturnType<typeof createPortalClient>["client"];
|
|
368
|
-
/**
|
|
369
|
-
* Get current contract addresses
|
|
370
|
-
*/
|
|
371
|
-
getContractAddresses(): {
|
|
372
|
-
easAddress?: Address;
|
|
373
|
-
schemaRegistryAddress?: Address;
|
|
374
|
-
};
|
|
375
|
-
private getEASAddress;
|
|
376
|
-
private getSchemaRegistryAddress;
|
|
377
|
-
private buildSchemaString;
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Create a new EAS client instance
|
|
381
|
-
*/
|
|
382
|
-
declare function createEASClient(options: EASClientOptions): EASClient;
|
|
70
|
+
* Creates an EAS client for interacting with the Ethereum Attestation Service.
|
|
71
|
+
*
|
|
72
|
+
* @param options - Configuration options for the client
|
|
73
|
+
* @returns An object containing the EAS client instance
|
|
74
|
+
* @throws Will throw an error if the options fail validation
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* import { createEASClient } from '@settlemint/sdk-eas';
|
|
79
|
+
*
|
|
80
|
+
* const client = createEASClient({
|
|
81
|
+
* schemaRegistryAddress: "0x1234567890123456789012345678901234567890",
|
|
82
|
+
* attestationAddress: "0x1234567890123456789012345678901234567890",
|
|
83
|
+
* accessToken: "your-access-token",
|
|
84
|
+
* chainId: "1",
|
|
85
|
+
* chainName: "Ethereum",
|
|
86
|
+
* rpcUrl: "http://localhost:8545"
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
declare function createEASClient(options: ClientOptions): {
|
|
91
|
+
registerSchema: (options: RegisterSchemaOptions) => Promise<string>;
|
|
92
|
+
getSchema: (uid: string) => Promise<string>;
|
|
93
|
+
};
|
|
383
94
|
|
|
384
95
|
//#endregion
|
|
385
|
-
export {
|
|
96
|
+
export { ClientOptions, ClientOptionsSchema, EASFieldType, EAS_FIELD_TYPES, RegisterSchemaOptions, SchemaField, createEASClient };
|
|
386
97
|
//# sourceMappingURL=eas.d.ts.map
|