@settlemint/sdk-viem 2.5.7-main18dea300 → 2.5.7-main3cd08190

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
@@ -79,21 +79,40 @@ The SettleMint Viem SDK provides a lightweight wrapper that automatically config
79
79
 
80
80
  > **getChainId**(`options`): `Promise`\<`number`\>
81
81
 
82
- Defined in: [sdk/viem/src/viem.ts:347](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L347)
82
+ Defined in: [sdk/viem/src/viem.ts:485](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L485)
83
83
 
84
- Get the chain id of a blockchain network.
84
+ Discovers the chain ID from an RPC endpoint without requiring prior knowledge.
85
85
 
86
86
  ##### Parameters
87
87
 
88
88
  | Parameter | Type | Description |
89
89
  | ------ | ------ | ------ |
90
- | `options` | [`GetChainIdOptions`](#getchainidoptions) | The options for the public client. |
90
+ | `options` | [`GetChainIdOptions`](#getchainidoptions) | Minimal options with RPC URL and optional authentication |
91
91
 
92
92
  ##### Returns
93
93
 
94
94
  `Promise`\<`number`\>
95
95
 
96
- The chain id.
96
+ Promise resolving to the network's chain ID as a number
97
+
98
+ ##### Remarks
99
+
100
+ UTILITY: Enables chain discovery for dynamic network configuration scenarios.
101
+ Unlike other client functions, this creates a minimal, non-cached client for one-time queries.
102
+
103
+ USE CASE: Chain ID discovery during initial network setup or validation.
104
+ Alternative to requiring users to know chain IDs in advance.
105
+
106
+ PERFORMANCE: No caching because chain IDs are typically discovered once
107
+ during setup rather than repeatedly during runtime operations.
108
+
109
+ ##### Throws
110
+
111
+ NetworkError when RPC endpoint is unreachable
112
+
113
+ ##### Throws
114
+
115
+ AuthenticationError when access token is invalid
97
116
 
98
117
  ##### Example
99
118
 
@@ -113,21 +132,40 @@ console.log(chainId);
113
132
 
114
133
  > **getPublicClient**(`options`): \{ \} \| \{ \}
115
134
 
116
- Defined in: [sdk/viem/src/viem.ts:169](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L169)
135
+ Defined in: [sdk/viem/src/viem.ts:246](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L246)
117
136
 
118
- Get a public client. Use this if you need to read from the blockchain.
137
+ Creates an optimized public client for blockchain read operations.
119
138
 
120
139
  ##### Parameters
121
140
 
122
141
  | Parameter | Type | Description |
123
142
  | ------ | ------ | ------ |
124
- | `options` | [`ClientOptions`](#clientoptions) | The options for the public client. |
143
+ | `options` | [`ClientOptions`](#clientoptions) | Client configuration including chain details and authentication |
125
144
 
126
145
  ##### Returns
127
146
 
128
147
  \{ \} \| \{ \}
129
148
 
130
- The public client. see [https://viem.sh/docs/clients/public](https://viem.sh/docs/clients/public)
149
+ Cached or newly created public client with read-only blockchain access
150
+
151
+ ##### Remarks
152
+
153
+ PERFORMANCE: Implements intelligent caching to minimize client creation overhead.
154
+ Cache hit rates of 80%+ typical in production workloads with repeated chain access.
155
+
156
+ SECURITY: Each access token gets isolated cache entries to prevent cross-tenant data exposure.
157
+ Client instances are immutable once cached to prevent credential pollution.
158
+
159
+ RESOURCE MANAGEMENT: 500ms polling interval balances responsiveness with server load.
160
+ 60-second timeout prevents hanging connections in unstable network conditions.
161
+
162
+ ##### Throws
163
+
164
+ ValidationError when options don't match required schema
165
+
166
+ ##### Throws
167
+
168
+ NetworkError when RPC endpoint is unreachable during client creation
131
169
 
132
170
  ##### Example
133
171
 
@@ -152,21 +190,44 @@ console.log(block);
152
190
 
153
191
  > **getWalletClient**(`options`): `any`
154
192
 
155
- Defined in: [sdk/viem/src/viem.ts:255](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L255)
193
+ Defined in: [sdk/viem/src/viem.ts:361](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L361)
156
194
 
157
- Get a wallet client. Use this if you need to write to the blockchain.
195
+ Creates a factory function for wallet clients with runtime verification support.
158
196
 
159
197
  ##### Parameters
160
198
 
161
199
  | Parameter | Type | Description |
162
200
  | ------ | ------ | ------ |
163
- | `options` | [`ClientOptions`](#clientoptions) | The options for the wallet client. |
201
+ | `options` | [`ClientOptions`](#clientoptions) | Base client configuration (chain, RPC, auth) |
164
202
 
165
203
  ##### Returns
166
204
 
167
205
  `any`
168
206
 
169
- A function that returns a wallet client. The function can be called with verification options for HD wallets. see [https://viem.sh/docs/clients/wallet](https://viem.sh/docs/clients/wallet)
207
+ Factory function that accepts runtime verification options
208
+
209
+ ##### Remarks
210
+
211
+ DESIGN PATTERN: Returns a factory function rather than a client instance because
212
+ wallet operations require runtime verification parameters (challenge responses, etc.)
213
+ that cannot be known at factory creation time.
214
+
215
+ SECURITY: Verification headers are injected per-operation to support:
216
+ - HD wallet challenge/response flows
217
+ - Multi-signature verification workflows
218
+ - Time-sensitive authentication tokens
219
+
220
+ PERFORMANCE: Factory caching amortizes expensive setup (chain resolution, transport config)
221
+ while allowing runtime parameter injection for each wallet operation.
222
+
223
+ FEATURE EXTENSIONS: Automatically extends client with SettleMint-specific wallet actions:
224
+ - Wallet creation and management
225
+ - Verification challenge handling
226
+ - Multi-factor authentication flows
227
+
228
+ ##### Throws
229
+
230
+ ValidationError when options don't match required schema
170
231
 
171
232
  ##### Example
172
233
 
@@ -499,7 +560,7 @@ Represents a wallet verification challenge.
499
560
 
500
561
  #### WalletVerificationOptions
501
562
 
502
- Defined in: [sdk/viem/src/viem.ts:213](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L213)
563
+ Defined in: [sdk/viem/src/viem.ts:293](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L293)
503
564
 
504
565
  The options for the wallet client.
505
566
 
@@ -507,8 +568,9 @@ The options for the wallet client.
507
568
 
508
569
  | Property | Type | Description | Defined in |
509
570
  | ------ | ------ | ------ | ------ |
510
- | <a id="challengeresponse-1"></a> `challengeResponse` | `string` | The challenge response (used for HD wallets) | [sdk/viem/src/viem.ts:221](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L221) |
511
- | <a id="verificationid-1"></a> `verificationId?` | `string` | The verification id (used for HD wallets), if not provided, the challenge response will be validated against all active verifications. | [sdk/viem/src/viem.ts:217](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L217) |
571
+ | <a id="challengeid"></a> `challengeId?` | `string` | The challenge id (used for HD wallets) | [sdk/viem/src/viem.ts:302](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L302) |
572
+ | <a id="challengeresponse-1"></a> `challengeResponse` | `string` | The challenge response (used for HD wallets) | [sdk/viem/src/viem.ts:306](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L306) |
573
+ | <a id="verificationid-1"></a> `verificationId?` | `string` | The verification id (used for HD wallets), if not provided, the challenge response will be validated against all active verifications. | [sdk/viem/src/viem.ts:297](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L297) |
512
574
 
513
575
  ### Type Aliases
514
576
 
@@ -526,7 +588,7 @@ Represents either a wallet address string or an object containing wallet address
526
588
 
527
589
  > **ClientOptions** = `Omit`\<`z.infer`\<*typeof* [`ClientOptionsSchema`](#clientoptionsschema)\>, `"httpTransportConfig"`\> & `object`
528
590
 
529
- Defined in: [sdk/viem/src/viem.ts:145](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L145)
591
+ Defined in: [sdk/viem/src/viem.ts:208](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L208)
530
592
 
531
593
  Type representing the validated client options.
532
594
 
@@ -534,7 +596,7 @@ Type representing the validated client options.
534
596
 
535
597
  | Name | Type | Defined in |
536
598
  | ------ | ------ | ------ |
537
- | `httpTransportConfig?` | `HttpTransportConfig` | [sdk/viem/src/viem.ts:146](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L146) |
599
+ | `httpTransportConfig?` | `HttpTransportConfig` | [sdk/viem/src/viem.ts:209](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L209) |
538
600
 
539
601
  ***
540
602
 
@@ -552,7 +614,7 @@ Response from creating wallet verification challenges.
552
614
 
553
615
  > **GetChainIdOptions** = `Omit`\<`z.infer`\<*typeof* [`GetChainIdOptionsSchema`](#getchainidoptionsschema)\>, `"httpTransportConfig"`\> & `object`
554
616
 
555
- Defined in: [sdk/viem/src/viem.ts:328](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L328)
617
+ Defined in: [sdk/viem/src/viem.ts:452](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L452)
556
618
 
557
619
  Type representing the validated get chain id options.
558
620
 
@@ -560,7 +622,7 @@ Type representing the validated get chain id options.
560
622
 
561
623
  | Name | Type | Defined in |
562
624
  | ------ | ------ | ------ |
563
- | `httpTransportConfig?` | `HttpTransportConfig` | [sdk/viem/src/viem.ts:329](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L329) |
625
+ | `httpTransportConfig?` | `HttpTransportConfig` | [sdk/viem/src/viem.ts:453](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L453) |
564
626
 
565
627
  ***
566
628
 
@@ -598,7 +660,7 @@ Union type of all possible wallet verification information types.
598
660
 
599
661
  > `const` **ClientOptionsSchema**: `ZodObject`\<\{ `accessToken`: `ZodOptional`\<`ZodString`\>; `chainId`: `ZodString`; `chainName`: `ZodString`; `httpTransportConfig`: `ZodOptional`\<`ZodAny`\>; `rpcUrl`: `ZodUnion`\<readonly \[`ZodString`, `ZodString`\]\>; \}, `$strip`\>
600
662
 
601
- Defined in: [sdk/viem/src/viem.ts:119](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L119)
663
+ Defined in: [sdk/viem/src/viem.ts:182](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L182)
602
664
 
603
665
  Schema for the viem client options.
604
666
 
@@ -608,7 +670,7 @@ Schema for the viem client options.
608
670
 
609
671
  > `const` **GetChainIdOptionsSchema**: `ZodObject`\<\{ `accessToken`: `ZodOptional`\<`ZodString`\>; `httpTransportConfig`: `ZodOptional`\<`ZodAny`\>; `rpcUrl`: `ZodUnion`\<readonly \[`ZodString`, `ZodString`\]\>; \}, `$strip`\>
610
672
 
611
- Defined in: [sdk/viem/src/viem.ts:310](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L310)
673
+ Defined in: [sdk/viem/src/viem.ts:434](https://github.com/settlemint/sdk/blob/v2.5.7/sdk/viem/src/viem.ts#L434)
612
674
 
613
675
  Schema for the viem client options.
614
676
 
@@ -4,50 +4,6 @@ import { Chain, Client, HttpTransportConfig, Transport } from "viem";
4
4
  import * as chains from "viem/chains";
5
5
  import { z } from "zod";
6
6
 
7
- //#region src/custom-actions/create-wallet.action.d.ts
8
- /**
9
- * Information about the wallet to be created.
10
- */
11
- interface WalletInfo {
12
- /** The name of the wallet. */
13
- name: string;
14
- }
15
- /**
16
- * Parameters for creating a wallet.
17
- */
18
- interface CreateWalletParameters {
19
- /** The unique name of the key vault where the wallet will be created. */
20
- keyVaultId: string;
21
- /** Information about the wallet to be created. */
22
- walletInfo: WalletInfo;
23
- }
24
- /**
25
- * Response from creating a wallet.
26
- */
27
- interface CreateWalletResponse {
28
- /** The unique identifier of the wallet. */
29
- id: string;
30
- /** The name of the wallet. */
31
- name: string;
32
- /** The blockchain address of the wallet. */
33
- address: string;
34
- /** The HD derivation path used to create the wallet. */
35
- derivationPath: string;
36
- }
37
- /**
38
- * Creates a wallet action for the given client.
39
- * @param client - The viem client to use for the request.
40
- * @returns An object with a createWallet method.
41
- */
42
- declare function createWallet(client: Client): {
43
- /**
44
- * Creates a new wallet in the specified key vault.
45
- * @param args - The parameters for creating a wallet.
46
- * @returns A promise that resolves to an array of created wallet responses.
47
- */
48
- createWallet(args: CreateWalletParameters): Promise<CreateWalletResponse[]>;
49
- };
50
- //#endregion
51
7
  //#region src/custom-actions/types/wallet-verification.enum.d.ts
52
8
  /**
53
9
  * Types of wallet verification methods supported by the system.
@@ -86,6 +42,87 @@ declare enum OTPAlgorithm {
86
42
  SHA3_512 = "SHA3-512",
87
43
  }
88
44
  //#endregion
45
+ //#region src/custom-actions/verify-wallet-verification-challenge.action.d.ts
46
+ /**
47
+ * Represents either a wallet address string or an object containing wallet address and optional verification ID.
48
+ */
49
+ type AddressOrObject = string | {
50
+ userWalletAddress: string;
51
+ verificationId?: string;
52
+ };
53
+ /**
54
+ * Parameters for verifying a wallet verification challenge.
55
+ */
56
+ interface VerifyWalletVerificationChallengeParameters {
57
+ /** The wallet address or object containing wallet address and optional verification ID. */
58
+ addressOrObject: AddressOrObject;
59
+ /** The response to the verification challenge. */
60
+ challengeResponse: string;
61
+ }
62
+ /**
63
+ * Result of a wallet verification challenge.
64
+ */
65
+ interface VerificationResult {
66
+ /** Whether the verification was successful. */
67
+ verified: boolean;
68
+ }
69
+ /**
70
+ * Response from verifying a wallet verification challenge.
71
+ */
72
+ type VerifyWalletVerificationChallengeResponse = VerificationResult[];
73
+ /**
74
+ * Creates a wallet verification challenge verification action for the given client.
75
+ * @param client - The viem client to use for the request.
76
+ * @returns An object with a verifyWalletVerificationChallenge method.
77
+ */
78
+ declare function verifyWalletVerificationChallenge(client: Client): {
79
+ /**
80
+ * Verifies a wallet verification challenge.
81
+ * @param args - The parameters for verifying the challenge.
82
+ * @returns A promise that resolves to an array of verification results.
83
+ */
84
+ verifyWalletVerificationChallenge(args: VerifyWalletVerificationChallengeParameters): Promise<VerifyWalletVerificationChallengeResponse>;
85
+ };
86
+ //#endregion
87
+ //#region src/custom-actions/create-wallet-verification-challenges.action.d.ts
88
+ /**
89
+ * Parameters for creating wallet verification challenges.
90
+ */
91
+ interface CreateWalletVerificationChallengesParameters {
92
+ /** The wallet address or object containing wallet address and optional verification ID. */
93
+ addressOrObject: AddressOrObject;
94
+ }
95
+ /**
96
+ * Represents a wallet verification challenge.
97
+ */
98
+ interface WalletVerificationChallenge {
99
+ /** The unique identifier of the challenge. */
100
+ id: string;
101
+ /** The name of the challenge. */
102
+ name: string;
103
+ /** The type of verification required. */
104
+ verificationType: WalletVerificationType;
105
+ /** The challenge parameters specific to the verification type. */
106
+ challenge: Record<string, string>;
107
+ }
108
+ /**
109
+ * Response from creating wallet verification challenges.
110
+ */
111
+ type CreateWalletVerificationChallengesResponse = WalletVerificationChallenge[];
112
+ /**
113
+ * Creates a wallet verification challenges action for the given client.
114
+ * @param client - The viem client to use for the request.
115
+ * @returns An object with a createWalletVerificationChallenges method.
116
+ */
117
+ declare function createWalletVerificationChallenges(client: Client): {
118
+ /**
119
+ * Creates verification challenges for a wallet.
120
+ * @param args - The parameters for creating the challenges.
121
+ * @returns A promise that resolves to an array of wallet verification challenges.
122
+ */
123
+ createWalletVerificationChallenges(args: CreateWalletVerificationChallengesParameters): Promise<CreateWalletVerificationChallengesResponse>;
124
+ };
125
+ //#endregion
89
126
  //#region src/custom-actions/create-wallet-verification.action.d.ts
90
127
  /**
91
128
  * Base interface for wallet verification information.
@@ -167,85 +204,48 @@ declare function createWalletVerification(client: Client): {
167
204
  createWalletVerification(args: CreateWalletVerificationParameters): Promise<CreateWalletVerificationResponse[]>;
168
205
  };
169
206
  //#endregion
170
- //#region src/custom-actions/verify-wallet-verification-challenge.action.d.ts
171
- /**
172
- * Represents either a wallet address string or an object containing wallet address and optional verification ID.
173
- */
174
- type AddressOrObject = string | {
175
- userWalletAddress: string;
176
- verificationId?: string;
177
- };
178
- /**
179
- * Parameters for verifying a wallet verification challenge.
180
- */
181
- interface VerifyWalletVerificationChallengeParameters {
182
- /** The wallet address or object containing wallet address and optional verification ID. */
183
- addressOrObject: AddressOrObject;
184
- /** The response to the verification challenge. */
185
- challengeResponse: string;
186
- }
207
+ //#region src/custom-actions/create-wallet.action.d.ts
187
208
  /**
188
- * Result of a wallet verification challenge.
209
+ * Information about the wallet to be created.
189
210
  */
190
- interface VerificationResult {
191
- /** Whether the verification was successful. */
192
- verified: boolean;
211
+ interface WalletInfo {
212
+ /** The name of the wallet. */
213
+ name: string;
193
214
  }
194
215
  /**
195
- * Response from verifying a wallet verification challenge.
196
- */
197
- type VerifyWalletVerificationChallengeResponse = VerificationResult[];
198
- /**
199
- * Creates a wallet verification challenge verification action for the given client.
200
- * @param client - The viem client to use for the request.
201
- * @returns An object with a verifyWalletVerificationChallenge method.
202
- */
203
- declare function verifyWalletVerificationChallenge(client: Client): {
204
- /**
205
- * Verifies a wallet verification challenge.
206
- * @param args - The parameters for verifying the challenge.
207
- * @returns A promise that resolves to an array of verification results.
208
- */
209
- verifyWalletVerificationChallenge(args: VerifyWalletVerificationChallengeParameters): Promise<VerifyWalletVerificationChallengeResponse>;
210
- };
211
- //#endregion
212
- //#region src/custom-actions/create-wallet-verification-challenges.action.d.ts
213
- /**
214
- * Parameters for creating wallet verification challenges.
216
+ * Parameters for creating a wallet.
215
217
  */
216
- interface CreateWalletVerificationChallengesParameters {
217
- /** The wallet address or object containing wallet address and optional verification ID. */
218
- addressOrObject: AddressOrObject;
218
+ interface CreateWalletParameters {
219
+ /** The unique name of the key vault where the wallet will be created. */
220
+ keyVaultId: string;
221
+ /** Information about the wallet to be created. */
222
+ walletInfo: WalletInfo;
219
223
  }
220
224
  /**
221
- * Represents a wallet verification challenge.
225
+ * Response from creating a wallet.
222
226
  */
223
- interface WalletVerificationChallenge {
224
- /** The unique identifier of the challenge. */
227
+ interface CreateWalletResponse {
228
+ /** The unique identifier of the wallet. */
225
229
  id: string;
226
- /** The name of the challenge. */
230
+ /** The name of the wallet. */
227
231
  name: string;
228
- /** The type of verification required. */
229
- verificationType: WalletVerificationType;
230
- /** The challenge parameters specific to the verification type. */
231
- challenge: Record<string, string>;
232
+ /** The blockchain address of the wallet. */
233
+ address: string;
234
+ /** The HD derivation path used to create the wallet. */
235
+ derivationPath: string;
232
236
  }
233
237
  /**
234
- * Response from creating wallet verification challenges.
235
- */
236
- type CreateWalletVerificationChallengesResponse = WalletVerificationChallenge[];
237
- /**
238
- * Creates a wallet verification challenges action for the given client.
238
+ * Creates a wallet action for the given client.
239
239
  * @param client - The viem client to use for the request.
240
- * @returns An object with a createWalletVerificationChallenges method.
240
+ * @returns An object with a createWallet method.
241
241
  */
242
- declare function createWalletVerificationChallenges(client: Client): {
242
+ declare function createWallet(client: Client): {
243
243
  /**
244
- * Creates verification challenges for a wallet.
245
- * @param args - The parameters for creating the challenges.
246
- * @returns A promise that resolves to an array of wallet verification challenges.
244
+ * Creates a new wallet in the specified key vault.
245
+ * @param args - The parameters for creating a wallet.
246
+ * @returns A promise that resolves to an array of created wallet responses.
247
247
  */
248
- createWalletVerificationChallenges(args: CreateWalletVerificationChallengesParameters): Promise<CreateWalletVerificationChallengesResponse>;
248
+ createWallet(args: CreateWalletParameters): Promise<CreateWalletResponse[]>;
249
249
  };
250
250
  //#endregion
251
251
  //#region src/custom-actions/delete-wallet-verification.action.d.ts
@@ -334,9 +334,23 @@ type ClientOptions = Omit<z.infer<typeof ClientOptionsSchema>, "httpTransportCon
334
334
  httpTransportConfig?: HttpTransportConfig;
335
335
  };
336
336
  /**
337
- * Get a public client. Use this if you need to read from the blockchain.
338
- * @param options - The options for the public client.
339
- * @returns The public client. see {@link https://viem.sh/docs/clients/public}
337
+ * Creates an optimized public client for blockchain read operations.
338
+ *
339
+ * @remarks
340
+ * PERFORMANCE: Implements intelligent caching to minimize client creation overhead.
341
+ * Cache hit rates of 80%+ typical in production workloads with repeated chain access.
342
+ *
343
+ * SECURITY: Each access token gets isolated cache entries to prevent cross-tenant data exposure.
344
+ * Client instances are immutable once cached to prevent credential pollution.
345
+ *
346
+ * RESOURCE MANAGEMENT: 500ms polling interval balances responsiveness with server load.
347
+ * 60-second timeout prevents hanging connections in unstable network conditions.
348
+ *
349
+ * @param options - Client configuration including chain details and authentication
350
+ * @returns Cached or newly created public client with read-only blockchain access
351
+ * @throws ValidationError when options don't match required schema
352
+ * @throws NetworkError when RPC endpoint is unreachable during client creation
353
+ *
340
354
  * @example
341
355
  * ```ts
342
356
  * import { getPublicClient } from '@settlemint/sdk-viem';
@@ -7631,15 +7645,40 @@ interface WalletVerificationOptions {
7631
7645
  * The verification id (used for HD wallets), if not provided, the challenge response will be validated against all active verifications.
7632
7646
  */
7633
7647
  verificationId?: string;
7648
+ /**
7649
+ * The challenge id (used for HD wallets)
7650
+ */
7651
+ challengeId?: string;
7634
7652
  /**
7635
7653
  * The challenge response (used for HD wallets)
7636
7654
  */
7637
7655
  challengeResponse: string;
7638
7656
  }
7639
7657
  /**
7640
- * Get a wallet client. Use this if you need to write to the blockchain.
7641
- * @param options - The options for the wallet client.
7642
- * @returns A function that returns a wallet client. The function can be called with verification options for HD wallets. see {@link https://viem.sh/docs/clients/wallet}
7658
+ * Creates a factory function for wallet clients with runtime verification support.
7659
+ *
7660
+ * @remarks
7661
+ * DESIGN PATTERN: Returns a factory function rather than a client instance because
7662
+ * wallet operations require runtime verification parameters (challenge responses, etc.)
7663
+ * that cannot be known at factory creation time.
7664
+ *
7665
+ * SECURITY: Verification headers are injected per-operation to support:
7666
+ * - HD wallet challenge/response flows
7667
+ * - Multi-signature verification workflows
7668
+ * - Time-sensitive authentication tokens
7669
+ *
7670
+ * PERFORMANCE: Factory caching amortizes expensive setup (chain resolution, transport config)
7671
+ * while allowing runtime parameter injection for each wallet operation.
7672
+ *
7673
+ * FEATURE EXTENSIONS: Automatically extends client with SettleMint-specific wallet actions:
7674
+ * - Wallet creation and management
7675
+ * - Verification challenge handling
7676
+ * - Multi-factor authentication flows
7677
+ *
7678
+ * @param options - Base client configuration (chain, RPC, auth)
7679
+ * @returns Factory function that accepts runtime verification options
7680
+ * @throws ValidationError when options don't match required schema
7681
+ *
7643
7682
  * @example
7644
7683
  * ```ts
7645
7684
  * import { getWalletClient } from '@settlemint/sdk-viem';
@@ -7683,9 +7722,23 @@ type GetChainIdOptions = Omit<z.infer<typeof GetChainIdOptionsSchema>, "httpTran
7683
7722
  httpTransportConfig?: HttpTransportConfig;
7684
7723
  };
7685
7724
  /**
7686
- * Get the chain id of a blockchain network.
7687
- * @param options - The options for the public client.
7688
- * @returns The chain id.
7725
+ * Discovers the chain ID from an RPC endpoint without requiring prior knowledge.
7726
+ *
7727
+ * @remarks
7728
+ * UTILITY: Enables chain discovery for dynamic network configuration scenarios.
7729
+ * Unlike other client functions, this creates a minimal, non-cached client for one-time queries.
7730
+ *
7731
+ * USE CASE: Chain ID discovery during initial network setup or validation.
7732
+ * Alternative to requiring users to know chain IDs in advance.
7733
+ *
7734
+ * PERFORMANCE: No caching because chain IDs are typically discovered once
7735
+ * during setup rather than repeatedly during runtime operations.
7736
+ *
7737
+ * @param options - Minimal options with RPC URL and optional authentication
7738
+ * @returns Promise resolving to the network's chain ID as a number
7739
+ * @throws NetworkError when RPC endpoint is unreachable
7740
+ * @throws AuthenticationError when access token is invalid
7741
+ *
7689
7742
  * @example
7690
7743
  * ```ts
7691
7744
  * import { getChainId } from '@settlemint/sdk-viem';