@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/dist/viem.d.cts CHANGED
@@ -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';