@solana/connector 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +460 -1082
- package/dist/{chunk-TIW3EQPC.js → chunk-CLXM6UEE.js} +120 -103
- package/dist/chunk-CLXM6UEE.js.map +1 -0
- package/dist/{chunk-7CKCRY25.js → chunk-D6PZY5G6.js} +69 -77
- package/dist/chunk-D6PZY5G6.js.map +1 -0
- package/dist/chunk-LUZWUZ5N.js +2012 -0
- package/dist/chunk-LUZWUZ5N.js.map +1 -0
- package/dist/{chunk-HPENTIPE.mjs → chunk-N3Q2J2FG.mjs} +51 -55
- package/dist/chunk-N3Q2J2FG.mjs.map +1 -0
- package/dist/chunk-P5MWBDFG.mjs +298 -0
- package/dist/chunk-P5MWBDFG.mjs.map +1 -0
- package/dist/chunk-RIQH5W7D.js +311 -0
- package/dist/chunk-RIQH5W7D.js.map +1 -0
- package/dist/chunk-U64YZRJL.mjs +1984 -0
- package/dist/chunk-U64YZRJL.mjs.map +1 -0
- package/dist/{chunk-TKJSKXSA.mjs → chunk-YTCSTE3Q.mjs} +35 -19
- package/dist/chunk-YTCSTE3Q.mjs.map +1 -0
- package/dist/compat.d.mts +4 -2
- package/dist/compat.d.ts +4 -2
- package/dist/compat.js +3 -3
- package/dist/compat.mjs +1 -1
- package/dist/headless.d.mts +146 -18
- package/dist/headless.d.ts +146 -18
- package/dist/headless.js +144 -111
- package/dist/headless.mjs +3 -2
- package/dist/index.d.mts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +207 -126
- package/dist/index.mjs +4 -3
- package/dist/react.d.mts +707 -67
- package/dist/react.d.ts +707 -67
- package/dist/react.js +64 -16
- package/dist/react.mjs +2 -2
- package/dist/{transaction-signer-D3csM_Mf.d.mts → transaction-signer-D9d8nxwb.d.mts} +3 -1
- package/dist/{transaction-signer-D3csM_Mf.d.ts → transaction-signer-D9d8nxwb.d.ts} +3 -1
- package/dist/{wallet-standard-shim-C1tisl9S.d.ts → wallet-standard-shim-Cp4vF4oo.d.mts} +133 -6
- package/dist/{wallet-standard-shim-Cg0GVGwu.d.mts → wallet-standard-shim-DC_Z7DS-.d.ts} +133 -6
- package/package.json +16 -12
- package/dist/chunk-5ZUVZZWU.mjs +0 -180
- package/dist/chunk-5ZUVZZWU.mjs.map +0 -1
- package/dist/chunk-7CKCRY25.js.map +0 -1
- package/dist/chunk-FTD7F7CS.js +0 -314
- package/dist/chunk-FTD7F7CS.js.map +0 -1
- package/dist/chunk-HPENTIPE.mjs.map +0 -1
- package/dist/chunk-MPZFJEJK.mjs +0 -298
- package/dist/chunk-MPZFJEJK.mjs.map +0 -1
- package/dist/chunk-SMUUAKC3.js +0 -186
- package/dist/chunk-SMUUAKC3.js.map +0 -1
- package/dist/chunk-TIW3EQPC.js.map +0 -1
- package/dist/chunk-TKJSKXSA.mjs.map +0 -1
package/dist/react.d.mts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { h as UnifiedConfig, d as ConnectorConfig, M as MobileWalletAdapterConfig, i as ClusterType, A as AccountInfo,
|
|
2
|
-
export { b as ConnectorErrorBoundary, C as ConnectorProvider, c as ConnectorSnapshot, e as ConnectorState, D as DefaultConfigOptions, E as ExtendedConnectorConfig, U as UnifiedConfigOptions, W as WalletInfo, g as WalletStandardAccount, f as WalletStandardWallet, u as useConnector, a as useConnectorClient, w as withErrorBoundary } from './wallet-standard-shim-
|
|
1
|
+
import { h as UnifiedConfig, d as ConnectorConfig, M as MobileWalletAdapterConfig, i as ClusterType, A as AccountInfo, V as ClipboardResult, Q as SolanaClient } from './wallet-standard-shim-Cp4vF4oo.mjs';
|
|
2
|
+
export { b as ConnectorErrorBoundary, C as ConnectorProvider, c as ConnectorSnapshot, e as ConnectorState, D as DefaultConfigOptions, E as ExtendedConnectorConfig, U as UnifiedConfigOptions, W as WalletInfo, g as WalletStandardAccount, f as WalletStandardWallet, u as useConnector, a as useConnectorClient, w as withErrorBoundary } from './wallet-standard-shim-Cp4vF4oo.mjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode, ComponentType, PropsWithChildren } from 'react';
|
|
5
5
|
import { SolanaCluster, SolanaClusterId } from '@wallet-ui/core';
|
|
6
6
|
export { SolanaCluster, SolanaClusterId } from '@wallet-ui/core';
|
|
7
|
-
import { j as TransactionSigner, b as TransactionSignerCapabilities } from './transaction-signer-
|
|
8
|
-
import { TransactionModifyingSigner
|
|
7
|
+
import { j as TransactionSigner, b as TransactionSignerCapabilities } from './transaction-signer-D9d8nxwb.mjs';
|
|
8
|
+
import { TransactionModifyingSigner } from '@solana/signers';
|
|
9
|
+
import { TransactionMessage, TransactionMessageWithFeePayer, TransactionMessageWithBlockhashLifetime } from '@solana/kit';
|
|
9
10
|
export { Wallet, WalletAccount } from '@wallet-standard/base';
|
|
11
|
+
import '@solana/addresses';
|
|
12
|
+
import '@solana/keys';
|
|
13
|
+
import '@solana/transaction-messages';
|
|
10
14
|
import '@solana/web3.js';
|
|
11
15
|
|
|
12
16
|
interface UnifiedProviderProps {
|
|
@@ -186,19 +190,19 @@ interface UseTransactionSignerReturn {
|
|
|
186
190
|
declare function useTransactionSigner(): UseTransactionSignerReturn;
|
|
187
191
|
|
|
188
192
|
/**
|
|
189
|
-
* @solana/connector -
|
|
193
|
+
* @solana/connector - useKitTransactionSigner hook
|
|
190
194
|
*
|
|
191
|
-
* React hook for
|
|
192
|
-
* Use this when working with modern Solana libraries (@solana/kit
|
|
195
|
+
* React hook for kit-compatible transaction signing
|
|
196
|
+
* Use this when working with modern Solana libraries (@solana/kit)
|
|
193
197
|
*/
|
|
194
198
|
|
|
195
199
|
/**
|
|
196
|
-
* Return value from
|
|
200
|
+
* Return value from useKitTransactionSigner hook
|
|
197
201
|
*/
|
|
198
|
-
interface
|
|
202
|
+
interface UseKitTransactionSignerReturn {
|
|
199
203
|
/**
|
|
200
|
-
*
|
|
201
|
-
* Use this with modern Solana libraries (@solana/kit
|
|
204
|
+
* Kit-compatible TransactionModifyingSigner instance (null if not connected)
|
|
205
|
+
* Use this with modern Solana libraries (@solana/kit)
|
|
202
206
|
*/
|
|
203
207
|
signer: TransactionModifyingSigner | null;
|
|
204
208
|
/**
|
|
@@ -208,27 +212,31 @@ interface UseGillTransactionSignerReturn {
|
|
|
208
212
|
ready: boolean;
|
|
209
213
|
}
|
|
210
214
|
/**
|
|
211
|
-
*
|
|
215
|
+
* @deprecated Use `UseKitTransactionSignerReturn` instead
|
|
216
|
+
*/
|
|
217
|
+
type UseGillTransactionSignerReturn = UseKitTransactionSignerReturn;
|
|
218
|
+
/**
|
|
219
|
+
* Hook for kit-compatible transaction signing
|
|
212
220
|
*
|
|
213
|
-
* Creates a TransactionPartialSigner that's compatible with @solana/kit
|
|
221
|
+
* Creates a TransactionPartialSigner that's compatible with @solana/kit,
|
|
214
222
|
* enabling seamless integration with modern Solana development patterns.
|
|
215
223
|
*
|
|
216
|
-
* This hook wraps the standard useTransactionSigner and adapts it to
|
|
224
|
+
* This hook wraps the standard useTransactionSigner and adapts it to kit's
|
|
217
225
|
* interface, allowing you to use modern libraries without type incompatibilities.
|
|
218
226
|
*
|
|
219
227
|
* @example
|
|
220
228
|
* ```tsx
|
|
221
|
-
* import {
|
|
222
|
-
* import { getTransferSolInstruction } from '
|
|
223
|
-
* import { address, pipe, createTransactionMessage } from '
|
|
229
|
+
* import { useKitTransactionSigner } from '@solana/connector';
|
|
230
|
+
* import { getTransferSolInstruction } from '@solana-program/system';
|
|
231
|
+
* import { address, pipe, createTransactionMessage } from '@solana/kit';
|
|
224
232
|
*
|
|
225
233
|
* function ModernTransfer() {
|
|
226
|
-
* const { signer, ready } =
|
|
234
|
+
* const { signer, ready } = useKitTransactionSigner();
|
|
227
235
|
*
|
|
228
236
|
* const handleTransfer = async (recipient: string, amount: number) => {
|
|
229
237
|
* if (!signer) return;
|
|
230
238
|
*
|
|
231
|
-
* // Fully type-safe with
|
|
239
|
+
* // Fully type-safe with @solana/kit!
|
|
232
240
|
* const instruction = getTransferSolInstruction({
|
|
233
241
|
* source: signer, // No type errors
|
|
234
242
|
* destination: address(recipient),
|
|
@@ -244,7 +252,7 @@ interface UseGillTransactionSignerReturn {
|
|
|
244
252
|
*
|
|
245
253
|
* return (
|
|
246
254
|
* <button onClick={handleTransfer} disabled={!ready}>
|
|
247
|
-
* Send with
|
|
255
|
+
* Send with Kit
|
|
248
256
|
* </button>
|
|
249
257
|
* );
|
|
250
258
|
* }
|
|
@@ -261,22 +269,26 @@ interface UseGillTransactionSignerReturn {
|
|
|
261
269
|
* }
|
|
262
270
|
* ```
|
|
263
271
|
*/
|
|
264
|
-
declare function
|
|
272
|
+
declare function useKitTransactionSigner(): UseKitTransactionSignerReturn;
|
|
273
|
+
/**
|
|
274
|
+
* @deprecated Use `useKitTransactionSigner` instead. This alias is provided for backward compatibility.
|
|
275
|
+
*/
|
|
276
|
+
declare const useGillTransactionSigner: typeof useKitTransactionSigner;
|
|
265
277
|
|
|
266
278
|
/**
|
|
267
|
-
* @solana/connector -
|
|
279
|
+
* @solana/connector - useSolanaClient hook
|
|
268
280
|
*
|
|
269
|
-
* React hook for
|
|
270
|
-
* Provides rpc
|
|
281
|
+
* React hook for Kit's SolanaClient with built-in RPC and WebSocket subscriptions
|
|
282
|
+
* Provides rpc and rpcSubscriptions
|
|
271
283
|
*/
|
|
272
284
|
|
|
273
285
|
/**
|
|
274
|
-
* Return value from
|
|
286
|
+
* Return value from useSolanaClient hook
|
|
275
287
|
*/
|
|
276
|
-
interface
|
|
288
|
+
interface UseSolanaClientReturn {
|
|
277
289
|
/**
|
|
278
|
-
*
|
|
279
|
-
* Includes: rpc, rpcSubscriptions
|
|
290
|
+
* Kit SolanaClient instance with RPC and subscriptions (null if not available)
|
|
291
|
+
* Includes: rpc, rpcSubscriptions
|
|
280
292
|
*/
|
|
281
293
|
client: SolanaClient | null;
|
|
282
294
|
/**
|
|
@@ -289,24 +301,26 @@ interface UseGillSolanaClientReturn {
|
|
|
289
301
|
clusterType: ClusterType | null;
|
|
290
302
|
}
|
|
291
303
|
/**
|
|
292
|
-
*
|
|
304
|
+
* @deprecated Use `UseSolanaClientReturn` instead
|
|
305
|
+
*/
|
|
306
|
+
type UseGillSolanaClientReturn = UseSolanaClientReturn;
|
|
307
|
+
/**
|
|
308
|
+
* Hook for Kit's SolanaClient with automatic RPC and WebSocket subscription management
|
|
293
309
|
*
|
|
294
310
|
* Creates a fully configured SolanaClient based on the current cluster, providing:
|
|
295
311
|
* - Type-safe RPC client
|
|
296
312
|
* - WebSocket subscription client
|
|
297
|
-
* - Built-in sendAndConfirmTransaction helper
|
|
298
|
-
* - Built-in simulateTransaction helper
|
|
299
313
|
*
|
|
300
314
|
* The client is automatically recreated when the cluster changes.
|
|
301
315
|
*
|
|
302
316
|
* @example
|
|
303
317
|
* ```tsx
|
|
304
|
-
* import {
|
|
305
|
-
* import { signTransactionMessageWithSigners } from '
|
|
318
|
+
* import { useSolanaClient, useKitTransactionSigner } from '@solana/connector';
|
|
319
|
+
* import { signTransactionMessageWithSigners } from '@solana/kit';
|
|
306
320
|
*
|
|
307
321
|
* function SendTransaction() {
|
|
308
|
-
* const { client, ready } =
|
|
309
|
-
* const { signer } =
|
|
322
|
+
* const { client, ready } = useSolanaClient();
|
|
323
|
+
* const { signer } = useKitTransactionSigner();
|
|
310
324
|
*
|
|
311
325
|
* const handleSend = async (transaction) => {
|
|
312
326
|
* if (!client || !signer) return;
|
|
@@ -314,10 +328,8 @@ interface UseGillSolanaClientReturn {
|
|
|
314
328
|
* // Sign the transaction
|
|
315
329
|
* const signed = await signTransactionMessageWithSigners(transaction);
|
|
316
330
|
*
|
|
317
|
-
* // Send
|
|
318
|
-
* await client.
|
|
319
|
-
* commitment: 'confirmed'
|
|
320
|
-
* });
|
|
331
|
+
* // Send using RPC client
|
|
332
|
+
* const signature = await client.rpc.sendTransaction(signed).send();
|
|
321
333
|
* };
|
|
322
334
|
*
|
|
323
335
|
* return (
|
|
@@ -330,28 +342,9 @@ interface UseGillSolanaClientReturn {
|
|
|
330
342
|
*
|
|
331
343
|
* @example
|
|
332
344
|
* ```tsx
|
|
333
|
-
* // Simulating a transaction
|
|
334
|
-
* function SimulateTransaction() {
|
|
335
|
-
* const { client } = useGillSolanaClient();
|
|
336
|
-
*
|
|
337
|
-
* const handleSimulate = async (transaction) => {
|
|
338
|
-
* if (!client) return;
|
|
339
|
-
*
|
|
340
|
-
* const simulation = await client.simulateTransaction(transaction, {
|
|
341
|
-
* sigVerify: false,
|
|
342
|
-
* commitment: 'processed'
|
|
343
|
-
* });
|
|
344
|
-
*
|
|
345
|
-
* console.log('Simulation result:', simulation);
|
|
346
|
-
* };
|
|
347
|
-
* }
|
|
348
|
-
* ```
|
|
349
|
-
*
|
|
350
|
-
* @example
|
|
351
|
-
* ```tsx
|
|
352
345
|
* // Direct RPC access
|
|
353
346
|
* function GetBalance() {
|
|
354
|
-
* const { client } =
|
|
347
|
+
* const { client } = useSolanaClient();
|
|
355
348
|
*
|
|
356
349
|
* const fetchBalance = async (address: Address) => {
|
|
357
350
|
* if (!client) return;
|
|
@@ -362,7 +355,11 @@ interface UseGillSolanaClientReturn {
|
|
|
362
355
|
* }
|
|
363
356
|
* ```
|
|
364
357
|
*/
|
|
365
|
-
declare function
|
|
358
|
+
declare function useSolanaClient(): UseSolanaClientReturn;
|
|
359
|
+
/**
|
|
360
|
+
* @deprecated Use `useSolanaClient` instead. This alias is provided for backward compatibility.
|
|
361
|
+
*/
|
|
362
|
+
declare const useGillSolanaClient: typeof useSolanaClient;
|
|
366
363
|
|
|
367
364
|
/**
|
|
368
365
|
* @solana/connector - useTransactionPreparer hook
|
|
@@ -371,6 +368,11 @@ declare function useGillSolanaClient(): UseGillSolanaClientReturn;
|
|
|
371
368
|
* Handles blockhash fetching, compute unit limits, and transaction simulation
|
|
372
369
|
*/
|
|
373
370
|
|
|
371
|
+
/**
|
|
372
|
+
* A transaction message that can be compiled for signing.
|
|
373
|
+
* Replaces the deprecated CompilableTransactionMessage type.
|
|
374
|
+
*/
|
|
375
|
+
type CompilableTransactionMessage = TransactionMessage & TransactionMessageWithFeePayer;
|
|
374
376
|
/**
|
|
375
377
|
* Options for transaction preparation
|
|
376
378
|
*/
|
|
@@ -416,7 +418,7 @@ interface UseTransactionPreparerReturn {
|
|
|
416
418
|
/**
|
|
417
419
|
* Hook for preparing transactions with automatic optimization
|
|
418
420
|
*
|
|
419
|
-
* Uses
|
|
421
|
+
* Uses kit's prepareTransaction utility to:
|
|
420
422
|
* 1. Simulate the transaction to determine optimal compute units
|
|
421
423
|
* 2. Set compute unit limit (with configurable multiplier for safety margin)
|
|
422
424
|
* 3. Fetch and set the latest blockhash (if not already present)
|
|
@@ -426,14 +428,14 @@ interface UseTransactionPreparerReturn {
|
|
|
426
428
|
*
|
|
427
429
|
* @example
|
|
428
430
|
* ```tsx
|
|
429
|
-
* import { useTransactionPreparer,
|
|
430
|
-
* import { pipe, createTransactionMessage, appendTransactionMessageInstructions } from '
|
|
431
|
-
* import { getTransferSolInstruction } from '
|
|
431
|
+
* import { useTransactionPreparer, useKitTransactionSigner } from '@solana/connector';
|
|
432
|
+
* import { pipe, createTransactionMessage, appendTransactionMessageInstructions } from '@solana/kit';
|
|
433
|
+
* import { getTransferSolInstruction } from '@solana-program/system';
|
|
432
434
|
*
|
|
433
435
|
* function SendOptimizedTransaction() {
|
|
434
436
|
* const { prepare, ready } = useTransactionPreparer();
|
|
435
|
-
* const { signer } =
|
|
436
|
-
* const { client } =
|
|
437
|
+
* const { signer } = useKitTransactionSigner();
|
|
438
|
+
* const { client } = useSolanaClient();
|
|
437
439
|
*
|
|
438
440
|
* const handleSend = async (recipient: string, amount: bigint) => {
|
|
439
441
|
* if (!ready || !signer || !client) return;
|
|
@@ -493,4 +495,642 @@ interface UseTransactionPreparerReturn {
|
|
|
493
495
|
*/
|
|
494
496
|
declare function useTransactionPreparer(): UseTransactionPreparerReturn;
|
|
495
497
|
|
|
496
|
-
|
|
498
|
+
interface TokenBalance {
|
|
499
|
+
/** Token mint address */
|
|
500
|
+
mint: string;
|
|
501
|
+
/** Token balance (in smallest unit) */
|
|
502
|
+
amount: bigint;
|
|
503
|
+
/** Token decimals */
|
|
504
|
+
decimals: number;
|
|
505
|
+
/** Formatted balance (human readable) */
|
|
506
|
+
formatted: string;
|
|
507
|
+
/** Token symbol if known */
|
|
508
|
+
symbol?: string;
|
|
509
|
+
/** Token name if known */
|
|
510
|
+
name?: string;
|
|
511
|
+
/** Token logo URL if known */
|
|
512
|
+
logo?: string;
|
|
513
|
+
}
|
|
514
|
+
interface UseBalanceReturn {
|
|
515
|
+
/** SOL balance in SOL (not lamports) */
|
|
516
|
+
solBalance: number;
|
|
517
|
+
/** SOL balance in lamports */
|
|
518
|
+
lamports: bigint;
|
|
519
|
+
/** Formatted SOL balance string */
|
|
520
|
+
formattedSol: string;
|
|
521
|
+
/** Token balances */
|
|
522
|
+
tokens: TokenBalance[];
|
|
523
|
+
/** Whether balance is loading */
|
|
524
|
+
isLoading: boolean;
|
|
525
|
+
/** Error if balance fetch failed */
|
|
526
|
+
error: Error | null;
|
|
527
|
+
/** Refetch balance */
|
|
528
|
+
refetch: () => Promise<void>;
|
|
529
|
+
/** Last updated timestamp */
|
|
530
|
+
lastUpdated: Date | null;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Hook for fetching wallet balance (SOL and tokens).
|
|
534
|
+
*
|
|
535
|
+
* @example Basic usage
|
|
536
|
+
* ```tsx
|
|
537
|
+
* function Balance() {
|
|
538
|
+
* const { solBalance, formattedSol, isLoading } = useBalance();
|
|
539
|
+
*
|
|
540
|
+
* if (isLoading) return <div>Loading...</div>;
|
|
541
|
+
* return <div>{formattedSol}</div>;
|
|
542
|
+
* }
|
|
543
|
+
* ```
|
|
544
|
+
*
|
|
545
|
+
* @example With token balances
|
|
546
|
+
* ```tsx
|
|
547
|
+
* function TokenBalances() {
|
|
548
|
+
* const { tokens, isLoading } = useBalance();
|
|
549
|
+
*
|
|
550
|
+
* return (
|
|
551
|
+
* <div>
|
|
552
|
+
* {tokens.map(token => (
|
|
553
|
+
* <div key={token.mint}>
|
|
554
|
+
* {token.symbol}: {token.formatted}
|
|
555
|
+
* </div>
|
|
556
|
+
* ))}
|
|
557
|
+
* </div>
|
|
558
|
+
* );
|
|
559
|
+
* }
|
|
560
|
+
* ```
|
|
561
|
+
*/
|
|
562
|
+
declare function useBalance(): UseBalanceReturn;
|
|
563
|
+
|
|
564
|
+
interface TransactionInfo {
|
|
565
|
+
/** Transaction signature */
|
|
566
|
+
signature: string;
|
|
567
|
+
/** Block time (unix timestamp) */
|
|
568
|
+
blockTime: number | null;
|
|
569
|
+
/** Slot number */
|
|
570
|
+
slot: number;
|
|
571
|
+
/** Transaction status */
|
|
572
|
+
status: 'success' | 'failed';
|
|
573
|
+
/** Error message if failed */
|
|
574
|
+
error?: string;
|
|
575
|
+
/** Transaction type (if detected) */
|
|
576
|
+
type: 'sent' | 'received' | 'swap' | 'nft' | 'stake' | 'program' | 'unknown';
|
|
577
|
+
/** Direction for transfers */
|
|
578
|
+
direction?: 'in' | 'out';
|
|
579
|
+
/** Amount in SOL (for transfers) */
|
|
580
|
+
amount?: number;
|
|
581
|
+
/** Formatted amount string */
|
|
582
|
+
formattedAmount?: string;
|
|
583
|
+
/** Token mint address (for token transfers) */
|
|
584
|
+
tokenMint?: string;
|
|
585
|
+
/** Token symbol (if known) */
|
|
586
|
+
tokenSymbol?: string;
|
|
587
|
+
/** Token icon URL (if known) */
|
|
588
|
+
tokenIcon?: string;
|
|
589
|
+
/** Counterparty address (who you sent to or received from) */
|
|
590
|
+
counterparty?: string;
|
|
591
|
+
/** Formatted date string */
|
|
592
|
+
formattedDate: string;
|
|
593
|
+
/** Formatted time string */
|
|
594
|
+
formattedTime: string;
|
|
595
|
+
/** Explorer URL */
|
|
596
|
+
explorerUrl: string;
|
|
597
|
+
}
|
|
598
|
+
interface UseTransactionsOptions {
|
|
599
|
+
/** Number of transactions to fetch */
|
|
600
|
+
limit?: number;
|
|
601
|
+
/** Whether to auto-refresh */
|
|
602
|
+
autoRefresh?: boolean;
|
|
603
|
+
/** Refresh interval in milliseconds */
|
|
604
|
+
refreshInterval?: number;
|
|
605
|
+
/** Fetch full transaction details (slower but more info) */
|
|
606
|
+
fetchDetails?: boolean;
|
|
607
|
+
}
|
|
608
|
+
interface UseTransactionsReturn {
|
|
609
|
+
/** List of transactions */
|
|
610
|
+
transactions: TransactionInfo[];
|
|
611
|
+
/** Whether transactions are loading */
|
|
612
|
+
isLoading: boolean;
|
|
613
|
+
/** Error if fetch failed */
|
|
614
|
+
error: Error | null;
|
|
615
|
+
/** Whether there are more transactions to load */
|
|
616
|
+
hasMore: boolean;
|
|
617
|
+
/** Load more transactions */
|
|
618
|
+
loadMore: () => Promise<void>;
|
|
619
|
+
/** Refetch transactions */
|
|
620
|
+
refetch: () => Promise<void>;
|
|
621
|
+
/** Last updated timestamp */
|
|
622
|
+
lastUpdated: Date | null;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Hook for fetching wallet transaction history.
|
|
626
|
+
* Parses transactions to detect type (sent/received/swap) and amounts.
|
|
627
|
+
*
|
|
628
|
+
* @example Basic usage
|
|
629
|
+
* ```tsx
|
|
630
|
+
* function TransactionList() {
|
|
631
|
+
* const { transactions, isLoading } = useTransactions({ limit: 10 });
|
|
632
|
+
*
|
|
633
|
+
* if (isLoading) return <div>Loading...</div>;
|
|
634
|
+
*
|
|
635
|
+
* return (
|
|
636
|
+
* <div>
|
|
637
|
+
* {transactions.map(tx => (
|
|
638
|
+
* <div key={tx.signature}>
|
|
639
|
+
* {tx.type} {tx.formattedAmount} - {tx.formattedDate}
|
|
640
|
+
* </div>
|
|
641
|
+
* ))}
|
|
642
|
+
* </div>
|
|
643
|
+
* );
|
|
644
|
+
* }
|
|
645
|
+
* ```
|
|
646
|
+
*/
|
|
647
|
+
declare function useTransactions(options?: UseTransactionsOptions): UseTransactionsReturn;
|
|
648
|
+
|
|
649
|
+
interface Token {
|
|
650
|
+
/** Token mint address */
|
|
651
|
+
mint: string;
|
|
652
|
+
/** Token account address */
|
|
653
|
+
tokenAccount: string;
|
|
654
|
+
/** Token balance (in smallest unit) */
|
|
655
|
+
amount: bigint;
|
|
656
|
+
/** Token decimals */
|
|
657
|
+
decimals: number;
|
|
658
|
+
/** Formatted balance (human readable) */
|
|
659
|
+
formatted: string;
|
|
660
|
+
/** Token symbol if known */
|
|
661
|
+
symbol?: string;
|
|
662
|
+
/** Token name if known */
|
|
663
|
+
name?: string;
|
|
664
|
+
/** Token logo URL if known */
|
|
665
|
+
logo?: string;
|
|
666
|
+
/** USD price if available */
|
|
667
|
+
usdPrice?: number;
|
|
668
|
+
/** Formatted USD value */
|
|
669
|
+
formattedUsd?: string;
|
|
670
|
+
/** Whether token is frozen */
|
|
671
|
+
isFrozen: boolean;
|
|
672
|
+
/** Owner address */
|
|
673
|
+
owner: string;
|
|
674
|
+
}
|
|
675
|
+
interface UseTokensOptions {
|
|
676
|
+
/** Whether to include zero balance tokens */
|
|
677
|
+
includeZeroBalance?: boolean;
|
|
678
|
+
/** Whether to auto-refresh */
|
|
679
|
+
autoRefresh?: boolean;
|
|
680
|
+
/** Refresh interval in milliseconds */
|
|
681
|
+
refreshInterval?: number;
|
|
682
|
+
/** Fetch metadata (name, symbol, logo) from Jupiter */
|
|
683
|
+
fetchMetadata?: boolean;
|
|
684
|
+
/** Include native SOL balance */
|
|
685
|
+
includeNativeSol?: boolean;
|
|
686
|
+
}
|
|
687
|
+
interface UseTokensReturn {
|
|
688
|
+
/** List of tokens */
|
|
689
|
+
tokens: Token[];
|
|
690
|
+
/** Whether tokens are loading */
|
|
691
|
+
isLoading: boolean;
|
|
692
|
+
/** Error if fetch failed */
|
|
693
|
+
error: Error | null;
|
|
694
|
+
/** Refetch tokens */
|
|
695
|
+
refetch: () => Promise<void>;
|
|
696
|
+
/** Last updated timestamp */
|
|
697
|
+
lastUpdated: Date | null;
|
|
698
|
+
/** Total number of token accounts */
|
|
699
|
+
totalAccounts: number;
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Hook for fetching wallet token holdings.
|
|
703
|
+
* Fetches metadata (name, symbol, icon, USD price) from Jupiter's API.
|
|
704
|
+
*
|
|
705
|
+
* @example Basic usage
|
|
706
|
+
* ```tsx
|
|
707
|
+
* function TokenList() {
|
|
708
|
+
* const { tokens, isLoading } = useTokens();
|
|
709
|
+
*
|
|
710
|
+
* if (isLoading) return <div>Loading...</div>;
|
|
711
|
+
*
|
|
712
|
+
* return (
|
|
713
|
+
* <div>
|
|
714
|
+
* {tokens.map(token => (
|
|
715
|
+
* <div key={token.mint}>
|
|
716
|
+
* <img src={token.logo} />
|
|
717
|
+
* {token.symbol}: {token.formatted}
|
|
718
|
+
* {token.formattedUsd && <span>({token.formattedUsd})</span>}
|
|
719
|
+
* </div>
|
|
720
|
+
* ))}
|
|
721
|
+
* </div>
|
|
722
|
+
* );
|
|
723
|
+
* }
|
|
724
|
+
* ```
|
|
725
|
+
*/
|
|
726
|
+
declare function useTokens(options?: UseTokensOptions): UseTokensReturn;
|
|
727
|
+
|
|
728
|
+
interface DisconnectElementProps {
|
|
729
|
+
/** Display variant */
|
|
730
|
+
variant?: 'button' | 'menuitem' | 'link';
|
|
731
|
+
/** Custom className */
|
|
732
|
+
className?: string;
|
|
733
|
+
/** Custom label */
|
|
734
|
+
label?: string;
|
|
735
|
+
/** Custom icon (render function) */
|
|
736
|
+
icon?: ReactNode;
|
|
737
|
+
/** Show icon */
|
|
738
|
+
showIcon?: boolean;
|
|
739
|
+
/** Callback after disconnect */
|
|
740
|
+
onDisconnect?: () => void;
|
|
741
|
+
/** Custom render function for full control */
|
|
742
|
+
render?: (props: {
|
|
743
|
+
disconnect: () => Promise<void>;
|
|
744
|
+
disconnecting: boolean;
|
|
745
|
+
}) => ReactNode;
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* Element for disconnecting the current wallet.
|
|
749
|
+
*
|
|
750
|
+
* @example Basic usage
|
|
751
|
+
* ```tsx
|
|
752
|
+
* <DisconnectElement />
|
|
753
|
+
* ```
|
|
754
|
+
*
|
|
755
|
+
* @example Button variant
|
|
756
|
+
* ```tsx
|
|
757
|
+
* <DisconnectElement variant="button" />
|
|
758
|
+
* ```
|
|
759
|
+
*
|
|
760
|
+
* @example Custom render
|
|
761
|
+
* ```tsx
|
|
762
|
+
* <DisconnectElement
|
|
763
|
+
* render={({ disconnect }) => (
|
|
764
|
+
* <DropdownMenuItem onClick={disconnect}>
|
|
765
|
+
* <LogOut className="mr-2 h-4 w-4" />
|
|
766
|
+
* Sign Out
|
|
767
|
+
* </DropdownMenuItem>
|
|
768
|
+
* )}
|
|
769
|
+
* />
|
|
770
|
+
* ```
|
|
771
|
+
*/
|
|
772
|
+
declare function DisconnectElement({ variant, className, label, icon, showIcon, onDisconnect, render, }: DisconnectElementProps): react_jsx_runtime.JSX.Element;
|
|
773
|
+
declare namespace DisconnectElement {
|
|
774
|
+
var displayName: string;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
interface AccountElementRenderProps {
|
|
778
|
+
address: string | null;
|
|
779
|
+
formatted: string;
|
|
780
|
+
walletName: string | null;
|
|
781
|
+
walletIcon: string | null;
|
|
782
|
+
copy: () => Promise<{
|
|
783
|
+
success: boolean;
|
|
784
|
+
}>;
|
|
785
|
+
copied: boolean;
|
|
786
|
+
}
|
|
787
|
+
interface AccountElementProps {
|
|
788
|
+
/** Show wallet avatar/icon */
|
|
789
|
+
showAvatar?: boolean;
|
|
790
|
+
/** Show copy button */
|
|
791
|
+
showCopy?: boolean;
|
|
792
|
+
/** Show full address instead of truncated */
|
|
793
|
+
showFullAddress?: boolean;
|
|
794
|
+
/** Custom className */
|
|
795
|
+
className?: string;
|
|
796
|
+
/** Custom avatar size (in pixels) */
|
|
797
|
+
avatarSize?: number;
|
|
798
|
+
/** Layout variant */
|
|
799
|
+
variant?: 'compact' | 'expanded' | 'inline';
|
|
800
|
+
/** Custom render function for full control */
|
|
801
|
+
render?: (props: AccountElementRenderProps) => ReactNode;
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Element for displaying connected account information.
|
|
805
|
+
*
|
|
806
|
+
* @example Basic usage
|
|
807
|
+
* ```tsx
|
|
808
|
+
* <AccountElement />
|
|
809
|
+
* ```
|
|
810
|
+
*
|
|
811
|
+
* @example With full address
|
|
812
|
+
* ```tsx
|
|
813
|
+
* <AccountElement showFullAddress />
|
|
814
|
+
* ```
|
|
815
|
+
*
|
|
816
|
+
* @example Custom render
|
|
817
|
+
* ```tsx
|
|
818
|
+
* <AccountElement
|
|
819
|
+
* render={({ formatted, walletIcon, copy, copied }) => (
|
|
820
|
+
* <DropdownMenuLabel>
|
|
821
|
+
* <img src={walletIcon} className="w-5 h-5" />
|
|
822
|
+
* <button onClick={copy}>
|
|
823
|
+
* {copied ? 'Copied!' : formatted}
|
|
824
|
+
* </button>
|
|
825
|
+
* </DropdownMenuLabel>
|
|
826
|
+
* )}
|
|
827
|
+
* />
|
|
828
|
+
* ```
|
|
829
|
+
*/
|
|
830
|
+
declare function AccountElement({ showAvatar, showCopy, showFullAddress, className, avatarSize, variant, render, }: AccountElementProps): react_jsx_runtime.JSX.Element | null;
|
|
831
|
+
declare namespace AccountElement {
|
|
832
|
+
var displayName: string;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
interface ClusterElementRenderProps {
|
|
836
|
+
cluster: SolanaCluster | null;
|
|
837
|
+
clusters: SolanaCluster[];
|
|
838
|
+
setCluster: (id: SolanaClusterId) => Promise<void>;
|
|
839
|
+
isMainnet: boolean;
|
|
840
|
+
isDevnet: boolean;
|
|
841
|
+
isTestnet: boolean;
|
|
842
|
+
isLocal: boolean;
|
|
843
|
+
}
|
|
844
|
+
interface ClusterElementProps {
|
|
845
|
+
/** Display variant */
|
|
846
|
+
variant?: 'badge' | 'select' | 'menuitem';
|
|
847
|
+
/** Custom className */
|
|
848
|
+
className?: string;
|
|
849
|
+
/** Whether the cluster can be changed */
|
|
850
|
+
allowChange?: boolean;
|
|
851
|
+
/** Show cluster icon/indicator */
|
|
852
|
+
showIndicator?: boolean;
|
|
853
|
+
/** Custom cluster labels */
|
|
854
|
+
labels?: Partial<Record<string, string>>;
|
|
855
|
+
/** Custom render function for full control */
|
|
856
|
+
render?: (props: ClusterElementRenderProps) => ReactNode;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Element for displaying and optionally changing the current cluster/network.
|
|
860
|
+
*
|
|
861
|
+
* @example Badge (read-only)
|
|
862
|
+
* ```tsx
|
|
863
|
+
* <ClusterElement variant="badge" />
|
|
864
|
+
* ```
|
|
865
|
+
*
|
|
866
|
+
* @example Select (changeable)
|
|
867
|
+
* ```tsx
|
|
868
|
+
* <ClusterElement variant="select" allowChange />
|
|
869
|
+
* ```
|
|
870
|
+
*
|
|
871
|
+
* @example Custom render
|
|
872
|
+
* ```tsx
|
|
873
|
+
* <ClusterElement
|
|
874
|
+
* render={({ cluster, clusters, setCluster }) => (
|
|
875
|
+
* <Select value={cluster?.id} onValueChange={setCluster}>
|
|
876
|
+
* {clusters.map(c => (
|
|
877
|
+
* <SelectItem key={c.id} value={c.id}>
|
|
878
|
+
* {c.label}
|
|
879
|
+
* </SelectItem>
|
|
880
|
+
* ))}
|
|
881
|
+
* </Select>
|
|
882
|
+
* )}
|
|
883
|
+
* />
|
|
884
|
+
* ```
|
|
885
|
+
*/
|
|
886
|
+
declare function ClusterElement({ variant, className, allowChange, showIndicator, labels, render, }: ClusterElementProps): react_jsx_runtime.JSX.Element | null;
|
|
887
|
+
declare namespace ClusterElement {
|
|
888
|
+
var displayName: string;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
interface WalletListElementRenderProps {
|
|
892
|
+
wallets: WalletDisplayInfo[];
|
|
893
|
+
installedWallets: WalletDisplayInfo[];
|
|
894
|
+
select: (walletName: string) => Promise<void>;
|
|
895
|
+
connecting: boolean;
|
|
896
|
+
}
|
|
897
|
+
interface WalletListElementWalletProps {
|
|
898
|
+
wallet: WalletDisplayInfo;
|
|
899
|
+
select: () => Promise<void>;
|
|
900
|
+
connecting: boolean;
|
|
901
|
+
}
|
|
902
|
+
interface WalletListElementProps {
|
|
903
|
+
/** Filter to only show installed wallets */
|
|
904
|
+
installedOnly?: boolean;
|
|
905
|
+
/** Custom className */
|
|
906
|
+
className?: string;
|
|
907
|
+
/** Layout variant */
|
|
908
|
+
variant?: 'list' | 'grid' | 'compact';
|
|
909
|
+
/** Show wallet status badge */
|
|
910
|
+
showStatus?: boolean;
|
|
911
|
+
/** Callback when a wallet is selected */
|
|
912
|
+
onSelect?: (walletName: string) => void;
|
|
913
|
+
/** Custom render function for full control */
|
|
914
|
+
render?: (props: WalletListElementRenderProps) => ReactNode;
|
|
915
|
+
/** Custom render function for individual wallet items */
|
|
916
|
+
renderWallet?: (props: WalletListElementWalletProps) => ReactNode;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Element for displaying available wallets and selecting one to connect.
|
|
920
|
+
*
|
|
921
|
+
* @example Basic usage
|
|
922
|
+
* ```tsx
|
|
923
|
+
* <WalletListElement />
|
|
924
|
+
* ```
|
|
925
|
+
*
|
|
926
|
+
* @example Installed wallets only (most common)
|
|
927
|
+
* ```tsx
|
|
928
|
+
* <WalletListElement installedOnly />
|
|
929
|
+
* ```
|
|
930
|
+
*
|
|
931
|
+
* @example Grid layout
|
|
932
|
+
* ```tsx
|
|
933
|
+
* <WalletListElement variant="grid" installedOnly />
|
|
934
|
+
* ```
|
|
935
|
+
*
|
|
936
|
+
* @example With custom wallet render
|
|
937
|
+
* ```tsx
|
|
938
|
+
* <WalletListElement
|
|
939
|
+
* installedOnly
|
|
940
|
+
* renderWallet={({ wallet, select }) => (
|
|
941
|
+
* <Button key={wallet.name} onClick={select}>
|
|
942
|
+
* <img src={wallet.icon} alt={wallet.name} />
|
|
943
|
+
* {wallet.name}
|
|
944
|
+
* </Button>
|
|
945
|
+
* )}
|
|
946
|
+
* />
|
|
947
|
+
* ```
|
|
948
|
+
*
|
|
949
|
+
* @example Full custom render
|
|
950
|
+
* ```tsx
|
|
951
|
+
* <WalletListElement
|
|
952
|
+
* render={({ installedWallets, select, connecting }) => (
|
|
953
|
+
* <div className="grid grid-cols-2 gap-2">
|
|
954
|
+
* {installedWallets.map(w => (
|
|
955
|
+
* <button key={w.name} onClick={() => select(w.name)} disabled={connecting}>
|
|
956
|
+
* {w.name}
|
|
957
|
+
* </button>
|
|
958
|
+
* ))}
|
|
959
|
+
* </div>
|
|
960
|
+
* )}
|
|
961
|
+
* />
|
|
962
|
+
* ```
|
|
963
|
+
*/
|
|
964
|
+
declare function WalletListElement({ installedOnly, className, variant, showStatus, onSelect, render, renderWallet, }: WalletListElementProps): react_jsx_runtime.JSX.Element;
|
|
965
|
+
declare namespace WalletListElement {
|
|
966
|
+
var displayName: string;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
interface BalanceElementRenderProps {
|
|
970
|
+
solBalance: number;
|
|
971
|
+
formattedSol: string;
|
|
972
|
+
tokens: TokenBalance[];
|
|
973
|
+
isLoading: boolean;
|
|
974
|
+
error: Error | null;
|
|
975
|
+
refetch: () => Promise<void>;
|
|
976
|
+
}
|
|
977
|
+
interface BalanceElementProps {
|
|
978
|
+
/** Show SOL balance */
|
|
979
|
+
showSol?: boolean;
|
|
980
|
+
/** Show token balances */
|
|
981
|
+
showTokens?: boolean;
|
|
982
|
+
/** Maximum number of tokens to display */
|
|
983
|
+
tokenCount?: number;
|
|
984
|
+
/** Custom className */
|
|
985
|
+
className?: string;
|
|
986
|
+
/** Display variant */
|
|
987
|
+
variant?: 'compact' | 'expanded' | 'inline';
|
|
988
|
+
/** Show refresh button */
|
|
989
|
+
showRefresh?: boolean;
|
|
990
|
+
/** Show loading skeleton */
|
|
991
|
+
showSkeleton?: boolean;
|
|
992
|
+
/** Custom render function for full control */
|
|
993
|
+
render?: (props: BalanceElementRenderProps) => ReactNode;
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Element for displaying wallet balance (SOL and tokens).
|
|
997
|
+
*
|
|
998
|
+
* @example Basic usage
|
|
999
|
+
* ```tsx
|
|
1000
|
+
* <BalanceElement />
|
|
1001
|
+
* ```
|
|
1002
|
+
*
|
|
1003
|
+
* @example With tokens
|
|
1004
|
+
* ```tsx
|
|
1005
|
+
* <BalanceElement showTokens tokenCount={5} />
|
|
1006
|
+
* ```
|
|
1007
|
+
*
|
|
1008
|
+
* @example Custom render
|
|
1009
|
+
* ```tsx
|
|
1010
|
+
* <BalanceElement
|
|
1011
|
+
* render={({ formattedSol, isLoading }) => (
|
|
1012
|
+
* <div className="text-2xl font-bold">
|
|
1013
|
+
* {isLoading ? 'Loading...' : formattedSol}
|
|
1014
|
+
* </div>
|
|
1015
|
+
* )}
|
|
1016
|
+
* />
|
|
1017
|
+
* ```
|
|
1018
|
+
*/
|
|
1019
|
+
declare function BalanceElement({ showSol, showTokens, tokenCount, className, variant, showRefresh, showSkeleton, render, }: BalanceElementProps): react_jsx_runtime.JSX.Element;
|
|
1020
|
+
declare namespace BalanceElement {
|
|
1021
|
+
var displayName: string;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
interface TransactionHistoryElementRenderProps {
|
|
1025
|
+
transactions: TransactionInfo[];
|
|
1026
|
+
isLoading: boolean;
|
|
1027
|
+
error: Error | null;
|
|
1028
|
+
hasMore: boolean;
|
|
1029
|
+
loadMore: () => Promise<void>;
|
|
1030
|
+
refetch: () => Promise<void>;
|
|
1031
|
+
}
|
|
1032
|
+
interface TransactionHistoryElementProps {
|
|
1033
|
+
/** Number of transactions to display */
|
|
1034
|
+
limit?: number;
|
|
1035
|
+
/** Show transaction status */
|
|
1036
|
+
showStatus?: boolean;
|
|
1037
|
+
/** Show transaction time */
|
|
1038
|
+
showTime?: boolean;
|
|
1039
|
+
/** Custom className */
|
|
1040
|
+
className?: string;
|
|
1041
|
+
/** Display variant */
|
|
1042
|
+
variant?: 'compact' | 'expanded' | 'list';
|
|
1043
|
+
/** Show load more button */
|
|
1044
|
+
showLoadMore?: boolean;
|
|
1045
|
+
/** Show skeleton while loading */
|
|
1046
|
+
showSkeleton?: boolean;
|
|
1047
|
+
/** Custom render function for full control */
|
|
1048
|
+
render?: (props: TransactionHistoryElementRenderProps) => ReactNode;
|
|
1049
|
+
/** Custom render for individual transaction item */
|
|
1050
|
+
renderItem?: (transaction: TransactionInfo) => ReactNode;
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Element for displaying recent transaction history.
|
|
1054
|
+
*
|
|
1055
|
+
* @example Basic usage
|
|
1056
|
+
* ```tsx
|
|
1057
|
+
* <TransactionHistoryElement limit={5} />
|
|
1058
|
+
* ```
|
|
1059
|
+
*
|
|
1060
|
+
* @example With load more
|
|
1061
|
+
* ```tsx
|
|
1062
|
+
* <TransactionHistoryElement limit={10} showLoadMore />
|
|
1063
|
+
* ```
|
|
1064
|
+
*
|
|
1065
|
+
* @example Custom item render
|
|
1066
|
+
* ```tsx
|
|
1067
|
+
* <TransactionHistoryElement
|
|
1068
|
+
* renderItem={(tx) => (
|
|
1069
|
+
* <a href={tx.explorerUrl} target="_blank">
|
|
1070
|
+
* {tx.signature.slice(0, 8)}... - {tx.status}
|
|
1071
|
+
* </a>
|
|
1072
|
+
* )}
|
|
1073
|
+
* />
|
|
1074
|
+
* ```
|
|
1075
|
+
*/
|
|
1076
|
+
declare function TransactionHistoryElement({ limit, showStatus, showTime, className, variant, showLoadMore, showSkeleton, render, renderItem, }: TransactionHistoryElementProps): react_jsx_runtime.JSX.Element;
|
|
1077
|
+
declare namespace TransactionHistoryElement {
|
|
1078
|
+
var displayName: string;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
interface TokenListElementRenderProps {
|
|
1082
|
+
tokens: Token[];
|
|
1083
|
+
isLoading: boolean;
|
|
1084
|
+
error: Error | null;
|
|
1085
|
+
refetch: () => Promise<void>;
|
|
1086
|
+
totalAccounts: number;
|
|
1087
|
+
}
|
|
1088
|
+
interface TokenListElementProps {
|
|
1089
|
+
/** Maximum number of tokens to display */
|
|
1090
|
+
limit?: number;
|
|
1091
|
+
/** Show USD value (requires price API integration) */
|
|
1092
|
+
showValue?: boolean;
|
|
1093
|
+
/** Custom className */
|
|
1094
|
+
className?: string;
|
|
1095
|
+
/** Display variant */
|
|
1096
|
+
variant?: 'compact' | 'expanded' | 'grid';
|
|
1097
|
+
/** Show refresh button */
|
|
1098
|
+
showRefresh?: boolean;
|
|
1099
|
+
/** Show skeleton while loading */
|
|
1100
|
+
showSkeleton?: boolean;
|
|
1101
|
+
/** Custom render function for full control */
|
|
1102
|
+
render?: (props: TokenListElementRenderProps) => ReactNode;
|
|
1103
|
+
/** Custom render for individual token item */
|
|
1104
|
+
renderItem?: (token: Token) => ReactNode;
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Element for displaying token holdings.
|
|
1108
|
+
*
|
|
1109
|
+
* @example Basic usage
|
|
1110
|
+
* ```tsx
|
|
1111
|
+
* <TokenListElement limit={10} />
|
|
1112
|
+
* ```
|
|
1113
|
+
*
|
|
1114
|
+
* @example Grid layout
|
|
1115
|
+
* ```tsx
|
|
1116
|
+
* <TokenListElement variant="grid" limit={6} />
|
|
1117
|
+
* ```
|
|
1118
|
+
*
|
|
1119
|
+
* @example Custom item render
|
|
1120
|
+
* ```tsx
|
|
1121
|
+
* <TokenListElement
|
|
1122
|
+
* renderItem={(token) => (
|
|
1123
|
+
* <div className="token-card">
|
|
1124
|
+
* <img src={token.logo} alt={token.symbol} />
|
|
1125
|
+
* <span>{token.formatted}</span>
|
|
1126
|
+
* </div>
|
|
1127
|
+
* )}
|
|
1128
|
+
* />
|
|
1129
|
+
* ```
|
|
1130
|
+
*/
|
|
1131
|
+
declare function TokenListElement({ limit, showValue, className, variant, showRefresh, showSkeleton, render, renderItem, }: TokenListElementProps): react_jsx_runtime.JSX.Element;
|
|
1132
|
+
declare namespace TokenListElement {
|
|
1133
|
+
var displayName: string;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
export { AccountElement, type AccountElementProps, type AccountElementRenderProps, AccountInfo, UnifiedProvider as AppProvider, BalanceElement, type BalanceElementProps, type BalanceElementRenderProps, ClusterElement, type ClusterElementProps, type ClusterElementRenderProps, ClusterType, ConnectorConfig, DisconnectElement, type DisconnectElementProps, MobileWalletAdapterConfig, type Token, type TokenBalance, TokenListElement, type TokenListElementProps, type TokenListElementRenderProps, TransactionHistoryElement, type TransactionHistoryElementProps, type TransactionHistoryElementRenderProps, type TransactionInfo, type TransactionPrepareOptions, UnifiedConfig, UnifiedProvider, type UnifiedProviderProps, type UseAccountReturn, type UseBalanceReturn, type UseClusterReturn, type UseGillSolanaClientReturn, type UseGillTransactionSignerReturn, type UseKitTransactionSignerReturn, type UseSolanaClientReturn, type UseTokensOptions, type UseTokensReturn, type UseTransactionPreparerReturn, type UseTransactionSignerReturn, type UseTransactionsOptions, type UseTransactionsReturn, type UseWalletInfoReturn, WalletListElement, type WalletListElementProps, type WalletListElementRenderProps, type WalletListElementWalletProps, useAccount, useBalance, useCluster, useGillSolanaClient, useGillTransactionSigner, useKitTransactionSigner, useSolanaClient, useTokens, useTransactionPreparer, useTransactionSigner, useTransactions, useWalletInfo };
|