@solana/connector 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +83 -5
  2. package/dist/{chunk-VA6LKXCQ.js → chunk-5HRJKCIL.js} +204 -268
  3. package/dist/chunk-5HRJKCIL.js.map +1 -0
  4. package/dist/chunk-DSUCH44G.js +678 -0
  5. package/dist/chunk-DSUCH44G.js.map +1 -0
  6. package/dist/{chunk-VZ5Y6DIM.js → chunk-I6TJLYNA.js} +80 -235
  7. package/dist/chunk-I6TJLYNA.js.map +1 -0
  8. package/dist/chunk-J7DHGLW6.mjs +638 -0
  9. package/dist/chunk-J7DHGLW6.mjs.map +1 -0
  10. package/dist/{chunk-TQRJYZNK.mjs → chunk-JOBLG62A.mjs} +71 -218
  11. package/dist/chunk-JOBLG62A.mjs.map +1 -0
  12. package/dist/{chunk-APQGEW7S.mjs → chunk-MAXA3HEP.mjs} +120 -170
  13. package/dist/chunk-MAXA3HEP.mjs.map +1 -0
  14. package/dist/{chunk-JK47EFJT.mjs → chunk-P5LXUDP6.mjs} +65 -14
  15. package/dist/chunk-P5LXUDP6.mjs.map +1 -0
  16. package/dist/{chunk-Z22V3D4E.js → chunk-WDXEP4AJ.js} +95 -37
  17. package/dist/chunk-WDXEP4AJ.js.map +1 -0
  18. package/dist/compat.d.mts +1 -1
  19. package/dist/compat.d.ts +1 -1
  20. package/dist/compat.js +40 -39
  21. package/dist/compat.js.map +1 -1
  22. package/dist/compat.mjs +39 -38
  23. package/dist/compat.mjs.map +1 -1
  24. package/dist/headless.d.mts +447 -151
  25. package/dist/headless.d.ts +447 -151
  26. package/dist/headless.js +214 -194
  27. package/dist/headless.mjs +3 -3
  28. package/dist/index.d.mts +7 -6
  29. package/dist/index.d.ts +7 -6
  30. package/dist/index.js +268 -224
  31. package/dist/index.mjs +4 -4
  32. package/dist/react.d.mts +108 -7
  33. package/dist/react.d.ts +108 -7
  34. package/dist/react.js +54 -30
  35. package/dist/react.mjs +2 -2
  36. package/dist/{wallet-standard-shim-DiMvGjOk.d.ts → standard-shim-CT49DM5l.d.mts} +38 -247
  37. package/dist/{wallet-standard-shim-D4CYG5sU.d.mts → standard-shim-D9guL5fz.d.ts} +38 -247
  38. package/dist/{transaction-signer-CpGEvp7S.d.mts → transaction-signer-T-KVQFi8.d.mts} +1 -1
  39. package/dist/{transaction-signer-CpGEvp7S.d.ts → transaction-signer-T-KVQFi8.d.ts} +1 -1
  40. package/package.json +3 -3
  41. package/dist/chunk-APQGEW7S.mjs.map +0 -1
  42. package/dist/chunk-I64FD2EH.js +0 -312
  43. package/dist/chunk-I64FD2EH.js.map +0 -1
  44. package/dist/chunk-JK47EFJT.mjs.map +0 -1
  45. package/dist/chunk-QL3IT3TS.mjs +0 -299
  46. package/dist/chunk-QL3IT3TS.mjs.map +0 -1
  47. package/dist/chunk-TQRJYZNK.mjs.map +0 -1
  48. package/dist/chunk-VA6LKXCQ.js.map +0 -1
  49. package/dist/chunk-VZ5Y6DIM.js.map +0 -1
  50. package/dist/chunk-Z22V3D4E.js.map +0 -1
@@ -1,11 +1,14 @@
1
- import { i as ClusterType, B as StorageOptions, S as StorageAdapter, F as EnhancedStorageAccountOptions, G as EnhancedStorageClusterOptions, H as EnhancedStorageWalletOptions } from './wallet-standard-shim-DiMvGjOk.js';
2
- export { q as AccountAddress, A as AccountInfo, T as ClipboardErrorType, V as ClipboardResult, j as ConnectorClient, d as ConnectorConfig, v as ConnectorDebugMetrics, x as ConnectorDebugState, y as ConnectorEvent, z as ConnectorEventListener, t as ConnectorHealth, e as ConnectorState, X as CopyOptions, R as CreateSolanaClientArgs, D as DefaultConfigOptions, E as ExtendedConnectorConfig, L as Listener, M as MobileWalletAdapterConfig, P as ModifiedClusterUrl, af as PUBLIC_RPC_ENDPOINTS, Q as SolanaClient, O as SolanaClusterMoniker, ae as SolanaNetwork, h as UnifiedConfig, U as UnifiedConfigOptions, J as WalletError, I as WalletErrorType, W as WalletInfo, p as WalletName, g as WalletStandardAccount, f as WalletStandardWallet, _ as copyAddressToClipboard, $ as copySignatureToClipboard, Z as copyToClipboard, n as createConfig, N as createSolanaClient, a3 as getAddressUrl, a5 as getBlockUrl, ad as getChainIdForWalletStandard, ac as getClusterChainId, a1 as getClusterExplorerUrl, aa as getClusterName, a0 as getClusterRpcUrl, ab as getClusterType, l as getDefaultConfig, m as getDefaultMobileConfig, ai as getDefaultRpcUrl, an as getNetworkDisplayName, K as getPublicSolanaRpcUrl, a4 as getTokenUrl, a2 as getTransactionUrl, k as getWalletsRegistry, s as isAccountAddress, Y as isClipboardAvailable, ak as isDevnet, a7 as isDevnetCluster, a9 as isLocalCluster, am as isLocalnet, aj as isMainnet, a6 as isMainnetCluster, al as isTestnet, a8 as isTestnetCluster, o as isUnifiedConfig, r as isWalletName, ag as normalizeNetwork, ah as toClusterId } from './wallet-standard-shim-DiMvGjOk.js';
3
- import { j as TransactionSigner } from './transaction-signer-CpGEvp7S.js';
4
- export { l as ConfigurationError, x as ConfigurationErrorCode, k as ConnectionError, v as ConnectionErrorCode, C as ConnectorError, E as Errors, N as NetworkError, y as NetworkErrorCode, a as SignedTransaction, S as SolanaTransaction, c as TransactionActivity, d as TransactionActivityStatus, m as TransactionError, z as TransactionErrorCode, f as TransactionMetadata, e as TransactionMethod, b as TransactionSignerCapabilities, T as TransactionSignerConfig, h as TransactionSignerError, V as ValidationError, w as ValidationErrorCode, g as createTransactionSigner, u as getUserFriendlyMessage, q as isConfigurationError, o as isConnectionError, n as isConnectorError, r as isNetworkError, s as isTransactionError, i as isTransactionSignerError, p as isValidationError, t as toConnectorError } from './transaction-signer-CpGEvp7S.js';
5
- import { TransactionModifyingSigner, MessageModifyingSigner, TransactionSendingSigner, SignatureDictionary } from '@solana/signers';
6
- export { MessageModifyingSigner, MessageModifyingSignerConfig, SignableMessage, SignatureDictionary, TransactionSendingSigner, TransactionSendingSignerConfig, createSignableMessage } from '@solana/signers';
1
+ import { h as ClusterType, N as StorageOptions, K as StorageAdapter, O as EnhancedStorageAccountOptions, P as EnhancedStorageClusterOptions, Q as EnhancedStorageWalletOptions } from './standard-shim-D9guL5fz.js';
2
+ export { x as AccountAddress, A as AccountInfo, R as ClipboardErrorType, T as ClipboardResult, B as CoinGeckoConfig, i as ConnectorClient, d as ConnectorConfig, G as ConnectorDebugMetrics, H as ConnectorDebugState, I as ConnectorEvent, J as ConnectorEventListener, F as ConnectorHealth, e as ConnectorState, U as CopyOptions, t as CreateSolanaClientArgs, D as DefaultConfigOptions, E as ExtendedConnectorConfig, L as Listener, M as MobileWalletAdapterConfig, q as ModifiedClusterUrl, s as SolanaClient, S as SolanaClusterMoniker, n as WalletError, m as WalletErrorType, W as WalletInfo, v as WalletName, g as WalletStandardAccount, f as WalletStandardWallet, Y as copyAddressToClipboard, Z as copySignatureToClipboard, X as copyToClipboard, p as createSolanaClient, a1 as getAddressUrl, a3 as getBlockUrl, ab as getChainIdForWalletStandard, aa as getClusterChainId, $ as getClusterExplorerUrl, a8 as getClusterName, _ as getClusterRpcUrl, a9 as getClusterType, j as getDefaultConfig, k as getDefaultMobileConfig, o as getPublicSolanaRpcUrl, a2 as getTokenUrl, a0 as getTransactionUrl, l as getWalletsRegistry, z as isAccountAddress, V as isClipboardAvailable, a5 as isDevnetCluster, a7 as isLocalCluster, a4 as isMainnetCluster, a6 as isTestnetCluster, y as isWalletName, r as ready } from './standard-shim-D9guL5fz.js';
3
+ import { z } from 'zod/v4';
4
+ import { a as TransactionSigner } from './transaction-signer-T-KVQFi8.js';
5
+ export { d as ConfigurationError, p as ConfigurationErrorCode, b as ConnectionError, n as ConnectionErrorCode, C as ConnectorError, E as Errors, N as NetworkError, q as NetworkErrorCode, u as SignedTransaction, S as SolanaTransaction, w as TransactionActivity, x as TransactionActivityStatus, e as TransactionError, r as TransactionErrorCode, z as TransactionMetadata, y as TransactionMethod, v as TransactionSignerCapabilities, s as TransactionSignerConfig, T as TransactionSignerError, V as ValidationError, o as ValidationErrorCode, c as createTransactionSigner, m as getUserFriendlyMessage, j as isConfigurationError, g as isConnectionError, f as isConnectorError, k as isNetworkError, l as isTransactionError, i as isTransactionSignerError, h as isValidationError, t as toConnectorError } from './transaction-signer-T-KVQFi8.js';
7
6
  import { SolanaCluster, SolanaClusterId, Storage } from '@wallet-ui/core';
8
7
  export { SolanaCluster, SolanaClusterId, createSolanaDevnet, createSolanaLocalnet, createSolanaMainnet, createSolanaTestnet } from '@wallet-ui/core';
8
+ import { Connection, SendOptions } from '@solana/web3.js';
9
+ import { MessageModifyingSigner, TransactionSendingSigner, SignatureDictionary, TransactionModifyingSigner } from '@solana/signers';
10
+ export { MessageModifyingSigner, MessageModifyingSignerConfig, SignableMessage, SignatureDictionary, TransactionSendingSigner, TransactionSendingSignerConfig, createSignableMessage } from '@solana/signers';
11
+ import { TransactionMessage, TransactionMessageWithFeePayer, Rpc, GetLatestBlockhashApi, TransactionMessageWithBlockhashLifetime } from '@solana/kit';
9
12
  import { Address } from '@solana/addresses';
10
13
  export { Address, address } from '@solana/addresses';
11
14
  import { SignatureBytes } from '@solana/keys';
@@ -14,10 +17,8 @@ import { Transaction } from '@solana/transactions';
14
17
  export { Transaction } from '@solana/transactions';
15
18
  import { Wallet, WalletAccount } from '@wallet-standard/base';
16
19
  export { Wallet, WalletAccount } from '@wallet-standard/base';
17
- import { Connection, SendOptions } from '@solana/web3.js';
18
- import { TransactionMessage, TransactionMessageWithFeePayer, Rpc, GetLatestBlockhashApi, TransactionMessageWithBlockhashLifetime } from '@solana/kit';
19
- import 'react';
20
20
  import 'react/jsx-runtime';
21
+ import 'react';
21
22
  import '@solana-mobile/wallet-standard-mobile';
22
23
  import '@solana/transaction-messages';
23
24
 
@@ -200,6 +201,113 @@ declare function clusterToChainId(cluster: SolanaCluster): `solana:${string}` |
200
201
  declare function chainIdToClusterType(chainId: string): ClusterType | null;
201
202
  declare function chainIdToClusterId(chainId: string): SolanaClusterId | null;
202
203
 
204
+ /**
205
+ * @solana/connector - Network utilities
206
+ *
207
+ * Utilities for translating between different Solana network naming conventions.
208
+ * Ensures compatibility with WalletUI (SolanaClusterId) and Gill types.
209
+ *
210
+ * Primary type: SolanaNetwork - normalized network names
211
+ * External integration: Use WalletUI's SolanaClusterId for cluster operations
212
+ */
213
+
214
+ /**
215
+ * Normalized Solana network names
216
+ *
217
+ * This is the canonical network type used throughout the connector.
218
+ * Use `toClusterId()` to convert to WalletUI's SolanaClusterId format.
219
+ * Aligned with Gill's SolanaClusterMoniker type.
220
+ */
221
+ type SolanaNetwork = 'mainnet' | 'devnet' | 'testnet' | 'localnet';
222
+ /**
223
+ * Public RPC endpoints for each Solana network
224
+ *
225
+ * ⚠️ WARNING: These are public, rate-limited endpoints provided by Solana Labs.
226
+ * For production applications, use a dedicated RPC provider like:
227
+ * - Triton (https://triton.one)
228
+ * - Helius (https://helius.dev)
229
+ * - QuickNode (https://quicknode.com)
230
+ * - Alchemy (https://alchemy.com)
231
+ *
232
+ * Note: These values are now sourced from Gill's getPublicSolanaRpcUrl for consistency.
233
+ * Kept here for reference and backward compatibility.
234
+ */
235
+ declare const PUBLIC_RPC_ENDPOINTS: Record<SolanaNetwork, string>;
236
+ /**
237
+ * Normalize network name to standard format
238
+ * Accepts various naming conventions and returns the canonical SolanaNetwork format
239
+ *
240
+ * @example
241
+ * normalizeNetwork('mainnet-beta') // Returns: 'mainnet'
242
+ * normalizeNetwork('mainnet') // Returns: 'mainnet'
243
+ * normalizeNetwork('MAINNET') // Returns: 'mainnet'
244
+ */
245
+ declare function normalizeNetwork(network: string): SolanaNetwork;
246
+ /**
247
+ * Convert network name to WalletUI cluster ID format
248
+ *
249
+ * WalletUI uses the 'solana:network' format for cluster identification.
250
+ *
251
+ * @example
252
+ * toClusterId('mainnet') // Returns: 'solana:mainnet'
253
+ * toClusterId('mainnet-beta') // Returns: 'solana:mainnet' (normalized)
254
+ */
255
+ declare function toClusterId(network: string): SolanaClusterId;
256
+ /**
257
+ * Get the public RPC URL for a network
258
+ *
259
+ * ⚠️ Returns public, rate-limited endpoints. For production, use a dedicated RPC provider.
260
+ *
261
+ * Now uses Gill's getPublicSolanaRpcUrl for consistency with the Gill ecosystem.
262
+ * Falls back to localnet URL for unknown networks.
263
+ *
264
+ * @example
265
+ * getDefaultRpcUrl('mainnet') // Returns: 'https://api.mainnet-beta.solana.com'
266
+ * getDefaultRpcUrl('devnet') // Returns: 'https://api.devnet.solana.com'
267
+ */
268
+ declare function getDefaultRpcUrl(network: string): string;
269
+ /**
270
+ * Check if a network is mainnet
271
+ *
272
+ * @example
273
+ * isMainnet('mainnet') // Returns: true
274
+ * isMainnet('mainnet-beta') // Returns: true
275
+ * isMainnet('devnet') // Returns: false
276
+ */
277
+ declare function isMainnet(network: string): boolean;
278
+ /**
279
+ * Check if a network is devnet
280
+ *
281
+ * @example
282
+ * isDevnet('devnet') // Returns: true
283
+ * isDevnet('mainnet') // Returns: false
284
+ */
285
+ declare function isDevnet(network: string): boolean;
286
+ /**
287
+ * Check if a network is testnet
288
+ *
289
+ * @example
290
+ * isTestnet('testnet') // Returns: true
291
+ * isTestnet('mainnet') // Returns: false
292
+ */
293
+ declare function isTestnet(network: string): boolean;
294
+ /**
295
+ * Check if a network is localnet
296
+ *
297
+ * @example
298
+ * isLocalnet('localnet') // Returns: true
299
+ * isLocalnet('mainnet') // Returns: false
300
+ */
301
+ declare function isLocalnet(network: string): boolean;
302
+ /**
303
+ * Get a user-friendly display name for a network
304
+ *
305
+ * @example
306
+ * getNetworkDisplayName('mainnet-beta') // Returns: 'Mainnet'
307
+ * getNetworkDisplayName('devnet') // Returns: 'Devnet'
308
+ */
309
+ declare function getNetworkDisplayName(network: string): string;
310
+
203
311
  /**
204
312
  * @solana/connector - Kit Constants
205
313
  *
@@ -324,48 +432,218 @@ interface PrepareTransactionConfig<TMessage extends PrepareCompilableTransaction
324
432
  declare function prepareTransaction<TMessage extends PrepareCompilableTransactionMessage>(config: PrepareTransactionConfig<TMessage>): Promise<TMessage & TransactionMessageWithBlockhashLifetime>;
325
433
 
326
434
  /**
327
- * @solana/connector - Kit Transaction Signer Adapter
435
+ * @solana/connector - Kit Signer Factories
328
436
  *
329
- * Adapter that wraps connector-kit's TransactionSigner to be compatible with
330
- * @solana/kit TransactionModifyingSigner interface.
437
+ * Framework-agnostic factory functions to create Kit-compatible signers from wallet functions.
438
+ * These factories enable pure Kit integration without React or framework dependencies.
439
+ */
440
+
441
+ /**
442
+ * Create a MessageModifyingSigner from a wallet's sign message function
331
443
  *
332
- * This enables connector-kit to work seamlessly with modern Solana libraries
333
- * that expect @solana/kit's signer interface.
444
+ * This is a pure, framework-agnostic factory function that can be used anywhere.
445
+ * Enables message signing (SIWS, auth) without React.
334
446
  *
335
- * Uses TransactionModifyingSigner to return fully signed Transaction objects,
336
- * ensuring the exact bytes the wallet signed are preserved without re-encoding.
447
+ * @param walletAddress - The address of the wallet
448
+ * @param signMessageFn - Function to sign a message (from wallet adapter)
449
+ * @returns A frozen MessageModifyingSigner object
450
+ *
451
+ * @example
452
+ * ```typescript
453
+ * import { address } from '@solana/addresses';
454
+ * import { createMessageSignerFromWallet } from '@solana/connector/headless';
455
+ *
456
+ * const signer = createMessageSignerFromWallet(
457
+ * address('...'),
458
+ * async (msg) => await wallet.signMessage(msg)
459
+ * );
460
+ *
461
+ * // Use with Kit message signing
462
+ * import { createSignableMessage } from '@solana/signers';
463
+ * const signed = await signer.modifyAndSignMessages([createSignableMessage(messageBytes)]);
464
+ * ```
465
+ */
466
+ declare function createMessageSignerFromWallet(walletAddress: Address<string>, signMessageFn: (message: Uint8Array) => Promise<Uint8Array>): MessageModifyingSigner<string>;
467
+ /**
468
+ * Create a TransactionSendingSigner from a wallet's send transaction function
469
+ *
470
+ * This is a pure, framework-agnostic factory function that can be used anywhere.
471
+ * Enables sign + send in one operation (wallets like Phantom support this).
472
+ *
473
+ * @param walletAddress - The address of the wallet
474
+ * @param chain - The Solana chain identifier (e.g., 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1')
475
+ * @param sendTransactionFn - Function to send a transaction (from wallet adapter)
476
+ * @returns A frozen TransactionSendingSigner object
477
+ *
478
+ * @example
479
+ * ```typescript
480
+ * import { address } from '@solana/addresses';
481
+ * import { createTransactionSendingSignerFromWallet } from '@solana/connector/headless';
482
+ *
483
+ * const signer = createTransactionSendingSignerFromWallet(
484
+ * address('...'),
485
+ * 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
486
+ * async (tx) => await wallet.sendTransaction(tx, connection)
487
+ * );
488
+ *
489
+ * // Use with Kit transaction sending
490
+ * const signatures = await signer.signAndSendTransactions([transaction]);
491
+ * ```
337
492
  */
493
+ declare function createTransactionSendingSignerFromWallet(walletAddress: Address<string>, chain: `solana:${string}`, sendTransactionFn: (transaction: Transaction) => Promise<string>): TransactionSendingSigner<string>;
338
494
 
339
495
  /**
340
- * Create a kit-compatible TransactionPartialSigner from connector-kit's TransactionSigner
496
+ * @solana/connector - Kit Integration Helper
341
497
  *
342
- * This adapter allows connector-kit to work with modern Solana libraries that use
343
- * @solana/kit's signer interfaces.
498
+ * High-level helper to create Kit signers from Wallet Standard wallets.
499
+ * Framework-agnostic and works in any JavaScript environment.
500
+ */
501
+
502
+ /**
503
+ * Result of creating Kit signers from a Wallet Standard wallet
504
+ */
505
+ interface KitSignersFromWallet {
506
+ /** Kit Address type (null if wallet not connected) */
507
+ address: Address<string> | null;
508
+ /** Plain address string (null if wallet not connected) */
509
+ addressString: string | null;
510
+ /** Message signer (null if wallet doesn't support signing or not connected) */
511
+ messageSigner: MessageModifyingSigner<string> | null;
512
+ /** Transaction sending signer (null if wallet doesn't support or not connected) */
513
+ transactionSigner: TransactionSendingSigner<string> | null;
514
+ }
515
+ /**
516
+ * Create Kit-compatible signers from a Wallet Standard wallet
344
517
  *
345
- * @param connectorSigner - Connector-kit's TransactionSigner instance
346
- * @returns Kit-compatible TransactionModifyingSigner
518
+ * This function bridges Wallet Standard wallets with modern Kit architecture.
519
+ * It's framework-agnostic and can be used in any JavaScript environment.
520
+ *
521
+ * The network is automatically detected from the connection's RPC endpoint.
522
+ * For custom RPC URLs, you can override detection with the optional `network` parameter.
523
+ *
524
+ * @param wallet - The Wallet Standard wallet instance
525
+ * @param account - The wallet account to use (first account if not provided)
526
+ * @param connection - Optional connection for network detection and transaction sending
527
+ * @param network - Optional network override ('mainnet' | 'devnet' | 'testnet')
528
+ * @returns Kit signers object with address and signer instances
347
529
  *
348
530
  * @example
349
531
  * ```typescript
350
- * import { createTransactionSigner } from '@solana/connector';
351
- * import { createKitTransactionSigner } from '@solana/connector';
532
+ * import { Connection } from '@solana/web3.js';
533
+ * import { createKitSignersFromWallet } from '@solana/connector/headless';
352
534
  *
353
- * const connectorSigner = createTransactionSigner({ wallet, account });
354
- * const kitSigner = createKitTransactionSigner(connectorSigner);
535
+ * const connection = new Connection('https://api.devnet.solana.com');
536
+ * const { address, messageSigner, transactionSigner } = createKitSignersFromWallet(
537
+ * wallet,
538
+ * account,
539
+ * connection
540
+ * );
541
+ * ```
542
+ */
543
+ declare function createKitSignersFromWallet(wallet: Wallet | null, account?: WalletAccount | null, connection?: Connection | null, network?: 'mainnet' | 'devnet' | 'testnet'): KitSignersFromWallet;
544
+
545
+ declare function detectMessageModification(original: Uint8Array, modified: Uint8Array): boolean;
546
+ declare function updateSignatureDictionary(original: Uint8Array, signed: Uint8Array, originalSignatures: SignatureDictionary, address: Address<string>, signature: Uint8Array): SignatureDictionary;
547
+ declare function freezeSigner<T extends object>(signer: T): Readonly<T>;
548
+ declare function base58ToSignatureBytes(signature: string): SignatureBytes;
549
+ declare function signatureBytesToBase58(bytes: SignatureBytes): string;
550
+
551
+ /**
552
+ * @solana/connector - Configuration Schemas
355
553
  *
356
- * // Now compatible with @solana/kit libraries
357
- * const instruction = getTransferSolInstruction({
358
- * source: kitSigner,
359
- * destination: address('...'),
360
- * amount: 1000000n
554
+ * Zod schemas for runtime validation of configuration options.
555
+ * These schemas provide type-safe validation with helpful error messages.
556
+ */
557
+
558
+ declare const defaultConfigOptionsSchema: z.ZodObject<{
559
+ appName: z.ZodString;
560
+ appUrl: z.ZodOptional<z.ZodString>;
561
+ imageProxy: z.ZodOptional<z.ZodString>;
562
+ clusterStorageKey: z.ZodOptional<z.ZodString>;
563
+ autoConnect: z.ZodOptional<z.ZodBoolean>;
564
+ debug: z.ZodOptional<z.ZodBoolean>;
565
+ enableMobile: z.ZodOptional<z.ZodBoolean>;
566
+ persistClusterSelection: z.ZodOptional<z.ZodBoolean>;
567
+ enableErrorBoundary: z.ZodOptional<z.ZodBoolean>;
568
+ network: z.ZodOptional<z.ZodEnum<{
569
+ devnet: "devnet";
570
+ localnet: "localnet";
571
+ mainnet: "mainnet";
572
+ testnet: "testnet";
573
+ "mainnet-beta": "mainnet-beta";
574
+ }>>;
575
+ maxRetries: z.ZodOptional<z.ZodNumber>;
576
+ storage: z.ZodOptional<z.ZodObject<{
577
+ account: z.ZodObject<{
578
+ get: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
579
+ set: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
580
+ }, z.core.$loose>;
581
+ cluster: z.ZodObject<{
582
+ get: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
583
+ set: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
584
+ }, z.core.$loose>;
585
+ wallet: z.ZodObject<{
586
+ get: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
587
+ set: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
588
+ }, z.core.$loose>;
589
+ }, z.core.$strip>>;
590
+ clusters: z.ZodOptional<z.ZodArray<z.ZodObject<{
591
+ id: z.ZodString;
592
+ label: z.ZodString;
593
+ url: z.ZodString;
594
+ urlWs: z.ZodOptional<z.ZodString>;
595
+ }, z.core.$strip>>>;
596
+ customClusters: z.ZodOptional<z.ZodArray<z.ZodObject<{
597
+ id: z.ZodString;
598
+ label: z.ZodString;
599
+ url: z.ZodString;
600
+ urlWs: z.ZodOptional<z.ZodString>;
601
+ }, z.core.$strip>>>;
602
+ programLabels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
603
+ coingecko: z.ZodOptional<z.ZodObject<{
604
+ apiKey: z.ZodOptional<z.ZodString>;
605
+ isPro: z.ZodOptional<z.ZodBoolean>;
606
+ maxRetries: z.ZodOptional<z.ZodNumber>;
607
+ baseDelay: z.ZodOptional<z.ZodNumber>;
608
+ maxTimeout: z.ZodOptional<z.ZodNumber>;
609
+ }, z.core.$strict>>;
610
+ onError: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
611
+ }, z.core.$strip>;
612
+ type DefaultConfigOptionsInput = z.input<typeof defaultConfigOptionsSchema>;
613
+ /**
614
+ * Validate configuration options and return a result with helpful errors
615
+ *
616
+ * @example
617
+ * ```ts
618
+ * const result = validateConfigOptions({
619
+ * appName: 'My App',
620
+ * network: 'mainnet',
361
621
  * });
622
+ *
623
+ * if (!result.success) {
624
+ * console.error('Config validation failed:', result.error.format());
625
+ * }
362
626
  * ```
363
627
  */
364
- declare function createKitTransactionSigner<TAddress extends string = string>(connectorSigner: TransactionSigner): TransactionModifyingSigner<TAddress>;
628
+ declare function validateConfigOptions(options: unknown): z.ZodSafeParseResult<DefaultConfigOptionsInput>;
365
629
  /**
366
- * @deprecated Use `createKitTransactionSigner` instead. This alias is provided for backward compatibility.
630
+ * Parse and validate config options, throwing on error with formatted message
631
+ *
632
+ * @throws {z.ZodError} If validation fails
633
+ *
634
+ * @example
635
+ * ```ts
636
+ * try {
637
+ * const validOptions = parseConfigOptions(userInput);
638
+ * // validOptions is typed and validated
639
+ * } catch (error) {
640
+ * if (error instanceof z.ZodError) {
641
+ * console.error(error.format());
642
+ * }
643
+ * }
644
+ * ```
367
645
  */
368
- declare const createGillTransactionSigner: typeof createKitTransactionSigner;
646
+ declare function parseConfigOptions(options: unknown): DefaultConfigOptionsInput;
369
647
 
370
648
  /**
371
649
  * Enhanced Storage
@@ -411,6 +689,141 @@ declare class EnhancedStorageAdapter<T> implements StorageAdapter<T> {
411
689
  onError(handler: (error: Error) => void): this;
412
690
  }
413
691
 
692
+ /**
693
+ * @solana/connector - Kit Transaction Signer Adapter
694
+ *
695
+ * Adapter that wraps connector-kit's TransactionSigner to be compatible with
696
+ * @solana/kit TransactionModifyingSigner interface.
697
+ *
698
+ * This enables connector-kit to work seamlessly with modern Solana libraries
699
+ * that expect @solana/kit's signer interface.
700
+ *
701
+ * Uses TransactionModifyingSigner to return fully signed Transaction objects,
702
+ * ensuring the exact bytes the wallet signed are preserved without re-encoding.
703
+ */
704
+
705
+ /**
706
+ * Create a kit-compatible TransactionPartialSigner from connector-kit's TransactionSigner
707
+ *
708
+ * This adapter allows connector-kit to work with modern Solana libraries that use
709
+ * @solana/kit's signer interfaces.
710
+ *
711
+ * @param connectorSigner - Connector-kit's TransactionSigner instance
712
+ * @returns Kit-compatible TransactionModifyingSigner
713
+ *
714
+ * @example
715
+ * ```typescript
716
+ * import { createTransactionSigner } from '@solana/connector';
717
+ * import { createKitTransactionSigner } from '@solana/connector';
718
+ *
719
+ * const connectorSigner = createTransactionSigner({ wallet, account });
720
+ * const kitSigner = createKitTransactionSigner(connectorSigner);
721
+ *
722
+ * // Now compatible with @solana/kit libraries
723
+ * const instruction = getTransferSolInstruction({
724
+ * source: kitSigner,
725
+ * destination: address('...'),
726
+ * amount: 1000000n
727
+ * });
728
+ * ```
729
+ */
730
+ declare function createKitTransactionSigner<TAddress extends string = string>(connectorSigner: TransactionSigner): TransactionModifyingSigner<TAddress>;
731
+ /**
732
+ * @deprecated Use `createKitTransactionSigner` instead. This alias is provided for backward compatibility.
733
+ */
734
+ declare const createGillTransactionSigner: typeof createKitTransactionSigner;
735
+
736
+ /**
737
+ * @solana/connector - Try-Catch Utility
738
+ *
739
+ * Provides a consistent pattern for async error handling,
740
+ * returning a Result type instead of throwing errors.
741
+ */
742
+ /**
743
+ * Represents a failed operation
744
+ */
745
+ interface Failure<E> {
746
+ data: null;
747
+ error: E;
748
+ }
749
+ /**
750
+ * Represents a successful operation
751
+ */
752
+ interface Success<T> {
753
+ data: T;
754
+ error: null;
755
+ }
756
+ /**
757
+ * Result type that is either a Success or Failure
758
+ */
759
+ type Result<T, E = Error> = Success<T> | Failure<E>;
760
+ /**
761
+ * Wraps an async operation and returns a Result instead of throwing.
762
+ * This enables consistent error handling without nested try/catch blocks.
763
+ *
764
+ * @param promise - The promise to wrap
765
+ * @returns A Result containing either the data or an error
766
+ *
767
+ * @example Basic usage
768
+ * ```typescript
769
+ * const { data, error } = await tryCatch(fetchData());
770
+ * if (error) {
771
+ * console.error('Failed:', error.message);
772
+ * return;
773
+ * }
774
+ * console.log('Success:', data);
775
+ * ```
776
+ *
777
+ * @example With typed errors
778
+ * ```typescript
779
+ * const { data, error } = await tryCatch<User, ApiError>(api.getUser(id));
780
+ * if (error) {
781
+ * // error is typed as ApiError
782
+ * handleApiError(error);
783
+ * return;
784
+ * }
785
+ * // data is typed as User
786
+ * displayUser(data);
787
+ * ```
788
+ *
789
+ * @example Chaining operations
790
+ * ```typescript
791
+ * const { data: user, error: userError } = await tryCatch(getUser(id));
792
+ * if (userError) return handleError(userError);
793
+ *
794
+ * const { data: posts, error: postsError } = await tryCatch(getPosts(user.id));
795
+ * if (postsError) return handleError(postsError);
796
+ *
797
+ * return { user, posts };
798
+ * ```
799
+ */
800
+ declare function tryCatch<T, E = Error>(promise: Promise<T>): Promise<Result<T, E>>;
801
+ /**
802
+ * Synchronous version of tryCatch for non-async operations
803
+ *
804
+ * @param fn - The function to execute
805
+ * @returns A Result containing either the return value or an error
806
+ *
807
+ * @example
808
+ * ```typescript
809
+ * const { data, error } = tryCatchSync(() => JSON.parse(jsonString));
810
+ * if (error) {
811
+ * console.error('Invalid JSON:', error.message);
812
+ * return defaultValue;
813
+ * }
814
+ * return data;
815
+ * ```
816
+ */
817
+ declare function tryCatchSync<T, E = Error>(fn: () => T): Result<T, E>;
818
+ /**
819
+ * Type guard to check if a Result is a Success
820
+ */
821
+ declare function isSuccess<T, E>(result: Result<T, E>): result is Success<T>;
822
+ /**
823
+ * Type guard to check if a Result is a Failure
824
+ */
825
+ declare function isFailure<T, E>(result: Result<T, E>): result is Failure<E>;
826
+
414
827
  /**
415
828
  * @solana/connector - Browser Compatibility Polyfills
416
829
  *
@@ -494,123 +907,6 @@ declare function getPolyfillStatus(): {
494
907
  environment: 'browser' | 'server';
495
908
  };
496
909
 
497
- /**
498
- * @solana/connector - Kit Signer Factories
499
- *
500
- * Framework-agnostic factory functions to create Kit-compatible signers from wallet functions.
501
- * These factories enable pure Kit integration without React or framework dependencies.
502
- */
503
-
504
- /**
505
- * Create a MessageModifyingSigner from a wallet's sign message function
506
- *
507
- * This is a pure, framework-agnostic factory function that can be used anywhere.
508
- * Enables message signing (SIWS, auth) without React.
509
- *
510
- * @param walletAddress - The address of the wallet
511
- * @param signMessageFn - Function to sign a message (from wallet adapter)
512
- * @returns A frozen MessageModifyingSigner object
513
- *
514
- * @example
515
- * ```typescript
516
- * import { address } from '@solana/addresses';
517
- * import { createMessageSignerFromWallet } from '@solana/connector/headless';
518
- *
519
- * const signer = createMessageSignerFromWallet(
520
- * address('...'),
521
- * async (msg) => await wallet.signMessage(msg)
522
- * );
523
- *
524
- * // Use with Kit message signing
525
- * import { createSignableMessage } from '@solana/signers';
526
- * const signed = await signer.modifyAndSignMessages([createSignableMessage(messageBytes)]);
527
- * ```
528
- */
529
- declare function createMessageSignerFromWallet(walletAddress: Address<string>, signMessageFn: (message: Uint8Array) => Promise<Uint8Array>): MessageModifyingSigner<string>;
530
- /**
531
- * Create a TransactionSendingSigner from a wallet's send transaction function
532
- *
533
- * This is a pure, framework-agnostic factory function that can be used anywhere.
534
- * Enables sign + send in one operation (wallets like Phantom support this).
535
- *
536
- * @param walletAddress - The address of the wallet
537
- * @param chain - The Solana chain identifier (e.g., 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1')
538
- * @param sendTransactionFn - Function to send a transaction (from wallet adapter)
539
- * @returns A frozen TransactionSendingSigner object
540
- *
541
- * @example
542
- * ```typescript
543
- * import { address } from '@solana/addresses';
544
- * import { createTransactionSendingSignerFromWallet } from '@solana/connector/headless';
545
- *
546
- * const signer = createTransactionSendingSignerFromWallet(
547
- * address('...'),
548
- * 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
549
- * async (tx) => await wallet.sendTransaction(tx, connection)
550
- * );
551
- *
552
- * // Use with Kit transaction sending
553
- * const signatures = await signer.signAndSendTransactions([transaction]);
554
- * ```
555
- */
556
- declare function createTransactionSendingSignerFromWallet(walletAddress: Address<string>, chain: `solana:${string}`, sendTransactionFn: (transaction: Transaction) => Promise<string>): TransactionSendingSigner<string>;
557
-
558
- /**
559
- * @solana/connector - Kit Integration Helper
560
- *
561
- * High-level helper to create Kit signers from Wallet Standard wallets.
562
- * Framework-agnostic and works in any JavaScript environment.
563
- */
564
-
565
- /**
566
- * Result of creating Kit signers from a Wallet Standard wallet
567
- */
568
- interface KitSignersFromWallet {
569
- /** Kit Address type (null if wallet not connected) */
570
- address: Address<string> | null;
571
- /** Plain address string (null if wallet not connected) */
572
- addressString: string | null;
573
- /** Message signer (null if wallet doesn't support signing or not connected) */
574
- messageSigner: MessageModifyingSigner<string> | null;
575
- /** Transaction sending signer (null if wallet doesn't support or not connected) */
576
- transactionSigner: TransactionSendingSigner<string> | null;
577
- }
578
- /**
579
- * Create Kit-compatible signers from a Wallet Standard wallet
580
- *
581
- * This function bridges Wallet Standard wallets with modern Kit architecture.
582
- * It's framework-agnostic and can be used in any JavaScript environment.
583
- *
584
- * The network is automatically detected from the connection's RPC endpoint.
585
- * For custom RPC URLs, you can override detection with the optional `network` parameter.
586
- *
587
- * @param wallet - The Wallet Standard wallet instance
588
- * @param account - The wallet account to use (first account if not provided)
589
- * @param connection - Optional connection for network detection and transaction sending
590
- * @param network - Optional network override ('mainnet' | 'devnet' | 'testnet')
591
- * @returns Kit signers object with address and signer instances
592
- *
593
- * @example
594
- * ```typescript
595
- * import { Connection } from '@solana/web3.js';
596
- * import { createKitSignersFromWallet } from '@solana/connector/headless';
597
- *
598
- * const connection = new Connection('https://api.devnet.solana.com');
599
- * const { address, messageSigner, transactionSigner } = createKitSignersFromWallet(
600
- * wallet,
601
- * account,
602
- * connection
603
- * );
604
- * ```
605
- */
606
- declare function createKitSignersFromWallet(wallet: Wallet | null, account?: WalletAccount | null, connection?: Connection | null, network?: 'mainnet' | 'devnet' | 'testnet'): KitSignersFromWallet;
607
-
608
- declare function detectMessageModification(original: Uint8Array, modified: Uint8Array): boolean;
609
- declare function updateSignatureDictionary(original: Uint8Array, signed: Uint8Array, originalSignatures: SignatureDictionary, address: Address<string>, signature: Uint8Array): SignatureDictionary;
610
- declare function freezeSigner<T extends object>(signer: T): Readonly<T>;
611
- declare function base58ToSignatureBytes(signature: string): SignatureBytes;
612
- declare function signatureBytesToBase58(bytes: SignatureBytes): string;
613
-
614
910
  type Commitment = 'processed' | 'confirmed' | 'finalized';
615
911
  interface KitSendTransactionOptions {
616
912
  commitment?: Commitment;
@@ -732,4 +1028,4 @@ declare function formatSignature(signature: string, chars?: number): string;
732
1028
  */
733
1029
  declare function copySignature(signature: string): Promise<boolean>;
734
1030
 
735
- export { ClusterType, type Commitment, type DualConnection, EnhancedStorage, EnhancedStorageAccountOptions, EnhancedStorageAdapter, EnhancedStorageClusterOptions, EnhancedStorageWalletOptions, type ExplorerOptions, type ExplorerType, type GetExplorerLinkArgs, type KitSignersFromWallet, LAMPORTS_PER_SOL, type PrepareTransactionConfig, SOLANA_CHAIN_IDS, StorageAdapter, StorageOptions, TransactionSigner, base58ToSignatureBytes, chainIdToClusterId, chainIdToClusterType, clusterToChainId, copySignature, createEnhancedStorageAccount, createEnhancedStorageCluster, createEnhancedStorageWallet, createGillTransactionSigner, createKitSignersFromWallet, createKitTransactionSigner, createMessageSignerFromWallet, createTransactionSendingSignerFromWallet, detectMessageModification, formatAddress, formatBigIntBalance, formatBigIntUsd, formatLamportsToSolSafe, formatNumber, formatSOL, formatSignature, formatTokenAmount, formatTokenBalanceSafe, freezeSigner, getAllExplorerUrls, getChainIdFromCluster, getChainIdFromClusterId, getChainIdFromClusterType, getChainIdFromConnection, getClusterIdFromChainId, getClusterTypeFromChainId, getClusterTypeFromConnection, getExplorerLink, getLatestBlockhash, getPolyfillStatus, getSolanaExplorerUrl, getSolanaFmUrl, getSolscanUrl, getXrayUrl, installPolyfills, isCryptoAvailable, isKitConnection, isKnownSolanaChain, isLegacyConnection, isPolyfillInstalled, isSolanaChain, lamportsToSol, prepareTransaction, sendRawTransaction, signatureBytesToBase58, solToLamports, truncate, updateSignatureDictionary, validateKnownSolanaChain };
1031
+ export { ClusterType, type Commitment, type DualConnection, EnhancedStorage, EnhancedStorageAccountOptions, EnhancedStorageAdapter, EnhancedStorageClusterOptions, EnhancedStorageWalletOptions, type ExplorerOptions, type ExplorerType, type Failure, type GetExplorerLinkArgs, type KitSignersFromWallet, LAMPORTS_PER_SOL, PUBLIC_RPC_ENDPOINTS, type PrepareTransactionConfig, type Result, SOLANA_CHAIN_IDS, type SolanaNetwork, StorageAdapter, StorageOptions, type Success, TransactionSigner, base58ToSignatureBytes, chainIdToClusterId, chainIdToClusterType, clusterToChainId, copySignature, createEnhancedStorageAccount, createEnhancedStorageCluster, createEnhancedStorageWallet, createGillTransactionSigner, createKitSignersFromWallet, createKitTransactionSigner, createMessageSignerFromWallet, createTransactionSendingSignerFromWallet, detectMessageModification, formatAddress, formatBigIntBalance, formatBigIntUsd, formatLamportsToSolSafe, formatNumber, formatSOL, formatSignature, formatTokenAmount, formatTokenBalanceSafe, freezeSigner, getAllExplorerUrls, getChainIdFromCluster, getChainIdFromClusterId, getChainIdFromClusterType, getChainIdFromConnection, getClusterIdFromChainId, getClusterTypeFromChainId, getClusterTypeFromConnection, getDefaultRpcUrl, getExplorerLink, getLatestBlockhash, getNetworkDisplayName, getPolyfillStatus, getSolanaExplorerUrl, getSolanaFmUrl, getSolscanUrl, getXrayUrl, installPolyfills, isCryptoAvailable, isDevnet, isFailure, isKitConnection, isKnownSolanaChain, isLegacyConnection, isLocalnet, isMainnet, isPolyfillInstalled, isSolanaChain, isSuccess, isTestnet, lamportsToSol, normalizeNetwork, parseConfigOptions, prepareTransaction, sendRawTransaction, signatureBytesToBase58, solToLamports, toClusterId, truncate, tryCatch, tryCatchSync, updateSignatureDictionary, validateConfigOptions, validateKnownSolanaChain };