@solana/connector 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1460 -0
- package/dist/chunk-5ZUVZZWU.mjs +180 -0
- package/dist/chunk-5ZUVZZWU.mjs.map +1 -0
- package/dist/chunk-6PBQ5CXV.mjs +635 -0
- package/dist/chunk-6PBQ5CXV.mjs.map +1 -0
- package/dist/chunk-D4JGBIP7.js +314 -0
- package/dist/chunk-D4JGBIP7.js.map +1 -0
- package/dist/chunk-EGYXJT54.mjs +298 -0
- package/dist/chunk-EGYXJT54.mjs.map +1 -0
- package/dist/chunk-P4ZLJI4L.js +706 -0
- package/dist/chunk-P4ZLJI4L.js.map +1 -0
- package/dist/chunk-P5A3XNFF.js +2482 -0
- package/dist/chunk-P5A3XNFF.js.map +1 -0
- package/dist/chunk-SMUUAKC3.js +186 -0
- package/dist/chunk-SMUUAKC3.js.map +1 -0
- package/dist/chunk-TAAXHAV2.mjs +2419 -0
- package/dist/chunk-TAAXHAV2.mjs.map +1 -0
- package/dist/compat.d.mts +47 -0
- package/dist/compat.d.ts +47 -0
- package/dist/compat.js +98 -0
- package/dist/compat.js.map +1 -0
- package/dist/compat.mjs +94 -0
- package/dist/compat.mjs.map +1 -0
- package/dist/headless.d.mts +515 -0
- package/dist/headless.d.ts +515 -0
- package/dist/headless.js +445 -0
- package/dist/headless.js.map +1 -0
- package/dist/headless.mjs +4 -0
- package/dist/headless.mjs.map +1 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +502 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5 -0
- package/dist/index.mjs.map +1 -0
- package/dist/react.d.mts +496 -0
- package/dist/react.d.ts +496 -0
- package/dist/react.js +65 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +4 -0
- package/dist/react.mjs.map +1 -0
- package/dist/transaction-signer-D3csM_Mf.d.mts +199 -0
- package/dist/transaction-signer-D3csM_Mf.d.ts +199 -0
- package/dist/wallet-standard-shim-C1tisl9S.d.ts +926 -0
- package/dist/wallet-standard-shim-Cg0GVGwu.d.mts +926 -0
- package/package.json +93 -10
- package/index.js +0 -1
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import { i as ClusterType, B as StorageOptions, S as StorageAdapter, F as EnhancedStorageAccountOptions, G as EnhancedStorageClusterOptions, H as EnhancedStorageWalletOptions } from './wallet-standard-shim-C1tisl9S.js';
|
|
2
|
+
export { q as AccountAddress, A as AccountInfo, K as ClipboardErrorType, N 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, O as CopyOptions, D as DefaultConfigOptions, E as ExtendedConnectorConfig, L as Listener, M as MobileWalletAdapterConfig, a9 as PUBLIC_RPC_ENDPOINTS, a8 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, R as copyAddressToClipboard, T as copySignatureToClipboard, Q as copyToClipboard, n as createConfig, Z as getAddressUrl, $ as getBlockUrl, a7 as getChainIdForWalletStandard, a6 as getClusterChainId, X as getClusterExplorerUrl, a4 as getClusterName, V as getClusterRpcUrl, a5 as getClusterType, l as getDefaultConfig, m as getDefaultMobileConfig, ac as getDefaultRpcUrl, ah as getNetworkDisplayName, _ as getTokenUrl, Y as getTransactionUrl, k as getWalletsRegistry, s as isAccountAddress, P as isClipboardAvailable, ae as isDevnet, a1 as isDevnetCluster, a3 as isLocalCluster, ag as isLocalnet, ad as isMainnet, a0 as isMainnetCluster, af as isTestnet, a2 as isTestnetCluster, o as isUnifiedConfig, r as isWalletName, aa as normalizeNetwork, ab as toClusterId } from './wallet-standard-shim-C1tisl9S.js';
|
|
3
|
+
import { j as TransactionSigner } from './transaction-signer-D3csM_Mf.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-D3csM_Mf.js';
|
|
5
|
+
import { TransactionModifyingSigner } from 'gill';
|
|
6
|
+
import { SolanaCluster, SolanaClusterId, Storage } from '@wallet-ui/core';
|
|
7
|
+
export { SolanaCluster, SolanaClusterId, createSolanaDevnet, createSolanaLocalnet, createSolanaMainnet, createSolanaTestnet } from '@wallet-ui/core';
|
|
8
|
+
import { MessageModifyingSigner, TransactionSendingSigner, SignatureDictionary } from '@solana/signers';
|
|
9
|
+
export { MessageModifyingSigner, MessageModifyingSignerConfig, SignableMessage, SignatureDictionary, TransactionSendingSigner, TransactionSendingSignerConfig, createSignableMessage } from '@solana/signers';
|
|
10
|
+
import { Address } from '@solana/addresses';
|
|
11
|
+
export { Address, address } from '@solana/addresses';
|
|
12
|
+
import { SignatureBytes } from '@solana/keys';
|
|
13
|
+
export { SignatureBytes } from '@solana/keys';
|
|
14
|
+
export { Transaction } from '@solana/transactions';
|
|
15
|
+
import { Wallet, WalletAccount } from '@wallet-standard/base';
|
|
16
|
+
export { Wallet, WalletAccount } from '@wallet-standard/base';
|
|
17
|
+
import { Connection, SendOptions } from '@solana/web3.js';
|
|
18
|
+
import 'react';
|
|
19
|
+
import 'react/jsx-runtime';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @solana/connector - Formatting utilities
|
|
23
|
+
*
|
|
24
|
+
* Unified utility functions for formatting addresses, amounts, and other display values
|
|
25
|
+
* Consolidates both fast (number-based) and precise (bigint-based) formatting options
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Format a Solana address for display
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* formatAddress('7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU')
|
|
32
|
+
* // Returns: '7xKX...gAsU'
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* formatAddress('7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU', { length: 6 })
|
|
36
|
+
* // Returns: '7xKXtg...osgAsU'
|
|
37
|
+
*/
|
|
38
|
+
declare function formatAddress(address: string, options?: {
|
|
39
|
+
length?: number;
|
|
40
|
+
separator?: string;
|
|
41
|
+
}): string;
|
|
42
|
+
/**
|
|
43
|
+
* Format SOL amount for display
|
|
44
|
+
* Supports both precise bigint and fast number arithmetic
|
|
45
|
+
*
|
|
46
|
+
* @param lamports - Amount in lamports (number or bigint)
|
|
47
|
+
* @param options - Formatting options
|
|
48
|
+
* @param options.decimals - Number of decimal places (default: 4)
|
|
49
|
+
* @param options.suffix - Add 'SOL' suffix (default: true)
|
|
50
|
+
* @param options.fast - Use fast number arithmetic for amounts < 9000 SOL (default: false)
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* formatSOL(1000000000n) // Returns: '1.0000 SOL' (precise)
|
|
54
|
+
* formatSOL(1000000000, { fast: true }) // Returns: '1.0000 SOL' (fast)
|
|
55
|
+
* formatSOL(1500000000, { decimals: 2 }) // Returns: '1.50 SOL'
|
|
56
|
+
*/
|
|
57
|
+
declare function formatSOL(lamports: number | bigint, options?: {
|
|
58
|
+
decimals?: number;
|
|
59
|
+
suffix?: boolean;
|
|
60
|
+
fast?: boolean;
|
|
61
|
+
}): string;
|
|
62
|
+
/**
|
|
63
|
+
* Format a number with thousands separators
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* formatNumber(1234567.89) // Returns: '1,234,567.89'
|
|
67
|
+
*/
|
|
68
|
+
declare function formatNumber(value: number, options?: {
|
|
69
|
+
decimals?: number;
|
|
70
|
+
locale?: string;
|
|
71
|
+
}): string;
|
|
72
|
+
/**
|
|
73
|
+
* Truncate text with ellipsis
|
|
74
|
+
*
|
|
75
|
+
* @param text - Text to truncate
|
|
76
|
+
* @param maxLength - Maximum length including ellipsis
|
|
77
|
+
* @param position - Where to truncate: 'middle' or 'end' (default: 'middle')
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* truncate('Hello World', 8) // Returns: 'He...ld'
|
|
81
|
+
* truncate('Hello World', 8, 'end') // Returns: 'Hello...'
|
|
82
|
+
* truncate('Short', 10) // Returns: 'Short' (no truncation needed)
|
|
83
|
+
*/
|
|
84
|
+
declare function truncate(text: string, maxLength: number, position?: 'middle' | 'end'): string;
|
|
85
|
+
/**
|
|
86
|
+
* Format token amount with proper decimals
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* formatTokenAmount(1000000, 6) // Returns: '1.000000'
|
|
90
|
+
*/
|
|
91
|
+
declare function formatTokenAmount(amount: number | bigint, decimals: number, options?: {
|
|
92
|
+
minimumDecimals?: number;
|
|
93
|
+
maximumDecimals?: number;
|
|
94
|
+
}): string;
|
|
95
|
+
|
|
96
|
+
declare const SOLANA_CHAIN_IDS: {
|
|
97
|
+
readonly mainnet: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
98
|
+
readonly devnet: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
|
|
99
|
+
readonly testnet: "solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z";
|
|
100
|
+
};
|
|
101
|
+
declare function getChainIdFromCluster(cluster: SolanaCluster): `solana:${string}` | null;
|
|
102
|
+
declare function getChainIdFromClusterId(clusterId: SolanaClusterId): `solana:${string}` | null;
|
|
103
|
+
declare function getChainIdFromClusterType(type: ClusterType): `solana:${string}` | null;
|
|
104
|
+
declare function getClusterTypeFromChainId(chainId: string): ClusterType | null;
|
|
105
|
+
declare function getClusterIdFromChainId(chainId: string): SolanaClusterId | null;
|
|
106
|
+
declare function isSolanaChain(chain: string): chain is `solana:${string}`;
|
|
107
|
+
declare function isKnownSolanaChain(chain: string): boolean;
|
|
108
|
+
declare function validateKnownSolanaChain(chain: string): asserts chain is `solana:${string}`;
|
|
109
|
+
declare function getClusterTypeFromConnection(connection: Connection | null): ClusterType | null;
|
|
110
|
+
declare function getChainIdFromConnection(connection: Connection | null, network?: 'mainnet' | 'devnet' | 'testnet'): `solana:${string}` | null;
|
|
111
|
+
declare function clusterToChainId(cluster: SolanaCluster): `solana:${string}` | null;
|
|
112
|
+
declare function chainIdToClusterType(chainId: string): ClusterType | null;
|
|
113
|
+
declare function chainIdToClusterId(chainId: string): SolanaClusterId | null;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @solana/connector - Gill/Kit Transaction Signer Adapter
|
|
117
|
+
*
|
|
118
|
+
* Adapter that wraps connector-kit's TransactionSigner to be compatible with
|
|
119
|
+
* gill (@solana/kit) TransactionModifyingSigner interface.
|
|
120
|
+
*
|
|
121
|
+
* This enables connector-kit to work seamlessly with modern Solana libraries
|
|
122
|
+
* that expect @solana/kit's signer interface.
|
|
123
|
+
*
|
|
124
|
+
* Uses TransactionModifyingSigner to return fully signed Transaction objects,
|
|
125
|
+
* ensuring the exact bytes the wallet signed are preserved without re-encoding.
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Create a gill-compatible TransactionPartialSigner from connector-kit's TransactionSigner
|
|
130
|
+
*
|
|
131
|
+
* This adapter allows connector-kit to work with modern Solana libraries that use
|
|
132
|
+
* @solana/kit's signer interfaces (gill, etc.)
|
|
133
|
+
*
|
|
134
|
+
* @param connectorSigner - Connector-kit's TransactionSigner instance
|
|
135
|
+
* @returns Gill-compatible TransactionPartialSigner
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* import { createTransactionSigner } from '@solana/connector';
|
|
140
|
+
* import { createGillTransactionSigner } from '@solana/connector/gill';
|
|
141
|
+
*
|
|
142
|
+
* const connectorSigner = createTransactionSigner({ wallet, account });
|
|
143
|
+
* const gillSigner = createGillTransactionSigner(connectorSigner);
|
|
144
|
+
*
|
|
145
|
+
* // Now compatible with gill libraries
|
|
146
|
+
* const instruction = getTransferSolInstruction({
|
|
147
|
+
* source: gillSigner,
|
|
148
|
+
* destination: address('...'),
|
|
149
|
+
* amount: 1000000n
|
|
150
|
+
* });
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
declare function createGillTransactionSigner<TAddress extends string = string>(connectorSigner: TransactionSigner): TransactionModifyingSigner<TAddress>;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Enhanced Storage
|
|
157
|
+
*/
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Enhanced version of wallet-ui's Storage class
|
|
161
|
+
* Extends the base Storage with validation, error handling, and SSR support
|
|
162
|
+
*/
|
|
163
|
+
declare class EnhancedStorage<T> extends Storage<T> {
|
|
164
|
+
private options?;
|
|
165
|
+
private errorHandlers;
|
|
166
|
+
private validators;
|
|
167
|
+
private memoryFallback;
|
|
168
|
+
constructor(key: string, initial: T, options?: StorageOptions<T> | undefined);
|
|
169
|
+
set(value: T): boolean;
|
|
170
|
+
get(): T;
|
|
171
|
+
validate(value: T): boolean;
|
|
172
|
+
addValidator(validator: (value: T) => boolean): this;
|
|
173
|
+
onError(handler: (error: Error) => void): this;
|
|
174
|
+
transform<U>(transformer: (value: T) => U): U;
|
|
175
|
+
reset(): void;
|
|
176
|
+
clear(): void;
|
|
177
|
+
isAvailable(): boolean;
|
|
178
|
+
static migrate<T>(oldKey: string, newStorage: EnhancedStorage<T>): boolean;
|
|
179
|
+
private handleError;
|
|
180
|
+
}
|
|
181
|
+
declare function createEnhancedStorageAccount(options?: EnhancedStorageAccountOptions): EnhancedStorage<string | undefined>;
|
|
182
|
+
declare function createEnhancedStorageCluster(options?: EnhancedStorageClusterOptions): EnhancedStorage<SolanaClusterId>;
|
|
183
|
+
declare function createEnhancedStorageWallet(options?: EnhancedStorageWalletOptions): EnhancedStorage<string | undefined>;
|
|
184
|
+
declare class EnhancedStorageAdapter<T> implements StorageAdapter<T> {
|
|
185
|
+
private storage;
|
|
186
|
+
constructor(storage: EnhancedStorage<T>);
|
|
187
|
+
get(): T;
|
|
188
|
+
set(value: T): void;
|
|
189
|
+
subscribe(callback: (value: T) => void): () => void;
|
|
190
|
+
validate(value: T): boolean;
|
|
191
|
+
reset(): void;
|
|
192
|
+
clear(): void;
|
|
193
|
+
isAvailable(): boolean;
|
|
194
|
+
transform<U>(transformer: (value: T) => U): U;
|
|
195
|
+
addValidator(validator: (value: T) => boolean): this;
|
|
196
|
+
onError(handler: (error: Error) => void): this;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @solana/connector - Browser Compatibility Polyfills
|
|
201
|
+
*
|
|
202
|
+
* Ensures connector works across all browser environments including:
|
|
203
|
+
* - Mobile browsers (iOS Safari, Chrome Mobile, etc.)
|
|
204
|
+
* - Older desktop browsers
|
|
205
|
+
* - Environments with restricted crypto APIs
|
|
206
|
+
*
|
|
207
|
+
* Inspired by wallet-adapter-compat's polyfill strategy
|
|
208
|
+
*/
|
|
209
|
+
/**
|
|
210
|
+
* Install browser compatibility polyfills
|
|
211
|
+
*
|
|
212
|
+
* This function:
|
|
213
|
+
* - Installs WebCrypto Ed25519 polyfill for signature operations
|
|
214
|
+
* - Is safe to call multiple times (idempotent)
|
|
215
|
+
* - Only runs in browser environments
|
|
216
|
+
* - Fails gracefully if installation errors occur
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* // Automatically called when connector-provider is imported
|
|
221
|
+
* import { ConnectorProvider } from '@solana/connector'
|
|
222
|
+
*
|
|
223
|
+
* // Can also be called manually if needed
|
|
224
|
+
* import { installPolyfills } from '@solana/connector/headless'
|
|
225
|
+
* installPolyfills()
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
declare function installPolyfills(): void;
|
|
229
|
+
/**
|
|
230
|
+
* Check if polyfills have been installed
|
|
231
|
+
* Useful for debugging and health checks
|
|
232
|
+
*
|
|
233
|
+
* @returns True if polyfills are installed, false otherwise
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```ts
|
|
237
|
+
* import { isPolyfillInstalled } from '@solana/connector/headless'
|
|
238
|
+
*
|
|
239
|
+
* if (!isPolyfillInstalled()) {
|
|
240
|
+
* console.warn('Polyfills not installed - may have issues on older browsers')
|
|
241
|
+
* }
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
declare function isPolyfillInstalled(): boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Check if WebCrypto API is available
|
|
247
|
+
* Useful for detecting environments with restricted crypto capabilities
|
|
248
|
+
*
|
|
249
|
+
* @returns True if crypto.subtle is available, false otherwise
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```ts
|
|
253
|
+
* import { isCryptoAvailable } from '@solana/connector/headless'
|
|
254
|
+
*
|
|
255
|
+
* if (!isCryptoAvailable()) {
|
|
256
|
+
* // Show warning to user about unsupported browser
|
|
257
|
+
* }
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
declare function isCryptoAvailable(): boolean;
|
|
261
|
+
/**
|
|
262
|
+
* Get polyfill status information
|
|
263
|
+
* Returns detailed information about polyfill and crypto availability
|
|
264
|
+
*
|
|
265
|
+
* @returns Object with polyfill status details
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```ts
|
|
269
|
+
* import { getPolyfillStatus } from '@solana/connector/headless'
|
|
270
|
+
*
|
|
271
|
+
* const status = getPolyfillStatus()
|
|
272
|
+
* console.log('Polyfills:', status.installed ? 'installed' : 'not installed')
|
|
273
|
+
* console.log('WebCrypto:', status.cryptoAvailable ? 'available' : 'unavailable')
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
declare function getPolyfillStatus(): {
|
|
277
|
+
installed: boolean;
|
|
278
|
+
cryptoAvailable: boolean;
|
|
279
|
+
environment: 'browser' | 'server';
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* @solana/connector - Kit Signer Factories
|
|
284
|
+
*
|
|
285
|
+
* Framework-agnostic factory functions to create Kit-compatible signers from wallet functions.
|
|
286
|
+
* These factories enable pure Kit integration without React or framework dependencies.
|
|
287
|
+
*/
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Create a MessageModifyingSigner from a wallet's sign message function
|
|
291
|
+
*
|
|
292
|
+
* This is a pure, framework-agnostic factory function that can be used anywhere.
|
|
293
|
+
* Enables message signing (SIWS, auth) without React.
|
|
294
|
+
*
|
|
295
|
+
* @param walletAddress - The address of the wallet
|
|
296
|
+
* @param signMessageFn - Function to sign a message (from wallet adapter)
|
|
297
|
+
* @returns A frozen MessageModifyingSigner object
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```typescript
|
|
301
|
+
* import { address } from '@solana/addresses';
|
|
302
|
+
* import { createMessageSignerFromWallet } from '@solana/connector/headless';
|
|
303
|
+
*
|
|
304
|
+
* const signer = createMessageSignerFromWallet(
|
|
305
|
+
* address('...'),
|
|
306
|
+
* async (msg) => await wallet.signMessage(msg)
|
|
307
|
+
* );
|
|
308
|
+
*
|
|
309
|
+
* // Use with Kit message signing
|
|
310
|
+
* import { createSignableMessage } from '@solana/signers';
|
|
311
|
+
* const signed = await signer.modifyAndSignMessages([createSignableMessage(messageBytes)]);
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
declare function createMessageSignerFromWallet(walletAddress: Address<string>, signMessageFn: (message: Uint8Array) => Promise<Uint8Array>): MessageModifyingSigner<string>;
|
|
315
|
+
/**
|
|
316
|
+
* Create a TransactionSendingSigner from a wallet's send transaction function
|
|
317
|
+
*
|
|
318
|
+
* This is a pure, framework-agnostic factory function that can be used anywhere.
|
|
319
|
+
* Enables sign + send in one operation (wallets like Phantom support this).
|
|
320
|
+
*
|
|
321
|
+
* @param walletAddress - The address of the wallet
|
|
322
|
+
* @param chain - The Solana chain identifier (e.g., 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1')
|
|
323
|
+
* @param sendTransactionFn - Function to send a transaction (from wallet adapter)
|
|
324
|
+
* @returns A frozen TransactionSendingSigner object
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```typescript
|
|
328
|
+
* import { address } from '@solana/addresses';
|
|
329
|
+
* import { createTransactionSendingSignerFromWallet } from '@solana/connector/headless';
|
|
330
|
+
*
|
|
331
|
+
* const signer = createTransactionSendingSignerFromWallet(
|
|
332
|
+
* address('...'),
|
|
333
|
+
* 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
|
|
334
|
+
* async (tx) => await wallet.sendTransaction(tx, connection)
|
|
335
|
+
* );
|
|
336
|
+
*
|
|
337
|
+
* // Use with Kit transaction sending
|
|
338
|
+
* const signatures = await signer.signAndSendTransactions([transaction]);
|
|
339
|
+
* ```
|
|
340
|
+
*/
|
|
341
|
+
declare function createTransactionSendingSignerFromWallet(walletAddress: Address<string>, chain: `solana:${string}`, sendTransactionFn: (transaction: any) => Promise<string>): TransactionSendingSigner<string>;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* @solana/connector - Kit Integration Helper
|
|
345
|
+
*
|
|
346
|
+
* High-level helper to create Kit signers from Wallet Standard wallets.
|
|
347
|
+
* Framework-agnostic and works in any JavaScript environment.
|
|
348
|
+
*/
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Result of creating Kit signers from a Wallet Standard wallet
|
|
352
|
+
*/
|
|
353
|
+
interface KitSignersFromWallet {
|
|
354
|
+
/** Kit Address type (null if wallet not connected) */
|
|
355
|
+
address: Address<string> | null;
|
|
356
|
+
/** Plain address string (null if wallet not connected) */
|
|
357
|
+
addressString: string | null;
|
|
358
|
+
/** Message signer (null if wallet doesn't support signing or not connected) */
|
|
359
|
+
messageSigner: MessageModifyingSigner<string> | null;
|
|
360
|
+
/** Transaction sending signer (null if wallet doesn't support or not connected) */
|
|
361
|
+
transactionSigner: TransactionSendingSigner<string> | null;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Create Kit-compatible signers from a Wallet Standard wallet
|
|
365
|
+
*
|
|
366
|
+
* This function bridges Wallet Standard wallets with modern Kit architecture.
|
|
367
|
+
* It's framework-agnostic and can be used in any JavaScript environment.
|
|
368
|
+
*
|
|
369
|
+
* The network is automatically detected from the connection's RPC endpoint.
|
|
370
|
+
* For custom RPC URLs, you can override detection with the optional `network` parameter.
|
|
371
|
+
*
|
|
372
|
+
* @param wallet - The Wallet Standard wallet instance
|
|
373
|
+
* @param account - The wallet account to use (first account if not provided)
|
|
374
|
+
* @param connection - Optional connection for network detection and transaction sending
|
|
375
|
+
* @param network - Optional network override ('mainnet' | 'devnet' | 'testnet')
|
|
376
|
+
* @returns Kit signers object with address and signer instances
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```typescript
|
|
380
|
+
* import { Connection } from '@solana/web3.js';
|
|
381
|
+
* import { createKitSignersFromWallet } from '@solana/connector/headless';
|
|
382
|
+
*
|
|
383
|
+
* const connection = new Connection('https://api.devnet.solana.com');
|
|
384
|
+
* const { address, messageSigner, transactionSigner } = createKitSignersFromWallet(
|
|
385
|
+
* wallet,
|
|
386
|
+
* account,
|
|
387
|
+
* connection
|
|
388
|
+
* );
|
|
389
|
+
* ```
|
|
390
|
+
*/
|
|
391
|
+
declare function createKitSignersFromWallet(wallet: Wallet | null, account?: WalletAccount | null, connection?: Connection | null, network?: 'mainnet' | 'devnet' | 'testnet'): KitSignersFromWallet;
|
|
392
|
+
|
|
393
|
+
declare function detectMessageModification(original: Uint8Array, modified: Uint8Array): boolean;
|
|
394
|
+
declare function updateSignatureDictionary(original: Uint8Array, signed: Uint8Array, originalSignatures: SignatureDictionary, address: Address<string>, signature: Uint8Array): SignatureDictionary;
|
|
395
|
+
declare function freezeSigner<T extends object>(signer: T): Readonly<T>;
|
|
396
|
+
declare function base58ToSignatureBytes(signature: string): SignatureBytes;
|
|
397
|
+
declare function signatureBytesToBase58(bytes: SignatureBytes): string;
|
|
398
|
+
|
|
399
|
+
type Commitment = 'processed' | 'confirmed' | 'finalized';
|
|
400
|
+
type KitRpc = {
|
|
401
|
+
getLatestBlockhash(options?: {
|
|
402
|
+
commitment?: Commitment;
|
|
403
|
+
}): {
|
|
404
|
+
send(): Promise<{
|
|
405
|
+
value: {
|
|
406
|
+
blockhash: string;
|
|
407
|
+
lastValidBlockHeight: number;
|
|
408
|
+
};
|
|
409
|
+
}>;
|
|
410
|
+
};
|
|
411
|
+
sendTransaction(bytes: Uint8Array | string, options?: any): {
|
|
412
|
+
send(): Promise<string>;
|
|
413
|
+
};
|
|
414
|
+
send?: () => unknown;
|
|
415
|
+
};
|
|
416
|
+
type DualConnection = Connection | KitRpc;
|
|
417
|
+
declare function isLegacyConnection(conn: DualConnection): conn is Connection;
|
|
418
|
+
declare function isKitConnection(conn: DualConnection): conn is KitRpc;
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* @solana/connector - Connection Helpers
|
|
422
|
+
*
|
|
423
|
+
* Abstraction layer for working with both legacy @solana/web3.js Connection
|
|
424
|
+
* and modern Kit/gill Rpc objects.
|
|
425
|
+
*/
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Get latest blockhash from either legacy Connection or Kit Rpc
|
|
429
|
+
*
|
|
430
|
+
* Abstracts the differences between web3.js 1.x and Kit/gill APIs.
|
|
431
|
+
*
|
|
432
|
+
* @param connection - Legacy Connection or Kit Rpc
|
|
433
|
+
* @param commitment - Optional commitment level (default: 'confirmed')
|
|
434
|
+
* @returns Latest blockhash and last valid block height
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
* ```typescript
|
|
438
|
+
* // Works with both Connection and Rpc
|
|
439
|
+
* const { blockhash, lastValidBlockHeight } = await getLatestBlockhash(connection);
|
|
440
|
+
* ```
|
|
441
|
+
*/
|
|
442
|
+
declare function getLatestBlockhash(connection: DualConnection, commitment?: Commitment): Promise<{
|
|
443
|
+
blockhash: string;
|
|
444
|
+
lastValidBlockHeight: number;
|
|
445
|
+
}>;
|
|
446
|
+
/**
|
|
447
|
+
* Send raw transaction bytes to either legacy Connection or Kit Rpc
|
|
448
|
+
*
|
|
449
|
+
* Abstracts the differences between web3.js 1.x and Kit/gill APIs.
|
|
450
|
+
*
|
|
451
|
+
* @param connection - Legacy Connection or Kit Rpc
|
|
452
|
+
* @param bytes - Raw transaction bytes
|
|
453
|
+
* @param options - Optional send options (skipPreflight, maxRetries, etc.)
|
|
454
|
+
* @returns Transaction signature string
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* ```typescript
|
|
458
|
+
* // Works with both Connection and Rpc
|
|
459
|
+
* const signature = await sendRawTransaction(connection, transactionBytes, {
|
|
460
|
+
* skipPreflight: false,
|
|
461
|
+
* maxRetries: 3
|
|
462
|
+
* });
|
|
463
|
+
* ```
|
|
464
|
+
*/
|
|
465
|
+
declare function sendRawTransaction(connection: DualConnection, bytes: Uint8Array, options?: SendOptions & {
|
|
466
|
+
commitment?: Commitment;
|
|
467
|
+
}): Promise<string>;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* @solana/connector - Explorer URL Utilities
|
|
471
|
+
*
|
|
472
|
+
* Generate URLs for various Solana block explorers to view transactions,
|
|
473
|
+
* accounts, and other on-chain data.
|
|
474
|
+
*/
|
|
475
|
+
type ExplorerType = 'solana-explorer' | 'solscan' | 'xray' | 'solana-fm';
|
|
476
|
+
interface ExplorerOptions {
|
|
477
|
+
/** Cluster to use for the explorer link */
|
|
478
|
+
cluster?: string;
|
|
479
|
+
/** Custom RPC URL for localnet */
|
|
480
|
+
customUrl?: string;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Generate Solana Explorer URL for a transaction signature
|
|
484
|
+
*/
|
|
485
|
+
declare function getSolanaExplorerUrl(signature: string, options?: ExplorerOptions): string;
|
|
486
|
+
/**
|
|
487
|
+
* Generate Solscan URL for a transaction signature
|
|
488
|
+
*/
|
|
489
|
+
declare function getSolscanUrl(signature: string, options?: ExplorerOptions): string;
|
|
490
|
+
/**
|
|
491
|
+
* Generate XRAY (Helius) URL for a transaction signature
|
|
492
|
+
* Note: XRAY works best with mainnet transactions
|
|
493
|
+
*/
|
|
494
|
+
declare function getXrayUrl(signature: string): string;
|
|
495
|
+
/**
|
|
496
|
+
* Generate SolanaFM URL for a transaction signature
|
|
497
|
+
*/
|
|
498
|
+
declare function getSolanaFmUrl(signature: string, options?: ExplorerOptions): string;
|
|
499
|
+
/**
|
|
500
|
+
* Get all explorer URLs for a transaction
|
|
501
|
+
*/
|
|
502
|
+
declare function getAllExplorerUrls(signature: string, options?: ExplorerOptions): Record<ExplorerType, string>;
|
|
503
|
+
/**
|
|
504
|
+
* Format a transaction signature for display (truncated)
|
|
505
|
+
*/
|
|
506
|
+
declare function formatSignature(signature: string, chars?: number): string;
|
|
507
|
+
/**
|
|
508
|
+
* Copy signature to clipboard with enhanced error handling
|
|
509
|
+
*
|
|
510
|
+
* @deprecated Use copySignatureToClipboard from utils/clipboard instead
|
|
511
|
+
* This is maintained for backwards compatibility but will be removed in a future version
|
|
512
|
+
*/
|
|
513
|
+
declare function copySignature(signature: string): Promise<boolean>;
|
|
514
|
+
|
|
515
|
+
export { ClusterType, type Commitment, type DualConnection, EnhancedStorage, EnhancedStorageAccountOptions, EnhancedStorageAdapter, EnhancedStorageClusterOptions, EnhancedStorageWalletOptions, type ExplorerOptions, type ExplorerType, type KitSignersFromWallet, SOLANA_CHAIN_IDS, StorageAdapter, StorageOptions, TransactionSigner, base58ToSignatureBytes, chainIdToClusterId, chainIdToClusterType, clusterToChainId, copySignature, createEnhancedStorageAccount, createEnhancedStorageCluster, createEnhancedStorageWallet, createGillTransactionSigner, createKitSignersFromWallet, createMessageSignerFromWallet, createTransactionSendingSignerFromWallet, detectMessageModification, formatAddress, formatNumber, formatSOL, formatSignature, formatTokenAmount, freezeSigner, getAllExplorerUrls, getChainIdFromCluster, getChainIdFromClusterId, getChainIdFromClusterType, getChainIdFromConnection, getClusterIdFromChainId, getClusterTypeFromChainId, getClusterTypeFromConnection, getLatestBlockhash, getPolyfillStatus, getSolanaExplorerUrl, getSolanaFmUrl, getSolscanUrl, getXrayUrl, installPolyfills, isCryptoAvailable, isKitConnection, isKnownSolanaChain, isLegacyConnection, isPolyfillInstalled, isSolanaChain, sendRawTransaction, signatureBytesToBase58, truncate, updateSignatureDictionary, validateKnownSolanaChain };
|