@solana/connector 0.1.7 → 0.1.9

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.
Files changed (50) hide show
  1. package/README.md +83 -5
  2. package/dist/{chunk-VA6LKXCQ.js → chunk-5HRJKCIL.js} +204 -268
  3. package/dist/chunk-5HRJKCIL.js.map +1 -0
  4. package/dist/chunk-DSUCH44G.js +678 -0
  5. package/dist/chunk-DSUCH44G.js.map +1 -0
  6. package/dist/{chunk-VZ5Y6DIM.js → chunk-I6TJLYNA.js} +80 -235
  7. package/dist/chunk-I6TJLYNA.js.map +1 -0
  8. package/dist/chunk-J7DHGLW6.mjs +638 -0
  9. package/dist/chunk-J7DHGLW6.mjs.map +1 -0
  10. package/dist/{chunk-TQRJYZNK.mjs → chunk-JOBLG62A.mjs} +71 -218
  11. package/dist/chunk-JOBLG62A.mjs.map +1 -0
  12. package/dist/{chunk-APQGEW7S.mjs → chunk-MAXA3HEP.mjs} +120 -170
  13. package/dist/chunk-MAXA3HEP.mjs.map +1 -0
  14. package/dist/{chunk-JK47EFJT.mjs → chunk-P5LXUDP6.mjs} +65 -14
  15. package/dist/chunk-P5LXUDP6.mjs.map +1 -0
  16. package/dist/{chunk-Z22V3D4E.js → chunk-WDXEP4AJ.js} +95 -37
  17. package/dist/chunk-WDXEP4AJ.js.map +1 -0
  18. package/dist/compat.d.mts +1 -1
  19. package/dist/compat.d.ts +1 -1
  20. package/dist/compat.js +40 -39
  21. package/dist/compat.js.map +1 -1
  22. package/dist/compat.mjs +39 -38
  23. package/dist/compat.mjs.map +1 -1
  24. package/dist/headless.d.mts +447 -151
  25. package/dist/headless.d.ts +447 -151
  26. package/dist/headless.js +214 -194
  27. package/dist/headless.mjs +3 -3
  28. package/dist/index.d.mts +7 -6
  29. package/dist/index.d.ts +7 -6
  30. package/dist/index.js +268 -224
  31. package/dist/index.mjs +4 -4
  32. package/dist/react.d.mts +108 -7
  33. package/dist/react.d.ts +108 -7
  34. package/dist/react.js +54 -30
  35. package/dist/react.mjs +2 -2
  36. package/dist/{wallet-standard-shim-DiMvGjOk.d.ts → standard-shim-CT49DM5l.d.mts} +38 -247
  37. package/dist/{wallet-standard-shim-D4CYG5sU.d.mts → standard-shim-D9guL5fz.d.ts} +38 -247
  38. package/dist/{transaction-signer-CpGEvp7S.d.mts → transaction-signer-T-KVQFi8.d.mts} +1 -1
  39. package/dist/{transaction-signer-CpGEvp7S.d.ts → transaction-signer-T-KVQFi8.d.ts} +1 -1
  40. package/package.json +3 -3
  41. package/dist/chunk-APQGEW7S.mjs.map +0 -1
  42. package/dist/chunk-I64FD2EH.js +0 -312
  43. package/dist/chunk-I64FD2EH.js.map +0 -1
  44. package/dist/chunk-JK47EFJT.mjs.map +0 -1
  45. package/dist/chunk-QL3IT3TS.mjs +0 -299
  46. package/dist/chunk-QL3IT3TS.mjs.map +0 -1
  47. package/dist/chunk-TQRJYZNK.mjs.map +0 -1
  48. package/dist/chunk-VA6LKXCQ.js.map +0 -1
  49. package/dist/chunk-VZ5Y6DIM.js.map +0 -1
  50. package/dist/chunk-Z22V3D4E.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/wallet/enhanced-storage.ts","../src/config/default-config.ts","../src/config/schemas.ts","../src/types/wallets.ts","../src/lib/connection/types.ts","../src/lib/connection/helpers.ts","../src/utils/chain.ts","../src/lib/utils/explorer-urls.ts"],"names":["WalletUiStorage","logger","address"],"mappings":";;;;;;;;;AAeA,IAAM,MAAA,GAAS,aAAa,iBAAiB,CAAA,CAAA,CAMhC,kBAAkB,IAAA,CAAA,CAMlB,eAAA,GAAN,cAAiCA,OAAA,CAAmB;AAAA,EAKvD,WAAA,CACI,GAAA,EACA,OAAA,EACQ,OAAA,EACV;AACE,IAAA,KAAA,CAAM,KAAK,OAAO,CAAA;AAFV,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAPZ,IAAA,aAAA,CAAA,IAAA,EAAQ,eAAA,sBAAiD,GA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["/**\n * Enhanced Storage\n */\n\nimport { Storage as WalletUiStorage } from '@wallet-ui/core';\nimport type { SolanaClusterId } from '@wallet-ui/core';\nimport type {\n StorageOptions,\n StorageAdapter,\n EnhancedStorageAccountOptions,\n EnhancedStorageClusterOptions,\n EnhancedStorageWalletOptions,\n} from '../../types/storage';\nimport { createLogger } from '../utils/secure-logger';\n\nconst logger = createLogger('EnhancedStorage');\n\n/**\n * Storage version for migration support\n * Increment when making breaking changes to storage format\n */\nexport const STORAGE_VERSION = 'v1';\n\n/**\n * Enhanced version of wallet-ui's Storage class\n * Extends the base Storage with validation, error handling, and SSR support\n */\nexport class EnhancedStorage<T> extends WalletUiStorage<T> {\n private errorHandlers: Set<(error: Error) => void> = new Set();\n private validators: ((value: T) => boolean)[] = [];\n private memoryFallback: T;\n\n constructor(\n key: string,\n initial: T,\n private options?: StorageOptions<T>,\n ) {\n super(key, initial);\n this.memoryFallback = initial;\n\n if (options?.onError) {\n this.errorHandlers.add(options.onError);\n }\n if (options?.validator) {\n this.validators.push(options.validator);\n }\n }\n\n override set(value: T): boolean {\n try {\n if (!this.validate(value)) {\n logger.warn('Validation failed', { key: this.key });\n return false;\n }\n\n super.set(value);\n\n this.memoryFallback = value;\n return true;\n } catch (error) {\n this.handleError(error as Error);\n\n if (this.options?.useMemoryFallback) {\n this.memoryFallback = value;\n return true;\n }\n\n return false;\n }\n }\n\n override get(): T {\n try {\n return super.get();\n } catch (error) {\n this.handleError(error as Error);\n\n if (this.options?.useMemoryFallback) {\n return this.memoryFallback;\n }\n\n return this.initial;\n }\n }\n\n validate(value: T): boolean {\n return this.validators.every(validator => validator(value));\n }\n\n addValidator(validator: (value: T) => boolean): this {\n this.validators.push(validator);\n return this;\n }\n\n onError(handler: (error: Error) => void): this {\n this.errorHandlers.add(handler);\n return this;\n }\n\n transform<U>(transformer: (value: T) => U): U {\n return transformer(this.get());\n }\n\n reset(): void {\n this.set(this.initial);\n }\n\n clear(): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n window.localStorage.removeItem(this.key);\n }\n this.reset();\n } catch (error) {\n this.handleError(error as Error);\n }\n }\n\n isAvailable(): boolean {\n try {\n if (typeof window === 'undefined') return false;\n const testKey = `__storage_test_${this.key}__`;\n window.localStorage.setItem(testKey, 'test');\n window.localStorage.removeItem(testKey);\n return true;\n } catch {\n return false;\n }\n }\n\n static migrate<T>(oldKey: string, newStorage: EnhancedStorage<T>): boolean {\n try {\n if (typeof window === 'undefined') return false;\n\n const oldValue = window.localStorage.getItem(oldKey);\n if (oldValue) {\n const parsed = JSON.parse(oldValue) as T;\n newStorage.set(parsed);\n window.localStorage.removeItem(oldKey);\n return true;\n }\n return false;\n } catch {\n return false;\n }\n }\n\n private handleError(error: Error): void {\n logger.error('Storage error', { key: this.key, error });\n this.errorHandlers.forEach(handler => {\n try {\n handler(error);\n } catch (err) {\n logger.error('Error in error handler', { error: err });\n }\n });\n }\n}\n\nexport function createEnhancedStorageAccount(\n options?: EnhancedStorageAccountOptions,\n): EnhancedStorage<string | undefined> {\n const key = options?.key ?? `connector-kit:${STORAGE_VERSION}:account`;\n return new EnhancedStorage(key, options?.initial, {\n validator: options?.validator,\n onError: options?.onError,\n useMemoryFallback: true, // Always fallback for SSR\n });\n}\n\nexport function createEnhancedStorageCluster(\n options?: EnhancedStorageClusterOptions,\n): EnhancedStorage<SolanaClusterId> {\n const key = options?.key ?? `connector-kit:${STORAGE_VERSION}:cluster`;\n const storage = new EnhancedStorage(key, options?.initial ?? 'solana:mainnet', {\n onError: options?.onError,\n useMemoryFallback: true,\n });\n\n if (options?.validClusters) {\n storage.addValidator(clusterId => options.validClusters!.includes(clusterId));\n }\n\n return storage;\n}\n\nexport function createEnhancedStorageWallet(\n options?: EnhancedStorageWalletOptions,\n): EnhancedStorage<string | undefined> {\n const key = options?.key ?? `connector-kit:${STORAGE_VERSION}:wallet`;\n return new EnhancedStorage(key, options?.initial, {\n onError: options?.onError,\n useMemoryFallback: true,\n });\n}\n\nexport class EnhancedStorageAdapter<T> implements StorageAdapter<T> {\n constructor(private storage: EnhancedStorage<T>) {}\n\n get(): T {\n return this.storage.get();\n }\n\n set(value: T): void {\n this.storage.set(value);\n }\n\n subscribe(callback: (value: T) => void): () => void {\n return this.storage.value.subscribe(callback);\n }\n\n validate(value: T): boolean {\n return this.storage.validate(value);\n }\n\n reset(): void {\n this.storage.reset();\n }\n\n clear(): void {\n this.storage.clear();\n }\n\n isAvailable(): boolean {\n return this.storage.isAvailable();\n }\n\n transform<U>(transformer: (value: T) => U): U {\n return this.storage.transform(transformer);\n }\n\n addValidator(validator: (value: T) => boolean): this {\n this.storage.addValidator(validator);\n return this;\n }\n\n onError(handler: (error: Error) => void): this {\n this.storage.onError(handler);\n return this;\n }\n}\n","import type { ConnectorConfig, CoinGeckoConfig } from '../types/connector';\nimport type { SolanaCluster, SolanaClusterId } from '@wallet-ui/core';\nimport { createSolanaMainnet, createSolanaDevnet, createSolanaTestnet, createSolanaLocalnet } from '@wallet-ui/core';\nimport {\n createEnhancedStorageAccount,\n createEnhancedStorageCluster,\n createEnhancedStorageWallet,\n EnhancedStorageAdapter,\n EnhancedStorage,\n} from '../lib/wallet/enhanced-storage';\nimport { toClusterId } from '../utils/network';\nimport type React from 'react';\nimport { isAddress } from '@solana/addresses';\nimport { DEFAULT_MAX_RETRIES } from '../lib/constants';\nimport { createLogger } from '../lib/utils/secure-logger';\n\nconst logger = createLogger('DefaultConfig');\n\nexport interface DefaultConfigOptions {\n /** Application name shown in wallet connection prompts */\n appName: string;\n /** Application URL for wallet connection metadata */\n appUrl?: string;\n /** Enable automatic wallet reconnection on page load */\n autoConnect?: boolean;\n /** Enable debug logging */\n debug?: boolean;\n /** Solana network to connect to (accepts both 'mainnet' and 'mainnet-beta' conventions) */\n network?: 'mainnet' | 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet';\n /** Enable Mobile Wallet Adapter support */\n enableMobile?: boolean;\n /** Custom storage implementation */\n storage?: ConnectorConfig['storage'];\n /** Custom cluster configuration - overrides network if provided */\n clusters?: SolanaCluster[];\n /** Additional custom clusters to add to the default list */\n customClusters?: SolanaCluster[];\n /** Persist cluster selection across sessions */\n persistClusterSelection?: boolean;\n /** Custom storage key for cluster persistence */\n clusterStorageKey?: string;\n /** Enable error boundaries for automatic error handling (default: true) */\n enableErrorBoundary?: boolean;\n /** Maximum retry attempts for error recovery (default: 3) */\n maxRetries?: number;\n /** Custom error handler */\n onError?: (error: Error, errorInfo: React.ErrorInfo) => void;\n /**\n * Image proxy URL prefix for token images.\n * When set, token image URLs will be transformed to: `${imageProxy}${encodeURIComponent(originalUrl)}`\n * This prevents direct image fetching which can leak user IPs to untrusted hosts.\n * @example '/_next/image?w=64&q=75&url=' // Next.js Image Optimization\n * @example '/cdn-cgi/image/width=64,quality=75/' // Cloudflare Image Resizing\n */\n imageProxy?: string;\n /**\n * Optional mapping from program IDs to human-readable program names.\n * Used to enrich transaction history (e.g. showing `Jupiter` instead of a raw program address).\n */\n programLabels?: Record<string, string>;\n /**\n * CoinGecko API configuration for token price fetching.\n * Configure API key for higher rate limits and retry behavior for 429 responses.\n * @see https://docs.coingecko.com/reference/introduction for rate limit details\n */\n coingecko?: CoinGeckoConfig;\n}\n\n/** Extended ConnectorConfig with app metadata */\nexport interface ExtendedConnectorConfig extends ConnectorConfig {\n /** Application name for display and metadata */\n appName?: string;\n /** Application URL for metadata */\n appUrl?: string;\n /** Whether mobile wallet adapter is enabled */\n enableMobile?: boolean;\n /** Selected network for convenience (accepts both 'mainnet' and 'mainnet-beta' conventions) */\n network?: 'mainnet' | 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet';\n /** Error boundary configuration */\n errorBoundary?: {\n /** Enable error boundaries (default: true) */\n enabled?: boolean;\n /** Maximum retry attempts (default: 3) */\n maxRetries?: number;\n /** Custom error handler */\n onError?: (error: Error, errorInfo: React.ErrorInfo) => void;\n /** Custom fallback component */\n fallback?: (error: Error, retry: () => void) => React.ReactNode;\n };\n /**\n * Image proxy URL prefix for token images.\n * When set, token image URLs will be transformed to: `${imageProxy}${encodeURIComponent(originalUrl)}`\n * This prevents direct image fetching which can leak user IPs to untrusted hosts.\n */\n imageProxy?: string;\n /**\n * Optional mapping from program IDs to human-readable program names.\n * Used to enrich transaction history (e.g. showing `Jupiter` instead of a raw program address).\n */\n programLabels?: Record<string, string>;\n /**\n * CoinGecko API configuration for token price fetching.\n */\n coingecko?: CoinGeckoConfig;\n}\n\n/**\n * Creates a default connector configuration with sensible defaults for Solana applications\n */\nexport function getDefaultConfig(options: DefaultConfigOptions): ExtendedConnectorConfig {\n const {\n appName,\n appUrl,\n autoConnect = true,\n debug,\n network = 'mainnet-beta',\n enableMobile = true,\n storage,\n clusters,\n customClusters = [],\n persistClusterSelection = true,\n clusterStorageKey,\n enableErrorBoundary = true,\n maxRetries = DEFAULT_MAX_RETRIES,\n onError,\n imageProxy,\n programLabels,\n coingecko,\n } = options;\n\n const defaultClusters: SolanaCluster[] = clusters ?? [\n createSolanaMainnet(),\n createSolanaDevnet(),\n createSolanaTestnet(),\n ...(network === 'localnet' ? [createSolanaLocalnet()] : []),\n ...(customClusters || []),\n ];\n\n const validClusterIds = defaultClusters.map(c => c.id);\n\n const accountStorage = createEnhancedStorageAccount({\n validator: address => {\n if (!address) return true;\n return isAddress(address);\n },\n onError: error => {\n if (debug) {\n logger.error('Account Storage error', { error });\n }\n if (onError) {\n onError(error, {\n componentStack: 'account-storage',\n });\n }\n },\n });\n\n const clusterStorage = createEnhancedStorageCluster({\n key: clusterStorageKey,\n initial: getInitialCluster(network),\n validClusters: persistClusterSelection ? validClusterIds : undefined,\n onError: error => {\n if (debug) {\n logger.error('Cluster Storage error', { error });\n }\n if (onError) {\n onError(error, {\n componentStack: 'cluster-storage',\n });\n }\n },\n });\n\n const walletStorage = createEnhancedStorageWallet({\n onError: error => {\n if (debug) {\n logger.error('Wallet Storage error', { error });\n }\n if (onError) {\n onError(error, {\n componentStack: 'wallet-storage',\n });\n }\n },\n });\n\n // Migrate old storage keys to new versioned format (v1)\n // This allows seamless upgrades from old versions without losing user data\n if (typeof window !== 'undefined') {\n // Old keys (pre-v1): 'connector-kit:account', 'connector-kit:wallet', 'connector-kit:cluster'\n // New keys (v1): 'connector-kit:v1:account', 'connector-kit:v1:wallet', 'connector-kit:v1:cluster'\n const oldAccountKey = 'connector-kit:account';\n const oldWalletKey = 'connector-kit:wallet';\n const oldClusterKey = clusterStorageKey || 'connector-kit:cluster';\n\n EnhancedStorage.migrate(oldAccountKey, accountStorage);\n EnhancedStorage.migrate(oldWalletKey, walletStorage);\n EnhancedStorage.migrate(oldClusterKey, clusterStorage);\n }\n\n const defaultStorage: ConnectorConfig['storage'] = storage ?? {\n account: new EnhancedStorageAdapter(accountStorage),\n cluster: new EnhancedStorageAdapter(clusterStorage),\n wallet: new EnhancedStorageAdapter(walletStorage),\n };\n\n const config: ExtendedConnectorConfig = {\n autoConnect,\n debug: debug ?? process.env.NODE_ENV === 'development',\n storage: defaultStorage,\n appName,\n appUrl,\n enableMobile,\n network,\n cluster: {\n clusters: defaultClusters,\n persistSelection: persistClusterSelection,\n initialCluster: getInitialCluster(network),\n },\n errorBoundary: {\n enabled: enableErrorBoundary,\n maxRetries,\n onError,\n },\n imageProxy,\n programLabels,\n coingecko,\n };\n\n return config;\n}\n\n/**\n * Helper to convert network string to cluster ID\n * Uses network utility for consistent translation\n */\nfunction getInitialCluster(\n network: 'mainnet' | 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet' = 'mainnet-beta',\n): SolanaClusterId {\n return toClusterId(network);\n}\n\n/**\n * Default Mobile Wallet Adapter configuration for Solana applications\n */\nexport function getDefaultMobileConfig(options: {\n appName: string;\n appUrl?: string;\n network?: 'mainnet' | 'mainnet-beta' | 'devnet' | 'testnet';\n}) {\n const baseUrl =\n options.appUrl || (typeof window !== 'undefined' ? window.location.origin : 'https://localhost:3000');\n\n return {\n appIdentity: {\n name: options.appName,\n uri: baseUrl,\n icon: `${baseUrl}/favicon.ico`,\n },\n cluster: options.network || 'mainnet-beta',\n };\n}\n","/**\n * @solana/connector - Configuration Schemas\n *\n * Zod schemas for runtime validation of configuration options.\n * These schemas provide type-safe validation with helpful error messages.\n */\n\nimport { z } from 'zod/v4';\n\n// ============================================================================\n// Primitive Schemas\n// ============================================================================\n\n/**\n * Valid Solana network values\n */\nexport const solanaNetworkSchema = z.enum(['mainnet', 'mainnet-beta', 'devnet', 'testnet', 'localnet']);\n\n/**\n * Solana cluster ID format (e.g., 'solana:mainnet', 'solana:devnet')\n */\nexport const solanaClusterIdSchema = z.string().regex(/^solana:(mainnet|devnet|testnet|localnet|[a-zA-Z0-9-]+)$/, {\n message: 'Cluster ID must be in format \"solana:<network>\" (e.g., \"solana:mainnet\")',\n});\n\n/**\n * URL validation with protocol check\n */\nexport const urlSchema = z.string().url('Invalid URL format');\n\n/**\n * Optional URL that allows undefined\n */\nexport const optionalUrlSchema = urlSchema.optional();\n\n// ============================================================================\n// CoinGecko Configuration\n// ============================================================================\n\nexport const coinGeckoConfigSchema = z\n .strictObject({\n apiKey: z.string().optional(),\n isPro: z.boolean().optional(),\n maxRetries: z.number().int().positive().max(10).optional(),\n baseDelay: z.number().int().positive().max(30000).optional(),\n maxTimeout: z.number().int().positive().max(120000).optional(),\n })\n .optional();\n\n// ============================================================================\n// Storage Configuration\n// ============================================================================\n\n/**\n * Storage adapter interface schema (validates shape, not implementation)\n */\nexport const storageAdapterSchema = z.looseObject({\n get: z.custom<(...args: unknown[]) => unknown>(val => typeof val === 'function'),\n set: z.custom<(...args: unknown[]) => unknown>(val => typeof val === 'function'),\n});\n\nexport const storageConfigSchema = z\n .object({\n account: storageAdapterSchema,\n cluster: storageAdapterSchema,\n wallet: storageAdapterSchema,\n })\n .optional();\n\n// ============================================================================\n// Cluster Configuration\n// ============================================================================\n\n/**\n * SolanaCluster object schema\n */\nexport const solanaClusterSchema = z.object({\n id: solanaClusterIdSchema,\n label: z.string().min(1, 'Cluster label cannot be empty'),\n url: urlSchema,\n urlWs: urlSchema.optional(),\n});\n\nexport const clusterConfigSchema = z\n .object({\n clusters: z.array(solanaClusterSchema).optional(),\n persistSelection: z.boolean().optional(),\n initialCluster: solanaClusterIdSchema.optional(),\n })\n .optional();\n\n// ============================================================================\n// Default Config Options\n// ============================================================================\n\nexport const defaultConfigOptionsSchema = z.object({\n // Required\n appName: z.string().min(1, 'Application name is required'),\n\n // Optional strings\n appUrl: optionalUrlSchema,\n imageProxy: z.string().optional(),\n clusterStorageKey: z.string().optional(),\n\n // Optional booleans\n autoConnect: z.boolean().optional(),\n debug: z.boolean().optional(),\n enableMobile: z.boolean().optional(),\n persistClusterSelection: z.boolean().optional(),\n enableErrorBoundary: z.boolean().optional(),\n\n // Network\n network: solanaNetworkSchema.optional(),\n\n // Numbers\n maxRetries: z.number().int().positive().max(10).optional(),\n\n // Complex types\n storage: storageConfigSchema,\n clusters: z.array(solanaClusterSchema).optional(),\n customClusters: z.array(solanaClusterSchema).optional(),\n programLabels: z.record(z.string(), z.string()).optional(),\n coingecko: coinGeckoConfigSchema,\n\n // Functions (can't validate implementation, just existence)\n onError: z.custom<(...args: unknown[]) => unknown>(val => typeof val === 'function').optional(),\n});\n\n// ============================================================================\n// Connector Config (for ConnectorClient)\n// ============================================================================\n\nexport const connectorConfigSchema = z\n .strictObject({\n autoConnect: z.boolean().optional(),\n debug: z.boolean().optional(),\n storage: storageConfigSchema,\n cluster: clusterConfigSchema,\n imageProxy: z.string().optional(),\n programLabels: z.record(z.string(), z.string()).optional(),\n coingecko: coinGeckoConfigSchema,\n })\n .optional();\n\n// ============================================================================\n// Type Exports (inferred from schemas)\n// ============================================================================\n\nexport type SolanaNetworkInput = z.input<typeof solanaNetworkSchema>;\nexport type SolanaClusterIdInput = z.input<typeof solanaClusterIdSchema>;\nexport type CoinGeckoConfigInput = z.input<typeof coinGeckoConfigSchema>;\nexport type DefaultConfigOptionsInput = z.input<typeof defaultConfigOptionsSchema>;\n\n// ============================================================================\n// Validation Helpers\n// ============================================================================\n\n/**\n * Validate configuration options and return a result with helpful errors\n *\n * @example\n * ```ts\n * const result = validateConfigOptions({\n * appName: 'My App',\n * network: 'mainnet',\n * });\n *\n * if (!result.success) {\n * console.error('Config validation failed:', result.error.format());\n * }\n * ```\n */\nexport function validateConfigOptions(options: unknown): z.ZodSafeParseResult<DefaultConfigOptionsInput> {\n return defaultConfigOptionsSchema.safeParse(options);\n}\n\n/**\n * Parse and validate config options, throwing on error with formatted message\n *\n * @throws {z.ZodError} If validation fails\n *\n * @example\n * ```ts\n * try {\n * const validOptions = parseConfigOptions(userInput);\n * // validOptions is typed and validated\n * } catch (error) {\n * if (error instanceof z.ZodError) {\n * console.error(error.format());\n * }\n * }\n * ```\n */\nexport function parseConfigOptions(options: unknown): DefaultConfigOptionsInput {\n return defaultConfigOptionsSchema.parse(options);\n}\n","/**\n * Wallet-related types\n * Re-exports from @wallet-standard/base and custom wallet types\n */\n\nimport type { Wallet, WalletAccount } from '@wallet-standard/base';\n\n// Re-export standard types\nexport type { Wallet, WalletAccount };\n\n/**\n * Wallet name as a branded string for type safety\n * Represents the unique identifier for a wallet (e.g., \"Phantom\", \"Solflare\")\n */\nexport type WalletName = string & { readonly __brand: 'WalletName' };\n\n/**\n * Account address as a branded string for type safety\n * Represents a Solana address (base58-encoded public key)\n *\n * @deprecated Use `Address` from '@solana/addresses' instead for consistent address typing\n */\nexport type AccountAddress = string & { readonly __brand: 'AccountAddress' };\n\n/**\n * Type guard to check if a string is a valid wallet name\n */\nexport function isWalletName(value: string): value is WalletName {\n return typeof value === 'string' && value.length > 0;\n}\n\n/**\n * Type guard to check if a string is a valid account address\n *\n * @deprecated Use `isAddress` from '@solana/addresses' instead for proper address validation\n */\nexport function isAccountAddress(value: string): value is AccountAddress {\n // Basic validation: Solana addresses are typically 32-44 characters\n return typeof value === 'string' && value.length >= 32 && value.length <= 44;\n}\n\n/**\n * Extended wallet information with capability metadata\n */\nexport interface WalletInfo {\n /** The Wallet Standard wallet object */\n wallet: Wallet;\n /** Whether the wallet extension is installed */\n installed: boolean;\n /** Precomputed capability flag for UI convenience */\n connectable?: boolean;\n}\n","import type { Connection } from '@solana/web3.js';\n\nexport type Commitment = 'processed' | 'confirmed' | 'finalized';\n\nexport interface KitSendTransactionOptions {\n commitment?: Commitment;\n skipPreflight?: boolean;\n maxRetries?: number;\n}\n\nexport type KitRpc = {\n getLatestBlockhash(options?: { commitment?: Commitment }): {\n send(): Promise<{ value: { blockhash: string; lastValidBlockHeight: number } }>;\n };\n sendTransaction(\n bytes: Uint8Array | string,\n options?: KitSendTransactionOptions,\n ): {\n send(): Promise<string>;\n };\n send?: () => unknown;\n};\n\nexport type DualConnection = Connection | KitRpc;\n\nexport function isLegacyConnection(conn: DualConnection): conn is Connection {\n return 'rpcEndpoint' in conn && typeof (conn as Connection).rpcEndpoint === 'string';\n}\n\nexport function isKitConnection(conn: DualConnection): conn is KitRpc {\n if ('rpcEndpoint' in conn) {\n return false;\n }\n\n const asKitRpc = conn as KitRpc;\n return typeof asKitRpc.getLatestBlockhash === 'function' && typeof asKitRpc.sendTransaction === 'function';\n}\n","/**\n * @solana/connector - Connection Helpers\n *\n * Abstraction layer for working with both legacy @solana/web3.js Connection\n * and modern Kit/gill Rpc objects.\n */\n\nimport type { SendOptions } from '@solana/web3.js';\nimport type { DualConnection, Commitment, KitRpc } from './types';\nimport { isLegacyConnection, isKitConnection } from './types';\n\n/**\n * Get latest blockhash from either legacy Connection or Kit Rpc\n *\n * Abstracts the differences between web3.js 1.x and Kit/gill APIs.\n *\n * @param connection - Legacy Connection or Kit Rpc\n * @param commitment - Optional commitment level (default: 'confirmed')\n * @returns Latest blockhash and last valid block height\n *\n * @example\n * ```typescript\n * // Works with both Connection and Rpc\n * const { blockhash, lastValidBlockHeight } = await getLatestBlockhash(connection);\n * ```\n */\nexport async function getLatestBlockhash(\n connection: DualConnection,\n commitment: Commitment = 'confirmed',\n): Promise<{ blockhash: string; lastValidBlockHeight: number }> {\n if (isLegacyConnection(connection)) {\n // Legacy Connection API\n return await connection.getLatestBlockhash(commitment);\n }\n\n if (isKitConnection(connection)) {\n // Kit/gill Rpc API - returns { value: { blockhash, lastValidBlockHeight } }\n const rpc = connection as KitRpc;\n const result = await rpc.getLatestBlockhash({ commitment }).send();\n return result.value;\n }\n\n throw new Error('Unsupported connection type');\n}\n\n/**\n * Send raw transaction bytes to either legacy Connection or Kit Rpc\n *\n * Abstracts the differences between web3.js 1.x and Kit/gill APIs.\n *\n * @param connection - Legacy Connection or Kit Rpc\n * @param bytes - Raw transaction bytes\n * @param options - Optional send options (skipPreflight, maxRetries, etc.)\n * @returns Transaction signature string\n *\n * @example\n * ```typescript\n * // Works with both Connection and Rpc\n * const signature = await sendRawTransaction(connection, transactionBytes, {\n * skipPreflight: false,\n * maxRetries: 3\n * });\n * ```\n */\nexport async function sendRawTransaction(\n connection: DualConnection,\n bytes: Uint8Array,\n options?: SendOptions & { commitment?: Commitment },\n): Promise<string> {\n if (isLegacyConnection(connection)) {\n // Legacy Connection API\n return await connection.sendRawTransaction(bytes, options);\n }\n\n if (isKitConnection(connection)) {\n // Kit/gill Rpc API\n // Note: gill's sendTransaction expects different options format\n const rpc = connection as KitRpc;\n // Convert Uint8Array to base64 string\n const base64String = Buffer.from(bytes).toString('base64');\n const result = await rpc\n .sendTransaction(base64String as Uint8Array | string, {\n ...(options?.commitment ? { commitment: options.commitment } : {}),\n ...(options?.skipPreflight !== undefined ? { skipPreflight: options.skipPreflight } : {}),\n ...(options?.maxRetries !== undefined ? { maxRetries: options.maxRetries } : {}),\n })\n .send();\n\n // Kit Rpc returns signature string directly\n return result;\n }\n\n throw new Error('Unsupported connection type');\n}\n","import type { SolanaCluster, SolanaClusterId } from '@wallet-ui/core';\nimport type { Connection } from '@solana/web3.js';\nimport type { ClusterType } from './cluster';\nimport { getClusterType, isMainnetCluster, isDevnetCluster, isTestnetCluster } from './cluster';\n\nexport const SOLANA_CHAIN_IDS = {\n mainnet: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',\n devnet: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',\n testnet: 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',\n} as const;\n\nconst CHAIN_ID_TO_CLUSTER_TYPE: Record<string, ClusterType> = {\n [SOLANA_CHAIN_IDS.mainnet]: 'mainnet',\n [SOLANA_CHAIN_IDS.devnet]: 'devnet',\n [SOLANA_CHAIN_IDS.testnet]: 'testnet',\n};\n\nconst CLUSTER_ID_TO_CHAIN_ID: Partial<Record<SolanaClusterId, string>> = {\n 'solana:mainnet': SOLANA_CHAIN_IDS.mainnet,\n 'solana:mainnet-beta': SOLANA_CHAIN_IDS.mainnet,\n 'solana:devnet': SOLANA_CHAIN_IDS.devnet,\n 'solana:testnet': SOLANA_CHAIN_IDS.testnet,\n};\n\nexport function getChainIdFromCluster(cluster: SolanaCluster): `solana:${string}` | null {\n const clusterType = getClusterType(cluster);\n\n if (clusterType === 'localnet' || clusterType === 'custom') {\n return null;\n }\n\n return getChainIdFromClusterType(clusterType);\n}\n\nexport function getChainIdFromClusterId(clusterId: SolanaClusterId): `solana:${string}` | null {\n return (CLUSTER_ID_TO_CHAIN_ID[clusterId] as `solana:${string}` | undefined) || null;\n}\n\nexport function getChainIdFromClusterType(type: ClusterType): `solana:${string}` | null {\n switch (type) {\n case 'mainnet':\n return SOLANA_CHAIN_IDS.mainnet;\n case 'devnet':\n return SOLANA_CHAIN_IDS.devnet;\n case 'testnet':\n return SOLANA_CHAIN_IDS.testnet;\n case 'localnet':\n case 'custom':\n return null;\n }\n}\n\nexport function getClusterTypeFromChainId(chainId: string): ClusterType | null {\n return CHAIN_ID_TO_CLUSTER_TYPE[chainId] || null;\n}\n\nexport function getClusterIdFromChainId(chainId: string): SolanaClusterId | null {\n const clusterType = getClusterTypeFromChainId(chainId);\n if (!clusterType) {\n return null;\n }\n\n switch (clusterType) {\n case 'mainnet':\n return 'solana:mainnet';\n case 'devnet':\n return 'solana:devnet';\n case 'testnet':\n return 'solana:testnet';\n default:\n return null;\n }\n}\n\nexport function isSolanaChain(chain: string): chain is `solana:${string}` {\n return chain.startsWith('solana:');\n}\n\nexport function isKnownSolanaChain(chain: string): boolean {\n return (\n chain === SOLANA_CHAIN_IDS.mainnet || chain === SOLANA_CHAIN_IDS.devnet || chain === SOLANA_CHAIN_IDS.testnet\n );\n}\n\nexport function validateKnownSolanaChain(chain: string): asserts chain is `solana:${string}` {\n if (!isSolanaChain(chain)) {\n throw new Error(`Invalid chain format: expected 'solana:...', got '${chain}'`);\n }\n\n if (!isKnownSolanaChain(chain)) {\n throw new Error(`Unknown Solana chain: ${chain}. Known chains: ${Object.values(SOLANA_CHAIN_IDS).join(', ')}`);\n }\n}\n\nexport function getClusterTypeFromConnection(connection: Connection | null): ClusterType | null {\n if (!connection) {\n return null;\n }\n\n const rpcUrl = connection.rpcEndpoint || '';\n\n if (rpcUrl.includes('mainnet') || rpcUrl.includes('api.mainnet-beta')) {\n return 'mainnet';\n }\n\n if (rpcUrl.includes('testnet')) {\n return 'testnet';\n }\n\n if (rpcUrl.includes('devnet')) {\n return 'devnet';\n }\n\n if (rpcUrl.includes('localhost') || rpcUrl.includes('127.0.0.1')) {\n return 'localnet';\n }\n\n return 'custom';\n}\n\nexport function getChainIdFromConnection(\n connection: Connection | null,\n network?: 'mainnet' | 'devnet' | 'testnet',\n): `solana:${string}` | null {\n if (network) {\n return getChainIdFromClusterType(network);\n }\n\n const clusterType = getClusterTypeFromConnection(connection);\n if (!clusterType) {\n return null;\n }\n\n return getChainIdFromClusterType(clusterType);\n}\n\nexport function clusterToChainId(cluster: SolanaCluster): `solana:${string}` | null {\n return getChainIdFromCluster(cluster);\n}\n\nexport function chainIdToClusterType(chainId: string): ClusterType | null {\n return getClusterTypeFromChainId(chainId);\n}\n\nexport function chainIdToClusterId(chainId: string): SolanaClusterId | null {\n return getClusterIdFromChainId(chainId);\n}\n","/**\n * @solana/connector - Explorer URL Utilities\n *\n * Generate URLs for various Solana block explorers to view transactions,\n * accounts, and other on-chain data.\n */\n\nimport { getExplorerLink } from '../kit';\n\nexport type ExplorerType = 'solana-explorer' | 'solscan' | 'xray' | 'solana-fm';\n\nexport interface ExplorerOptions {\n /** Cluster to use for the explorer link */\n cluster?: string;\n /** Custom RPC URL for localnet */\n customUrl?: string;\n}\n\n/**\n * Generate Solana Explorer URL for a transaction signature\n */\nexport function getSolanaExplorerUrl(signature: string, options: ExplorerOptions = {}): string {\n const { cluster = 'mainnet', customUrl } = options;\n const normalizedCluster = cluster === 'mainnet-beta' ? 'mainnet' : cluster;\n\n // Handle localnet with custom URL - gill doesn't support this specific case\n if (normalizedCluster === 'localnet') {\n const url = customUrl || 'http://localhost:8899';\n return `https://explorer.solana.com/tx/${signature}?cluster=custom&customUrl=${encodeURIComponent(url)}`;\n }\n\n // Map to valid gill cluster types (custom clusters default to devnet)\n const validClusters = ['mainnet', 'devnet', 'testnet'] as const;\n const explorerCluster = validClusters.includes(normalizedCluster as 'mainnet' | 'devnet' | 'testnet')\n ? (normalizedCluster as 'mainnet' | 'devnet' | 'testnet')\n : 'devnet';\n\n // Use gill's getExplorerLink for standard clusters\n return getExplorerLink({\n transaction: signature,\n cluster: explorerCluster,\n });\n}\n\n/**\n * Generate Solscan URL for a transaction signature\n */\nexport function getSolscanUrl(signature: string, options: ExplorerOptions = {}): string {\n const { cluster = 'mainnet' } = options;\n const normalizedCluster = cluster === 'mainnet-beta' ? 'mainnet' : cluster;\n\n if (normalizedCluster === 'mainnet') {\n return `https://solscan.io/tx/${signature}`;\n }\n\n if (normalizedCluster === 'localnet') {\n return `https://solscan.io/tx/${signature}?cluster=custom`;\n }\n\n return `https://solscan.io/tx/${signature}?cluster=${normalizedCluster}`;\n}\n\n/**\n * Generate XRAY (Helius) URL for a transaction signature\n * Note: XRAY works best with mainnet transactions\n */\nexport function getXrayUrl(signature: string): string {\n return `https://xray.helius.xyz/tx/${signature}`;\n}\n\n/**\n * Generate SolanaFM URL for a transaction signature\n */\nexport function getSolanaFmUrl(signature: string, options: ExplorerOptions = {}): string {\n const { cluster = 'mainnet' } = options;\n const normalizedCluster = cluster === 'mainnet-beta' ? 'mainnet' : cluster;\n\n if (normalizedCluster === 'mainnet') {\n return `https://solana.fm/tx/${signature}`;\n }\n\n return `https://solana.fm/tx/${signature}?cluster=${normalizedCluster}`;\n}\n\n/**\n * Get all explorer URLs for a transaction\n */\nexport function getAllExplorerUrls(signature: string, options: ExplorerOptions = {}): Record<ExplorerType, string> {\n return {\n 'solana-explorer': getSolanaExplorerUrl(signature, options),\n solscan: getSolscanUrl(signature, options),\n xray: getXrayUrl(signature),\n 'solana-fm': getSolanaFmUrl(signature, options),\n };\n}\n\n/**\n * Format a transaction signature for display (truncated)\n */\nexport function formatSignature(signature: string, chars = 8): string {\n if (signature.length <= chars * 2) return signature;\n return `${signature.slice(0, chars)}...${signature.slice(-chars)}`;\n}\n\n/**\n * Copy signature to clipboard with enhanced error handling\n *\n * @deprecated Use copySignatureToClipboard from utils/clipboard instead\n * This is maintained for backwards compatibility but will be removed in a future version\n */\nexport async function copySignature(signature: string): Promise<boolean> {\n try {\n await navigator.clipboard.writeText(signature);\n return true;\n } catch {\n return false;\n }\n}\n"]}
@@ -1,13 +1,30 @@
1
- import { createLogger, __publicField, getPublicSolanaRpcUrl, getExplorerLink, isWeb3jsTransaction, prepareTransactionForWallet, convertSignedTransaction } from './chunk-QL3IT3TS.mjs';
1
+ import { createLogger, getPublicSolanaRpcUrl, getExplorerLink, __publicField, tryCatchSync, TransactionError, isWeb3jsTransaction, Errors, prepareTransactionForWallet, convertSignedTransaction, ValidationError, isConnectorError } from './chunk-J7DHGLW6.mjs';
2
2
  import { Component, useTransition, useState, useCallback, useMemo } from 'react';
3
3
  import { jsx, jsxs } from 'react/jsx-runtime';
4
4
  import { install } from '@solana/webcrypto-ed25519-polyfill';
5
5
  import { address, isAddress } from '@solana/addresses';
6
- import { getTransactionDecoder, assertIsTransactionWithinSizeLimit } from '@solana/transactions';
7
6
  import { getBase58Decoder } from '@solana/codecs';
7
+ import { getTransactionDecoder, assertIsTransactionWithinSizeLimit } from '@solana/transactions';
8
8
 
9
- // src/lib/adapters/wallet-standard-shim.ts
10
- var registry = null;
9
+ // src/lib/wallet/standard-shim.ts
10
+ var registry = null, registryInitPromise = null, registryInitResolve = null, ready = new Promise((resolve, reject) => {
11
+ if (typeof window > "u") {
12
+ resolve();
13
+ return;
14
+ }
15
+ registryInitResolve = resolve;
16
+ let nav = window.navigator;
17
+ if (nav.wallets && typeof nav.wallets.get == "function") {
18
+ registry = nav.wallets, resolve();
19
+ return;
20
+ }
21
+ registryInitPromise = import('@wallet-standard/app').then((mod) => {
22
+ let walletStandardRegistry = mod.getWallets?.();
23
+ walletStandardRegistry && (registry = walletStandardRegistry), resolve();
24
+ }).catch((err) => {
25
+ console.warn("[standard-shim] Failed to load @wallet-standard/app:", err), resolve();
26
+ });
27
+ });
11
28
  function getWalletsRegistry() {
12
29
  if (typeof window > "u")
13
30
  return {
@@ -15,12 +32,13 @@ function getWalletsRegistry() {
15
32
  on: () => () => {
16
33
  }
17
34
  };
18
- if (!registry) {
35
+ if (!registry && !registryInitPromise) {
19
36
  let nav = window.navigator;
20
- nav.wallets && typeof nav.wallets.get == "function" ? registry = nav.wallets : import('@wallet-standard/app').then((mod) => {
37
+ nav.wallets && typeof nav.wallets.get == "function" ? (registry = nav.wallets, registryInitResolve?.()) : registryInitPromise = import('@wallet-standard/app').then((mod) => {
21
38
  let walletStandardRegistry = mod.getWallets?.();
22
- walletStandardRegistry && (registry = walletStandardRegistry);
39
+ walletStandardRegistry && (registry = walletStandardRegistry), registryInitResolve?.();
23
40
  }).catch(() => {
41
+ registryInitResolve?.();
24
42
  });
25
43
  }
26
44
  return {
@@ -49,135 +67,6 @@ function getWalletsRegistry() {
49
67
  };
50
68
  }
51
69
 
52
- // src/lib/errors/index.ts
53
- var ConnectorError = class extends Error {
54
- constructor(message, context, originalError) {
55
- super(message);
56
- __publicField(this, "context");
57
- __publicField(this, "originalError");
58
- __publicField(this, "timestamp");
59
- this.name = this.constructor.name, this.context = context, this.originalError = originalError, this.timestamp = (/* @__PURE__ */ new Date()).toISOString(), Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
60
- }
61
- toJSON() {
62
- return {
63
- name: this.name,
64
- code: this.code,
65
- message: this.message,
66
- recoverable: this.recoverable,
67
- context: this.context,
68
- timestamp: this.timestamp,
69
- originalError: this.originalError?.message
70
- };
71
- }
72
- }, ConnectionError = class extends ConnectorError {
73
- constructor(code, message, context, originalError) {
74
- super(message, context, originalError);
75
- __publicField(this, "code");
76
- __publicField(this, "recoverable", true);
77
- this.code = code;
78
- }
79
- }, ValidationError = class extends ConnectorError {
80
- constructor(code, message, context, originalError) {
81
- super(message, context, originalError);
82
- __publicField(this, "code");
83
- __publicField(this, "recoverable", false);
84
- this.code = code;
85
- }
86
- }, ConfigurationError = class extends ConnectorError {
87
- constructor(code, message, context, originalError) {
88
- super(message, context, originalError);
89
- __publicField(this, "code");
90
- __publicField(this, "recoverable", false);
91
- this.code = code;
92
- }
93
- }, NetworkError = class extends ConnectorError {
94
- constructor(code, message, context, originalError) {
95
- super(message, context, originalError);
96
- __publicField(this, "code");
97
- __publicField(this, "recoverable", true);
98
- this.code = code;
99
- }
100
- }, TransactionError = class extends ConnectorError {
101
- constructor(code, message, context, originalError) {
102
- super(message, context, originalError);
103
- __publicField(this, "code");
104
- __publicField(this, "recoverable");
105
- this.code = code, this.recoverable = ["USER_REJECTED", "SEND_FAILED", "SIMULATION_FAILED"].includes(code);
106
- }
107
- };
108
- function isConnectorError(error) {
109
- return error instanceof ConnectorError;
110
- }
111
- function isConnectionError(error) {
112
- return error instanceof ConnectionError;
113
- }
114
- function isValidationError(error) {
115
- return error instanceof ValidationError;
116
- }
117
- function isConfigurationError(error) {
118
- return error instanceof ConfigurationError;
119
- }
120
- function isNetworkError(error) {
121
- return error instanceof NetworkError;
122
- }
123
- function isTransactionError(error) {
124
- return error instanceof TransactionError;
125
- }
126
- var Errors = {
127
- walletNotConnected: (context) => new ConnectionError("WALLET_NOT_CONNECTED", "No wallet connected", context),
128
- walletNotFound: (walletName) => new ConnectionError("WALLET_NOT_FOUND", `Wallet not found${walletName ? `: ${walletName}` : ""}`, {
129
- walletName
130
- }),
131
- connectionFailed: (originalError) => new ConnectionError("CONNECTION_FAILED", "Failed to connect to wallet", void 0, originalError),
132
- accountNotAvailable: (address) => new ConnectionError("ACCOUNT_NOT_AVAILABLE", "Requested account not available", { address }),
133
- invalidTransaction: (reason, context) => new ValidationError("INVALID_TRANSACTION", `Invalid transaction: ${reason}`, context),
134
- invalidFormat: (expectedFormat, actualFormat) => new ValidationError("INVALID_FORMAT", `Invalid format: expected ${expectedFormat}`, {
135
- expectedFormat,
136
- actualFormat
137
- }),
138
- unsupportedFormat: (format) => new ValidationError("UNSUPPORTED_FORMAT", `Unsupported format: ${format}`, { format }),
139
- missingProvider: (hookName) => new ConfigurationError(
140
- "MISSING_PROVIDER",
141
- `${hookName} must be used within ConnectorProvider. Wrap your app with <ConnectorProvider> or <UnifiedProvider>.`,
142
- { hookName }
143
- ),
144
- clusterNotFound: (clusterId, availableClusters) => new ConfigurationError(
145
- "CLUSTER_NOT_FOUND",
146
- `Cluster ${clusterId} not found. Available clusters: ${availableClusters.join(", ")}`,
147
- { clusterId, availableClusters }
148
- ),
149
- rpcError: (message, originalError) => new NetworkError("RPC_ERROR", message, void 0, originalError),
150
- networkTimeout: () => new NetworkError("NETWORK_TIMEOUT", "Network request timed out"),
151
- signingFailed: (originalError) => new TransactionError("SIGNING_FAILED", "Failed to sign transaction", void 0, originalError),
152
- featureNotSupported: (feature) => new TransactionError("FEATURE_NOT_SUPPORTED", `Wallet does not support ${feature}`, { feature }),
153
- userRejected: (operation) => new TransactionError("USER_REJECTED", `User rejected ${operation}`, { operation })
154
- };
155
- function toConnectorError(error, defaultMessage = "An unexpected error occurred") {
156
- if (isConnectorError(error))
157
- return error;
158
- if (error instanceof Error) {
159
- let message = error.message.toLowerCase();
160
- return message.includes("user rejected") || message.includes("user denied") ? Errors.userRejected("transaction") : message.includes("wallet not found") || message.includes("not installed") ? Errors.walletNotFound() : message.includes("not connected") ? Errors.walletNotConnected() : message.includes("network") || message.includes("fetch") ? Errors.rpcError(error.message, error) : message.includes("invalid") ? new ValidationError("VALIDATION_FAILED", error.message, void 0, error) : new TransactionError("SIGNING_FAILED", error.message, void 0, error);
161
- }
162
- return new TransactionError("SIGNING_FAILED", defaultMessage, { originalError: String(error) });
163
- }
164
- function getUserFriendlyMessage(error) {
165
- return isConnectorError(error) ? {
166
- WALLET_NOT_CONNECTED: "Please connect your wallet to continue.",
167
- WALLET_NOT_FOUND: "Wallet not found. Please install a supported wallet.",
168
- CONNECTION_FAILED: "Failed to connect to wallet. Please try again.",
169
- USER_REJECTED: "Transaction was cancelled.",
170
- FEATURE_NOT_SUPPORTED: "This wallet does not support this feature.",
171
- SIGNING_FAILED: "Failed to sign transaction. Please try again.",
172
- SEND_FAILED: "Failed to send transaction. Please try again.",
173
- INVALID_CLUSTER: "Invalid network configuration.",
174
- CLUSTER_NOT_FOUND: "Network not found.",
175
- MISSING_PROVIDER: "Application not properly configured.",
176
- RPC_ERROR: "Network error. Please check your connection.",
177
- NETWORK_TIMEOUT: "Request timed out. Please try again."
178
- }[error.code] || error.message || "An error occurred." : "An unexpected error occurred. Please try again.";
179
- }
180
-
181
70
  // src/utils/network.ts
182
71
  var PUBLIC_RPC_ENDPOINTS = {
183
72
  mainnet: "https://api.mainnet-beta.solana.com",
@@ -521,7 +410,7 @@ var BaseCollaborator = class {
521
410
  }
522
411
  };
523
412
 
524
- // src/lib/connection/wallet-authenticity-verifier.ts
413
+ // src/lib/wallet/authenticity-verifier.ts
525
414
  var logger2 = createLogger("WalletAuthenticity"), WalletAuthenticityVerifier = class {
526
415
  /**
527
416
  * Verify a wallet's authenticity using dynamic heuristics
@@ -731,7 +620,7 @@ var logger2 = createLogger("WalletAuthenticity"), WalletAuthenticityVerifier = c
731
620
  }
732
621
  };
733
622
 
734
- // src/lib/connection/wallet-detector.ts
623
+ // src/lib/wallet/detector.ts
735
624
  var logger3 = createLogger("WalletDetector");
736
625
  function hasFeature(wallet, featureName) {
737
626
  return wallet.features != null && wallet.features[featureName] !== void 0;
@@ -757,7 +646,14 @@ var WalletDetector = class extends BaseCollaborator {
757
646
  __publicField(this, "unsubscribers", []);
758
647
  }
759
648
  /**
760
- * Initialize wallet detection
649
+ * Initialize wallet detection (synchronous)
650
+ *
651
+ * Sets up registry listeners immediately. Due to the async nature of registry initialization,
652
+ * the initial call to `get()` may return an empty array if called before the registry is ready.
653
+ * Event listeners will fire as wallets register, providing eventual consistency.
654
+ *
655
+ * For deterministic detection where you need all wallets available immediately,
656
+ * use `initializeAsync()` instead.
761
657
  */
762
658
  initialize() {
763
659
  if (!(typeof window > "u"))
@@ -780,6 +676,24 @@ var WalletDetector = class extends BaseCollaborator {
780
676
  } catch {
781
677
  }
782
678
  }
679
+ /**
680
+ * Initialize wallet detection with deterministic registry availability (async)
681
+ *
682
+ * Awaits the registry `ready` Promise before performing initial detection,
683
+ * ensuring all registered wallets are available on the first `get()` call.
684
+ *
685
+ * Use this when you need guaranteed wallet availability before proceeding
686
+ * (e.g., auto-reconnect logic, checking if a specific wallet is installed).
687
+ *
688
+ * @example
689
+ * ```ts
690
+ * await walletDetector.initializeAsync();
691
+ * const wallets = walletDetector.getDetectedWallets(); // Guaranteed populated
692
+ * ```
693
+ */
694
+ async initializeAsync() {
695
+ typeof window > "u" || (await ready, this.initialize());
696
+ }
783
697
  /**
784
698
  * Check if a specific wallet is available immediately via direct window object detection
785
699
  */
@@ -866,7 +780,7 @@ var WalletDetector = class extends BaseCollaborator {
866
780
  }
867
781
  };
868
782
 
869
- // src/lib/connection/connection-manager.ts
783
+ // src/lib/wallet/connection-manager.ts
870
784
  function getConnectFeature(wallet) {
871
785
  return wallet.features["standard:connect"]?.connect ?? null;
872
786
  }
@@ -1076,7 +990,7 @@ var ConnectionManager = class extends BaseCollaborator {
1076
990
  }
1077
991
  };
1078
992
 
1079
- // src/lib/connection/auto-connector.ts
993
+ // src/lib/wallet/auto-connector.ts
1080
994
  var logger4 = createLogger("AutoConnector"), MIN_ADDRESS_LENGTH = 30, AutoConnector = class {
1081
995
  constructor(walletDetector, connectionManager, stateManager, walletStorage, debug = false) {
1082
996
  __publicField(this, "walletDetector");
@@ -1190,7 +1104,7 @@ var logger4 = createLogger("AutoConnector"), MIN_ADDRESS_LENGTH = 30, AutoConnec
1190
1104
  ]
1191
1105
  },
1192
1106
  true
1193
- );
1107
+ ), await ready;
1194
1108
  let walletsApi = getWalletsRegistry(), registryWallet = walletsApi.get().find((w) => w.name === storedWalletName), walletToUse = registryWallet || wallet;
1195
1109
  return this.debug && logger4.info("Attempting to connect via instant auto-connect", {
1196
1110
  walletName: storedWalletName,
@@ -1446,16 +1360,15 @@ var logger5 = createLogger("ConnectorClient"), ConnectorClient = class {
1446
1360
  ), this.initialize();
1447
1361
  }
1448
1362
  initialize() {
1449
- if (!(typeof window > "u") && !this.initialized)
1450
- try {
1451
- this.walletDetector.initialize(), this.config.autoConnect && setTimeout(() => {
1452
- this.autoConnector.attemptAutoConnect().catch((err) => {
1453
- this.config.debug && logger5.error("Auto-connect error", { error: err });
1454
- });
1455
- }, 100), this.initialized = true;
1456
- } catch (e) {
1457
- this.config.debug && logger5.error("Connector initialization failed", { error: e });
1458
- }
1363
+ if (typeof window > "u" || this.initialized) return;
1364
+ let { error } = tryCatchSync(() => {
1365
+ this.walletDetector.initialize(), this.config.autoConnect && setTimeout(() => {
1366
+ this.autoConnector.attemptAutoConnect().catch((err) => {
1367
+ this.config.debug && logger5.error("Auto-connect error", { error: err });
1368
+ });
1369
+ }, 100), this.initialized = true;
1370
+ });
1371
+ error && this.config.debug && logger5.error("Connector initialization failed", { error });
1459
1372
  }
1460
1373
  async select(walletName) {
1461
1374
  let wallet = this.stateManager.getSnapshot().wallets.find((w) => w.wallet.name === walletName)?.wallet;
@@ -1480,11 +1393,8 @@ var logger5 = createLogger("ConnectorClient"), ConnectorClient = class {
1480
1393
  getRpcUrl() {
1481
1394
  let cluster = this.clusterManager.getCluster();
1482
1395
  if (!cluster) return null;
1483
- try {
1484
- return getClusterRpcUrl(cluster);
1485
- } catch (error) {
1486
- return this.config.debug && logger5.error("Failed to get RPC URL", { error }), null;
1487
- }
1396
+ let { data, error } = tryCatchSync(() => getClusterRpcUrl(cluster));
1397
+ return error ? (this.config.debug && logger5.error("Failed to get RPC URL", { error }), null) : data;
1488
1398
  }
1489
1399
  subscribe(listener) {
1490
1400
  return this.stateManager.subscribe(listener);
@@ -1497,12 +1407,10 @@ var logger5 = createLogger("ConnectorClient"), ConnectorClient = class {
1497
1407
  let storageKeys = ["account", "wallet", "cluster"];
1498
1408
  for (let key of storageKeys) {
1499
1409
  let storage = this.config.storage?.[key];
1500
- if (storage && "reset" in storage && typeof storage.reset == "function")
1501
- try {
1502
- storage.reset(), this.config.debug && logger5.debug("Reset storage", { key });
1503
- } catch (error) {
1504
- this.config.debug && logger5.error("Failed to reset storage", { key, error });
1505
- }
1410
+ if (storage && "reset" in storage && typeof storage.reset == "function") {
1411
+ let resetFn = storage.reset, { error } = tryCatchSync(() => resetFn());
1412
+ error ? this.config.debug && logger5.error("Failed to reset storage", { key, error }) : this.config.debug && logger5.debug("Reset storage", { key });
1413
+ }
1506
1414
  }
1507
1415
  this.eventEmitter.emit({
1508
1416
  type: "storage:reset",
@@ -2170,9 +2078,28 @@ var logger8 = createLogger("TransactionValidator"), MAX_TRANSACTION_SIZE = 1232,
2170
2078
  return transactions.map((tx, index) => (logger8.debug(`Validating transaction ${index + 1}/${transactions.length}`), this.validate(tx, options)));
2171
2079
  }
2172
2080
  };
2173
-
2174
- // src/lib/transaction/transaction-signer.ts
2175
2081
  var logger9 = createLogger("TransactionSigner");
2082
+ function signatureBytesToBase58(bytes) {
2083
+ if (bytes.length !== 64)
2084
+ throw new Error(`Invalid signature length: expected 64 bytes, got ${bytes.length}`);
2085
+ return getBase58Decoder().decode(bytes);
2086
+ }
2087
+ function extractSignatureString(result) {
2088
+ if (typeof result == "string")
2089
+ return result;
2090
+ if (result instanceof Uint8Array)
2091
+ return signatureBytesToBase58(result);
2092
+ if (Array.isArray(result) && result.length > 0)
2093
+ return extractSignatureString(result[0]);
2094
+ if (result && typeof result == "object") {
2095
+ let record = result;
2096
+ if ("signature" in record)
2097
+ return extractSignatureString(record.signature);
2098
+ if (Array.isArray(record.signatures) && record.signatures.length > 0)
2099
+ return extractSignatureString(record.signatures[0]);
2100
+ }
2101
+ throw new Error("Unexpected wallet response format for signAndSendTransaction");
2102
+ }
2176
2103
  function createTransactionSigner(config) {
2177
2104
  let { wallet, account, cluster, eventEmitter } = config;
2178
2105
  if (!wallet || !account)
@@ -2332,7 +2259,7 @@ function createTransactionSigner(config) {
2332
2259
  transaction: serialized
2333
2260
  });
2334
2261
  }
2335
- let signature = typeof result == "object" && result.signature ? result.signature : String(result);
2262
+ let signature = extractSignatureString(result);
2336
2263
  return eventEmitter && eventEmitter.emit({
2337
2264
  type: "transaction:sent",
2338
2265
  signature,
@@ -2410,6 +2337,29 @@ function decodeShortVecLength(data) {
2410
2337
  }
2411
2338
  return { length, bytesConsumed: size };
2412
2339
  }
2340
+ function parseMessageSigners(messageBytes) {
2341
+ let offset = 0;
2342
+ if (messageBytes.length < 4)
2343
+ throw new Error("Invalid message: too short for header");
2344
+ if (messageBytes[0] === 128 && (offset = 1), offset + 3 > messageBytes.length)
2345
+ throw new Error("Invalid message: incomplete header");
2346
+ let numSignerAccounts = messageBytes[offset];
2347
+ if (offset += 3, offset >= messageBytes.length)
2348
+ throw new Error("Invalid message: no static accounts section");
2349
+ let { length: numStaticAccounts, bytesConsumed } = decodeShortVecLength(messageBytes.subarray(offset));
2350
+ offset += bytesConsumed;
2351
+ let staticAccounts = [], base58Decoder = getBase58Decoder();
2352
+ for (let i = 0; i < numStaticAccounts && i < numSignerAccounts; i++) {
2353
+ if (offset + 32 > messageBytes.length)
2354
+ throw new Error(`Invalid message: incomplete account ${i}`);
2355
+ let accountBytes = messageBytes.subarray(offset, offset + 32), accountAddress = base58Decoder.decode(accountBytes);
2356
+ staticAccounts.push(accountAddress), offset += 32;
2357
+ }
2358
+ return {
2359
+ numSigners: numSignerAccounts,
2360
+ staticAccounts
2361
+ };
2362
+ }
2413
2363
  function createTransactionBytesForSigning(messageBytes, numSigners) {
2414
2364
  let numSignaturesBytes = encodeShortVecLength(numSigners), signatureSlots = new Uint8Array(numSigners * 64), totalLength = numSignaturesBytes.length + signatureSlots.length + messageBytes.length, transactionBytes = new Uint8Array(totalLength), offset = 0;
2415
2365
  return transactionBytes.set(numSignaturesBytes, offset), offset += numSignaturesBytes.length, transactionBytes.set(signatureSlots, offset), offset += signatureSlots.length, transactionBytes.set(messageBytes, offset), transactionBytes;
@@ -2441,7 +2391,7 @@ function createKitTransactionSigner(connectorSigner) {
2441
2391
  address: signerAddress,
2442
2392
  async modifyAndSignTransactions(transactions) {
2443
2393
  let transactionData = transactions.map((tx) => {
2444
- let messageBytes = new Uint8Array(tx.messageBytes), numSigners = Object.keys(tx.signatures).length, wireFormat = createTransactionBytesForSigning(messageBytes, numSigners);
2394
+ let messageBytes = new Uint8Array(tx.messageBytes), { numSigners } = parseMessageSigners(messageBytes), wireFormat = createTransactionBytesForSigning(messageBytes, numSigners);
2445
2395
  return logger10.debug("Preparing wire format for wallet", {
2446
2396
  signerAddress,
2447
2397
  messageBytesLength: messageBytes.length,
@@ -2518,6 +2468,6 @@ function createKitTransactionSigner(connectorSigner) {
2518
2468
  }
2519
2469
  var createGillTransactionSigner = createKitTransactionSigner;
2520
2470
 
2521
- export { ClipboardErrorType, ConfigurationError, ConnectionError, ConnectorClient, ConnectorError, ConnectorErrorBoundary, DEFAULT_MAX_RETRIES, Errors, NetworkError, PUBLIC_RPC_ENDPOINTS, TransactionError, TransactionSignerError, ValidationError, WalletErrorType, copyAddressToClipboard, copySignatureToClipboard, copyToClipboard, createGillTransactionSigner, createKitTransactionSigner, createTransactionSigner, formatAddress, formatBigIntBalance, formatBigIntUsd, formatLamportsToSolSafe, formatNumber, formatSOL, formatTokenAmount, formatTokenBalanceSafe, getAddressUrl, getBlockUrl, getChainIdForWalletStandard, getClusterChainId, getClusterExplorerUrl, getClusterName, getClusterRpcUrl, getClusterType, getDefaultRpcUrl, getNetworkDisplayName, getPolyfillStatus, getTokenUrl, getTransactionUrl, getUserFriendlyMessage, getWalletsRegistry, installPolyfills, isClipboardAvailable, isConfigurationError, isConnectionError, isConnectorError, isCryptoAvailable, isDevnet, isDevnetCluster, isLocalCluster, isLocalnet, isMainnet, isMainnetCluster, isNetworkError, isPolyfillInstalled, isTestnet, isTestnetCluster, isTransactionError, isTransactionSignerError, isValidationError, normalizeNetwork, toClusterId, toConnectorError, truncate, withErrorBoundary };
2522
- //# sourceMappingURL=chunk-APQGEW7S.mjs.map
2523
- //# sourceMappingURL=chunk-APQGEW7S.mjs.map
2471
+ export { ClipboardErrorType, ConnectorClient, ConnectorErrorBoundary, DEFAULT_MAX_RETRIES, PUBLIC_RPC_ENDPOINTS, TransactionSignerError, WalletErrorType, copyAddressToClipboard, copySignatureToClipboard, copyToClipboard, createGillTransactionSigner, createKitTransactionSigner, createTransactionSigner, formatAddress, formatBigIntBalance, formatBigIntUsd, formatLamportsToSolSafe, formatNumber, formatSOL, formatTokenAmount, formatTokenBalanceSafe, getAddressUrl, getBlockUrl, getChainIdForWalletStandard, getClusterChainId, getClusterExplorerUrl, getClusterName, getClusterRpcUrl, getClusterType, getDefaultRpcUrl, getNetworkDisplayName, getPolyfillStatus, getTokenUrl, getTransactionUrl, getWalletsRegistry, installPolyfills, isClipboardAvailable, isCryptoAvailable, isDevnet, isDevnetCluster, isLocalCluster, isLocalnet, isMainnet, isMainnetCluster, isPolyfillInstalled, isTestnet, isTestnetCluster, isTransactionSignerError, normalizeNetwork, ready, toClusterId, truncate, withErrorBoundary };
2472
+ //# sourceMappingURL=chunk-MAXA3HEP.mjs.map
2473
+ //# sourceMappingURL=chunk-MAXA3HEP.mjs.map