@solana/connector 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +236 -0
- package/dist/{chunk-U64YZRJL.mjs → chunk-3STZXVXD.mjs} +254 -53
- package/dist/chunk-3STZXVXD.mjs.map +1 -0
- package/dist/{chunk-RIQH5W7D.js → chunk-I64FD2EH.js} +4 -3
- package/dist/chunk-I64FD2EH.js.map +1 -0
- package/dist/{chunk-CLXM6UEE.js → chunk-JUZVCBAI.js} +91 -85
- package/dist/chunk-JUZVCBAI.js.map +1 -0
- package/dist/{chunk-D6PZY5G6.js → chunk-NQXK7PGX.js} +30 -26
- package/dist/chunk-NQXK7PGX.js.map +1 -0
- package/dist/{chunk-N3Q2J2FG.mjs → chunk-QKVL45F6.mjs} +10 -6
- package/dist/chunk-QKVL45F6.mjs.map +1 -0
- package/dist/{chunk-P5MWBDFG.mjs → chunk-QL3IT3TS.mjs} +4 -3
- package/dist/chunk-QL3IT3TS.mjs.map +1 -0
- package/dist/{chunk-LUZWUZ5N.js → chunk-ULUYX23Q.js} +268 -67
- package/dist/chunk-ULUYX23Q.js.map +1 -0
- package/dist/{chunk-YTCSTE3Q.mjs → chunk-VMSZJPR5.mjs} +10 -4
- package/dist/chunk-VMSZJPR5.mjs.map +1 -0
- package/dist/compat.js +3 -3
- package/dist/compat.mjs +1 -1
- package/dist/headless.d.mts +2 -2
- package/dist/headless.d.ts +2 -2
- package/dist/headless.js +120 -120
- package/dist/headless.mjs +3 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +147 -147
- package/dist/index.mjs +4 -4
- package/dist/react.d.mts +4 -4
- package/dist/react.d.ts +4 -4
- package/dist/react.js +28 -28
- package/dist/react.mjs +2 -2
- package/dist/{wallet-standard-shim-DC_Z7DS-.d.ts → wallet-standard-shim--YcrQNRt.d.ts} +83 -0
- package/dist/{wallet-standard-shim-Cp4vF4oo.d.mts → wallet-standard-shim-Dx7H8Ctf.d.mts} +83 -0
- package/package.json +1 -1
- package/dist/chunk-CLXM6UEE.js.map +0 -1
- package/dist/chunk-D6PZY5G6.js.map +0 -1
- package/dist/chunk-LUZWUZ5N.js.map +0 -1
- package/dist/chunk-N3Q2J2FG.mjs.map +0 -1
- package/dist/chunk-P5MWBDFG.mjs.map +0 -1
- package/dist/chunk-RIQH5W7D.js.map +0 -1
- package/dist/chunk-U64YZRJL.mjs.map +0 -1
- package/dist/chunk-YTCSTE3Q.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/adapters/enhanced-storage.ts","../src/config/default-config.ts","../src/config/unified-config.ts","../src/types/wallets.ts","../src/lib/kit-signers/utils.ts","../src/lib/kit-signers/factories.ts","../src/lib/kit-signers/integration.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","message"],"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,GAAA,EAAI,CAAA;AAC7D,IAAA,aAAA,CAAA,IAAA,EAAQ,cAAwC,EAAC,CAAA;AACjD,IAAA,aAAA,CAAA,IAAA,EAAQ,gBAAA,CAAA;AAQJ,IAAA,IAAA,CAAK,iBAAiB,OAAA,EAElB,OAAA,EAAS,OAAA,IACT,IAAA,CAAK,cAAc,GAAA,CAAI,OAAA,CAAQ,OAAO,CAAA,EAEtC,SAAS,SAAA,IACT,IAAA,CAAK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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 } 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/adapters/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\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\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 } = 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 };\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 - Unified configuration\n *\n * Simplified configuration for apps using ConnectorKit\n * Eliminates config duplication and provides a single source of truth\n */\n\nimport type { ExtendedConnectorConfig, DefaultConfigOptions } from './default-config';\nimport type { MobileWalletAdapterConfig } from '../ui/connector-provider';\nimport { getDefaultConfig, getDefaultMobileConfig } from './default-config';\nimport { normalizeNetwork, getDefaultRpcUrl, type SolanaNetwork } from '../utils/network';\n\n/**\n * Options for creating a unified configuration\n * Maintains type safety while providing flexibility\n */\nexport interface UnifiedConfigOptions extends DefaultConfigOptions {\n /**\n * Custom RPC URL (optional - overrides default for network)\n * Note: For production apps, use environment variables to avoid exposing API keys\n * @see packages/connector/src/utils/cluster.ts for secure RPC URL patterns\n */\n rpcUrl?: string;\n}\n\n/**\n * Unified configuration output\n * Contains all configs needed for ConnectorKit and integrations\n *\n * Important: The `rpcUrl` property is intended for:\n * 1. Server-side rendering (SSR) setup\n * 2. Passing to external libraries that need RPC configuration\n * 3. Development/testing environments\n *\n * For production client-side code, use the connector client's `getRpcUrl()` method\n * which supports environment variable patterns and proxy configurations.\n */\nexport interface UnifiedConfig {\n /** ConnectorKit configuration */\n connectorConfig: ExtendedConnectorConfig;\n /** Mobile Wallet Adapter configuration (optional) */\n mobile?: MobileWalletAdapterConfig;\n /** Normalized network name ('mainnet', 'devnet', 'testnet', 'localnet') */\n network: SolanaNetwork;\n /**\n * RPC endpoint URL\n * For external library integration only - client code should use connector client\n * @deprecated in client components - use `useConnectorClient().getRpcUrl()` instead\n */\n rpcUrl: string;\n /** Application metadata */\n app: {\n name: string;\n url: string;\n };\n}\n\n/**\n * Create a unified configuration for ConnectorKit\n *\n * This helper eliminates configuration duplication by creating all necessary\n * configs from a single source of truth. It automatically handles network\n * name translation between different conventions.\n *\n * @example Basic usage\n * ```tsx\n * import { createConfig, AppProvider } from '@solana/connector';\n *\n * const config = createConfig({\n * appName: 'My App',\n * network: 'mainnet', // Works with 'mainnet' or 'mainnet-beta'\n * enableMobile: true\n * });\n *\n * <AppProvider config={config}>\n * {children}\n * </AppProvider>\n * ```\n *\n * @example Integration with external libraries\n * ```tsx\n * import { createConfig, AppProvider } from '@solana/connector';\n * import { ArmaProvider } from '@armadura/sdk';\n *\n * const config = createConfig({\n * appName: 'My App',\n * network: 'mainnet',\n * });\n *\n * <AppProvider config={config}>\n * <ArmaProvider\n * config={{\n * network: config.network,\n * rpcUrl: config.rpcUrl, // Safe - for external library initialization\n * providers: [...]\n * }}\n * useConnector=\"auto\"\n * >\n * {children}\n * </ArmaProvider>\n * </AppProvider>\n * ```\n *\n * @example Production with environment variables\n * ```tsx\n * // Use environment variables to avoid exposing API keys\n * const config = createConfig({\n * appName: 'My App',\n * network: 'mainnet',\n * // RPC URL comes from process.env on server\n * // Client-side code should use connector client's getRpcUrl()\n * });\n * ```\n *\n * @example Custom clusters\n * ```tsx\n * const config = createConfig({\n * appName: 'My App',\n * network: 'mainnet',\n * customClusters: [\n * {\n * id: 'solana:custom',\n * label: 'Custom RPC',\n * url: process.env.CUSTOM_RPC_URL || 'https://...'\n * }\n * ]\n * });\n * ```\n */\nexport function createConfig(options: UnifiedConfigOptions): UnifiedConfig {\n // Extract network and rpcUrl, use remaining options for connector config\n const { network = 'mainnet-beta', rpcUrl: customRpcUrl, ...connectorOptions } = options;\n\n // Normalize network name for consistency\n const normalizedNetwork = normalizeNetwork(typeof network === 'string' ? network : 'mainnet-beta');\n\n // Get RPC URL (custom or default)\n const rpcUrl = customRpcUrl || getDefaultRpcUrl(normalizedNetwork);\n\n // Convert normalized network to RPC format (mainnet -> mainnet-beta)\n const rpcNetwork = normalizedNetwork === 'mainnet' ? 'mainnet-beta' : normalizedNetwork;\n\n // Create connector configuration\n const connectorConfig = getDefaultConfig({\n ...connectorOptions,\n network: rpcNetwork,\n });\n\n // Create mobile configuration (if enabled)\n const mobile =\n options.enableMobile !== false && normalizedNetwork !== 'localnet'\n ? getDefaultMobileConfig({\n appName: options.appName,\n appUrl: connectorConfig.appUrl,\n network: rpcNetwork as 'mainnet-beta' | 'devnet' | 'testnet',\n })\n : undefined;\n\n return {\n connectorConfig,\n mobile,\n network: normalizedNetwork,\n rpcUrl,\n app: {\n name: options.appName,\n url:\n connectorConfig.appUrl ||\n (typeof window !== 'undefined' ? window.location.origin : 'https://localhost:3000'),\n },\n };\n}\n\n/**\n * Type guard to check if a config is a unified config\n *\n * @example\n * ```ts\n * if (isUnifiedConfig(someConfig)) {\n * // TypeScript knows this is UnifiedConfig\n * console.log(someConfig.network, someConfig.rpcUrl);\n * }\n * ```\n */\nexport function isUnifiedConfig(config: unknown): config is UnifiedConfig {\n return Boolean(\n config &&\n typeof config === 'object' &&\n 'connectorConfig' in config &&\n 'network' in config &&\n 'rpcUrl' in config &&\n 'app' in config,\n );\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 { Address } from '@solana/addresses';\nimport { getBase58Decoder, getBase58Encoder } from '@solana/codecs';\nimport type { SignatureBytes } from '@solana/keys';\nimport type { SignatureDictionary } from '@solana/signers';\n\nfunction toSignatureBytes(bytes: Uint8Array): SignatureBytes {\n return bytes as SignatureBytes;\n}\n\nexport function detectMessageModification(original: Uint8Array, modified: Uint8Array): boolean {\n if (original.length !== modified.length) {\n return true;\n }\n\n for (let i = 0; i < original.length; i++) {\n if (original[i] !== modified[i]) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function updateSignatureDictionary(\n original: Uint8Array,\n signed: Uint8Array,\n originalSignatures: SignatureDictionary,\n address: Address<string>,\n signature: Uint8Array,\n): SignatureDictionary {\n const wasModified = detectMessageModification(original, signed);\n\n const signatureBytes = signature as unknown as SignatureBytes;\n\n const newSignatures = {} as Record<string, SignatureBytes>;\n newSignatures[address as string] = signatureBytes;\n\n if (wasModified) {\n return newSignatures as SignatureDictionary;\n }\n\n const merged = {\n ...originalSignatures,\n ...newSignatures,\n };\n\n return merged as SignatureDictionary;\n}\n\nexport function freezeSigner<T extends object>(signer: T): Readonly<T> {\n return Object.freeze(signer);\n}\n\nexport function base58ToSignatureBytes(signature: string): SignatureBytes {\n try {\n const bytes = getBase58Encoder().encode(signature);\n if (bytes.length !== 64) {\n throw new Error(`Invalid signature length: expected 64 bytes, got ${bytes.length}`);\n }\n return bytes as SignatureBytes;\n } catch (error) {\n throw new Error(`Failed to decode base58 signature: ${error instanceof Error ? error.message : String(error)}`);\n }\n}\n\nexport function signatureBytesToBase58(bytes: SignatureBytes): string {\n try {\n if (bytes.length !== 64) {\n throw new Error(`Invalid signature length: expected 64 bytes, got ${bytes.length}`);\n }\n return getBase58Decoder().decode(bytes);\n } catch (error) {\n throw new Error(\n `Failed to encode signature to base58: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n}\n","/**\n * @solana/connector - Kit Signer Factories\n *\n * Framework-agnostic factory functions to create Kit-compatible signers from wallet functions.\n * These factories enable pure Kit integration without React or framework dependencies.\n */\n\nimport type { Address } from '@solana/addresses';\nimport type {\n MessageModifyingSigner,\n TransactionSendingSigner,\n SignableMessage,\n MessageModifyingSignerConfig,\n TransactionSendingSignerConfig,\n} from '@solana/signers';\nimport type { SignatureBytes } from '@solana/keys';\nimport { ValidationError, TransactionError, Errors } from '../errors';\nimport { updateSignatureDictionary, freezeSigner, base58ToSignatureBytes } from './utils';\n\n/**\n * Create a MessageModifyingSigner from a wallet's sign message function\n *\n * This is a pure, framework-agnostic factory function that can be used anywhere.\n * Enables message signing (SIWS, auth) without React.\n *\n * @param walletAddress - The address of the wallet\n * @param signMessageFn - Function to sign a message (from wallet adapter)\n * @returns A frozen MessageModifyingSigner object\n *\n * @example\n * ```typescript\n * import { address } from '@solana/addresses';\n * import { createMessageSignerFromWallet } from '@solana/connector/headless';\n *\n * const signer = createMessageSignerFromWallet(\n * address('...'),\n * async (msg) => await wallet.signMessage(msg)\n * );\n *\n * // Use with Kit message signing\n * import { createSignableMessage } from '@solana/signers';\n * const signed = await signer.modifyAndSignMessages([createSignableMessage(messageBytes)]);\n * ```\n */\nexport function createMessageSignerFromWallet(\n walletAddress: Address<string>,\n signMessageFn: (message: Uint8Array) => Promise<Uint8Array>,\n): MessageModifyingSigner<string> {\n const signer: MessageModifyingSigner<string> = {\n address: walletAddress,\n\n async modifyAndSignMessages(\n messages: readonly SignableMessage[],\n config?: MessageModifyingSignerConfig,\n ): Promise<readonly SignableMessage[]> {\n // Most wallets only support signing one message at a time\n if (messages.length !== 1) {\n throw new ValidationError('INVALID_FORMAT', 'Wallets only support signing one message at a time', {\n receivedCount: messages.length,\n expectedCount: 1,\n });\n }\n\n const [message] = messages;\n const { content, signatures: originalSignatures } = message;\n\n // Handle abort signal if provided\n if (config?.abortSignal?.aborted) {\n throw Errors.userRejected('message signing');\n }\n\n try {\n // Sign the message\n const signature = await signMessageFn(content);\n\n // Update signatures (handle potential message modification)\n // Note: Message content doesn't change in signMessage operations\n const signatures = updateSignatureDictionary(\n content,\n content, // Message content doesn't change in signMessage\n originalSignatures,\n walletAddress,\n signature,\n );\n\n // Return signed message\n return [\n {\n content,\n signatures,\n },\n ];\n } catch (error) {\n // Convert wallet errors to ConnectorKit errors\n if (error instanceof Error) {\n const message = error.message.toLowerCase();\n if (message.includes('user rejected') || message.includes('user denied')) {\n throw Errors.userRejected('message signing');\n }\n throw new TransactionError('SIGNING_FAILED', 'Failed to sign message', undefined, error);\n }\n throw new TransactionError('SIGNING_FAILED', 'Failed to sign message', {\n originalError: String(error),\n });\n }\n },\n };\n\n return freezeSigner(signer);\n}\n\n/**\n * Create a TransactionSendingSigner from a wallet's send transaction function\n *\n * This is a pure, framework-agnostic factory function that can be used anywhere.\n * Enables sign + send in one operation (wallets like Phantom support this).\n *\n * @param walletAddress - The address of the wallet\n * @param chain - The Solana chain identifier (e.g., 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1')\n * @param sendTransactionFn - Function to send a transaction (from wallet adapter)\n * @returns A frozen TransactionSendingSigner object\n *\n * @example\n * ```typescript\n * import { address } from '@solana/addresses';\n * import { createTransactionSendingSignerFromWallet } from '@solana/connector/headless';\n *\n * const signer = createTransactionSendingSignerFromWallet(\n * address('...'),\n * 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',\n * async (tx) => await wallet.sendTransaction(tx, connection)\n * );\n *\n * // Use with Kit transaction sending\n * const signatures = await signer.signAndSendTransactions([transaction]);\n * ```\n */\nexport function createTransactionSendingSignerFromWallet(\n walletAddress: Address<string>,\n chain: `solana:${string}`,\n sendTransactionFn: (transaction: any) => Promise<string>,\n): TransactionSendingSigner<string> {\n const signer: TransactionSendingSigner<string> = {\n address: walletAddress,\n\n async signAndSendTransactions(\n transactions: readonly any[],\n config?: TransactionSendingSignerConfig,\n ): Promise<readonly SignatureBytes[]> {\n // Most wallets only support signing one transaction at a time\n if (transactions.length !== 1) {\n throw new ValidationError('INVALID_FORMAT', 'Wallets only support sending one transaction at a time', {\n receivedCount: transactions.length,\n expectedCount: 1,\n });\n }\n\n const [transaction] = transactions;\n\n // Handle abort signal if provided\n if (config?.abortSignal?.aborted) {\n throw Errors.userRejected('transaction sending');\n }\n\n try {\n // Send the transaction and get signature string (base58)\n const signatureString = await sendTransactionFn(transaction);\n\n // Convert base58 signature string to SignatureBytes\n const signatureBytes = base58ToSignatureBytes(signatureString);\n\n return [signatureBytes];\n } catch (error) {\n // Convert wallet errors to ConnectorKit errors\n if (error instanceof Error) {\n const message = error.message.toLowerCase();\n if (message.includes('user rejected') || message.includes('user denied')) {\n throw Errors.userRejected('transaction sending');\n }\n if (message.includes('network') || message.includes('rpc')) {\n throw new TransactionError('SEND_FAILED', 'Failed to send transaction', undefined, error);\n }\n throw new TransactionError('SEND_FAILED', 'Failed to send transaction', undefined, error);\n }\n throw new TransactionError('SEND_FAILED', 'Failed to send transaction', {\n originalError: String(error),\n });\n }\n },\n };\n\n return freezeSigner(signer);\n}\n","/**\n * @solana/connector - Kit Integration Helper\n *\n * High-level helper to create Kit signers from Wallet Standard wallets.\n * Framework-agnostic and works in any JavaScript environment.\n */\n\nimport type { Wallet, WalletAccount } from '@wallet-standard/base';\nimport type { Address } from '@solana/addresses';\nimport type { MessageModifyingSigner, TransactionSendingSigner } from '@solana/signers';\nimport { address } from '@solana/addresses';\nimport type { Connection } from '@solana/web3.js';\nimport { createMessageSignerFromWallet, createTransactionSendingSignerFromWallet } from './factories';\nimport { Errors } from '../errors';\n\n/**\n * Result of creating Kit signers from a Wallet Standard wallet\n */\nexport interface KitSignersFromWallet {\n /** Kit Address type (null if wallet not connected) */\n address: Address<string> | null;\n\n /** Plain address string (null if wallet not connected) */\n addressString: string | null;\n\n /** Message signer (null if wallet doesn't support signing or not connected) */\n messageSigner: MessageModifyingSigner<string> | null;\n\n /** Transaction sending signer (null if wallet doesn't support or not connected) */\n transactionSigner: TransactionSendingSigner<string> | null;\n}\n\n/**\n * Create Kit-compatible signers from a Wallet Standard wallet\n *\n * This function bridges Wallet Standard wallets with modern Kit architecture.\n * It's framework-agnostic and can be used in any JavaScript environment.\n *\n * The network is automatically detected from the connection's RPC endpoint.\n * For custom RPC URLs, you can override detection with the optional `network` parameter.\n *\n * @param wallet - The Wallet Standard wallet instance\n * @param account - The wallet account to use (first account if not provided)\n * @param connection - Optional connection for network detection and transaction sending\n * @param network - Optional network override ('mainnet' | 'devnet' | 'testnet')\n * @returns Kit signers object with address and signer instances\n *\n * @example\n * ```typescript\n * import { Connection } from '@solana/web3.js';\n * import { createKitSignersFromWallet } from '@solana/connector/headless';\n *\n * const connection = new Connection('https://api.devnet.solana.com');\n * const { address, messageSigner, transactionSigner } = createKitSignersFromWallet(\n * wallet,\n * account,\n * connection\n * );\n * ```\n */\nexport function createKitSignersFromWallet(\n wallet: Wallet | null,\n account?: WalletAccount | null,\n connection?: Connection | null,\n network?: 'mainnet' | 'devnet' | 'testnet',\n): KitSignersFromWallet {\n // If no wallet or account, return null values\n if (!wallet || !account) {\n return {\n address: null,\n addressString: null,\n messageSigner: null,\n transactionSigner: null,\n };\n }\n\n // Convert account address to Kit Address type\n let walletAddress: Address<string> | null = null;\n let walletAddressString: string | null = null;\n\n try {\n walletAddress = address(account.address) as Address<string>;\n walletAddressString = account.address;\n } catch (error) {\n // Invalid address format\n return {\n address: null,\n addressString: null,\n messageSigner: null,\n transactionSigner: null,\n };\n }\n\n // Detect network from connection or use provided override\n // Note: Will be enhanced in Phase 2 with chain utilities\n let chain: `solana:${string}` = 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1'; // Default to devnet\n\n if (network) {\n // Map network to Wallet Standard chain ID\n const chainMap: Record<string, `solana:${string}`> = {\n mainnet: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',\n devnet: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',\n testnet: 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',\n };\n chain = chainMap[network] || chain;\n } else if (connection) {\n // Detect from connection RPC URL\n const rpcUrl = connection.rpcEndpoint || '';\n if (rpcUrl.includes('mainnet') || rpcUrl.includes('api.mainnet-beta')) {\n chain = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp';\n } else if (rpcUrl.includes('testnet')) {\n chain = 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z';\n } else {\n // Default to devnet\n chain = 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1';\n }\n }\n\n // Check wallet features for capabilities\n const features = wallet.features as Record<string, Record<string, (...args: unknown[]) => unknown>>;\n const hasSignMessage = Boolean(features['solana:signMessage']);\n const hasSignAndSendTransaction = Boolean(features['solana:signAndSendTransaction']);\n const hasSendTransaction = Boolean(features['solana:sendTransaction']);\n\n // Create message signer if wallet supports message signing\n const messageSigner: MessageModifyingSigner<string> | null = hasSignMessage\n ? createMessageSignerFromWallet(walletAddress, async (message: Uint8Array) => {\n if (!hasSignMessage) {\n throw Errors.featureNotSupported('message signing');\n }\n\n try {\n const signFeature = features['solana:signMessage'];\n\n // Ensure message is a Uint8Array\n const messageBytes = message instanceof Uint8Array ? message : new Uint8Array(message);\n\n // Wallet Standard returns an array of signed messages\n const results = (await signFeature.signMessage({\n account,\n message: messageBytes,\n ...(chain ? { chain } : {}),\n })) as Array<{ signature: Uint8Array; signedMessage?: Uint8Array }>;\n\n if (!Array.isArray(results) || results.length === 0) {\n throw new Error('Wallet returned empty results array');\n }\n\n const firstResult = results[0];\n if (!firstResult?.signature) {\n throw new Error('Wallet returned no signature in first result');\n }\n\n return firstResult.signature;\n } catch (error) {\n console.error('signMessage error:', error);\n throw error instanceof Error ? error : new Error(String(error));\n }\n })\n : null;\n\n // Create transaction sending signer if wallet supports sending transactions\n // Prefer signAndSendTransaction over sendTransaction as it's more efficient\n const transactionSigner: TransactionSendingSigner<string> | null =\n hasSignAndSendTransaction || hasSendTransaction\n ? createTransactionSendingSignerFromWallet(walletAddress, chain, async (transaction: any) => {\n // Prefer signAndSendTransaction (sign + send in one call)\n if (hasSignAndSendTransaction) {\n try {\n const signAndSendFeature = features['solana:signAndSendTransaction'];\n const result = (await signAndSendFeature.signAndSendTransaction({\n account,\n transactions: [transaction],\n ...(chain ? { chain } : {}),\n ...(connection ? { connection } : {}),\n })) as { signatures: string[] };\n\n // Return first signature (wallet limitation: single transaction)\n return result.signatures[0] || '';\n } catch (error) {\n throw error instanceof Error ? error : new Error(String(error));\n }\n }\n\n // Fallback to sendTransaction (if wallet supports it but not signAndSendTransaction)\n // Note: sendTransaction in Wallet Standard typically just signs, but some wallets\n // may implement it to also send if connection is available\n if (hasSendTransaction) {\n try {\n const sendFeature = features['solana:sendTransaction'];\n const result = (await sendFeature.sendTransaction({\n account,\n transactions: [transaction],\n ...(chain ? { chain } : {}),\n })) as { signatures: string[] };\n\n // Return first signature\n // Note: Actual sending should be handled by the caller or wallet implementation\n return result.signatures[0] || '';\n } catch (error) {\n throw error instanceof Error ? error : new Error(String(error));\n }\n }\n\n throw Errors.featureNotSupported('transaction sending');\n })\n : null;\n\n return {\n address: walletAddress,\n addressString: walletAddressString,\n messageSigner,\n transactionSigner,\n };\n}\n","import type { Connection } from '@solana/web3.js';\n\nexport type Commitment = 'processed' | 'confirmed' | 'finalized';\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?: any,\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-utils';\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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/kit-utils/constants.ts","../src/lib/kit-utils/rpc.ts","../src/lib/kit-utils/explorer.ts","../src/lib/kit-utils/client.ts","../src/lib/kit-utils/debug.ts","../src/lib/kit-utils/prepare-transaction.ts","../src/lib/utils/secure-logger.ts","../src/utils/transaction-format.ts"],"names":["LOG_LEVELS"],"mappings":";;;;;;;AAQO,IAAM,gBAAA,GAAmB;AAgBzB,SAAS,cAAc,QAAA,EAAmC;AAC7D,EAAA,OAAO,MAAA,CAAO,QAAQ,CAAA,GAAI,GAAA;AAC9B;AAOO,SAAS,cAAc,GAAA,EAAqB;AAC/C,EAAA,OAAO,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,GAAA,GAAM,GAAgB,CAAC,CAAA;AACpD;;;ACIO,SAAS,sBACZ,OAAA,EACkB;AAClB,EAAA,QAAQ,OAAA;AAAS,IACb,KAAK,QAAA;AACD,MAAA,OAAO,+BAAA;AAAA,IACX,KAAK,SAAA;AACD,MAAA,OAAO,gCAAA;AAAA,IACX,KAAK,cAAA;AAAA,IACL,KAAK,SAAA;AACD,MAAA,OAAO,qCAAA;AAAA,IACX,KA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A,EADU,oBAAA,CAAqB,EAAE,GACrB,SAAA,EAAU;AACnC;AAUA,eAAsB,wBAAA,CAClB,aACA,SAAA,EACwD;AACxD,EAAA,OAAI,SAAA,GACO,MAAM,8BAAA,CAA+B,WAAW,CAAA,GAEpD,WAAA;AACX","file":"chunk-P5MWBDFG.mjs","sourcesContent":["/**\n * @solana/connector - Kit Constants\n *\n * Core Solana constants used throughout the connector.\n * These match the values from @solana/kit ecosystem.\n */\n\n/** 1 billion lamports per SOL */\nexport const LAMPORTS_PER_SOL = 1_000_000_000;\n\n/**\n * Genesis hash for Solana network clusters\n */\nexport const GENESIS_HASH = {\n mainnet: '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d',\n devnet: 'EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG',\n testnet: '4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2NsNY',\n} as const;\n\n/**\n * Convert lamports to SOL\n * @param lamports - Amount in lamports\n * @returns Amount in SOL\n */\nexport function lamportsToSol(lamports: number | bigint): number {\n return Number(lamports) / LAMPORTS_PER_SOL;\n}\n\n/**\n * Convert SOL to lamports\n * @param sol - Amount in SOL\n * @returns Amount in lamports\n */\nexport function solToLamports(sol: number): bigint {\n return BigInt(Math.floor(sol * LAMPORTS_PER_SOL));\n}\n","/**\n * @solana/connector - Kit RPC Utilities\n *\n * RPC URL helpers for Solana clusters.\n */\n\nimport type { DevnetUrl, MainnetUrl, TestnetUrl } from '@solana/kit';\n\n/** Solana cluster moniker */\nexport type SolanaClusterMoniker = 'devnet' | 'localnet' | 'mainnet' | 'testnet';\n\n/** Localnet URL type */\nexport type LocalnetUrl = string & { '~cluster': 'localnet' };\n\n/** Generic URL type */\nexport type GenericUrl = string & {};\n\n/** Union of all cluster URL types */\nexport type ModifiedClusterUrl = DevnetUrl | GenericUrl | LocalnetUrl | MainnetUrl | TestnetUrl;\n\n/** URL or moniker that can be used to create a Solana client */\nexport type SolanaClientUrlOrMoniker = ModifiedClusterUrl | SolanaClusterMoniker | URL;\n\n/**\n * Helper to create a localnet URL type\n */\nexport function localnet(putativeString: string): LocalnetUrl {\n return putativeString as LocalnetUrl;\n}\n\n/**\n * Get a public Solana RPC endpoint for a cluster based on its moniker\n *\n * Note: These RPC URLs are rate limited and not suitable for production applications.\n * For production, use a dedicated RPC provider like Triton, Helius, QuickNode, or Alchemy.\n *\n * @param cluster - Cluster moniker\n * @returns Public RPC URL for the cluster\n */\nexport function getPublicSolanaRpcUrl(\n cluster: SolanaClusterMoniker | 'mainnet-beta' | 'localhost',\n): ModifiedClusterUrl {\n switch (cluster) {\n case 'devnet':\n return 'https://api.devnet.solana.com' as DevnetUrl;\n case 'testnet':\n return 'https://api.testnet.solana.com' as TestnetUrl;\n case 'mainnet-beta':\n case 'mainnet':\n return 'https://api.mainnet-beta.solana.com' as MainnetUrl;\n case 'localnet':\n case 'localhost':\n return 'http://127.0.0.1:8899' as LocalnetUrl;\n default:\n throw new Error('Invalid cluster moniker');\n }\n}\n\n/**\n * Get the WebSocket URL for a given RPC URL\n *\n * @param rpcUrl - HTTP/HTTPS RPC URL\n * @returns WebSocket URL\n */\nexport function getWebSocketUrl(rpcUrl: string): string {\n const url = new URL(rpcUrl);\n url.protocol = url.protocol.replace('http', 'ws');\n\n // Default WebSocket port for localnet\n if (url.hostname === 'localhost' || url.hostname.startsWith('127')) {\n url.port = '8900';\n }\n\n return url.toString();\n}\n","/**\n * @solana/connector - Kit Explorer Utilities\n *\n * Generate Solana Explorer links for addresses, transactions, and blocks.\n */\n\n/** Cluster type for explorer links */\nexport type ExplorerCluster = 'mainnet' | 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet' | 'localhost';\n\n/** Arguments for generating an explorer link */\nexport type GetExplorerLinkArgs =\n | { address: string; cluster?: ExplorerCluster }\n | { transaction: string; cluster?: ExplorerCluster }\n | { block: string | number; cluster?: ExplorerCluster }\n | { cluster?: ExplorerCluster };\n\n/**\n * Craft a Solana Explorer link on any cluster\n *\n * @param props - Configuration for the explorer link\n * @returns Solana Explorer URL\n *\n * @example\n * ```ts\n * // Transaction link on mainnet\n * getExplorerLink({ transaction: 'abc123...', cluster: 'mainnet' });\n *\n * // Address link on devnet\n * getExplorerLink({ address: 'abc123...', cluster: 'devnet' });\n *\n * // Block link on testnet\n * getExplorerLink({ block: 12345, cluster: 'testnet' });\n * ```\n */\nexport function getExplorerLink(props: GetExplorerLinkArgs = {}): string {\n const url = new URL('https://explorer.solana.com');\n\n // Default to mainnet / mainnet-beta\n let cluster = props.cluster;\n if (!cluster || cluster === 'mainnet') {\n cluster = 'mainnet-beta';\n }\n\n if ('address' in props && props.address) {\n url.pathname = `/address/${props.address}`;\n } else if ('transaction' in props && props.transaction) {\n url.pathname = `/tx/${props.transaction}`;\n } else if ('block' in props && props.block !== undefined) {\n url.pathname = `/block/${props.block}`;\n }\n\n if (cluster !== 'mainnet-beta') {\n if (cluster === 'localnet' || cluster === 'localhost') {\n // localnet technically isn't a cluster, so requires special handling\n url.searchParams.set('cluster', 'custom');\n url.searchParams.set('customUrl', 'http://localhost:8899');\n } else {\n url.searchParams.set('cluster', cluster);\n }\n }\n\n return url.toString();\n}\n","/**\n * @solana/connector - Kit Client Factory\n *\n * Creates a Solana RPC and WebSocket subscriptions client.\n * Replaces gill's createSolanaClient with a kit-based implementation.\n */\n\nimport type {\n DevnetUrl,\n MainnetUrl,\n TestnetUrl,\n Rpc,\n RpcSubscriptions,\n SolanaRpcApi,\n SolanaRpcSubscriptionsApi,\n} from '@solana/kit';\nimport { createSolanaRpc, createSolanaRpcSubscriptions } from '@solana/kit';\n\nimport type { LocalnetUrl, ModifiedClusterUrl, SolanaClientUrlOrMoniker } from './rpc';\nimport { getPublicSolanaRpcUrl } from './rpc';\n\n/**\n * Configuration for creating a Solana RPC client\n */\nexport interface CreateSolanaClientRpcConfig {\n /** Custom port for the RPC endpoint */\n port?: number;\n}\n\n/**\n * Configuration for creating a Solana RPC subscriptions client\n */\nexport interface CreateSolanaClientRpcSubscriptionsConfig {\n /** Custom port for the WebSocket endpoint */\n port?: number;\n}\n\n/**\n * Arguments for creating a Solana client\n */\nexport interface CreateSolanaClientArgs<TClusterUrl extends SolanaClientUrlOrMoniker = string> {\n /** Full RPC URL (for a private RPC endpoint) or the Solana moniker (for a public RPC endpoint) */\n urlOrMoniker: SolanaClientUrlOrMoniker | TClusterUrl;\n /** Configuration used to create the `rpc` client */\n rpcConfig?: CreateSolanaClientRpcConfig;\n /** Configuration used to create the `rpcSubscriptions` client */\n rpcSubscriptionsConfig?: CreateSolanaClientRpcSubscriptionsConfig;\n}\n\n/**\n * A Solana client with RPC and WebSocket subscription capabilities\n */\nexport interface SolanaClient<TClusterUrl extends ModifiedClusterUrl | string = string> {\n /** Used to make RPC calls to your RPC provider */\n rpc: Rpc<SolanaRpcApi>;\n /** Used to make RPC websocket calls to your RPC provider */\n rpcSubscriptions: RpcSubscriptions<SolanaRpcSubscriptionsApi>;\n /** Full RPC URL that was used to create this client */\n urlOrMoniker: SolanaClientUrlOrMoniker | TClusterUrl;\n}\n\n/**\n * Create a Solana `rpc` and `rpcSubscriptions` client\n *\n * @param props - Configuration for the client\n * @returns Solana client with RPC and WebSocket subscription capabilities\n *\n * @example\n * ```ts\n * // Using a cluster moniker\n * const client = createSolanaClient({ urlOrMoniker: 'devnet' });\n *\n * // Using a custom RPC URL\n * const client = createSolanaClient({ urlOrMoniker: 'https://my-rpc.example.com' });\n *\n * // Making RPC calls\n * const balance = await client.rpc.getBalance(address).send();\n * ```\n */\nexport function createSolanaClient(\n props: Omit<CreateSolanaClientArgs<MainnetUrl | 'mainnet'>, 'urlOrMoniker'> & {\n urlOrMoniker: 'mainnet';\n },\n): SolanaClient<MainnetUrl>;\nexport function createSolanaClient(\n props: Omit<CreateSolanaClientArgs<DevnetUrl | 'devnet'>, 'urlOrMoniker'> & {\n urlOrMoniker: 'devnet';\n },\n): SolanaClient<DevnetUrl>;\nexport function createSolanaClient(\n props: Omit<CreateSolanaClientArgs<TestnetUrl | 'testnet'>, 'urlOrMoniker'> & {\n urlOrMoniker: 'testnet';\n },\n): SolanaClient<TestnetUrl>;\nexport function createSolanaClient(\n props: Omit<CreateSolanaClientArgs<LocalnetUrl | 'localnet'>, 'urlOrMoniker'> & {\n urlOrMoniker: 'localnet';\n },\n): SolanaClient<LocalnetUrl>;\nexport function createSolanaClient<TClusterUrl extends ModifiedClusterUrl>(\n props: CreateSolanaClientArgs<TClusterUrl>,\n): SolanaClient<TClusterUrl>;\nexport function createSolanaClient<TCluster extends ModifiedClusterUrl>({\n urlOrMoniker,\n rpcConfig,\n rpcSubscriptionsConfig,\n}: CreateSolanaClientArgs<TCluster>): SolanaClient<TCluster> {\n if (!urlOrMoniker) throw new Error('Cluster url or moniker is required');\n\n let parsedUrl: URL;\n\n // Try to parse as URL first\n if (urlOrMoniker instanceof URL) {\n parsedUrl = urlOrMoniker;\n } else {\n try {\n parsedUrl = new URL(urlOrMoniker.toString());\n } catch {\n // Not a valid URL, try as moniker\n try {\n parsedUrl = new URL(\n getPublicSolanaRpcUrl(urlOrMoniker.toString() as 'mainnet' | 'devnet' | 'testnet' | 'localnet'),\n );\n } catch {\n throw new Error('Invalid URL or cluster moniker');\n }\n }\n }\n\n if (!parsedUrl.protocol.match(/^https?:/i)) {\n throw new Error('Unsupported protocol. Only HTTP and HTTPS are supported');\n }\n\n // Apply custom port if specified\n if (rpcConfig?.port) {\n parsedUrl.port = rpcConfig.port.toString();\n }\n\n const rpcUrl = parsedUrl.toString();\n const rpc = createSolanaRpc(rpcUrl) as Rpc<SolanaRpcApi>;\n\n // Convert HTTP to WS for subscriptions\n parsedUrl.protocol = parsedUrl.protocol.replace('http', 'ws');\n\n // Apply WebSocket port if specified, or use default 8900 for localhost\n if (rpcSubscriptionsConfig?.port) {\n parsedUrl.port = rpcSubscriptionsConfig.port.toString();\n } else if (parsedUrl.hostname === 'localhost' || parsedUrl.hostname.startsWith('127')) {\n parsedUrl.port = '8900';\n }\n\n const rpcSubscriptions = createSolanaRpcSubscriptions(\n parsedUrl.toString(),\n ) as RpcSubscriptions<SolanaRpcSubscriptionsApi>;\n\n return {\n rpc,\n rpcSubscriptions,\n urlOrMoniker: rpcUrl as TCluster,\n };\n}\n","/**\n * @solana/connector - Kit Debug Utilities\n *\n * Simplified debug logging utilities for the connector.\n * Replaces gill's debug system with a connector-specific implementation.\n */\n\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\nconst LOG_LEVELS: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n};\n\ndeclare global {\n /**\n * Whether or not to enable debug mode. When enabled, default log level of `info`\n */\n // eslint-disable-next-line no-var\n var __CONNECTOR_DEBUG__: boolean | undefined;\n /**\n * Set the a desired level of logs to be output in the application\n *\n * - Default: `info`\n * - Options: `debug` | `info` | `warn` | `error`\n */\n // eslint-disable-next-line no-var\n var __CONNECTOR_DEBUG_LEVEL__: LogLevel | undefined;\n}\n\n/**\n * Get the minimum log level from environment or global settings\n */\nfunction getMinLogLevel(): LogLevel {\n if (typeof process !== 'undefined' && process.env?.CONNECTOR_DEBUG_LEVEL) {\n return process.env.CONNECTOR_DEBUG_LEVEL as LogLevel;\n }\n if (\n typeof globalThis !== 'undefined' &&\n (globalThis as typeof globalThis & { __CONNECTOR_DEBUG_LEVEL__?: LogLevel }).__CONNECTOR_DEBUG_LEVEL__\n ) {\n return (globalThis as typeof globalThis & { __CONNECTOR_DEBUG_LEVEL__?: LogLevel }).__CONNECTOR_DEBUG_LEVEL__!;\n }\n if (\n typeof window !== 'undefined' &&\n (window as Window & { __CONNECTOR_DEBUG_LEVEL__?: LogLevel }).__CONNECTOR_DEBUG_LEVEL__\n ) {\n return (window as Window & { __CONNECTOR_DEBUG_LEVEL__?: LogLevel }).__CONNECTOR_DEBUG_LEVEL__!;\n }\n return 'info';\n}\n\n/**\n * Check if the connector debug logger is enabled or not\n *\n * Enable debugging by setting any of the following to `true`:\n * - `process.env.CONNECTOR_DEBUG`\n * - `globalThis.__CONNECTOR_DEBUG__`\n * - `window.__CONNECTOR_DEBUG__`\n */\nexport function isDebugEnabled(): boolean {\n if (typeof process !== 'undefined') {\n if (process.env?.CONNECTOR_DEBUG_LEVEL) return true;\n if (process.env?.CONNECTOR_DEBUG === 'true' || process.env?.CONNECTOR_DEBUG === '1') return true;\n }\n if (typeof globalThis !== 'undefined') {\n if ((globalThis as typeof globalThis & { __CONNECTOR_DEBUG__?: boolean }).__CONNECTOR_DEBUG__ === true) {\n return true;\n }\n if ((globalThis as typeof globalThis & { __CONNECTOR_DEBUG_LEVEL__?: LogLevel }).__CONNECTOR_DEBUG_LEVEL__) {\n return true;\n }\n }\n if (typeof window !== 'undefined') {\n if ((window as Window & { __CONNECTOR_DEBUG__?: boolean }).__CONNECTOR_DEBUG__ === true) {\n return true;\n }\n if ((window as Window & { __CONNECTOR_DEBUG_LEVEL__?: LogLevel }).__CONNECTOR_DEBUG_LEVEL__) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Log debug messages based on the desired application's logging level.\n *\n * @param message - the message contents to be logged\n * @param level - default: `info` (see: {@link LOG_LEVELS})\n * @param prefix - default: `[Connector]`\n *\n * To enable connector's debug logger, set any of the following to `true`:\n * - `process.env.CONNECTOR_DEBUG`\n * - `globalThis.__CONNECTOR_DEBUG__`\n * - `window.__CONNECTOR_DEBUG__`\n *\n * To set a desired level of logs to be output in the application, set the value of one of the following:\n * - `process.env.CONNECTOR_DEBUG_LEVEL`\n * - `globalThis.__CONNECTOR_DEBUG_LEVEL__`\n * - `window.__CONNECTOR_DEBUG_LEVEL__`\n */\nexport function debug(message: unknown, level: LogLevel = 'info', prefix: string = '[Connector]'): void {\n if (!isDebugEnabled()) return;\n\n if (LOG_LEVELS[level] < LOG_LEVELS[getMinLogLevel()]) return;\n\n const formattedMessage = typeof message === 'string' ? message : JSON.stringify(message, null, 2);\n\n switch (level) {\n case 'debug':\n console.log(prefix, formattedMessage);\n break;\n case 'info':\n console.info(prefix, formattedMessage);\n break;\n case 'warn':\n console.warn(prefix, formattedMessage);\n break;\n case 'error':\n console.error(prefix, formattedMessage);\n break;\n }\n}\n","/**\n * @solana/connector - Kit Transaction Preparation\n *\n * Prepares transactions for sending by setting blockhash.\n * A simplified version that focuses on blockhash management.\n */\n\nimport type {\n GetLatestBlockhashApi,\n Rpc,\n TransactionMessage,\n TransactionMessageWithBlockhashLifetime,\n TransactionMessageWithFeePayer,\n} from '@solana/kit';\nimport {\n assertIsTransactionMessageWithBlockhashLifetime,\n setTransactionMessageLifetimeUsingBlockhash,\n} from '@solana/kit';\n\nimport { debug, isDebugEnabled } from './debug';\n\n/**\n * Transaction message types that can be prepared.\n * Requires both a fee payer and a transaction message.\n */\ntype PrepareCompilableTransactionMessage = TransactionMessage & TransactionMessageWithFeePayer;\n\n/**\n * Configuration for preparing a transaction\n */\nexport interface PrepareTransactionConfig<TMessage extends PrepareCompilableTransactionMessage> {\n /**\n * Transaction to prepare for sending to the blockchain\n */\n transaction: TMessage;\n /**\n * RPC client capable of getting the latest blockhash\n */\n rpc: Rpc<GetLatestBlockhashApi>;\n /**\n * Multiplier applied to the simulated compute unit value obtained from simulation\n * @default 1.1\n * @deprecated Compute unit estimation is not currently supported\n */\n computeUnitLimitMultiplier?: number;\n /**\n * Whether or not you wish to force reset the compute unit limit value (if one is already set)\n * @deprecated Compute unit estimation is not currently supported\n */\n computeUnitLimitReset?: boolean;\n /**\n * Whether or not you wish to force reset the latest blockhash (if one is already set)\n * @default true\n */\n blockhashReset?: boolean;\n}\n\n/**\n * Prepare a Transaction to be signed and sent to the network. Including:\n * - fetching the latest blockhash (if not already set)\n * - (optional) resetting latest blockhash to the most recent\n *\n * Note: Automatic compute unit estimation is not currently supported in this version.\n * You should set compute unit limits manually if needed.\n *\n * @param config - Configuration for transaction preparation\n * @returns Prepared transaction with blockhash lifetime set\n *\n * @example\n * ```ts\n * const prepared = await prepareTransaction({\n * transaction: myTransaction,\n * rpc: client.rpc,\n * });\n * ```\n */\nexport async function prepareTransaction<TMessage extends PrepareCompilableTransactionMessage>(\n config: PrepareTransactionConfig<TMessage>,\n): Promise<TMessage & TransactionMessageWithBlockhashLifetime> {\n // Set config defaults\n const blockhashReset = config.blockhashReset !== false;\n\n let transaction = config.transaction as TMessage & Partial<TransactionMessageWithBlockhashLifetime>;\n\n // Update the latest blockhash\n const hasLifetimeConstraint = 'lifetimeConstraint' in transaction;\n\n if (blockhashReset || !hasLifetimeConstraint) {\n const { value: latestBlockhash } = await config.rpc.getLatestBlockhash().send();\n\n if (!hasLifetimeConstraint) {\n if (isDebugEnabled()) {\n debug('Transaction missing latest blockhash, fetching one.', 'debug');\n }\n transaction = setTransactionMessageLifetimeUsingBlockhash(\n latestBlockhash,\n transaction as TMessage,\n ) as TMessage & TransactionMessageWithBlockhashLifetime;\n } else if (blockhashReset) {\n if (isDebugEnabled()) {\n debug('Auto resetting the latest blockhash.', 'debug');\n }\n transaction = {\n ...transaction,\n lifetimeConstraint: latestBlockhash,\n } as TMessage & TransactionMessageWithBlockhashLifetime;\n }\n }\n\n assertIsTransactionMessageWithBlockhashLifetime(transaction);\n\n return transaction as TMessage & TransactionMessageWithBlockhashLifetime;\n}\n","/**\n * @solana/connector - Secure Logger\n *\n * Production-safe logger that redacts sensitive information\n * Prevents accidental exposure of addresses, keys, and other PII in logs\n *\n * Integrates with the connector's debug system:\n * - Respects `__CONNECTOR_DEBUG__` flag (enable/disable logging globally)\n * - Respects `__CONNECTOR_DEBUG_LEVEL__` (set minimum log level)\n * - Provides sensitive data redaction\n * - Provides unified logging API across the connector\n *\n * Enable connector debug:\n * ```ts\n * window.__CONNECTOR_DEBUG__ = true\n * window.__CONNECTOR_DEBUG_LEVEL__ = 'debug' // or 'info', 'warn', 'error'\n * ```\n */\n\nimport { isDebugEnabled, debug as connectorDebug } from '../kit-utils';\n\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\nexport interface SecureLoggerConfig {\n /** Enable logging (defaults to true in development, false in production) */\n enabled?: boolean;\n /** Minimum log level to output */\n level?: LogLevel;\n /** Redact sensitive information in logs (defaults to true in production) */\n redactSensitive?: boolean;\n /** Custom prefix for all log messages */\n prefix?: string;\n /** Use connector's debug system for logging (respects __CONNECTOR_DEBUG__ flags) */\n useConnectorDebug?: boolean;\n}\n\n/**\n * Keys that contain sensitive information that should be redacted\n */\nconst SENSITIVE_KEYS = [\n 'address',\n 'publickey',\n 'signature',\n 'account',\n 'rpcurl',\n 'url',\n 'apikey',\n 'api_key',\n 'token',\n 'secret',\n 'password',\n 'private',\n 'seed',\n 'mnemonic',\n];\n\n/**\n * Log levels in order of severity\n */\nconst LOG_LEVELS: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n};\n\n/**\n * SecureLogger - Production-safe logging with automatic redaction\n *\n * Features:\n * - Integrates with connector's debug system (respects __CONNECTOR_DEBUG__ flags)\n * - Automatic redaction of sensitive data (addresses, keys, URLs)\n * - Configurable log levels (respects __CONNECTOR_DEBUG_LEVEL__)\n * - Environment-aware defaults\n * - Deep object traversal for nested sensitive data\n *\n * @example\n * ```ts\n * // Enable connector debug\n * window.__CONNECTOR_DEBUG__ = true\n * window.__CONNECTOR_DEBUG_LEVEL__ = 'info' // Optional: filter by level\n *\n * const logger = new SecureLogger({ prefix: 'Connector' });\n *\n * logger.debug('User connected', {\n * address: '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU', // Auto-redacted in prod\n * wallet: 'Phantom'\n * });\n * // Development: \"User connected { address: '7xKX...gAsU', wallet: 'Phantom' }\"\n * // Production: \"User connected { address: '***', wallet: 'Phantom' }\"\n * ```\n */\nexport class SecureLogger {\n private config: Required<SecureLoggerConfig>;\n\n constructor(config: SecureLoggerConfig = {}) {\n const isDevelopment = typeof process !== 'undefined' && process.env?.NODE_ENV === 'development';\n\n this.config = {\n enabled: config.enabled ?? isDevelopment,\n level: config.level ?? 'debug',\n redactSensitive: config.redactSensitive ?? !isDevelopment,\n prefix: config.prefix ?? 'Connector',\n useConnectorDebug: config.useConnectorDebug ?? true, // Default to using connector's debug system\n };\n }\n\n /**\n * Log debug information (lowest priority)\n */\n debug(message: string, data?: unknown): void {\n this.log('debug', message, data);\n }\n\n /**\n * Log general information\n */\n info(message: string, data?: unknown): void {\n this.log('info', message, data);\n }\n\n /**\n * Log warnings\n */\n warn(message: string, data?: unknown): void {\n this.log('warn', message, data);\n }\n\n /**\n * Log errors (highest priority)\n */\n error(message: string, data?: unknown): void {\n this.log('error', message, data);\n }\n\n /**\n * Internal log method that handles level filtering and redaction\n * Integrates with connector's debug system when enabled\n */\n private log(level: LogLevel, message: string, data?: unknown): void {\n // Check if logging is enabled (either via config or connector's debug system)\n const debugEnabled = this.config.useConnectorDebug ? isDebugEnabled() : false;\n if (!this.config.enabled && !debugEnabled) return;\n\n // Get effective log level (prefer connector's debug level if set)\n let effectiveLevel = this.config.level;\n if (this.config.useConnectorDebug && typeof globalThis !== 'undefined') {\n const connectorLevel = (globalThis as { __CONNECTOR_DEBUG_LEVEL__?: string }).__CONNECTOR_DEBUG_LEVEL__;\n if (connectorLevel && ['debug', 'info', 'warn', 'error'].includes(connectorLevel)) {\n effectiveLevel = connectorLevel as LogLevel;\n }\n }\n\n // Check if this log level should be output\n if (LOG_LEVELS[level] < LOG_LEVELS[effectiveLevel]) {\n return;\n }\n\n // Process data (redact if enabled)\n const processedData = this.config.redactSensitive ? this.redact(data) : data;\n\n // Format message with data\n const fullMessage =\n processedData !== undefined\n ? `${message} ${typeof processedData === 'object' ? JSON.stringify(processedData, null, 2) : processedData}`\n : message;\n\n // Use connector's debug system if enabled, otherwise fall back to console.*\n if (this.config.useConnectorDebug && debugEnabled) {\n connectorDebug(fullMessage, level, this.config.prefix);\n } else {\n const prefix = `[${this.config.prefix}]`;\n switch (level) {\n case 'debug':\n console.debug(prefix, message, processedData !== undefined ? processedData : '');\n break;\n case 'info':\n console.info(prefix, message, processedData !== undefined ? processedData : '');\n break;\n case 'warn':\n console.warn(prefix, message, processedData !== undefined ? processedData : '');\n break;\n case 'error':\n console.error(prefix, message, processedData !== undefined ? processedData : '');\n break;\n }\n }\n }\n\n /**\n * Recursively redact sensitive information from data\n */\n private redact(data: unknown): unknown {\n if (data === null || data === undefined) {\n return data;\n }\n\n // Handle primitives\n if (typeof data !== 'object') {\n return data;\n }\n\n // Handle arrays\n if (Array.isArray(data)) {\n return data.map(item => this.redact(item));\n }\n\n // Handle objects\n const redacted: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(data)) {\n const keyLower = key.toLowerCase();\n\n // Check if this key contains sensitive information\n const isSensitive = SENSITIVE_KEYS.some(sensitiveKey => keyLower.includes(sensitiveKey));\n\n if (isSensitive) {\n redacted[key] = this.maskValue(value);\n } else if (typeof value === 'object' && value !== null) {\n redacted[key] = this.redact(value);\n } else {\n redacted[key] = value;\n }\n }\n\n return redacted;\n }\n\n /**\n * Mask a sensitive value for logging\n * Shows first 4 and last 4 characters for strings longer than 8 chars\n */\n private maskValue(value: unknown): string {\n if (value === null || value === undefined) {\n return '***';\n }\n\n const str = String(value);\n\n // For very short strings, just mask completely\n if (str.length <= 8) {\n return '***';\n }\n\n // For longer strings, show first and last 4 characters\n return `${str.slice(0, 4)}...${str.slice(-4)}`;\n }\n\n /**\n * Update logger configuration at runtime\n */\n updateConfig(config: Partial<SecureLoggerConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n /**\n * Get current configuration\n */\n getConfig(): Required<SecureLoggerConfig> {\n return { ...this.config };\n }\n}\n\n/**\n * Default logger instance for the connector\n * Automatically configured based on NODE_ENV\n */\nexport const logger = new SecureLogger({\n prefix: 'Connector',\n});\n\n/**\n * Create a logger with a custom prefix\n *\n * @example\n * ```ts\n * const walletLogger = createLogger('WalletDetector');\n * walletLogger.debug('Scanning for wallets...');\n * // Output: [WalletDetector] Scanning for wallets...\n * ```\n */\nexport function createLogger(prefix: string, config?: Omit<SecureLoggerConfig, 'prefix'>): SecureLogger {\n return new SecureLogger({ ...config, prefix });\n}\n","/**\n * Transaction Format Utilities\n *\n * Utilities for detecting and converting between different transaction formats:\n * - web3.js Transaction/VersionedTransaction objects\n * - Serialized Uint8Array (Wallet Standard format)\n * - Other TypedArray formats\n *\n * Note: Uses dynamic imports for @solana/web3.js to avoid bundling it\n * since it's only needed for the compat layer.\n */\n\nimport type { Transaction, VersionedTransaction } from '@solana/web3.js';\nimport type { SolanaTransaction } from '../types/transactions';\n\n/**\n * Check if a value is a web3.js Transaction or VersionedTransaction object\n *\n * @param tx - Value to check\n * @returns True if it's a web3.js transaction object\n */\nexport function isWeb3jsTransaction(tx: unknown): tx is Transaction | VersionedTransaction {\n // Duck-typing: if it has a serialize method, it's likely a web3.js transaction\n return tx !== null && typeof tx === 'object' && 'serialize' in tx && typeof tx.serialize === 'function';\n}\n\n/**\n * Serialize a transaction to Uint8Array format (required for Wallet Standard)\n *\n * @param tx - Transaction to serialize (web3.js object, Uint8Array, or TypedArray)\n * @returns Serialized transaction bytes\n * @throws Error if transaction format is unsupported\n */\nexport function serializeTransaction(tx: SolanaTransaction): Uint8Array {\n // web3.js Transaction/VersionedTransaction object\n if (isWeb3jsTransaction(tx)) {\n return tx.serialize({\n requireAllSignatures: false,\n verifySignatures: false,\n });\n }\n\n // Already serialized as Uint8Array\n if (tx instanceof Uint8Array) {\n return tx;\n }\n\n // Other TypedArray format\n if (ArrayBuffer.isView(tx)) {\n return new Uint8Array(tx.buffer, tx.byteOffset, tx.byteLength);\n }\n\n throw new Error('Unsupported transaction format - must be Transaction, VersionedTransaction, or Uint8Array');\n}\n\n/**\n * Check if transaction bytes represent a legacy transaction\n * Legacy transactions have high bit = 0, versioned have high bit = 1\n *\n * @param bytes - Serialized transaction bytes\n * @returns True if legacy transaction\n */\nfunction isLegacyTransaction(bytes: Uint8Array): boolean {\n if (bytes.length === 0) return false;\n // High bit of first byte: 0 = legacy, 1 = versioned\n return (bytes[0] & 0x80) === 0;\n}\n\n/**\n * Deserialize bytes to a web3.js Transaction or VersionedTransaction object\n * Uses dynamic import to avoid bundling @solana/web3.js\n * Automatically detects legacy vs versioned format\n *\n * @param bytes - Serialized transaction bytes\n * @returns Transaction or VersionedTransaction object\n */\nexport async function deserializeToWeb3jsTransaction(bytes: Uint8Array): Promise<Transaction | VersionedTransaction> {\n if (isLegacyTransaction(bytes)) {\n // Legacy transaction - use Transaction.deserialize to preserve legacy-only fields\n const { Transaction } = await import('@solana/web3.js');\n return Transaction.from(bytes);\n } else {\n // Versioned transaction\n const { VersionedTransaction } = await import('@solana/web3.js');\n return VersionedTransaction.deserialize(bytes);\n }\n}\n\n/**\n * Smart converter that preserves the original format\n * Converts to Wallet Standard format (Uint8Array) and tracks original type\n *\n * @param tx - Transaction in any supported format\n * @returns Object with serialized bytes and format flag\n */\nexport function prepareTransactionForWallet(tx: SolanaTransaction): { serialized: Uint8Array; wasWeb3js: boolean } {\n const wasWeb3js = isWeb3jsTransaction(tx);\n const serialized = serializeTransaction(tx);\n return { serialized, wasWeb3js };\n}\n\n/**\n * Convert signed transaction bytes back to original format if needed\n *\n * @param signedBytes - Signed transaction as Uint8Array\n * @param wasWeb3js - Whether the original was a web3.js object\n * @returns Transaction in appropriate format (async if conversion needed)\n * Returns Transaction for legacy, VersionedTransaction for versioned, or Uint8Array if not web3js\n */\nexport async function convertSignedTransaction(\n signedBytes: Uint8Array,\n wasWeb3js: boolean,\n): Promise<Transaction | VersionedTransaction | Uint8Array> {\n if (wasWeb3js) {\n return await deserializeToWeb3jsTransaction(signedBytes);\n }\n return signedBytes;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/kit-utils/constants.ts","../src/lib/kit-utils/rpc.ts","../src/lib/kit-utils/explorer.ts","../src/lib/kit-utils/client.ts","../src/lib/kit-utils/debug.ts","../src/lib/kit-utils/prepare-transaction.ts","../src/lib/utils/secure-logger.ts","../src/utils/transaction-format.ts"],"names":["createSolanaRpc","createSolanaRpcSubscriptions","setTransactionMessageLifetimeUsingBlockhash","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AAA,GAAU,SAEvB,KAAA,CAAM,CAAC,IAAI,GAAA,MAAU,CAAA;AACjC;AAUA,eAAsB,+BAA+B,KAAA,EAAgE;AACjH,EAAA,IAAI,mBAAA,CAAoB,KAAK,CAAA,EAAG;AAE5B,IAAA,IAAM,EAAE,WAAA,EAAY,GAAI,MAAM,OAAO,iBAAiB,CAAA;AACtD,IAAA,OAAO,WAAA,CAAY,KAAK,KAAK,CAAA;AAAA,EACjC,CAAA,MAAO;AAEH,IAAA,IAAM,EAAE,oBAAA,EAAqB,GAAI,MAAM,OAAO,iBAAiB,CAAA;AAC/D,IAAA,OAAO,oBAAA,CAAqB,YAAY,KAAK,CAAA;AAAA,EACjD;AACJ;AASO,SAAS,4BAA4B,EAAA,EAAuE;AAC/G,EAAA,IAAM,SAAA,GAAY,oBAAoB,EAAE,CAAA;AAExC,EAAA,OAAO,EAAE,UAAA,EADU,oBAAA,CAAqB,EAAE,GACrB,SAAA,EAAU;AACnC;AAUA,eAAsB,wBAAA,CAClB,aACA,SAAA,EACwD;AACxD,EAAA,OAAI,SAAA,GACO,MAAM,8BAAA,CAA+B,WAAW,CAAA,GAEpD,WAAA;AACX","file":"chunk-RIQH5W7D.js","sourcesContent":["/**\n * @solana/connector - Kit Constants\n *\n * Core Solana constants used throughout the connector.\n * These match the values from @solana/kit ecosystem.\n */\n\n/** 1 billion lamports per SOL */\nexport const LAMPORTS_PER_SOL = 1_000_000_000;\n\n/**\n * Genesis hash for Solana network clusters\n */\nexport const GENESIS_HASH = {\n mainnet: '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d',\n devnet: 'EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG',\n testnet: '4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2NsNY',\n} as const;\n\n/**\n * Convert lamports to SOL\n * @param lamports - Amount in lamports\n * @returns Amount in SOL\n */\nexport function lamportsToSol(lamports: number | bigint): number {\n return Number(lamports) / LAMPORTS_PER_SOL;\n}\n\n/**\n * Convert SOL to lamports\n * @param sol - Amount in SOL\n * @returns Amount in lamports\n */\nexport function solToLamports(sol: number): bigint {\n return BigInt(Math.floor(sol * LAMPORTS_PER_SOL));\n}\n","/**\n * @solana/connector - Kit RPC Utilities\n *\n * RPC URL helpers for Solana clusters.\n */\n\nimport type { DevnetUrl, MainnetUrl, TestnetUrl } from '@solana/kit';\n\n/** Solana cluster moniker */\nexport type SolanaClusterMoniker = 'devnet' | 'localnet' | 'mainnet' | 'testnet';\n\n/** Localnet URL type */\nexport type LocalnetUrl = string & { '~cluster': 'localnet' };\n\n/** Generic URL type */\nexport type GenericUrl = string & {};\n\n/** Union of all cluster URL types */\nexport type ModifiedClusterUrl = DevnetUrl | GenericUrl | LocalnetUrl | MainnetUrl | TestnetUrl;\n\n/** URL or moniker that can be used to create a Solana client */\nexport type SolanaClientUrlOrMoniker = ModifiedClusterUrl | SolanaClusterMoniker | URL;\n\n/**\n * Helper to create a localnet URL type\n */\nexport function localnet(putativeString: string): LocalnetUrl {\n return putativeString as LocalnetUrl;\n}\n\n/**\n * Get a public Solana RPC endpoint for a cluster based on its moniker\n *\n * Note: These RPC URLs are rate limited and not suitable for production applications.\n * For production, use a dedicated RPC provider like Triton, Helius, QuickNode, or Alchemy.\n *\n * @param cluster - Cluster moniker\n * @returns Public RPC URL for the cluster\n */\nexport function getPublicSolanaRpcUrl(\n cluster: SolanaClusterMoniker | 'mainnet-beta' | 'localhost',\n): ModifiedClusterUrl {\n switch (cluster) {\n case 'devnet':\n return 'https://api.devnet.solana.com' as DevnetUrl;\n case 'testnet':\n return 'https://api.testnet.solana.com' as TestnetUrl;\n case 'mainnet-beta':\n case 'mainnet':\n return 'https://api.mainnet-beta.solana.com' as MainnetUrl;\n case 'localnet':\n case 'localhost':\n return 'http://127.0.0.1:8899' as LocalnetUrl;\n default:\n throw new Error('Invalid cluster moniker');\n }\n}\n\n/**\n * Get the WebSocket URL for a given RPC URL\n *\n * @param rpcUrl - HTTP/HTTPS RPC URL\n * @returns WebSocket URL\n */\nexport function getWebSocketUrl(rpcUrl: string): string {\n const url = new URL(rpcUrl);\n url.protocol = url.protocol.replace('http', 'ws');\n\n // Default WebSocket port for localnet\n if (url.hostname === 'localhost' || url.hostname.startsWith('127')) {\n url.port = '8900';\n }\n\n return url.toString();\n}\n","/**\n * @solana/connector - Kit Explorer Utilities\n *\n * Generate Solana Explorer links for addresses, transactions, and blocks.\n */\n\n/** Cluster type for explorer links */\nexport type ExplorerCluster = 'mainnet' | 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet' | 'localhost';\n\n/** Arguments for generating an explorer link */\nexport type GetExplorerLinkArgs =\n | { address: string; cluster?: ExplorerCluster }\n | { transaction: string; cluster?: ExplorerCluster }\n | { block: string | number; cluster?: ExplorerCluster }\n | { cluster?: ExplorerCluster };\n\n/**\n * Craft a Solana Explorer link on any cluster\n *\n * @param props - Configuration for the explorer link\n * @returns Solana Explorer URL\n *\n * @example\n * ```ts\n * // Transaction link on mainnet\n * getExplorerLink({ transaction: 'abc123...', cluster: 'mainnet' });\n *\n * // Address link on devnet\n * getExplorerLink({ address: 'abc123...', cluster: 'devnet' });\n *\n * // Block link on testnet\n * getExplorerLink({ block: 12345, cluster: 'testnet' });\n * ```\n */\nexport function getExplorerLink(props: GetExplorerLinkArgs = {}): string {\n const url = new URL('https://explorer.solana.com');\n\n // Default to mainnet / mainnet-beta\n let cluster = props.cluster;\n if (!cluster || cluster === 'mainnet') {\n cluster = 'mainnet-beta';\n }\n\n if ('address' in props && props.address) {\n url.pathname = `/address/${props.address}`;\n } else if ('transaction' in props && props.transaction) {\n url.pathname = `/tx/${props.transaction}`;\n } else if ('block' in props && props.block !== undefined) {\n url.pathname = `/block/${props.block}`;\n }\n\n if (cluster !== 'mainnet-beta') {\n if (cluster === 'localnet' || cluster === 'localhost') {\n // localnet technically isn't a cluster, so requires special handling\n url.searchParams.set('cluster', 'custom');\n url.searchParams.set('customUrl', 'http://localhost:8899');\n } else {\n url.searchParams.set('cluster', cluster);\n }\n }\n\n return url.toString();\n}\n","/**\n * @solana/connector - Kit Client Factory\n *\n * Creates a Solana RPC and WebSocket subscriptions client.\n * Replaces gill's createSolanaClient with a kit-based implementation.\n */\n\nimport type {\n DevnetUrl,\n MainnetUrl,\n TestnetUrl,\n Rpc,\n RpcSubscriptions,\n SolanaRpcApi,\n SolanaRpcSubscriptionsApi,\n} from '@solana/kit';\nimport { createSolanaRpc, createSolanaRpcSubscriptions } from '@solana/kit';\n\nimport type { LocalnetUrl, ModifiedClusterUrl, SolanaClientUrlOrMoniker } from './rpc';\nimport { getPublicSolanaRpcUrl } from './rpc';\n\n/**\n * Configuration for creating a Solana RPC client\n */\nexport interface CreateSolanaClientRpcConfig {\n /** Custom port for the RPC endpoint */\n port?: number;\n}\n\n/**\n * Configuration for creating a Solana RPC subscriptions client\n */\nexport interface CreateSolanaClientRpcSubscriptionsConfig {\n /** Custom port for the WebSocket endpoint */\n port?: number;\n}\n\n/**\n * Arguments for creating a Solana client\n */\nexport interface CreateSolanaClientArgs<TClusterUrl extends SolanaClientUrlOrMoniker = string> {\n /** Full RPC URL (for a private RPC endpoint) or the Solana moniker (for a public RPC endpoint) */\n urlOrMoniker: SolanaClientUrlOrMoniker | TClusterUrl;\n /** Configuration used to create the `rpc` client */\n rpcConfig?: CreateSolanaClientRpcConfig;\n /** Configuration used to create the `rpcSubscriptions` client */\n rpcSubscriptionsConfig?: CreateSolanaClientRpcSubscriptionsConfig;\n}\n\n/**\n * A Solana client with RPC and WebSocket subscription capabilities\n */\nexport interface SolanaClient<TClusterUrl extends ModifiedClusterUrl | string = string> {\n /** Used to make RPC calls to your RPC provider */\n rpc: Rpc<SolanaRpcApi>;\n /** Used to make RPC websocket calls to your RPC provider */\n rpcSubscriptions: RpcSubscriptions<SolanaRpcSubscriptionsApi>;\n /** Full RPC URL that was used to create this client */\n urlOrMoniker: SolanaClientUrlOrMoniker | TClusterUrl;\n}\n\n/**\n * Create a Solana `rpc` and `rpcSubscriptions` client\n *\n * @param props - Configuration for the client\n * @returns Solana client with RPC and WebSocket subscription capabilities\n *\n * @example\n * ```ts\n * // Using a cluster moniker\n * const client = createSolanaClient({ urlOrMoniker: 'devnet' });\n *\n * // Using a custom RPC URL\n * const client = createSolanaClient({ urlOrMoniker: 'https://my-rpc.example.com' });\n *\n * // Making RPC calls\n * const balance = await client.rpc.getBalance(address).send();\n * ```\n */\nexport function createSolanaClient(\n props: Omit<CreateSolanaClientArgs<MainnetUrl | 'mainnet'>, 'urlOrMoniker'> & {\n urlOrMoniker: 'mainnet';\n },\n): SolanaClient<MainnetUrl>;\nexport function createSolanaClient(\n props: Omit<CreateSolanaClientArgs<DevnetUrl | 'devnet'>, 'urlOrMoniker'> & {\n urlOrMoniker: 'devnet';\n },\n): SolanaClient<DevnetUrl>;\nexport function createSolanaClient(\n props: Omit<CreateSolanaClientArgs<TestnetUrl | 'testnet'>, 'urlOrMoniker'> & {\n urlOrMoniker: 'testnet';\n },\n): SolanaClient<TestnetUrl>;\nexport function createSolanaClient(\n props: Omit<CreateSolanaClientArgs<LocalnetUrl | 'localnet'>, 'urlOrMoniker'> & {\n urlOrMoniker: 'localnet';\n },\n): SolanaClient<LocalnetUrl>;\nexport function createSolanaClient<TClusterUrl extends ModifiedClusterUrl>(\n props: CreateSolanaClientArgs<TClusterUrl>,\n): SolanaClient<TClusterUrl>;\nexport function createSolanaClient<TCluster extends ModifiedClusterUrl>({\n urlOrMoniker,\n rpcConfig,\n rpcSubscriptionsConfig,\n}: CreateSolanaClientArgs<TCluster>): SolanaClient<TCluster> {\n if (!urlOrMoniker) throw new Error('Cluster url or moniker is required');\n\n let parsedUrl: URL;\n\n // Try to parse as URL first\n if (urlOrMoniker instanceof URL) {\n parsedUrl = urlOrMoniker;\n } else {\n try {\n parsedUrl = new URL(urlOrMoniker.toString());\n } catch {\n // Not a valid URL, try as moniker\n try {\n parsedUrl = new URL(\n getPublicSolanaRpcUrl(urlOrMoniker.toString() as 'mainnet' | 'devnet' | 'testnet' | 'localnet'),\n );\n } catch {\n throw new Error('Invalid URL or cluster moniker');\n }\n }\n }\n\n if (!parsedUrl.protocol.match(/^https?:/i)) {\n throw new Error('Unsupported protocol. Only HTTP and HTTPS are supported');\n }\n\n // Apply custom port if specified\n if (rpcConfig?.port) {\n parsedUrl.port = rpcConfig.port.toString();\n }\n\n const rpcUrl = parsedUrl.toString();\n const rpc = createSolanaRpc(rpcUrl) as Rpc<SolanaRpcApi>;\n\n // Convert HTTP to WS for subscriptions\n parsedUrl.protocol = parsedUrl.protocol.replace('http', 'ws');\n\n // Apply WebSocket port if specified, or use default 8900 for localhost\n if (rpcSubscriptionsConfig?.port) {\n parsedUrl.port = rpcSubscriptionsConfig.port.toString();\n } else if (parsedUrl.hostname === 'localhost' || parsedUrl.hostname.startsWith('127')) {\n parsedUrl.port = '8900';\n }\n\n const rpcSubscriptions = createSolanaRpcSubscriptions(\n parsedUrl.toString(),\n ) as RpcSubscriptions<SolanaRpcSubscriptionsApi>;\n\n return {\n rpc,\n rpcSubscriptions,\n urlOrMoniker: rpcUrl as TCluster,\n };\n}\n","/**\n * @solana/connector - Kit Debug Utilities\n *\n * Simplified debug logging utilities for the connector.\n * Replaces gill's debug system with a connector-specific implementation.\n */\n\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\nconst LOG_LEVELS: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n};\n\ndeclare global {\n /**\n * Whether or not to enable debug mode. When enabled, default log level of `info`\n */\n // eslint-disable-next-line no-var\n var __CONNECTOR_DEBUG__: boolean | undefined;\n /**\n * Set the a desired level of logs to be output in the application\n *\n * - Default: `info`\n * - Options: `debug` | `info` | `warn` | `error`\n */\n // eslint-disable-next-line no-var\n var __CONNECTOR_DEBUG_LEVEL__: LogLevel | undefined;\n}\n\n/**\n * Get the minimum log level from environment or global settings\n */\nfunction getMinLogLevel(): LogLevel {\n if (typeof process !== 'undefined' && process.env?.CONNECTOR_DEBUG_LEVEL) {\n return process.env.CONNECTOR_DEBUG_LEVEL as LogLevel;\n }\n if (\n typeof globalThis !== 'undefined' &&\n (globalThis as typeof globalThis & { __CONNECTOR_DEBUG_LEVEL__?: LogLevel }).__CONNECTOR_DEBUG_LEVEL__\n ) {\n return (globalThis as typeof globalThis & { __CONNECTOR_DEBUG_LEVEL__?: LogLevel }).__CONNECTOR_DEBUG_LEVEL__!;\n }\n if (\n typeof window !== 'undefined' &&\n (window as Window & { __CONNECTOR_DEBUG_LEVEL__?: LogLevel }).__CONNECTOR_DEBUG_LEVEL__\n ) {\n return (window as Window & { __CONNECTOR_DEBUG_LEVEL__?: LogLevel }).__CONNECTOR_DEBUG_LEVEL__!;\n }\n return 'info';\n}\n\n/**\n * Check if the connector debug logger is enabled or not\n *\n * Enable debugging by setting any of the following to `true`:\n * - `process.env.CONNECTOR_DEBUG`\n * - `globalThis.__CONNECTOR_DEBUG__`\n * - `window.__CONNECTOR_DEBUG__`\n */\nexport function isDebugEnabled(): boolean {\n if (typeof process !== 'undefined') {\n if (process.env?.CONNECTOR_DEBUG_LEVEL) return true;\n if (process.env?.CONNECTOR_DEBUG === 'true' || process.env?.CONNECTOR_DEBUG === '1') return true;\n }\n if (typeof globalThis !== 'undefined') {\n if ((globalThis as typeof globalThis & { __CONNECTOR_DEBUG__?: boolean }).__CONNECTOR_DEBUG__ === true) {\n return true;\n }\n if ((globalThis as typeof globalThis & { __CONNECTOR_DEBUG_LEVEL__?: LogLevel }).__CONNECTOR_DEBUG_LEVEL__) {\n return true;\n }\n }\n if (typeof window !== 'undefined') {\n if ((window as Window & { __CONNECTOR_DEBUG__?: boolean }).__CONNECTOR_DEBUG__ === true) {\n return true;\n }\n if ((window as Window & { __CONNECTOR_DEBUG_LEVEL__?: LogLevel }).__CONNECTOR_DEBUG_LEVEL__) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Log debug messages based on the desired application's logging level.\n *\n * @param message - the message contents to be logged\n * @param level - default: `info` (see: {@link LOG_LEVELS})\n * @param prefix - default: `[Connector]`\n *\n * To enable connector's debug logger, set any of the following to `true`:\n * - `process.env.CONNECTOR_DEBUG`\n * - `globalThis.__CONNECTOR_DEBUG__`\n * - `window.__CONNECTOR_DEBUG__`\n *\n * To set a desired level of logs to be output in the application, set the value of one of the following:\n * - `process.env.CONNECTOR_DEBUG_LEVEL`\n * - `globalThis.__CONNECTOR_DEBUG_LEVEL__`\n * - `window.__CONNECTOR_DEBUG_LEVEL__`\n */\nexport function debug(message: unknown, level: LogLevel = 'info', prefix: string = '[Connector]'): void {\n if (!isDebugEnabled()) return;\n\n if (LOG_LEVELS[level] < LOG_LEVELS[getMinLogLevel()]) return;\n\n const formattedMessage = typeof message === 'string' ? message : JSON.stringify(message, null, 2);\n\n switch (level) {\n case 'debug':\n console.log(prefix, formattedMessage);\n break;\n case 'info':\n console.info(prefix, formattedMessage);\n break;\n case 'warn':\n console.warn(prefix, formattedMessage);\n break;\n case 'error':\n console.error(prefix, formattedMessage);\n break;\n }\n}\n","/**\n * @solana/connector - Kit Transaction Preparation\n *\n * Prepares transactions for sending by setting blockhash.\n * A simplified version that focuses on blockhash management.\n */\n\nimport type {\n GetLatestBlockhashApi,\n Rpc,\n TransactionMessage,\n TransactionMessageWithBlockhashLifetime,\n TransactionMessageWithFeePayer,\n} from '@solana/kit';\nimport {\n assertIsTransactionMessageWithBlockhashLifetime,\n setTransactionMessageLifetimeUsingBlockhash,\n} from '@solana/kit';\n\nimport { debug, isDebugEnabled } from './debug';\n\n/**\n * Transaction message types that can be prepared.\n * Requires both a fee payer and a transaction message.\n */\ntype PrepareCompilableTransactionMessage = TransactionMessage & TransactionMessageWithFeePayer;\n\n/**\n * Configuration for preparing a transaction\n */\nexport interface PrepareTransactionConfig<TMessage extends PrepareCompilableTransactionMessage> {\n /**\n * Transaction to prepare for sending to the blockchain\n */\n transaction: TMessage;\n /**\n * RPC client capable of getting the latest blockhash\n */\n rpc: Rpc<GetLatestBlockhashApi>;\n /**\n * Multiplier applied to the simulated compute unit value obtained from simulation\n * @default 1.1\n * @deprecated Compute unit estimation is not currently supported\n */\n computeUnitLimitMultiplier?: number;\n /**\n * Whether or not you wish to force reset the compute unit limit value (if one is already set)\n * @deprecated Compute unit estimation is not currently supported\n */\n computeUnitLimitReset?: boolean;\n /**\n * Whether or not you wish to force reset the latest blockhash (if one is already set)\n * @default true\n */\n blockhashReset?: boolean;\n}\n\n/**\n * Prepare a Transaction to be signed and sent to the network. Including:\n * - fetching the latest blockhash (if not already set)\n * - (optional) resetting latest blockhash to the most recent\n *\n * Note: Automatic compute unit estimation is not currently supported in this version.\n * You should set compute unit limits manually if needed.\n *\n * @param config - Configuration for transaction preparation\n * @returns Prepared transaction with blockhash lifetime set\n *\n * @example\n * ```ts\n * const prepared = await prepareTransaction({\n * transaction: myTransaction,\n * rpc: client.rpc,\n * });\n * ```\n */\nexport async function prepareTransaction<TMessage extends PrepareCompilableTransactionMessage>(\n config: PrepareTransactionConfig<TMessage>,\n): Promise<TMessage & TransactionMessageWithBlockhashLifetime> {\n // Set config defaults\n const blockhashReset = config.blockhashReset !== false;\n\n let transaction = config.transaction as TMessage & Partial<TransactionMessageWithBlockhashLifetime>;\n\n // Update the latest blockhash\n const hasLifetimeConstraint = 'lifetimeConstraint' in transaction;\n\n if (blockhashReset || !hasLifetimeConstraint) {\n const { value: latestBlockhash } = await config.rpc.getLatestBlockhash().send();\n\n if (!hasLifetimeConstraint) {\n if (isDebugEnabled()) {\n debug('Transaction missing latest blockhash, fetching one.', 'debug');\n }\n transaction = setTransactionMessageLifetimeUsingBlockhash(\n latestBlockhash,\n transaction as TMessage,\n ) as TMessage & TransactionMessageWithBlockhashLifetime;\n } else if (blockhashReset) {\n if (isDebugEnabled()) {\n debug('Auto resetting the latest blockhash.', 'debug');\n }\n transaction = {\n ...transaction,\n lifetimeConstraint: latestBlockhash,\n } as TMessage & TransactionMessageWithBlockhashLifetime;\n }\n }\n\n assertIsTransactionMessageWithBlockhashLifetime(transaction);\n\n return transaction as TMessage & TransactionMessageWithBlockhashLifetime;\n}\n","/**\n * @solana/connector - Secure Logger\n *\n * Production-safe logger that redacts sensitive information\n * Prevents accidental exposure of addresses, keys, and other PII in logs\n *\n * Integrates with the connector's debug system:\n * - Respects `__CONNECTOR_DEBUG__` flag (enable/disable logging globally)\n * - Respects `__CONNECTOR_DEBUG_LEVEL__` (set minimum log level)\n * - Provides sensitive data redaction\n * - Provides unified logging API across the connector\n *\n * Enable connector debug:\n * ```ts\n * window.__CONNECTOR_DEBUG__ = true\n * window.__CONNECTOR_DEBUG_LEVEL__ = 'debug' // or 'info', 'warn', 'error'\n * ```\n */\n\nimport { isDebugEnabled, debug as connectorDebug } from '../kit-utils';\n\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\nexport interface SecureLoggerConfig {\n /** Enable logging (defaults to true in development, false in production) */\n enabled?: boolean;\n /** Minimum log level to output */\n level?: LogLevel;\n /** Redact sensitive information in logs (defaults to true in production) */\n redactSensitive?: boolean;\n /** Custom prefix for all log messages */\n prefix?: string;\n /** Use connector's debug system for logging (respects __CONNECTOR_DEBUG__ flags) */\n useConnectorDebug?: boolean;\n}\n\n/**\n * Keys that contain sensitive information that should be redacted\n */\nconst SENSITIVE_KEYS = [\n 'address',\n 'publickey',\n 'signature',\n 'account',\n 'rpcurl',\n 'url',\n 'apikey',\n 'api_key',\n 'token',\n 'secret',\n 'password',\n 'private',\n 'seed',\n 'mnemonic',\n];\n\n/**\n * Log levels in order of severity\n */\nconst LOG_LEVELS: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n};\n\n/**\n * SecureLogger - Production-safe logging with automatic redaction\n *\n * Features:\n * - Integrates with connector's debug system (respects __CONNECTOR_DEBUG__ flags)\n * - Automatic redaction of sensitive data (addresses, keys, URLs)\n * - Configurable log levels (respects __CONNECTOR_DEBUG_LEVEL__)\n * - Environment-aware defaults\n * - Deep object traversal for nested sensitive data\n *\n * @example\n * ```ts\n * // Enable connector debug\n * window.__CONNECTOR_DEBUG__ = true\n * window.__CONNECTOR_DEBUG_LEVEL__ = 'info' // Optional: filter by level\n *\n * const logger = new SecureLogger({ prefix: 'Connector' });\n *\n * logger.debug('User connected', {\n * address: '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU', // Auto-redacted in prod\n * wallet: 'Phantom'\n * });\n * // Development: \"User connected { address: '7xKX...gAsU', wallet: 'Phantom' }\"\n * // Production: \"User connected { address: '***', wallet: 'Phantom' }\"\n * ```\n */\nexport class SecureLogger {\n private config: Required<SecureLoggerConfig>;\n\n constructor(config: SecureLoggerConfig = {}) {\n const isDevelopment = typeof process !== 'undefined' && process.env?.NODE_ENV === 'development';\n\n this.config = {\n enabled: config.enabled ?? isDevelopment,\n level: config.level ?? 'debug',\n redactSensitive: config.redactSensitive ?? !isDevelopment,\n prefix: config.prefix ?? 'Connector',\n useConnectorDebug: config.useConnectorDebug ?? true, // Default to using connector's debug system\n };\n }\n\n /**\n * Log debug information (lowest priority)\n */\n debug(message: string, data?: unknown): void {\n this.log('debug', message, data);\n }\n\n /**\n * Log general information\n */\n info(message: string, data?: unknown): void {\n this.log('info', message, data);\n }\n\n /**\n * Log warnings\n */\n warn(message: string, data?: unknown): void {\n this.log('warn', message, data);\n }\n\n /**\n * Log errors (highest priority)\n */\n error(message: string, data?: unknown): void {\n this.log('error', message, data);\n }\n\n /**\n * Internal log method that handles level filtering and redaction\n * Integrates with connector's debug system when enabled\n */\n private log(level: LogLevel, message: string, data?: unknown): void {\n // Check if logging is enabled (either via config or connector's debug system)\n const debugEnabled = this.config.useConnectorDebug ? isDebugEnabled() : false;\n if (!this.config.enabled && !debugEnabled) return;\n\n // Get effective log level (prefer connector's debug level if set)\n let effectiveLevel = this.config.level;\n if (this.config.useConnectorDebug && typeof globalThis !== 'undefined') {\n const connectorLevel = (globalThis as { __CONNECTOR_DEBUG_LEVEL__?: string }).__CONNECTOR_DEBUG_LEVEL__;\n if (connectorLevel && ['debug', 'info', 'warn', 'error'].includes(connectorLevel)) {\n effectiveLevel = connectorLevel as LogLevel;\n }\n }\n\n // Check if this log level should be output\n if (LOG_LEVELS[level] < LOG_LEVELS[effectiveLevel]) {\n return;\n }\n\n // Process data (redact if enabled)\n const processedData = this.config.redactSensitive ? this.redact(data) : data;\n\n // Format message with data\n const fullMessage =\n processedData !== undefined\n ? `${message} ${typeof processedData === 'object' ? JSON.stringify(processedData, null, 2) : processedData}`\n : message;\n\n // Use connector's debug system if enabled, otherwise fall back to console.*\n if (this.config.useConnectorDebug && debugEnabled) {\n connectorDebug(fullMessage, level, this.config.prefix);\n } else {\n const prefix = `[${this.config.prefix}]`;\n switch (level) {\n case 'debug':\n console.debug(prefix, message, processedData !== undefined ? processedData : '');\n break;\n case 'info':\n console.info(prefix, message, processedData !== undefined ? processedData : '');\n break;\n case 'warn':\n console.warn(prefix, message, processedData !== undefined ? processedData : '');\n break;\n case 'error':\n console.error(prefix, message, processedData !== undefined ? processedData : '');\n break;\n }\n }\n }\n\n /**\n * Recursively redact sensitive information from data\n */\n private redact(data: unknown): unknown {\n if (data === null || data === undefined) {\n return data;\n }\n\n // Handle primitives\n if (typeof data !== 'object') {\n return data;\n }\n\n // Handle arrays\n if (Array.isArray(data)) {\n return data.map(item => this.redact(item));\n }\n\n // Handle objects\n const redacted: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(data)) {\n const keyLower = key.toLowerCase();\n\n // Check if this key contains sensitive information\n const isSensitive = SENSITIVE_KEYS.some(sensitiveKey => keyLower.includes(sensitiveKey));\n\n if (isSensitive) {\n redacted[key] = this.maskValue(value);\n } else if (typeof value === 'object' && value !== null) {\n redacted[key] = this.redact(value);\n } else {\n redacted[key] = value;\n }\n }\n\n return redacted;\n }\n\n /**\n * Mask a sensitive value for logging\n * Shows first 4 and last 4 characters for strings longer than 8 chars\n */\n private maskValue(value: unknown): string {\n if (value === null || value === undefined) {\n return '***';\n }\n\n const str = String(value);\n\n // For very short strings, just mask completely\n if (str.length <= 8) {\n return '***';\n }\n\n // For longer strings, show first and last 4 characters\n return `${str.slice(0, 4)}...${str.slice(-4)}`;\n }\n\n /**\n * Update logger configuration at runtime\n */\n updateConfig(config: Partial<SecureLoggerConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n /**\n * Get current configuration\n */\n getConfig(): Required<SecureLoggerConfig> {\n return { ...this.config };\n }\n}\n\n/**\n * Default logger instance for the connector\n * Automatically configured based on NODE_ENV\n */\nexport const logger = new SecureLogger({\n prefix: 'Connector',\n});\n\n/**\n * Create a logger with a custom prefix\n *\n * @example\n * ```ts\n * const walletLogger = createLogger('WalletDetector');\n * walletLogger.debug('Scanning for wallets...');\n * // Output: [WalletDetector] Scanning for wallets...\n * ```\n */\nexport function createLogger(prefix: string, config?: Omit<SecureLoggerConfig, 'prefix'>): SecureLogger {\n return new SecureLogger({ ...config, prefix });\n}\n","/**\n * Transaction Format Utilities\n *\n * Utilities for detecting and converting between different transaction formats:\n * - web3.js Transaction/VersionedTransaction objects\n * - Serialized Uint8Array (Wallet Standard format)\n * - Other TypedArray formats\n *\n * Note: Uses dynamic imports for @solana/web3.js to avoid bundling it\n * since it's only needed for the compat layer.\n */\n\nimport type { Transaction, VersionedTransaction } from '@solana/web3.js';\nimport type { SolanaTransaction } from '../types/transactions';\n\n/**\n * Check if a value is a web3.js Transaction or VersionedTransaction object\n *\n * @param tx - Value to check\n * @returns True if it's a web3.js transaction object\n */\nexport function isWeb3jsTransaction(tx: unknown): tx is Transaction | VersionedTransaction {\n // Duck-typing: if it has a serialize method, it's likely a web3.js transaction\n return tx !== null && typeof tx === 'object' && 'serialize' in tx && typeof tx.serialize === 'function';\n}\n\n/**\n * Serialize a transaction to Uint8Array format (required for Wallet Standard)\n *\n * @param tx - Transaction to serialize (web3.js object, Uint8Array, or TypedArray)\n * @returns Serialized transaction bytes\n * @throws Error if transaction format is unsupported\n */\nexport function serializeTransaction(tx: SolanaTransaction): Uint8Array {\n // web3.js Transaction/VersionedTransaction object\n if (isWeb3jsTransaction(tx)) {\n return tx.serialize({\n requireAllSignatures: false,\n verifySignatures: false,\n });\n }\n\n // Already serialized as Uint8Array\n if (tx instanceof Uint8Array) {\n return tx;\n }\n\n // Other TypedArray format\n if (ArrayBuffer.isView(tx)) {\n return new Uint8Array(tx.buffer, tx.byteOffset, tx.byteLength);\n }\n\n throw new Error('Unsupported transaction format - must be Transaction, VersionedTransaction, or Uint8Array');\n}\n\n/**\n * Check if transaction bytes represent a legacy transaction\n * Legacy transactions have high bit = 0, versioned have high bit = 1\n *\n * @param bytes - Serialized transaction bytes\n * @returns True if legacy transaction\n */\nfunction isLegacyTransaction(bytes: Uint8Array): boolean {\n if (bytes.length === 0) return false;\n // High bit of first byte: 0 = legacy, 1 = versioned\n return (bytes[0] & 0x80) === 0;\n}\n\n/**\n * Deserialize bytes to a web3.js Transaction or VersionedTransaction object\n * Uses dynamic import to avoid bundling @solana/web3.js\n * Automatically detects legacy vs versioned format\n *\n * @param bytes - Serialized transaction bytes\n * @returns Transaction or VersionedTransaction object\n */\nexport async function deserializeToWeb3jsTransaction(bytes: Uint8Array): Promise<Transaction | VersionedTransaction> {\n if (isLegacyTransaction(bytes)) {\n // Legacy transaction - use Transaction.deserialize to preserve legacy-only fields\n const { Transaction } = await import('@solana/web3.js');\n return Transaction.from(bytes);\n } else {\n // Versioned transaction\n const { VersionedTransaction } = await import('@solana/web3.js');\n return VersionedTransaction.deserialize(bytes);\n }\n}\n\n/**\n * Smart converter that preserves the original format\n * Converts to Wallet Standard format (Uint8Array) and tracks original type\n *\n * @param tx - Transaction in any supported format\n * @returns Object with serialized bytes and format flag\n */\nexport function prepareTransactionForWallet(tx: SolanaTransaction): { serialized: Uint8Array; wasWeb3js: boolean } {\n const wasWeb3js = isWeb3jsTransaction(tx);\n const serialized = serializeTransaction(tx);\n return { serialized, wasWeb3js };\n}\n\n/**\n * Convert signed transaction bytes back to original format if needed\n *\n * @param signedBytes - Signed transaction as Uint8Array\n * @param wasWeb3js - Whether the original was a web3.js object\n * @returns Transaction in appropriate format (async if conversion needed)\n * Returns Transaction for legacy, VersionedTransaction for versioned, or Uint8Array if not web3js\n */\nexport async function convertSignedTransaction(\n signedBytes: Uint8Array,\n wasWeb3js: boolean,\n): Promise<Transaction | VersionedTransaction | Uint8Array> {\n if (wasWeb3js) {\n return await deserializeToWeb3jsTransaction(signedBytes);\n }\n return signedBytes;\n}\n"]}
|