@tuwaio/nova-connect 0.8.0 → 0.8.2

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.
@@ -1,10 +1,10 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default, { ComponentPropsWithoutRef, ComponentType, ReactNode } from 'react';
3
+ import { N as NovaConnectLabels } from './types-CnOiSyvZ.cjs';
4
+ import { Variants, Easing } from 'framer-motion';
3
5
  import { OrbitAdapter } from '@tuwaio/orbit-core';
4
6
  import { TransactionPool, Transaction, TxAdapter } from '@tuwaio/pulsar-core';
5
- import { N as NovaConnectLabels } from './types-CnOiSyvZ.cjs';
6
7
  import { SatelliteSiwxFieldOptions, UseSiwxSignInOptions } from '@tuwaio/siwx-react';
7
- import { Variants, Easing } from 'framer-motion';
8
8
 
9
9
  /**
10
10
  * Chain configuration types of the networks the app imports. Importing `@tuwaio/nova-connect/evm` adds `appChains`
@@ -50,509 +50,108 @@ interface AllChainConfigs {
50
50
  type InitialChains = AllChainConfigs;
51
51
 
52
52
  /**
53
- * @file ConnectedModalTxHistory component with comprehensive customization options for transaction history display.
53
+ * @file Headless SIWX auto-authentication watcher for NovaConnect.
54
+ * Monitors active wallet connections and automatically triggers SIWX signing prompts.
54
55
  */
55
56
 
56
57
  /**
57
- * Local mirror of TxInMemoryPagination from @tuwaio/pulsar-core.
58
- * Defined inline because pulsar-core is an optional peer dependency in nova-connect.
58
+ * Props of {@link NovaSiwxWatcher} (the `siwx` prop of `NovaConnectProvider`): the sign-in callbacks and the SIWX
59
+ * message fields of `getSatelliteSiwxFields` from `@tuwaio/siwx-react` (`domain`, `uri`, `statement`, and so on).
59
60
  */
60
- type LocalTxPagination = {
61
- /** Indicates whether the store is currently loading transaction history. */
62
- isLoading: boolean;
63
- /** Indicates whether the last loading request ended with an error. */
64
- isError: boolean;
65
- /** Indicates whether more history pages are available. */
66
- hasMore: boolean;
67
- /** The current page number in the paginated history. */
68
- currentPage: number;
61
+ interface NovaSiwxWatcherProps extends SatelliteSiwxFieldOptions {
62
+ /** Whether to ask connected wallets to sign in (default: `true`) */
63
+ enabled?: boolean;
64
+ /** Fetches the nonce of the SIWX message from your backend */
65
+ getNonce?: () => Promise<string>;
66
+ /** Verifies the signed message on your backend (required for the sign-in) */
67
+ verifier?: UseSiwxSignInOptions['verifier'];
69
68
  /**
70
- * Loads the next page of transaction history and appends it to the pool.
71
- *
72
- * @param walletAddress - The address whose history is loaded.
73
- * @returns Resolves when the page is loaded.
69
+ * Optional callback triggered when the wallet disconnects or when `signOut` is called.
70
+ * Useful for hitting a `/logout` endpoint to clear the backend cookie.
74
71
  */
75
- fetchNextPage: (walletAddress: string) => Promise<void>;
76
- };
72
+ destroyer?: () => Promise<void>;
73
+ /** Optional callback triggered immediately after successful SIWX authentication */
74
+ onSuccess?: UseSiwxSignInOptions['onSuccess'];
75
+ /** Optional callback triggered if SIWX signing or verification fails */
76
+ onError?: UseSiwxSignInOptions['onError'];
77
+ }
77
78
  /**
78
- * Local customization options for TransactionsHistory component.
79
- * This is a copy of the type from @tuwaio/nova-transactions to avoid
80
- * breaking dynamic import logic.
79
+ * Signs the connected wallet in with SIWX. `NovaConnectProvider` renders it with its `siwx` prop, so apps do not
80
+ * render it themselves. It renders nothing.
81
+ *
82
+ * - When a wallet connects (or the account changes), it asks the wallet to sign a SIWX message once per address
83
+ * (`signIn` of `useSiwx` from `@tuwaio/siwx-react`: a wallet prompt, then `getNonce` and `verifier` requests to your
84
+ * backend). A rejected or failed sign-in disconnects that wallet (if it is still the active one) and calls
85
+ * `onError`. Without `verifier` it logs a warning and does not sign in.
86
+ * - When no wallet is connected, it clears the SIWX session and calls `destroyer`. After a page load it waits until
87
+ * Satellite Connect has finished reconnecting (`isAutoConnectFinished`), so the session restored by
88
+ * `@tuwaio/siwx-react` is kept.
89
+ *
90
+ * @param props - See {@link NovaSiwxWatcherProps}.
91
+ * @returns `null`.
81
92
  */
82
- type LocalTransactionsHistoryCustomization = {
83
- /** Custom title for the transactions history section */
84
- title?: string;
85
- /** Custom class name generators */
86
- classNames?: {
87
- /** Classes for the outer container */
88
- container?: string;
89
- /** Classes for the title element */
90
- titleText?: string;
91
- /** Classes for the list wrapper container */
92
- listWrapper?: string;
93
- /** Classes for the placeholder container */
94
- placeholderContainer?: string;
95
- /** Classes for the placeholder title */
96
- placeholderTitle?: string;
97
- /** Classes for the placeholder message */
98
- placeholderMessage?: string;
99
- /** Classes for the infinite scroll loader container */
100
- loaderContainer?: string;
101
- /** Classes for the infinite scroll loader icon (spinner) */
102
- loaderIcon?: string;
103
- /** Classes for the error indicator container */
104
- errorContainer?: string;
105
- /** Classes for the error indicator icon */
106
- errorIcon?: string;
107
- /** Classes for individual transaction item container */
108
- itemContainer?: string;
109
- /** Classes for the icon wrapper */
110
- itemIconWrapper?: string;
111
- /** Classes for the icon itself */
112
- itemIcon?: string;
113
- /** Classes for the content wrapper */
114
- itemContentWrapper?: string;
115
- /** Classes for the title text */
116
- itemTitle?: string;
117
- /** Classes for the timestamp text */
118
- itemTimestamp?: string;
119
- /** Classes for the description text */
120
- itemDescription?: string;
121
- /** Classes for the status badge container */
122
- itemStatusBadge?: string;
123
- /** Classes for the status badge icon */
124
- itemStatusBadgeIcon?: string;
125
- /** Classes for the status badge label */
126
- itemStatusBadgeLabel?: string;
127
- /** Classes for the transaction key container */
128
- itemTxKeyContainer?: string;
129
- /** Classes for the default hash link label */
130
- itemHashLabel?: string;
131
- /** Classes for the default hash link */
132
- itemHashLink?: string;
133
- /** Classes for the default hash copy button */
134
- itemHashCopyButton?: string;
135
- /** Classes for the original hash link label (replaced transactions) */
136
- itemOriginalHashLabel?: string;
137
- /** Classes for the original hash link (replaced transactions) */
138
- itemOriginalHashLink?: string;
139
- /** Classes for the original hash copy button (replaced transactions) */
140
- itemOriginalHashCopyButton?: string;
141
- };
142
- };
93
+ declare function NovaSiwxWatcher(props: NovaSiwxWatcherProps): null;
94
+
143
95
  /**
144
- * Props for a custom loading state (shown while `@tuwaio/nova-transactions` loads).
96
+ * Status of the latest transaction of the active wallet, shown by the connect button: `loading` while it is pending,
97
+ * then `succeed`, `failed` or `replaced`, and `idle` otherwise.
145
98
  */
146
- type ConnectedModalTxHistoryLoadingContainerProps = {
147
- /** The Nova Connect labels */
148
- labels: Record<string, string>;
149
- /** Classes from `classNames.loadingContainer` */
150
- className?: string;
151
- /** Granular classNames for sub-elements */
152
- classNames?: {
153
- /** From `classNames.loadingSpinner` */
154
- spinner?: string;
155
- /** From `classNames.loadingText` */
156
- text?: string;
157
- };
158
- };
99
+ type ButtonTxStatus = 'idle' | 'loading' | 'succeed' | 'failed' | 'replaced';
159
100
  /**
160
- * Props for a custom error state (shown when `@tuwaio/nova-transactions` cannot be loaded or its component throws).
101
+ * Screen of the connect modal: `connectors` (wallet list), `network` (network choice of a multi-network wallet),
102
+ * `connecting`, `about` ("About wallets"), `getWallet` ("Get a wallet") or `impersonate` (impersonation form).
161
103
  */
162
- type ConnectedModalTxHistoryErrorContainerProps = {
163
- /** Classes from `classNames.errorContainer` */
164
- className?: string;
165
- /** Granular classNames for sub-elements */
166
- classNames?: {
167
- /** From `classNames.errorIconContainer` */
168
- iconContainer?: string;
169
- /** From `classNames.errorIcon` */
170
- icon?: string;
171
- /** From `classNames.errorContent` */
172
- content?: string;
173
- /** From `classNames.errorTitle` */
174
- title?: string;
175
- /** From `classNames.errorDescription` */
176
- description?: string;
177
- };
178
- };
104
+ type ConnectContentType = 'network' | 'connectors' | 'about' | 'getWallet' | 'connecting' | 'impersonate';
179
105
  /**
180
- * Props for a custom state without a connected wallet.
106
+ * Screen of the connected modal: `main`, `transactions` (history), `chains` (network switch) or `connections`
107
+ * (connected and recent wallets).
181
108
  */
182
- type ConnectedModalTxHistoryNoWalletContainerProps = {
183
- /** Classes from `classNames.noWalletContainer` */
184
- className?: string;
185
- /** Granular classNames for sub-elements */
186
- classNames?: {
187
- /** From `classNames.noWalletText` */
188
- text?: string;
189
- };
190
- };
109
+ type ConnectedContentType = 'main' | 'transactions' | 'chains' | 'connections';
110
+ /** Legal configuration for Terms of Service and Privacy Policy links */
111
+ interface LegalConfig {
112
+ /** URL of the terms of service */
113
+ termsUrl?: string;
114
+ /** URL of the privacy policy */
115
+ privacyUrl?: string;
116
+ }
191
117
  /**
192
- * Props for a custom wrapper of the `TransactionsHistory` of `@tuwaio/nova-transactions`.
118
+ * Props of `NovaConnectProvider`. `appChains` and `solanaRPCUrls` give the chains of the app; without both, the
119
+ * modals are not rendered.
193
120
  */
194
- type ConnectedModalTxHistoryTransactionsHistoryWrapperProps = {
195
- /** The transaction history */
196
- children: ReactNode;
197
- /** The active address */
198
- activeConnectionAddress: string;
199
- /** The `transactionPool` prop */
200
- transactionPool: NonNullable<NovaConnectProviderProps['transactionPool']>;
201
- /** The `pulsarAdapter` prop */
202
- pulsarAdapter: NonNullable<NovaConnectProviderProps['pulsarAdapter']>;
203
- /** The Nova Connect labels */
204
- labels: Record<string, string>;
205
- /** Classes from `classNames.transactionsHistoryWrapper` */
206
- className?: string;
207
- };
121
+ interface NovaConnectProviderProps extends InitialChains {
122
+ /** Transaction pool of Pulsar: the connect button shows the status of the latest transaction of the wallet */
123
+ transactionPool?: TransactionPool<Transaction>;
124
+ /** Pulsar adapter(s); with `transactionPool`, the connected modal shows the transaction history */
125
+ pulsarAdapter?: TxAdapter<Transaction> | TxAdapter<Transaction>[];
126
+ /** Whether the connect button shows the native balance */
127
+ withBalance?: boolean;
128
+ /** Whether the connect button shows a chain selector */
129
+ withChain?: boolean;
130
+ /** Whether the wallet list offers the impersonated wallet (a read-only address, for development) */
131
+ withImpersonated?: boolean;
132
+ /** Wallet names of the "Popular" group, in order (default: WalletConnect, Porto, Coinbase, Gemini) */
133
+ popularConnectors?: string[];
134
+ /** Extra wallet groups of the wallet list: group title → wallet names, in order */
135
+ customConnectorGroups?: Record<string, string[]>;
136
+ /** Legal configuration for Terms of Service and Privacy Policy links */
137
+ legal?: LegalConfig;
138
+ /**
139
+ * SIWX sign-in of the connected wallet (see `NovaSiwxWatcher`). Without it, Nova Connect does not sign in and does
140
+ * not touch the SIWX session.
141
+ */
142
+ siwx?: NovaSiwxWatcherProps;
143
+ /**
144
+ * Pagination state for infinite scroll, forwarded to ConnectedModalTxHistory and TransactionsHistory.
145
+ * Mirrors TxInMemoryPagination from @tuwaio/pulsar-core (optional peer dependency).
146
+ */
147
+ pagination?: LocalTxPagination;
148
+ /** The app */
149
+ children: React.ReactNode;
150
+ /** Texts to override, merged over the English defaults */
151
+ labels?: Partial<NovaConnectLabels>;
152
+ }
208
153
  /**
209
- * Customization options of {@link ConnectedModalTxHistory}.
210
- */
211
- type ConnectedModalTxHistoryCustomization = {
212
- /** Props of the container (the component props, `className` and `aria-label` take precedence) */
213
- containerProps?: Partial<Omit<ComponentPropsWithoutRef<'div'>, 'popover' | 'onDrag' | 'onDragEnd' | 'onDragExit' | 'onDragStart' | 'onDragStartCapture' | 'onAnimationStart' | 'onAnimationEnd' | 'onAnimationStartCapture' | 'onAnimationEndCapture' | 'onAnimationIteration' | 'onAnimationIterationCapture'>>;
214
- /** Custom components */
215
- components?: {
216
- /** Custom loading container component */
217
- LoadingContainer?: ComponentType<ConnectedModalTxHistoryLoadingContainerProps>;
218
- /** Custom error container component */
219
- ErrorContainer?: ComponentType<ConnectedModalTxHistoryErrorContainerProps>;
220
- /** Custom no wallet container component */
221
- NoWalletContainer?: ComponentType<ConnectedModalTxHistoryNoWalletContainerProps>;
222
- /** Custom transactions history wrapper component */
223
- TransactionsHistoryWrapper?: ComponentType<ConnectedModalTxHistoryTransactionsHistoryWrapperProps>;
224
- };
225
- /** Custom class name generators */
226
- classNames?: {
227
- /**
228
- * Returns the classes of the container, instead of the default ones and the `className` prop.
229
- *
230
- * @param params - The state.
231
- * @param params.hasActiveWallet - Whether a wallet is connected.
232
- * @param params.hasValidAdapter - Whether `transactionPool` and `pulsarAdapter` are set.
233
- * @returns The classes.
234
- */
235
- container?: (params: {
236
- hasActiveWallet: boolean;
237
- hasValidAdapter: boolean;
238
- }) => string;
239
- /**
240
- * Returns classes of the loading state, added to the default ones.
241
- *
242
- * @returns The classes.
243
- */
244
- loadingContainer?: () => string;
245
- /**
246
- * Returns classes of the loading spinner, added to the default ones.
247
- *
248
- * @returns The classes.
249
- */
250
- loadingSpinner?: () => string;
251
- /**
252
- * Returns classes of the loading text, added to the default ones.
253
- *
254
- * @returns The classes.
255
- */
256
- loadingText?: () => string;
257
- /**
258
- * Returns classes of the error state, added to the default ones.
259
- *
260
- * @returns The classes.
261
- */
262
- errorContainer?: () => string;
263
- /**
264
- * Returns classes of the error icon container, added to the default ones.
265
- *
266
- * @returns The classes.
267
- */
268
- errorIconContainer?: () => string;
269
- /**
270
- * Returns classes of the error icon, added to the default ones.
271
- *
272
- * @returns The classes.
273
- */
274
- errorIcon?: () => string;
275
- /**
276
- * Returns classes of the error texts, added to the default ones.
277
- *
278
- * @returns The classes.
279
- */
280
- errorContent?: () => string;
281
- /**
282
- * Returns classes of the error title, added to the default ones.
283
- *
284
- * @returns The classes.
285
- */
286
- errorTitle?: () => string;
287
- /**
288
- * Returns classes of the error description, added to the default ones.
289
- *
290
- * @returns The classes.
291
- */
292
- errorDescription?: () => string;
293
- /**
294
- * Returns classes of the state without a wallet, added to the default ones.
295
- *
296
- * @returns The classes.
297
- */
298
- noWalletContainer?: () => string;
299
- /**
300
- * Returns classes of the text without a wallet, added to the default ones.
301
- *
302
- * @returns The classes.
303
- */
304
- noWalletText?: () => string;
305
- /**
306
- * Returns classes of the "Pulsar adapter required" state, instead of the default ones.
307
- *
308
- * @returns The classes.
309
- */
310
- pulsarRequiredContainer?: () => string;
311
- /**
312
- * Returns classes of its icon container, instead of the default ones.
313
- *
314
- * @returns The classes.
315
- */
316
- pulsarRequiredIconContainer?: () => string;
317
- /**
318
- * Returns classes of its icon, instead of the default ones.
319
- *
320
- * @returns The classes.
321
- */
322
- pulsarRequiredIcon?: () => string;
323
- /**
324
- * Returns classes of its texts, instead of the default ones.
325
- *
326
- * @returns The classes.
327
- */
328
- pulsarRequiredContent?: () => string;
329
- /**
330
- * Returns classes of its title, instead of the default ones.
331
- *
332
- * @returns The classes.
333
- */
334
- pulsarRequiredTitle?: () => string;
335
- /**
336
- * Returns classes of its description, instead of the default ones.
337
- *
338
- * @returns The classes.
339
- */
340
- pulsarRequiredDescription?: () => string;
341
- /**
342
- * Returns classes of the transaction history wrapper, added to the default ones.
343
- *
344
- * @returns The classes.
345
- */
346
- transactionsHistoryWrapper?: () => string;
347
- };
348
- /** Custom animation variants */
349
- variants?: {
350
- /** Container animation variants (`initial`, `animate`, `exit`) */
351
- container?: Variants;
352
- /** Variants of the "Pulsar adapter required" state */
353
- error?: Variants;
354
- };
355
- /** Custom animation configuration */
356
- animation?: {
357
- /** Container animation configuration */
358
- container?: {
359
- /** Animation duration in seconds */
360
- duration?: number;
361
- /** Animation easing curve */
362
- ease?: Easing | Easing[];
363
- /** Animation delay in seconds */
364
- delay?: number;
365
- };
366
- /** Animation of the "Pulsar adapter required" state */
367
- error?: {
368
- /** Animation duration in seconds */
369
- duration?: number;
370
- /** Animation easing curve */
371
- ease?: Easing | Easing[];
372
- /** Animation delay in seconds */
373
- delay?: number;
374
- };
375
- };
376
- /** Custom event handlers */
377
- handlers?: {
378
- /**
379
- * Called when `@tuwaio/nova-transactions` fails to load or its `TransactionsHistory` throws.
380
- *
381
- * @param packageName - `config.packageName`.
382
- * @param error - The error.
383
- */
384
- onPackageLoadingFailure?: (packageName: string, error: Error) => void;
385
- };
386
- /** Configuration options */
387
- config?: {
388
- /** Renders without Framer Motion (default: `false`) */
389
- disableAnimation?: boolean;
390
- /** Same as `disableAnimation` (default: `false`) */
391
- reduceMotion?: boolean;
392
- /** Name passed to `handlers.onPackageLoadingFailure` (default: `@tuwaio/nova-transactions`) */
393
- packageName?: string;
394
- /** Custom aria labels for different states */
395
- ariaLabels?: {
396
- /** ARIA label of the container, after the `aria-label` prop (default: the `transactionsInApp` label) */
397
- transactionsHistory?: string;
398
- };
399
- };
400
- /**
401
- * Customization for the TransactionsHistory component (from @tuwaio/nova-transactions).
402
- * Passed through to the dynamically loaded component.
403
- */
404
- transactionsHistory?: LocalTransactionsHistoryCustomization;
405
- };
406
- /**
407
- * Props for the {@link ConnectedModalTxHistory} component. Without `transactionPool` and `pulsarAdapter` (Pulsar)
408
- * the "Pulsar adapter required" state is shown. Other props are passed to the container.
409
- */
410
- interface ConnectedModalTxHistoryProps extends Pick<NovaConnectProviderProps, 'transactionPool' | 'pulsarAdapter'> {
411
- /** Classes added to the default container classes (ignored when `classNames.container` is set) */
412
- className?: string;
413
- /** ARIA label of the container (default: the `transactionsInApp` label) */
414
- 'aria-label'?: string;
415
- /** Customization options */
416
- customization?: ConnectedModalTxHistoryCustomization;
417
- /** Pagination state for infinite scroll, forwarded to TransactionsHistory. */
418
- pagination?: LocalTxPagination;
419
- }
420
- /**
421
- * The transaction history screen of the connected modal: the `TransactionsHistory` of `@tuwaio/nova-transactions`
422
- * for the active address (loaded with a dynamic import, without the details view). Shows a loading state while the
423
- * package loads, an error state when it cannot be loaded, a "Pulsar adapter required" state without
424
- * `transactionPool` and `pulsarAdapter`, and a message without a connected wallet.
425
- *
426
- * Props: {@link ConnectedModalTxHistoryProps}; the ref is forwarded to the container.
427
- *
428
- * @example
429
- * ```tsx
430
- * import { ConnectedModalTxHistory } from '@tuwaio/nova-connect/components';
431
- * import type { NovaConnectProviderProps } from '@tuwaio/nova-connect/hooks';
432
- *
433
- * type HistoryProps = Pick<NovaConnectProviderProps, 'transactionPool' | 'pulsarAdapter'>;
434
- *
435
- * export function History({ transactionPool, pulsarAdapter }: HistoryProps) {
436
- * return (
437
- * <ConnectedModalTxHistory
438
- * transactionPool={transactionPool}
439
- * pulsarAdapter={pulsarAdapter}
440
- * customization={{
441
- * classNames: { loadingContainer: () => 'bg-blue-100' },
442
- * handlers: {
443
- * onPackageLoadingFailure: (packageName, error) => console.error(packageName, error),
444
- * },
445
- * }}
446
- * />
447
- * );
448
- * }
449
- * ```
450
- */
451
- declare const ConnectedModalTxHistory: React__default.ForwardRefExoticComponent<ConnectedModalTxHistoryProps & React__default.RefAttributes<HTMLDivElement>>;
452
-
453
- /**
454
- * @file Headless SIWX auto-authentication watcher for NovaConnect.
455
- * Monitors active wallet connections and automatically triggers SIWX signing prompts.
456
- */
457
-
458
- /**
459
- * Props of {@link NovaSiwxWatcher} (the `siwx` prop of `NovaConnectProvider`): the sign-in callbacks and the SIWX
460
- * message fields of `getSatelliteSiwxFields` from `@tuwaio/siwx-react` (`domain`, `uri`, `statement`, and so on).
461
- */
462
- interface NovaSiwxWatcherProps extends SatelliteSiwxFieldOptions {
463
- /** Whether to ask connected wallets to sign in (default: `true`) */
464
- enabled?: boolean;
465
- /** Fetches the nonce of the SIWX message from your backend */
466
- getNonce?: () => Promise<string>;
467
- /** Verifies the signed message on your backend (required for the sign-in) */
468
- verifier?: UseSiwxSignInOptions['verifier'];
469
- /**
470
- * Optional callback triggered when the wallet disconnects or when `signOut` is called.
471
- * Useful for hitting a `/logout` endpoint to clear the backend cookie.
472
- */
473
- destroyer?: () => Promise<void>;
474
- /** Optional callback triggered immediately after successful SIWX authentication */
475
- onSuccess?: UseSiwxSignInOptions['onSuccess'];
476
- /** Optional callback triggered if SIWX signing or verification fails */
477
- onError?: UseSiwxSignInOptions['onError'];
478
- }
479
- /**
480
- * Signs the connected wallet in with SIWX. `NovaConnectProvider` renders it with its `siwx` prop, so apps do not
481
- * render it themselves. It renders nothing.
482
- *
483
- * - When a wallet connects (or the account changes), it asks the wallet to sign a SIWX message once per address
484
- * (`signIn` of `useSiwx` from `@tuwaio/siwx-react`: a wallet prompt, then `getNonce` and `verifier` requests to your
485
- * backend). A rejected or failed sign-in disconnects that wallet (if it is still the active one) and calls
486
- * `onError`. Without `verifier` it logs a warning and does not sign in.
487
- * - When no wallet is connected, it clears the SIWX session and calls `destroyer`. After a page load it waits until
488
- * Satellite Connect has finished reconnecting (`isAutoConnectFinished`), so the session restored by
489
- * `@tuwaio/siwx-react` is kept.
490
- *
491
- * @param props - See {@link NovaSiwxWatcherProps}.
492
- * @returns `null`.
493
- */
494
- declare function NovaSiwxWatcher(props: NovaSiwxWatcherProps): null;
495
-
496
- /**
497
- * Status of the latest transaction of the active wallet, shown by the connect button: `loading` while it is pending,
498
- * then `succeed`, `failed` or `replaced`, and `idle` otherwise.
499
- */
500
- type ButtonTxStatus = 'idle' | 'loading' | 'succeed' | 'failed' | 'replaced';
501
- /**
502
- * Screen of the connect modal: `connectors` (wallet list), `network` (network choice of a multi-network wallet),
503
- * `connecting`, `about` ("About wallets"), `getWallet` ("Get a wallet") or `impersonate` (impersonation form).
504
- */
505
- type ConnectContentType = 'network' | 'connectors' | 'about' | 'getWallet' | 'connecting' | 'impersonate';
506
- /**
507
- * Screen of the connected modal: `main`, `transactions` (history), `chains` (network switch) or `connections`
508
- * (connected and recent wallets).
509
- */
510
- type ConnectedContentType = 'main' | 'transactions' | 'chains' | 'connections';
511
- /** Legal configuration for Terms of Service and Privacy Policy links */
512
- interface LegalConfig {
513
- /** URL of the terms of service */
514
- termsUrl?: string;
515
- /** URL of the privacy policy */
516
- privacyUrl?: string;
517
- }
518
- /**
519
- * Props of `NovaConnectProvider`. `appChains` and `solanaRPCUrls` give the chains of the app; without both, the
520
- * modals are not rendered.
521
- */
522
- interface NovaConnectProviderProps extends InitialChains {
523
- /** Transaction pool of Pulsar: the connect button shows the status of the latest transaction of the wallet */
524
- transactionPool?: TransactionPool<Transaction>;
525
- /** Pulsar adapter(s); with `transactionPool`, the connected modal shows the transaction history */
526
- pulsarAdapter?: TxAdapter<Transaction> | TxAdapter<Transaction>[];
527
- /** Whether the connect button shows the native balance */
528
- withBalance?: boolean;
529
- /** Whether the connect button shows a chain selector */
530
- withChain?: boolean;
531
- /** Whether the wallet list offers the impersonated wallet (a read-only address, for development) */
532
- withImpersonated?: boolean;
533
- /** Wallet names of the "Popular" group, in order (default: WalletConnect, Porto, Coinbase, Gemini) */
534
- popularConnectors?: string[];
535
- /** Extra wallet groups of the wallet list: group title → wallet names, in order */
536
- customConnectorGroups?: Record<string, string[]>;
537
- /** Legal configuration for Terms of Service and Privacy Policy links */
538
- legal?: LegalConfig;
539
- /**
540
- * SIWX sign-in of the connected wallet (see `NovaSiwxWatcher`). Without it, Nova Connect does not sign in and does
541
- * not touch the SIWX session.
542
- */
543
- siwx?: NovaSiwxWatcherProps;
544
- /**
545
- * Pagination state for infinite scroll, forwarded to ConnectedModalTxHistory and TransactionsHistory.
546
- * Mirrors TxInMemoryPagination from @tuwaio/pulsar-core (optional peer dependency).
547
- */
548
- pagination?: LocalTxPagination;
549
- /** The app */
550
- children: React.ReactNode;
551
- /** Texts to override, merged over the English defaults */
552
- labels?: Partial<NovaConnectLabels>;
553
- }
554
- /**
555
- * A native balance.
154
+ * A native balance.
556
155
  */
557
156
  interface WalletBalance {
558
157
  /** Formatted amount */
@@ -875,44 +474,445 @@ interface NativeBalanceResult {
875
474
  symbol: string;
876
475
  }
877
476
  /**
878
- * The balance of {@link useWalletNativeBalance}, or `null` when it is not known.
477
+ * The balance of {@link useWalletNativeBalance}, or `null` when it is not known.
478
+ */
479
+ type UseWalletNativeBalanceState = NativeBalanceResult | null;
480
+ /**
481
+ * Result of {@link useWalletNativeBalance}.
482
+ */
483
+ interface UseWalletNativeBalanceData {
484
+ /** The balance, or `null` without a wallet, without `getBalance` or before it resolves */
485
+ balance: UseWalletNativeBalanceState;
486
+ /** Whether the balance is being requested */
487
+ isLoading: boolean;
488
+ /** Requests the balance again (a failed refresh clears the kept balance) */
489
+ refetch: () => void;
490
+ }
491
+ /**
492
+ * Returns the native balance of the active wallet on its chain, from `getBalance` of its Satellite adapter (an RPC
493
+ * request). Each balance is kept in memory for the address and chain while the component is mounted, so switching
494
+ * back does not request it again; `refetch` requests it again.
495
+ *
496
+ * @returns See {@link UseWalletNativeBalanceData}.
497
+ *
498
+ * @example
499
+ * ```tsx
500
+ * import { useWalletNativeBalance } from '@tuwaio/nova-connect/hooks';
501
+ *
502
+ * export function NativeBalance() {
503
+ * const { balance, isLoading, refetch } = useWalletNativeBalance();
504
+ *
505
+ * if (isLoading) return <p>Loading balance...</p>;
506
+ *
507
+ * return (
508
+ * <p>
509
+ * {balance ? `${balance.value} ${balance.symbol}` : 'n/a'} <button onClick={refetch}>Refresh</button>
510
+ * </p>
511
+ * );
512
+ * }
513
+ * ```
514
+ */
515
+ declare function useWalletNativeBalance(): UseWalletNativeBalanceData;
516
+
517
+ /**
518
+ * @file ConnectedModalTxHistory component with comprehensive customization options for transaction history display.
519
+ */
520
+
521
+ /**
522
+ * Local mirror of TxInMemoryPagination from @tuwaio/pulsar-core.
523
+ * Defined inline because pulsar-core is an optional peer dependency in nova-connect.
524
+ */
525
+ type LocalTxPagination = {
526
+ /** Indicates whether the store is currently loading transaction history. */
527
+ isLoading: boolean;
528
+ /** Indicates whether the last loading request ended with an error. */
529
+ isError: boolean;
530
+ /** Indicates whether more history pages are available. */
531
+ hasMore: boolean;
532
+ /** The current page number in the paginated history. */
533
+ currentPage: number;
534
+ /**
535
+ * Loads the next page of transaction history and appends it to the pool.
536
+ *
537
+ * @param walletAddress - The address whose history is loaded.
538
+ * @returns Resolves when the page is loaded.
539
+ */
540
+ fetchNextPage: (walletAddress: string) => Promise<void>;
541
+ };
542
+ /**
543
+ * Local customization options for TransactionsHistory component.
544
+ * This is a copy of the type from @tuwaio/nova-transactions to avoid
545
+ * breaking dynamic import logic.
546
+ */
547
+ type LocalTransactionsHistoryCustomization = {
548
+ /** Custom title for the transactions history section */
549
+ title?: string;
550
+ /** Custom class name generators */
551
+ classNames?: {
552
+ /** Classes for the outer container */
553
+ container?: string;
554
+ /** Classes for the title element */
555
+ titleText?: string;
556
+ /** Classes for the list wrapper container */
557
+ listWrapper?: string;
558
+ /** Classes for the placeholder container */
559
+ placeholderContainer?: string;
560
+ /** Classes for the placeholder title */
561
+ placeholderTitle?: string;
562
+ /** Classes for the placeholder message */
563
+ placeholderMessage?: string;
564
+ /** Classes for the infinite scroll loader container */
565
+ loaderContainer?: string;
566
+ /** Classes for the infinite scroll loader icon (spinner) */
567
+ loaderIcon?: string;
568
+ /** Classes for the error indicator container */
569
+ errorContainer?: string;
570
+ /** Classes for the error indicator icon */
571
+ errorIcon?: string;
572
+ /** Classes for individual transaction item container */
573
+ itemContainer?: string;
574
+ /** Classes for the icon wrapper */
575
+ itemIconWrapper?: string;
576
+ /** Classes for the icon itself */
577
+ itemIcon?: string;
578
+ /** Classes for the content wrapper */
579
+ itemContentWrapper?: string;
580
+ /** Classes for the title text */
581
+ itemTitle?: string;
582
+ /** Classes for the timestamp text */
583
+ itemTimestamp?: string;
584
+ /** Classes for the description text */
585
+ itemDescription?: string;
586
+ /** Classes for the status badge container */
587
+ itemStatusBadge?: string;
588
+ /** Classes for the status badge icon */
589
+ itemStatusBadgeIcon?: string;
590
+ /** Classes for the status badge label */
591
+ itemStatusBadgeLabel?: string;
592
+ /** Classes for the transaction key container */
593
+ itemTxKeyContainer?: string;
594
+ /** Classes for the default hash link label */
595
+ itemHashLabel?: string;
596
+ /** Classes for the default hash link */
597
+ itemHashLink?: string;
598
+ /** Classes for the default hash copy button */
599
+ itemHashCopyButton?: string;
600
+ /** Classes for the original hash link label (replaced transactions) */
601
+ itemOriginalHashLabel?: string;
602
+ /** Classes for the original hash link (replaced transactions) */
603
+ itemOriginalHashLink?: string;
604
+ /** Classes for the original hash copy button (replaced transactions) */
605
+ itemOriginalHashCopyButton?: string;
606
+ };
607
+ };
608
+ /**
609
+ * Props for a custom loading state (shown while `@tuwaio/nova-transactions` loads).
610
+ */
611
+ type ConnectedModalTxHistoryLoadingContainerProps = {
612
+ /** The Nova Connect labels */
613
+ labels: Record<string, string>;
614
+ /** Classes from `classNames.loadingContainer` */
615
+ className?: string;
616
+ /** Granular classNames for sub-elements */
617
+ classNames?: {
618
+ /** From `classNames.loadingSpinner` */
619
+ spinner?: string;
620
+ /** From `classNames.loadingText` */
621
+ text?: string;
622
+ };
623
+ };
624
+ /**
625
+ * Props for a custom error state (shown when `@tuwaio/nova-transactions` cannot be loaded or its component throws).
626
+ */
627
+ type ConnectedModalTxHistoryErrorContainerProps = {
628
+ /** Classes from `classNames.errorContainer` */
629
+ className?: string;
630
+ /** Granular classNames for sub-elements */
631
+ classNames?: {
632
+ /** From `classNames.errorIconContainer` */
633
+ iconContainer?: string;
634
+ /** From `classNames.errorIcon` */
635
+ icon?: string;
636
+ /** From `classNames.errorContent` */
637
+ content?: string;
638
+ /** From `classNames.errorTitle` */
639
+ title?: string;
640
+ /** From `classNames.errorDescription` */
641
+ description?: string;
642
+ };
643
+ };
644
+ /**
645
+ * Props for a custom state without a connected wallet.
646
+ */
647
+ type ConnectedModalTxHistoryNoWalletContainerProps = {
648
+ /** Classes from `classNames.noWalletContainer` */
649
+ className?: string;
650
+ /** Granular classNames for sub-elements */
651
+ classNames?: {
652
+ /** From `classNames.noWalletText` */
653
+ text?: string;
654
+ };
655
+ };
656
+ /**
657
+ * Props for a custom wrapper of the `TransactionsHistory` of `@tuwaio/nova-transactions`.
658
+ */
659
+ type ConnectedModalTxHistoryTransactionsHistoryWrapperProps = {
660
+ /** The transaction history */
661
+ children: ReactNode;
662
+ /** The active address */
663
+ activeConnectionAddress: string;
664
+ /** The `transactionPool` prop */
665
+ transactionPool: NonNullable<NovaConnectProviderProps['transactionPool']>;
666
+ /** The `pulsarAdapter` prop */
667
+ pulsarAdapter: NonNullable<NovaConnectProviderProps['pulsarAdapter']>;
668
+ /** The Nova Connect labels */
669
+ labels: Record<string, string>;
670
+ /** Classes from `classNames.transactionsHistoryWrapper` */
671
+ className?: string;
672
+ };
673
+ /**
674
+ * Customization options of {@link ConnectedModalTxHistory}.
879
675
  */
880
- type UseWalletNativeBalanceState = NativeBalanceResult | null;
676
+ type ConnectedModalTxHistoryCustomization = {
677
+ /** Props of the container (the component props, `className` and `aria-label` take precedence) */
678
+ containerProps?: Partial<Omit<ComponentPropsWithoutRef<'div'>, 'popover' | 'onDrag' | 'onDragEnd' | 'onDragExit' | 'onDragStart' | 'onDragStartCapture' | 'onAnimationStart' | 'onAnimationEnd' | 'onAnimationStartCapture' | 'onAnimationEndCapture' | 'onAnimationIteration' | 'onAnimationIterationCapture'>>;
679
+ /** Custom components */
680
+ components?: {
681
+ /** Custom loading container component */
682
+ LoadingContainer?: ComponentType<ConnectedModalTxHistoryLoadingContainerProps>;
683
+ /** Custom error container component */
684
+ ErrorContainer?: ComponentType<ConnectedModalTxHistoryErrorContainerProps>;
685
+ /** Custom no wallet container component */
686
+ NoWalletContainer?: ComponentType<ConnectedModalTxHistoryNoWalletContainerProps>;
687
+ /** Custom transactions history wrapper component */
688
+ TransactionsHistoryWrapper?: ComponentType<ConnectedModalTxHistoryTransactionsHistoryWrapperProps>;
689
+ };
690
+ /** Custom class name generators */
691
+ classNames?: {
692
+ /**
693
+ * Returns the classes of the container, instead of the default ones and the `className` prop.
694
+ *
695
+ * @param params - The state.
696
+ * @param params.hasActiveWallet - Whether a wallet is connected.
697
+ * @param params.hasValidAdapter - Whether `transactionPool` and `pulsarAdapter` are set.
698
+ * @returns The classes.
699
+ */
700
+ container?: (params: {
701
+ hasActiveWallet: boolean;
702
+ hasValidAdapter: boolean;
703
+ }) => string;
704
+ /**
705
+ * Returns classes of the loading state, added to the default ones.
706
+ *
707
+ * @returns The classes.
708
+ */
709
+ loadingContainer?: () => string;
710
+ /**
711
+ * Returns classes of the loading spinner, added to the default ones.
712
+ *
713
+ * @returns The classes.
714
+ */
715
+ loadingSpinner?: () => string;
716
+ /**
717
+ * Returns classes of the loading text, added to the default ones.
718
+ *
719
+ * @returns The classes.
720
+ */
721
+ loadingText?: () => string;
722
+ /**
723
+ * Returns classes of the error state, added to the default ones.
724
+ *
725
+ * @returns The classes.
726
+ */
727
+ errorContainer?: () => string;
728
+ /**
729
+ * Returns classes of the error icon container, added to the default ones.
730
+ *
731
+ * @returns The classes.
732
+ */
733
+ errorIconContainer?: () => string;
734
+ /**
735
+ * Returns classes of the error icon, added to the default ones.
736
+ *
737
+ * @returns The classes.
738
+ */
739
+ errorIcon?: () => string;
740
+ /**
741
+ * Returns classes of the error texts, added to the default ones.
742
+ *
743
+ * @returns The classes.
744
+ */
745
+ errorContent?: () => string;
746
+ /**
747
+ * Returns classes of the error title, added to the default ones.
748
+ *
749
+ * @returns The classes.
750
+ */
751
+ errorTitle?: () => string;
752
+ /**
753
+ * Returns classes of the error description, added to the default ones.
754
+ *
755
+ * @returns The classes.
756
+ */
757
+ errorDescription?: () => string;
758
+ /**
759
+ * Returns classes of the state without a wallet, added to the default ones.
760
+ *
761
+ * @returns The classes.
762
+ */
763
+ noWalletContainer?: () => string;
764
+ /**
765
+ * Returns classes of the text without a wallet, added to the default ones.
766
+ *
767
+ * @returns The classes.
768
+ */
769
+ noWalletText?: () => string;
770
+ /**
771
+ * Returns classes of the "Pulsar adapter required" state, instead of the default ones.
772
+ *
773
+ * @returns The classes.
774
+ */
775
+ pulsarRequiredContainer?: () => string;
776
+ /**
777
+ * Returns classes of its icon container, instead of the default ones.
778
+ *
779
+ * @returns The classes.
780
+ */
781
+ pulsarRequiredIconContainer?: () => string;
782
+ /**
783
+ * Returns classes of its icon, instead of the default ones.
784
+ *
785
+ * @returns The classes.
786
+ */
787
+ pulsarRequiredIcon?: () => string;
788
+ /**
789
+ * Returns classes of its texts, instead of the default ones.
790
+ *
791
+ * @returns The classes.
792
+ */
793
+ pulsarRequiredContent?: () => string;
794
+ /**
795
+ * Returns classes of its title, instead of the default ones.
796
+ *
797
+ * @returns The classes.
798
+ */
799
+ pulsarRequiredTitle?: () => string;
800
+ /**
801
+ * Returns classes of its description, instead of the default ones.
802
+ *
803
+ * @returns The classes.
804
+ */
805
+ pulsarRequiredDescription?: () => string;
806
+ /**
807
+ * Returns classes of the transaction history wrapper, added to the default ones.
808
+ *
809
+ * @returns The classes.
810
+ */
811
+ transactionsHistoryWrapper?: () => string;
812
+ };
813
+ /** Custom animation variants */
814
+ variants?: {
815
+ /** Container animation variants (`initial`, `animate`, `exit`) */
816
+ container?: Variants;
817
+ /** Variants of the "Pulsar adapter required" state */
818
+ error?: Variants;
819
+ };
820
+ /** Custom animation configuration */
821
+ animation?: {
822
+ /** Container animation configuration */
823
+ container?: {
824
+ /** Animation duration in seconds */
825
+ duration?: number;
826
+ /** Animation easing curve */
827
+ ease?: Easing | Easing[];
828
+ /** Animation delay in seconds */
829
+ delay?: number;
830
+ };
831
+ /** Animation of the "Pulsar adapter required" state */
832
+ error?: {
833
+ /** Animation duration in seconds */
834
+ duration?: number;
835
+ /** Animation easing curve */
836
+ ease?: Easing | Easing[];
837
+ /** Animation delay in seconds */
838
+ delay?: number;
839
+ };
840
+ };
841
+ /** Custom event handlers */
842
+ handlers?: {
843
+ /**
844
+ * Called when `@tuwaio/nova-transactions` fails to load or its `TransactionsHistory` throws.
845
+ *
846
+ * @param packageName - `config.packageName`.
847
+ * @param error - The error.
848
+ */
849
+ onPackageLoadingFailure?: (packageName: string, error: Error) => void;
850
+ };
851
+ /** Configuration options */
852
+ config?: {
853
+ /** Renders without Framer Motion (default: `false`) */
854
+ disableAnimation?: boolean;
855
+ /** Same as `disableAnimation` (default: `false`) */
856
+ reduceMotion?: boolean;
857
+ /** Name passed to `handlers.onPackageLoadingFailure` (default: `@tuwaio/nova-transactions`) */
858
+ packageName?: string;
859
+ /** Custom aria labels for different states */
860
+ ariaLabels?: {
861
+ /** ARIA label of the container, after the `aria-label` prop (default: the `transactionsInApp` label) */
862
+ transactionsHistory?: string;
863
+ };
864
+ };
865
+ /**
866
+ * Customization for the TransactionsHistory component (from @tuwaio/nova-transactions).
867
+ * Passed through to the dynamically loaded component.
868
+ */
869
+ transactionsHistory?: LocalTransactionsHistoryCustomization;
870
+ };
881
871
  /**
882
- * Result of {@link useWalletNativeBalance}.
872
+ * Props for the {@link ConnectedModalTxHistory} component. Without `transactionPool` and `pulsarAdapter` (Pulsar)
873
+ * the "Pulsar adapter required" state is shown. Other props are passed to the container.
883
874
  */
884
- interface UseWalletNativeBalanceData {
885
- /** The balance, or `null` without a wallet, without `getBalance` or before it resolves */
886
- balance: UseWalletNativeBalanceState;
887
- /** Whether the balance is being requested */
888
- isLoading: boolean;
889
- /** Requests the balance again (a failed refresh clears the kept balance) */
890
- refetch: () => void;
875
+ interface ConnectedModalTxHistoryProps extends Pick<NovaConnectProviderProps, 'transactionPool' | 'pulsarAdapter'> {
876
+ /** Classes added to the default container classes (ignored when `classNames.container` is set) */
877
+ className?: string;
878
+ /** ARIA label of the container (default: the `transactionsInApp` label) */
879
+ 'aria-label'?: string;
880
+ /** Customization options */
881
+ customization?: ConnectedModalTxHistoryCustomization;
882
+ /** Pagination state for infinite scroll, forwarded to TransactionsHistory. */
883
+ pagination?: LocalTxPagination;
891
884
  }
892
885
  /**
893
- * Returns the native balance of the active wallet on its chain, from `getBalance` of its Satellite adapter (an RPC
894
- * request). Each balance is kept in memory for the address and chain while the component is mounted, so switching
895
- * back does not request it again; `refetch` requests it again.
886
+ * The transaction history screen of the connected modal: the `TransactionsHistory` of `@tuwaio/nova-transactions`
887
+ * for the active address (loaded with a dynamic import, without the details view). Shows a loading state while the
888
+ * package loads, an error state when it cannot be loaded, a "Pulsar adapter required" state without
889
+ * `transactionPool` and `pulsarAdapter`, and a message without a connected wallet.
896
890
  *
897
- * @returns See {@link UseWalletNativeBalanceData}.
891
+ * Props: {@link ConnectedModalTxHistoryProps}; the ref is forwarded to the container.
898
892
  *
899
893
  * @example
900
894
  * ```tsx
901
- * import { useWalletNativeBalance } from '@tuwaio/nova-connect/hooks';
902
- *
903
- * export function NativeBalance() {
904
- * const { balance, isLoading, refetch } = useWalletNativeBalance();
895
+ * import { ConnectedModalTxHistory } from '@tuwaio/nova-connect/components';
896
+ * import type { NovaConnectProviderProps } from '@tuwaio/nova-connect/hooks';
905
897
  *
906
- * if (isLoading) return <p>Loading balance...</p>;
898
+ * type HistoryProps = Pick<NovaConnectProviderProps, 'transactionPool' | 'pulsarAdapter'>;
907
899
  *
900
+ * export function History({ transactionPool, pulsarAdapter }: HistoryProps) {
908
901
  * return (
909
- * <p>
910
- * {balance ? `${balance.value} ${balance.symbol}` : 'n/a'} <button onClick={refetch}>Refresh</button>
911
- * </p>
902
+ * <ConnectedModalTxHistory
903
+ * transactionPool={transactionPool}
904
+ * pulsarAdapter={pulsarAdapter}
905
+ * customization={{
906
+ * classNames: { loadingContainer: () => 'bg-blue-100' },
907
+ * handlers: {
908
+ * onPackageLoadingFailure: (packageName, error) => console.error(packageName, error),
909
+ * },
910
+ * }}
911
+ * />
912
912
  * );
913
913
  * }
914
914
  * ```
915
915
  */
916
- declare function useWalletNativeBalance(): UseWalletNativeBalanceData;
916
+ declare const ConnectedModalTxHistory: React__default.ForwardRefExoticComponent<ConnectedModalTxHistoryProps & React__default.RefAttributes<HTMLDivElement>>;
917
917
 
918
918
  export { type AllChainConfigs as A, type ButtonTxStatus as B, type ConnectContentType as C, ConnectedModalTxHistory as D, type ConnectedModalTxHistoryErrorContainerProps as E, type ConnectedModalTxHistoryLoadingContainerProps as F, type ConnectedModalTxHistoryNoWalletContainerProps as G, type ConnectedModalTxHistoryProps as H, type InitialChains as I, type ConnectedModalTxHistoryTransactionsHistoryWrapperProps as J, type LocalTransactionsHistoryCustomization as K, type LabelCategory as L, type LocalTxPagination as M, type NovaConnectProviderProps as N, type UseWalletNativeBalanceData as U, type WalletBalance as W, type ConnectedContentType as a, type NovaConnectProviderType as b, type LegalConfig as c, type NativeBalanceResult as d, type NovaConnectAppChains as e, type NovaConnectChainConfigTypes as f, NovaConnectLabelsContext as g, NovaConnectProviderContext as h, NovaConnectProviderError as i, type NovaConnectSolanaRPCUrls as j, NovaSiwxWatcher as k, type NovaSiwxWatcherProps as l, type UseWalletNativeBalanceState as m, createLabelsSubset as n, getLabelWithFallback as o, hasLabel as p, isDefaultLabels as q, useLabelsByCategory as r, useNovaConnect as s, useNovaConnectLabel as t, useHasNovaConnectContext as u, useNovaConnectLabels as v, useNovaConnectLabelsSubset as w, useNovaConnectOptional as x, useWalletNativeBalance as y, type ConnectedModalTxHistoryCustomization as z };