@solana/connector 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +460 -1082
  3. package/dist/{chunk-TIW3EQPC.js → chunk-CLXM6UEE.js} +120 -103
  4. package/dist/chunk-CLXM6UEE.js.map +1 -0
  5. package/dist/{chunk-7CKCRY25.js → chunk-D6PZY5G6.js} +69 -77
  6. package/dist/chunk-D6PZY5G6.js.map +1 -0
  7. package/dist/chunk-LUZWUZ5N.js +2012 -0
  8. package/dist/chunk-LUZWUZ5N.js.map +1 -0
  9. package/dist/{chunk-HPENTIPE.mjs → chunk-N3Q2J2FG.mjs} +51 -55
  10. package/dist/chunk-N3Q2J2FG.mjs.map +1 -0
  11. package/dist/chunk-P5MWBDFG.mjs +298 -0
  12. package/dist/chunk-P5MWBDFG.mjs.map +1 -0
  13. package/dist/chunk-RIQH5W7D.js +311 -0
  14. package/dist/chunk-RIQH5W7D.js.map +1 -0
  15. package/dist/chunk-U64YZRJL.mjs +1984 -0
  16. package/dist/chunk-U64YZRJL.mjs.map +1 -0
  17. package/dist/{chunk-TKJSKXSA.mjs → chunk-YTCSTE3Q.mjs} +35 -19
  18. package/dist/chunk-YTCSTE3Q.mjs.map +1 -0
  19. package/dist/compat.d.mts +4 -2
  20. package/dist/compat.d.ts +4 -2
  21. package/dist/compat.js +3 -3
  22. package/dist/compat.mjs +1 -1
  23. package/dist/headless.d.mts +146 -18
  24. package/dist/headless.d.ts +146 -18
  25. package/dist/headless.js +144 -111
  26. package/dist/headless.mjs +3 -2
  27. package/dist/index.d.mts +6 -5
  28. package/dist/index.d.ts +6 -5
  29. package/dist/index.js +207 -126
  30. package/dist/index.mjs +4 -3
  31. package/dist/react.d.mts +707 -67
  32. package/dist/react.d.ts +707 -67
  33. package/dist/react.js +64 -16
  34. package/dist/react.mjs +2 -2
  35. package/dist/{transaction-signer-D3csM_Mf.d.mts → transaction-signer-D9d8nxwb.d.mts} +3 -1
  36. package/dist/{transaction-signer-D3csM_Mf.d.ts → transaction-signer-D9d8nxwb.d.ts} +3 -1
  37. package/dist/{wallet-standard-shim-C1tisl9S.d.ts → wallet-standard-shim-Cp4vF4oo.d.mts} +133 -6
  38. package/dist/{wallet-standard-shim-Cg0GVGwu.d.mts → wallet-standard-shim-DC_Z7DS-.d.ts} +133 -6
  39. package/package.json +16 -12
  40. package/dist/chunk-5ZUVZZWU.mjs +0 -180
  41. package/dist/chunk-5ZUVZZWU.mjs.map +0 -1
  42. package/dist/chunk-7CKCRY25.js.map +0 -1
  43. package/dist/chunk-FTD7F7CS.js +0 -314
  44. package/dist/chunk-FTD7F7CS.js.map +0 -1
  45. package/dist/chunk-HPENTIPE.mjs.map +0 -1
  46. package/dist/chunk-MPZFJEJK.mjs +0 -298
  47. package/dist/chunk-MPZFJEJK.mjs.map +0 -1
  48. package/dist/chunk-SMUUAKC3.js +0 -186
  49. package/dist/chunk-SMUUAKC3.js.map +0 -1
  50. package/dist/chunk-TIW3EQPC.js.map +0 -1
  51. package/dist/chunk-TKJSKXSA.mjs.map +0 -1
@@ -0,0 +1 @@
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,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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-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"]}
@@ -0,0 +1,311 @@
1
+ 'use strict';
2
+
3
+ var kit = require('@solana/kit');
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
8
+
9
+ // src/lib/kit-utils/constants.ts
10
+ var LAMPORTS_PER_SOL = 1e9;
11
+ function lamportsToSol(lamports) {
12
+ return Number(lamports) / 1e9;
13
+ }
14
+ function solToLamports(sol) {
15
+ return BigInt(Math.floor(sol * 1e9));
16
+ }
17
+
18
+ // src/lib/kit-utils/rpc.ts
19
+ function getPublicSolanaRpcUrl(cluster) {
20
+ switch (cluster) {
21
+ case "devnet":
22
+ return "https://api.devnet.solana.com";
23
+ case "testnet":
24
+ return "https://api.testnet.solana.com";
25
+ case "mainnet-beta":
26
+ case "mainnet":
27
+ return "https://api.mainnet-beta.solana.com";
28
+ case "localnet":
29
+ case "localhost":
30
+ return "http://127.0.0.1:8899";
31
+ default:
32
+ throw new Error("Invalid cluster moniker");
33
+ }
34
+ }
35
+
36
+ // src/lib/kit-utils/explorer.ts
37
+ function getExplorerLink(props = {}) {
38
+ let url = new URL("https://explorer.solana.com"), cluster = props.cluster;
39
+ return (!cluster || cluster === "mainnet") && (cluster = "mainnet-beta"), "address" in props && props.address ? url.pathname = `/address/${props.address}` : "transaction" in props && props.transaction ? url.pathname = `/tx/${props.transaction}` : "block" in props && props.block !== void 0 && (url.pathname = `/block/${props.block}`), cluster !== "mainnet-beta" && (cluster === "localnet" || cluster === "localhost" ? (url.searchParams.set("cluster", "custom"), url.searchParams.set("customUrl", "http://localhost:8899")) : url.searchParams.set("cluster", cluster)), url.toString();
40
+ }
41
+ function createSolanaClient({
42
+ urlOrMoniker,
43
+ rpcConfig,
44
+ rpcSubscriptionsConfig
45
+ }) {
46
+ if (!urlOrMoniker) throw new Error("Cluster url or moniker is required");
47
+ let parsedUrl;
48
+ if (urlOrMoniker instanceof URL)
49
+ parsedUrl = urlOrMoniker;
50
+ else
51
+ try {
52
+ parsedUrl = new URL(urlOrMoniker.toString());
53
+ } catch {
54
+ try {
55
+ parsedUrl = new URL(
56
+ getPublicSolanaRpcUrl(urlOrMoniker.toString())
57
+ );
58
+ } catch {
59
+ throw new Error("Invalid URL or cluster moniker");
60
+ }
61
+ }
62
+ if (!parsedUrl.protocol.match(/^https?:/i))
63
+ throw new Error("Unsupported protocol. Only HTTP and HTTPS are supported");
64
+ rpcConfig?.port && (parsedUrl.port = rpcConfig.port.toString());
65
+ let rpcUrl = parsedUrl.toString(), rpc = kit.createSolanaRpc(rpcUrl);
66
+ parsedUrl.protocol = parsedUrl.protocol.replace("http", "ws"), rpcSubscriptionsConfig?.port ? parsedUrl.port = rpcSubscriptionsConfig.port.toString() : (parsedUrl.hostname === "localhost" || parsedUrl.hostname.startsWith("127")) && (parsedUrl.port = "8900");
67
+ let rpcSubscriptions = kit.createSolanaRpcSubscriptions(
68
+ parsedUrl.toString()
69
+ );
70
+ return {
71
+ rpc,
72
+ rpcSubscriptions,
73
+ urlOrMoniker: rpcUrl
74
+ };
75
+ }
76
+
77
+ // src/lib/kit-utils/debug.ts
78
+ var LOG_LEVELS = {
79
+ debug: 0,
80
+ info: 1,
81
+ warn: 2,
82
+ error: 3
83
+ };
84
+ function getMinLogLevel() {
85
+ return typeof process < "u" && process.env?.CONNECTOR_DEBUG_LEVEL ? process.env.CONNECTOR_DEBUG_LEVEL : typeof globalThis < "u" && globalThis.__CONNECTOR_DEBUG_LEVEL__ ? globalThis.__CONNECTOR_DEBUG_LEVEL__ : typeof window < "u" && window.__CONNECTOR_DEBUG_LEVEL__ ? window.__CONNECTOR_DEBUG_LEVEL__ : "info";
86
+ }
87
+ function isDebugEnabled() {
88
+ return !!(typeof process < "u" && (process.env?.CONNECTOR_DEBUG_LEVEL || process.env?.CONNECTOR_DEBUG === "true" || process.env?.CONNECTOR_DEBUG === "1") || typeof globalThis < "u" && (globalThis.__CONNECTOR_DEBUG__ === true || globalThis.__CONNECTOR_DEBUG_LEVEL__) || typeof window < "u" && (window.__CONNECTOR_DEBUG__ === true || window.__CONNECTOR_DEBUG_LEVEL__));
89
+ }
90
+ function debug(message, level = "info", prefix = "[Connector]") {
91
+ if (!isDebugEnabled() || LOG_LEVELS[level] < LOG_LEVELS[getMinLogLevel()]) return;
92
+ let formattedMessage = typeof message == "string" ? message : JSON.stringify(message, null, 2);
93
+ switch (level) {
94
+ case "debug":
95
+ console.log(prefix, formattedMessage);
96
+ break;
97
+ case "info":
98
+ console.info(prefix, formattedMessage);
99
+ break;
100
+ case "warn":
101
+ console.warn(prefix, formattedMessage);
102
+ break;
103
+ case "error":
104
+ console.error(prefix, formattedMessage);
105
+ break;
106
+ }
107
+ }
108
+
109
+ // src/lib/kit-utils/prepare-transaction.ts
110
+ async function prepareTransaction(config) {
111
+ let blockhashReset = config.blockhashReset !== false, transaction = config.transaction, hasLifetimeConstraint = "lifetimeConstraint" in transaction;
112
+ if (blockhashReset || !hasLifetimeConstraint) {
113
+ let { value: latestBlockhash } = await config.rpc.getLatestBlockhash().send();
114
+ hasLifetimeConstraint ? blockhashReset && (isDebugEnabled() && debug("Auto resetting the latest blockhash.", "debug"), transaction = {
115
+ ...transaction,
116
+ lifetimeConstraint: latestBlockhash
117
+ }) : (isDebugEnabled() && debug("Transaction missing latest blockhash, fetching one.", "debug"), transaction = kit.setTransactionMessageLifetimeUsingBlockhash(
118
+ latestBlockhash,
119
+ transaction
120
+ ));
121
+ }
122
+ return kit.assertIsTransactionMessageWithBlockhashLifetime(transaction), transaction;
123
+ }
124
+
125
+ // src/lib/utils/secure-logger.ts
126
+ var SENSITIVE_KEYS = [
127
+ "address",
128
+ "publickey",
129
+ "signature",
130
+ "account",
131
+ "rpcurl",
132
+ "url",
133
+ "apikey",
134
+ "api_key",
135
+ "token",
136
+ "secret",
137
+ "password",
138
+ "private",
139
+ "seed",
140
+ "mnemonic"
141
+ ], LOG_LEVELS2 = {
142
+ debug: 0,
143
+ info: 1,
144
+ warn: 2,
145
+ error: 3
146
+ }, SecureLogger = class {
147
+ constructor(config = {}) {
148
+ __publicField(this, "config");
149
+ let isDevelopment = typeof process < "u" && process.env?.NODE_ENV === "development";
150
+ this.config = {
151
+ enabled: config.enabled ?? isDevelopment,
152
+ level: config.level ?? "debug",
153
+ redactSensitive: config.redactSensitive ?? !isDevelopment,
154
+ prefix: config.prefix ?? "Connector",
155
+ useConnectorDebug: config.useConnectorDebug ?? true
156
+ // Default to using connector's debug system
157
+ };
158
+ }
159
+ /**
160
+ * Log debug information (lowest priority)
161
+ */
162
+ debug(message, data) {
163
+ this.log("debug", message, data);
164
+ }
165
+ /**
166
+ * Log general information
167
+ */
168
+ info(message, data) {
169
+ this.log("info", message, data);
170
+ }
171
+ /**
172
+ * Log warnings
173
+ */
174
+ warn(message, data) {
175
+ this.log("warn", message, data);
176
+ }
177
+ /**
178
+ * Log errors (highest priority)
179
+ */
180
+ error(message, data) {
181
+ this.log("error", message, data);
182
+ }
183
+ /**
184
+ * Internal log method that handles level filtering and redaction
185
+ * Integrates with connector's debug system when enabled
186
+ */
187
+ log(level, message, data) {
188
+ let debugEnabled = this.config.useConnectorDebug ? isDebugEnabled() : false;
189
+ if (!this.config.enabled && !debugEnabled) return;
190
+ let effectiveLevel = this.config.level;
191
+ if (this.config.useConnectorDebug && typeof globalThis < "u") {
192
+ let connectorLevel = globalThis.__CONNECTOR_DEBUG_LEVEL__;
193
+ connectorLevel && ["debug", "info", "warn", "error"].includes(connectorLevel) && (effectiveLevel = connectorLevel);
194
+ }
195
+ if (LOG_LEVELS2[level] < LOG_LEVELS2[effectiveLevel])
196
+ return;
197
+ let processedData = this.config.redactSensitive ? this.redact(data) : data, fullMessage = processedData !== void 0 ? `${message} ${typeof processedData == "object" ? JSON.stringify(processedData, null, 2) : processedData}` : message;
198
+ if (this.config.useConnectorDebug && debugEnabled)
199
+ debug(fullMessage, level, this.config.prefix);
200
+ else {
201
+ let prefix = `[${this.config.prefix}]`;
202
+ switch (level) {
203
+ case "debug":
204
+ console.debug(prefix, message, processedData !== void 0 ? processedData : "");
205
+ break;
206
+ case "info":
207
+ console.info(prefix, message, processedData !== void 0 ? processedData : "");
208
+ break;
209
+ case "warn":
210
+ console.warn(prefix, message, processedData !== void 0 ? processedData : "");
211
+ break;
212
+ case "error":
213
+ console.error(prefix, message, processedData !== void 0 ? processedData : "");
214
+ break;
215
+ }
216
+ }
217
+ }
218
+ /**
219
+ * Recursively redact sensitive information from data
220
+ */
221
+ redact(data) {
222
+ if (data == null || typeof data != "object")
223
+ return data;
224
+ if (Array.isArray(data))
225
+ return data.map((item) => this.redact(item));
226
+ let redacted = {};
227
+ for (let [key, value] of Object.entries(data)) {
228
+ let keyLower = key.toLowerCase();
229
+ SENSITIVE_KEYS.some((sensitiveKey) => keyLower.includes(sensitiveKey)) ? redacted[key] = this.maskValue(value) : typeof value == "object" && value !== null ? redacted[key] = this.redact(value) : redacted[key] = value;
230
+ }
231
+ return redacted;
232
+ }
233
+ /**
234
+ * Mask a sensitive value for logging
235
+ * Shows first 4 and last 4 characters for strings longer than 8 chars
236
+ */
237
+ maskValue(value) {
238
+ if (value == null)
239
+ return "***";
240
+ let str = String(value);
241
+ return str.length <= 8 ? "***" : `${str.slice(0, 4)}...${str.slice(-4)}`;
242
+ }
243
+ /**
244
+ * Update logger configuration at runtime
245
+ */
246
+ updateConfig(config) {
247
+ this.config = { ...this.config, ...config };
248
+ }
249
+ /**
250
+ * Get current configuration
251
+ */
252
+ getConfig() {
253
+ return { ...this.config };
254
+ }
255
+ }; new SecureLogger({
256
+ prefix: "Connector"
257
+ });
258
+ function createLogger(prefix, config) {
259
+ return new SecureLogger({ ...config, prefix });
260
+ }
261
+
262
+ // src/utils/transaction-format.ts
263
+ function isWeb3jsTransaction(tx) {
264
+ return tx !== null && typeof tx == "object" && "serialize" in tx && typeof tx.serialize == "function";
265
+ }
266
+ function serializeTransaction(tx) {
267
+ if (isWeb3jsTransaction(tx))
268
+ return tx.serialize({
269
+ requireAllSignatures: false,
270
+ verifySignatures: false
271
+ });
272
+ if (tx instanceof Uint8Array)
273
+ return tx;
274
+ if (ArrayBuffer.isView(tx))
275
+ return new Uint8Array(tx.buffer, tx.byteOffset, tx.byteLength);
276
+ throw new Error("Unsupported transaction format - must be Transaction, VersionedTransaction, or Uint8Array");
277
+ }
278
+ function isLegacyTransaction(bytes) {
279
+ return bytes.length === 0 ? false : (bytes[0] & 128) === 0;
280
+ }
281
+ async function deserializeToWeb3jsTransaction(bytes) {
282
+ if (isLegacyTransaction(bytes)) {
283
+ let { Transaction } = await import('@solana/web3.js');
284
+ return Transaction.from(bytes);
285
+ } else {
286
+ let { VersionedTransaction } = await import('@solana/web3.js');
287
+ return VersionedTransaction.deserialize(bytes);
288
+ }
289
+ }
290
+ function prepareTransactionForWallet(tx) {
291
+ let wasWeb3js = isWeb3jsTransaction(tx);
292
+ return { serialized: serializeTransaction(tx), wasWeb3js };
293
+ }
294
+ async function convertSignedTransaction(signedBytes, wasWeb3js) {
295
+ return wasWeb3js ? await deserializeToWeb3jsTransaction(signedBytes) : signedBytes;
296
+ }
297
+
298
+ exports.LAMPORTS_PER_SOL = LAMPORTS_PER_SOL;
299
+ exports.__publicField = __publicField;
300
+ exports.convertSignedTransaction = convertSignedTransaction;
301
+ exports.createLogger = createLogger;
302
+ exports.createSolanaClient = createSolanaClient;
303
+ exports.getExplorerLink = getExplorerLink;
304
+ exports.getPublicSolanaRpcUrl = getPublicSolanaRpcUrl;
305
+ exports.isWeb3jsTransaction = isWeb3jsTransaction;
306
+ exports.lamportsToSol = lamportsToSol;
307
+ exports.prepareTransaction = prepareTransaction;
308
+ exports.prepareTransactionForWallet = prepareTransactionForWallet;
309
+ exports.solToLamports = solToLamports;
310
+ //# sourceMappingURL=chunk-RIQH5W7D.js.map
311
+ //# sourceMappingURL=chunk-RIQH5W7D.js.map
@@ -0,0 +1 @@
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","assertIsTransactionMessageWithBlockhashLifetime","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,KAAK,UAAA;AAAA,IACL,KAAK,WAAA;AACD,MAAA,OAAO,uBAAA;AAAA,IACX;AACI,MAAA,MAAM,IAAI,MAAM,yBAAyB,CAAA;AAAA;AAErD;;;ACtBO,SAAS,eAAA,CAAgB,KAAA,GAA6B,EAAC,EAAW;AACrE,EAAA,IAAM,MAAM,IAAI,GAAA,CAAI,6BAA6B,CAAA,EAG7C,UAAU,KAAA,CAAM,OAAA;AACpB,EAAA,OAAA,CAAI,CAAC,OAAA,IAAW,OAAA,KAAY,SAAA,MACxB,OAAA,GAAU,cAAA,CAAA,EAGV,SAAA,IAAa,KAAA,IAAS,KAAA,CAAM,OAAA,GAC5B,GAAA,CAAI,QAAA,GAAW,CAAA,SAAA,EAAY,KAAA,CAAM,OAAO,CAAA,CAAA,GACjC,aAAA,IAAiB,KAAA,IAAS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CAAG,QAAQ,EAAA,CAAG,UAAA,EAAY,GAAG,UAAU,CAAA;AAGjE,EAAA,MAAM,IAAI,MAAM,2FAA2F,CAAA;AAC/G;AASA,SAAS,oBAAoB,KAAA,EAA4B;AACrD,EAAA,OAAI,MAAM,MAAA,KAAW,CAAA,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"]}