@settlemint/sdk-eas 2.3.2-prfd3a56ad → 2.3.3-pr2c60f853

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 CHANGED
@@ -53,7 +53,7 @@ The SettleMint EAS SDK provides a lightweight wrapper for the Ethereum Attestati
53
53
 
54
54
  > **createEASClient**(`options`): `object`
55
55
 
56
- Defined in: [sdk/eas/src/eas.ts:36](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/eas.ts#L36)
56
+ Defined in: [sdk/eas/src/eas.ts:36](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/eas.ts#L36)
57
57
 
58
58
  Creates an EAS client for interacting with the Ethereum Attestation Service.
59
59
 
@@ -61,7 +61,13 @@ Creates an EAS client for interacting with the Ethereum Attestation Service.
61
61
 
62
62
  | Parameter | Type | Description |
63
63
  | ------ | ------ | ------ |
64
- | `options` | [`ClientOptions`](#clientoptions) | Configuration options for the client |
64
+ | `options` | \{ `accessToken`: `string`; `attestationAddress`: `string`; `chainId`: `string`; `chainName`: `string`; `rpcUrl`: `string`; `schemaRegistryAddress`: `string`; \} | Configuration options for the client |
65
+ | `options.accessToken` | `string` | Access token for the RPC provider (must start with 'sm_aat_' or 'sm_pat_') |
66
+ | `options.attestationAddress` | `string` | The address of the EAS Attestation contract |
67
+ | `options.chainId` | `string` | The chain ID to connect to |
68
+ | `options.chainName` | `string` | The name of the chain to connect to |
69
+ | `options.rpcUrl` | `string` | The RPC URL to connect to (must be a valid URL) |
70
+ | `options.schemaRegistryAddress` | `string` | The address of the EAS Schema Registry contract |
65
71
 
66
72
  ##### Returns
67
73
 
@@ -71,8 +77,8 @@ An object containing the EAS client instance
71
77
 
72
78
  | Name | Type | Defined in |
73
79
  | ------ | ------ | ------ |
74
- | `getSchema()` | (`uid`) => `Promise`\<`string`\> | [sdk/eas/src/eas.ts:96](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/eas.ts#L96) |
75
- | `registerSchema()` | (`options`) => `Promise`\<`string`\> | [sdk/eas/src/eas.ts:95](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/eas.ts#L95) |
80
+ | `getSchema()` | (`uid`) => `Promise`\<`string`\> | [sdk/eas/src/eas.ts:96](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/eas.ts#L96) |
81
+ | `registerSchema()` | (`options`) => `Promise`\<`string`\> | [sdk/eas/src/eas.ts:95](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/eas.ts#L95) |
76
82
 
77
83
  ##### Throws
78
84
 
@@ -97,25 +103,41 @@ const client = createEASClient({
97
103
 
98
104
  #### RegisterSchemaOptions
99
105
 
100
- Defined in: [sdk/eas/src/types.ts:39](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/types.ts#L39)
106
+ Defined in: [sdk/eas/src/types.ts:34](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L34)
101
107
 
102
108
  Options for registering a new schema in the EAS Schema Registry.
103
109
 
110
+ ##### Properties
111
+
112
+ | Property | Type | Description | Defined in |
113
+ | ------ | ------ | ------ | ------ |
114
+ | <a id="fields"></a> `fields` | [`SchemaField`](#schemafield)[] | Array of fields that make up the schema | [sdk/eas/src/types.ts:36](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L36) |
115
+ | <a id="resolveraddress"></a> `resolverAddress` | `string` | Address of the resolver contract that will handle attestations | [sdk/eas/src/types.ts:38](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L38) |
116
+ | <a id="revocable"></a> `revocable` | `boolean` | Whether attestations using this schema can be revoked | [sdk/eas/src/types.ts:40](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L40) |
117
+
104
118
  ***
105
119
 
106
120
  #### SchemaField
107
121
 
108
- Defined in: [sdk/eas/src/types.ts:26](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/types.ts#L26)
122
+ Defined in: [sdk/eas/src/types.ts:22](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L22)
109
123
 
110
124
  Represents a single field in an EAS schema.
111
125
 
126
+ ##### Properties
127
+
128
+ | Property | Type | Description | Defined in |
129
+ | ------ | ------ | ------ | ------ |
130
+ | <a id="description"></a> `description?` | `string` | Optional description of the field's purpose | [sdk/eas/src/types.ts:28](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L28) |
131
+ | <a id="name"></a> `name` | `string` | The name of the field | [sdk/eas/src/types.ts:24](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L24) |
132
+ | <a id="type"></a> `type` | `"string"` \| `"address"` \| `"bool"` \| `"bytes"` \| `"bytes32"` \| `"int8"` \| `"int256"` \| `"uint8"` \| `"uint256"` | The Solidity type of the field | [sdk/eas/src/types.ts:26](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L26) |
133
+
112
134
  ### Type Aliases
113
135
 
114
136
  #### ClientOptions
115
137
 
116
- > **ClientOptions** = `z.infer`\<*typeof* [`ClientOptionsSchema`](#clientoptionsschema)\> & `Pick`\<`ViemClientOptions`, `"accessToken"` \| `"chainId"` \| `"chainName"` \| `"rpcUrl"`\>
138
+ > **ClientOptions** = `z.infer`\<*typeof* [`ClientOptionsSchema`](#clientoptionsschema)\>
117
139
 
118
- Defined in: [sdk/eas/src/client-options.schema.ts:32](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/client-options.schema.ts#L32)
140
+ Defined in: [sdk/eas/src/client-options.schema.ts:28](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/client-options.schema.ts#L28)
119
141
 
120
142
  Configuration options for creating an EAS client.
121
143
  Combines EAS-specific options with base Viem client options.
@@ -126,7 +148,7 @@ Combines EAS-specific options with base Viem client options.
126
148
 
127
149
  > `const` **ClientOptionsSchema**: `ZodObject`\<\{ `accessToken`: `ZodString`; `attestationAddress`: `ZodString`; `chainId`: `ZodString`; `chainName`: `ZodString`; `rpcUrl`: `ZodString`; `schemaRegistryAddress`: `ZodString`; \}, `$strip`\>
128
150
 
129
- Defined in: [sdk/eas/src/client-options.schema.ts:10](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/client-options.schema.ts#L10)
151
+ Defined in: [sdk/eas/src/client-options.schema.ts:9](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/client-options.schema.ts#L9)
130
152
 
131
153
  Schema for validating EAS client configuration options.
132
154
  Extends the base Viem client options with EAS-specific requirements.
@@ -137,7 +159,7 @@ Extends the base Viem client options with EAS-specific requirements.
137
159
 
138
160
  > `const` **EAS\_FIELD\_TYPES**: `object`
139
161
 
140
- Defined in: [sdk/eas/src/types.ts:5](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/types.ts#L5)
162
+ Defined in: [sdk/eas/src/types.ts:5](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L5)
141
163
 
142
164
  Supported field types for EAS schema fields.
143
165
  Maps to the Solidity types that can be used in EAS schemas.
@@ -146,15 +168,15 @@ Maps to the Solidity types that can be used in EAS schemas.
146
168
 
147
169
  | Name | Type | Default value | Defined in |
148
170
  | ------ | ------ | ------ | ------ |
149
- | <a id="address"></a> `address` | `"address"` | `"address"` | [sdk/eas/src/types.ts:7](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/types.ts#L7) |
150
- | <a id="bool"></a> `bool` | `"bool"` | `"bool"` | [sdk/eas/src/types.ts:8](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/types.ts#L8) |
151
- | <a id="bytes"></a> `bytes` | `"bytes"` | `"bytes"` | [sdk/eas/src/types.ts:9](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/types.ts#L9) |
152
- | <a id="bytes32"></a> `bytes32` | `"bytes32"` | `"bytes32"` | [sdk/eas/src/types.ts:10](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/types.ts#L10) |
153
- | <a id="int256"></a> `int256` | `"int256"` | `"int256"` | [sdk/eas/src/types.ts:12](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/types.ts#L12) |
154
- | <a id="int8"></a> `int8` | `"int8"` | `"int8"` | [sdk/eas/src/types.ts:14](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/types.ts#L14) |
155
- | <a id="string"></a> `string` | `"string"` | `"string"` | [sdk/eas/src/types.ts:6](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/types.ts#L6) |
156
- | <a id="uint256"></a> `uint256` | `"uint256"` | `"uint256"` | [sdk/eas/src/types.ts:11](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/types.ts#L11) |
157
- | <a id="uint8"></a> `uint8` | `"uint8"` | `"uint8"` | [sdk/eas/src/types.ts:13](https://github.com/settlemint/sdk/blob/v2.3.2/sdk/eas/src/types.ts#L13) |
171
+ | <a id="address"></a> `address` | `"address"` | `"address"` | [sdk/eas/src/types.ts:7](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L7) |
172
+ | <a id="bool"></a> `bool` | `"bool"` | `"bool"` | [sdk/eas/src/types.ts:8](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L8) |
173
+ | <a id="bytes"></a> `bytes` | `"bytes"` | `"bytes"` | [sdk/eas/src/types.ts:9](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L9) |
174
+ | <a id="bytes32"></a> `bytes32` | `"bytes32"` | `"bytes32"` | [sdk/eas/src/types.ts:10](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L10) |
175
+ | <a id="int256"></a> `int256` | `"int256"` | `"int256"` | [sdk/eas/src/types.ts:12](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L12) |
176
+ | <a id="int8"></a> `int8` | `"int8"` | `"int8"` | [sdk/eas/src/types.ts:14](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L14) |
177
+ | <a id="string"></a> `string` | `"string"` | `"string"` | [sdk/eas/src/types.ts:6](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L6) |
178
+ | <a id="uint256"></a> `uint256` | `"uint256"` | `"uint256"` | [sdk/eas/src/types.ts:11](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L11) |
179
+ | <a id="uint8"></a> `uint8` | `"uint8"` | `"uint8"` | [sdk/eas/src/types.ts:13](https://github.com/settlemint/sdk/blob/v2.3.3/sdk/eas/src/types.ts#L13) |
158
180
 
159
181
  ## Contributing
160
182
 
@@ -0,0 +1,97 @@
1
+ import { z } from "zod/v4";
2
+
3
+ //#region src/client-options.schema.d.ts
4
+ /**
5
+ * Schema for validating EAS client configuration options.
6
+ * Extends the base Viem client options with EAS-specific requirements.
7
+ */
8
+ /**
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.
23
+ */
24
+ type ClientOptions = z.infer<typeof ClientOptionsSchema>;
25
+
26
+ //#endregion
27
+ //#region src/types.d.ts
28
+ /**
29
+ * Supported field types for EAS schema fields.
30
+ * Maps to the Solidity types that can be used in EAS schemas.
31
+ */
32
+ declare const EAS_FIELD_TYPES: {
33
+ readonly string: "string";
34
+ readonly address: "address";
35
+ readonly bool: "bool";
36
+ readonly bytes: "bytes";
37
+ readonly bytes32: "bytes32";
38
+ readonly uint256: "uint256";
39
+ readonly int256: "int256";
40
+ readonly uint8: "uint8";
41
+ readonly int8: "int8";
42
+ };
43
+ type EASFieldType = keyof typeof EAS_FIELD_TYPES;
44
+ /**
45
+ * Represents a single field in an EAS schema.
46
+ */
47
+ interface SchemaField {
48
+ /** The name of the field */
49
+ name: string;
50
+ /** The Solidity type of the field */
51
+ type: EASFieldType;
52
+ /** Optional description of the field's purpose */
53
+ description?: string;
54
+ }
55
+ /**
56
+ * Options for registering a new schema in the EAS Schema Registry.
57
+ */
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;
63
+ /** Whether attestations using this schema can be revoked */
64
+ revocable: boolean;
65
+ }
66
+
67
+ //#endregion
68
+ //#region src/eas.d.ts
69
+ /**
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
+ };
94
+
95
+ //#endregion
96
+ export { ClientOptions, ClientOptionsSchema, EASFieldType, EAS_FIELD_TYPES, RegisterSchemaOptions, SchemaField, createEASClient };
97
+ //# sourceMappingURL=eas.d.ts.map