@solana/connector 0.1.6 → 0.1.8
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 +122 -44
- package/dist/{chunk-VMSZJPR5.mjs → chunk-6F6M6L7R.mjs} +152 -173
- package/dist/chunk-6F6M6L7R.mjs.map +1 -0
- package/dist/{chunk-NQXK7PGX.js → chunk-AOIXHVRH.js} +82 -235
- package/dist/chunk-AOIXHVRH.js.map +1 -0
- package/dist/chunk-DSUCH44G.js +678 -0
- package/dist/chunk-DSUCH44G.js.map +1 -0
- package/dist/{chunk-JUZVCBAI.js → chunk-FTXIXM43.js} +240 -271
- package/dist/chunk-FTXIXM43.js.map +1 -0
- package/dist/{chunk-QKVL45F6.mjs → chunk-G575OAT4.mjs} +73 -218
- package/dist/chunk-G575OAT4.mjs.map +1 -0
- package/dist/chunk-J7DHGLW6.mjs +638 -0
- package/dist/chunk-J7DHGLW6.mjs.map +1 -0
- package/dist/{chunk-ULUYX23Q.js → chunk-K3BNIGPX.js} +1023 -404
- package/dist/chunk-K3BNIGPX.js.map +1 -0
- package/dist/{chunk-3STZXVXD.mjs → chunk-TTOKQAPX.mjs} +998 -388
- package/dist/chunk-TTOKQAPX.mjs.map +1 -0
- package/dist/compat.d.mts +1 -1
- package/dist/compat.d.ts +1 -1
- package/dist/compat.js +40 -39
- package/dist/compat.js.map +1 -1
- package/dist/compat.mjs +39 -38
- package/dist/compat.mjs.map +1 -1
- package/dist/headless.d.mts +540 -152
- package/dist/headless.d.ts +540 -152
- package/dist/headless.js +226 -190
- package/dist/headless.mjs +3 -3
- package/dist/index.d.mts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +286 -218
- package/dist/index.mjs +4 -4
- package/dist/react.d.mts +283 -16
- package/dist/react.d.ts +283 -16
- package/dist/react.js +60 -28
- package/dist/react.mjs +2 -2
- package/dist/{wallet-standard-shim--YcrQNRt.d.ts → standard-shim-CT49DM5l.d.mts} +72 -252
- package/dist/{wallet-standard-shim-Dx7H8Ctf.d.mts → standard-shim-D9guL5fz.d.ts} +72 -252
- package/dist/{transaction-signer-D9d8nxwb.d.mts → transaction-signer-T-KVQFi8.d.mts} +2 -2
- package/dist/{transaction-signer-D9d8nxwb.d.ts → transaction-signer-T-KVQFi8.d.ts} +2 -2
- package/package.json +3 -3
- package/dist/chunk-3STZXVXD.mjs.map +0 -1
- package/dist/chunk-I64FD2EH.js +0 -312
- package/dist/chunk-I64FD2EH.js.map +0 -1
- package/dist/chunk-JUZVCBAI.js.map +0 -1
- package/dist/chunk-NQXK7PGX.js.map +0 -1
- package/dist/chunk-QKVL45F6.mjs.map +0 -1
- package/dist/chunk-QL3IT3TS.mjs +0 -299
- package/dist/chunk-QL3IT3TS.mjs.map +0 -1
- package/dist/chunk-ULUYX23Q.js.map +0 -1
- package/dist/chunk-VMSZJPR5.mjs.map +0 -1
package/dist/headless.d.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
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';
|
|
12
15
|
export { SignatureBytes } from '@solana/keys';
|
|
16
|
+
import { Transaction } from '@solana/transactions';
|
|
13
17
|
export { Transaction } from '@solana/transactions';
|
|
14
18
|
import { Wallet, WalletAccount } from '@wallet-standard/base';
|
|
15
19
|
export { Wallet, WalletAccount } from '@wallet-standard/base';
|
|
16
|
-
import { Connection, SendOptions } from '@solana/web3.js';
|
|
17
|
-
import { TransactionMessage, TransactionMessageWithFeePayer, Rpc, GetLatestBlockhashApi, TransactionMessageWithBlockhashLifetime } from '@solana/kit';
|
|
18
|
-
import 'react';
|
|
19
20
|
import 'react/jsx-runtime';
|
|
21
|
+
import 'react';
|
|
22
|
+
import '@solana-mobile/wallet-standard-mobile';
|
|
20
23
|
import '@solana/transaction-messages';
|
|
21
24
|
|
|
22
25
|
/**
|
|
@@ -93,6 +96,91 @@ declare function formatTokenAmount(amount: number | bigint, decimals: number, op
|
|
|
93
96
|
minimumDecimals?: number;
|
|
94
97
|
maximumDecimals?: number;
|
|
95
98
|
}): string;
|
|
99
|
+
/**
|
|
100
|
+
* Format a bigint balance with decimals, avoiding Number precision loss.
|
|
101
|
+
* Uses string manipulation for precision beyond Number.MAX_SAFE_INTEGER.
|
|
102
|
+
*
|
|
103
|
+
* @param amount - The bigint amount in smallest units
|
|
104
|
+
* @param decimals - Number of decimal places for the token
|
|
105
|
+
* @param options - Formatting options
|
|
106
|
+
* @returns Formatted string representation
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* // Small amounts (uses Number for speed)
|
|
110
|
+
* formatBigIntBalance(1000000n, 6) // Returns: '1'
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* // Large amounts (uses string manipulation for precision)
|
|
114
|
+
* formatBigIntBalance(12345678901234567890n, 18) // Returns: '12.345678901234567890'
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* // With options
|
|
118
|
+
* formatBigIntBalance(1500000n, 6, { maxDecimals: 2 }) // Returns: '1.5'
|
|
119
|
+
*/
|
|
120
|
+
declare function formatBigIntBalance(amount: bigint, decimals: number, options?: {
|
|
121
|
+
/** Maximum number of decimal places to show (default: min(decimals, 6)) */
|
|
122
|
+
maxDecimals?: number;
|
|
123
|
+
/** Minimum number of decimal places to show (default: 0) */
|
|
124
|
+
minDecimals?: number;
|
|
125
|
+
/** Locale for number formatting (default: undefined, uses browser locale) */
|
|
126
|
+
locale?: string;
|
|
127
|
+
/** Whether to use grouping separators like commas (default: true) */
|
|
128
|
+
useGrouping?: boolean;
|
|
129
|
+
}): string;
|
|
130
|
+
/**
|
|
131
|
+
* Convert lamports to SOL string representation with BigInt safety.
|
|
132
|
+
*
|
|
133
|
+
* @param lamports - Amount in lamports (bigint)
|
|
134
|
+
* @param options - Formatting options
|
|
135
|
+
* @returns Formatted SOL string
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* formatLamportsToSolSafe(1000000000n) // Returns: '1'
|
|
139
|
+
* formatLamportsToSolSafe(1500000000n, { maxDecimals: 4 }) // Returns: '1.5'
|
|
140
|
+
* formatLamportsToSolSafe(1000000000n, { suffix: true }) // Returns: '1 SOL'
|
|
141
|
+
*/
|
|
142
|
+
declare function formatLamportsToSolSafe(lamports: bigint, options?: {
|
|
143
|
+
/** Maximum decimal places (default: 4) */
|
|
144
|
+
maxDecimals?: number;
|
|
145
|
+
/** Minimum decimal places (default: 0) */
|
|
146
|
+
minDecimals?: number;
|
|
147
|
+
/** Add ' SOL' suffix (default: false) */
|
|
148
|
+
suffix?: boolean;
|
|
149
|
+
/** Locale for formatting */
|
|
150
|
+
locale?: string;
|
|
151
|
+
}): string;
|
|
152
|
+
/**
|
|
153
|
+
* Format USD value from bigint amount with BigInt safety.
|
|
154
|
+
* Uses the USD price to calculate the value.
|
|
155
|
+
*
|
|
156
|
+
* @param amount - Token amount in smallest units (bigint)
|
|
157
|
+
* @param decimals - Token decimals
|
|
158
|
+
* @param usdPrice - Current USD price per token
|
|
159
|
+
* @param options - Formatting options
|
|
160
|
+
* @returns Formatted USD string
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* formatBigIntUsd(1000000000n, 9, 150.50) // Returns: '$150.50'
|
|
164
|
+
*/
|
|
165
|
+
declare function formatBigIntUsd(amount: bigint, decimals: number, usdPrice: number, options?: {
|
|
166
|
+
/** Locale for formatting (default: undefined) */
|
|
167
|
+
locale?: string;
|
|
168
|
+
/** Currency code (default: 'USD') */
|
|
169
|
+
currency?: string;
|
|
170
|
+
}): string;
|
|
171
|
+
/**
|
|
172
|
+
* Format a token balance for display with BigInt safety.
|
|
173
|
+
* Convenience wrapper around formatBigIntBalance.
|
|
174
|
+
*
|
|
175
|
+
* @param amount - Token amount in smallest units
|
|
176
|
+
* @param decimals - Token decimals
|
|
177
|
+
* @param options - Formatting options
|
|
178
|
+
* @returns Formatted balance string
|
|
179
|
+
*/
|
|
180
|
+
declare function formatTokenBalanceSafe(amount: bigint, decimals: number, options?: {
|
|
181
|
+
maxDecimals?: number;
|
|
182
|
+
locale?: string;
|
|
183
|
+
}): string;
|
|
96
184
|
|
|
97
185
|
declare const SOLANA_CHAIN_IDS: {
|
|
98
186
|
readonly mainnet: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
@@ -113,6 +201,113 @@ declare function clusterToChainId(cluster: SolanaCluster): `solana:${string}` |
|
|
|
113
201
|
declare function chainIdToClusterType(chainId: string): ClusterType | null;
|
|
114
202
|
declare function chainIdToClusterId(chainId: string): SolanaClusterId | null;
|
|
115
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
|
+
|
|
116
311
|
/**
|
|
117
312
|
* @solana/connector - Kit Constants
|
|
118
313
|
*
|
|
@@ -237,48 +432,218 @@ interface PrepareTransactionConfig<TMessage extends PrepareCompilableTransaction
|
|
|
237
432
|
declare function prepareTransaction<TMessage extends PrepareCompilableTransactionMessage>(config: PrepareTransactionConfig<TMessage>): Promise<TMessage & TransactionMessageWithBlockhashLifetime>;
|
|
238
433
|
|
|
239
434
|
/**
|
|
240
|
-
* @solana/connector - Kit
|
|
435
|
+
* @solana/connector - Kit Signer Factories
|
|
241
436
|
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
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
|
|
244
443
|
*
|
|
245
|
-
* This
|
|
246
|
-
*
|
|
444
|
+
* This is a pure, framework-agnostic factory function that can be used anywhere.
|
|
445
|
+
* Enables message signing (SIWS, auth) without React.
|
|
247
446
|
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
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
|
+
* ```
|
|
250
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
|
+
* ```
|
|
492
|
+
*/
|
|
493
|
+
declare function createTransactionSendingSignerFromWallet(walletAddress: Address<string>, chain: `solana:${string}`, sendTransactionFn: (transaction: Transaction) => Promise<string>): TransactionSendingSigner<string>;
|
|
251
494
|
|
|
252
495
|
/**
|
|
253
|
-
*
|
|
496
|
+
* @solana/connector - Kit Integration Helper
|
|
254
497
|
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
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
|
|
257
517
|
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
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
|
|
260
529
|
*
|
|
261
530
|
* @example
|
|
262
531
|
* ```typescript
|
|
263
|
-
* import {
|
|
264
|
-
* import {
|
|
532
|
+
* import { Connection } from '@solana/web3.js';
|
|
533
|
+
* import { createKitSignersFromWallet } from '@solana/connector/headless';
|
|
265
534
|
*
|
|
266
|
-
* const
|
|
267
|
-
* const
|
|
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
|
|
268
553
|
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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',
|
|
274
621
|
* });
|
|
622
|
+
*
|
|
623
|
+
* if (!result.success) {
|
|
624
|
+
* console.error('Config validation failed:', result.error.format());
|
|
625
|
+
* }
|
|
275
626
|
* ```
|
|
276
627
|
*/
|
|
277
|
-
declare function
|
|
628
|
+
declare function validateConfigOptions(options: unknown): z.ZodSafeParseResult<DefaultConfigOptionsInput>;
|
|
278
629
|
/**
|
|
279
|
-
*
|
|
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
|
+
* ```
|
|
280
645
|
*/
|
|
281
|
-
declare
|
|
646
|
+
declare function parseConfigOptions(options: unknown): DefaultConfigOptionsInput;
|
|
282
647
|
|
|
283
648
|
/**
|
|
284
649
|
* Enhanced Storage
|
|
@@ -324,6 +689,141 @@ declare class EnhancedStorageAdapter<T> implements StorageAdapter<T> {
|
|
|
324
689
|
onError(handler: (error: Error) => void): this;
|
|
325
690
|
}
|
|
326
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
|
+
|
|
327
827
|
/**
|
|
328
828
|
* @solana/connector - Browser Compatibility Polyfills
|
|
329
829
|
*
|
|
@@ -407,124 +907,12 @@ declare function getPolyfillStatus(): {
|
|
|
407
907
|
environment: 'browser' | 'server';
|
|
408
908
|
};
|
|
409
909
|
|
|
410
|
-
/**
|
|
411
|
-
* @solana/connector - Kit Signer Factories
|
|
412
|
-
*
|
|
413
|
-
* Framework-agnostic factory functions to create Kit-compatible signers from wallet functions.
|
|
414
|
-
* These factories enable pure Kit integration without React or framework dependencies.
|
|
415
|
-
*/
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Create a MessageModifyingSigner from a wallet's sign message function
|
|
419
|
-
*
|
|
420
|
-
* This is a pure, framework-agnostic factory function that can be used anywhere.
|
|
421
|
-
* Enables message signing (SIWS, auth) without React.
|
|
422
|
-
*
|
|
423
|
-
* @param walletAddress - The address of the wallet
|
|
424
|
-
* @param signMessageFn - Function to sign a message (from wallet adapter)
|
|
425
|
-
* @returns A frozen MessageModifyingSigner object
|
|
426
|
-
*
|
|
427
|
-
* @example
|
|
428
|
-
* ```typescript
|
|
429
|
-
* import { address } from '@solana/addresses';
|
|
430
|
-
* import { createMessageSignerFromWallet } from '@solana/connector/headless';
|
|
431
|
-
*
|
|
432
|
-
* const signer = createMessageSignerFromWallet(
|
|
433
|
-
* address('...'),
|
|
434
|
-
* async (msg) => await wallet.signMessage(msg)
|
|
435
|
-
* );
|
|
436
|
-
*
|
|
437
|
-
* // Use with Kit message signing
|
|
438
|
-
* import { createSignableMessage } from '@solana/signers';
|
|
439
|
-
* const signed = await signer.modifyAndSignMessages([createSignableMessage(messageBytes)]);
|
|
440
|
-
* ```
|
|
441
|
-
*/
|
|
442
|
-
declare function createMessageSignerFromWallet(walletAddress: Address<string>, signMessageFn: (message: Uint8Array) => Promise<Uint8Array>): MessageModifyingSigner<string>;
|
|
443
|
-
/**
|
|
444
|
-
* Create a TransactionSendingSigner from a wallet's send transaction function
|
|
445
|
-
*
|
|
446
|
-
* This is a pure, framework-agnostic factory function that can be used anywhere.
|
|
447
|
-
* Enables sign + send in one operation (wallets like Phantom support this).
|
|
448
|
-
*
|
|
449
|
-
* @param walletAddress - The address of the wallet
|
|
450
|
-
* @param chain - The Solana chain identifier (e.g., 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1')
|
|
451
|
-
* @param sendTransactionFn - Function to send a transaction (from wallet adapter)
|
|
452
|
-
* @returns A frozen TransactionSendingSigner object
|
|
453
|
-
*
|
|
454
|
-
* @example
|
|
455
|
-
* ```typescript
|
|
456
|
-
* import { address } from '@solana/addresses';
|
|
457
|
-
* import { createTransactionSendingSignerFromWallet } from '@solana/connector/headless';
|
|
458
|
-
*
|
|
459
|
-
* const signer = createTransactionSendingSignerFromWallet(
|
|
460
|
-
* address('...'),
|
|
461
|
-
* 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
|
|
462
|
-
* async (tx) => await wallet.sendTransaction(tx, connection)
|
|
463
|
-
* );
|
|
464
|
-
*
|
|
465
|
-
* // Use with Kit transaction sending
|
|
466
|
-
* const signatures = await signer.signAndSendTransactions([transaction]);
|
|
467
|
-
* ```
|
|
468
|
-
*/
|
|
469
|
-
declare function createTransactionSendingSignerFromWallet(walletAddress: Address<string>, chain: `solana:${string}`, sendTransactionFn: (transaction: any) => Promise<string>): TransactionSendingSigner<string>;
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* @solana/connector - Kit Integration Helper
|
|
473
|
-
*
|
|
474
|
-
* High-level helper to create Kit signers from Wallet Standard wallets.
|
|
475
|
-
* Framework-agnostic and works in any JavaScript environment.
|
|
476
|
-
*/
|
|
477
|
-
|
|
478
|
-
/**
|
|
479
|
-
* Result of creating Kit signers from a Wallet Standard wallet
|
|
480
|
-
*/
|
|
481
|
-
interface KitSignersFromWallet {
|
|
482
|
-
/** Kit Address type (null if wallet not connected) */
|
|
483
|
-
address: Address<string> | null;
|
|
484
|
-
/** Plain address string (null if wallet not connected) */
|
|
485
|
-
addressString: string | null;
|
|
486
|
-
/** Message signer (null if wallet doesn't support signing or not connected) */
|
|
487
|
-
messageSigner: MessageModifyingSigner<string> | null;
|
|
488
|
-
/** Transaction sending signer (null if wallet doesn't support or not connected) */
|
|
489
|
-
transactionSigner: TransactionSendingSigner<string> | null;
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Create Kit-compatible signers from a Wallet Standard wallet
|
|
493
|
-
*
|
|
494
|
-
* This function bridges Wallet Standard wallets with modern Kit architecture.
|
|
495
|
-
* It's framework-agnostic and can be used in any JavaScript environment.
|
|
496
|
-
*
|
|
497
|
-
* The network is automatically detected from the connection's RPC endpoint.
|
|
498
|
-
* For custom RPC URLs, you can override detection with the optional `network` parameter.
|
|
499
|
-
*
|
|
500
|
-
* @param wallet - The Wallet Standard wallet instance
|
|
501
|
-
* @param account - The wallet account to use (first account if not provided)
|
|
502
|
-
* @param connection - Optional connection for network detection and transaction sending
|
|
503
|
-
* @param network - Optional network override ('mainnet' | 'devnet' | 'testnet')
|
|
504
|
-
* @returns Kit signers object with address and signer instances
|
|
505
|
-
*
|
|
506
|
-
* @example
|
|
507
|
-
* ```typescript
|
|
508
|
-
* import { Connection } from '@solana/web3.js';
|
|
509
|
-
* import { createKitSignersFromWallet } from '@solana/connector/headless';
|
|
510
|
-
*
|
|
511
|
-
* const connection = new Connection('https://api.devnet.solana.com');
|
|
512
|
-
* const { address, messageSigner, transactionSigner } = createKitSignersFromWallet(
|
|
513
|
-
* wallet,
|
|
514
|
-
* account,
|
|
515
|
-
* connection
|
|
516
|
-
* );
|
|
517
|
-
* ```
|
|
518
|
-
*/
|
|
519
|
-
declare function createKitSignersFromWallet(wallet: Wallet | null, account?: WalletAccount | null, connection?: Connection | null, network?: 'mainnet' | 'devnet' | 'testnet'): KitSignersFromWallet;
|
|
520
|
-
|
|
521
|
-
declare function detectMessageModification(original: Uint8Array, modified: Uint8Array): boolean;
|
|
522
|
-
declare function updateSignatureDictionary(original: Uint8Array, signed: Uint8Array, originalSignatures: SignatureDictionary, address: Address<string>, signature: Uint8Array): SignatureDictionary;
|
|
523
|
-
declare function freezeSigner<T extends object>(signer: T): Readonly<T>;
|
|
524
|
-
declare function base58ToSignatureBytes(signature: string): SignatureBytes;
|
|
525
|
-
declare function signatureBytesToBase58(bytes: SignatureBytes): string;
|
|
526
|
-
|
|
527
910
|
type Commitment = 'processed' | 'confirmed' | 'finalized';
|
|
911
|
+
interface KitSendTransactionOptions {
|
|
912
|
+
commitment?: Commitment;
|
|
913
|
+
skipPreflight?: boolean;
|
|
914
|
+
maxRetries?: number;
|
|
915
|
+
}
|
|
528
916
|
type KitRpc = {
|
|
529
917
|
getLatestBlockhash(options?: {
|
|
530
918
|
commitment?: Commitment;
|
|
@@ -536,7 +924,7 @@ type KitRpc = {
|
|
|
536
924
|
};
|
|
537
925
|
}>;
|
|
538
926
|
};
|
|
539
|
-
sendTransaction(bytes: Uint8Array | string, options?:
|
|
927
|
+
sendTransaction(bytes: Uint8Array | string, options?: KitSendTransactionOptions): {
|
|
540
928
|
send(): Promise<string>;
|
|
541
929
|
};
|
|
542
930
|
send?: () => unknown;
|
|
@@ -640,4 +1028,4 @@ declare function formatSignature(signature: string, chars?: number): string;
|
|
|
640
1028
|
*/
|
|
641
1029
|
declare function copySignature(signature: string): Promise<boolean>;
|
|
642
1030
|
|
|
643
|
-
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, formatNumber, formatSOL, formatSignature, formatTokenAmount, 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 };
|