@settlemint/sdk-viem 2.6.2 → 2.6.3

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.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"viem.js","names":["keyObject: Record<string, unknown>","filteredHeaders: Record<string, string>","validatedOptions: ClientOptions","createPublicClient","createPublicClientViem","validatedOptions: GetChainIdOptions"],"sources":["../src/custom-actions/anvil/anvil-set-balance.ts","../src/custom-actions/create-wallet.action.ts","../src/custom-actions/create-wallet-verification.action.ts","../src/custom-actions/create-wallet-verification-challenge.action.ts","../src/custom-actions/create-wallet-verification-challenges.action.ts","../src/custom-actions/delete-wallet-verification.action.ts","../src/custom-actions/eth-sign.action.ts","../src/custom-actions/get-wallet-verifications.action.ts","../src/custom-actions/verify-wallet-verification-challenge.action.ts","../src/utils/lru-cache.ts","../src/custom-actions/types/wallet-verification.enum.ts","../src/viem.ts"],"sourcesContent":["import type { Client, Hex } from \"viem\";\n\n/**\n * Parameters for setting the balance of a wallet.\n */\nexport type AnvilSetBalanceParameters = [wallet: string, balance: Hex];\n\n/**\n * RPC schema for setting the balance of a wallet.\n */\ntype SetBalanceRpcSchema = {\n Method: \"anvil_setBalance\";\n Parameters: AnvilSetBalanceParameters;\n ReturnType: unknown;\n};\n\n/**\n * Set the balance of a wallet in the Anvil test environment.\n * @param client - The viem client to use for the request.\n * @returns An object with a anvilSetBalance method.\n */\nexport function anvilSetBalance(client: Client) {\n return {\n /**\n * Sets the balance of a wallet.\n * @param args - The parameters for setting the balance.\n * @returns A promise that resolves to the result of the balance setting operation.\n */\n anvilSetBalance(args: AnvilSetBalanceParameters): Promise<unknown> {\n return client.request<SetBalanceRpcSchema>({\n method: \"anvil_setBalance\",\n params: args,\n });\n },\n };\n}\n","import type { Client } from \"viem\";\n\n/**\n * Information about the wallet to be created.\n */\nexport interface WalletInfo {\n /** The name of the wallet. */\n name: string;\n /** Optional index for the wallet, walletIndex enables HD derivation paths */\n walletIndex?: number;\n}\n\n/**\n * Parameters for creating a wallet.\n */\nexport interface CreateWalletParameters {\n /** The unique name of the key vault where the wallet will be created. */\n keyVaultId: string;\n /** Information about the wallet to be created. */\n walletInfo: WalletInfo;\n}\n\n/**\n * Response from creating a wallet.\n */\nexport interface CreateWalletResponse {\n /** The unique identifier of the wallet. */\n id: string;\n /** The name of the wallet. */\n name: string;\n /** The blockchain address of the wallet. */\n address: string;\n /** The HD derivation path used to create the wallet. */\n derivationPath: string;\n}\n\n/**\n * RPC schema for wallet creation.\n */\ntype WalletRpcSchema = {\n Method: \"user_createWallet\";\n Parameters: [keyVaultId: string, walletInfo: WalletInfo];\n ReturnType: CreateWalletResponse[];\n};\n\n/**\n * Creates a wallet action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a createWallet method.\n */\nexport function createWallet(client: Client) {\n return {\n /**\n * Creates a new wallet in the specified key vault.\n * @param args - The parameters for creating a wallet.\n * @returns A promise that resolves to an array of created wallet responses.\n */\n createWallet(args: CreateWalletParameters): Promise<CreateWalletResponse[]> {\n return client.request<WalletRpcSchema>({\n method: \"user_createWallet\",\n params: [args.keyVaultId, args.walletInfo],\n });\n },\n };\n}\n","import type { Client } from \"viem\";\nimport type { OTPAlgorithm, WalletVerificationType } from \"./types/wallet-verification.enum.js\";\n\n/**\n * Base interface for wallet verification information.\n */\ntype BaseWalletVerificationInfo = {\n /** The name of the verification method. */\n name: string;\n /** The type of verification method. */\n verificationType: WalletVerificationType;\n};\n\n/**\n * Information for PIN code verification.\n */\nexport interface WalletPincodeVerificationInfo extends BaseWalletVerificationInfo {\n /** The type of verification method. */\n verificationType: WalletVerificationType.PINCODE;\n /** The PIN code to use for verification. */\n pincode: string;\n}\n\n/**\n * Information for One-Time Password (OTP) verification.\n */\nexport interface WalletOTPVerificationInfo extends BaseWalletVerificationInfo {\n /** The type of verification method. */\n verificationType: WalletVerificationType.OTP;\n /** The hash algorithm to use for OTP generation. */\n algorithm?: OTPAlgorithm;\n /** The number of digits in the OTP code. */\n digits?: number;\n /** The time period in seconds for OTP validity. */\n period?: number;\n /** The issuer of the OTP. */\n issuer?: string;\n}\n\n/**\n * Information for secret recovery codes verification.\n */\nexport interface WalletSecretCodesVerificationInfo extends BaseWalletVerificationInfo {\n /** The type of verification method. */\n verificationType: WalletVerificationType.SECRET_CODES;\n}\n\n/**\n * Union type of all possible wallet verification information types.\n */\nexport type WalletVerificationInfo =\n | WalletPincodeVerificationInfo\n | WalletOTPVerificationInfo\n | WalletSecretCodesVerificationInfo;\n\n/**\n * Parameters for creating a wallet verification.\n */\nexport interface CreateWalletVerificationParameters {\n /** The wallet address for which to create the verification. */\n userWalletAddress: string;\n /** The verification information to create. */\n walletVerificationInfo: WalletVerificationInfo;\n}\n\n/**\n * Response from creating a wallet verification.\n */\nexport interface CreateWalletVerificationResponse {\n /** The unique identifier of the verification. */\n id: string;\n /** The name of the verification method. */\n name: string;\n /** The type of verification method. */\n verificationType: WalletVerificationType;\n /** Additional parameters specific to the verification type. */\n parameters: Record<string, string>;\n}\n\n/**\n * RPC schema for creating a wallet verification.\n */\ntype WalletRpcSchema = {\n Method: \"user_createWalletVerification\";\n Parameters: [userWalletAddress: string, walletVerificationInfo: WalletVerificationInfo];\n ReturnType: CreateWalletVerificationResponse[];\n};\n\n/**\n * Creates a wallet verification action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a createWalletVerification method.\n */\nexport function createWalletVerification(client: Client) {\n return {\n /**\n * Creates a new wallet verification.\n * @param args - The parameters for creating the verification.\n * @returns A promise that resolves to an array of created wallet verification responses.\n */\n createWalletVerification(args: CreateWalletVerificationParameters): Promise<CreateWalletVerificationResponse[]> {\n return client.request<WalletRpcSchema>({\n method: \"user_createWalletVerification\",\n params: [args.userWalletAddress, args.walletVerificationInfo],\n });\n },\n };\n}\n","import type { Client } from \"viem\";\nimport type { WalletVerificationChallenge } from \"./types/wallet-verification-challenge.js\";\n\n/**\n * Parameters for creating wallet verification challenges.\n */\nexport interface CreateWalletVerificationChallengeParameters {\n /** The wallet address. */\n userWalletAddress: string;\n /** The verification ID. */\n verificationId: string;\n}\n\n/**\n * Data specific to a wallet verification challenge.\n */\nexport interface WalletVerificationChallengeData {\n /** Optional salt for PINCODE verification type. */\n salt?: string;\n /** Optional secret for PINCODE verification type. */\n secret?: string;\n}\n\n/**\n * Response from creating wallet verification challenge.\n */\nexport type CreateWalletVerificationChallengeResponse = WalletVerificationChallenge<WalletVerificationChallengeData>;\n\n/**\n * RPC schema for creating wallet verification challenge.\n */\ntype WalletRpcSchema = {\n Method: \"user_createWalletVerificationChallenge\";\n Parameters: [CreateWalletVerificationChallengeParameters];\n ReturnType: CreateWalletVerificationChallengeResponse;\n};\n\n/**\n * Creates a wallet verification challenge action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a createWalletVerificationChallenge method.\n */\nexport function createWalletVerificationChallenge(client: Client) {\n return {\n /**\n * Creates a verification challenge for a wallet.\n * @param args - The parameters for creating the challenge.\n * @returns A promise that resolves to a wallet verification challenge.\n */\n createWalletVerificationChallenge(\n args: CreateWalletVerificationChallengeParameters,\n ): Promise<CreateWalletVerificationChallengeResponse> {\n return client.request<WalletRpcSchema>({\n method: \"user_createWalletVerificationChallenge\",\n params: [args],\n });\n },\n };\n}\n","import type { Client } from \"viem\";\nimport type { WalletVerificationChallenge } from \"./types/wallet-verification-challenge.js\";\nimport type { AddressOrObject } from \"./verify-wallet-verification-challenge.action.js\";\n\n/**\n * Parameters for creating wallet verification challenges.\n */\nexport interface CreateWalletVerificationChallengesParameters {\n /** The wallet address or object containing wallet address and optional verification ID. */\n addressOrObject: AddressOrObject<{ amount?: number }>;\n}\n\n/**\n * Response from creating wallet verification challenges.\n */\nexport type CreateWalletVerificationChallengesResponse = Omit<\n WalletVerificationChallenge<Record<string, string>>,\n \"verificationId\"\n>[];\n\n/**\n * RPC schema for creating wallet verification challenges.\n */\ntype WalletRpcSchema = {\n Method: \"user_createWalletVerificationChallenges\";\n Parameters: [addressOrObject: AddressOrObject];\n ReturnType: CreateWalletVerificationChallengesResponse;\n};\n\n/**\n * Creates a wallet verification challenges action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a createWalletVerificationChallenges method.\n */\nexport function createWalletVerificationChallenges(client: Client) {\n return {\n /**\n * Creates verification challenges for a wallet.\n * @param args - The parameters for creating the challenges.\n * @returns A promise that resolves to an array of wallet verification challenges.\n */\n createWalletVerificationChallenges(\n args: CreateWalletVerificationChallengesParameters,\n ): Promise<CreateWalletVerificationChallengesResponse> {\n return client.request<WalletRpcSchema>({\n method: \"user_createWalletVerificationChallenges\",\n params: [args.addressOrObject],\n });\n },\n };\n}\n","import type { Client } from \"viem\";\n\n/**\n * Parameters for deleting a wallet verification.\n */\nexport interface DeleteWalletVerificationParameters {\n /** The wallet address for which to delete the verification. */\n userWalletAddress: string;\n /** The unique identifier of the verification to delete. */\n verificationId: string;\n}\n\n/**\n * Response from deleting a wallet verification.\n */\nexport interface DeleteWalletVerificationResponse {\n /** Whether the deletion was successful. */\n success: boolean;\n}\n\n/**\n * RPC schema for deleting a wallet verification.\n */\ntype WalletRpcSchema = {\n Method: \"user_deleteWalletVerification\";\n Parameters: [userWalletAddress: string, verificationId: string];\n ReturnType: DeleteWalletVerificationResponse[];\n};\n\n/**\n * Creates a wallet verification deletion action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a deleteWalletVerification method.\n */\nexport function deleteWalletVerification(client: Client) {\n return {\n /**\n * Deletes a wallet verification.\n * @param args - The parameters for deleting the verification.\n * @returns A promise that resolves to an array of deletion results.\n */\n deleteWalletVerification(args: DeleteWalletVerificationParameters): Promise<DeleteWalletVerificationResponse[]> {\n return client.request<WalletRpcSchema>({\n method: \"user_deleteWalletVerification\",\n params: [args.userWalletAddress, args.verificationId],\n });\n },\n };\n}\n","import type { Client } from \"viem\";\n\n/**\n * Parameters for signing data with a wallet.\n */\nexport interface EthSignParameters {\n /** The wallet address to sign the data with. */\n userWalletAddress: string;\n /** The data to sign. */\n data: string;\n}\n\n/**\n * RPC schema for signing data with a wallet.\n */\ntype EthSignRpcSchema = {\n Method: \"eth_sign\";\n Parameters: [userWalletAddress: string, data: string];\n ReturnType: string;\n};\n\n/**\n * Creates a wallet action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a createWallet method.\n */\nexport function ethSign(client: Client) {\n return {\n /**\n * Signs data with a wallet.\n * @param args - The parameters for signing data with a wallet.\n * @returns A promise that resolves to signed data response.\n */\n ethSign(args: EthSignParameters): Promise<string> {\n return client.request<EthSignRpcSchema>({\n method: \"eth_sign\",\n params: [args.userWalletAddress, args.data],\n });\n },\n };\n}\n","import type { Client } from \"viem\";\nimport type { WalletVerificationType } from \"./types/wallet-verification.enum.js\";\n\n/**\n * Parameters for getting wallet verifications.\n */\nexport interface GetWalletVerificationsParameters {\n /** The wallet address for which to fetch verifications. */\n userWalletAddress: string;\n}\n\n/**\n * Represents a wallet verification.\n */\nexport interface WalletVerification {\n /** The unique identifier of the verification. */\n id: string;\n /** The name of the verification method. */\n name: string;\n /** The type of verification method. */\n verificationType: WalletVerificationType;\n}\n\n/**\n * Response from getting wallet verifications.\n */\nexport type GetWalletVerificationsResponse = WalletVerification[];\n\n/**\n * RPC schema for getting wallet verifications.\n */\ntype WalletRpcSchema = {\n Method: \"user_walletVerifications\";\n Parameters: [userWalletAddress: string];\n ReturnType: GetWalletVerificationsResponse;\n};\n\n/**\n * Creates a wallet verifications retrieval action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a getWalletVerifications method.\n */\nexport function getWalletVerifications(client: Client) {\n return {\n /**\n * Gets all verifications for a wallet.\n * @param args - The parameters for getting the verifications.\n * @returns A promise that resolves to an array of wallet verifications.\n */\n getWalletVerifications(args: GetWalletVerificationsParameters): Promise<GetWalletVerificationsResponse> {\n return client.request<WalletRpcSchema>({\n method: \"user_walletVerifications\",\n params: [args.userWalletAddress],\n });\n },\n };\n}\n","import type { Client } from \"viem\";\n\n/**\n * Represents either a wallet address string or an object containing wallet address and optional verification ID.\n */\n\n// biome-ignore lint/complexity/noBannedTypes: is optional and the default is empty\nexport type AddressOrObject<Extra = {}> =\n | string\n | ({\n userWalletAddress: string;\n verificationId?: string;\n } & Extra);\n\n/**\n * Represents either a wallet address string, an object containing wallet address and optional verification ID or a challenge ID.\n */\nexport type AddressOrObjectWithChallengeId =\n | AddressOrObject\n | {\n /** ID of the challenge to verify against */\n challengeId: string;\n };\n\n/**\n * Parameters for verifying a wallet verification challenge.\n */\nexport interface VerifyWalletVerificationChallengeParameters {\n /** The wallet address or object containing wallet address and optional verification ID. */\n addressOrObject: AddressOrObjectWithChallengeId;\n /** The response to the verification challenge. */\n challengeResponse: string;\n}\n\n/**\n * Result of a wallet verification challenge.\n */\nexport interface VerificationResult {\n /** Whether the verification was successful. */\n verified: boolean;\n}\n\n/**\n * Response from verifying a wallet verification challenge.\n */\nexport type VerifyWalletVerificationChallengeResponse = VerificationResult[];\n\n/**\n * RPC schema for wallet verification challenge verification.\n */\ntype WalletRpcSchema = {\n Method: \"user_verifyWalletVerificationChallenge\";\n Parameters: [addressOrObject: AddressOrObjectWithChallengeId, challengeResponse: string];\n ReturnType: VerifyWalletVerificationChallengeResponse;\n};\n\n/**\n * Creates a wallet verification challenge verification action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a verifyWalletVerificationChallenge method.\n */\nexport function verifyWalletVerificationChallenge(client: Client) {\n return {\n /**\n * Verifies a wallet verification challenge.\n * @param args - The parameters for verifying the challenge.\n * @returns A promise that resolves to an array of verification results.\n */\n verifyWalletVerificationChallenge(\n args: VerifyWalletVerificationChallengeParameters,\n ): Promise<VerifyWalletVerificationChallengeResponse> {\n return client.request<WalletRpcSchema>({\n method: \"user_verifyWalletVerificationChallenge\",\n params: [args.addressOrObject, args.challengeResponse],\n });\n },\n };\n}\n","/**\n * DESIGN DECISION: Custom LRU cache implementation over external libraries.\n *\n * WHY: Avoids external dependencies for this critical infrastructure component.\n * TRADEOFF: Simpler implementation trades advanced features (TTL, statistics) for reliability.\n * PERFORMANCE: O(1) access with automatic memory management prevents unbounded growth.\n *\n * Alternative considered: Using Map without eviction - rejected due to memory leak risk\n * in long-running server applications with diverse chain/client combinations.\n */\nexport class LRUCache<K, V> {\n private cache = new Map<K, V>();\n private readonly maxSize: number;\n\n constructor(maxSize: number) {\n this.maxSize = maxSize;\n }\n\n get(key: K): V | undefined {\n const value = this.cache.get(key);\n if (value !== undefined) {\n // PERFORMANCE: Move to end to maintain LRU ordering - prevents premature eviction\n this.cache.delete(key);\n this.cache.set(key, value);\n }\n return value;\n }\n\n set(key: K, value: V): void {\n // INVARIANT: Remove existing key to update position in insertion order\n this.cache.delete(key);\n\n // MEMORY MANAGEMENT: Enforce size limit to prevent unbounded growth\n if (this.cache.size >= this.maxSize) {\n // WHY: Maps preserve insertion order - first key is least recently used\n const firstKey = this.cache.keys().next().value;\n if (firstKey !== undefined) {\n this.cache.delete(firstKey);\n }\n }\n\n this.cache.set(key, value);\n }\n\n clear(): void {\n this.cache.clear();\n }\n}\n","/**\n * Types of wallet verification methods supported by the system.\n * Used to identify different verification mechanisms when creating or managing wallet verifications.\n */\nexport enum WalletVerificationType {\n /** PIN code verification method */\n PINCODE = \"PINCODE\",\n /** One-Time Password verification method */\n OTP = \"OTP\",\n /** Secret recovery codes verification method */\n SECRET_CODES = \"SECRET_CODES\",\n}\n\n/**\n * Supported hash algorithms for One-Time Password (OTP) verification.\n * These algorithms determine the cryptographic function used to generate OTP codes.\n */\nexport enum OTPAlgorithm {\n /** SHA-1 hash algorithm */\n SHA1 = \"SHA1\",\n /** SHA-224 hash algorithm */\n SHA224 = \"SHA224\",\n /** SHA-256 hash algorithm */\n SHA256 = \"SHA256\",\n /** SHA-384 hash algorithm */\n SHA384 = \"SHA384\",\n /** SHA-512 hash algorithm */\n SHA512 = \"SHA512\",\n /** SHA3-224 hash algorithm */\n SHA3_224 = \"SHA3-224\",\n /** SHA3-256 hash algorithm */\n SHA3_256 = \"SHA3-256\",\n /** SHA3-384 hash algorithm */\n SHA3_384 = \"SHA3-384\",\n /** SHA3-512 hash algorithm */\n SHA3_512 = \"SHA3-512\",\n}\n","/**\n * Viem client factory with intelligent caching and SettleMint platform integration.\n *\n * This module provides optimized blockchain client creation for the SettleMint platform.\n * Key architectural decisions:\n * - LRU caching prevents memory leaks while optimizing performance for repeated operations\n * - Separate caching strategies for known vs custom chains maximize cache hit rates\n * - Security-conscious header handling prevents undefined auth token exposure\n * - Factory pattern for wallet clients enables runtime verification parameter injection\n */\n\nimport { appendHeaders } from \"@settlemint/sdk-utils/http\";\nimport { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { ApplicationAccessTokenSchema, UrlOrPathSchema, validate } from \"@settlemint/sdk-utils/validation\";\nimport {\n createPublicClient as createPublicClientViem,\n createWalletClient,\n defineChain,\n type HttpTransportConfig,\n http,\n publicActions,\n type Chain as ViemChain,\n} from \"viem\";\nimport * as chains from \"viem/chains\";\nimport { z } from \"zod\";\nimport { anvilSetBalance } from \"./custom-actions/anvil/anvil-set-balance.js\";\nimport { createWallet } from \"./custom-actions/create-wallet.action.js\";\nimport { createWalletVerification } from \"./custom-actions/create-wallet-verification.action.js\";\nimport { createWalletVerificationChallenge } from \"./custom-actions/create-wallet-verification-challenge.action.js\";\nimport { createWalletVerificationChallenges } from \"./custom-actions/create-wallet-verification-challenges.action.js\";\nimport { deleteWalletVerification } from \"./custom-actions/delete-wallet-verification.action.js\";\nimport { ethSign } from \"./custom-actions/eth-sign.action.js\";\nimport { getWalletVerifications } from \"./custom-actions/get-wallet-verifications.action.js\";\nimport { verifyWalletVerificationChallenge } from \"./custom-actions/verify-wallet-verification-challenge.action.js\";\nimport { LRUCache } from \"./utils/lru-cache.js\";\n\n/**\n * CACHE SIZING STRATEGY: Different limits based on usage patterns and memory impact.\n *\n * Chain cache (100): WHY larger?\n * - Chain definitions are lightweight (just metadata)\n * - High reuse across different client instances\n * - Custom chains vary widely in development/testing scenarios\n *\n * Client caches (50 each): WHY smaller?\n * - Clients hold heavy resources (connections, transport state)\n * - Fewer unique client configurations in typical usage\n * - Each client maintains internal connection pools\n *\n * TRADEOFF: Balances memory usage vs cache hit rates for optimal performance.\n */\nconst chainCache = new LRUCache<string, ViemChain>(100);\n\n/**\n * SECURITY CONSIDERATION: Public clients contain auth tokens in transport config.\n * Cache key generation ensures tokens are not leaked between different access contexts.\n */\nconst publicClientCache = new LRUCache<string, ReturnType<typeof createPublicClient>>(50);\n\n/**\n * DESIGN PATTERN: Factory caching rather than client instance caching.\n * WHY: Wallet clients need runtime verification parameters that can't be pre-cached.\n * BENEFIT: Amortizes chain resolution and transport configuration setup costs.\n */\nconst walletClientFactoryCache = new LRUCache<\n string,\n (verificationOptions?: WalletVerificationOptions) => ReturnType<typeof createWalletClientWithCustomMethods>\n>(50);\n\n/**\n * CACHE KEY GENERATION: Deterministic key creation for consistent cache behavior.\n *\n * SECURITY: Access tokens are included in cache keys to prevent cross-tenant data leaks.\n * Different access tokens must produce different cache entries even with identical chain configs.\n *\n * DETERMINISM: Property sorting ensures identical options always produce the same key,\n * regardless of object property enumeration order differences across JavaScript engines.\n *\n * EDGE CASE: Function properties in httpTransportConfig are excluded because:\n * 1. Functions cannot be serialized to JSON\n * 2. Function identity changes don't affect transport behavior for caching purposes\n * 3. Prevents cache key generation failures\n */\nfunction createCacheKey(options: Partial<ClientOptions>): string {\n // WHY: Deterministic key generation prevents cache misses due to property order\n const keyObject: Record<string, unknown> = {};\n\n // INVARIANT: Process properties in fixed order for consistency\n const keys = [\"chainId\", \"chainName\", \"rpcUrl\", \"accessToken\"] as const;\n for (const key of keys) {\n const value = options[key as keyof ClientOptions];\n // SECURITY: Only include defined values to prevent undefined token caching issues\n if (value !== undefined) {\n keyObject[key] = value;\n }\n }\n\n // EDGE CASE: Serialize only the serializable parts of httpTransportConfig\n if (options.httpTransportConfig) {\n // biome-ignore lint/correctness/noUnusedVariables: Destructuring to exclude functions from serialization\n const { onFetchRequest, onFetchResponse, ...serializableConfig } = options.httpTransportConfig;\n if (Object.keys(serializableConfig).length > 0) {\n keyObject.httpTransportConfig = serializableConfig;\n }\n }\n\n // WHY: Sorted keys ensure deterministic JSON stringification across environments\n return JSON.stringify(keyObject, Object.keys(keyObject).sort());\n}\n\n/**\n * HEADER SECURITY: Prevents undefined auth tokens from being sent as 'undefined' strings.\n *\n * WHY: HTTP headers with undefined values can be serialized as the string 'undefined',\n * which may bypass authentication or cause server-side parsing errors.\n *\n * SECURITY BOUNDARY: Filters out undefined authentication headers before network transmission\n * to prevent accidental exposure of invalid credentials or authentication bypass attempts.\n */\nfunction buildHeaders(\n baseHeaders: HeadersInit | undefined,\n authHeaders: Record<string, string | undefined>,\n): HeadersInit {\n // SECURITY: Only include headers with actual string values - prevents 'undefined' transmission\n const filteredHeaders: Record<string, string> = {};\n for (const [key, value] of Object.entries(authHeaders)) {\n if (value !== undefined) {\n filteredHeaders[key] = value;\n }\n }\n return appendHeaders(baseHeaders, filteredHeaders);\n}\n\n/**\n * Schema for the viem client options.\n */\nexport const ClientOptionsSchema = z.object({\n /**\n * The access token\n */\n accessToken: ApplicationAccessTokenSchema.optional(),\n /**\n * The chain id\n */\n chainId: z.string(),\n /**\n * The chain name\n */\n chainName: z.string(),\n /**\n * The json rpc url\n */\n rpcUrl: UrlOrPathSchema,\n /**\n * The http transport config\n */\n httpTransportConfig: z.any().optional(),\n});\n\n/**\n * Type representing the validated client options.\n */\nexport type ClientOptions = Omit<z.infer<typeof ClientOptionsSchema>, \"httpTransportConfig\"> & {\n httpTransportConfig?: HttpTransportConfig;\n};\n\n/**\n * Creates an optimized public client for blockchain read operations.\n *\n * @remarks\n * PERFORMANCE: Implements intelligent caching to minimize client creation overhead.\n * Cache hit rates of 80%+ typical in production workloads with repeated chain access.\n *\n * SECURITY: Each access token gets isolated cache entries to prevent cross-tenant data exposure.\n * Client instances are immutable once cached to prevent credential pollution.\n *\n * RESOURCE MANAGEMENT: 500ms polling interval balances responsiveness with server load.\n * 60-second timeout prevents hanging connections in unstable network conditions.\n *\n * @param options - Client configuration including chain details and authentication\n * @returns Cached or newly created public client with read-only blockchain access\n * @throws ValidationError when options don't match required schema\n * @throws NetworkError when RPC endpoint is unreachable during client creation\n *\n * @example\n * ```ts\n * import { getPublicClient } from '@settlemint/sdk-viem';\n *\n * const publicClient = getPublicClient({\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,\n * chainId: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!,\n * chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,\n * rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT!,\n * });\n *\n * // Get the block number\n * const block = await publicClient.getBlockNumber();\n * console.log(block);\n * ```\n */\nexport const getPublicClient = (options: ClientOptions) => {\n ensureServer();\n const validatedOptions: ClientOptions = validate(ClientOptionsSchema, options);\n\n // PERFORMANCE: Check cache first to avoid expensive client creation\n const cacheKey = createCacheKey(validatedOptions);\n const cachedClient = publicClientCache.get(cacheKey);\n if (cachedClient) {\n return cachedClient;\n }\n\n // SECURITY: Build headers with undefined value filtering\n const headers = buildHeaders(validatedOptions?.httpTransportConfig?.fetchOptions?.headers, {\n \"x-auth-token\": validatedOptions.accessToken,\n });\n\n // CONFIGURATION: Create new client with optimized settings\n const client = createPublicClient(validatedOptions, headers);\n\n // PERFORMANCE: Cache for future requests with identical configuration\n publicClientCache.set(cacheKey, client);\n\n return client;\n};\n\nfunction createPublicClient(validatedOptions: ClientOptions, headers: HeadersInit) {\n return (\n createPublicClientViem({\n chain: getChain({\n chainId: validatedOptions.chainId,\n chainName: validatedOptions.chainName,\n rpcUrl: validatedOptions.rpcUrl,\n }),\n // WHY 500ms: Balances real-time updates with reasonable server load\n pollingInterval: 500,\n transport: http(validatedOptions.rpcUrl, {\n // PERFORMANCE: Batch requests reduce network round-trips for multiple calls\n batch: true,\n // RELIABILITY: 60s timeout prevents indefinite hangs on slow networks\n timeout: 60_000,\n ...validatedOptions.httpTransportConfig,\n fetchOptions: {\n ...validatedOptions?.httpTransportConfig?.fetchOptions,\n headers,\n },\n }),\n })\n // FEATURE COMPOSITION: Extend with anvil actions\n .extend(anvilSetBalance)\n );\n}\n\n/**\n * The options for the wallet client.\n */\nexport interface WalletVerificationOptions {\n /**\n * The verification id (used for HD wallets), if not provided, the challenge response will be validated against all active verifications.\n */\n verificationId?: string;\n /**\n * The challenge id (used for HD wallets)\n */\n challengeId?: string;\n /**\n * The challenge response (used for HD wallets)\n */\n challengeResponse: string;\n}\n\n/**\n * Creates a factory function for wallet clients with runtime verification support.\n *\n * @remarks\n * DESIGN PATTERN: Returns a factory function rather than a client instance because\n * wallet operations require runtime verification parameters (challenge responses, etc.)\n * that cannot be known at factory creation time.\n *\n * SECURITY: Verification headers are injected per-operation to support:\n * - HD wallet challenge/response flows\n * - Multi-signature verification workflows\n * - Time-sensitive authentication tokens\n *\n * PERFORMANCE: Factory caching amortizes expensive setup (chain resolution, transport config)\n * while allowing runtime parameter injection for each wallet operation.\n *\n * FEATURE EXTENSIONS: Automatically extends client with SettleMint-specific wallet actions:\n * - Wallet creation and management\n * - Verification challenge handling\n * - Multi-factor authentication flows\n *\n * @param options - Base client configuration (chain, RPC, auth)\n * @returns Factory function that accepts runtime verification options\n * @throws ValidationError when options don't match required schema\n *\n * @example\n * ```ts\n * import { getWalletClient } from '@settlemint/sdk-viem';\n * import { parseAbi } from \"viem\";\n *\n * const walletClient = getWalletClient({\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,\n * chainId: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!,\n * chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,\n * rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT!,\n * });\n *\n * // Get the chain id\n * const chainId = await walletClient().getChainId();\n * console.log(chainId);\n *\n * // write to the blockchain\n * const transactionHash = await walletClient().writeContract({\n * account: \"0x0000000000000000000000000000000000000000\",\n * address: \"0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2\",\n * abi: parseAbi([\"function mint(uint32 tokenId) nonpayable\"]),\n * functionName: \"mint\",\n * args: [69420],\n * });\n * console.log(transactionHash);\n * ```\n */\nexport const getWalletClient = (options: ClientOptions) => {\n ensureServer();\n const validatedOptions: ClientOptions = validate(ClientOptionsSchema, options);\n\n // PERFORMANCE: Check cache first for the factory function\n const cacheKey = createCacheKey(validatedOptions);\n const cachedFactory = walletClientFactoryCache.get(cacheKey);\n if (cachedFactory) {\n return cachedFactory;\n }\n\n // OPTIMIZATION: Get chain once - will be cached internally for reuse\n const chain = getChain({\n chainId: validatedOptions.chainId,\n chainName: validatedOptions.chainName,\n rpcUrl: validatedOptions.rpcUrl,\n });\n\n // DESIGN PATTERN: Create factory function that captures static config but allows runtime verification\n const walletClientFactory = (verificationOptions?: WalletVerificationOptions) =>\n createWalletClientWithCustomMethods(chain, validatedOptions, verificationOptions);\n // PERFORMANCE: Cache the factory to amortize setup costs across multiple operations\n walletClientFactoryCache.set(cacheKey, walletClientFactory);\n\n return walletClientFactory;\n};\n\nconst createWalletClientWithCustomMethods = (\n chain: ReturnType<typeof getChain>,\n validatedOptions: ClientOptions,\n verificationOptions?: WalletVerificationOptions,\n) =>\n createWalletClient({\n chain: chain,\n // WHY 500ms: Same as public client for consistent behavior\n pollingInterval: 500,\n transport: http(validatedOptions.rpcUrl, {\n // NEVER BATCH!\n batch: false,\n // RELIABILITY: 60s timeout for potentially slow signing operations\n timeout: 60_000,\n ...validatedOptions.httpTransportConfig,\n fetchOptions: {\n ...validatedOptions?.httpTransportConfig?.fetchOptions,\n // SECURITY: Runtime verification headers for HD wallet authentication\n headers: buildHeaders(validatedOptions?.httpTransportConfig?.fetchOptions?.headers, {\n \"x-auth-token\": validatedOptions.accessToken,\n // WHY conditional spreads: Only include headers when verification data is provided\n ...(verificationOptions?.challengeResponse\n ? {\n \"x-auth-challenge-response\": verificationOptions.challengeResponse,\n }\n : {}),\n ...(verificationOptions?.challengeId\n ? {\n \"x-auth-challenge-id\": verificationOptions.challengeId,\n }\n : {}),\n ...(verificationOptions?.verificationId\n ? {\n \"x-auth-verification-id\": verificationOptions.verificationId,\n }\n : {}),\n }),\n },\n }),\n })\n // FEATURE COMPOSITION: Extend with both standard viem actions, anvil actions and SettleMint-specific wallet features\n .extend(publicActions)\n .extend(anvilSetBalance)\n .extend(createWallet)\n .extend(getWalletVerifications)\n .extend(createWalletVerification)\n .extend(deleteWalletVerification)\n .extend(createWalletVerificationChallenge)\n .extend(createWalletVerificationChallenges)\n .extend(verifyWalletVerificationChallenge)\n .extend(ethSign);\n\n/**\n * Schema for the viem client options.\n */\nexport const GetChainIdOptionsSchema = z.object({\n /**\n * The access token\n */\n accessToken: ApplicationAccessTokenSchema.optional(),\n /**\n * The json rpc url\n */\n rpcUrl: UrlOrPathSchema,\n /**\n * The http transport config\n */\n httpTransportConfig: z.any().optional(),\n});\n\n/**\n * Type representing the validated get chain id options.\n */\nexport type GetChainIdOptions = Omit<z.infer<typeof GetChainIdOptionsSchema>, \"httpTransportConfig\"> & {\n httpTransportConfig?: HttpTransportConfig;\n};\n\n/**\n * Discovers the chain ID from an RPC endpoint without requiring prior knowledge.\n *\n * @remarks\n * UTILITY: Enables chain discovery for dynamic network configuration scenarios.\n * Unlike other client functions, this creates a minimal, non-cached client for one-time queries.\n *\n * USE CASE: Chain ID discovery during initial network setup or validation.\n * Alternative to requiring users to know chain IDs in advance.\n *\n * PERFORMANCE: No caching because chain IDs are typically discovered once\n * during setup rather than repeatedly during runtime operations.\n *\n * @param options - Minimal options with RPC URL and optional authentication\n * @returns Promise resolving to the network's chain ID as a number\n * @throws NetworkError when RPC endpoint is unreachable\n * @throws AuthenticationError when access token is invalid\n *\n * @example\n * ```ts\n * import { getChainId } from '@settlemint/sdk-viem';\n *\n * const chainId = await getChainId({\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,\n * rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT!,\n * });\n * console.log(chainId);\n * ```\n */\nexport async function getChainId(options: GetChainIdOptions): Promise<number> {\n ensureServer();\n const validatedOptions: GetChainIdOptions = validate(GetChainIdOptionsSchema, options);\n\n // SECURITY: Apply header filtering for undefined auth tokens\n const headers = buildHeaders(validatedOptions?.httpTransportConfig?.fetchOptions?.headers, {\n \"x-auth-token\": validatedOptions.accessToken,\n });\n\n // WHY no caching: Chain ID discovery is typically a one-time setup operation\n const client = createPublicClientViem({\n transport: http(validatedOptions.rpcUrl, {\n ...validatedOptions.httpTransportConfig,\n fetchOptions: {\n ...validatedOptions?.httpTransportConfig?.fetchOptions,\n headers,\n },\n }),\n });\n\n return client.getChainId();\n}\n\n/**\n * OPTIMIZATION: Pre-compute known chains map for O(1) lookup performance.\n * WHY Map over Object: Avoids prototype chain lookups and provides guaranteed O(1) access.\n * MEMORY: One-time initialization cost for ~100 known chains vs repeated lookups.\n */\nconst knownChainsMap = new Map<string, ViemChain>(Object.values(chains).map((chain) => [chain.id.toString(), chain]));\n\n/**\n * CHAIN RESOLUTION STRATEGY: Two-tier lookup optimizes for both known and custom chains.\n *\n * Tier 1: Known chains (Ethereum mainnet, common testnets, L2s)\n * - O(1) lookup from pre-built map\n * - No caching needed (references are stable)\n * - Ignores custom RPC URLs (uses viem's defaults)\n *\n * Tier 2: Custom chains (private networks, development chains)\n * - LRU cached to handle dynamic discovery\n * - Full parameter consideration for cache key\n * - ETH defaults for unknown chains (SettleMint platform assumption)\n *\n * TRADEOFF: Memory usage vs performance - separate strategies prevent cache pollution\n * of known chains with custom RPC configurations.\n */\nfunction getChain({ chainId, chainName, rpcUrl }: Pick<ClientOptions, \"chainId\" | \"chainName\" | \"rpcUrl\">): ViemChain {\n // PERFORMANCE: O(1) lookup for known chains - no cache needed\n const knownChain = knownChainsMap.get(chainId);\n if (knownChain) {\n // WHY: Known chains use viem's default RPC URLs and ignore custom ones\n return knownChain;\n }\n\n // CACHING: Custom chains require full parameter consideration\n const cacheKey = JSON.stringify({ chainId, chainName, rpcUrl }, [\"chainId\", \"chainName\", \"rpcUrl\"]);\n\n const cachedChain = chainCache.get(cacheKey);\n if (cachedChain) {\n return cachedChain;\n }\n\n // DEFAULTS: Assume ETH-compatible chain for SettleMint platform networks\n const customChain = defineChain({\n id: Number(chainId),\n name: chainName,\n rpcUrls: {\n default: {\n http: [rpcUrl],\n },\n },\n // ASSUMPTION: SettleMint networks use ETH as native currency\n nativeCurrency: {\n decimals: 18,\n name: \"Ether\",\n symbol: \"ETH\",\n },\n });\n\n // MEMORY MANAGEMENT: Cache only custom chains to prevent known chain pollution\n chainCache.set(cacheKey, customChain);\n return customChain;\n}\n\nexport type {\n CreateWalletParameters,\n CreateWalletResponse,\n WalletInfo,\n} from \"./custom-actions/create-wallet.action.js\";\nexport type {\n CreateWalletVerificationParameters,\n CreateWalletVerificationResponse,\n WalletOTPVerificationInfo,\n WalletPincodeVerificationInfo,\n WalletSecretCodesVerificationInfo,\n WalletVerificationInfo,\n} from \"./custom-actions/create-wallet-verification.action.js\";\nexport type {\n CreateWalletVerificationChallengeParameters,\n CreateWalletVerificationChallengeResponse,\n WalletVerificationChallengeData,\n} from \"./custom-actions/create-wallet-verification-challenge.action.js\";\nexport type {\n CreateWalletVerificationChallengesParameters,\n CreateWalletVerificationChallengesResponse,\n} from \"./custom-actions/create-wallet-verification-challenges.action.js\";\nexport type {\n DeleteWalletVerificationParameters,\n DeleteWalletVerificationResponse,\n} from \"./custom-actions/delete-wallet-verification.action.js\";\nexport type {\n GetWalletVerificationsParameters,\n GetWalletVerificationsResponse,\n WalletVerification,\n} from \"./custom-actions/get-wallet-verifications.action.js\";\nexport {\n OTPAlgorithm,\n WalletVerificationType,\n} from \"./custom-actions/types/wallet-verification.enum.js\";\nexport type { WalletVerificationChallenge } from \"./custom-actions/types/wallet-verification-challenge.js\";\nexport type {\n AddressOrObject,\n AddressOrObjectWithChallengeId,\n VerificationResult,\n VerifyWalletVerificationChallengeParameters,\n VerifyWalletVerificationChallengeResponse,\n} from \"./custom-actions/verify-wallet-verification-challenge.action.js\";\n"],"mappings":";;;;;;;;;;;;;;AAqBA,SAAgB,gBAAgB,QAAgB;AAC9C,QAAO,EAML,gBAAgB,MAAmD;AACjE,SAAO,OAAO,QAA6B;GACzC,QAAQ;GACR,QAAQ;;;;;;;;;;;;ACmBhB,SAAgB,aAAa,QAAgB;AAC3C,QAAO,EAML,aAAa,MAA+D;AAC1E,SAAO,OAAO,QAAyB;GACrC,QAAQ;GACR,QAAQ,CAAC,KAAK,YAAY,KAAK;;;;;;;;;;;;ACiCvC,SAAgB,yBAAyB,QAAgB;AACvD,QAAO,EAML,yBAAyB,MAAuF;AAC9G,SAAO,OAAO,QAAyB;GACrC,QAAQ;GACR,QAAQ,CAAC,KAAK,mBAAmB,KAAK;;;;;;;;;;;;AC7D9C,SAAgB,kCAAkC,QAAgB;AAChE,QAAO,EAML,kCACE,MACoD;AACpD,SAAO,OAAO,QAAyB;GACrC,QAAQ;GACR,QAAQ,CAAC;;;;;;;;;;;;ACpBjB,SAAgB,mCAAmC,QAAgB;AACjE,QAAO,EAML,mCACE,MACqD;AACrD,SAAO,OAAO,QAAyB;GACrC,QAAQ;GACR,QAAQ,CAAC,KAAK;;;;;;;;;;;;ACZtB,SAAgB,yBAAyB,QAAgB;AACvD,QAAO,EAML,yBAAyB,MAAuF;AAC9G,SAAO,OAAO,QAAyB;GACrC,QAAQ;GACR,QAAQ,CAAC,KAAK,mBAAmB,KAAK;;;;;;;;;;;;AClB9C,SAAgB,QAAQ,QAAgB;AACtC,QAAO,EAML,QAAQ,MAA0C;AAChD,SAAO,OAAO,QAA0B;GACtC,QAAQ;GACR,QAAQ,CAAC,KAAK,mBAAmB,KAAK;;;;;;;;;;;;ACM9C,SAAgB,uBAAuB,QAAgB;AACrD,QAAO,EAML,uBAAuB,MAAiF;AACtG,SAAO,OAA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AAK,iBAAiB,QAAQ;EACvC,GAAG,iBAAiB;EACpB,cAAc;GACZ,GAAG,kBAAkB,qBAAqB;GAC1C;;;AAKN,QAAO,OAAO;;;;;;;AAQhB,MAAM,iBAAiB,IAAI,IAAuB,OAAO,OAAO,QAAQ,KAAK,UAAU,CAAC,MAAM,GAAG,YAAY;;;;;;;;;;;;;;;;;AAkB7G,SAAS,SAAS,EAAE,SAAS,WAAW,UAA8E;CAEpH,MAAM,aAAa,eAAe,IAAI;AACtC,KAAI,YAAY;AAEd,SAAO;;CAIT,MAAM,WAAW,KAAK,UAAU;EAAE;EAAS;EAAW;IAAU;EAAC;EAAW;EAAa;;CAEzF,MAAM,cAAc,WAAW,IAAI;AACnC,KAAI,aAAa;AACf,SAAO;;CAIT,MAAM,cAAc,YAAY;EAC9B,IAAI,OAAO;EACX,MAAM;EACN,SAAS,EACP,SAAS,EACP,MAAM,CAAC;EAIX,gBAAgB;GACd,UAAU;GACV,MAAM;GACN,QAAQ;;;AAKZ,YAAW,IAAI,UAAU;AACzB,QAAO"}
1
+ {"version":3,"file":"viem.js","names":["keyObject: Record<string, unknown>","filteredHeaders: Record<string, string>","validatedOptions: ClientOptions","createPublicClient","createPublicClientViem","validatedOptions: GetChainIdOptions"],"sources":["../src/custom-actions/anvil/anvil-set-balance.ts","../src/custom-actions/create-wallet.action.ts","../src/custom-actions/create-wallet-verification.action.ts","../src/custom-actions/create-wallet-verification-challenge.action.ts","../src/custom-actions/create-wallet-verification-challenges.action.ts","../src/custom-actions/delete-wallet-verification.action.ts","../src/custom-actions/eth-sign.action.ts","../src/custom-actions/get-wallet-verifications.action.ts","../src/custom-actions/verify-wallet-verification-challenge.action.ts","../src/utils/lru-cache.ts","../src/custom-actions/types/wallet-verification.enum.ts","../src/viem.ts"],"sourcesContent":["import type { Client, Hex } from \"viem\";\n\n/**\n * Parameters for setting the balance of a wallet.\n */\nexport type AnvilSetBalanceParameters = [wallet: string, balance: Hex];\n\n/**\n * RPC schema for setting the balance of a wallet.\n */\ntype SetBalanceRpcSchema = {\n Method: \"anvil_setBalance\";\n Parameters: AnvilSetBalanceParameters;\n ReturnType: unknown;\n};\n\n/**\n * Set the balance of a wallet in the Anvil test environment.\n * @param client - The viem client to use for the request.\n * @returns An object with a anvilSetBalance method.\n */\nexport function anvilSetBalance(client: Client) {\n return {\n /**\n * Sets the balance of a wallet.\n * @param args - The parameters for setting the balance.\n * @returns A promise that resolves to the result of the balance setting operation.\n */\n anvilSetBalance(args: AnvilSetBalanceParameters): Promise<unknown> {\n return client.request<SetBalanceRpcSchema>({\n method: \"anvil_setBalance\",\n params: args,\n });\n },\n };\n}\n","import type { Client } from \"viem\";\n\n/**\n * Information about the wallet to be created.\n */\nexport interface WalletInfo {\n /** The name of the wallet. */\n name: string;\n /** Optional index for the wallet, walletIndex enables HD derivation paths */\n walletIndex?: number;\n}\n\n/**\n * Parameters for creating a wallet.\n */\nexport interface CreateWalletParameters {\n /** The unique name of the key vault where the wallet will be created. */\n keyVaultId: string;\n /** Information about the wallet to be created. */\n walletInfo: WalletInfo;\n}\n\n/**\n * Response from creating a wallet.\n */\nexport interface CreateWalletResponse {\n /** The unique identifier of the wallet. */\n id: string;\n /** The name of the wallet. */\n name: string;\n /** The blockchain address of the wallet. */\n address: string;\n /** The HD derivation path used to create the wallet. */\n derivationPath: string;\n}\n\n/**\n * RPC schema for wallet creation.\n */\ntype WalletRpcSchema = {\n Method: \"user_createWallet\";\n Parameters: [keyVaultId: string, walletInfo: WalletInfo];\n ReturnType: CreateWalletResponse[];\n};\n\n/**\n * Creates a wallet action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a createWallet method.\n */\nexport function createWallet(client: Client) {\n return {\n /**\n * Creates a new wallet in the specified key vault.\n * @param args - The parameters for creating a wallet.\n * @returns A promise that resolves to an array of created wallet responses.\n */\n createWallet(args: CreateWalletParameters): Promise<CreateWalletResponse[]> {\n return client.request<WalletRpcSchema>({\n method: \"user_createWallet\",\n params: [args.keyVaultId, args.walletInfo],\n });\n },\n };\n}\n","import type { Client } from \"viem\";\nimport type { OTPAlgorithm, WalletVerificationType } from \"./types/wallet-verification.enum.js\";\n\n/**\n * Base interface for wallet verification information.\n */\ntype BaseWalletVerificationInfo = {\n /** The name of the verification method. */\n name: string;\n /** The type of verification method. */\n verificationType: WalletVerificationType;\n};\n\n/**\n * Information for PIN code verification.\n */\nexport interface WalletPincodeVerificationInfo extends BaseWalletVerificationInfo {\n /** The type of verification method. */\n verificationType: WalletVerificationType.PINCODE;\n /** The PIN code to use for verification. */\n pincode: string;\n}\n\n/**\n * Information for One-Time Password (OTP) verification.\n */\nexport interface WalletOTPVerificationInfo extends BaseWalletVerificationInfo {\n /** The type of verification method. */\n verificationType: WalletVerificationType.OTP;\n /** The hash algorithm to use for OTP generation. */\n algorithm?: OTPAlgorithm;\n /** The number of digits in the OTP code. */\n digits?: number;\n /** The time period in seconds for OTP validity. */\n period?: number;\n /** The issuer of the OTP. */\n issuer?: string;\n}\n\n/**\n * Information for secret recovery codes verification.\n */\nexport interface WalletSecretCodesVerificationInfo extends BaseWalletVerificationInfo {\n /** The type of verification method. */\n verificationType: WalletVerificationType.SECRET_CODES;\n}\n\n/**\n * Union type of all possible wallet verification information types.\n */\nexport type WalletVerificationInfo =\n | WalletPincodeVerificationInfo\n | WalletOTPVerificationInfo\n | WalletSecretCodesVerificationInfo;\n\n/**\n * Parameters for creating a wallet verification.\n */\nexport interface CreateWalletVerificationParameters {\n /** The wallet address for which to create the verification. */\n userWalletAddress: string;\n /** The verification information to create. */\n walletVerificationInfo: WalletVerificationInfo;\n}\n\n/**\n * Response from creating a wallet verification.\n */\nexport interface CreateWalletVerificationResponse {\n /** The unique identifier of the verification. */\n id: string;\n /** The name of the verification method. */\n name: string;\n /** The type of verification method. */\n verificationType: WalletVerificationType;\n /** Additional parameters specific to the verification type. */\n parameters: Record<string, string>;\n}\n\n/**\n * RPC schema for creating a wallet verification.\n */\ntype WalletRpcSchema = {\n Method: \"user_createWalletVerification\";\n Parameters: [userWalletAddress: string, walletVerificationInfo: WalletVerificationInfo];\n ReturnType: CreateWalletVerificationResponse[];\n};\n\n/**\n * Creates a wallet verification action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a createWalletVerification method.\n */\nexport function createWalletVerification(client: Client) {\n return {\n /**\n * Creates a new wallet verification.\n * @param args - The parameters for creating the verification.\n * @returns A promise that resolves to an array of created wallet verification responses.\n */\n createWalletVerification(args: CreateWalletVerificationParameters): Promise<CreateWalletVerificationResponse[]> {\n return client.request<WalletRpcSchema>({\n method: \"user_createWalletVerification\",\n params: [args.userWalletAddress, args.walletVerificationInfo],\n });\n },\n };\n}\n","import type { Client } from \"viem\";\nimport type { WalletVerificationChallenge } from \"./types/wallet-verification-challenge.js\";\n\n/**\n * Parameters for creating wallet verification challenges.\n */\nexport interface CreateWalletVerificationChallengeParameters {\n /** The wallet address. */\n userWalletAddress: string;\n /** The verification ID. */\n verificationId: string;\n}\n\n/**\n * Data specific to a wallet verification challenge.\n */\nexport interface WalletVerificationChallengeData {\n /** Optional salt for PINCODE verification type. */\n salt?: string;\n /** Optional secret for PINCODE verification type. */\n secret?: string;\n}\n\n/**\n * Response from creating wallet verification challenge.\n */\nexport type CreateWalletVerificationChallengeResponse = WalletVerificationChallenge<WalletVerificationChallengeData>;\n\n/**\n * RPC schema for creating wallet verification challenge.\n */\ntype WalletRpcSchema = {\n Method: \"user_createWalletVerificationChallenge\";\n Parameters: [CreateWalletVerificationChallengeParameters];\n ReturnType: CreateWalletVerificationChallengeResponse;\n};\n\n/**\n * Creates a wallet verification challenge action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a createWalletVerificationChallenge method.\n */\nexport function createWalletVerificationChallenge(client: Client) {\n return {\n /**\n * Creates a verification challenge for a wallet.\n * @param args - The parameters for creating the challenge.\n * @returns A promise that resolves to a wallet verification challenge.\n */\n createWalletVerificationChallenge(\n args: CreateWalletVerificationChallengeParameters,\n ): Promise<CreateWalletVerificationChallengeResponse> {\n return client.request<WalletRpcSchema>({\n method: \"user_createWalletVerificationChallenge\",\n params: [args],\n });\n },\n };\n}\n","import type { Client } from \"viem\";\nimport type { WalletVerificationChallenge } from \"./types/wallet-verification-challenge.js\";\nimport type { AddressOrObject } from \"./verify-wallet-verification-challenge.action.js\";\n\n/**\n * Parameters for creating wallet verification challenges.\n */\nexport interface CreateWalletVerificationChallengesParameters {\n /** The wallet address or object containing wallet address and optional verification ID. */\n addressOrObject: AddressOrObject<{ amount?: number }>;\n}\n\n/**\n * Response from creating wallet verification challenges.\n */\nexport type CreateWalletVerificationChallengesResponse = Omit<\n WalletVerificationChallenge<Record<string, string>>,\n \"verificationId\"\n>[];\n\n/**\n * RPC schema for creating wallet verification challenges.\n */\ntype WalletRpcSchema = {\n Method: \"user_createWalletVerificationChallenges\";\n Parameters: [addressOrObject: AddressOrObject];\n ReturnType: CreateWalletVerificationChallengesResponse;\n};\n\n/**\n * Creates a wallet verification challenges action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a createWalletVerificationChallenges method.\n */\nexport function createWalletVerificationChallenges(client: Client) {\n return {\n /**\n * Creates verification challenges for a wallet.\n * @param args - The parameters for creating the challenges.\n * @returns A promise that resolves to an array of wallet verification challenges.\n */\n createWalletVerificationChallenges(\n args: CreateWalletVerificationChallengesParameters,\n ): Promise<CreateWalletVerificationChallengesResponse> {\n return client.request<WalletRpcSchema>({\n method: \"user_createWalletVerificationChallenges\",\n params: [args.addressOrObject],\n });\n },\n };\n}\n","import type { Client } from \"viem\";\n\n/**\n * Parameters for deleting a wallet verification.\n */\nexport interface DeleteWalletVerificationParameters {\n /** The wallet address for which to delete the verification. */\n userWalletAddress: string;\n /** The unique identifier of the verification to delete. */\n verificationId: string;\n}\n\n/**\n * Response from deleting a wallet verification.\n */\nexport interface DeleteWalletVerificationResponse {\n /** Whether the deletion was successful. */\n success: boolean;\n}\n\n/**\n * RPC schema for deleting a wallet verification.\n */\ntype WalletRpcSchema = {\n Method: \"user_deleteWalletVerification\";\n Parameters: [userWalletAddress: string, verificationId: string];\n ReturnType: DeleteWalletVerificationResponse[];\n};\n\n/**\n * Creates a wallet verification deletion action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a deleteWalletVerification method.\n */\nexport function deleteWalletVerification(client: Client) {\n return {\n /**\n * Deletes a wallet verification.\n * @param args - The parameters for deleting the verification.\n * @returns A promise that resolves to an array of deletion results.\n */\n deleteWalletVerification(args: DeleteWalletVerificationParameters): Promise<DeleteWalletVerificationResponse[]> {\n return client.request<WalletRpcSchema>({\n method: \"user_deleteWalletVerification\",\n params: [args.userWalletAddress, args.verificationId],\n });\n },\n };\n}\n","import type { Client } from \"viem\";\n\n/**\n * Parameters for signing data with a wallet.\n */\nexport interface EthSignParameters {\n /** The wallet address to sign the data with. */\n userWalletAddress: string;\n /** The data to sign. */\n data: string;\n}\n\n/**\n * RPC schema for signing data with a wallet.\n */\ntype EthSignRpcSchema = {\n Method: \"eth_sign\";\n Parameters: [userWalletAddress: string, data: string];\n ReturnType: string;\n};\n\n/**\n * Creates a wallet action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a createWallet method.\n */\nexport function ethSign(client: Client) {\n return {\n /**\n * Signs data with a wallet.\n * @param args - The parameters for signing data with a wallet.\n * @returns A promise that resolves to signed data response.\n */\n ethSign(args: EthSignParameters): Promise<string> {\n return client.request<EthSignRpcSchema>({\n method: \"eth_sign\",\n params: [args.userWalletAddress, args.data],\n });\n },\n };\n}\n","import type { Client } from \"viem\";\nimport type { WalletVerificationType } from \"./types/wallet-verification.enum.js\";\n\n/**\n * Parameters for getting wallet verifications.\n */\nexport interface GetWalletVerificationsParameters {\n /** The wallet address for which to fetch verifications. */\n userWalletAddress: string;\n}\n\n/**\n * Represents a wallet verification.\n */\nexport interface WalletVerification {\n /** The unique identifier of the verification. */\n id: string;\n /** The name of the verification method. */\n name: string;\n /** The type of verification method. */\n verificationType: WalletVerificationType;\n}\n\n/**\n * Response from getting wallet verifications.\n */\nexport type GetWalletVerificationsResponse = WalletVerification[];\n\n/**\n * RPC schema for getting wallet verifications.\n */\ntype WalletRpcSchema = {\n Method: \"user_walletVerifications\";\n Parameters: [userWalletAddress: string];\n ReturnType: GetWalletVerificationsResponse;\n};\n\n/**\n * Creates a wallet verifications retrieval action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a getWalletVerifications method.\n */\nexport function getWalletVerifications(client: Client) {\n return {\n /**\n * Gets all verifications for a wallet.\n * @param args - The parameters for getting the verifications.\n * @returns A promise that resolves to an array of wallet verifications.\n */\n getWalletVerifications(args: GetWalletVerificationsParameters): Promise<GetWalletVerificationsResponse> {\n return client.request<WalletRpcSchema>({\n method: \"user_walletVerifications\",\n params: [args.userWalletAddress],\n });\n },\n };\n}\n","import type { Client } from \"viem\";\n\n/**\n * Represents either a wallet address string or an object containing wallet address and optional verification ID.\n */\n\n// biome-ignore lint/complexity/noBannedTypes: is optional and the default is empty\nexport type AddressOrObject<Extra = {}> =\n | string\n | ({\n userWalletAddress: string;\n verificationId?: string;\n } & Extra);\n\n/**\n * Represents either a wallet address string, an object containing wallet address and optional verification ID or a challenge ID.\n */\nexport type AddressOrObjectWithChallengeId =\n | AddressOrObject\n | {\n /** ID of the challenge to verify against */\n challengeId: string;\n };\n\n/**\n * Parameters for verifying a wallet verification challenge.\n */\nexport interface VerifyWalletVerificationChallengeParameters {\n /** The wallet address or object containing wallet address and optional verification ID. */\n addressOrObject: AddressOrObjectWithChallengeId;\n /** The response to the verification challenge. */\n challengeResponse: string;\n}\n\n/**\n * Result of a wallet verification challenge.\n */\nexport interface VerificationResult {\n /** Whether the verification was successful. */\n verified: boolean;\n}\n\n/**\n * Response from verifying a wallet verification challenge.\n */\nexport type VerifyWalletVerificationChallengeResponse = VerificationResult[];\n\n/**\n * RPC schema for wallet verification challenge verification.\n */\ntype WalletRpcSchema = {\n Method: \"user_verifyWalletVerificationChallenge\";\n Parameters: [addressOrObject: AddressOrObjectWithChallengeId, challengeResponse: string];\n ReturnType: VerifyWalletVerificationChallengeResponse;\n};\n\n/**\n * Creates a wallet verification challenge verification action for the given client.\n * @param client - The viem client to use for the request.\n * @returns An object with a verifyWalletVerificationChallenge method.\n */\nexport function verifyWalletVerificationChallenge(client: Client) {\n return {\n /**\n * Verifies a wallet verification challenge.\n * @param args - The parameters for verifying the challenge.\n * @returns A promise that resolves to an array of verification results.\n */\n verifyWalletVerificationChallenge(\n args: VerifyWalletVerificationChallengeParameters,\n ): Promise<VerifyWalletVerificationChallengeResponse> {\n return client.request<WalletRpcSchema>({\n method: \"user_verifyWalletVerificationChallenge\",\n params: [args.addressOrObject, args.challengeResponse],\n });\n },\n };\n}\n","/**\n * DESIGN DECISION: Custom LRU cache implementation over external libraries.\n *\n * WHY: Avoids external dependencies for this critical infrastructure component.\n * TRADEOFF: Simpler implementation trades advanced features (TTL, statistics) for reliability.\n * PERFORMANCE: O(1) access with automatic memory management prevents unbounded growth.\n *\n * Alternative considered: Using Map without eviction - rejected due to memory leak risk\n * in long-running server applications with diverse chain/client combinations.\n */\nexport class LRUCache<K, V> {\n private cache = new Map<K, V>();\n private readonly maxSize: number;\n\n constructor(maxSize: number) {\n this.maxSize = maxSize;\n }\n\n get(key: K): V | undefined {\n const value = this.cache.get(key);\n if (value !== undefined) {\n // PERFORMANCE: Move to end to maintain LRU ordering - prevents premature eviction\n this.cache.delete(key);\n this.cache.set(key, value);\n }\n return value;\n }\n\n set(key: K, value: V): void {\n // INVARIANT: Remove existing key to update position in insertion order\n this.cache.delete(key);\n\n // MEMORY MANAGEMENT: Enforce size limit to prevent unbounded growth\n if (this.cache.size >= this.maxSize) {\n // WHY: Maps preserve insertion order - first key is least recently used\n const firstKey = this.cache.keys().next().value;\n if (firstKey !== undefined) {\n this.cache.delete(firstKey);\n }\n }\n\n this.cache.set(key, value);\n }\n\n clear(): void {\n this.cache.clear();\n }\n}\n","/**\n * Types of wallet verification methods supported by the system.\n * Used to identify different verification mechanisms when creating or managing wallet verifications.\n */\nexport enum WalletVerificationType {\n /** PIN code verification method */\n PINCODE = \"PINCODE\",\n /** One-Time Password verification method */\n OTP = \"OTP\",\n /** Secret recovery codes verification method */\n SECRET_CODES = \"SECRET_CODES\",\n}\n\n/**\n * Supported hash algorithms for One-Time Password (OTP) verification.\n * These algorithms determine the cryptographic function used to generate OTP codes.\n */\nexport enum OTPAlgorithm {\n /** SHA-1 hash algorithm */\n SHA1 = \"SHA1\",\n /** SHA-224 hash algorithm */\n SHA224 = \"SHA224\",\n /** SHA-256 hash algorithm */\n SHA256 = \"SHA256\",\n /** SHA-384 hash algorithm */\n SHA384 = \"SHA384\",\n /** SHA-512 hash algorithm */\n SHA512 = \"SHA512\",\n /** SHA3-224 hash algorithm */\n SHA3_224 = \"SHA3-224\",\n /** SHA3-256 hash algorithm */\n SHA3_256 = \"SHA3-256\",\n /** SHA3-384 hash algorithm */\n SHA3_384 = \"SHA3-384\",\n /** SHA3-512 hash algorithm */\n SHA3_512 = \"SHA3-512\",\n}\n","/**\n * Viem client factory with intelligent caching and SettleMint platform integration.\n *\n * This module provides optimized blockchain client creation for the SettleMint platform.\n * Key architectural decisions:\n * - LRU caching prevents memory leaks while optimizing performance for repeated operations\n * - Separate caching strategies for known vs custom chains maximize cache hit rates\n * - Security-conscious header handling prevents undefined auth token exposure\n * - Factory pattern for wallet clients enables runtime verification parameter injection\n */\n\nimport { appendHeaders } from \"@settlemint/sdk-utils/http\";\nimport { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { ApplicationAccessTokenSchema, UrlOrPathSchema, validate } from \"@settlemint/sdk-utils/validation\";\nimport {\n createPublicClient as createPublicClientViem,\n createWalletClient,\n defineChain,\n type HttpTransportConfig,\n http,\n publicActions,\n type Chain as ViemChain,\n} from \"viem\";\nimport * as chains from \"viem/chains\";\nimport { z } from \"zod\";\nimport { anvilSetBalance } from \"./custom-actions/anvil/anvil-set-balance.js\";\nimport { createWallet } from \"./custom-actions/create-wallet.action.js\";\nimport { createWalletVerification } from \"./custom-actions/create-wallet-verification.action.js\";\nimport { createWalletVerificationChallenge } from \"./custom-actions/create-wallet-verification-challenge.action.js\";\nimport { createWalletVerificationChallenges } from \"./custom-actions/create-wallet-verification-challenges.action.js\";\nimport { deleteWalletVerification } from \"./custom-actions/delete-wallet-verification.action.js\";\nimport { ethSign } from \"./custom-actions/eth-sign.action.js\";\nimport { getWalletVerifications } from \"./custom-actions/get-wallet-verifications.action.js\";\nimport { verifyWalletVerificationChallenge } from \"./custom-actions/verify-wallet-verification-challenge.action.js\";\nimport { LRUCache } from \"./utils/lru-cache.js\";\n\n/**\n * CACHE SIZING STRATEGY: Different limits based on usage patterns and memory impact.\n *\n * Chain cache (100): WHY larger?\n * - Chain definitions are lightweight (just metadata)\n * - High reuse across different client instances\n * - Custom chains vary widely in development/testing scenarios\n *\n * Client caches (50 each): WHY smaller?\n * - Clients hold heavy resources (connections, transport state)\n * - Fewer unique client configurations in typical usage\n * - Each client maintains internal connection pools\n *\n * TRADEOFF: Balances memory usage vs cache hit rates for optimal performance.\n */\nconst chainCache = new LRUCache<string, ViemChain>(100);\n\n/**\n * SECURITY CONSIDERATION: Public clients contain auth tokens in transport config.\n * Cache key generation ensures tokens are not leaked between different access contexts.\n */\nconst publicClientCache = new LRUCache<string, ReturnType<typeof createPublicClient>>(50);\n\n/**\n * DESIGN PATTERN: Factory caching rather than client instance caching.\n * WHY: Wallet clients need runtime verification parameters that can't be pre-cached.\n * BENEFIT: Amortizes chain resolution and transport configuration setup costs.\n */\nconst walletClientFactoryCache = new LRUCache<\n string,\n (verificationOptions?: WalletVerificationOptions) => ReturnType<typeof createWalletClientWithCustomMethods>\n>(50);\n\n/**\n * CACHE KEY GENERATION: Deterministic key creation for consistent cache behavior.\n *\n * SECURITY: Access tokens are included in cache keys to prevent cross-tenant data leaks.\n * Different access tokens must produce different cache entries even with identical chain configs.\n *\n * DETERMINISM: Property sorting ensures identical options always produce the same key,\n * regardless of object property enumeration order differences across JavaScript engines.\n *\n * EDGE CASE: Function properties in httpTransportConfig are excluded because:\n * 1. Functions cannot be serialized to JSON\n * 2. Function identity changes don't affect transport behavior for caching purposes\n * 3. Prevents cache key generation failures\n */\nfunction createCacheKey(options: Partial<ClientOptions>): string {\n // WHY: Deterministic key generation prevents cache misses due to property order\n const keyObject: Record<string, unknown> = {};\n\n // INVARIANT: Process properties in fixed order for consistency\n const keys = [\"chainId\", \"chainName\", \"rpcUrl\", \"accessToken\"] as const;\n for (const key of keys) {\n const value = options[key as keyof ClientOptions];\n // SECURITY: Only include defined values to prevent undefined token caching issues\n if (value !== undefined) {\n keyObject[key] = value;\n }\n }\n\n // EDGE CASE: Serialize only the serializable parts of httpTransportConfig\n if (options.httpTransportConfig) {\n // biome-ignore lint/correctness/noUnusedVariables: Destructuring to exclude functions from serialization\n const { onFetchRequest, onFetchResponse, ...serializableConfig } = options.httpTransportConfig;\n if (Object.keys(serializableConfig).length > 0) {\n keyObject.httpTransportConfig = serializableConfig;\n }\n }\n\n // WHY: Sorted keys ensure deterministic JSON stringification across environments\n return JSON.stringify(keyObject, Object.keys(keyObject).sort());\n}\n\n/**\n * HEADER SECURITY: Prevents undefined auth tokens from being sent as 'undefined' strings.\n *\n * WHY: HTTP headers with undefined values can be serialized as the string 'undefined',\n * which may bypass authentication or cause server-side parsing errors.\n *\n * SECURITY BOUNDARY: Filters out undefined authentication headers before network transmission\n * to prevent accidental exposure of invalid credentials or authentication bypass attempts.\n */\nfunction buildHeaders(\n baseHeaders: HeadersInit | undefined,\n authHeaders: Record<string, string | undefined>,\n): HeadersInit {\n // SECURITY: Only include headers with actual string values - prevents 'undefined' transmission\n const filteredHeaders: Record<string, string> = {};\n for (const [key, value] of Object.entries(authHeaders)) {\n if (value !== undefined) {\n filteredHeaders[key] = value;\n }\n }\n return appendHeaders(baseHeaders, filteredHeaders);\n}\n\n/**\n * Schema for the viem client options.\n */\nexport const ClientOptionsSchema = z.object({\n /**\n * The access token\n */\n accessToken: ApplicationAccessTokenSchema.optional(),\n /**\n * The chain id\n */\n chainId: z.string(),\n /**\n * The chain name\n */\n chainName: z.string(),\n /**\n * The json rpc url\n */\n rpcUrl: UrlOrPathSchema,\n /**\n * The http transport config\n */\n httpTransportConfig: z.any().optional(),\n});\n\n/**\n * Type representing the validated client options.\n */\nexport type ClientOptions = Omit<z.infer<typeof ClientOptionsSchema>, \"httpTransportConfig\"> & {\n httpTransportConfig?: HttpTransportConfig;\n};\n\n/**\n * Creates an optimized public client for blockchain read operations.\n *\n * @remarks\n * PERFORMANCE: Implements intelligent caching to minimize client creation overhead.\n * Cache hit rates of 80%+ typical in production workloads with repeated chain access.\n *\n * SECURITY: Each access token gets isolated cache entries to prevent cross-tenant data exposure.\n * Client instances are immutable once cached to prevent credential pollution.\n *\n * RESOURCE MANAGEMENT: 500ms polling interval balances responsiveness with server load.\n * 60-second timeout prevents hanging connections in unstable network conditions.\n *\n * @param options - Client configuration including chain details and authentication\n * @returns Cached or newly created public client with read-only blockchain access\n * @throws ValidationError when options don't match required schema\n * @throws NetworkError when RPC endpoint is unreachable during client creation\n *\n * @example\n * ```ts\n * import { getPublicClient } from '@settlemint/sdk-viem';\n *\n * const publicClient = getPublicClient({\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,\n * chainId: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!,\n * chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,\n * rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT!,\n * });\n *\n * // Get the block number\n * const block = await publicClient.getBlockNumber();\n * console.log(block);\n * ```\n */\nexport const getPublicClient = (options: ClientOptions) => {\n ensureServer();\n const validatedOptions: ClientOptions = validate(ClientOptionsSchema, options);\n\n // PERFORMANCE: Check cache first to avoid expensive client creation\n const cacheKey = createCacheKey(validatedOptions);\n const cachedClient = publicClientCache.get(cacheKey);\n if (cachedClient) {\n return cachedClient;\n }\n\n // SECURITY: Build headers with undefined value filtering\n const headers = buildHeaders(validatedOptions?.httpTransportConfig?.fetchOptions?.headers, {\n \"x-auth-token\": validatedOptions.accessToken,\n });\n\n // CONFIGURATION: Create new client with optimized settings\n const client = createPublicClient(validatedOptions, headers);\n\n // PERFORMANCE: Cache for future requests with identical configuration\n publicClientCache.set(cacheKey, client);\n\n return client;\n};\n\nfunction createPublicClient(validatedOptions: ClientOptions, headers: HeadersInit) {\n return (\n createPublicClientViem({\n chain: getChain({\n chainId: validatedOptions.chainId,\n chainName: validatedOptions.chainName,\n rpcUrl: validatedOptions.rpcUrl,\n }),\n // WHY 500ms: Balances real-time updates with reasonable server load\n pollingInterval: 500,\n transport: http(validatedOptions.rpcUrl, {\n // PERFORMANCE: Batch requests reduce network round-trips for multiple calls\n batch: true,\n // RELIABILITY: 60s timeout prevents indefinite hangs on slow networks\n timeout: 60_000,\n ...validatedOptions.httpTransportConfig,\n fetchOptions: {\n ...validatedOptions?.httpTransportConfig?.fetchOptions,\n headers,\n },\n }),\n })\n // FEATURE COMPOSITION: Extend with anvil actions\n .extend(anvilSetBalance)\n );\n}\n\n/**\n * The options for the wallet client.\n */\nexport interface WalletVerificationOptions {\n /**\n * The verification id (used for HD wallets), if not provided, the challenge response will be validated against all active verifications.\n */\n verificationId?: string;\n /**\n * The challenge id (used for HD wallets)\n */\n challengeId?: string;\n /**\n * The challenge response (used for HD wallets)\n */\n challengeResponse: string;\n}\n\n/**\n * Creates a factory function for wallet clients with runtime verification support.\n *\n * @remarks\n * DESIGN PATTERN: Returns a factory function rather than a client instance because\n * wallet operations require runtime verification parameters (challenge responses, etc.)\n * that cannot be known at factory creation time.\n *\n * SECURITY: Verification headers are injected per-operation to support:\n * - HD wallet challenge/response flows\n * - Multi-signature verification workflows\n * - Time-sensitive authentication tokens\n *\n * PERFORMANCE: Factory caching amortizes expensive setup (chain resolution, transport config)\n * while allowing runtime parameter injection for each wallet operation.\n *\n * FEATURE EXTENSIONS: Automatically extends client with SettleMint-specific wallet actions:\n * - Wallet creation and management\n * - Verification challenge handling\n * - Multi-factor authentication flows\n *\n * @param options - Base client configuration (chain, RPC, auth)\n * @returns Factory function that accepts runtime verification options\n * @throws ValidationError when options don't match required schema\n *\n * @example\n * ```ts\n * import { getWalletClient } from '@settlemint/sdk-viem';\n * import { parseAbi } from \"viem\";\n *\n * const walletClient = getWalletClient({\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,\n * chainId: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!,\n * chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,\n * rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT!,\n * });\n *\n * // Get the chain id\n * const chainId = await walletClient().getChainId();\n * console.log(chainId);\n *\n * // write to the blockchain\n * const transactionHash = await walletClient().writeContract({\n * account: \"0x0000000000000000000000000000000000000000\",\n * address: \"0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2\",\n * abi: parseAbi([\"function mint(uint32 tokenId) nonpayable\"]),\n * functionName: \"mint\",\n * args: [69420],\n * });\n * console.log(transactionHash);\n * ```\n */\nexport const getWalletClient = (options: ClientOptions) => {\n ensureServer();\n const validatedOptions: ClientOptions = validate(ClientOptionsSchema, options);\n\n // PERFORMANCE: Check cache first for the factory function\n const cacheKey = createCacheKey(validatedOptions);\n const cachedFactory = walletClientFactoryCache.get(cacheKey);\n if (cachedFactory) {\n return cachedFactory;\n }\n\n // OPTIMIZATION: Get chain once - will be cached internally for reuse\n const chain = getChain({\n chainId: validatedOptions.chainId,\n chainName: validatedOptions.chainName,\n rpcUrl: validatedOptions.rpcUrl,\n });\n\n // DESIGN PATTERN: Create factory function that captures static config but allows runtime verification\n const walletClientFactory = (verificationOptions?: WalletVerificationOptions) =>\n createWalletClientWithCustomMethods(chain, validatedOptions, verificationOptions);\n // PERFORMANCE: Cache the factory to amortize setup costs across multiple operations\n walletClientFactoryCache.set(cacheKey, walletClientFactory);\n\n return walletClientFactory;\n};\n\nconst createWalletClientWithCustomMethods = (\n chain: ReturnType<typeof getChain>,\n validatedOptions: ClientOptions,\n verificationOptions?: WalletVerificationOptions,\n) =>\n createWalletClient({\n chain: chain,\n // WHY 500ms: Same as public client for consistent behavior\n pollingInterval: 500,\n transport: http(validatedOptions.rpcUrl, {\n // NEVER BATCH!\n batch: false,\n // RELIABILITY: 60s timeout for potentially slow signing operations\n timeout: 60_000,\n ...validatedOptions.httpTransportConfig,\n fetchOptions: {\n ...validatedOptions?.httpTransportConfig?.fetchOptions,\n // SECURITY: Runtime verification headers for HD wallet authentication\n headers: buildHeaders(validatedOptions?.httpTransportConfig?.fetchOptions?.headers, {\n \"x-auth-token\": validatedOptions.accessToken,\n // WHY conditional spreads: Only include headers when verification data is provided\n ...(verificationOptions?.challengeResponse\n ? {\n \"x-auth-challenge-response\": verificationOptions.challengeResponse,\n }\n : {}),\n ...(verificationOptions?.challengeId\n ? {\n \"x-auth-challenge-id\": verificationOptions.challengeId,\n }\n : {}),\n ...(verificationOptions?.verificationId\n ? {\n \"x-auth-verification-id\": verificationOptions.verificationId,\n }\n : {}),\n }),\n },\n }),\n })\n // FEATURE COMPOSITION: Extend with both standard viem actions, anvil actions and SettleMint-specific wallet features\n .extend(publicActions)\n .extend(anvilSetBalance)\n .extend(createWallet)\n .extend(getWalletVerifications)\n .extend(createWalletVerification)\n .extend(deleteWalletVerification)\n .extend(createWalletVerificationChallenge)\n .extend(createWalletVerificationChallenges)\n .extend(verifyWalletVerificationChallenge)\n .extend(ethSign);\n\n/**\n * Schema for the viem client options.\n */\nexport const GetChainIdOptionsSchema = z.object({\n /**\n * The access token\n */\n accessToken: ApplicationAccessTokenSchema.optional(),\n /**\n * The json rpc url\n */\n rpcUrl: UrlOrPathSchema,\n /**\n * The http transport config\n */\n httpTransportConfig: z.any().optional(),\n});\n\n/**\n * Type representing the validated get chain id options.\n */\nexport type GetChainIdOptions = Omit<z.infer<typeof GetChainIdOptionsSchema>, \"httpTransportConfig\"> & {\n httpTransportConfig?: HttpTransportConfig;\n};\n\n/**\n * Discovers the chain ID from an RPC endpoint without requiring prior knowledge.\n *\n * @remarks\n * UTILITY: Enables chain discovery for dynamic network configuration scenarios.\n * Unlike other client functions, this creates a minimal, non-cached client for one-time queries.\n *\n * USE CASE: Chain ID discovery during initial network setup or validation.\n * Alternative to requiring users to know chain IDs in advance.\n *\n * PERFORMANCE: No caching because chain IDs are typically discovered once\n * during setup rather than repeatedly during runtime operations.\n *\n * @param options - Minimal options with RPC URL and optional authentication\n * @returns Promise resolving to the network's chain ID as a number\n * @throws NetworkError when RPC endpoint is unreachable\n * @throws AuthenticationError when access token is invalid\n *\n * @example\n * ```ts\n * import { getChainId } from '@settlemint/sdk-viem';\n *\n * const chainId = await getChainId({\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,\n * rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT!,\n * });\n * console.log(chainId);\n * ```\n */\nexport async function getChainId(options: GetChainIdOptions): Promise<number> {\n ensureServer();\n const validatedOptions: GetChainIdOptions = validate(GetChainIdOptionsSchema, options);\n\n // SECURITY: Apply header filtering for undefined auth tokens\n const headers = buildHeaders(validatedOptions?.httpTransportConfig?.fetchOptions?.headers, {\n \"x-auth-token\": validatedOptions.accessToken,\n });\n\n // WHY no caching: Chain ID discovery is typically a one-time setup operation\n const client = createPublicClientViem({\n transport: http(validatedOptions.rpcUrl, {\n ...validatedOptions.httpTransportConfig,\n fetchOptions: {\n ...validatedOptions?.httpTransportConfig?.fetchOptions,\n headers,\n },\n }),\n });\n\n return client.getChainId();\n}\n\n/**\n * OPTIMIZATION: Pre-compute known chains map for O(1) lookup performance.\n * WHY Map over Object: Avoids prototype chain lookups and provides guaranteed O(1) access.\n * MEMORY: One-time initialization cost for ~100 known chains vs repeated lookups.\n */\nconst knownChainsMap = new Map<string, ViemChain>(Object.values(chains).map((chain) => [chain.id.toString(), chain]));\n\n/**\n * CHAIN RESOLUTION STRATEGY: Two-tier lookup optimizes for both known and custom chains.\n *\n * Tier 1: Known chains (Ethereum mainnet, common testnets, L2s)\n * - O(1) lookup from pre-built map\n * - No caching needed (references are stable)\n * - Ignores custom RPC URLs (uses viem's defaults)\n *\n * Tier 2: Custom chains (private networks, development chains)\n * - LRU cached to handle dynamic discovery\n * - Full parameter consideration for cache key\n * - ETH defaults for unknown chains (SettleMint platform assumption)\n *\n * TRADEOFF: Memory usage vs performance - separate strategies prevent cache pollution\n * of known chains with custom RPC configurations.\n */\nfunction getChain({ chainId, chainName, rpcUrl }: Pick<ClientOptions, \"chainId\" | \"chainName\" | \"rpcUrl\">): ViemChain {\n // PERFORMANCE: O(1) lookup for known chains - no cache needed\n const knownChain = knownChainsMap.get(chainId);\n if (knownChain) {\n // WHY: Known chains use viem's default RPC URLs and ignore custom ones\n return knownChain;\n }\n\n // CACHING: Custom chains require full parameter consideration\n const cacheKey = JSON.stringify({ chainId, chainName, rpcUrl }, [\"chainId\", \"chainName\", \"rpcUrl\"]);\n\n const cachedChain = chainCache.get(cacheKey);\n if (cachedChain) {\n return cachedChain;\n }\n\n // DEFAULTS: Assume ETH-compatible chain for SettleMint platform networks\n const customChain = defineChain({\n id: Number(chainId),\n name: chainName,\n rpcUrls: {\n default: {\n http: [rpcUrl],\n },\n },\n // ASSUMPTION: SettleMint networks use ETH as native currency\n nativeCurrency: {\n decimals: 18,\n name: \"Ether\",\n symbol: \"ETH\",\n },\n });\n\n // MEMORY MANAGEMENT: Cache only custom chains to prevent known chain pollution\n chainCache.set(cacheKey, customChain);\n return customChain;\n}\n\nexport type {\n CreateWalletParameters,\n CreateWalletResponse,\n WalletInfo,\n} from \"./custom-actions/create-wallet.action.js\";\nexport type {\n CreateWalletVerificationParameters,\n CreateWalletVerificationResponse,\n WalletOTPVerificationInfo,\n WalletPincodeVerificationInfo,\n WalletSecretCodesVerificationInfo,\n WalletVerificationInfo,\n} from \"./custom-actions/create-wallet-verification.action.js\";\nexport type {\n CreateWalletVerificationChallengeParameters,\n CreateWalletVerificationChallengeResponse,\n WalletVerificationChallengeData,\n} from \"./custom-actions/create-wallet-verification-challenge.action.js\";\nexport type {\n CreateWalletVerificationChallengesParameters,\n CreateWalletVerificationChallengesResponse,\n} from \"./custom-actions/create-wallet-verification-challenges.action.js\";\nexport type {\n DeleteWalletVerificationParameters,\n DeleteWalletVerificationResponse,\n} from \"./custom-actions/delete-wallet-verification.action.js\";\nexport type {\n GetWalletVerificationsParameters,\n GetWalletVerificationsResponse,\n WalletVerification,\n} from \"./custom-actions/get-wallet-verifications.action.js\";\nexport {\n OTPAlgorithm,\n WalletVerificationType,\n} from \"./custom-actions/types/wallet-verification.enum.js\";\nexport type { WalletVerificationChallenge } from \"./custom-actions/types/wallet-verification-challenge.js\";\nexport type {\n AddressOrObject,\n AddressOrObjectWithChallengeId,\n VerificationResult,\n VerifyWalletVerificationChallengeParameters,\n VerifyWalletVerificationChallengeResponse,\n} from \"./custom-actions/verify-wallet-verification-challenge.action.js\";\n"],"mappings":";;;;;;;;;;;;;;AAqBA,SAAgB,gBAAgB,QAAgB;AAC9C,QAAO,EAML,gBAAgB,MAAmD;AACjE,SAAO,OAAO,QAA6B;GACzC,QAAQ;GACR,QAAQ;GACT,CAAC;IAEL;;;;;;;;;;ACgBH,SAAgB,aAAa,QAAgB;AAC3C,QAAO,EAML,aAAa,MAA+D;AAC1E,SAAO,OAAO,QAAyB;GACrC,QAAQ;GACR,QAAQ,CAAC,KAAK,YAAY,KAAK,WAAW;GAC3C,CAAC;IAEL;;;;;;;;;;AC8BH,SAAgB,yBAAyB,QAAgB;AACvD,QAAO,EAML,yBAAyB,MAAuF;AAC9G,SAAO,OAAO,QAAyB;GACrC,QAAQ;GACR,QAAQ,CAAC,KAAK,mBAAmB,KAAK,uBAAuB;GAC9D,CAAC;IAEL;;;;;;;;;;AChEH,SAAgB,kCAAkC,QAAgB;AAChE,QAAO,EAML,kCACE,MACoD;AACpD,SAAO,OAAO,QAAyB;GAC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iB,QAAQ;EACvC,GAAG,iBAAiB;EACpB,cAAc;GACZ,GAAG,kBAAkB,qBAAqB;GAC1C;GACD;EACF,CAAC,EACH,CAAC;AAEF,QAAO,OAAO,YAAY;;;;;;;AAQ5B,MAAM,iBAAiB,IAAI,IAAuB,OAAO,OAAO,OAAO,CAAC,KAAK,UAAU,CAAC,MAAM,GAAG,UAAU,EAAE,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;;;AAkBrH,SAAS,SAAS,EAAE,SAAS,WAAW,UAA8E;CAEpH,MAAM,aAAa,eAAe,IAAI,QAAQ;AAC9C,KAAI,YAAY;AAEd,SAAO;;CAIT,MAAM,WAAW,KAAK,UAAU;EAAE;EAAS;EAAW;EAAQ,EAAE;EAAC;EAAW;EAAa;EAAS,CAAC;CAEnG,MAAM,cAAc,WAAW,IAAI,SAAS;AAC5C,KAAI,aAAa;AACf,SAAO;;CAIT,MAAM,cAAc,YAAY;EAC9B,IAAI,OAAO,QAAQ;EACnB,MAAM;EACN,SAAS,EACP,SAAS,EACP,MAAM,CAAC,OAAO,EACf,EACF;EAED,gBAAgB;GACd,UAAU;GACV,MAAM;GACN,QAAQ;GACT;EACF,CAAC;AAGF,YAAW,IAAI,UAAU,YAAY;AACrC,QAAO"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@settlemint/sdk-viem",
3
3
  "description": "Viem (TypeScript Interface for Ethereum) module for SettleMint SDK",
4
- "version": "2.6.2",
4
+ "version": "2.6.3",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "license": "FSL-1.1-MIT",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "scripts": {
43
43
  "build": "tsdown",
44
- "dev": "tsdown --watch",
44
+ "dev": "tsdown --watch ./src",
45
45
  "publint": "publint run --strict",
46
46
  "attw": "attw --pack .",
47
47
  "test": "bun test",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "devDependencies": {},
55
55
  "dependencies": {
56
- "@settlemint/sdk-utils": "2.6.2",
56
+ "@settlemint/sdk-utils": "2.6.3",
57
57
  "viem": "^2",
58
58
  "zod": "^4"
59
59
  },