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