@tuwaio/nova-connect 1.0.0-fix-test-alpha.1.1de2063 → 1.0.0-fix-test-alpha.2.3c61c83
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/dist/ToastError-D24J0PWb.d.cts +586 -0
- package/dist/ToastError-ixUdnzTl.d.ts +586 -0
- package/dist/chunk-CEGEQMI2.cjs +2 -0
- package/dist/chunk-CEGEQMI2.cjs.map +1 -0
- package/dist/chunk-EKIVAPR5.cjs +2 -0
- package/dist/chunk-EKIVAPR5.cjs.map +1 -0
- package/dist/chunk-PA5HVUML.cjs +6 -0
- package/dist/chunk-PA5HVUML.cjs.map +1 -0
- package/dist/chunk-QEDV2DL5.js +6 -0
- package/dist/chunk-QEDV2DL5.js.map +1 -0
- package/dist/chunk-RHHLGHTV.cjs +2 -0
- package/dist/chunk-RHHLGHTV.cjs.map +1 -0
- package/dist/evm/index.cjs +1 -1
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.js +1 -1
- package/dist/evm/index.js.map +1 -1
- package/dist/evm-7NHOTSAK.cjs +2 -0
- package/dist/evm-7NHOTSAK.cjs.map +1 -0
- package/dist/getChainsListByWalletType-PPNS2YMZ.cjs +2 -0
- package/dist/getChainsListByWalletType-PPNS2YMZ.cjs.map +1 -0
- package/dist/index.cjs +1 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -566
- package/dist/index.d.ts +16 -566
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +1 -5
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.d.cts +9 -590
- package/dist/providers/index.d.ts +9 -590
- package/dist/providers/index.js +1 -5
- package/dist/providers/index.js.map +1 -1
- package/dist/solana/index.cjs +1 -1
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +40 -0
- package/dist/solana/index.d.ts +40 -0
- package/dist/solana/index.js +1 -1
- package/dist/solana/index.js.map +1 -1
- package/dist/solana-MTTFU3UW.cjs +2 -0
- package/dist/solana-MTTFU3UW.cjs.map +1 -0
- package/dist/types-yzbOGSEA.d.cts +75 -0
- package/dist/types-yzbOGSEA.d.ts +75 -0
- package/dist/utils-DKLQEIST.cjs +2 -0
- package/dist/utils-DKLQEIST.cjs.map +1 -0
- package/dist/utils-DZB4ZTS4.cjs +2 -0
- package/dist/utils-DZB4ZTS4.cjs.map +1 -0
- package/package.json +4 -4
- package/dist/evm-F7OJEDX3.js +0 -2
- package/dist/evm-F7OJEDX3.js.map +0 -1
- package/dist/providers/evm-5323YCLC.js +0 -2
- package/dist/providers/evm-5323YCLC.js.map +0 -1
- package/dist/providers/solana-WHT5KTOF.js +0 -2
- package/dist/providers/solana-WHT5KTOF.js.map +0 -1
- package/dist/providers/utils-FHHKXQ5Z.js +0 -2
- package/dist/providers/utils-FHHKXQ5Z.js.map +0 -1
- package/dist/providers/utils-L6CFHW4B.js +0 -2
- package/dist/providers/utils-L6CFHW4B.js.map +0 -1
- package/dist/solana-EV65GS7Q.js +0 -2
- package/dist/solana-EV65GS7Q.js.map +0 -1
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { BaseWallet, ISatelliteConnectStore } from '@tuwaio/satellite-core';
|
|
3
|
+
import * as React$1 from 'react';
|
|
4
|
+
import { ComponentPropsWithoutRef, ComponentType, ReactNode } from 'react';
|
|
5
|
+
import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
6
|
+
import { StoreApi } from 'zustand/index';
|
|
7
|
+
import { a as Connector, W as Wallet } from './types-yzbOGSEA.cjs';
|
|
8
|
+
import { ToastPosition, ToastContainer, toast } from 'react-toastify';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Type definitions for NovaConnect component translations
|
|
12
|
+
* Contains all text strings for multi-language support
|
|
13
|
+
*/
|
|
14
|
+
type NovaConnectLabels = {
|
|
15
|
+
connectWallet: string;
|
|
16
|
+
disconnect: string;
|
|
17
|
+
connecting: string;
|
|
18
|
+
connected: string;
|
|
19
|
+
tryAgain: string;
|
|
20
|
+
back: string;
|
|
21
|
+
connect: string;
|
|
22
|
+
close: string;
|
|
23
|
+
all: string;
|
|
24
|
+
connectionError: string;
|
|
25
|
+
connectedSuccessfully: string;
|
|
26
|
+
connectingTo: string;
|
|
27
|
+
walletConnectionError: string;
|
|
28
|
+
errorWhenChainSwitching: string;
|
|
29
|
+
cannotConnectWallet: string;
|
|
30
|
+
success: string;
|
|
31
|
+
error: string;
|
|
32
|
+
replaced: string;
|
|
33
|
+
recent: string;
|
|
34
|
+
transactionLoading: string;
|
|
35
|
+
transactionSuccess: string;
|
|
36
|
+
transactionError: string;
|
|
37
|
+
transactionReplaced: string;
|
|
38
|
+
aboutWallets: string;
|
|
39
|
+
getWallet: string;
|
|
40
|
+
connectImpersonatedWallet: string;
|
|
41
|
+
transactionsInApp: string;
|
|
42
|
+
switchNetwork: string;
|
|
43
|
+
switchNetworks: string;
|
|
44
|
+
connectingEllipsis: string;
|
|
45
|
+
installed: string;
|
|
46
|
+
popular: string;
|
|
47
|
+
impersonate: string;
|
|
48
|
+
readOnlyMode: string;
|
|
49
|
+
whatIsWallet: string;
|
|
50
|
+
walletDescription: string;
|
|
51
|
+
whatIsNetwork: string;
|
|
52
|
+
networkDescription: string;
|
|
53
|
+
learnMore: string;
|
|
54
|
+
listOfNetworks: string;
|
|
55
|
+
viewOnExplorer: string;
|
|
56
|
+
viewTransactions: string;
|
|
57
|
+
enterWalletAddress: string;
|
|
58
|
+
walletAddressPlaceholder: string;
|
|
59
|
+
noConnectorsFound: string;
|
|
60
|
+
noConnectorsDescription: string;
|
|
61
|
+
somethingWentWrong: string;
|
|
62
|
+
networkPickingError: string;
|
|
63
|
+
pulsarAdapterRequired: string;
|
|
64
|
+
pulsarAdapterDescription: string;
|
|
65
|
+
selectAvailableNetwork: string;
|
|
66
|
+
startExploringWeb3: string;
|
|
67
|
+
walletKeyToDigitalWorld: string;
|
|
68
|
+
iDontHaveWallet: string;
|
|
69
|
+
choseWallet: string;
|
|
70
|
+
keyToNewInternet: string;
|
|
71
|
+
keyToNewInternetDescription: string;
|
|
72
|
+
logInWithoutHassle: string;
|
|
73
|
+
logInWithoutHassleDescription: string;
|
|
74
|
+
copyRawError: string;
|
|
75
|
+
copied: string;
|
|
76
|
+
chainSelector: string;
|
|
77
|
+
closeModal: string;
|
|
78
|
+
selectChain: string;
|
|
79
|
+
chainOption: string;
|
|
80
|
+
openChainSelector: string;
|
|
81
|
+
currentChain: string;
|
|
82
|
+
scrollToTop: string;
|
|
83
|
+
scrollToBottom: string;
|
|
84
|
+
chainListContainer: string;
|
|
85
|
+
walletControls: string;
|
|
86
|
+
openWalletModal: string;
|
|
87
|
+
walletConnected: string;
|
|
88
|
+
walletNotConnected: string;
|
|
89
|
+
walletBalance: string;
|
|
90
|
+
walletAddress: string;
|
|
91
|
+
transactionStatus: string;
|
|
92
|
+
successIcon: string;
|
|
93
|
+
errorIcon: string;
|
|
94
|
+
replacedIcon: string;
|
|
95
|
+
statusIcon: string;
|
|
96
|
+
loading: string;
|
|
97
|
+
idle: string;
|
|
98
|
+
unknownWallet: string;
|
|
99
|
+
walletAvatar: string;
|
|
100
|
+
ensAvatar: string;
|
|
101
|
+
walletIcon: string;
|
|
102
|
+
impersonateAddressEmpty: string;
|
|
103
|
+
impersonateAddressNotCorrect: string;
|
|
104
|
+
impersonateAddressConnected: string;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
type ButtonTxStatus = 'idle' | 'loading' | 'succeed' | 'failed' | 'replaced';
|
|
108
|
+
type ConnectContentType = 'network' | 'connectors' | 'about' | 'getWallet' | 'connecting' | 'impersonate';
|
|
109
|
+
type ConnectedContentType = 'main' | 'transactions' | 'chains';
|
|
110
|
+
interface NovaConnectProviderProps {
|
|
111
|
+
store: StoreApi<ISatelliteConnectStore<Connector, Wallet>>;
|
|
112
|
+
children: React.ReactNode;
|
|
113
|
+
labels?: Partial<NovaConnectLabels>;
|
|
114
|
+
}
|
|
115
|
+
interface WalletBalance {
|
|
116
|
+
value: string;
|
|
117
|
+
symbol: string;
|
|
118
|
+
}
|
|
119
|
+
interface NovaConnectProviderType {
|
|
120
|
+
activeWallet: BaseWallet | undefined;
|
|
121
|
+
walletConnectionError: string | undefined;
|
|
122
|
+
isConnectModalOpen: boolean;
|
|
123
|
+
setIsConnectModalOpen: (value: boolean) => void;
|
|
124
|
+
isConnectedModalOpen: boolean;
|
|
125
|
+
setIsConnectedModalOpen: (value: boolean) => void;
|
|
126
|
+
isChainsListOpen: boolean;
|
|
127
|
+
setIsChainsListOpen: (value: boolean) => void;
|
|
128
|
+
isChainsListOpenMobile: boolean;
|
|
129
|
+
setIsChainsListOpenMobile: (value: boolean) => void;
|
|
130
|
+
connectedButtonStatus: ButtonTxStatus;
|
|
131
|
+
setConnectedButtonStatus: (value: ButtonTxStatus) => void;
|
|
132
|
+
isConnected: boolean;
|
|
133
|
+
setIsConnected: (value: boolean) => void;
|
|
134
|
+
connectedModalContentType: ConnectedContentType;
|
|
135
|
+
setConnectedModalContentType: (value: ConnectedContentType) => void;
|
|
136
|
+
connectModalContentType: ConnectContentType;
|
|
137
|
+
setConnectModalContentType: (value: ConnectContentType) => void;
|
|
138
|
+
selectedAdapter: OrbitAdapter | undefined;
|
|
139
|
+
setSelectedAdapter: (value: OrbitAdapter | undefined) => void;
|
|
140
|
+
activeConnector: string | undefined;
|
|
141
|
+
setActiveConnector: (value: string | undefined) => void;
|
|
142
|
+
impersonatedAddress: string;
|
|
143
|
+
setImpersonatedAddress: (value: string) => void;
|
|
144
|
+
}
|
|
145
|
+
declare class NovaConnectProviderError extends Error {
|
|
146
|
+
constructor(message?: string);
|
|
147
|
+
}
|
|
148
|
+
declare const NovaConnectProviderContext: React$1.Context<NovaConnectProviderType | undefined>;
|
|
149
|
+
/**
|
|
150
|
+
* Hook to access NovaConnect context
|
|
151
|
+
*
|
|
152
|
+
* @throws {NovaConnectProviderError} When used outside of NovaConnectProvider
|
|
153
|
+
* @returns {NovaConnectProviderType} The NovaConnect context value
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* function MyComponent() {
|
|
158
|
+
* const { isConnected, handleConnectButtonClick } = useNovaConnect();
|
|
159
|
+
*
|
|
160
|
+
* return (
|
|
161
|
+
* <button onClick={handleConnectButtonClick}>
|
|
162
|
+
* {isConnected ? 'Connected' : 'Connect Wallet'}
|
|
163
|
+
* </button>
|
|
164
|
+
* );
|
|
165
|
+
* }
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
declare const useNovaConnect: () => NovaConnectProviderType;
|
|
169
|
+
/**
|
|
170
|
+
* Hook to check if NovaConnect context is available
|
|
171
|
+
*
|
|
172
|
+
* @returns {boolean} True if context is available, false otherwise
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```typescript
|
|
176
|
+
* function ConditionalComponent() {
|
|
177
|
+
* const hasContext = useHasNovaConnectContext();
|
|
178
|
+
*
|
|
179
|
+
* if (!hasContext) {
|
|
180
|
+
* return <div>NovaConnect provider not found</div>;
|
|
181
|
+
* }
|
|
182
|
+
*
|
|
183
|
+
* return <ConnectedComponent />;
|
|
184
|
+
* }
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
declare const useHasNovaConnectContext: () => boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Optional hook that returns null if provider is not available
|
|
190
|
+
*
|
|
191
|
+
* @returns {NovaConnectProviderType | null} Context value or null if not available
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```typescript
|
|
195
|
+
* function OptionalComponent() {
|
|
196
|
+
* const context = useNovaConnectOptional();
|
|
197
|
+
*
|
|
198
|
+
* if (!context) {
|
|
199
|
+
* return <div>No wallet provider available</div>;
|
|
200
|
+
* }
|
|
201
|
+
*
|
|
202
|
+
* return <div>Connected: {context.isConnected}</div>;
|
|
203
|
+
* }
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
declare const useNovaConnectOptional: () => NovaConnectProviderType | null;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @interface NativeBalanceResult
|
|
210
|
+
* Represents the native token balance returned by the adapter.
|
|
211
|
+
* The value is already formatted for human readability.
|
|
212
|
+
* @property {string} value The native token balance formatted to standard decimals (e.g., "1.5").
|
|
213
|
+
* @property {string} symbol The symbol of the native token (e.g., "ETH").
|
|
214
|
+
*/
|
|
215
|
+
interface NativeBalanceResult {
|
|
216
|
+
value: string;
|
|
217
|
+
symbol: string;
|
|
218
|
+
}
|
|
219
|
+
type NativeBalanceState = NativeBalanceResult | null;
|
|
220
|
+
/**
|
|
221
|
+
* @interface NativeBalanceData
|
|
222
|
+
* The object returned by the useWalletNativeBalance hook.
|
|
223
|
+
* @property {NativeBalanceState} balance The native token balance and symbol, or null.
|
|
224
|
+
* @property {boolean} isLoading True while the balance is being fetched for the current wallet/chain combination.
|
|
225
|
+
* @property {() => void} refetch Function to manually trigger a balance refresh.
|
|
226
|
+
*/
|
|
227
|
+
interface NativeBalanceData {
|
|
228
|
+
balance: NativeBalanceState;
|
|
229
|
+
isLoading: boolean;
|
|
230
|
+
refetch: () => void;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Custom hook to fetch the native token balance for the currently connected wallet
|
|
234
|
+
* on the active chain. It includes a local cache layer to prevent redundant network calls
|
|
235
|
+
* when switching between components or on re-renders for the same wallet/chain.
|
|
236
|
+
*
|
|
237
|
+
* @returns {NativeBalanceData} An object containing the balance data and loading state.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```typescript
|
|
241
|
+
* import { useWalletNativeBalance } from './useWalletNativeBalance';
|
|
242
|
+
*
|
|
243
|
+
* function NativeTokenDisplay() {
|
|
244
|
+
* const { balance, isLoading, refetch } = useWalletNativeBalance();
|
|
245
|
+
*
|
|
246
|
+
* if (isLoading) {
|
|
247
|
+
* return <p>Loading balance...</p>;
|
|
248
|
+
* }
|
|
249
|
+
*
|
|
250
|
+
* // Display the formatted balance and symbol
|
|
251
|
+
* return (
|
|
252
|
+
* <div>
|
|
253
|
+
* <p>Balance: {balance ? `${balance.value} ${balance.symbol}` : '0.00'}</p>
|
|
254
|
+
* <button onClick={refetch}>Refresh</button>
|
|
255
|
+
* </div>
|
|
256
|
+
* );
|
|
257
|
+
* }
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
declare function useWalletNativeBalance({ store, activeWallet, }: Pick<NovaConnectProviderProps, 'store'> & Pick<NovaConnectProviderType, 'activeWallet'>): NativeBalanceData;
|
|
261
|
+
|
|
262
|
+
type CustomToastErrorProps = {
|
|
263
|
+
title: string;
|
|
264
|
+
rawError: string;
|
|
265
|
+
onCopyComplete?: (success: boolean) => void;
|
|
266
|
+
errorType: 'wallet' | 'switch' | null;
|
|
267
|
+
isConnected: boolean;
|
|
268
|
+
};
|
|
269
|
+
type CustomContainerProps = ComponentPropsWithoutRef<typeof ToastContainer>;
|
|
270
|
+
/**
|
|
271
|
+
* Customization options for ErrorsProvider component
|
|
272
|
+
*/
|
|
273
|
+
type ErrorsProviderCustomization = {
|
|
274
|
+
/** Override ToastContainer element props */
|
|
275
|
+
containerProps?: Partial<ComponentPropsWithoutRef<typeof ToastContainer>>;
|
|
276
|
+
/** Custom components */
|
|
277
|
+
components?: {
|
|
278
|
+
/** Custom ToastError component */
|
|
279
|
+
ToastError?: ComponentType<CustomToastErrorProps>;
|
|
280
|
+
/** Custom ToastContainer component */
|
|
281
|
+
Container?: ComponentType<CustomContainerProps>;
|
|
282
|
+
};
|
|
283
|
+
/** Default ToastError customization (only used with default ToastError component) */
|
|
284
|
+
toastErrorCustomization?: ToastErrorCustomization;
|
|
285
|
+
/** Custom class name generators */
|
|
286
|
+
classNames?: {
|
|
287
|
+
/** Function to generate container classes */
|
|
288
|
+
container?: (params: {
|
|
289
|
+
hasErrors: boolean;
|
|
290
|
+
errorType: 'wallet' | 'switch' | null;
|
|
291
|
+
}) => string;
|
|
292
|
+
};
|
|
293
|
+
/** Custom toast options generators */
|
|
294
|
+
toastOptions?: {
|
|
295
|
+
/** Function to generate toast options */
|
|
296
|
+
error?: (params: {
|
|
297
|
+
title: string;
|
|
298
|
+
rawError: string;
|
|
299
|
+
errorType: 'wallet' | 'switch' | null;
|
|
300
|
+
isConnected: boolean;
|
|
301
|
+
}) => Partial<Parameters<typeof toast.error>[1]>;
|
|
302
|
+
};
|
|
303
|
+
/** Custom logic handlers */
|
|
304
|
+
handlers?: {
|
|
305
|
+
/** Custom error display logic */
|
|
306
|
+
showError?: (originalHandler: (title: string, rawError: string, errorKey: string) => void, params: {
|
|
307
|
+
title: string;
|
|
308
|
+
rawError: string;
|
|
309
|
+
errorKey: string;
|
|
310
|
+
errorType: 'wallet' | 'switch' | null;
|
|
311
|
+
}) => void;
|
|
312
|
+
/** Custom error dismissal logic */
|
|
313
|
+
dismissError?: (originalHandler: () => void) => void;
|
|
314
|
+
/** Custom copy complete handler */
|
|
315
|
+
onCopyComplete?: (success: boolean, rawError: string, errorType: 'wallet' | 'switch' | null) => void;
|
|
316
|
+
};
|
|
317
|
+
/** Custom error title generator - does NOT customize labels, just allows title modification */
|
|
318
|
+
errorTitle?: (defaultTitle: string, params: {
|
|
319
|
+
errorType: 'wallet' | 'switch' | null;
|
|
320
|
+
}) => string;
|
|
321
|
+
/** Custom error hash generator for deduplication */
|
|
322
|
+
errorHash?: (defaultHash: string | null, params: {
|
|
323
|
+
primaryError: string | null;
|
|
324
|
+
errorType: 'wallet' | 'switch' | null;
|
|
325
|
+
}) => string | null;
|
|
326
|
+
};
|
|
327
|
+
interface ErrorsProviderProps extends Pick<NovaConnectProviderProps, 'store'> {
|
|
328
|
+
/** Custom container ID for toast notifications */
|
|
329
|
+
containerId?: string;
|
|
330
|
+
/** Custom position for toast notifications */
|
|
331
|
+
position?: ToastPosition;
|
|
332
|
+
/** Auto close delay in milliseconds */
|
|
333
|
+
autoClose?: number | false;
|
|
334
|
+
/** Whether to enable drag to dismiss */
|
|
335
|
+
draggable?: boolean;
|
|
336
|
+
/** Customization options */
|
|
337
|
+
customization?: ErrorsProviderCustomization;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* A highly customizable error toast provider with extensive styling options and component replacement capabilities.
|
|
341
|
+
* Provides comprehensive customization for appearance, behavior, and error handling logic while maintaining accessibility.
|
|
342
|
+
*/
|
|
343
|
+
declare function ErrorsProvider({ store, containerId, position, autoClose, draggable, customization, }: ErrorsProviderProps): react_jsx_runtime.JSX.Element;
|
|
344
|
+
declare namespace ErrorsProvider {
|
|
345
|
+
var displayName: string;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Props for custom NovaConnectLabelsProvider component
|
|
350
|
+
*/
|
|
351
|
+
type CustomLabelsProviderProps = {
|
|
352
|
+
labels?: Partial<NovaConnectLabels>;
|
|
353
|
+
children: ReactNode;
|
|
354
|
+
};
|
|
355
|
+
/**
|
|
356
|
+
* Props for custom ErrorsProvider component
|
|
357
|
+
*/
|
|
358
|
+
type CustomErrorsProviderProps = Pick<ErrorsProviderProps, 'store'> & {
|
|
359
|
+
customization?: ErrorsProviderCustomization;
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
* Context data passed to custom provider components
|
|
363
|
+
*/
|
|
364
|
+
type ProviderContext = {
|
|
365
|
+
/** Current wallet connection state */
|
|
366
|
+
isConnected: boolean;
|
|
367
|
+
/** Active wallet instance */
|
|
368
|
+
activeWallet: BaseWallet | undefined;
|
|
369
|
+
/** Current wallet connection error */
|
|
370
|
+
walletConnectionError: string | undefined;
|
|
371
|
+
/** All modal and UI states */
|
|
372
|
+
modalStates: {
|
|
373
|
+
isConnectModalOpen: boolean;
|
|
374
|
+
isConnectedModalOpen: boolean;
|
|
375
|
+
isChainsListOpen: boolean;
|
|
376
|
+
isChainsListOpenMobile: boolean;
|
|
377
|
+
};
|
|
378
|
+
/** Current content types for modals */
|
|
379
|
+
contentTypes: {
|
|
380
|
+
connectModal: ConnectContentType;
|
|
381
|
+
connectedModal: ConnectedContentType;
|
|
382
|
+
};
|
|
383
|
+
/** Button and transaction statuses */
|
|
384
|
+
statuses: {
|
|
385
|
+
connectedButton: ButtonTxStatus;
|
|
386
|
+
};
|
|
387
|
+
};
|
|
388
|
+
/**
|
|
389
|
+
* Comprehensive customization options for NovaConnectProvider
|
|
390
|
+
*/
|
|
391
|
+
type NovaConnectProviderCustomization = {
|
|
392
|
+
/** Custom components */
|
|
393
|
+
components?: {
|
|
394
|
+
/** Custom labels provider component */
|
|
395
|
+
LabelsProvider?: ComponentType<CustomLabelsProviderProps>;
|
|
396
|
+
/** Custom errors provider component */
|
|
397
|
+
ErrorsProvider?: ComponentType<CustomErrorsProviderProps>;
|
|
398
|
+
};
|
|
399
|
+
/** Labels customization and merging strategy */
|
|
400
|
+
labels?: {
|
|
401
|
+
/** Custom labels merging function */
|
|
402
|
+
merge?: (defaultLabels: NovaConnectLabels, userLabels: Partial<NovaConnectLabels>) => NovaConnectLabels;
|
|
403
|
+
/** Transform final merged labels before use */
|
|
404
|
+
transform?: (mergedLabels: NovaConnectLabels, context: ProviderContext) => NovaConnectLabels;
|
|
405
|
+
};
|
|
406
|
+
/** ErrorsProvider customization - passed through to ErrorsProvider */
|
|
407
|
+
errors?: ErrorsProviderCustomization;
|
|
408
|
+
/** Custom initialization logic */
|
|
409
|
+
initialization?: {
|
|
410
|
+
/** Custom logic after store subscription setup */
|
|
411
|
+
onStoreSubscribed?: (context: ProviderContext) => void;
|
|
412
|
+
/** Custom logic when connection state changes */
|
|
413
|
+
onConnectionStateChange?: (isConnected: boolean, activeWallet: BaseWallet | undefined, context: ProviderContext) => void;
|
|
414
|
+
/** Custom logic when error state changes */
|
|
415
|
+
onErrorStateChange?: (error: string | undefined, context: ProviderContext) => void;
|
|
416
|
+
};
|
|
417
|
+
/** Custom context value transformation */
|
|
418
|
+
contextValue?: {
|
|
419
|
+
/** Transform context value before providing to children */
|
|
420
|
+
transform?: (defaultValue: NovaConnectProviderType, context: ProviderContext) => NovaConnectProviderType;
|
|
421
|
+
};
|
|
422
|
+
/** Custom rendering logic */
|
|
423
|
+
rendering?: {
|
|
424
|
+
/** Custom provider tree structure */
|
|
425
|
+
providerTree?: (defaultTree: ReactNode, components: {
|
|
426
|
+
ErrorsProvider: ReactNode;
|
|
427
|
+
LabelsProvider: ReactNode;
|
|
428
|
+
MainContent: ReactNode;
|
|
429
|
+
}, context: ProviderContext) => ReactNode;
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* Extended props for NovaConnectProvider with full customization capabilities
|
|
434
|
+
*/
|
|
435
|
+
interface NovaConnectProviderPropsWithCustomization extends NovaConnectProviderProps {
|
|
436
|
+
/** Comprehensive customization options for the provider and its sub-components */
|
|
437
|
+
customization?: NovaConnectProviderCustomization;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Main NovaConnect provider component with comprehensive customization capabilities.
|
|
441
|
+
*
|
|
442
|
+
* This provider manages wallet connection state, error handling, internationalization,
|
|
443
|
+
* and modal states while offering extensive customization options for all sub-components
|
|
444
|
+
* and behaviors.
|
|
445
|
+
*
|
|
446
|
+
* Features:
|
|
447
|
+
* - Complete wallet connection state management
|
|
448
|
+
* - Customizable error handling through ErrorsProvider
|
|
449
|
+
* - Flexible internationalization system
|
|
450
|
+
* - Modal and UI state coordination
|
|
451
|
+
* - Extensive customization API for all aspects
|
|
452
|
+
* - Custom component replacement capabilities
|
|
453
|
+
* - Advanced initialization and lifecycle hooks
|
|
454
|
+
*
|
|
455
|
+
* @example Basic usage
|
|
456
|
+
* ```tsx
|
|
457
|
+
* <NovaConnectProvider store={store}>
|
|
458
|
+
* <App />
|
|
459
|
+
* </NovaConnectProvider>
|
|
460
|
+
* ```
|
|
461
|
+
*
|
|
462
|
+
* @example With customization
|
|
463
|
+
* ```tsx
|
|
464
|
+
* <NovaConnectProvider
|
|
465
|
+
* store={store}
|
|
466
|
+
* labels={customLabels}
|
|
467
|
+
* customization={{
|
|
468
|
+
* errors: {
|
|
469
|
+
* position: 'bottom-right',
|
|
470
|
+
* autoClose: 5000,
|
|
471
|
+
* components: {
|
|
472
|
+
* ToastError: CustomToastError
|
|
473
|
+
* }
|
|
474
|
+
* },
|
|
475
|
+
* initialization: {
|
|
476
|
+
* onConnectionStateChange: (isConnected, wallet) => {
|
|
477
|
+
* console.log('Connection state:', isConnected, wallet);
|
|
478
|
+
* }
|
|
479
|
+
* }
|
|
480
|
+
* }}
|
|
481
|
+
* >
|
|
482
|
+
* <App />
|
|
483
|
+
* </NovaConnectProvider>
|
|
484
|
+
* ```
|
|
485
|
+
*
|
|
486
|
+
* @param props - Provider configuration and customization options
|
|
487
|
+
*/
|
|
488
|
+
declare function NovaConnectProvider({ labels, store, children, customization, }: NovaConnectProviderPropsWithCustomization): react_jsx_runtime.JSX.Element;
|
|
489
|
+
declare namespace NovaConnectProvider {
|
|
490
|
+
var displayName: string;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
type CustomIconProps = {
|
|
494
|
+
isCopied: boolean;
|
|
495
|
+
className?: string;
|
|
496
|
+
'aria-hidden'?: boolean;
|
|
497
|
+
};
|
|
498
|
+
type CustomTitleProps = {
|
|
499
|
+
title: string;
|
|
500
|
+
titleId: string;
|
|
501
|
+
className?: string;
|
|
502
|
+
};
|
|
503
|
+
type CustomDescriptionProps = {
|
|
504
|
+
rawError: string;
|
|
505
|
+
descriptionId: string;
|
|
506
|
+
className?: string;
|
|
507
|
+
};
|
|
508
|
+
type CustomButtonContentProps = {
|
|
509
|
+
icon: ReactNode;
|
|
510
|
+
isCopied: boolean;
|
|
511
|
+
copyLabel: string;
|
|
512
|
+
copiedLabel: string;
|
|
513
|
+
};
|
|
514
|
+
/**
|
|
515
|
+
* Customization options for ToastError component
|
|
516
|
+
*/
|
|
517
|
+
type ToastErrorCustomization = {
|
|
518
|
+
/** Override container element props */
|
|
519
|
+
containerProps?: Partial<Omit<ComponentPropsWithoutRef<'div'>, 'style'>>;
|
|
520
|
+
/** Override button element props */
|
|
521
|
+
buttonProps?: Partial<Omit<ComponentPropsWithoutRef<'button'>, 'style'>>;
|
|
522
|
+
/** Custom components */
|
|
523
|
+
components?: {
|
|
524
|
+
/** Custom icon component */
|
|
525
|
+
Icon?: ComponentType<CustomIconProps>;
|
|
526
|
+
/** Custom title component */
|
|
527
|
+
Title?: ComponentType<CustomTitleProps>;
|
|
528
|
+
/** Custom description component */
|
|
529
|
+
Description?: ComponentType<CustomDescriptionProps>;
|
|
530
|
+
/** Custom button content component */
|
|
531
|
+
ButtonContent?: ComponentType<CustomButtonContentProps>;
|
|
532
|
+
};
|
|
533
|
+
/** Custom class name generators */
|
|
534
|
+
classNames?: {
|
|
535
|
+
/** Function to generate container classes */
|
|
536
|
+
container?: (params: {
|
|
537
|
+
hasTitle: boolean;
|
|
538
|
+
hasError: boolean;
|
|
539
|
+
}) => string;
|
|
540
|
+
/** Function to generate title classes */
|
|
541
|
+
title?: (params: {
|
|
542
|
+
title: string;
|
|
543
|
+
}) => string;
|
|
544
|
+
/** Function to generate description classes */
|
|
545
|
+
description?: (params: {
|
|
546
|
+
rawError: string;
|
|
547
|
+
}) => string;
|
|
548
|
+
/** Function to generate button classes */
|
|
549
|
+
button?: (params: {
|
|
550
|
+
isCopied: boolean;
|
|
551
|
+
disabled: boolean;
|
|
552
|
+
}) => string;
|
|
553
|
+
/** Function to generate icon classes */
|
|
554
|
+
icon?: (params: {
|
|
555
|
+
isCopied: boolean;
|
|
556
|
+
}) => string;
|
|
557
|
+
};
|
|
558
|
+
/** Custom event handlers */
|
|
559
|
+
handlers?: {
|
|
560
|
+
/** Custom click handler wrapper */
|
|
561
|
+
onClick?: (originalHandler: (event: React.MouseEvent<HTMLButtonElement>) => void, event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
562
|
+
/** Custom keydown handler wrapper */
|
|
563
|
+
onKeyDown?: (originalHandler: (event: React.KeyboardEvent<HTMLButtonElement>) => void, event: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
interface ToastErrorProps extends Omit<ComponentPropsWithoutRef<'div'>, 'role' | 'aria-live' | 'style'> {
|
|
567
|
+
/** Error title to display */
|
|
568
|
+
title: string;
|
|
569
|
+
/** Raw error message to display and copy */
|
|
570
|
+
rawError: string;
|
|
571
|
+
/** Custom CSS classes for the container */
|
|
572
|
+
className?: string;
|
|
573
|
+
/** Custom ARIA label for the error container */
|
|
574
|
+
'aria-label'?: string;
|
|
575
|
+
/** Callback fired when copy operation completes */
|
|
576
|
+
onCopyComplete?: (success: boolean) => void;
|
|
577
|
+
/** Customization options */
|
|
578
|
+
customization?: ToastErrorCustomization;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* A highly customizable error toast component with copy functionality and extensive styling options.
|
|
582
|
+
* Provides comprehensive customization for appearance, behavior, and event handling while maintaining accessibility.
|
|
583
|
+
*/
|
|
584
|
+
declare const ToastError: React$1.ForwardRefExoticComponent<ToastErrorProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
585
|
+
|
|
586
|
+
export { type ButtonTxStatus as B, type ConnectContentType as C, type ErrorsProviderCustomization as E, type NovaConnectLabels as N, type ToastErrorCustomization as T, type WalletBalance as W, type NativeBalanceResult as a, type NovaConnectProviderType as b, type NovaConnectProviderProps as c, NovaConnectProvider as d, type NovaConnectProviderCustomization as e, type ToastErrorProps as f, ToastError as g, type ConnectedContentType as h, NovaConnectProviderError as i, NovaConnectProviderContext as j, useHasNovaConnectContext as k, useNovaConnectOptional as l, useWalletNativeBalance as m, type ErrorsProviderProps as n, ErrorsProvider as o, type NovaConnectProviderPropsWithCustomization as p, useNovaConnect as u };
|