@tuwaio/nova-connect 0.6.0 → 0.7.0
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 +93 -155
- package/dist/chunk-3LWAAUG4.js +1 -0
- package/dist/chunk-6EDQ7JRZ.js +1 -0
- package/dist/chunk-AGE6EFTV.js +1 -0
- package/dist/chunk-ENXSDTRV.js +2 -0
- package/dist/chunk-Q4FCNEIJ.cjs +2 -0
- package/dist/chunk-R5V3K52O.cjs +1 -0
- package/dist/chunk-YJRNNNR6.cjs +1 -0
- package/dist/chunk-ZVUCC2QP.cjs +1 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.cts +5140 -2914
- package/dist/components/index.d.ts +5140 -2914
- package/dist/components/index.js +1 -1
- package/dist/evm/index.cjs +1 -1
- package/dist/evm/index.d.cts +15 -9
- package/dist/evm/index.d.ts +15 -9
- package/dist/evm/index.js +1 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.cts +76 -51
- package/dist/hooks/index.d.ts +76 -51
- package/dist/hooks/index.js +1 -1
- package/dist/i18n/index.cjs +1 -1
- package/dist/i18n/index.d.cts +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +0 -22
- package/dist/index.d.cts +271 -879
- package/dist/index.d.ts +271 -879
- package/dist/index.js +1 -1
- package/dist/satellite/index.cjs +1 -1
- package/dist/satellite/index.d.cts +1 -1
- package/dist/satellite/index.d.ts +1 -1
- package/dist/satellite/index.js +1 -1
- package/dist/solana/index.cjs +1 -1
- package/dist/solana/index.d.cts +16 -9
- package/dist/solana/index.d.ts +16 -9
- package/dist/solana/index.js +1 -1
- package/dist/types-CnOiSyvZ.d.cts +400 -0
- package/dist/types-CnOiSyvZ.d.ts +400 -0
- package/dist/useWalletNativeBalance-CPK-PoXG.d.ts +918 -0
- package/dist/useWalletNativeBalance-DMPPRldX.d.cts +918 -0
- package/package.json +28 -68
- package/dist/chunk-5MOVHUHI.js +0 -2
- package/dist/chunk-7K4ENNWO.cjs +0 -2
- package/dist/chunk-7TYZT7ZD.cjs +0 -1
- package/dist/chunk-ARBYH7CW.js +0 -1
- package/dist/chunk-K44IHM6B.cjs +0 -1
- package/dist/chunk-MGBN4EIT.cjs +0 -1
- package/dist/chunk-NQ5AECZQ.js +0 -1
- package/dist/chunk-S3IRVZMG.js +0 -1
- package/dist/evm-DUQXCW22.js +0 -1
- package/dist/evm-KSA7PJIK.cjs +0 -1
- package/dist/getChainsListByConnectorType-QCNOPM6I.cjs +0 -1
- package/dist/getChainsListByConnectorType-YZZUYC6D.js +0 -1
- package/dist/solana-CVUSQUPL.cjs +0 -1
- package/dist/solana-GDE2KIT6.js +0 -1
- package/dist/types-DxUn8qmU.d.cts +0 -108
- package/dist/types-DxUn8qmU.d.ts +0 -108
- package/dist/useWalletNativeBalance-BuiJip3d.d.cts +0 -743
- package/dist/useWalletNativeBalance-DrgdoQa-.d.ts +0 -743
- /package/dist/{chunk-V6XDFRWV.cjs → chunk-EGATOYHY.cjs} +0 -0
- /package/dist/{chunk-EYP534IS.js → chunk-ZVADGOGQ.js} +0 -0
|
@@ -1,743 +0,0 @@
|
|
|
1
|
-
import * as React$1 from 'react';
|
|
2
|
-
import React__default, { ComponentPropsWithoutRef, ComponentType, ReactNode } from 'react';
|
|
3
|
-
import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
4
|
-
import { TransactionPool, Transaction, TxAdapter } from '@tuwaio/pulsar-core';
|
|
5
|
-
import { N as NovaConnectLabels } from './types-DxUn8qmU.cjs';
|
|
6
|
-
import { SatelliteSiwxFieldOptions, UseSiwxSignInOptions } from '@tuwaio/siwx-react';
|
|
7
|
-
import { Variants, Easing } from 'framer-motion';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @description
|
|
11
|
-
* This interface provides default fallback types for chain configurations.
|
|
12
|
-
* Chain-specific packages will use module augmentation to override these
|
|
13
|
-
* with more specific types while maintaining backward compatibility.
|
|
14
|
-
*
|
|
15
|
-
* Default values are `any` to ensure the system works without specific
|
|
16
|
-
* chain packages, but gets enhanced type safety when they are installed.
|
|
17
|
-
*/
|
|
18
|
-
interface AllChainConfigs {
|
|
19
|
-
/**
|
|
20
|
-
* App chains configuration - defaults to any, gets enhanced by chain-specific packages
|
|
21
|
-
* @default any - Will be typed as `readonly [Chain, ...Chain[]]` when viem is available
|
|
22
|
-
*/
|
|
23
|
-
appChains?: any;
|
|
24
|
-
/**
|
|
25
|
-
* Solana RPC URLs configuration - defaults to any, gets enhanced by Solana packages
|
|
26
|
-
* @default any - Will be typed as `Partial<Record<SolanaClusterMoniker, string>>` when @tuwaio/orbit-solana is available
|
|
27
|
-
*/
|
|
28
|
-
solanaRPCUrls?: any;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Union type for all supported chain configurations.
|
|
32
|
-
* Gets automatically extended when packages augment AllChainConfigs.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* // Without specific packages - uses any types
|
|
37
|
-
* const config: InitialChains = {
|
|
38
|
-
* appChains: [], // any
|
|
39
|
-
* solanaRPCUrls: {} // any
|
|
40
|
-
* }
|
|
41
|
-
*
|
|
42
|
-
* // With viem package installed - gets proper Chain[] typing
|
|
43
|
-
* // With @tuwaio/orbit-solana package installed - gets proper SolanaClusterMoniker typing
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
type InitialChains = AllChainConfigs;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @file ConnectedModalTxHistory component with comprehensive customization options for transaction history display.
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Local mirror of TxInMemoryPagination from @tuwaio/pulsar-core.
|
|
54
|
-
* Defined inline because pulsar-core is an optional peer dependency in nova-connect.
|
|
55
|
-
*/
|
|
56
|
-
type LocalTxPagination = {
|
|
57
|
-
/** Indicates whether the store is currently loading transaction history. */
|
|
58
|
-
isLoading: boolean;
|
|
59
|
-
/** Indicates whether the last loading request ended with an error. */
|
|
60
|
-
isError: boolean;
|
|
61
|
-
/** Indicates whether more history pages are available. */
|
|
62
|
-
hasMore: boolean;
|
|
63
|
-
/** The current page number in the paginated history. */
|
|
64
|
-
currentPage: number;
|
|
65
|
-
/** Loads the next page of transaction history and appends it to the pool. */
|
|
66
|
-
fetchNextPage: (walletAddress: string) => Promise<void>;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Local customization options for TransactionsHistory component.
|
|
70
|
-
* This is a copy of the type from @tuwaio/nova-transactions to avoid
|
|
71
|
-
* breaking dynamic import logic.
|
|
72
|
-
*/
|
|
73
|
-
type LocalTransactionsHistoryCustomization = {
|
|
74
|
-
/** Custom title for the transactions history section */
|
|
75
|
-
title?: string;
|
|
76
|
-
/** Custom class name generators */
|
|
77
|
-
classNames?: {
|
|
78
|
-
/** Classes for the outer container */
|
|
79
|
-
container?: string;
|
|
80
|
-
/** Classes for the title element */
|
|
81
|
-
titleText?: string;
|
|
82
|
-
/** Classes for the list wrapper container */
|
|
83
|
-
listWrapper?: string;
|
|
84
|
-
/** Classes for the placeholder container */
|
|
85
|
-
placeholderContainer?: string;
|
|
86
|
-
/** Classes for the placeholder title */
|
|
87
|
-
placeholderTitle?: string;
|
|
88
|
-
/** Classes for the placeholder message */
|
|
89
|
-
placeholderMessage?: string;
|
|
90
|
-
/** Classes for the infinite scroll loader container */
|
|
91
|
-
loaderContainer?: string;
|
|
92
|
-
/** Classes for the infinite scroll loader icon (spinner) */
|
|
93
|
-
loaderIcon?: string;
|
|
94
|
-
/** Classes for the error indicator container */
|
|
95
|
-
errorContainer?: string;
|
|
96
|
-
/** Classes for the error indicator icon */
|
|
97
|
-
errorIcon?: string;
|
|
98
|
-
/** Classes for individual transaction item container */
|
|
99
|
-
itemContainer?: string;
|
|
100
|
-
/** Classes for the icon wrapper */
|
|
101
|
-
itemIconWrapper?: string;
|
|
102
|
-
/** Classes for the icon itself */
|
|
103
|
-
itemIcon?: string;
|
|
104
|
-
/** Classes for the content wrapper */
|
|
105
|
-
itemContentWrapper?: string;
|
|
106
|
-
/** Classes for the title text */
|
|
107
|
-
itemTitle?: string;
|
|
108
|
-
/** Classes for the timestamp text */
|
|
109
|
-
itemTimestamp?: string;
|
|
110
|
-
/** Classes for the description text */
|
|
111
|
-
itemDescription?: string;
|
|
112
|
-
/** Classes for the status badge container */
|
|
113
|
-
itemStatusBadge?: string;
|
|
114
|
-
/** Classes for the status badge icon */
|
|
115
|
-
itemStatusBadgeIcon?: string;
|
|
116
|
-
/** Classes for the status badge label */
|
|
117
|
-
itemStatusBadgeLabel?: string;
|
|
118
|
-
/** Classes for the transaction key container */
|
|
119
|
-
itemTxKeyContainer?: string;
|
|
120
|
-
/** Classes for the default hash link label */
|
|
121
|
-
itemHashLabel?: string;
|
|
122
|
-
/** Classes for the default hash link */
|
|
123
|
-
itemHashLink?: string;
|
|
124
|
-
/** Classes for the default hash copy button */
|
|
125
|
-
itemHashCopyButton?: string;
|
|
126
|
-
/** Classes for the original hash link label (replaced transactions) */
|
|
127
|
-
itemOriginalHashLabel?: string;
|
|
128
|
-
/** Classes for the original hash link (replaced transactions) */
|
|
129
|
-
itemOriginalHashLink?: string;
|
|
130
|
-
/** Classes for the original hash copy button (replaced transactions) */
|
|
131
|
-
itemOriginalHashCopyButton?: string;
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
type CustomLoadingContainerProps = {
|
|
135
|
-
labels: Record<string, string>;
|
|
136
|
-
className?: string;
|
|
137
|
-
/** Granular classNames for sub-elements */
|
|
138
|
-
classNames?: {
|
|
139
|
-
spinner?: string;
|
|
140
|
-
text?: string;
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
type CustomErrorContainerProps = {
|
|
144
|
-
className?: string;
|
|
145
|
-
/** Granular classNames for sub-elements */
|
|
146
|
-
classNames?: {
|
|
147
|
-
iconContainer?: string;
|
|
148
|
-
icon?: string;
|
|
149
|
-
content?: string;
|
|
150
|
-
title?: string;
|
|
151
|
-
description?: string;
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
type CustomNoWalletContainerProps = {
|
|
155
|
-
className?: string;
|
|
156
|
-
/** Granular classNames for sub-elements */
|
|
157
|
-
classNames?: {
|
|
158
|
-
text?: string;
|
|
159
|
-
};
|
|
160
|
-
};
|
|
161
|
-
type CustomTransactionsHistoryWrapperProps = {
|
|
162
|
-
children: ReactNode;
|
|
163
|
-
activeConnectionAddress: string;
|
|
164
|
-
transactionPool: NonNullable<NovaConnectProviderProps['transactionPool']>;
|
|
165
|
-
pulsarAdapter: NonNullable<NovaConnectProviderProps['pulsarAdapter']>;
|
|
166
|
-
labels: Record<string, string>;
|
|
167
|
-
className?: string;
|
|
168
|
-
};
|
|
169
|
-
/**
|
|
170
|
-
* Customization options for ConnectedModalTxHistory component
|
|
171
|
-
*/
|
|
172
|
-
type ConnectedModalTxHistoryCustomization = {
|
|
173
|
-
/** Override root container props */
|
|
174
|
-
containerProps?: Partial<Omit<ComponentPropsWithoutRef<'div'>, 'popover' | 'onDrag' | 'onDragEnd' | 'onDragExit' | 'onDragStart' | 'onDragStartCapture' | 'onAnimationStart' | 'onAnimationEnd' | 'onAnimationStartCapture' | 'onAnimationEndCapture' | 'onAnimationIteration' | 'onAnimationIterationCapture'>>;
|
|
175
|
-
/** Custom components */
|
|
176
|
-
components?: {
|
|
177
|
-
/** Custom loading container component */
|
|
178
|
-
LoadingContainer?: ComponentType<CustomLoadingContainerProps>;
|
|
179
|
-
/** Custom error container component */
|
|
180
|
-
ErrorContainer?: ComponentType<CustomErrorContainerProps>;
|
|
181
|
-
/** Custom no wallet container component */
|
|
182
|
-
NoWalletContainer?: ComponentType<CustomNoWalletContainerProps>;
|
|
183
|
-
/** Custom transactions history wrapper component */
|
|
184
|
-
TransactionsHistoryWrapper?: ComponentType<CustomTransactionsHistoryWrapperProps>;
|
|
185
|
-
};
|
|
186
|
-
/** Custom class name generators */
|
|
187
|
-
classNames?: {
|
|
188
|
-
/** Function to generate container classes */
|
|
189
|
-
container?: (params: {
|
|
190
|
-
hasActiveWallet: boolean;
|
|
191
|
-
hasValidAdapter: boolean;
|
|
192
|
-
}) => string;
|
|
193
|
-
/** Function to generate loading container classes */
|
|
194
|
-
loadingContainer?: () => string;
|
|
195
|
-
/** Function to generate loading spinner classes */
|
|
196
|
-
loadingSpinner?: () => string;
|
|
197
|
-
/** Function to generate loading text classes */
|
|
198
|
-
loadingText?: () => string;
|
|
199
|
-
/** Function to generate error container classes */
|
|
200
|
-
errorContainer?: () => string;
|
|
201
|
-
/** Function to generate error icon container classes */
|
|
202
|
-
errorIconContainer?: () => string;
|
|
203
|
-
/** Function to generate error icon classes */
|
|
204
|
-
errorIcon?: () => string;
|
|
205
|
-
/** Function to generate error content classes */
|
|
206
|
-
errorContent?: () => string;
|
|
207
|
-
/** Function to generate error title classes */
|
|
208
|
-
errorTitle?: () => string;
|
|
209
|
-
/** Function to generate error description classes */
|
|
210
|
-
errorDescription?: () => string;
|
|
211
|
-
/** Function to generate no wallet container classes */
|
|
212
|
-
noWalletContainer?: () => string;
|
|
213
|
-
/** Function to generate no wallet text classes */
|
|
214
|
-
noWalletText?: () => string;
|
|
215
|
-
/** Function to generate pulsar required container classes */
|
|
216
|
-
pulsarRequiredContainer?: () => string;
|
|
217
|
-
/** Function to generate pulsar required icon container classes */
|
|
218
|
-
pulsarRequiredIconContainer?: () => string;
|
|
219
|
-
/** Function to generate pulsar required icon classes */
|
|
220
|
-
pulsarRequiredIcon?: () => string;
|
|
221
|
-
/** Function to generate pulsar required content classes */
|
|
222
|
-
pulsarRequiredContent?: () => string;
|
|
223
|
-
/** Function to generate pulsar required title classes */
|
|
224
|
-
pulsarRequiredTitle?: () => string;
|
|
225
|
-
/** Function to generate pulsar required description classes */
|
|
226
|
-
pulsarRequiredDescription?: () => string;
|
|
227
|
-
/** Function to generate transactions history wrapper classes */
|
|
228
|
-
transactionsHistoryWrapper?: () => string;
|
|
229
|
-
};
|
|
230
|
-
/** Custom animation variants */
|
|
231
|
-
variants?: {
|
|
232
|
-
/** Container animation variants */
|
|
233
|
-
container?: Variants;
|
|
234
|
-
/** Error animation variants */
|
|
235
|
-
error?: Variants;
|
|
236
|
-
/** Loading animation variants */
|
|
237
|
-
loading?: Variants;
|
|
238
|
-
};
|
|
239
|
-
/** Custom animation configuration */
|
|
240
|
-
animation?: {
|
|
241
|
-
/** Container animation configuration */
|
|
242
|
-
container?: {
|
|
243
|
-
/** Animation duration in seconds */
|
|
244
|
-
duration?: number;
|
|
245
|
-
/** Animation easing curve */
|
|
246
|
-
ease?: Easing | Easing[];
|
|
247
|
-
/** Animation delay in seconds */
|
|
248
|
-
delay?: number;
|
|
249
|
-
};
|
|
250
|
-
/** Error animation configuration */
|
|
251
|
-
error?: {
|
|
252
|
-
/** Animation duration in seconds */
|
|
253
|
-
duration?: number;
|
|
254
|
-
/** Animation easing curve */
|
|
255
|
-
ease?: Easing | Easing[];
|
|
256
|
-
/** Animation delay in seconds */
|
|
257
|
-
delay?: number;
|
|
258
|
-
};
|
|
259
|
-
/** Loading animation configuration */
|
|
260
|
-
loading?: {
|
|
261
|
-
/** Animation duration in seconds */
|
|
262
|
-
duration?: number;
|
|
263
|
-
/** Animation easing curve */
|
|
264
|
-
ease?: Easing | Easing[];
|
|
265
|
-
/** Animation delay in seconds */
|
|
266
|
-
delay?: number;
|
|
267
|
-
};
|
|
268
|
-
};
|
|
269
|
-
/** Custom event handlers */
|
|
270
|
-
handlers?: {
|
|
271
|
-
/** Custom handler for error retry actions */
|
|
272
|
-
onErrorRetry?: (error: Error, event: React__default.MouseEvent<HTMLButtonElement>) => void;
|
|
273
|
-
/** Custom handler for package loading failure */
|
|
274
|
-
onPackageLoadingFailure?: (packageName: string, error: Error) => void;
|
|
275
|
-
};
|
|
276
|
-
/** Configuration options */
|
|
277
|
-
config?: {
|
|
278
|
-
/** Whether to disable animations */
|
|
279
|
-
disableAnimation?: boolean;
|
|
280
|
-
/** Whether to reduce motion for accessibility */
|
|
281
|
-
reduceMotion?: boolean;
|
|
282
|
-
/** Custom package name for error messages */
|
|
283
|
-
packageName?: string;
|
|
284
|
-
/** Custom aria labels for different states */
|
|
285
|
-
ariaLabels?: {
|
|
286
|
-
loading?: string;
|
|
287
|
-
error?: string;
|
|
288
|
-
noWallet?: string;
|
|
289
|
-
pulsarRequired?: string;
|
|
290
|
-
transactionsHistory?: string;
|
|
291
|
-
};
|
|
292
|
-
};
|
|
293
|
-
/**
|
|
294
|
-
* Customization for the TransactionsHistory component (from @tuwaio/nova-transactions).
|
|
295
|
-
* Passed through to the dynamically loaded component.
|
|
296
|
-
*/
|
|
297
|
-
transactionsHistory?: LocalTransactionsHistoryCustomization;
|
|
298
|
-
};
|
|
299
|
-
/**
|
|
300
|
-
* Props for the ConnectedModalTxHistory component
|
|
301
|
-
*/
|
|
302
|
-
interface ConnectedModalTxHistoryProps extends Pick<NovaConnectProviderProps, 'transactionPool' | 'pulsarAdapter'> {
|
|
303
|
-
/** Additional CSS classes for the container */
|
|
304
|
-
className?: string;
|
|
305
|
-
/** Custom aria-label for the container */
|
|
306
|
-
'aria-label'?: string;
|
|
307
|
-
/** Customization options */
|
|
308
|
-
customization?: ConnectedModalTxHistoryCustomization;
|
|
309
|
-
/** Pagination state for infinite scroll, forwarded to TransactionsHistory. */
|
|
310
|
-
pagination?: LocalTxPagination;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Component for displaying transaction history with comprehensive customization options.
|
|
314
|
-
*
|
|
315
|
-
* This component provides comprehensive transaction history functionality:
|
|
316
|
-
* - Conditional loading of the @tuwaio/nova-transactions package
|
|
317
|
-
* - Graceful fallback when the package is not available
|
|
318
|
-
* - Loading states with proper accessibility support
|
|
319
|
-
* - Error handling for missing configuration
|
|
320
|
-
* - Full WCAG compliance with ARIA labels
|
|
321
|
-
* - Comprehensive customization for all UI elements and behaviors
|
|
322
|
-
* - Animation support with reduced motion options
|
|
323
|
-
* - Custom event handlers for enhanced interactivity
|
|
324
|
-
* - Performance-optimized with memoized calculations
|
|
325
|
-
*
|
|
326
|
-
* The component automatically detects if the required dependencies are available
|
|
327
|
-
* and provides appropriate fallbacks for different scenarios.
|
|
328
|
-
*
|
|
329
|
-
* @example Basic usage
|
|
330
|
-
* ```tsx
|
|
331
|
-
* <ConnectedModalTxHistory
|
|
332
|
-
* transactionPool={txPool}
|
|
333
|
-
* pulsarAdapter={adapter}
|
|
334
|
-
* className="custom-styling"
|
|
335
|
-
* />
|
|
336
|
-
* ```
|
|
337
|
-
*
|
|
338
|
-
* @example With full customization
|
|
339
|
-
* ```tsx
|
|
340
|
-
* <ConnectedModalTxHistory
|
|
341
|
-
* transactionPool={txPool}
|
|
342
|
-
* pulsarAdapter={adapter}
|
|
343
|
-
* customization={{
|
|
344
|
-
* classNames: {
|
|
345
|
-
* container: ({ hasActiveWallet }) =>
|
|
346
|
-
* `custom-container ${hasActiveWallet ? 'has-wallet' : 'no-wallet'}`,
|
|
347
|
-
* loadingContainer: () => "custom-loading bg-blue-100",
|
|
348
|
-
* errorContainer: () => "custom-error bg-red-100",
|
|
349
|
-
* },
|
|
350
|
-
* components: {
|
|
351
|
-
* LoadingContainer: ({ className }) =>
|
|
352
|
-
* <div className={cn("custom-spinner", className)} />,
|
|
353
|
-
* },
|
|
354
|
-
* handlers: {
|
|
355
|
-
* onPackageLoadingFailure: (packageName, error) =>
|
|
356
|
-
* console.error(`Failed to load ${packageName}:`, error),
|
|
357
|
-
* },
|
|
358
|
-
* config: {
|
|
359
|
-
* packageName: '@custom/transactions',
|
|
360
|
-
* ariaLabels: {
|
|
361
|
-
* loading: 'Loading transaction history...',
|
|
362
|
-
* error: 'Error loading transactions',
|
|
363
|
-
* },
|
|
364
|
-
* },
|
|
365
|
-
* animation: {
|
|
366
|
-
* container: { duration: 0.3, ease: 'easeOut' },
|
|
367
|
-
* error: { duration: 0.2, ease: 'easeIn' },
|
|
368
|
-
* },
|
|
369
|
-
* }}
|
|
370
|
-
* />
|
|
371
|
-
* ```
|
|
372
|
-
*/
|
|
373
|
-
declare const ConnectedModalTxHistory: React__default.ForwardRefExoticComponent<ConnectedModalTxHistoryProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* @fileoverview Headless SIWX auto-authentication watcher for NovaConnect.
|
|
377
|
-
* Monitors active wallet connections and automatically triggers SIWX signing prompts.
|
|
378
|
-
*/
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Props for NovaSiwxWatcher component.
|
|
382
|
-
*/
|
|
383
|
-
interface NovaSiwxWatcherProps extends SatelliteSiwxFieldOptions {
|
|
384
|
-
/** Enables or disables automatic SIWX authentication prompt (defaults to true) */
|
|
385
|
-
enabled?: boolean;
|
|
386
|
-
/** Optional function to fetch challenge nonce from backend */
|
|
387
|
-
getNonce?: () => Promise<string>;
|
|
388
|
-
/** Optional backend verification callback function */
|
|
389
|
-
verifier?: UseSiwxSignInOptions['verifier'];
|
|
390
|
-
/**
|
|
391
|
-
* Optional callback triggered when the wallet disconnects or when `signOut` is called.
|
|
392
|
-
* Useful for hitting a `/logout` endpoint to clear the backend cookie.
|
|
393
|
-
*/
|
|
394
|
-
destroyer?: () => Promise<void>;
|
|
395
|
-
/** Optional callback triggered immediately after successful SIWX authentication */
|
|
396
|
-
onSuccess?: UseSiwxSignInOptions['onSuccess'];
|
|
397
|
-
/** Optional callback triggered if SIWX signing or verification fails */
|
|
398
|
-
onError?: UseSiwxSignInOptions['onError'];
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Headless React component rendered inside `NovaConnectProvider`.
|
|
402
|
-
* Automatically prompts the user for SIWX authentication whenever a new wallet connects.
|
|
403
|
-
* Uses a `lastPromptedAddress` ref lock to prevent infinite retry loops on prompt rejection.
|
|
404
|
-
*/
|
|
405
|
-
declare function NovaSiwxWatcher(props: NovaSiwxWatcherProps): null;
|
|
406
|
-
|
|
407
|
-
type ButtonTxStatus = 'idle' | 'loading' | 'succeed' | 'failed' | 'replaced';
|
|
408
|
-
type ConnectContentType = 'network' | 'connectors' | 'about' | 'getWallet' | 'connecting' | 'impersonate';
|
|
409
|
-
type ConnectedContentType = 'main' | 'transactions' | 'chains' | 'connections';
|
|
410
|
-
/** Legal configuration for Terms of Service and Privacy Policy links */
|
|
411
|
-
interface LegalConfig {
|
|
412
|
-
termsUrl?: string;
|
|
413
|
-
privacyUrl?: string;
|
|
414
|
-
}
|
|
415
|
-
interface NovaConnectProviderProps extends InitialChains {
|
|
416
|
-
/** Transaction pool for pending transactions display */
|
|
417
|
-
transactionPool?: TransactionPool<Transaction>;
|
|
418
|
-
/** Pulsar adapter(s) for transaction handling */
|
|
419
|
-
pulsarAdapter?: TxAdapter<Transaction> | TxAdapter<Transaction>[];
|
|
420
|
-
/** Whether balance should be shown */
|
|
421
|
-
withBalance?: boolean;
|
|
422
|
-
/** Whether chain selector should be shown */
|
|
423
|
-
withChain?: boolean;
|
|
424
|
-
/** Whether impersonated wallets are enabled */
|
|
425
|
-
withImpersonated?: boolean;
|
|
426
|
-
/** Custom list of popular connector names to show in the popular section */
|
|
427
|
-
popularConnectors?: string[];
|
|
428
|
-
/** Custom connector groups to show in the modal */
|
|
429
|
-
customConnectorGroups?: Record<string, string[]>;
|
|
430
|
-
/** Legal configuration for Terms of Service and Privacy Policy links */
|
|
431
|
-
legal?: LegalConfig;
|
|
432
|
-
/** SIWX auto-authentication watcher configuration */
|
|
433
|
-
siwx?: NovaSiwxWatcherProps;
|
|
434
|
-
/**
|
|
435
|
-
* Pagination state for infinite scroll, forwarded to ConnectedModalTxHistory and TransactionsHistory.
|
|
436
|
-
* Mirrors TxInMemoryPagination from @tuwaio/pulsar-core (optional peer dependency).
|
|
437
|
-
*/
|
|
438
|
-
pagination?: LocalTxPagination;
|
|
439
|
-
children: React.ReactNode;
|
|
440
|
-
labels?: Partial<NovaConnectLabels>;
|
|
441
|
-
}
|
|
442
|
-
interface WalletBalance {
|
|
443
|
-
value: string;
|
|
444
|
-
symbol: string;
|
|
445
|
-
}
|
|
446
|
-
interface NovaConnectProviderType extends Omit<NovaConnectProviderProps, 'pulsarAdapter' | 'children' | 'labels' | 'transactionPool'> {
|
|
447
|
-
isConnectModalOpen: boolean;
|
|
448
|
-
setIsConnectModalOpen: (value: boolean) => void;
|
|
449
|
-
isConnectedModalOpen: boolean;
|
|
450
|
-
setIsConnectedModalOpen: (value: boolean) => void;
|
|
451
|
-
isChainsListOpen: boolean;
|
|
452
|
-
setIsChainsListOpen: (value: boolean) => void;
|
|
453
|
-
isChainsListOpenMobile: boolean;
|
|
454
|
-
setIsChainsListOpenMobile: (value: boolean) => void;
|
|
455
|
-
connectedButtonStatus: ButtonTxStatus;
|
|
456
|
-
setConnectedButtonStatus: (value: ButtonTxStatus) => void;
|
|
457
|
-
isConnected: boolean;
|
|
458
|
-
setIsConnected: (value: boolean) => void;
|
|
459
|
-
connectedModalContentType: ConnectedContentType;
|
|
460
|
-
setConnectedModalContentType: (value: ConnectedContentType) => void;
|
|
461
|
-
connectModalContentType: ConnectContentType;
|
|
462
|
-
setConnectModalContentType: (value: ConnectContentType) => void;
|
|
463
|
-
selectedAdapter: OrbitAdapter | undefined;
|
|
464
|
-
setSelectedAdapter: (value: OrbitAdapter | undefined) => void;
|
|
465
|
-
activeConnector: string | undefined;
|
|
466
|
-
setActiveConnector: (value: string | undefined) => void;
|
|
467
|
-
impersonatedAddress: string;
|
|
468
|
-
setImpersonatedAddress: (value: string) => void;
|
|
469
|
-
legal?: LegalConfig;
|
|
470
|
-
}
|
|
471
|
-
declare class NovaConnectProviderError extends Error {
|
|
472
|
-
constructor(message?: string);
|
|
473
|
-
}
|
|
474
|
-
declare const NovaConnectProviderContext: React$1.Context<NovaConnectProviderType | undefined>;
|
|
475
|
-
/**
|
|
476
|
-
* Hook to access NovaConnect context
|
|
477
|
-
*
|
|
478
|
-
* @throws {NovaConnectProviderError} When used outside of NovaConnectProvider
|
|
479
|
-
* @returns {NovaConnectProviderType} The NovaConnect context value
|
|
480
|
-
*
|
|
481
|
-
* @example
|
|
482
|
-
* ```typescript
|
|
483
|
-
* function MyComponent() {
|
|
484
|
-
* const { isConnected, handleConnectButtonClick } = useNovaConnect();
|
|
485
|
-
*
|
|
486
|
-
* return (
|
|
487
|
-
* <button onClick={handleConnectButtonClick}>
|
|
488
|
-
* {isConnected ? 'Connected' : 'Connect Wallet'}
|
|
489
|
-
* </button>
|
|
490
|
-
* );
|
|
491
|
-
* }
|
|
492
|
-
* ```
|
|
493
|
-
*/
|
|
494
|
-
declare const useNovaConnect: () => NovaConnectProviderType;
|
|
495
|
-
/**
|
|
496
|
-
* Hook to check if NovaConnect context is available
|
|
497
|
-
*
|
|
498
|
-
* @returns {boolean} True if context is available, false otherwise
|
|
499
|
-
*
|
|
500
|
-
* @example
|
|
501
|
-
* ```typescript
|
|
502
|
-
* function ConditionalComponent() {
|
|
503
|
-
* const hasContext = useHasNovaConnectContext();
|
|
504
|
-
*
|
|
505
|
-
* if (!hasContext) {
|
|
506
|
-
* return <div>NovaConnect provider not found</div>;
|
|
507
|
-
* }
|
|
508
|
-
*
|
|
509
|
-
* return <ConnectedComponent />;
|
|
510
|
-
* }
|
|
511
|
-
* ```
|
|
512
|
-
*/
|
|
513
|
-
declare const useHasNovaConnectContext: () => boolean;
|
|
514
|
-
/**
|
|
515
|
-
* Optional hook that returns null if provider is not available
|
|
516
|
-
*
|
|
517
|
-
* @returns {NovaConnectProviderType | null} Context value or null if not available
|
|
518
|
-
*
|
|
519
|
-
* @example
|
|
520
|
-
* ```typescript
|
|
521
|
-
* function OptionalComponent() {
|
|
522
|
-
* const context = useNovaConnectOptional();
|
|
523
|
-
*
|
|
524
|
-
* if (!context) {
|
|
525
|
-
* return <div>No wallet provider available</div>;
|
|
526
|
-
* }
|
|
527
|
-
*
|
|
528
|
-
* return <div>Connected: {context.isConnected}</div>;
|
|
529
|
-
* }
|
|
530
|
-
* ```
|
|
531
|
-
*/
|
|
532
|
-
declare const useNovaConnectOptional: () => NovaConnectProviderType | null;
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* React Context for storing and providing the UI labels.
|
|
536
|
-
* It is initialized with the default English labels, ensuring that components
|
|
537
|
-
* work even without an explicit provider.
|
|
538
|
-
*/
|
|
539
|
-
declare const NovaConnectLabelsContext: React$1.Context<NovaConnectLabels>;
|
|
540
|
-
/**
|
|
541
|
-
* A custom hook to easily access the i18n labels from any component
|
|
542
|
-
* within the `NovaConnectLabelsProvider` tree.
|
|
543
|
-
*
|
|
544
|
-
* This hook provides type-safe access to all UI labels and automatically
|
|
545
|
-
* falls back to default English labels if no provider is found.
|
|
546
|
-
*
|
|
547
|
-
* @returns {NovaConnectLabels} The complete object of UI labels for the current locale.
|
|
548
|
-
*
|
|
549
|
-
* @example
|
|
550
|
-
* ```typescript
|
|
551
|
-
* import { useNovaConnectLabels } from './hooks/useNovaConnectLabels';
|
|
552
|
-
*
|
|
553
|
-
* function MyComponent() {
|
|
554
|
-
* const labels = useNovaConnectLabels();
|
|
555
|
-
*
|
|
556
|
-
* return (
|
|
557
|
-
* <div>
|
|
558
|
-
* <h1>{labels.connectWallet}</h1>
|
|
559
|
-
* <button>{labels.connect}</button>
|
|
560
|
-
* <p aria-label={labels.walletBalance}>{formattedBalance}</p>
|
|
561
|
-
* </div>
|
|
562
|
-
* );
|
|
563
|
-
* }
|
|
564
|
-
* ```
|
|
565
|
-
*
|
|
566
|
-
* @example
|
|
567
|
-
* ```typescript
|
|
568
|
-
* // Destructuring specific labels for better performance
|
|
569
|
-
* function ConnectButton() {
|
|
570
|
-
* const { connectWallet, connecting, connected } = useNovaConnectLabels();
|
|
571
|
-
*
|
|
572
|
-
* return (
|
|
573
|
-
* <button>
|
|
574
|
-
* {isConnecting ? connecting : isConnected ? connected : connectWallet}
|
|
575
|
-
* </button>
|
|
576
|
-
* );
|
|
577
|
-
* }
|
|
578
|
-
* ```
|
|
579
|
-
*/
|
|
580
|
-
declare const useNovaConnectLabels: () => NovaConnectLabels;
|
|
581
|
-
/**
|
|
582
|
-
* Hook to get a specific label by key path with type safety
|
|
583
|
-
*
|
|
584
|
-
* @param key The label key to retrieve
|
|
585
|
-
* @returns The specific label value
|
|
586
|
-
*
|
|
587
|
-
* @example
|
|
588
|
-
* ```typescript
|
|
589
|
-
* function MyComponent() {
|
|
590
|
-
* const connectLabel = useNovaConnectLabel('connectWallet');
|
|
591
|
-
* const errorLabel = useNovaConnectLabel('connectionError');
|
|
592
|
-
*
|
|
593
|
-
* return <button>{connectLabel}</button>;
|
|
594
|
-
* }
|
|
595
|
-
* ```
|
|
596
|
-
*/
|
|
597
|
-
declare const useNovaConnectLabel: <K extends keyof NovaConnectLabels>(key: K) => NovaConnectLabels[K];
|
|
598
|
-
/**
|
|
599
|
-
* Hook to get multiple specific labels for better performance
|
|
600
|
-
*
|
|
601
|
-
* @param keys Array of label keys to retrieve
|
|
602
|
-
* @returns Object with only the requested labels
|
|
603
|
-
*
|
|
604
|
-
* @example
|
|
605
|
-
* ```typescript
|
|
606
|
-
* function ConnectModal() {
|
|
607
|
-
* const { connectWallet, connecting, disconnect } = useNovaConnectLabelsSubset(['connectWallet', 'connecting', 'disconnect']);
|
|
608
|
-
*
|
|
609
|
-
* return (
|
|
610
|
-
* <div>
|
|
611
|
-
* <h2>{connectWallet}</h2>
|
|
612
|
-
* <span>{connecting}</span>
|
|
613
|
-
* <button>{disconnect}</button>
|
|
614
|
-
* </div>
|
|
615
|
-
* );
|
|
616
|
-
* }
|
|
617
|
-
* ```
|
|
618
|
-
*/
|
|
619
|
-
declare const useNovaConnectLabelsSubset: <K extends keyof NovaConnectLabels>(keys: K[]) => Pick<NovaConnectLabels, K>;
|
|
620
|
-
/**
|
|
621
|
-
* Type-safe helper to check if a label exists
|
|
622
|
-
*
|
|
623
|
-
* @param labels The labels object
|
|
624
|
-
* @param key The key to check
|
|
625
|
-
* @returns Whether the key exists and has a non-empty value
|
|
626
|
-
*/
|
|
627
|
-
declare const hasLabel: (labels: NovaConnectLabels, key: keyof NovaConnectLabels) => boolean;
|
|
628
|
-
/**
|
|
629
|
-
* Utility type for extracting label keys by category
|
|
630
|
-
*/
|
|
631
|
-
type LabelCategory = {
|
|
632
|
-
actions: Extract<keyof NovaConnectLabels, 'connectWallet' | 'disconnect' | 'connecting' | 'connected' | 'tryAgain' | 'back' | 'connect' | 'close'>;
|
|
633
|
-
states: Extract<keyof NovaConnectLabels, 'success' | 'error' | 'replaced' | 'loading' | 'idle'>;
|
|
634
|
-
accessibility: Extract<keyof NovaConnectLabels, 'chainSelector' | 'closeModal' | 'selectChain' | 'walletControls' | 'openWalletModal'>;
|
|
635
|
-
transactions: Extract<keyof NovaConnectLabels, 'transactionLoading' | 'transactionSuccess' | 'transactionError' | 'transactionReplaced' | 'recent'>;
|
|
636
|
-
};
|
|
637
|
-
/**
|
|
638
|
-
* Hook to get labels by category for better organization
|
|
639
|
-
*
|
|
640
|
-
* @param category The category of labels to retrieve
|
|
641
|
-
* @returns Object with labels from the specified category
|
|
642
|
-
*/
|
|
643
|
-
declare const useLabelsByCategory: <T extends keyof LabelCategory>(category: T) => Pick<NovaConnectLabels, LabelCategory[T]>;
|
|
644
|
-
/**
|
|
645
|
-
* Utility function to check if labels are default ones (for external use)
|
|
646
|
-
* This is a regular function, not a hook, so it can be used anywhere
|
|
647
|
-
*
|
|
648
|
-
* @param labels The labels to check
|
|
649
|
-
* @returns Whether the labels are the default English labels
|
|
650
|
-
*
|
|
651
|
-
* @example
|
|
652
|
-
* ```typescript
|
|
653
|
-
* function SomeUtilityFunction(labels: NovaConnectLabels) {
|
|
654
|
-
* if (isDefaultLabels(labels)) {
|
|
655
|
-
* console.log('Using default English labels');
|
|
656
|
-
* }
|
|
657
|
-
* }
|
|
658
|
-
* ```
|
|
659
|
-
*/
|
|
660
|
-
declare const isDefaultLabels: (labels: NovaConnectLabels) => boolean;
|
|
661
|
-
/**
|
|
662
|
-
* Utility function to get a formatted label with fallback
|
|
663
|
-
*
|
|
664
|
-
* @param labels The labels object
|
|
665
|
-
* @param key The label key
|
|
666
|
-
* @param fallback Optional fallback text
|
|
667
|
-
* @returns The label value or fallback
|
|
668
|
-
*
|
|
669
|
-
* @example
|
|
670
|
-
* ```typescript
|
|
671
|
-
* const buttonText = getLabelWithFallback(labels, 'connectWallet', 'Connect');
|
|
672
|
-
* ```
|
|
673
|
-
*/
|
|
674
|
-
declare const getLabelWithFallback: (labels: NovaConnectLabels, key: keyof NovaConnectLabels, fallback?: string) => string;
|
|
675
|
-
/**
|
|
676
|
-
* Utility function to create a labels subset (for use outside of React components)
|
|
677
|
-
*
|
|
678
|
-
* @param labels The source labels object
|
|
679
|
-
* @param keys Array of keys to extract
|
|
680
|
-
* @returns Object with only the requested labels
|
|
681
|
-
*
|
|
682
|
-
* @example
|
|
683
|
-
* ```typescript
|
|
684
|
-
* const actionLabels = createLabelsSubset(labels, ['connect', 'disconnect', 'tryAgain']);
|
|
685
|
-
* ```
|
|
686
|
-
*/
|
|
687
|
-
declare const createLabelsSubset: <K extends keyof NovaConnectLabels>(labels: NovaConnectLabels, keys: K[]) => Pick<NovaConnectLabels, K>;
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* @interface NativeBalanceResult
|
|
691
|
-
* Represents the native token balance returned by the adapter.
|
|
692
|
-
* The value is already formatted for human readability.
|
|
693
|
-
* @property {string} value The native token balance formatted to standard decimals (e.g., "1.5").
|
|
694
|
-
* @property {string} symbol The symbol of the native token (e.g., "ETH").
|
|
695
|
-
*/
|
|
696
|
-
interface NativeBalanceResult {
|
|
697
|
-
value: string;
|
|
698
|
-
symbol: string;
|
|
699
|
-
}
|
|
700
|
-
type NativeBalanceState = NativeBalanceResult | null;
|
|
701
|
-
/**
|
|
702
|
-
* @interface NativeBalanceData
|
|
703
|
-
* The object returned by the useWalletNativeBalance hook.
|
|
704
|
-
* @property {NativeBalanceState} balance The native token balance and symbol, or null.
|
|
705
|
-
* @property {boolean} isLoading True while the balance is being fetched for the current wallet/chain combination.
|
|
706
|
-
* @property {() => void} refetch Function to manually trigger a balance refresh.
|
|
707
|
-
*/
|
|
708
|
-
interface NativeBalanceData {
|
|
709
|
-
balance: NativeBalanceState;
|
|
710
|
-
isLoading: boolean;
|
|
711
|
-
refetch: () => void;
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* Custom hook to fetch the native token balance for the currently connected wallet
|
|
715
|
-
* on the active chain. It includes a local cache layer to prevent redundant network calls
|
|
716
|
-
* when switching between components or on re-renders for the same wallet/chain.
|
|
717
|
-
*
|
|
718
|
-
* @returns {NativeBalanceData} An object containing the balance data and loading state.
|
|
719
|
-
*
|
|
720
|
-
* @example
|
|
721
|
-
* ```typescript
|
|
722
|
-
* import { useWalletNativeBalance } from './useWalletNativeBalance';
|
|
723
|
-
*
|
|
724
|
-
* function NativeTokenDisplay() {
|
|
725
|
-
* const { balance, isLoading, refetch } = useWalletNativeBalance();
|
|
726
|
-
*
|
|
727
|
-
* if (isLoading) {
|
|
728
|
-
* return <p>Loading balance...</p>;
|
|
729
|
-
* }
|
|
730
|
-
*
|
|
731
|
-
* // Display the formatted balance and symbol
|
|
732
|
-
* return (
|
|
733
|
-
* <div>
|
|
734
|
-
* <p>Balance: {balance ? `${balance.value} ${balance.symbol}` : '0.00'}</p>
|
|
735
|
-
* <button onClick={refetch}>Refresh</button>
|
|
736
|
-
* </div>
|
|
737
|
-
* );
|
|
738
|
-
* }
|
|
739
|
-
* ```
|
|
740
|
-
*/
|
|
741
|
-
declare function useWalletNativeBalance(): NativeBalanceData;
|
|
742
|
-
|
|
743
|
-
export { type AllChainConfigs as A, type ButtonTxStatus as B, type ConnectContentType as C, type InitialChains as I, type LabelCategory as L, type NovaConnectProviderProps as N, type WalletBalance as W, type ConnectedContentType as a, type NovaConnectProviderType as b, type LegalConfig as c, type NativeBalanceResult as d, NovaConnectLabelsContext as e, NovaConnectProviderContext as f, NovaConnectProviderError as g, NovaSiwxWatcher as h, type NovaSiwxWatcherProps as i, createLabelsSubset as j, getLabelWithFallback as k, hasLabel as l, isDefaultLabels as m, useLabelsByCategory as n, useNovaConnect as o, useNovaConnectLabel as p, useNovaConnectLabels as q, useNovaConnectLabelsSubset as r, useNovaConnectOptional as s, useWalletNativeBalance as t, useHasNovaConnectContext as u, type ConnectedModalTxHistoryProps as v, type ConnectedModalTxHistoryCustomization as w, ConnectedModalTxHistory as x, type LocalTransactionsHistoryCustomization as y, type LocalTxPagination as z };
|