@settlemint/sdk-eas 2.3.14-main3ecc8697 → 2.3.14-main79ecef1f
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 +4327 -39
- package/dist/browser/eas.js +568 -167
- package/dist/browser/eas.js.map +1 -1
- package/dist/eas.cjs +570 -164
- package/dist/eas.cjs.map +1 -1
- package/dist/eas.d.cts +4327 -39
- package/dist/eas.d.ts +4327 -39
- package/dist/eas.js +568 -167
- package/dist/eas.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -27,23 +27,441 @@
|
|
|
27
27
|
## Table of Contents
|
|
28
28
|
|
|
29
29
|
- [About](#about)
|
|
30
|
+
- [Examples](#examples)
|
|
31
|
+
- [Simple eas workflow](#simple-eas-workflow)
|
|
30
32
|
- [API Reference](#api-reference)
|
|
31
33
|
- [Functions](#functions)
|
|
32
34
|
- [createEASClient()](#createeasclient)
|
|
35
|
+
- [Classes](#classes)
|
|
36
|
+
- [EASClient](#easclient)
|
|
33
37
|
- [Interfaces](#interfaces)
|
|
34
|
-
- [
|
|
38
|
+
- [AttestationData](#attestationdata)
|
|
39
|
+
- [AttestationInfo](#attestationinfo)
|
|
40
|
+
- [AttestationRequest](#attestationrequest)
|
|
41
|
+
- [DeploymentResult](#deploymentresult)
|
|
42
|
+
- [GetAttestationsOptions](#getattestationsoptions)
|
|
43
|
+
- [GetSchemasOptions](#getschemasoptions)
|
|
44
|
+
- [SchemaData](#schemadata)
|
|
35
45
|
- [SchemaField](#schemafield)
|
|
46
|
+
- [SchemaRequest](#schemarequest)
|
|
47
|
+
- [TransactionResult](#transactionresult)
|
|
36
48
|
- [Type Aliases](#type-aliases)
|
|
37
|
-
- [
|
|
49
|
+
- [EASClientOptions](#easclientoptions)
|
|
38
50
|
- [Variables](#variables)
|
|
39
|
-
- [ClientOptionsSchema](#clientoptionsschema)
|
|
40
51
|
- [EAS\_FIELD\_TYPES](#eas_field_types)
|
|
52
|
+
- [EASClientOptionsSchema](#easclientoptionsschema)
|
|
53
|
+
- [ZERO\_ADDRESS](#zero_address)
|
|
41
54
|
- [Contributing](#contributing)
|
|
42
55
|
- [License](#license)
|
|
43
56
|
|
|
44
57
|
## About
|
|
45
58
|
|
|
46
59
|
The SettleMint EAS SDK provides a lightweight wrapper for the Ethereum Attestation Service (EAS), enabling developers to easily create, manage, and verify attestations within their applications. It simplifies the process of working with EAS by handling contract interactions, schema management, and The Graph integration, while ensuring proper integration with the SettleMint platform. This allows developers to quickly implement document verification, identity attestation, and other EAS-based features without manual setup.
|
|
60
|
+
## Examples
|
|
61
|
+
|
|
62
|
+
### Simple eas workflow
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
/**
|
|
66
|
+
* Digital Notary EAS SDK Workflow Example
|
|
67
|
+
*
|
|
68
|
+
* Demonstrates a digital notary use case with EAS:
|
|
69
|
+
* 1. Initialize EAS client
|
|
70
|
+
* 2. Deploy EAS contracts
|
|
71
|
+
* 3. Register a digital notary schema
|
|
72
|
+
* 4. Create document attestations
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
import type { Address, Hex } from "viem";
|
|
76
|
+
import { decodeAbiParameters, encodeAbiParameters, parseAbiParameters } from "viem";
|
|
77
|
+
import { ZERO_ADDRESS, ZERO_BYTES32, createEASClient } from "../eas.ts"; // Replace this path with "@settlemint/sdk-eas";
|
|
78
|
+
|
|
79
|
+
const CONFIG = {
|
|
80
|
+
instance: process.env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT,
|
|
81
|
+
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
|
82
|
+
deployerAddress: process.env.SETTLEMINT_DEPLOYER_ADDRESS as Address | undefined,
|
|
83
|
+
debug: true,
|
|
84
|
+
|
|
85
|
+
// Configuration options for addresses and references
|
|
86
|
+
resolverAddress: ZERO_ADDRESS, // Use ZERO_ADDRESS for no resolver, or specify custom resolver
|
|
87
|
+
forwarderAddress: undefined, // Use undefined for ZERO_ADDRESS, or specify custom forwarder
|
|
88
|
+
referenceUID: ZERO_BYTES32, // Use ZERO_BYTES32 for no reference, or specify parent attestation
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Example addresses for demonstration
|
|
92
|
+
const EXAMPLE_DEPLOYER_ADDRESS = CONFIG.deployerAddress;
|
|
93
|
+
const EXAMPLE_FROM_ADDRESS = CONFIG.deployerAddress;
|
|
94
|
+
|
|
95
|
+
// Schema definition with proper typing
|
|
96
|
+
interface UserReputationSchema {
|
|
97
|
+
user: Address;
|
|
98
|
+
score: bigint;
|
|
99
|
+
category: string;
|
|
100
|
+
timestamp: bigint;
|
|
101
|
+
verified: boolean;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface DigitalNotarySchema {
|
|
105
|
+
documentHash: string;
|
|
106
|
+
notaryAddress: Address;
|
|
107
|
+
signerAddress: Address;
|
|
108
|
+
notarizationTimestamp: bigint;
|
|
109
|
+
documentType: string;
|
|
110
|
+
witnessCount: bigint;
|
|
111
|
+
isVerified: boolean;
|
|
112
|
+
ipfsHash: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async function runEASWorkflow() {
|
|
116
|
+
if (!CONFIG.instance || !CONFIG.accessToken || !EXAMPLE_DEPLOYER_ADDRESS || !EXAMPLE_FROM_ADDRESS) {
|
|
117
|
+
console.error(
|
|
118
|
+
"Missing environment variables. Please set SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT, SETTLEMINT_ACCESS_TOKEN, and SETTLEMINT_DEPLOYER_ADDRESS.",
|
|
119
|
+
);
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
console.log("🚀 Simple EAS SDK Workflow");
|
|
124
|
+
console.log("===========================\n");
|
|
125
|
+
|
|
126
|
+
let deployedAddresses: { easAddress: Address; schemaRegistryAddress: Address };
|
|
127
|
+
|
|
128
|
+
// Step 1: Initialize EAS Client
|
|
129
|
+
console.log("📋 Step 1: Initialize EAS Client");
|
|
130
|
+
const client = createEASClient({
|
|
131
|
+
instance: CONFIG.instance,
|
|
132
|
+
accessToken: CONFIG.accessToken,
|
|
133
|
+
debug: CONFIG.debug,
|
|
134
|
+
});
|
|
135
|
+
console.log("✅ EAS client initialized\n");
|
|
136
|
+
|
|
137
|
+
// Step 2: Deploy EAS Contracts (if needed)
|
|
138
|
+
console.log("🏗️ Step 2: Deploy EAS Contracts");
|
|
139
|
+
try {
|
|
140
|
+
const deployment = await client.deploy(
|
|
141
|
+
EXAMPLE_DEPLOYER_ADDRESS,
|
|
142
|
+
CONFIG.forwarderAddress, // Will use ZERO_ADDRESS if undefined
|
|
143
|
+
);
|
|
144
|
+
console.log("✅ Contracts deployed:");
|
|
145
|
+
console.log(` EAS: ${deployment.easAddress}`);
|
|
146
|
+
console.log(` Schema Registry: ${deployment.schemaRegistryAddress}\n`);
|
|
147
|
+
|
|
148
|
+
deployedAddresses = {
|
|
149
|
+
easAddress: deployment.easAddress,
|
|
150
|
+
schemaRegistryAddress: deployment.schemaRegistryAddress,
|
|
151
|
+
};
|
|
152
|
+
} catch (err) {
|
|
153
|
+
const error = err as Error;
|
|
154
|
+
console.log(`❌ Deployment failed: ${error.message}`);
|
|
155
|
+
|
|
156
|
+
const addresses = client.getContractAddresses();
|
|
157
|
+
console.log("ℹ️ Using existing contracts:");
|
|
158
|
+
console.log(` EAS: ${addresses.easAddress || "Not set"}`);
|
|
159
|
+
console.log(` Schema Registry: ${addresses.schemaRegistryAddress || "Not set"}`);
|
|
160
|
+
console.log("✅ Contracts ready\n");
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Step 3: Register Schema
|
|
164
|
+
console.log("📝 Step 3: Register Schema");
|
|
165
|
+
try {
|
|
166
|
+
const schemaResult = await client.registerSchema(
|
|
167
|
+
{
|
|
168
|
+
fields: [
|
|
169
|
+
{ name: "user", type: "address", description: "User's wallet address" },
|
|
170
|
+
{ name: "score", type: "uint256", description: "Reputation score (0-100)" },
|
|
171
|
+
{ name: "category", type: "string", description: "Reputation category" },
|
|
172
|
+
{ name: "timestamp", type: "uint256", description: "When reputation was earned" },
|
|
173
|
+
{ name: "verified", type: "bool", description: "Whether reputation is verified" },
|
|
174
|
+
],
|
|
175
|
+
resolver: CONFIG.resolverAddress,
|
|
176
|
+
revocable: true,
|
|
177
|
+
},
|
|
178
|
+
EXAMPLE_FROM_ADDRESS,
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
console.log("✅ Schema registered successfully");
|
|
182
|
+
console.log(` Schema UID: ${schemaResult.hash}`);
|
|
183
|
+
console.log(
|
|
184
|
+
` Resolver: ${CONFIG.resolverAddress} (${CONFIG.resolverAddress === ZERO_ADDRESS ? "none" : "custom"})\n`,
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
// Step 4: Create Attestations
|
|
188
|
+
console.log("🎯 Step 4: Create Attestations");
|
|
189
|
+
try {
|
|
190
|
+
const attestationResult = await client.attest(
|
|
191
|
+
{
|
|
192
|
+
schema: schemaResult.hash,
|
|
193
|
+
data: {
|
|
194
|
+
recipient: EXAMPLE_FROM_ADDRESS,
|
|
195
|
+
expirationTime: BigInt(0),
|
|
196
|
+
revocable: true,
|
|
197
|
+
refUID: CONFIG.referenceUID,
|
|
198
|
+
data: "0x",
|
|
199
|
+
value: BigInt(0),
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
EXAMPLE_FROM_ADDRESS,
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
console.log("✅ Attestation created successfully");
|
|
206
|
+
console.log(` Attestation transaction hash: ${attestationResult.hash}`);
|
|
207
|
+
console.log(
|
|
208
|
+
` Reference: ${CONFIG.referenceUID} (${CONFIG.referenceUID === ZERO_BYTES32 ? "standalone" : "linked"})`,
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
const multiAttestResult = await client.multiAttest(
|
|
212
|
+
[
|
|
213
|
+
{
|
|
214
|
+
schema: schemaResult.hash,
|
|
215
|
+
data: {
|
|
216
|
+
recipient: EXAMPLE_FROM_ADDRESS,
|
|
217
|
+
expirationTime: BigInt(0),
|
|
218
|
+
revocable: true,
|
|
219
|
+
refUID: CONFIG.referenceUID,
|
|
220
|
+
data: "0x",
|
|
221
|
+
value: BigInt(0),
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
EXAMPLE_FROM_ADDRESS,
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
console.log("✅ Multi-attestation created successfully");
|
|
229
|
+
console.log(` Transaction hash: ${multiAttestResult.hash}\n`);
|
|
230
|
+
} catch (error) {
|
|
231
|
+
console.log("⚠️ Attestation creation failed:", error);
|
|
232
|
+
}
|
|
233
|
+
} catch (error) {
|
|
234
|
+
console.log("⚠️ Schema registration failed:", error);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/*
|
|
238
|
+
The following steps for retrieving schemas and attestations are commented out
|
|
239
|
+
because the underlying SDK functions are not yet fully implemented and depend on
|
|
240
|
+
a configured The Graph subgraph, which is not available in this example.
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
// // Step 5: Retrieve Schema
|
|
244
|
+
// console.log("📖 Step 5: Retrieve Schema");
|
|
245
|
+
// try {
|
|
246
|
+
// const schema = await client.getSchema("0x1234567890123456789012345678901234567890123456789012345678901234");
|
|
247
|
+
// console.log("✅ Schema retrieved successfully");
|
|
248
|
+
// console.log(` UID: ${schema.uid}`);
|
|
249
|
+
// console.log(` Resolver: ${schema.resolver}`);
|
|
250
|
+
// console.log(` Revocable: ${schema.revocable}`);
|
|
251
|
+
// console.log(` Schema: ${schema.schema}\n`);
|
|
252
|
+
// } catch (error) {
|
|
253
|
+
// console.log("⚠️ Schema retrieval failed (Portal access required)");
|
|
254
|
+
// console.log(" Would retrieve schema: 0x1234567890123456789012345678901234567890123456789012345678901234\n");
|
|
255
|
+
// }
|
|
256
|
+
|
|
257
|
+
// // Step 6: Retrieve All Schemas
|
|
258
|
+
// console.log("📚 Step 6: Retrieve All Schemas");
|
|
259
|
+
// try {
|
|
260
|
+
// const schemas = await client.getSchemas({ limit: 10 });
|
|
261
|
+
// console.log("✅ Schemas retrieved successfully");
|
|
262
|
+
// console.log(` Found ${schemas.length} schemas`);
|
|
263
|
+
// schemas.forEach((schema, index) => {
|
|
264
|
+
// console.log(` ${index + 1}. ${schema.uid} - ${schema.schema}`);
|
|
265
|
+
// });
|
|
266
|
+
// console.log();
|
|
267
|
+
// } catch (error) {
|
|
268
|
+
// console.log("⚠️ Schemas retrieval failed (Portal access required)");
|
|
269
|
+
// console.log(" Would retrieve paginated schemas\n");
|
|
270
|
+
// }
|
|
271
|
+
|
|
272
|
+
// // Step 7: Retrieve Attestations
|
|
273
|
+
// console.log("📋 Step 7: Retrieve Attestations");
|
|
274
|
+
// try {
|
|
275
|
+
// const attestation1 = await client.getAttestation(
|
|
276
|
+
// "0xabcd567890123456789012345678901234567890123456789012345678901234",
|
|
277
|
+
// );
|
|
278
|
+
// console.log("✅ Attestation retrieved successfully");
|
|
279
|
+
// console.log(` UID: ${attestation1.uid}`);
|
|
280
|
+
// console.log(` Attester: ${attestation1.attester}`);
|
|
281
|
+
// console.log(` Recipient: ${attestation1.recipient}`);
|
|
282
|
+
// console.log(` Schema: ${attestation1.schema}\n`);
|
|
283
|
+
// } catch (error) {
|
|
284
|
+
// console.log("⚠️ Attestation retrieval failed (Portal access required)");
|
|
285
|
+
// console.log(
|
|
286
|
+
// " Would retrieve attestations: 0xabcd567890123456789012345678901234567890123456789012345678901234, 0xefgh567890123456789012345678901234567890123456789012345678901234\n",
|
|
287
|
+
// );
|
|
288
|
+
// }
|
|
289
|
+
|
|
290
|
+
// // Step 8: Retrieve All Attestations
|
|
291
|
+
// console.log("📋 Step 8: Retrieve All Attestations");
|
|
292
|
+
// try {
|
|
293
|
+
// const attestations = await client.getAttestations({
|
|
294
|
+
// limit: 10,
|
|
295
|
+
// schema: "0x1234567890123456789012345678901234567890123456789012345678901234",
|
|
296
|
+
// });
|
|
297
|
+
// console.log("✅ Attestations retrieved successfully");
|
|
298
|
+
// console.log(` Found ${attestations.length} attestations`);
|
|
299
|
+
// attestations.forEach((attestation, index) => {
|
|
300
|
+
// console.log(` ${index + 1}. ${attestation.uid} by ${attestation.attester}`);
|
|
301
|
+
// });
|
|
302
|
+
// console.log();
|
|
303
|
+
// } catch (error) {
|
|
304
|
+
// console.log("⚠️ Attestations retrieval failed (Portal access required)");
|
|
305
|
+
// console.log(" Would retrieve paginated attestations\n");
|
|
306
|
+
// }
|
|
307
|
+
|
|
308
|
+
// Final Summary
|
|
309
|
+
console.log("🎉 Workflow Complete!");
|
|
310
|
+
console.log("=====================");
|
|
311
|
+
console.log("✅ EAS client initialized");
|
|
312
|
+
console.log("✅ Contract deployment ready");
|
|
313
|
+
console.log("✅ Schema registration ready");
|
|
314
|
+
console.log("✅ Attestation creation ready");
|
|
315
|
+
console.log("✅ Schema retrieval ready");
|
|
316
|
+
console.log("✅ Attestation retrieval ready");
|
|
317
|
+
|
|
318
|
+
console.log("\n💡 Production ready!");
|
|
319
|
+
console.log("- All EAS operations implemented");
|
|
320
|
+
console.log("- Full Portal GraphQL integration");
|
|
321
|
+
console.log("- Comprehensive error handling");
|
|
322
|
+
console.log("- Type-safe TypeScript API");
|
|
323
|
+
console.log("- No hardcoded values - fully configurable");
|
|
324
|
+
|
|
325
|
+
console.log("\n🔑 To use with real Portal:");
|
|
326
|
+
console.log("- Obtain valid EAS Portal access token");
|
|
327
|
+
console.log("- Provide deployer and transaction sender addresses");
|
|
328
|
+
console.log("- Deploy or configure contract addresses");
|
|
329
|
+
console.log("- Start creating attestations!");
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export const DigitalNotarySchemaHelpers = {
|
|
333
|
+
/**
|
|
334
|
+
* Encodes DigitalNotarySchema data using ABI encoding.
|
|
335
|
+
* @param data - The digital notary data to encode
|
|
336
|
+
* @returns The ABI-encoded data as a hex string
|
|
337
|
+
* @example
|
|
338
|
+
* ```ts
|
|
339
|
+
* import { DigitalNotarySchemaHelpers } from './simple-eas-workflow';
|
|
340
|
+
* import { getAddress } from 'viem';
|
|
341
|
+
*
|
|
342
|
+
* const encoded = DigitalNotarySchemaHelpers.encodeData({
|
|
343
|
+
* documentHash: "0xa1b2c3d4e5f67890123456789012345678901234567890123456789012345678",
|
|
344
|
+
* notaryAddress: getAddress("0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6"),
|
|
345
|
+
* signerAddress: getAddress("0x1234567890123456789012345678901234567890"),
|
|
346
|
+
* notarizationTimestamp: BigInt(Math.floor(Date.now() / 1000)),
|
|
347
|
+
* documentType: "purchase_agreement",
|
|
348
|
+
* witnessCount: BigInt(2),
|
|
349
|
+
* isVerified: true,
|
|
350
|
+
* ipfsHash: "QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG",
|
|
351
|
+
* });
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
encodeData(data: DigitalNotarySchema): Hex {
|
|
355
|
+
return encodeAbiParameters(
|
|
356
|
+
parseAbiParameters(
|
|
357
|
+
"string documentHash, address notaryAddress, address signerAddress, uint256 notarizationTimestamp, string documentType, uint256 witnessCount, bool isVerified, string ipfsHash",
|
|
358
|
+
),
|
|
359
|
+
[
|
|
360
|
+
data.documentHash,
|
|
361
|
+
data.notaryAddress,
|
|
362
|
+
data.signerAddress,
|
|
363
|
+
data.notarizationTimestamp,
|
|
364
|
+
data.documentType,
|
|
365
|
+
data.witnessCount,
|
|
366
|
+
data.isVerified,
|
|
367
|
+
data.ipfsHash,
|
|
368
|
+
],
|
|
369
|
+
);
|
|
370
|
+
},
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Decodes ABI-encoded data back to DigitalNotarySchema format.
|
|
374
|
+
* @param encodedData - The ABI-encoded hex data to decode
|
|
375
|
+
* @returns The decoded digital notary data
|
|
376
|
+
* @example
|
|
377
|
+
* ```ts
|
|
378
|
+
* import { DigitalNotarySchemaHelpers } from './simple-eas-workflow';
|
|
379
|
+
*
|
|
380
|
+
* const decoded = DigitalNotarySchemaHelpers.decodeData("0x...");
|
|
381
|
+
* console.log(decoded.documentHash, decoded.notaryAddress, decoded.documentType);
|
|
382
|
+
* ```
|
|
383
|
+
*/
|
|
384
|
+
decodeData(encodedData: Hex): DigitalNotarySchema {
|
|
385
|
+
const [
|
|
386
|
+
documentHash,
|
|
387
|
+
notaryAddress,
|
|
388
|
+
signerAddress,
|
|
389
|
+
notarizationTimestamp,
|
|
390
|
+
documentType,
|
|
391
|
+
witnessCount,
|
|
392
|
+
isVerified,
|
|
393
|
+
ipfsHash,
|
|
394
|
+
] = decodeAbiParameters(
|
|
395
|
+
parseAbiParameters(
|
|
396
|
+
"string documentHash, address notaryAddress, address signerAddress, uint256 notarizationTimestamp, string documentType, uint256 witnessCount, bool isVerified, string ipfsHash",
|
|
397
|
+
),
|
|
398
|
+
encodedData,
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
return {
|
|
402
|
+
documentHash: documentHash as string,
|
|
403
|
+
notaryAddress: notaryAddress as Address,
|
|
404
|
+
signerAddress: signerAddress as Address,
|
|
405
|
+
notarizationTimestamp: notarizationTimestamp as bigint,
|
|
406
|
+
documentType: documentType as string,
|
|
407
|
+
witnessCount: witnessCount as bigint,
|
|
408
|
+
isVerified: isVerified as boolean,
|
|
409
|
+
ipfsHash: ipfsHash as string,
|
|
410
|
+
};
|
|
411
|
+
},
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Validates that a document hash follows the expected format.
|
|
415
|
+
* @param documentHash - The document hash to validate
|
|
416
|
+
* @returns Whether the hash is valid
|
|
417
|
+
*/
|
|
418
|
+
validateDocumentHash(documentHash: string): boolean {
|
|
419
|
+
return /^0x[a-fA-F0-9]{64}$/.test(documentHash);
|
|
420
|
+
},
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Validates that witness count is within reasonable bounds.
|
|
424
|
+
* @param witnessCount - The number of witnesses
|
|
425
|
+
* @returns Whether the witness count is valid
|
|
426
|
+
*/
|
|
427
|
+
validateWitnessCount(witnessCount: bigint): boolean {
|
|
428
|
+
return witnessCount >= BigInt(0) && witnessCount <= BigInt(10);
|
|
429
|
+
},
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Gets the supported document types for notarization.
|
|
433
|
+
* @returns Array of supported document types
|
|
434
|
+
*/
|
|
435
|
+
getDocumentTypes(): readonly string[] {
|
|
436
|
+
return [
|
|
437
|
+
"purchase_agreement",
|
|
438
|
+
"last_will_testament",
|
|
439
|
+
"power_of_attorney",
|
|
440
|
+
"real_estate_deed",
|
|
441
|
+
"business_contract",
|
|
442
|
+
"loan_agreement",
|
|
443
|
+
"affidavit",
|
|
444
|
+
"other",
|
|
445
|
+
] as const;
|
|
446
|
+
},
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Validates that the IPFS hash follows the expected format.
|
|
450
|
+
* @param ipfsHash - The IPFS hash to validate
|
|
451
|
+
* @returns Whether the IPFS hash is valid
|
|
452
|
+
*/
|
|
453
|
+
validateIpfsHash(ipfsHash: string): boolean {
|
|
454
|
+
return /^Qm[1-9A-HJ-NP-Za-km-z]{44}$/.test(ipfsHash);
|
|
455
|
+
},
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
if (typeof require !== "undefined" && require.main === module) {
|
|
459
|
+
runEASWorkflow().catch(console.error);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export { runEASWorkflow, type UserReputationSchema };
|
|
463
|
+
|
|
464
|
+
```
|
|
47
465
|
|
|
48
466
|
## API Reference
|
|
49
467
|
|
|
@@ -51,75 +469,626 @@ The SettleMint EAS SDK provides a lightweight wrapper for the Ethereum Attestati
|
|
|
51
469
|
|
|
52
470
|
#### createEASClient()
|
|
53
471
|
|
|
54
|
-
> **createEASClient**(`options`): `
|
|
472
|
+
> **createEASClient**(`options`): [`EASClient`](#easclient)
|
|
55
473
|
|
|
56
|
-
Defined in: [sdk/eas/src/eas.ts:
|
|
474
|
+
Defined in: [sdk/eas/src/eas.ts:632](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L632)
|
|
57
475
|
|
|
58
|
-
|
|
476
|
+
Create an EAS client instance
|
|
59
477
|
|
|
60
478
|
##### Parameters
|
|
61
479
|
|
|
62
480
|
| Parameter | Type | Description |
|
|
63
481
|
| ------ | ------ | ------ |
|
|
64
|
-
| `options` | \{ `accessToken
|
|
65
|
-
| `options.accessToken
|
|
66
|
-
| `options.
|
|
67
|
-
| `options.
|
|
68
|
-
| `options.
|
|
69
|
-
| `options.
|
|
70
|
-
| `options.schemaRegistryAddress` | `string` | The address of the EAS Schema Registry contract |
|
|
482
|
+
| `options` | \{ `accessToken?`: `string`; `debug?`: `boolean`; `easContractAddress?`: `` `0x${string}` ``; `instance`: `string`; `schemaRegistryContractAddress?`: `` `0x${string}` ``; \} | Configuration options for the EAS client |
|
|
483
|
+
| `options.accessToken?` | `string` | The application access token |
|
|
484
|
+
| `options.debug?` | `boolean` | Whether to enable debug mode |
|
|
485
|
+
| `options.easContractAddress?` | `` `0x${string}` `` | The EAS contract address |
|
|
486
|
+
| `options.instance` | `string` | The EAS instance URL |
|
|
487
|
+
| `options.schemaRegistryContractAddress?` | `` `0x${string}` `` | The schema registry contract address |
|
|
71
488
|
|
|
72
489
|
##### Returns
|
|
73
490
|
|
|
74
|
-
`
|
|
491
|
+
[`EASClient`](#easclient)
|
|
492
|
+
|
|
493
|
+
EAS client instance
|
|
494
|
+
|
|
495
|
+
##### Example
|
|
496
|
+
|
|
497
|
+
```typescript
|
|
498
|
+
import { createEASClient } from "@settlemint/sdk-eas";
|
|
499
|
+
|
|
500
|
+
const easClient = createEASClient({
|
|
501
|
+
instance: "https://your-portal-instance.settlemint.com",
|
|
502
|
+
accessToken: "your-access-token"
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
// Use the client
|
|
506
|
+
const deployment = await easClient.deploy("0x1234...deployer-address");
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
### Classes
|
|
510
|
+
|
|
511
|
+
#### EASClient
|
|
512
|
+
|
|
513
|
+
Defined in: [sdk/eas/src/eas.ts:44](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L44)
|
|
514
|
+
|
|
515
|
+
Main EAS client class for interacting with Ethereum Attestation Service via Portal
|
|
516
|
+
|
|
517
|
+
##### Example
|
|
518
|
+
|
|
519
|
+
```typescript
|
|
520
|
+
import { createEASClient } from "@settlemint/sdk-eas";
|
|
521
|
+
|
|
522
|
+
const easClient = createEASClient({
|
|
523
|
+
instance: "https://your-portal-instance.settlemint.com",
|
|
524
|
+
accessToken: "your-access-token"
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
// Deploy EAS contracts
|
|
528
|
+
const deployment = await easClient.deploy("0x1234...deployer-address");
|
|
529
|
+
console.log("EAS deployed at:", deployment.easAddress);
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
##### Constructors
|
|
533
|
+
|
|
534
|
+
###### Constructor
|
|
535
|
+
|
|
536
|
+
> **new EASClient**(`options`): [`EASClient`](#easclient)
|
|
537
|
+
|
|
538
|
+
Defined in: [sdk/eas/src/eas.ts:55](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L55)
|
|
539
|
+
|
|
540
|
+
Create a new EAS client instance
|
|
541
|
+
|
|
542
|
+
###### Parameters
|
|
543
|
+
|
|
544
|
+
| Parameter | Type | Description |
|
|
545
|
+
| ------ | ------ | ------ |
|
|
546
|
+
| `options` | \{ `accessToken?`: `string`; `debug?`: `boolean`; `easContractAddress?`: `` `0x${string}` ``; `instance`: `string`; `schemaRegistryContractAddress?`: `` `0x${string}` ``; \} | Configuration options for the EAS client |
|
|
547
|
+
| `options.accessToken?` | `string` | The application access token |
|
|
548
|
+
| `options.debug?` | `boolean` | Whether to enable debug mode |
|
|
549
|
+
| `options.easContractAddress?` | `` `0x${string}` `` | The EAS contract address |
|
|
550
|
+
| `options.instance` | `string` | The EAS instance URL |
|
|
551
|
+
| `options.schemaRegistryContractAddress?` | `` `0x${string}` `` | The schema registry contract address |
|
|
552
|
+
|
|
553
|
+
###### Returns
|
|
554
|
+
|
|
555
|
+
[`EASClient`](#easclient)
|
|
556
|
+
|
|
557
|
+
##### Methods
|
|
558
|
+
|
|
559
|
+
###### attest()
|
|
560
|
+
|
|
561
|
+
> **attest**(`request`, `fromAddress`, `gasLimit?`): `Promise`\<[`TransactionResult`](#transactionresult)\>
|
|
562
|
+
|
|
563
|
+
Defined in: [sdk/eas/src/eas.ts:295](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L295)
|
|
564
|
+
|
|
565
|
+
Create an attestation
|
|
566
|
+
|
|
567
|
+
###### Parameters
|
|
568
|
+
|
|
569
|
+
| Parameter | Type | Description |
|
|
570
|
+
| ------ | ------ | ------ |
|
|
571
|
+
| `request` | [`AttestationRequest`](#attestationrequest) | Attestation request containing schema and data |
|
|
572
|
+
| `fromAddress` | `` `0x${string}` `` | Address that will create the attestation |
|
|
573
|
+
| `gasLimit?` | `string` | Optional gas limit for the transaction (defaults to "0x3d0900") |
|
|
75
574
|
|
|
76
|
-
|
|
575
|
+
###### Returns
|
|
576
|
+
|
|
577
|
+
`Promise`\<[`TransactionResult`](#transactionresult)\>
|
|
578
|
+
|
|
579
|
+
Promise resolving to transaction result
|
|
580
|
+
|
|
581
|
+
###### Example
|
|
582
|
+
|
|
583
|
+
```typescript
|
|
584
|
+
import { createEASClient } from "@settlemint/sdk-eas";
|
|
585
|
+
|
|
586
|
+
const easClient = createEASClient({
|
|
587
|
+
instance: "https://your-portal-instance.settlemint.com",
|
|
588
|
+
accessToken: "your-access-token"
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
const attestationResult = await easClient.attest(
|
|
592
|
+
{
|
|
593
|
+
schema: "0x1234567890123456789012345678901234567890123456789012345678901234",
|
|
594
|
+
data: {
|
|
595
|
+
recipient: "0x1234567890123456789012345678901234567890",
|
|
596
|
+
expirationTime: BigInt(0), // No expiration
|
|
597
|
+
revocable: true,
|
|
598
|
+
refUID: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
599
|
+
data: "0x1234", // ABI-encoded data
|
|
600
|
+
value: BigInt(0)
|
|
601
|
+
}
|
|
602
|
+
},
|
|
603
|
+
"0x1234567890123456789012345678901234567890" // from address
|
|
604
|
+
);
|
|
605
|
+
|
|
606
|
+
console.log("Attestation created:", attestationResult.hash);
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
###### deploy()
|
|
610
|
+
|
|
611
|
+
> **deploy**(`deployerAddress`, `forwarderAddress?`, `gasLimit?`): `Promise`\<[`DeploymentResult`](#deploymentresult)\>
|
|
612
|
+
|
|
613
|
+
Defined in: [sdk/eas/src/eas.ts:106](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L106)
|
|
614
|
+
|
|
615
|
+
Deploy EAS contracts via Portal
|
|
616
|
+
|
|
617
|
+
###### Parameters
|
|
618
|
+
|
|
619
|
+
| Parameter | Type | Description |
|
|
620
|
+
| ------ | ------ | ------ |
|
|
621
|
+
| `deployerAddress` | `` `0x${string}` `` | The address that will deploy the contracts |
|
|
622
|
+
| `forwarderAddress?` | `` `0x${string}` `` | Optional trusted forwarder address (defaults to zero address) |
|
|
623
|
+
| `gasLimit?` | `string` | Optional gas limit for deployment transactions (defaults to "0x7a1200") |
|
|
624
|
+
|
|
625
|
+
###### Returns
|
|
626
|
+
|
|
627
|
+
`Promise`\<[`DeploymentResult`](#deploymentresult)\>
|
|
628
|
+
|
|
629
|
+
Promise resolving to deployment result with contract addresses and transaction hashes
|
|
630
|
+
|
|
631
|
+
###### Example
|
|
632
|
+
|
|
633
|
+
```typescript
|
|
634
|
+
import { createEASClient } from "@settlemint/sdk-eas";
|
|
635
|
+
|
|
636
|
+
const easClient = createEASClient({
|
|
637
|
+
instance: "https://your-portal-instance.settlemint.com",
|
|
638
|
+
accessToken: "your-access-token"
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
const deployment = await easClient.deploy(
|
|
642
|
+
"0x1234567890123456789012345678901234567890", // deployer address
|
|
643
|
+
"0x0000000000000000000000000000000000000000", // forwarder (optional)
|
|
644
|
+
"0x7a1200" // gas limit (optional)
|
|
645
|
+
);
|
|
646
|
+
|
|
647
|
+
console.log("Schema Registry:", deployment.schemaRegistryAddress);
|
|
648
|
+
console.log("EAS Contract:", deployment.easAddress);
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
###### getAttestation()
|
|
652
|
+
|
|
653
|
+
> **getAttestation**(`uid`): `Promise`\<[`AttestationInfo`](#attestationinfo)\>
|
|
654
|
+
|
|
655
|
+
Defined in: [sdk/eas/src/eas.ts:528](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L528)
|
|
656
|
+
|
|
657
|
+
Get an attestation by UID
|
|
658
|
+
|
|
659
|
+
TODO: Implement using The Graph subgraph for EAS data queries
|
|
660
|
+
|
|
661
|
+
###### Parameters
|
|
662
|
+
|
|
663
|
+
| Parameter | Type |
|
|
664
|
+
| ------ | ------ |
|
|
665
|
+
| `uid` | `` `0x${string}` `` |
|
|
666
|
+
|
|
667
|
+
###### Returns
|
|
668
|
+
|
|
669
|
+
`Promise`\<[`AttestationInfo`](#attestationinfo)\>
|
|
670
|
+
|
|
671
|
+
###### getAttestations()
|
|
672
|
+
|
|
673
|
+
> **getAttestations**(`options?`): `Promise`\<[`AttestationInfo`](#attestationinfo)[]\>
|
|
674
|
+
|
|
675
|
+
Defined in: [sdk/eas/src/eas.ts:539](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L539)
|
|
676
|
+
|
|
677
|
+
Get attestations with pagination and filtering
|
|
678
|
+
|
|
679
|
+
TODO: Implement using The Graph subgraph for EAS data queries
|
|
680
|
+
|
|
681
|
+
###### Parameters
|
|
682
|
+
|
|
683
|
+
| Parameter | Type |
|
|
684
|
+
| ------ | ------ |
|
|
685
|
+
| `options?` | [`GetAttestationsOptions`](#getattestationsoptions) |
|
|
686
|
+
|
|
687
|
+
###### Returns
|
|
688
|
+
|
|
689
|
+
`Promise`\<[`AttestationInfo`](#attestationinfo)[]\>
|
|
690
|
+
|
|
691
|
+
###### getContractAddresses()
|
|
692
|
+
|
|
693
|
+
> **getContractAddresses**(): `object`
|
|
694
|
+
|
|
695
|
+
Defined in: [sdk/eas/src/eas.ts:578](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L578)
|
|
696
|
+
|
|
697
|
+
Get current contract addresses
|
|
698
|
+
|
|
699
|
+
###### Returns
|
|
700
|
+
|
|
701
|
+
`object`
|
|
77
702
|
|
|
78
703
|
| Name | Type | Defined in |
|
|
79
704
|
| ------ | ------ | ------ |
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
705
|
+
| `easAddress?` | `` `0x${string}` `` | [sdk/eas/src/eas.ts:578](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L578) |
|
|
706
|
+
| `schemaRegistryAddress?` | `` `0x${string}` `` | [sdk/eas/src/eas.ts:578](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L578) |
|
|
82
707
|
|
|
83
|
-
|
|
708
|
+
###### getOptions()
|
|
84
709
|
|
|
85
|
-
|
|
710
|
+
> **getOptions**(): `object`
|
|
86
711
|
|
|
87
|
-
|
|
712
|
+
Defined in: [sdk/eas/src/eas.ts:564](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L564)
|
|
88
713
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
714
|
+
Get client configuration
|
|
715
|
+
|
|
716
|
+
###### Returns
|
|
717
|
+
|
|
718
|
+
| Name | Type | Default value | Description | Defined in |
|
|
719
|
+
| ------ | ------ | ------ | ------ | ------ |
|
|
720
|
+
| `accessToken?` | `string` | - | The application access token | [sdk/eas/src/utils/validation.ts:21](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/utils/validation.ts#L21) |
|
|
721
|
+
| `debug?` | `boolean` | - | Whether to enable debug mode | [sdk/eas/src/utils/validation.ts:33](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/utils/validation.ts#L33) |
|
|
722
|
+
| `easContractAddress?` | `` `0x${string}` `` | - | The EAS contract address | [sdk/eas/src/utils/validation.ts:25](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/utils/validation.ts#L25) |
|
|
723
|
+
| `instance` | `string` | `UrlSchema` | The EAS instance URL | [sdk/eas/src/utils/validation.ts:17](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/utils/validation.ts#L17) |
|
|
724
|
+
| `schemaRegistryContractAddress?` | `` `0x${string}` `` | - | The schema registry contract address | [sdk/eas/src/utils/validation.ts:29](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/utils/validation.ts#L29) |
|
|
725
|
+
|
|
726
|
+
###### getPortalClient()
|
|
727
|
+
|
|
728
|
+
> **getPortalClient**(): `GraphQLClient`
|
|
729
|
+
|
|
730
|
+
Defined in: [sdk/eas/src/eas.ts:571](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L571)
|
|
731
|
+
|
|
732
|
+
Get the Portal client instance for advanced operations
|
|
733
|
+
|
|
734
|
+
###### Returns
|
|
735
|
+
|
|
736
|
+
`GraphQLClient`
|
|
737
|
+
|
|
738
|
+
###### getSchema()
|
|
739
|
+
|
|
740
|
+
> **getSchema**(`uid`): `Promise`\<[`SchemaData`](#schemadata)\>
|
|
741
|
+
|
|
742
|
+
Defined in: [sdk/eas/src/eas.ts:508](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L508)
|
|
743
|
+
|
|
744
|
+
Get a schema by UID
|
|
745
|
+
|
|
746
|
+
TODO: Implement using The Graph subgraph for EAS data queries
|
|
747
|
+
|
|
748
|
+
###### Parameters
|
|
749
|
+
|
|
750
|
+
| Parameter | Type |
|
|
751
|
+
| ------ | ------ |
|
|
752
|
+
| `uid` | `` `0x${string}` `` |
|
|
753
|
+
|
|
754
|
+
###### Returns
|
|
755
|
+
|
|
756
|
+
`Promise`\<[`SchemaData`](#schemadata)\>
|
|
757
|
+
|
|
758
|
+
###### getSchemas()
|
|
759
|
+
|
|
760
|
+
> **getSchemas**(`options?`): `Promise`\<[`SchemaData`](#schemadata)[]\>
|
|
761
|
+
|
|
762
|
+
Defined in: [sdk/eas/src/eas.ts:519](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L519)
|
|
763
|
+
|
|
764
|
+
Get all schemas with pagination
|
|
765
|
+
|
|
766
|
+
TODO: Implement using The Graph subgraph for EAS data queries
|
|
767
|
+
|
|
768
|
+
###### Parameters
|
|
769
|
+
|
|
770
|
+
| Parameter | Type |
|
|
771
|
+
| ------ | ------ |
|
|
772
|
+
| `options?` | [`GetSchemasOptions`](#getschemasoptions) |
|
|
773
|
+
|
|
774
|
+
###### Returns
|
|
775
|
+
|
|
776
|
+
`Promise`\<[`SchemaData`](#schemadata)[]\>
|
|
777
|
+
|
|
778
|
+
###### getTimestamp()
|
|
779
|
+
|
|
780
|
+
> **getTimestamp**(): `Promise`\<`bigint`\>
|
|
781
|
+
|
|
782
|
+
Defined in: [sdk/eas/src/eas.ts:557](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L557)
|
|
783
|
+
|
|
784
|
+
Get the current timestamp from the contract
|
|
785
|
+
|
|
786
|
+
TODO: Fix Portal GraphQL query parameter encoding or use The Graph subgraph
|
|
787
|
+
|
|
788
|
+
###### Returns
|
|
789
|
+
|
|
790
|
+
`Promise`\<`bigint`\>
|
|
791
|
+
|
|
792
|
+
###### isValidAttestation()
|
|
793
|
+
|
|
794
|
+
> **isValidAttestation**(`uid`): `Promise`\<`boolean`\>
|
|
795
|
+
|
|
796
|
+
Defined in: [sdk/eas/src/eas.ts:548](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L548)
|
|
797
|
+
|
|
798
|
+
Check if an attestation is valid
|
|
799
|
+
|
|
800
|
+
TODO: Implement using The Graph subgraph for EAS data queries
|
|
801
|
+
|
|
802
|
+
###### Parameters
|
|
803
|
+
|
|
804
|
+
| Parameter | Type |
|
|
805
|
+
| ------ | ------ |
|
|
806
|
+
| `uid` | `` `0x${string}` `` |
|
|
807
|
+
|
|
808
|
+
###### Returns
|
|
809
|
+
|
|
810
|
+
`Promise`\<`boolean`\>
|
|
811
|
+
|
|
812
|
+
###### multiAttest()
|
|
813
|
+
|
|
814
|
+
> **multiAttest**(`requests`, `fromAddress`, `gasLimit?`): `Promise`\<[`TransactionResult`](#transactionresult)\>
|
|
815
|
+
|
|
816
|
+
Defined in: [sdk/eas/src/eas.ts:386](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L386)
|
|
817
|
+
|
|
818
|
+
Create multiple attestations in a single transaction
|
|
819
|
+
|
|
820
|
+
###### Parameters
|
|
821
|
+
|
|
822
|
+
| Parameter | Type | Description |
|
|
823
|
+
| ------ | ------ | ------ |
|
|
824
|
+
| `requests` | [`AttestationRequest`](#attestationrequest)[] | Array of attestation requests |
|
|
825
|
+
| `fromAddress` | `` `0x${string}` `` | Address that will create the attestations |
|
|
826
|
+
| `gasLimit?` | `string` | Optional gas limit for the transaction (defaults to "0x3d0900") |
|
|
827
|
+
|
|
828
|
+
###### Returns
|
|
829
|
+
|
|
830
|
+
`Promise`\<[`TransactionResult`](#transactionresult)\>
|
|
831
|
+
|
|
832
|
+
Promise resolving to transaction result
|
|
833
|
+
|
|
834
|
+
###### Example
|
|
835
|
+
|
|
836
|
+
```typescript
|
|
837
|
+
import { createEASClient } from "@settlemint/sdk-eas";
|
|
838
|
+
|
|
839
|
+
const easClient = createEASClient({
|
|
840
|
+
instance: "https://your-portal-instance.settlemint.com",
|
|
841
|
+
accessToken: "your-access-token"
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
const multiAttestResult = await easClient.multiAttest(
|
|
845
|
+
[
|
|
846
|
+
{
|
|
847
|
+
schema: "0x1234567890123456789012345678901234567890123456789012345678901234",
|
|
848
|
+
data: {
|
|
849
|
+
recipient: "0x1234567890123456789012345678901234567890",
|
|
850
|
+
expirationTime: BigInt(0),
|
|
851
|
+
revocable: true,
|
|
852
|
+
refUID: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
853
|
+
data: "0x1234",
|
|
854
|
+
value: BigInt(0)
|
|
855
|
+
}
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
schema: "0x5678901234567890123456789012345678901234567890123456789012345678",
|
|
859
|
+
data: {
|
|
860
|
+
recipient: "0x5678901234567890123456789012345678901234",
|
|
861
|
+
expirationTime: BigInt(0),
|
|
862
|
+
revocable: false,
|
|
863
|
+
refUID: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
864
|
+
data: "0x5678",
|
|
865
|
+
value: BigInt(0)
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
],
|
|
869
|
+
"0x1234567890123456789012345678901234567890" // from address
|
|
870
|
+
);
|
|
871
|
+
|
|
872
|
+
console.log("Multiple attestations created:", multiAttestResult.hash);
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
###### registerSchema()
|
|
876
|
+
|
|
877
|
+
> **registerSchema**(`request`, `fromAddress`, `gasLimit?`): `Promise`\<[`TransactionResult`](#transactionresult)\>
|
|
878
|
+
|
|
879
|
+
Defined in: [sdk/eas/src/eas.ts:216](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L216)
|
|
880
|
+
|
|
881
|
+
Register a new schema in the EAS Schema Registry
|
|
882
|
+
|
|
883
|
+
###### Parameters
|
|
884
|
+
|
|
885
|
+
| Parameter | Type | Description |
|
|
886
|
+
| ------ | ------ | ------ |
|
|
887
|
+
| `request` | [`SchemaRequest`](#schemarequest) | Schema registration request containing schema definition |
|
|
888
|
+
| `fromAddress` | `` `0x${string}` `` | Address that will register the schema |
|
|
889
|
+
| `gasLimit?` | `string` | Optional gas limit for the transaction (defaults to "0x3d0900") |
|
|
890
|
+
|
|
891
|
+
###### Returns
|
|
892
|
+
|
|
893
|
+
`Promise`\<[`TransactionResult`](#transactionresult)\>
|
|
894
|
+
|
|
895
|
+
Promise resolving to transaction result
|
|
896
|
+
|
|
897
|
+
###### Example
|
|
898
|
+
|
|
899
|
+
```typescript
|
|
900
|
+
import { createEASClient } from "@settlemint/sdk-eas";
|
|
901
|
+
|
|
902
|
+
const easClient = createEASClient({
|
|
903
|
+
instance: "https://your-portal-instance.settlemint.com",
|
|
904
|
+
accessToken: "your-access-token"
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
const schemaResult = await easClient.registerSchema(
|
|
908
|
+
{
|
|
909
|
+
schema: "uint256 eventId, uint8 voteIndex",
|
|
910
|
+
resolver: "0x0000000000000000000000000000000000000000",
|
|
911
|
+
revocable: true
|
|
912
|
+
},
|
|
913
|
+
"0x1234567890123456789012345678901234567890" // from address
|
|
914
|
+
);
|
|
915
|
+
|
|
916
|
+
console.log("Schema registered:", schemaResult.hash);
|
|
917
|
+
```
|
|
918
|
+
|
|
919
|
+
###### revoke()
|
|
920
|
+
|
|
921
|
+
> **revoke**(`schemaUID`, `attestationUID`, `fromAddress`, `value?`, `gasLimit?`): `Promise`\<[`TransactionResult`](#transactionresult)\>
|
|
922
|
+
|
|
923
|
+
Defined in: [sdk/eas/src/eas.ts:464](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/eas.ts#L464)
|
|
924
|
+
|
|
925
|
+
Revoke an existing attestation
|
|
926
|
+
|
|
927
|
+
###### Parameters
|
|
928
|
+
|
|
929
|
+
| Parameter | Type | Description |
|
|
930
|
+
| ------ | ------ | ------ |
|
|
931
|
+
| `schemaUID` | `` `0x${string}` `` | UID of the schema used for the attestation |
|
|
932
|
+
| `attestationUID` | `` `0x${string}` `` | UID of the attestation to revoke |
|
|
933
|
+
| `fromAddress` | `` `0x${string}` `` | Address that will revoke the attestation |
|
|
934
|
+
| `value?` | `bigint` | Optional ETH value to send with the revocation |
|
|
935
|
+
| `gasLimit?` | `string` | Optional gas limit for the transaction (defaults to "0x3d0900") |
|
|
936
|
+
|
|
937
|
+
###### Returns
|
|
938
|
+
|
|
939
|
+
`Promise`\<[`TransactionResult`](#transactionresult)\>
|
|
940
|
+
|
|
941
|
+
Promise resolving to transaction result
|
|
942
|
+
|
|
943
|
+
###### Example
|
|
944
|
+
|
|
945
|
+
```typescript
|
|
946
|
+
import { createEASClient } from "@settlemint/sdk-eas";
|
|
947
|
+
|
|
948
|
+
const easClient = createEASClient({
|
|
949
|
+
instance: "https://your-portal-instance.settlemint.com",
|
|
950
|
+
accessToken: "your-access-token"
|
|
99
951
|
});
|
|
952
|
+
|
|
953
|
+
const revokeResult = await easClient.revoke(
|
|
954
|
+
"0x1234567890123456789012345678901234567890123456789012345678901234", // schema UID
|
|
955
|
+
"0x5678901234567890123456789012345678901234567890123456789012345678", // attestation UID
|
|
956
|
+
"0x1234567890123456789012345678901234567890", // from address
|
|
957
|
+
BigInt(0) // value (optional)
|
|
958
|
+
);
|
|
959
|
+
|
|
960
|
+
console.log("Attestation revoked:", revokeResult.hash);
|
|
100
961
|
```
|
|
101
962
|
|
|
102
963
|
### Interfaces
|
|
103
964
|
|
|
104
|
-
####
|
|
965
|
+
#### AttestationData
|
|
966
|
+
|
|
967
|
+
Defined in: [sdk/eas/src/schema.ts:63](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L63)
|
|
968
|
+
|
|
969
|
+
Attestation data structure
|
|
970
|
+
|
|
971
|
+
##### Properties
|
|
972
|
+
|
|
973
|
+
| Property | Type | Description | Defined in |
|
|
974
|
+
| ------ | ------ | ------ | ------ |
|
|
975
|
+
| <a id="data"></a> `data` | `` `0x${string}` `` | Encoded attestation data | [sdk/eas/src/schema.ts:73](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L73) |
|
|
976
|
+
| <a id="expirationtime"></a> `expirationTime` | `bigint` | Expiration time (0 for no expiration) | [sdk/eas/src/schema.ts:67](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L67) |
|
|
977
|
+
| <a id="recipient"></a> `recipient` | `` `0x${string}` `` | Recipient of the attestation | [sdk/eas/src/schema.ts:65](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L65) |
|
|
978
|
+
| <a id="refuid"></a> `refUID` | `` `0x${string}` `` | Reference UID (use ZERO_BYTES32 for no reference) | [sdk/eas/src/schema.ts:71](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L71) |
|
|
979
|
+
| <a id="revocable"></a> `revocable` | `boolean` | Whether this attestation can be revoked | [sdk/eas/src/schema.ts:69](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L69) |
|
|
980
|
+
| <a id="value"></a> `value` | `bigint` | Value sent with the attestation | [sdk/eas/src/schema.ts:75](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L75) |
|
|
981
|
+
|
|
982
|
+
***
|
|
983
|
+
|
|
984
|
+
#### AttestationInfo
|
|
985
|
+
|
|
986
|
+
Defined in: [sdk/eas/src/schema.ts:115](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L115)
|
|
987
|
+
|
|
988
|
+
Attestation information
|
|
105
989
|
|
|
106
|
-
|
|
990
|
+
##### Properties
|
|
991
|
+
|
|
992
|
+
| Property | Type | Description | Defined in |
|
|
993
|
+
| ------ | ------ | ------ | ------ |
|
|
994
|
+
| <a id="attester"></a> `attester` | `` `0x${string}` `` | Address that created the attestation | [sdk/eas/src/schema.ts:121](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L121) |
|
|
995
|
+
| <a id="data-1"></a> `data` | `` `0x${string}` `` | Encoded attestation data | [sdk/eas/src/schema.ts:133](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L133) |
|
|
996
|
+
| <a id="expirationtime-1"></a> `expirationTime` | `bigint` | Expiration timestamp | [sdk/eas/src/schema.ts:127](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L127) |
|
|
997
|
+
| <a id="recipient-1"></a> `recipient` | `` `0x${string}` `` | Recipient of the attestation | [sdk/eas/src/schema.ts:123](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L123) |
|
|
998
|
+
| <a id="refuid-1"></a> `refUID` | `` `0x${string}` `` | Reference UID | [sdk/eas/src/schema.ts:131](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L131) |
|
|
999
|
+
| <a id="revocable-1"></a> `revocable` | `boolean` | Whether this attestation can be revoked | [sdk/eas/src/schema.ts:129](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L129) |
|
|
1000
|
+
| <a id="schema"></a> `schema` | `` `0x${string}` `` | Schema UID | [sdk/eas/src/schema.ts:119](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L119) |
|
|
1001
|
+
| <a id="time"></a> `time` | `bigint` | Creation timestamp | [sdk/eas/src/schema.ts:125](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L125) |
|
|
1002
|
+
| <a id="uid"></a> `uid` | `` `0x${string}` `` | Attestation UID | [sdk/eas/src/schema.ts:117](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L117) |
|
|
1003
|
+
| <a id="value-1"></a> `value` | `bigint` | Value sent with the attestation | [sdk/eas/src/schema.ts:135](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L135) |
|
|
1004
|
+
|
|
1005
|
+
***
|
|
1006
|
+
|
|
1007
|
+
#### AttestationRequest
|
|
1008
|
+
|
|
1009
|
+
Defined in: [sdk/eas/src/schema.ts:81](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L81)
|
|
1010
|
+
|
|
1011
|
+
Attestation request
|
|
1012
|
+
|
|
1013
|
+
##### Properties
|
|
1014
|
+
|
|
1015
|
+
| Property | Type | Description | Defined in |
|
|
1016
|
+
| ------ | ------ | ------ | ------ |
|
|
1017
|
+
| <a id="data-2"></a> `data` | [`AttestationData`](#attestationdata) | Attestation data | [sdk/eas/src/schema.ts:85](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L85) |
|
|
1018
|
+
| <a id="schema-1"></a> `schema` | `` `0x${string}` `` | Schema UID to attest against | [sdk/eas/src/schema.ts:83](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L83) |
|
|
1019
|
+
|
|
1020
|
+
***
|
|
1021
|
+
|
|
1022
|
+
#### DeploymentResult
|
|
1023
|
+
|
|
1024
|
+
Defined in: [sdk/eas/src/schema.ts:167](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L167)
|
|
1025
|
+
|
|
1026
|
+
Contract deployment result
|
|
1027
|
+
|
|
1028
|
+
##### Properties
|
|
1029
|
+
|
|
1030
|
+
| Property | Type | Description | Defined in |
|
|
1031
|
+
| ------ | ------ | ------ | ------ |
|
|
1032
|
+
| <a id="easaddress"></a> `easAddress` | `` `0x${string}` `` | Deployed EAS contract address | [sdk/eas/src/schema.ts:169](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L169) |
|
|
1033
|
+
| <a id="eastransactionhash"></a> `easTransactionHash?` | `` `0x${string}` `` | EAS deployment transaction hash (when address not immediately available) | [sdk/eas/src/schema.ts:173](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L173) |
|
|
1034
|
+
| <a id="schemaregistryaddress"></a> `schemaRegistryAddress` | `` `0x${string}` `` | Deployed Schema Registry contract address | [sdk/eas/src/schema.ts:171](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L171) |
|
|
1035
|
+
| <a id="schemaregistrytransactionhash"></a> `schemaRegistryTransactionHash?` | `` `0x${string}` `` | Schema Registry deployment transaction hash (when address not immediately available) | [sdk/eas/src/schema.ts:175](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L175) |
|
|
1036
|
+
|
|
1037
|
+
***
|
|
1038
|
+
|
|
1039
|
+
#### GetAttestationsOptions
|
|
1040
|
+
|
|
1041
|
+
Defined in: [sdk/eas/src/schema.ts:151](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L151)
|
|
1042
|
+
|
|
1043
|
+
Options for retrieving attestations
|
|
1044
|
+
|
|
1045
|
+
##### Properties
|
|
1046
|
+
|
|
1047
|
+
| Property | Type | Description | Defined in |
|
|
1048
|
+
| ------ | ------ | ------ | ------ |
|
|
1049
|
+
| <a id="attester-1"></a> `attester?` | `` `0x${string}` `` | Filter by attester address | [sdk/eas/src/schema.ts:159](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L159) |
|
|
1050
|
+
| <a id="limit"></a> `limit?` | `number` | Maximum number of attestations to return | [sdk/eas/src/schema.ts:153](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L153) |
|
|
1051
|
+
| <a id="offset"></a> `offset?` | `number` | Number of attestations to skip | [sdk/eas/src/schema.ts:155](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L155) |
|
|
1052
|
+
| <a id="recipient-2"></a> `recipient?` | `` `0x${string}` `` | Filter by recipient address | [sdk/eas/src/schema.ts:161](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L161) |
|
|
1053
|
+
| <a id="schema-2"></a> `schema?` | `` `0x${string}` `` | Filter by schema UID | [sdk/eas/src/schema.ts:157](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L157) |
|
|
1054
|
+
|
|
1055
|
+
***
|
|
1056
|
+
|
|
1057
|
+
#### GetSchemasOptions
|
|
1058
|
+
|
|
1059
|
+
Defined in: [sdk/eas/src/schema.ts:141](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L141)
|
|
1060
|
+
|
|
1061
|
+
Options for retrieving schemas
|
|
1062
|
+
|
|
1063
|
+
##### Properties
|
|
1064
|
+
|
|
1065
|
+
| Property | Type | Description | Defined in |
|
|
1066
|
+
| ------ | ------ | ------ | ------ |
|
|
1067
|
+
| <a id="limit-1"></a> `limit?` | `number` | Maximum number of schemas to return | [sdk/eas/src/schema.ts:143](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L143) |
|
|
1068
|
+
| <a id="offset-1"></a> `offset?` | `number` | Number of schemas to skip | [sdk/eas/src/schema.ts:145](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L145) |
|
|
1069
|
+
|
|
1070
|
+
***
|
|
1071
|
+
|
|
1072
|
+
#### SchemaData
|
|
1073
|
+
|
|
1074
|
+
Defined in: [sdk/eas/src/schema.ts:101](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L101)
|
|
107
1075
|
|
|
108
|
-
|
|
1076
|
+
Schema information
|
|
109
1077
|
|
|
110
1078
|
##### Properties
|
|
111
1079
|
|
|
112
1080
|
| Property | Type | Description | Defined in |
|
|
113
1081
|
| ------ | ------ | ------ | ------ |
|
|
114
|
-
| <a id="
|
|
115
|
-
| <a id="
|
|
116
|
-
| <a id="
|
|
1082
|
+
| <a id="resolver"></a> `resolver` | `` `0x${string}` `` | Resolver contract address | [sdk/eas/src/schema.ts:105](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L105) |
|
|
1083
|
+
| <a id="revocable-2"></a> `revocable` | `boolean` | Whether attestations can be revoked | [sdk/eas/src/schema.ts:107](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L107) |
|
|
1084
|
+
| <a id="schema-3"></a> `schema` | `string` | Schema string | [sdk/eas/src/schema.ts:109](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L109) |
|
|
1085
|
+
| <a id="uid-1"></a> `uid` | `` `0x${string}` `` | Schema UID | [sdk/eas/src/schema.ts:103](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L103) |
|
|
117
1086
|
|
|
118
1087
|
***
|
|
119
1088
|
|
|
120
1089
|
#### SchemaField
|
|
121
1090
|
|
|
122
|
-
Defined in: [sdk/eas/src/
|
|
1091
|
+
Defined in: [sdk/eas/src/schema.ts:32](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L32)
|
|
123
1092
|
|
|
124
1093
|
Represents a single field in an EAS schema.
|
|
125
1094
|
|
|
@@ -127,39 +1096,59 @@ Represents a single field in an EAS schema.
|
|
|
127
1096
|
|
|
128
1097
|
| Property | Type | Description | Defined in |
|
|
129
1098
|
| ------ | ------ | ------ | ------ |
|
|
130
|
-
| <a id="description"></a> `description?` | `string` | Optional description of the field's purpose | [sdk/eas/src/
|
|
131
|
-
| <a id="name"></a> `name` | `string` | The name of the field | [sdk/eas/src/
|
|
132
|
-
| <a id="type"></a> `type` | `"string"` \| `"address"` \| `"bool"` \| `"bytes"` \| `"bytes32"` \| `"
|
|
1099
|
+
| <a id="description"></a> `description?` | `string` | Optional description of the field's purpose | [sdk/eas/src/schema.ts:38](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L38) |
|
|
1100
|
+
| <a id="name"></a> `name` | `string` | The name of the field | [sdk/eas/src/schema.ts:34](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L34) |
|
|
1101
|
+
| <a id="type"></a> `type` | `"string"` \| `"address"` \| `"bool"` \| `"bytes"` \| `"bytes32"` \| `"uint256"` \| `"int256"` \| `"uint8"` \| `"int8"` | The Solidity type of the field | [sdk/eas/src/schema.ts:36](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L36) |
|
|
133
1102
|
|
|
134
|
-
|
|
1103
|
+
***
|
|
135
1104
|
|
|
136
|
-
####
|
|
1105
|
+
#### SchemaRequest
|
|
137
1106
|
|
|
138
|
-
|
|
1107
|
+
Defined in: [sdk/eas/src/schema.ts:49](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L49)
|
|
139
1108
|
|
|
140
|
-
|
|
1109
|
+
Schema registration request
|
|
141
1110
|
|
|
142
|
-
|
|
143
|
-
Combines EAS-specific options with base Viem client options.
|
|
1111
|
+
##### Properties
|
|
144
1112
|
|
|
145
|
-
|
|
1113
|
+
| Property | Type | Description | Defined in |
|
|
1114
|
+
| ------ | ------ | ------ | ------ |
|
|
1115
|
+
| <a id="fields"></a> `fields?` | [`SchemaField`](#schemafield)[] | Schema fields (alternative to schema string) | [sdk/eas/src/schema.ts:51](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L51) |
|
|
1116
|
+
| <a id="resolver-1"></a> `resolver` | `` `0x${string}` `` | Resolver contract address (use ZERO_ADDRESS for no resolver) | [sdk/eas/src/schema.ts:55](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L55) |
|
|
1117
|
+
| <a id="revocable-3"></a> `revocable` | `boolean` | Whether attestations using this schema can be revoked | [sdk/eas/src/schema.ts:57](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L57) |
|
|
1118
|
+
| <a id="schema-4"></a> `schema?` | `string` | Raw schema string (alternative to fields) | [sdk/eas/src/schema.ts:53](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L53) |
|
|
1119
|
+
|
|
1120
|
+
***
|
|
146
1121
|
|
|
147
|
-
####
|
|
1122
|
+
#### TransactionResult
|
|
148
1123
|
|
|
149
|
-
|
|
1124
|
+
Defined in: [sdk/eas/src/schema.ts:91](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L91)
|
|
150
1125
|
|
|
151
|
-
|
|
1126
|
+
Transaction result
|
|
152
1127
|
|
|
153
|
-
|
|
154
|
-
Extends the base Viem client options with EAS-specific requirements.
|
|
1128
|
+
##### Properties
|
|
155
1129
|
|
|
156
|
-
|
|
1130
|
+
| Property | Type | Description | Defined in |
|
|
1131
|
+
| ------ | ------ | ------ | ------ |
|
|
1132
|
+
| <a id="hash"></a> `hash` | `` `0x${string}` `` | Transaction hash | [sdk/eas/src/schema.ts:93](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L93) |
|
|
1133
|
+
| <a id="success"></a> `success` | `boolean` | Whether the transaction was successful | [sdk/eas/src/schema.ts:95](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L95) |
|
|
1134
|
+
|
|
1135
|
+
### Type Aliases
|
|
1136
|
+
|
|
1137
|
+
#### EASClientOptions
|
|
1138
|
+
|
|
1139
|
+
> **EASClientOptions** = `z.infer`\<*typeof* [`EASClientOptionsSchema`](#easclientoptionsschema)\>
|
|
1140
|
+
|
|
1141
|
+
Defined in: [sdk/eas/src/schema.ts:44](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L44)
|
|
1142
|
+
|
|
1143
|
+
Configuration options for the EAS client
|
|
1144
|
+
|
|
1145
|
+
### Variables
|
|
157
1146
|
|
|
158
1147
|
#### EAS\_FIELD\_TYPES
|
|
159
1148
|
|
|
160
1149
|
> `const` **EAS\_FIELD\_TYPES**: `object`
|
|
161
1150
|
|
|
162
|
-
Defined in: [sdk/eas/src/
|
|
1151
|
+
Defined in: [sdk/eas/src/schema.ts:15](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L15)
|
|
163
1152
|
|
|
164
1153
|
Supported field types for EAS schema fields.
|
|
165
1154
|
Maps to the Solidity types that can be used in EAS schemas.
|
|
@@ -168,15 +1157,35 @@ Maps to the Solidity types that can be used in EAS schemas.
|
|
|
168
1157
|
|
|
169
1158
|
| Name | Type | Default value | Defined in |
|
|
170
1159
|
| ------ | ------ | ------ | ------ |
|
|
171
|
-
| <a id="address"></a> `address` | `"address"` | `"address"` | [sdk/eas/src/
|
|
172
|
-
| <a id="bool"></a> `bool` | `"bool"` | `"bool"` | [sdk/eas/src/
|
|
173
|
-
| <a id="bytes"></a> `bytes` | `"bytes"` | `"bytes"` | [sdk/eas/src/
|
|
174
|
-
| <a id="bytes32"></a> `bytes32` | `"bytes32"` | `"bytes32"` | [sdk/eas/src/
|
|
175
|
-
| <a id="int256"></a> `int256` | `"int256"` | `"int256"` | [sdk/eas/src/
|
|
176
|
-
| <a id="int8"></a> `int8` | `"int8"` | `"int8"` | [sdk/eas/src/
|
|
177
|
-
| <a id="string"></a> `string` | `"string"` | `"string"` | [sdk/eas/src/
|
|
178
|
-
| <a id="uint256"></a> `uint256` | `"uint256"` | `"uint256"` | [sdk/eas/src/
|
|
179
|
-
| <a id="uint8"></a> `uint8` | `"uint8"` | `"uint8"` | [sdk/eas/src/
|
|
1160
|
+
| <a id="address"></a> `address` | `"address"` | `"address"` | [sdk/eas/src/schema.ts:17](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L17) |
|
|
1161
|
+
| <a id="bool"></a> `bool` | `"bool"` | `"bool"` | [sdk/eas/src/schema.ts:18](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L18) |
|
|
1162
|
+
| <a id="bytes"></a> `bytes` | `"bytes"` | `"bytes"` | [sdk/eas/src/schema.ts:19](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L19) |
|
|
1163
|
+
| <a id="bytes32"></a> `bytes32` | `"bytes32"` | `"bytes32"` | [sdk/eas/src/schema.ts:20](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L20) |
|
|
1164
|
+
| <a id="int256"></a> `int256` | `"int256"` | `"int256"` | [sdk/eas/src/schema.ts:22](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L22) |
|
|
1165
|
+
| <a id="int8"></a> `int8` | `"int8"` | `"int8"` | [sdk/eas/src/schema.ts:24](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L24) |
|
|
1166
|
+
| <a id="string"></a> `string` | `"string"` | `"string"` | [sdk/eas/src/schema.ts:16](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L16) |
|
|
1167
|
+
| <a id="uint256"></a> `uint256` | `"uint256"` | `"uint256"` | [sdk/eas/src/schema.ts:21](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L21) |
|
|
1168
|
+
| <a id="uint8"></a> `uint8` | `"uint8"` | `"uint8"` | [sdk/eas/src/schema.ts:23](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L23) |
|
|
1169
|
+
|
|
1170
|
+
***
|
|
1171
|
+
|
|
1172
|
+
#### EASClientOptionsSchema
|
|
1173
|
+
|
|
1174
|
+
> `const` **EASClientOptionsSchema**: `ZodObject`\<\{ `accessToken`: `ZodOptional`\<`ZodString`\>; `debug`: `ZodOptional`\<`ZodBoolean`\>; `easContractAddress`: `ZodOptional`\<`ZodCustom`\<`` `0x${string}` ``, `` `0x${string}` ``\>\>; `instance`: `ZodString`; `schemaRegistryContractAddress`: `ZodOptional`\<`ZodCustom`\<`` `0x${string}` ``, `` `0x${string}` ``\>\>; \}, `$strip`\>
|
|
1175
|
+
|
|
1176
|
+
Defined in: [sdk/eas/src/utils/validation.ts:13](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/utils/validation.ts#L13)
|
|
1177
|
+
|
|
1178
|
+
Zod schema for EASClientOptions.
|
|
1179
|
+
|
|
1180
|
+
***
|
|
1181
|
+
|
|
1182
|
+
#### ZERO\_ADDRESS
|
|
1183
|
+
|
|
1184
|
+
> `const` **ZERO\_ADDRESS**: `"0x0000000000000000000000000000000000000000"` = `zeroAddress`
|
|
1185
|
+
|
|
1186
|
+
Defined in: [sdk/eas/src/schema.ts:8](https://github.com/settlemint/sdk/blob/v2.3.14/sdk/eas/src/schema.ts#L8)
|
|
1187
|
+
|
|
1188
|
+
Common address constants
|
|
180
1189
|
|
|
181
1190
|
## Contributing
|
|
182
1191
|
|