@tuwaio/nova-transactions 1.0.0-fix-integrate-orbit-alpha.21.4b8f114 → 1.0.0-fix-integrate-orbit-alpha.23.c69d70b
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/{TransactionsInfoModal-ZGqfDAxN.d.cts → TransactionsInfoModal-BPOe6aUa.d.cts} +0 -76
- package/dist/{TransactionsInfoModal-ZGqfDAxN.d.ts → TransactionsInfoModal-BPOe6aUa.d.ts} +0 -76
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +282 -394
- package/dist/index.d.cts +2 -16
- package/dist/index.d.ts +2 -16
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +15 -15
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.d.cts +2 -2
- package/dist/providers/index.d.ts +2 -2
- package/dist/providers/index.js +15 -15
- package/dist/providers/index.js.map +1 -1
- package/package.json +2 -2
@@ -10,9 +10,6 @@ import { MotionProps } from 'framer-motion';
|
|
10
10
|
* @file This file contains the `HashLink` component, a UI element for displaying
|
11
11
|
* blockchain hashes with copy-to-clipboard and block explorer link functionality.
|
12
12
|
*/
|
13
|
-
/**
|
14
|
-
* Defines the props for the HashLink component.
|
15
|
-
*/
|
16
13
|
type HashLinkProps = {
|
17
14
|
/** The full hash string to display and copy (e.g., a transaction hash or wallet address). */
|
18
15
|
hash: string;
|
@@ -25,10 +22,6 @@ type HashLinkProps = {
|
|
25
22
|
/** Additional CSS classes to apply to the container element for custom styling. */
|
26
23
|
className?: string;
|
27
24
|
};
|
28
|
-
/**
|
29
|
-
* A component to display a hash string with an optional label, a link to a block explorer,
|
30
|
-
* and a copy-to-clipboard button. It automatically ellipsizes the hash for readability.
|
31
|
-
*/
|
32
25
|
declare function HashLink({ label, hash, explorerUrl, variant, className }: HashLinkProps): react_jsx_runtime.JSX.Element;
|
33
26
|
|
34
27
|
/**
|
@@ -211,48 +204,19 @@ type NovaProviderProps<T extends Transaction> = {
|
|
211
204
|
*/
|
212
205
|
declare function NovaProvider<T extends Transaction>({ adapter, connectedWalletAddress, connectedAdapterType, transactionsPool, initialTx, executeTxAction, closeTxTrackedModal, labels, features, customization, ...toastProps }: NovaProviderProps<T>): react_jsx_runtime.JSX.Element;
|
213
206
|
|
214
|
-
/**
|
215
|
-
* Defines the props for the TransactionKey component.
|
216
|
-
* @template TR - The type of the tracker identifier.
|
217
|
-
* @template T - The transaction type.
|
218
|
-
* @template A - The type of the key returned by an action function.
|
219
|
-
*/
|
220
207
|
type TransactionKeyProps<T extends Transaction> = Pick<NovaProviderProps<T>, 'adapter'> & {
|
221
|
-
/** The transaction object to display identifiers for. */
|
222
208
|
tx: T;
|
223
|
-
/** The visual variant, which applies different container styles. */
|
224
209
|
variant?: 'toast' | 'history';
|
225
|
-
/** Optional additional CSS classes for the container. */
|
226
210
|
className?: string;
|
227
|
-
/**
|
228
|
-
* An optional render prop to allow for complete customization of how the hash link is rendered.
|
229
|
-
* If not provided, the default `HashLink` component will be used.
|
230
|
-
*/
|
231
211
|
renderHashLink?: (props: HashLinkProps) => ReactNode;
|
232
|
-
/** Optional number of confirmations for a transaction. */
|
233
212
|
confirmations?: number;
|
234
213
|
};
|
235
|
-
/**
|
236
|
-
* A component that intelligently displays the relevant keys and hashes for a transaction.
|
237
|
-
* It leverages the adapter system to show chain-specific identifiers and explorer links.
|
238
|
-
*/
|
239
214
|
declare function TransactionKey<T extends Transaction>({ tx, adapter, variant, className, renderHashLink, confirmations, }: TransactionKeyProps<T>): react_jsx_runtime.JSX.Element | null;
|
240
215
|
|
241
|
-
/**
|
242
|
-
* Defines the props for the TransactionStatusBadge component.
|
243
|
-
* @template TR - The type of the tracker identifier.
|
244
|
-
* @template T - The transaction type.
|
245
|
-
*/
|
246
216
|
type TransactionStatusBadgeProps<T extends Transaction> = {
|
247
|
-
/** The transaction object whose status will be displayed. */
|
248
217
|
tx: T;
|
249
|
-
/** Optional additional CSS classes to apply to the badge container. */
|
250
218
|
className?: string;
|
251
219
|
};
|
252
|
-
/**
|
253
|
-
* A component that displays a transaction's status as a styled badge
|
254
|
-
* with a corresponding icon, color, and label.
|
255
|
-
*/
|
256
220
|
declare function TransactionStatusBadge<T extends Transaction>({ tx, className }: TransactionStatusBadgeProps<T>): react_jsx_runtime.JSX.Element;
|
257
221
|
|
258
222
|
/**
|
@@ -282,10 +246,6 @@ type ToastTransactionProps<T extends Transaction> = {
|
|
282
246
|
closeToast?: ToastContentProps['closeToast'];
|
283
247
|
toastProps?: ToastContainerProps;
|
284
248
|
} & Pick<NovaProviderProps<T>, 'adapter' | 'connectedWalletAddress'>;
|
285
|
-
/**
|
286
|
-
* A composite component that renders the content for a transaction toast notification.
|
287
|
-
* It is highly customizable and leverages the adapter to show relevant actions like "Speed Up".
|
288
|
-
*/
|
289
249
|
declare function ToastTransaction<T extends Transaction>({ openTxInfoModal, tx, icon, className, customization, connectedWalletAddress, adapter, }: ToastTransactionProps<T>): JSX.Element;
|
290
250
|
|
291
251
|
type CustomHeaderProps$1 = {
|
@@ -321,10 +281,6 @@ type TrackingTxModalProps<T extends Transaction> = Pick<NovaProviderProps<T>, 'e
|
|
321
281
|
className?: string;
|
322
282
|
customization?: TrackingTxModalCustomization<T>;
|
323
283
|
};
|
324
|
-
/**
|
325
|
-
* A detailed modal that displays the real-time status and lifecycle of a transaction.
|
326
|
-
* It opens automatically for transactions initiated with `withTrackedModal: true`.
|
327
|
-
*/
|
328
284
|
declare function TrackingTxModal<T extends Transaction>({ adapter, onClose, onOpenAllTransactions, className, customization, transactionsPool, executeTxAction, initialTx, connectedWalletAddress, }: TrackingTxModalProps<T>): react_jsx_runtime.JSX.Element | null;
|
329
285
|
|
330
286
|
/**
|
@@ -380,9 +336,6 @@ interface TxProgressIndicatorProps {
|
|
380
336
|
className?: string;
|
381
337
|
StepComponent?: ComponentType<StepProps>;
|
382
338
|
}
|
383
|
-
/**
|
384
|
-
* A 3-step progress indicator that visually represents the lifecycle of a transaction.
|
385
|
-
*/
|
386
339
|
declare function TxProgressIndicator({ isProcessing, isSucceed, isFailed, isReplaced, className, StepComponent, }: TxProgressIndicatorProps): react_jsx_runtime.JSX.Element;
|
387
340
|
|
388
341
|
/**
|
@@ -415,10 +368,6 @@ type CustomIconProps = {
|
|
415
368
|
type CustomTimestampProps = {
|
416
369
|
timestamp?: number;
|
417
370
|
};
|
418
|
-
/**
|
419
|
-
* Defines the structure for the `customization` prop, allowing users to override
|
420
|
-
* default sub-components with their own implementations for a history item.
|
421
|
-
*/
|
422
371
|
type TransactionHistoryItemCustomization<T extends Transaction> = {
|
423
372
|
components?: {
|
424
373
|
Icon?: ComponentType<CustomIconProps>;
|
@@ -437,20 +386,12 @@ type TransactionHistoryItemProps<T extends Transaction> = {
|
|
437
386
|
/** Optional additional CSS classes for the container. */
|
438
387
|
className?: string;
|
439
388
|
} & Pick<NovaProviderProps<T>, 'adapter'>;
|
440
|
-
/**
|
441
|
-
* A component that renders a single row in the transaction history list.
|
442
|
-
* It is highly customizable via the `customization` prop, allowing developers
|
443
|
-
* to override any of its internal parts with their own components.
|
444
|
-
*/
|
445
389
|
declare function TransactionHistoryItem<T extends Transaction>({ tx, adapter, className, customization, }: TransactionHistoryItemProps<T>): JSX.Element;
|
446
390
|
|
447
391
|
type CustomPlaceholderProps = {
|
448
392
|
title: string;
|
449
393
|
message: string;
|
450
394
|
};
|
451
|
-
/**
|
452
|
-
* Defines the customization options for the TransactionsHistory component.
|
453
|
-
*/
|
454
395
|
type TransactionsHistoryCustomization<T extends Transaction> = {
|
455
396
|
title?: string;
|
456
397
|
classNames?: {
|
@@ -461,26 +402,15 @@ type TransactionsHistoryCustomization<T extends Transaction> = {
|
|
461
402
|
HistoryItem?: ComponentType<TransactionHistoryItemProps<T>>;
|
462
403
|
};
|
463
404
|
};
|
464
|
-
/**
|
465
|
-
* Defines the props for the TransactionsHistory component.
|
466
|
-
* @template T - The transaction type.
|
467
|
-
*/
|
468
405
|
type TransactionsHistoryProps<T extends Transaction> = Pick<NovaProviderProps<T>, 'adapter' | 'transactionsPool' | 'connectedWalletAddress'> & {
|
469
406
|
className?: string;
|
470
407
|
customization?: TransactionsHistoryCustomization<T>;
|
471
408
|
};
|
472
|
-
/**
|
473
|
-
* A component that displays a scrollable list of transactions for the connected wallet.
|
474
|
-
* It handles states for when a wallet is not connected or when the history is empty.
|
475
|
-
*/
|
476
409
|
declare function TransactionsHistory<T extends Transaction>({ adapter, connectedWalletAddress, transactionsPool, className, customization, }: TransactionsHistoryProps<T>): react_jsx_runtime.JSX.Element;
|
477
410
|
|
478
411
|
type CustomHeaderProps = {
|
479
412
|
closeModal: () => void;
|
480
413
|
};
|
481
|
-
/**
|
482
|
-
* Defines the customization options for the TransactionsInfoModal.
|
483
|
-
*/
|
484
414
|
type TransactionsInfoModalCustomization<T extends Transaction> = {
|
485
415
|
modalProps?: Partial<ComponentPropsWithoutRef<typeof DialogContent>>;
|
486
416
|
classNames?: {
|
@@ -491,17 +421,11 @@ type TransactionsInfoModalCustomization<T extends Transaction> = {
|
|
491
421
|
History?: ComponentType<TransactionsHistoryProps<T>>;
|
492
422
|
};
|
493
423
|
};
|
494
|
-
/**
|
495
|
-
* Defines the core props for the TransactionsInfoModal.
|
496
|
-
*/
|
497
424
|
type TransactionsInfoModalProps<T extends Transaction> = Pick<NovaProviderProps<T>, 'adapter' | 'connectedAdapterType' | 'connectedWalletAddress' | 'transactionsPool'> & {
|
498
425
|
isOpen?: boolean;
|
499
426
|
setIsOpen: (value: boolean) => void;
|
500
427
|
customization?: TransactionsInfoModalCustomization<T>;
|
501
428
|
};
|
502
|
-
/**
|
503
|
-
* The main modal component for displaying wallet information and transaction history.
|
504
|
-
*/
|
505
429
|
declare function TransactionsInfoModal<T extends Transaction>({ isOpen, setIsOpen, customization, adapter, connectedWalletAddress, transactionsPool, }: TransactionsInfoModalProps<T>): react_jsx_runtime.JSX.Element;
|
506
430
|
|
507
431
|
export { TransactionsHistory as A, type TransactionsInfoModalCustomization as B, type TransactionsInfoModalProps as C, TransactionsInfoModal as D, type TransactionStatusBadgeProps as E, TransactionStatusBadge as F, NovaProvider as G, type HashLinkProps as H, type NovaProviderProps as N, type StatusAwareTextProps as S, type TuwaLabels as T, HashLink as a, StatusAwareText as b, type ToastTransactionCustomization as c, type ToastTransactionProps as d, ToastTransaction as e, type TrackingTxModalCustomization as f, type TrackingTxModalProps as g, TrackingTxModal as h, type TxErrorBlockProps as i, TxErrorBlock as j, type TxInfoBlockCustomization as k, type TxInfoBlockProps as l, TxInfoBlock as m, type StepStatus as n, type StepProps as o, type TxProgressIndicatorProps as p, TxProgressIndicator as q, type TxStatusVisualProps as r, TxStatusVisual as s, type TransactionHistoryItemCustomization as t, type TransactionHistoryItemProps as u, TransactionHistoryItem as v, type TransactionKeyProps as w, TransactionKey as x, type TransactionsHistoryCustomization as y, type TransactionsHistoryProps as z };
|
@@ -10,9 +10,6 @@ import { MotionProps } from 'framer-motion';
|
|
10
10
|
* @file This file contains the `HashLink` component, a UI element for displaying
|
11
11
|
* blockchain hashes with copy-to-clipboard and block explorer link functionality.
|
12
12
|
*/
|
13
|
-
/**
|
14
|
-
* Defines the props for the HashLink component.
|
15
|
-
*/
|
16
13
|
type HashLinkProps = {
|
17
14
|
/** The full hash string to display and copy (e.g., a transaction hash or wallet address). */
|
18
15
|
hash: string;
|
@@ -25,10 +22,6 @@ type HashLinkProps = {
|
|
25
22
|
/** Additional CSS classes to apply to the container element for custom styling. */
|
26
23
|
className?: string;
|
27
24
|
};
|
28
|
-
/**
|
29
|
-
* A component to display a hash string with an optional label, a link to a block explorer,
|
30
|
-
* and a copy-to-clipboard button. It automatically ellipsizes the hash for readability.
|
31
|
-
*/
|
32
25
|
declare function HashLink({ label, hash, explorerUrl, variant, className }: HashLinkProps): react_jsx_runtime.JSX.Element;
|
33
26
|
|
34
27
|
/**
|
@@ -211,48 +204,19 @@ type NovaProviderProps<T extends Transaction> = {
|
|
211
204
|
*/
|
212
205
|
declare function NovaProvider<T extends Transaction>({ adapter, connectedWalletAddress, connectedAdapterType, transactionsPool, initialTx, executeTxAction, closeTxTrackedModal, labels, features, customization, ...toastProps }: NovaProviderProps<T>): react_jsx_runtime.JSX.Element;
|
213
206
|
|
214
|
-
/**
|
215
|
-
* Defines the props for the TransactionKey component.
|
216
|
-
* @template TR - The type of the tracker identifier.
|
217
|
-
* @template T - The transaction type.
|
218
|
-
* @template A - The type of the key returned by an action function.
|
219
|
-
*/
|
220
207
|
type TransactionKeyProps<T extends Transaction> = Pick<NovaProviderProps<T>, 'adapter'> & {
|
221
|
-
/** The transaction object to display identifiers for. */
|
222
208
|
tx: T;
|
223
|
-
/** The visual variant, which applies different container styles. */
|
224
209
|
variant?: 'toast' | 'history';
|
225
|
-
/** Optional additional CSS classes for the container. */
|
226
210
|
className?: string;
|
227
|
-
/**
|
228
|
-
* An optional render prop to allow for complete customization of how the hash link is rendered.
|
229
|
-
* If not provided, the default `HashLink` component will be used.
|
230
|
-
*/
|
231
211
|
renderHashLink?: (props: HashLinkProps) => ReactNode;
|
232
|
-
/** Optional number of confirmations for a transaction. */
|
233
212
|
confirmations?: number;
|
234
213
|
};
|
235
|
-
/**
|
236
|
-
* A component that intelligently displays the relevant keys and hashes for a transaction.
|
237
|
-
* It leverages the adapter system to show chain-specific identifiers and explorer links.
|
238
|
-
*/
|
239
214
|
declare function TransactionKey<T extends Transaction>({ tx, adapter, variant, className, renderHashLink, confirmations, }: TransactionKeyProps<T>): react_jsx_runtime.JSX.Element | null;
|
240
215
|
|
241
|
-
/**
|
242
|
-
* Defines the props for the TransactionStatusBadge component.
|
243
|
-
* @template TR - The type of the tracker identifier.
|
244
|
-
* @template T - The transaction type.
|
245
|
-
*/
|
246
216
|
type TransactionStatusBadgeProps<T extends Transaction> = {
|
247
|
-
/** The transaction object whose status will be displayed. */
|
248
217
|
tx: T;
|
249
|
-
/** Optional additional CSS classes to apply to the badge container. */
|
250
218
|
className?: string;
|
251
219
|
};
|
252
|
-
/**
|
253
|
-
* A component that displays a transaction's status as a styled badge
|
254
|
-
* with a corresponding icon, color, and label.
|
255
|
-
*/
|
256
220
|
declare function TransactionStatusBadge<T extends Transaction>({ tx, className }: TransactionStatusBadgeProps<T>): react_jsx_runtime.JSX.Element;
|
257
221
|
|
258
222
|
/**
|
@@ -282,10 +246,6 @@ type ToastTransactionProps<T extends Transaction> = {
|
|
282
246
|
closeToast?: ToastContentProps['closeToast'];
|
283
247
|
toastProps?: ToastContainerProps;
|
284
248
|
} & Pick<NovaProviderProps<T>, 'adapter' | 'connectedWalletAddress'>;
|
285
|
-
/**
|
286
|
-
* A composite component that renders the content for a transaction toast notification.
|
287
|
-
* It is highly customizable and leverages the adapter to show relevant actions like "Speed Up".
|
288
|
-
*/
|
289
249
|
declare function ToastTransaction<T extends Transaction>({ openTxInfoModal, tx, icon, className, customization, connectedWalletAddress, adapter, }: ToastTransactionProps<T>): JSX.Element;
|
290
250
|
|
291
251
|
type CustomHeaderProps$1 = {
|
@@ -321,10 +281,6 @@ type TrackingTxModalProps<T extends Transaction> = Pick<NovaProviderProps<T>, 'e
|
|
321
281
|
className?: string;
|
322
282
|
customization?: TrackingTxModalCustomization<T>;
|
323
283
|
};
|
324
|
-
/**
|
325
|
-
* A detailed modal that displays the real-time status and lifecycle of a transaction.
|
326
|
-
* It opens automatically for transactions initiated with `withTrackedModal: true`.
|
327
|
-
*/
|
328
284
|
declare function TrackingTxModal<T extends Transaction>({ adapter, onClose, onOpenAllTransactions, className, customization, transactionsPool, executeTxAction, initialTx, connectedWalletAddress, }: TrackingTxModalProps<T>): react_jsx_runtime.JSX.Element | null;
|
329
285
|
|
330
286
|
/**
|
@@ -380,9 +336,6 @@ interface TxProgressIndicatorProps {
|
|
380
336
|
className?: string;
|
381
337
|
StepComponent?: ComponentType<StepProps>;
|
382
338
|
}
|
383
|
-
/**
|
384
|
-
* A 3-step progress indicator that visually represents the lifecycle of a transaction.
|
385
|
-
*/
|
386
339
|
declare function TxProgressIndicator({ isProcessing, isSucceed, isFailed, isReplaced, className, StepComponent, }: TxProgressIndicatorProps): react_jsx_runtime.JSX.Element;
|
387
340
|
|
388
341
|
/**
|
@@ -415,10 +368,6 @@ type CustomIconProps = {
|
|
415
368
|
type CustomTimestampProps = {
|
416
369
|
timestamp?: number;
|
417
370
|
};
|
418
|
-
/**
|
419
|
-
* Defines the structure for the `customization` prop, allowing users to override
|
420
|
-
* default sub-components with their own implementations for a history item.
|
421
|
-
*/
|
422
371
|
type TransactionHistoryItemCustomization<T extends Transaction> = {
|
423
372
|
components?: {
|
424
373
|
Icon?: ComponentType<CustomIconProps>;
|
@@ -437,20 +386,12 @@ type TransactionHistoryItemProps<T extends Transaction> = {
|
|
437
386
|
/** Optional additional CSS classes for the container. */
|
438
387
|
className?: string;
|
439
388
|
} & Pick<NovaProviderProps<T>, 'adapter'>;
|
440
|
-
/**
|
441
|
-
* A component that renders a single row in the transaction history list.
|
442
|
-
* It is highly customizable via the `customization` prop, allowing developers
|
443
|
-
* to override any of its internal parts with their own components.
|
444
|
-
*/
|
445
389
|
declare function TransactionHistoryItem<T extends Transaction>({ tx, adapter, className, customization, }: TransactionHistoryItemProps<T>): JSX.Element;
|
446
390
|
|
447
391
|
type CustomPlaceholderProps = {
|
448
392
|
title: string;
|
449
393
|
message: string;
|
450
394
|
};
|
451
|
-
/**
|
452
|
-
* Defines the customization options for the TransactionsHistory component.
|
453
|
-
*/
|
454
395
|
type TransactionsHistoryCustomization<T extends Transaction> = {
|
455
396
|
title?: string;
|
456
397
|
classNames?: {
|
@@ -461,26 +402,15 @@ type TransactionsHistoryCustomization<T extends Transaction> = {
|
|
461
402
|
HistoryItem?: ComponentType<TransactionHistoryItemProps<T>>;
|
462
403
|
};
|
463
404
|
};
|
464
|
-
/**
|
465
|
-
* Defines the props for the TransactionsHistory component.
|
466
|
-
* @template T - The transaction type.
|
467
|
-
*/
|
468
405
|
type TransactionsHistoryProps<T extends Transaction> = Pick<NovaProviderProps<T>, 'adapter' | 'transactionsPool' | 'connectedWalletAddress'> & {
|
469
406
|
className?: string;
|
470
407
|
customization?: TransactionsHistoryCustomization<T>;
|
471
408
|
};
|
472
|
-
/**
|
473
|
-
* A component that displays a scrollable list of transactions for the connected wallet.
|
474
|
-
* It handles states for when a wallet is not connected or when the history is empty.
|
475
|
-
*/
|
476
409
|
declare function TransactionsHistory<T extends Transaction>({ adapter, connectedWalletAddress, transactionsPool, className, customization, }: TransactionsHistoryProps<T>): react_jsx_runtime.JSX.Element;
|
477
410
|
|
478
411
|
type CustomHeaderProps = {
|
479
412
|
closeModal: () => void;
|
480
413
|
};
|
481
|
-
/**
|
482
|
-
* Defines the customization options for the TransactionsInfoModal.
|
483
|
-
*/
|
484
414
|
type TransactionsInfoModalCustomization<T extends Transaction> = {
|
485
415
|
modalProps?: Partial<ComponentPropsWithoutRef<typeof DialogContent>>;
|
486
416
|
classNames?: {
|
@@ -491,17 +421,11 @@ type TransactionsInfoModalCustomization<T extends Transaction> = {
|
|
491
421
|
History?: ComponentType<TransactionsHistoryProps<T>>;
|
492
422
|
};
|
493
423
|
};
|
494
|
-
/**
|
495
|
-
* Defines the core props for the TransactionsInfoModal.
|
496
|
-
*/
|
497
424
|
type TransactionsInfoModalProps<T extends Transaction> = Pick<NovaProviderProps<T>, 'adapter' | 'connectedAdapterType' | 'connectedWalletAddress' | 'transactionsPool'> & {
|
498
425
|
isOpen?: boolean;
|
499
426
|
setIsOpen: (value: boolean) => void;
|
500
427
|
customization?: TransactionsInfoModalCustomization<T>;
|
501
428
|
};
|
502
|
-
/**
|
503
|
-
* The main modal component for displaying wallet information and transaction history.
|
504
|
-
*/
|
505
429
|
declare function TransactionsInfoModal<T extends Transaction>({ isOpen, setIsOpen, customization, adapter, connectedWalletAddress, transactionsPool, }: TransactionsInfoModalProps<T>): react_jsx_runtime.JSX.Element;
|
506
430
|
|
507
431
|
export { TransactionsHistory as A, type TransactionsInfoModalCustomization as B, type TransactionsInfoModalProps as C, TransactionsInfoModal as D, type TransactionStatusBadgeProps as E, TransactionStatusBadge as F, NovaProvider as G, type HashLinkProps as H, type NovaProviderProps as N, type StatusAwareTextProps as S, type TuwaLabels as T, HashLink as a, StatusAwareText as b, type ToastTransactionCustomization as c, type ToastTransactionProps as d, ToastTransaction as e, type TrackingTxModalCustomization as f, type TrackingTxModalProps as g, TrackingTxModal as h, type TxErrorBlockProps as i, TxErrorBlock as j, type TxInfoBlockCustomization as k, type TxInfoBlockProps as l, TxInfoBlock as m, type StepStatus as n, type StepProps as o, type TxProgressIndicatorProps as p, TxProgressIndicator as q, type TxStatusVisualProps as r, TxStatusVisual as s, type TransactionHistoryItemCustomization as t, type TransactionHistoryItemProps as u, TransactionHistoryItem as v, type TransactionKeyProps as w, TransactionKey as x, type TransactionsHistoryCustomization as y, type TransactionsHistoryProps as z };
|
package/dist/index.cjs
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
'use strict';var solid=require('@heroicons/react/24/solid'),novaCore=require('@tuwaio/nova-core'),react=require('react'),jsxRuntime=require('react/jsx-runtime'),pulsarCore=require('@tuwaio/pulsar-core');require('react-toastify');var reactWeb3Icons=require('@bgd-labs/react-web3-icons'),utils=require('@bgd-labs/react-web3-icons/dist/utils'),orbitCore=require('@tuwaio/orbit-core'),It=require('dayjs'),Ze=require('dayjs/plugin/relativeTime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var It__default=/*#__PURE__*/_interopDefault(It);var Ze__default=/*#__PURE__*/_interopDefault(Ze);var J={transactionsModal:{history:{title:"Transactions History",connectWalletTitle:"Connect Wallet",connectWalletMessage:"Please connect your wallet to see your past activity.",noTransactionsTitle:"No Transactions Yet",noTransactionsMessage:"Once you interact with the app, your transaction history will appear here."}},toast:{openTransactionsInfo:"Open transactions"},statuses:{pending:"Pending",success:"Success",failed:"Failed",reverted:"Reverted",replaced:"Replaced",unknown:"Unknown",confirmationsLabel:"Confirmations"},hashLabels:{gelato:"Gelato Task ID",safe:"Safe Tx Hash",original:"Original Tx Hash",replaced:"Replaced Tx Hash",default:"Tx Hash",recentBlockhash:"Recent Blockhash",solana:"Signature"},txInfo:{started:"Started",network:"Network",slot:"Slot"},txError:{title:"Error",copied:"Copied!"},trackingModal:{title:"Transaction Overview",processing:"Processing...",close:"Close",allTransactions:"All transactions",retry:"Retry",progressIndicator:{created:"Created",processing:"Processing",succeed:"Succeed"}},trackedTxButton:{loading:"Processing...",succeed:"Success",failed:"Failed",replaced:"Replaced"},actions:{copy:"Copy address",viewOnExplorer:"View on explorer",close:"Close",cancel:"Cancel",speedUp:"Speed up"}};var Ot=react.createContext(J);var m=()=>react.useContext(Ot);({[pulsarCore.TransactionStatus.Success]:"success",[pulsarCore.TransactionStatus.Failed]:"error",[pulsarCore.TransactionStatus.Replaced]:"info"});function D({label:t,hash:e,explorerUrl:r,variant:c="default",className:s}){let{isCopied:l,copy:i}=novaCore.useCopyToClipboard(),{actions:n,txError:p}=m(),o=novaCore.cn("flex items-center justify-between",{"text-sm":c==="default","text-xs":c==="compact"},s),a=novaCore.cn("pr-1",{"font-bold text-[var(--tuwa-text-primary)]":c==="default","font-medium text-[var(--tuwa-text-secondary)]":c==="compact"}),d=jsxRuntime.jsx("span",{className:"font-mono",children:novaCore.textCenterEllipsis(e,5,5)});return jsxRuntime.jsxs("div",{className:o,children:[t&&jsxRuntime.jsxs("span",{className:a,children:[t,":"]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[r?jsxRuntime.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-x-1 text-[var(--tuwa-text-accent)] transition-colors hover:underline",title:n.viewOnExplorer,"aria-label":n.viewOnExplorer,children:[d,jsxRuntime.jsx(solid.ArrowTopRightOnSquareIcon,{className:"h-4 w-4"})]}):jsxRuntime.jsx("span",{className:"text-[var(--tuwa-text-primary)]",children:d}),jsxRuntime.jsx("button",{type:"button",onClick:()=>i(e),className:"cursor-pointer text-[var(--tuwa-text-tertiary)] transition-colors hover:text-[var(--tuwa-text-secondary)]",title:l?p.copied:n.copy,"aria-label":l?p.copied:n.copy,children:l?jsxRuntime.jsx(solid.CheckIcon,{className:"h-4 w-4 text-[var(--tuwa-success-icon)]"}):jsxRuntime.jsx(solid.DocumentDuplicateIcon,{className:"h-4 w-4"})})]})]})}var pt={[pulsarCore.TransactionStatus.Success]:{index:1,colorClass:"text-[var(--tuwa-success-text)]"},[pulsarCore.TransactionStatus.Failed]:{index:2,colorClass:"text-[var(--tuwa-error-text)]"},[pulsarCore.TransactionStatus.Replaced]:{index:3,colorClass:"text-[var(--tuwa-text-secondary)]"},default:{index:0,colorClass:"text-[var(--tuwa-text-primary)]"}};function S({txStatus:t,source:e,fallback:r,variant:c,className:s,applyColor:l=false}){let i,n="";if(typeof e=="string")i=e;else if(Array.isArray(e)){let a=pt[t||"default"]??pt.default;i=e[a.index],l&&(n=a.colorClass);}else i=r;return i?jsxRuntime.jsx("div",{className:novaCore.cn(c==="title"?"text-sm font-semibold text-[var(--tuwa-text-primary)]":"mt-1 text-xs text-[var(--tuwa-text-secondary)]",n,s),children:i}):null}function Ut({closeToast:t}){let{actions:e}=m();return jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":e.close,title:e.close,className:novaCore.cn("absolute top-2 right-2 cursor-pointer rounded-full p-1","text-[var(--tuwa-text-tertiary)] transition-colors","hover:bg-[var(--tuwa-bg-muted)] hover:text-[var(--tuwa-text-primary)]"),children:jsxRuntime.jsx(solid.XMarkIcon,{className:"h-5 w-5"})})}function L({tx:t,adapter:e,variant:r="toast",className:c,renderHashLink:s,confirmations:l}){let{hashLabels:i,statuses:n}=m(),p=orbitCore.selectAdapterByKey({adapterKey:t.adapter,adapter:e});if(!p)return null;let o=x=>s?s(x):jsxRuntime.jsx(D,{...x}),a=r==="toast"?"mt-2 flex w-full flex-col gap-y-2 border-t border-[var(--tuwa-border-primary)] pt-2":"flex w-full flex-col gap-y-2",d=i[String(t.tracker)],v=d?o({label:d,hash:t.txKey,variant:t.tracker!==pulsarCore.TransactionTracker.Solana?"compact":"default",explorerUrl:p.getExplorerTxUrl&&t.tracker===pulsarCore.TransactionTracker.Solana?p?.getExplorerTxUrl(t):void 0}):null,f=(()=>{let x=t.hash,g=t.replacedTxHash;return !x&&!g?null:g?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[x&&o({label:i.original,hash:x,variant:"compact"}),typeof p.getExplorerTxUrl<"u"&&o({label:i.replaced,hash:g,explorerUrl:p.getExplorerTxUrl(t)})]}):x&&typeof p.getExplorerTxUrl<"u"&&o({label:i.default,hash:x,explorerUrl:p.getExplorerTxUrl(t)})})(),T=d&&d!==i.default&&t.txKey!==t.hash;return jsxRuntime.jsxs("div",{className:novaCore.cn(a,c),children:[T&&v,f,typeof l=="number"&&jsxRuntime.jsxs("p",{className:"text-xs text-[var(--tuwa-text-tertiary)]",children:[n.confirmationsLabel,": ",l]})]})}var se=t=>({Pending:{label:t.pending,Icon:solid.ArrowPathIcon,badgeClasses:"bg-[var(--tuwa-pending-bg)] text-[var(--tuwa-pending-text)]",iconClasses:"animate-spin text-[var(--tuwa-pending-icon)]"},[pulsarCore.TransactionStatus.Success]:{label:t.success,Icon:solid.CheckCircleIcon,badgeClasses:"bg-[var(--tuwa-success-bg)] text-[var(--tuwa-success-text)]",iconClasses:"text-[var(--tuwa-success-icon)]"},[pulsarCore.TransactionStatus.Failed]:{label:t.failed,Icon:solid.XCircleIcon,badgeClasses:"bg-[var(--tuwa-error-bg)] text-[var(--tuwa-error-text)]",iconClasses:"text-[var(--tuwa-error-icon)]"},[pulsarCore.TransactionStatus.Replaced]:{label:t.replaced,Icon:solid.ArrowPathIcon,badgeClasses:"bg-[var(--tuwa-info-bg)] text-[var(--tuwa-info-text)]",iconClasses:"text-[var(--tuwa-info-icon)]"}});function F({tx:t,className:e}){let{statuses:r}=m(),c=react.useMemo(()=>se(r),[r]),s="inline-flex items-center gap-x-1.5 rounded-full px-2 py-1 text-xs font-medium",l=t.pending?"Pending":t.status,i=l?c[l]:null;if(!i)return jsxRuntime.jsx("div",{className:novaCore.cn(s,"bg-[var(--tuwa-info-bg)] text-[var(--tuwa-info-text)]",e),children:t.status??r.unknown});let{label:n,Icon:p,badgeClasses:o,iconClasses:a}=i;return jsxRuntime.jsxs("div",{className:novaCore.cn(s,o,e),children:[jsxRuntime.jsx(p,{className:novaCore.cn("h-4 w-4",a)}),n]})}var de=({onClick:t,children:e})=>jsxRuntime.jsx("button",{onClick:t,type:"button",className:"cursor-pointer text-sm font-medium text-[var(--tuwa-text-accent)] transition-opacity hover:opacity-80",children:e}),ue=({onClick:t,children:e})=>jsxRuntime.jsx("button",{onClick:t,type:"button",className:"cursor-pointer text-sm font-medium text-[var(--tuwa-text-secondary)] transition-opacity hover:opacity-80",children:e}),me=({onClick:t,children:e})=>jsxRuntime.jsx("button",{className:"cursor-pointer rounded-md bg-gradient-to-r from-[var(--tuwa-button-gradient-from)] to-[var(--tuwa-button-gradient-to)] px-3 py-1 text-xs font-bold text-[var(--tuwa-text-on-accent)] shadow-lg transition-all duration-200 ease-in-out hover:shadow-xl hover:from-[var(--tuwa-button-gradient-from-hover)] hover:to-[var(--tuwa-button-gradient-to-hover)] active:scale-95",onClick:t,type:"button",children:e});function Ft({openTxInfoModal:t,tx:e,icon:r,className:c,customization:s,connectedWalletAddress:l,adapter:i}){let{actions:n,toast:p}=m(),o=orbitCore.selectAdapterByKey({adapterKey:e.adapter,adapter:i}),a=!!(e.tracker==="ethereum"&&e.pending&&o?.speedUpTxAction&&o?.cancelTxAction&&e.from.toLowerCase()===l?.toLowerCase()),d=()=>{a&&o.cancelTxAction(e);},v=()=>{a&&o.speedUpTxAction(e);},{StatusAwareText:f=S,TransactionKey:T=L,StatusBadge:x=F,SpeedUpButton:g=de,CancelButton:w=ue,TxInfoButton:b=me}=s?.components??{};return jsxRuntime.jsxs("div",{className:novaCore.cn("flex w-full flex-col gap-3 rounded-lg bg-[var(--tuwa-bg-primary)] p-4 shadow-md",c),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-[40px] flex-shrink-0 [&>img]:w-full [&>img]:h-auto",title:utils.getChainName(orbitCore.setChainId(e.chainId)),children:r??jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:orbitCore.setChainId(e.chainId)})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(f,{txStatus:e.status,source:e.title,fallback:e.type,variant:"title",applyColor:true}),jsxRuntime.jsx(f,{txStatus:e.status,source:e.description,variant:"description"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(T,{adapter:i,tx:e,variant:"toast"}),jsxRuntime.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[jsxRuntime.jsx(x,{tx:e}),a?jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(g,{onClick:v,children:n.speedUp}),jsxRuntime.jsx(w,{onClick:d,children:n.cancel})]}):t&&!!l&&jsxRuntime.jsx(b,{onClick:t,children:p.openTransactionsInfo})]})]})]})}function Wt({adapter:t,onClose:e,onOpenAllTransactions:r,className:c,customization:s,transactionsPool:l,executeTxAction:i,initialTx:n,connectedWalletAddress:p}){let o=react.useMemo(()=>n?.lastTxKey?l[n.lastTxKey]:void 0,[l,n]),a=o??n,d=n?.withTrackedModal&&!o||(o?.isTrackedModalOpen??false),{isProcessing:v,isSucceed:f,isFailed:T,isReplaced:x}=react.useMemo(()=>{let M=o?.status,Rt=n?.isInitializing??false,Kt=o?.pending??false;return {isProcessing:Rt||Kt,isSucceed:M===pulsarCore.TransactionStatus.Success,isFailed:o?.isError||!!n?.errorMessage,isReplaced:M===pulsarCore.TransactionStatus.Replaced}},[o,n]),g=react.useMemo(()=>a?orbitCore.selectAdapterByKey({adapterKey:a.adapter,adapter:t}):void 0,[a,t]),w=!!(T&&a&&n?.actionFunction&&i),b=!!(g?.speedUpTxAction&&g?.cancelTxAction&&o?.pending&&o.tracker==="ethereum"),O=()=>{if(!w||!g?.retryTxAction)return;let M={adapter:a.adapter,type:a.type,desiredChainID:"desiredChainID"in a?a.desiredChainID:a.chainId,actionFunction:n?.actionFunction,title:a.title,description:a.description,payload:a.payload,rpcUrl:"rpcUrl"in a?a?.rpcUrl:"desiredChainID"in a?a.desiredChainID:a.chainId.split(":")[1],withTrackedModal:"withTrackedModal"in a?a.withTrackedModal:false};g.retryTxAction({tx:M,txKey:o?.txKey??"",onClose:e,executeTxAction:i});},N=()=>{b&&o&&g.cancelTxAction(o);},ot=()=>{b&&o&&g.speedUpTxAction(o);},at=s?.components?.Header,rt=s?.components?.Footer,st=s?.components?.StatusVisual,nt=s?.components?.ProgressIndicator,it=s?.components?.InfoBlock,ct=s?.components?.ErrorBlock;return a?jsxRuntime.jsx(novaCore.Dialog,{open:d,onOpenChange:M=>!M&&e(o?.txKey),children:jsxRuntime.jsx(novaCore.DialogContent,{className:novaCore.cn("w-full sm:max-w-md",s?.modalProps?.className),...s?.modalProps,children:jsxRuntime.jsxs("div",{className:novaCore.cn("relative flex w-full flex-col",c),children:[at?jsxRuntime.jsx(at,{onClose:()=>e(o?.txKey),title:jsxRuntime.jsx(vt,{tx:a})}):jsxRuntime.jsx(Ce,{onClose:()=>e(o?.txKey),title:jsxRuntime.jsx(vt,{tx:a})}),jsxRuntime.jsxs("main",{className:"flex flex-col gap-4 p-4",children:[st?jsxRuntime.jsx(st,{isProcessing:v,isSucceed:f,isFailed:T,isReplaced:x}):jsxRuntime.jsx(wt,{isProcessing:v,isSucceed:f,isFailed:T,isReplaced:x}),nt?jsxRuntime.jsx(nt,{isProcessing:v,isSucceed:f,isFailed:T,isReplaced:x}):jsxRuntime.jsx(Ct,{isProcessing:v,isSucceed:f,isFailed:T,isReplaced:x}),it?jsxRuntime.jsx(it,{tx:a,adapter:t}):jsxRuntime.jsx(bt,{tx:a,adapter:t}),ct?jsxRuntime.jsx(ct,{error:o?.errorMessage||n?.errorMessage}):jsxRuntime.jsx(yt,{error:o?.errorMessage||n?.errorMessage})]}),rt?jsxRuntime.jsx(rt,{onClose:()=>e(o?.txKey),onOpenAllTransactions:r,isProcessing:v,isFailed:T,canReplace:b,onRetry:w?O:void 0,onSpeedUp:b?ot:void 0,onCancel:b?N:void 0,connectedWalletAddress:p}):jsxRuntime.jsx(we,{onClose:()=>e(o?.txKey),onOpenAllTransactions:r,isProcessing:v,isFailed:T,canReplace:b,onRetry:w?O:void 0,onSpeedUp:b?ot:void 0,onCancel:b?N:void 0,connectedWalletAddress:p})]})})}):null}function vt({tx:t}){return jsxRuntime.jsx(S,{txStatus:"status"in t?t.status:void 0,source:t.title,fallback:t.type,variant:"title",className:"text-lg"})}var Ce=({onClose:t,title:e})=>{let{actions:r}=m();return jsxRuntime.jsxs(novaCore.DialogHeader,{children:[jsxRuntime.jsx(novaCore.DialogTitle,{children:e}),jsxRuntime.jsx(novaCore.DialogClose,{asChild:true,children:jsxRuntime.jsx("button",{type:"button",onClick:()=>t(),"aria-label":r.close,className:`cursor-pointer rounded-full p-1
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
disabled:cursor-not-allowed disabled:opacity-50`,children:r&&!i?o.processing:o.close})]})]})};function yt({error:t,className:e}){let{isCopied:r,copy:c}=novaCore.useCopyToClipboard(),{actions:s,txError:l}=m();return t?jsxRuntime.jsxs("div",{className:novaCore.cn("rounded-lg border border-[var(--tuwa-error-icon)]/30 bg-[var(--tuwa-error-bg)] p-3 text-sm",e),children:[jsxRuntime.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 font-bold text-[var(--tuwa-error-icon)]",children:[jsxRuntime.jsx(solid.ExclamationTriangleIcon,{className:"h-5 w-5"}),jsxRuntime.jsx("span",{children:l.title})]}),jsxRuntime.jsx("button",{type:"button",onClick:()=>c(t),title:r?l.copied:s.copy,"aria-label":r?l.copied:`${s.copy} error message`,className:"cursor-pointer text-[var(--tuwa-error-icon)]/50 transition-colors hover:text-[var(--tuwa-error-icon)]",children:r?jsxRuntime.jsx(solid.CheckIcon,{className:"h-5 w-5 text-[var(--tuwa-success-icon)]"}):jsxRuntime.jsx(solid.DocumentDuplicateIcon,{className:"h-5 w-5"})})]}),jsxRuntime.jsx("div",{className:"max-h-24 overflow-y-auto rounded bg-[var(--tuwa-bg-primary)] p-2",children:jsxRuntime.jsx("p",{className:"font-mono text-xs text-[var(--tuwa-error-text)] break-all",children:t})})]}):null}function Ke({label:t,value:e}){return jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-[var(--tuwa-text-secondary)]",children:t}),jsxRuntime.jsx("span",{className:"font-medium text-[var(--tuwa-text-primary)]",children:e})]})}function bt({tx:t,adapter:e,className:r,customization:c}){let{txInfo:s,statuses:l,hashLabels:i}=m(),n=orbitCore.selectAdapterByKey({adapterKey:t.adapter,adapter:e});if(!n)return null;let{InfoRow:p=Ke}=c?.components??{},o="chainId"in t?t.chainId:t.desiredChainID,a=t.adapter===orbitCore.OrbitAdapter.SOLANA,d=a?t:void 0;return jsxRuntime.jsxs("div",{className:novaCore.cn("flex flex-col gap-3 rounded-lg border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)] p-3",r),children:[jsxRuntime.jsx(p,{label:s.network,value:jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2",children:[jsxRuntime.jsx("div",{className:"h-4 w-4",children:jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:orbitCore.setChainId(o)})}),jsxRuntime.jsx("span",{children:utils.getChainName(orbitCore.setChainId(o))})]})}),t.localTimestamp&&jsxRuntime.jsx(p,{label:s.started,value:It__default.default.unix(t.localTimestamp).format("MMM D, HH:mm:ss")}),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d?.slot&&jsxRuntime.jsx(p,{label:s.slot,value:jsxRuntime.jsx(D,{hash:d.slot.toString(),explorerUrl:n?.getExplorerUrl?`${n?.getExplorerUrl(`/block/${d.slot}`)}`:void 0})}),(typeof d?.confirmations=="number"||typeof d?.confirmations=="string")&&jsxRuntime.jsx(p,{label:l.confirmationsLabel,value:d.confirmations}),d?.recentBlockhash&&jsxRuntime.jsx(p,{label:i.recentBlockhash,value:jsxRuntime.jsx(D,{hash:d.recentBlockhash})})]}),"txKey"in t&&t.txKey&&jsxRuntime.jsx("div",{className:"border-t border-[var(--tuwa-border-primary)] pt-3",children:jsxRuntime.jsx(L,{tx:t,adapter:e,variant:"history",renderHashLink:c?.components?.transactionKey})})]})}var We={completed:{line:"bg-[var(--tuwa-success-icon)]",border:"border-[var(--tuwa-success-icon)]",fill:"bg-[var(--tuwa-success-icon)]"},error:{line:"bg-[var(--tuwa-error-icon)]",border:"border-[var(--tuwa-error-icon)]",fill:"bg-[var(--tuwa-error-icon)]"},replaced:{line:"bg-[var(--tuwa-info-icon)]",border:"border-[var(--tuwa-info-icon)]",fill:"bg-[var(--tuwa-info-icon)]"},active:{line:"bg-[var(--tuwa-pending-icon)]",border:"border-[var(--tuwa-pending-icon)]",fill:"bg-transparent",pulse:"bg-[var(--tuwa-pending-icon)]"},inactive:{line:"bg-[var(--tuwa-border-primary)]",border:"border-[var(--tuwa-border-primary)]",fill:"bg-transparent"}};function ze({status:t,label:e,isFirst:r=false}){let c=We[t],s=()=>{switch(t){case "completed":return jsxRuntime.jsx(solid.CheckIcon,{className:"h-3 w-3 text-white"});case "error":return jsxRuntime.jsx(solid.ExclamationTriangleIcon,{className:"h-3 w-3 text-white"});case "replaced":return jsxRuntime.jsx(solid.ArrowPathIcon,{className:"h-3 w-3 text-white"});case "active":return jsxRuntime.jsx("div",{className:novaCore.cn("h-2 w-2 animate-pulse rounded-full",c.pulse)});default:return null}};return jsxRuntime.jsxs("div",{className:"relative flex min-w-[80px] flex-1 flex-col items-center",children:[!r&&jsxRuntime.jsx("div",{className:novaCore.cn("absolute right-1/2 top-[10px] h-0.5 w-full",c.line)}),jsxRuntime.jsx("div",{className:novaCore.cn("relative z-10 flex h-5 w-5 items-center justify-center rounded-full border-2",c.border,c.fill),children:s()}),jsxRuntime.jsx("span",{className:novaCore.cn("mt-2 text-center text-xs",t!=="inactive"?"font-semibold text-[var(--tuwa-text-primary)]":"text-[var(--tuwa-text-secondary)]"),children:e})]})}function Ct({isProcessing:t,isSucceed:e,isFailed:r,isReplaced:c,className:s,StepComponent:l=ze}){let{trackingModal:i,statuses:n}=m(),p=react.useMemo(()=>{let o=d=>{if(d===1)return "completed";if(d===2){if(e||r||c)return "completed";if(t)return "active"}if(d===3){if(e)return "completed";if(r)return "error";if(c)return "replaced";if(t)return "active"}return "inactive"},a=d=>d===1?i.progressIndicator.created:d===2?i.progressIndicator.processing:r?n.failed:c?n.replaced:i.progressIndicator.succeed;return [{status:o(1),label:a(1),isFirst:true},{status:o(2),label:a(2)},{status:o(3),label:a(3),isLast:true}]},[t,e,r,c,i,n]);return jsxRuntime.jsx("div",{className:novaCore.cn("flex w-full items-start px-4 pt-2 pb-1",s),children:p.map((o,a)=>jsxRuntime.jsx(l,{...o},a))})}var Ye={succeed:{Icon:solid.CheckCircleIcon,className:"text-[var(--tuwa-success-icon)]"},failed:{Icon:solid.ExclamationCircleIcon,className:"text-[var(--tuwa-error-icon)]"},replaced:{Icon:solid.ArrowPathIcon,className:"text-[var(--tuwa-info-icon)]"},processing:{Icon:solid.ArrowPathIcon,className:"animate-spin text-[var(--tuwa-text-accent)]"},initializing:{Icon:solid.ClockIcon,className:"animate-pulse text-[var(--tuwa-pending-icon)]"}};function wt({isProcessing:t,isSucceed:e,isFailed:r,isReplaced:c}){let s=e&&"succeed"||r&&"failed"||c&&"replaced"||t&&"processing"||"initializing",{Icon:l,className:i}=Ye[s];return jsxRuntime.jsx("div",{className:"flex justify-center py-4",children:jsxRuntime.jsx(l,{className:novaCore.cn("h-16 w-16",i)})})}It__default.default.extend(Ze__default.default);var je=({chainId:t})=>jsxRuntime.jsx("div",{className:"h-8 w-8 text-[var(--tuwa-text-secondary)]",children:jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:orbitCore.setChainId(t)})}),to=({timestamp:t})=>jsxRuntime.jsx("span",{className:"mb-1 block text-xs text-[var(--tuwa-text-secondary)]",children:t?It__default.default.unix(t).fromNow():"..."});function kt({tx:t,adapter:e,className:r,customization:c}){let{Icon:s=je,Title:l=S,Description:i=S,Timestamp:n=to,StatusBadge:p=F,TransactionKey:o=L}=c?.components??{};return jsxRuntime.jsxs("div",{className:novaCore.cn("flex flex-col gap-2 border-b border-[var(--tuwa-border-secondary)] p-3 transition-colors hover:bg-[var(--tuwa-bg-secondary)]",r),children:[jsxRuntime.jsxs("div",{className:"flex items-start justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("div",{className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-[var(--tuwa-bg-muted)]",children:jsxRuntime.jsx(s,{chainId:t.chainId})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(l,{txStatus:t.status,source:t.title,fallback:t.type,variant:"title",applyColor:true}),jsxRuntime.jsx(n,{timestamp:t.localTimestamp}),jsxRuntime.jsx(i,{txStatus:t.status,source:t.description,variant:"description"})]})]}),jsxRuntime.jsx(p,{tx:t})]}),jsxRuntime.jsx(o,{tx:t,adapter:e,variant:"history"})]})}function ao({title:t,message:e,className:r}){return jsxRuntime.jsxs("div",{className:novaCore.cn("rounded-lg bg-[var(--tuwa-bg-muted)] p-8 text-center",r),children:[jsxRuntime.jsx("h4",{className:"font-semibold text-[var(--tuwa-text-primary)]",children:t}),jsxRuntime.jsx("p",{className:"mt-1 text-sm text-[var(--tuwa-text-secondary)]",children:e})]})}function St({adapter:t,connectedWalletAddress:e,transactionsPool:r,className:c,customization:s}){let{transactionsModal:l}=m(),i=react.useMemo(()=>e?pulsarCore.selectAllTransactionsByActiveWallet(r,e).sort((d,v)=>(v.localTimestamp??0)-(d.localTimestamp??0)):[],[r,e]),{Placeholder:n=ao,HistoryItem:p=kt}=s?.components??{},o=()=>e?i.length>0?jsxRuntime.jsx("div",{className:novaCore.cn("max-h-[400px] overflow-y-auto rounded-lg border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)]",s?.classNames?.listWrapper),children:i.map(a=>jsxRuntime.jsx(p,{tx:a,adapter:t},a.txKey))}):jsxRuntime.jsx(n,{title:l.history.noTransactionsTitle,message:l.history.noTransactionsMessage}):jsxRuntime.jsx(n,{title:l.history.connectWalletTitle,message:l.history.connectWalletMessage});return jsxRuntime.jsxs("div",{className:novaCore.cn("flex flex-col gap-y-3",c),children:[s?.title&&jsxRuntime.jsx("h3",{className:"text-lg font-bold text-[var(--tuwa-text-primary)]",children:s?.title}),o()]})}var po=({closeModal:t,title:e})=>{let{actions:r}=m();return jsxRuntime.jsxs(novaCore.DialogHeader,{children:[jsxRuntime.jsx(novaCore.DialogTitle,{children:e}),jsxRuntime.jsx(novaCore.DialogClose,{asChild:true,children:jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":r.close,className:`cursor-pointer rounded-full p-1
|
14
|
-
text-[var(--tuwa-text-tertiary)] transition-colors
|
15
|
-
hover:bg-[var(--tuwa-bg-muted)] hover:text-[var(--tuwa-text-primary)]`,children:jsxRuntime.jsx(novaCore.CloseIcon,{})})})]})};function zt({isOpen:t,setIsOpen:
|
1
|
+
'use strict';var solid=require('@heroicons/react/24/solid'),novaCore=require('@tuwaio/nova-core'),react=require('react'),jsxRuntime=require('react/jsx-runtime'),pulsarCore=require('@tuwaio/pulsar-core');require('react-toastify');var reactWeb3Icons=require('@bgd-labs/react-web3-icons'),utils=require('@bgd-labs/react-web3-icons/dist/utils'),orbitCore=require('@tuwaio/orbit-core'),It=require('dayjs'),jo=require('dayjs/plugin/relativeTime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var It__default=/*#__PURE__*/_interopDefault(It);var jo__default=/*#__PURE__*/_interopDefault(jo);var J={transactionsModal:{history:{title:"Transactions History",connectWalletTitle:"Connect Wallet",connectWalletMessage:"Please connect your wallet to see your past activity.",noTransactionsTitle:"No Transactions Yet",noTransactionsMessage:"Once you interact with the app, your transaction history will appear here."}},toast:{openTransactionsInfo:"Open transactions"},statuses:{pending:"Pending",success:"Success",failed:"Failed",reverted:"Reverted",replaced:"Replaced",unknown:"Unknown",confirmationsLabel:"Confirmations"},hashLabels:{gelato:"Gelato Task ID",safe:"Safe Tx Hash",original:"Original Tx Hash",replaced:"Replaced Tx Hash",default:"Tx Hash",recentBlockhash:"Recent Blockhash",solana:"Signature"},txInfo:{started:"Started",network:"Network",slot:"Slot"},txError:{title:"Error",copied:"Copied!"},trackingModal:{title:"Transaction Overview",processing:"Processing...",close:"Close",allTransactions:"All transactions",retry:"Retry",progressIndicator:{created:"Created",processing:"Processing",succeed:"Succeed"}},trackedTxButton:{loading:"Processing...",succeed:"Success",failed:"Failed",replaced:"Replaced"},actions:{copy:"Copy address",viewOnExplorer:"View on explorer",close:"Close",cancel:"Cancel",speedUp:"Speed up"}};var Ot=react.createContext(J);var v=()=>react.useContext(Ot);({[pulsarCore.TransactionStatus.Success]:"success",[pulsarCore.TransactionStatus.Failed]:"error",[pulsarCore.TransactionStatus.Replaced]:"info"});function D({label:t,hash:o,explorerUrl:n,variant:c="default",className:r}){let{isCopied:l,copy:i}=novaCore.useCopyToClipboard(),{actions:s,txError:p}=v(),a=novaCore.cn("novatx:flex novatx:items-center novatx:justify-between",{"novatx:text-sm":c==="default","novatx:text-xs":c==="compact"},r),e=novaCore.cn("novatx:pr-1",{"novatx:font-bold novatx:text-[var(--tuwa-text-primary)]":c==="default","novatx:font-medium novatx:text-[var(--tuwa-text-secondary)]":c==="compact"}),x=jsxRuntime.jsx("span",{className:"novatx:font-mono",children:novaCore.textCenterEllipsis(o,5,5)});return jsxRuntime.jsxs("div",{className:a,children:[t&&jsxRuntime.jsxs("span",{className:e,children:[t,":"]}),jsxRuntime.jsxs("div",{className:"novatx:flex novatx:items-center novatx:gap-x-2",children:[n?jsxRuntime.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"novatx:flex novatx:items-center novatx:gap-x-1 novatx:text-[var(--tuwa-text-accent)] novatx:transition-colors novatx:hover:underline",title:s.viewOnExplorer,"aria-label":s.viewOnExplorer,children:[x,jsxRuntime.jsx(solid.ArrowTopRightOnSquareIcon,{className:"novatx:h-4 novatx:w-4"})]}):jsxRuntime.jsx("span",{className:"novatx:text-[var(--tuwa-text-primary)]",children:x}),jsxRuntime.jsx("button",{type:"button",onClick:()=>i(o),className:"novatx:cursor-pointer novatx:text-[var(--tuwa-text-tertiary)] novatx:transition-colors novatx:hover:text-[var(--tuwa-text-secondary)]",title:l?p.copied:s.copy,"aria-label":l?p.copied:s.copy,children:l?jsxRuntime.jsx(solid.CheckIcon,{className:"novatx:h-4 novatx:w-4 novatx:text-[var(--tuwa-success-icon)]"}):jsxRuntime.jsx(solid.DocumentDuplicateIcon,{className:"novatx:h-4 novatx:w-4"})})]})]})}var pt={[pulsarCore.TransactionStatus.Success]:{index:1,colorClass:"novatx:text-[var(--tuwa-success-text)]"},[pulsarCore.TransactionStatus.Failed]:{index:2,colorClass:"novatx:text-[var(--tuwa-error-text)]"},[pulsarCore.TransactionStatus.Replaced]:{index:3,colorClass:"novatx:text-[var(--tuwa-text-secondary)]"},default:{index:0,colorClass:"novatx:text-[var(--tuwa-text-primary)]"}};function S({txStatus:t,source:o,fallback:n,variant:c,className:r,applyColor:l=false}){let i,s="";if(typeof o=="string")i=o;else if(Array.isArray(o)){let e=pt[t||"default"]??pt.default;i=o[e.index],l&&(s=e.colorClass);}else i=n;return i?jsxRuntime.jsx("div",{className:novaCore.cn(c==="title"?"novatx:text-sm novatx:font-semibold novatx:text-[var(--tuwa-text-primary)]":"novatx:mt-1 novatx:text-xs novatx:text-[var(--tuwa-text-secondary)]",s,r),children:i}):null}function Ut({closeToast:t}){let{actions:o}=v();return jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":o.close,title:o.close,className:novaCore.cn("novatx:absolute novatx:top-2 novatx:right-2 novatx:cursor-pointer novatx:rounded-full novatx:p-1","novatx:text-[var(--tuwa-text-tertiary)] novatx:transition-colors","novatx:hover:bg-[var(--tuwa-bg-muted)] novatx:hover:text-[var(--tuwa-text-primary)]"),children:jsxRuntime.jsx(solid.XMarkIcon,{className:"novatx:h-5 novatx:w-5"})})}function L({tx:t,adapter:o,variant:n="toast",className:c,renderHashLink:r,confirmations:l}){let{hashLabels:i,statuses:s}=v(),p=orbitCore.selectAdapterByKey({adapterKey:t.adapter,adapter:o});if(!p)return null;let a=f=>r?r(f):jsxRuntime.jsx(D,{...f}),e=n==="toast"?"novatx:mt-2 novatx:flex novatx:w-full novatx:flex-col novatx:gap-y-2 novatx:border-t novatx:border-[var(--tuwa-border-primary)] novatx:pt-2":"novatx:flex novatx:w-full novatx:flex-col novatx:gap-y-2",x=i[String(t.tracker)],g=x?a({label:x,hash:t.txKey,variant:t.tracker!==pulsarCore.TransactionTracker.Solana?"compact":"default",explorerUrl:p.getExplorerTxUrl&&t.tracker===pulsarCore.TransactionTracker.Solana?p?.getExplorerTxUrl(t):void 0}):null,u=(()=>{let f=t.hash,T=t.replacedTxHash;return !f&&!T?null:T?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f&&a({label:i.original,hash:f,variant:"compact"}),typeof p.getExplorerTxUrl<"u"&&a({label:i.replaced,hash:T,explorerUrl:p.getExplorerTxUrl(t)})]}):f&&typeof p.getExplorerTxUrl<"u"&&a({label:i.default,hash:f,explorerUrl:p.getExplorerTxUrl(t)})})(),m=x&&x!==i.default&&t.txKey!==t.hash;return jsxRuntime.jsxs("div",{className:novaCore.cn(e,c),children:[m&&g,u,typeof l=="number"&&jsxRuntime.jsxs("p",{className:"novatx:text-xs novatx:text-[var(--tuwa-text-tertiary)]",children:[s.confirmationsLabel,": ",l]})]})}var ro=t=>({Pending:{label:t.pending,Icon:solid.ArrowPathIcon,badgeClasses:"novatx:bg-[var(--tuwa-pending-bg)] novatx:text-[var(--tuwa-pending-text)]",iconClasses:"novatx:animate-spin novatx:text-[var(--tuwa-pending-icon)]"},[pulsarCore.TransactionStatus.Success]:{label:t.success,Icon:solid.CheckCircleIcon,badgeClasses:"novatx:bg-[var(--tuwa-success-bg)] novatx:text-[var(--tuwa-success-text)]",iconClasses:"novatx:text-[var(--tuwa-success-icon)]"},[pulsarCore.TransactionStatus.Failed]:{label:t.failed,Icon:solid.XCircleIcon,badgeClasses:"novatx:bg-[var(--tuwa-error-bg)] novatx:text-[var(--tuwa-error-text)]",iconClasses:"novatx:text-[var(--tuwa-error-icon)]"},[pulsarCore.TransactionStatus.Replaced]:{label:t.replaced,Icon:solid.ArrowPathIcon,badgeClasses:"novatx:bg-[var(--tuwa-info-bg)] novatx:text-[var(--tuwa-info-text)]",iconClasses:"novatx:text-[var(--tuwa-info-icon)]"}});function F({tx:t,className:o}){let{statuses:n}=v(),c=react.useMemo(()=>ro(n),[n]),r="novatx:inline-flex novatx:items-center novatx:gap-x-1.5 novatx:rounded-full novatx:px-2 novatx:py-1 novatx:text-xs novatx:font-medium",l=t.pending?"Pending":t.status,i=l?c[l]:null;if(!i)return jsxRuntime.jsx("div",{className:novaCore.cn(r,"novatx:bg-[var(--tuwa-info-bg)] novatx:text-[var(--tuwa-info-text)]",o),children:t.status??n.unknown});let{label:s,Icon:p,badgeClasses:a,iconClasses:e}=i;return jsxRuntime.jsxs("div",{className:novaCore.cn(r,a,o),children:[jsxRuntime.jsx(p,{className:novaCore.cn("novatx:h-4 novatx:w-4",e)}),s]})}var xo=({onClick:t,children:o})=>jsxRuntime.jsx("button",{onClick:t,type:"button",className:"novatx:cursor-pointer novatx:text-sm novatx:font-medium novatx:text-[var(--tuwa-text-accent)] novatx:transition-opacity novatx:hover:opacity-80",children:o}),vo=({onClick:t,children:o})=>jsxRuntime.jsx("button",{onClick:t,type:"button",className:"novatx:cursor-pointer novatx:text-sm novatx:font-medium novatx:text-[var(--tuwa-text-secondary)] novatx:transition-opacity novatx:hover:opacity-80",children:o}),uo=({onClick:t,children:o})=>jsxRuntime.jsx("button",{className:"novatx:cursor-pointer novatx:rounded-md novatx:bg-gradient-to-r novatx:from-[var(--tuwa-button-gradient-from)] novatx:to-[var(--tuwa-button-gradient-to)] novatx:px-3 novatx:py-1 novatx:text-xs novatx:font-bold novatx:text-[var(--tuwa-text-on-accent)] novatx:shadow-lg novatx:transition-all novatx:duration-200 novatx:ease-in-out novatx:hover:shadow-xl novatx:hover:from-[var(--tuwa-button-gradient-from-hover)] novatx:hover:to-[var(--tuwa-button-gradient-to-hover)] novatx:active:scale-95",onClick:t,type:"button",children:o});function Ft({openTxInfoModal:t,tx:o,icon:n,className:c,customization:r,connectedWalletAddress:l,adapter:i}){let{actions:s,toast:p}=v(),a=orbitCore.selectAdapterByKey({adapterKey:o.adapter,adapter:i}),e=!!(o.tracker==="ethereum"&&o.pending&&a?.speedUpTxAction&&a?.cancelTxAction&&o.from.toLowerCase()===l?.toLowerCase()),x=()=>{e&&a.cancelTxAction(o);},g=()=>{e&&a.speedUpTxAction(o);},{StatusAwareText:u=S,TransactionKey:m=L,StatusBadge:f=F,SpeedUpButton:T=xo,CancelButton:w=vo,TxInfoButton:b=uo}=r?.components??{};return jsxRuntime.jsxs("div",{className:novaCore.cn("novatx:flex novatx:w-full novatx:flex-col novatx:gap-3 novatx:rounded-lg novatx:bg-[var(--tuwa-bg-primary)] novatx:p-4 novatx:shadow-md",c),children:[jsxRuntime.jsxs("div",{className:"novatx:flex novatx:items-center novatx:gap-3",children:[jsxRuntime.jsx("div",{className:"novatx:w-[40px] novatx:flex-shrink-0 [&>img]:novatx:w-full [&>img]:novatx:h-auto",title:utils.getChainName(orbitCore.setChainId(o.chainId)),children:n??jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:orbitCore.setChainId(o.chainId)})}),jsxRuntime.jsxs("div",{className:"novatx:flex-1",children:[jsxRuntime.jsx(u,{txStatus:o.status,source:o.title,fallback:o.type,variant:"title",applyColor:true}),jsxRuntime.jsx(u,{txStatus:o.status,source:o.description,variant:"description"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(m,{adapter:i,tx:o,variant:"toast"}),jsxRuntime.jsxs("div",{className:"novatx:mt-3 novatx:flex novatx:items-center novatx:justify-between",children:[jsxRuntime.jsx(f,{tx:o}),e?jsxRuntime.jsxs("div",{className:"novatx:flex novatx:items-center novatx:gap-4",children:[jsxRuntime.jsx(T,{onClick:g,children:s.speedUp}),jsxRuntime.jsx(w,{onClick:x,children:s.cancel})]}):t&&!!l&&jsxRuntime.jsx(b,{onClick:t,children:p.openTransactionsInfo})]})]})]})}function Wt({adapter:t,onClose:o,onOpenAllTransactions:n,className:c,customization:r,transactionsPool:l,executeTxAction:i,initialTx:s,connectedWalletAddress:p}){let a=react.useMemo(()=>s?.lastTxKey?l[s.lastTxKey]:void 0,[l,s]),e=a??s,x=s?.withTrackedModal&&!a||(a?.isTrackedModalOpen??false),{isProcessing:g,isSucceed:u,isFailed:m,isReplaced:f}=react.useMemo(()=>{let M=a?.status,Rt=s?.isInitializing??false,Kt=a?.pending??false;return {isProcessing:Rt||Kt,isSucceed:M===pulsarCore.TransactionStatus.Success,isFailed:a?.isError||!!s?.errorMessage,isReplaced:M===pulsarCore.TransactionStatus.Replaced}},[a,s]),T=react.useMemo(()=>e?orbitCore.selectAdapterByKey({adapterKey:e.adapter,adapter:t}):void 0,[e,t]),w=!!(m&&e&&s?.actionFunction&&i),b=!!(T?.speedUpTxAction&&T?.cancelTxAction&&a?.pending&&a.tracker==="ethereum"),O=()=>{if(!w||!T?.retryTxAction)return;let M={adapter:e.adapter,type:e.type,desiredChainID:"desiredChainID"in e?e.desiredChainID:e.chainId,actionFunction:s?.actionFunction,title:e.title,description:e.description,payload:e.payload,rpcUrl:"rpcUrl"in e?e?.rpcUrl:"desiredChainID"in e?e.desiredChainID:e.chainId.split(":")[1],withTrackedModal:"withTrackedModal"in e?e.withTrackedModal:false};T.retryTxAction({tx:M,txKey:a?.txKey??"",onClose:o,executeTxAction:i});},N=()=>{b&&a&&T.cancelTxAction(a);},at=()=>{b&&a&&T.speedUpTxAction(a);},et=r?.components?.Header,nt=r?.components?.Footer,rt=r?.components?.StatusVisual,st=r?.components?.ProgressIndicator,it=r?.components?.InfoBlock,ct=r?.components?.ErrorBlock;return e?jsxRuntime.jsx(novaCore.Dialog,{open:x,onOpenChange:M=>!M&&o(a?.txKey),children:jsxRuntime.jsx(novaCore.DialogContent,{className:novaCore.cn("novatx:w-full novatx:sm:max-w-md",r?.modalProps?.className),...r?.modalProps,children:jsxRuntime.jsxs("div",{className:novaCore.cn("novatx:relative novatx:flex novatx:w-full novatx:flex-col",c),children:[et?jsxRuntime.jsx(et,{onClose:()=>o(a?.txKey),title:jsxRuntime.jsx(gt,{tx:e})}):jsxRuntime.jsx(wo,{onClose:()=>o(a?.txKey),title:jsxRuntime.jsx(gt,{tx:e})}),jsxRuntime.jsxs("main",{className:"novatx:flex novatx:flex-col novatx:gap-4 novatx:p-4",children:[rt?jsxRuntime.jsx(rt,{isProcessing:g,isSucceed:u,isFailed:m,isReplaced:f}):jsxRuntime.jsx(wt,{isProcessing:g,isSucceed:u,isFailed:m,isReplaced:f}),st?jsxRuntime.jsx(st,{isProcessing:g,isSucceed:u,isFailed:m,isReplaced:f}):jsxRuntime.jsx(Ct,{isProcessing:g,isSucceed:u,isFailed:m,isReplaced:f}),it?jsxRuntime.jsx(it,{tx:e,adapter:t}):jsxRuntime.jsx(bt,{tx:e,adapter:t}),ct?jsxRuntime.jsx(ct,{error:a?.errorMessage||s?.errorMessage}):jsxRuntime.jsx(yt,{error:a?.errorMessage||s?.errorMessage})]}),nt?jsxRuntime.jsx(nt,{onClose:()=>o(a?.txKey),onOpenAllTransactions:n,isProcessing:g,isFailed:m,canReplace:b,onRetry:w?O:void 0,onSpeedUp:b?at:void 0,onCancel:b?N:void 0,connectedWalletAddress:p}):jsxRuntime.jsx(ho,{onClose:()=>o(a?.txKey),onOpenAllTransactions:n,isProcessing:g,isFailed:m,canReplace:b,onRetry:w?O:void 0,onSpeedUp:b?at:void 0,onCancel:b?N:void 0,connectedWalletAddress:p})]})})}):null}function gt({tx:t}){return jsxRuntime.jsx(S,{txStatus:"status"in t?t.status:void 0,source:t.title,fallback:t.type,variant:"title",className:"novatx:text-lg"})}var wo=({onClose:t,title:o})=>{let{actions:n}=v();return jsxRuntime.jsxs(novaCore.DialogHeader,{children:[jsxRuntime.jsx(novaCore.DialogTitle,{children:o}),jsxRuntime.jsx(novaCore.DialogClose,{asChild:true,children:jsxRuntime.jsx("button",{type:"button",onClick:()=>t(),"aria-label":n.close,className:`novatx:cursor-pointer novatx:rounded-full novatx:p-1
|
2
|
+
novatx:text-[var(--tuwa-text-tertiary)] novatx:transition-colors
|
3
|
+
novatx:hover:bg-[var(--tuwa-bg-muted)] novatx:hover:text-[var(--tuwa-text-primary)]`,children:jsxRuntime.jsx(novaCore.CloseIcon,{})})})]})},ho=({onClose:t,onOpenAllTransactions:o,isProcessing:n,onRetry:c,onSpeedUp:r,onCancel:l,canReplace:i,isFailed:s,connectedWalletAddress:p})=>{let{trackingModal:a,actions:e}=v(),x=()=>s&&c?jsxRuntime.jsx("button",{type:"button",onClick:c,className:`novatx:cursor-pointer novatx:rounded-t-md novatx:sm:rounded-md
|
4
|
+
novatx:bg-gradient-to-r novatx:from-[var(--tuwa-button-gradient-from)] novatx:to-[var(--tuwa-button-gradient-to)]
|
5
|
+
novatx:px-4 novatx:py-2 novatx:text-sm novatx:font-semibold novatx:text-[var(--tuwa-text-on-accent)] novatx:transition-opacity
|
6
|
+
novatx:hover:from-[var(--tuwa-button-gradient-from-hover)] novatx:hover:to-[var(--tuwa-button-gradient-to-hover)]`,children:a.retry}):!n&&!i&&p?jsxRuntime.jsx("button",{type:"button",onClick:o,className:`novatx:cursor-pointer novatx:rounded-md
|
7
|
+
novatx:bg-[var(--tuwa-bg-muted)] novatx:px-4 novatx:py-2 novatx:text-sm novatx:font-semibold novatx:text-[var(--tuwa-text-primary)]
|
8
|
+
novatx:transition-colors novatx:hover:bg-[var(--tuwa-border-primary)]`,children:a.allTransactions}):null;return jsxRuntime.jsxs("footer",{className:`novatx:flex novatx:w-full novatx:items-center novatx:justify-between
|
9
|
+
novatx:border-t novatx:border-[var(--tuwa-border-primary)] novatx:p-4`,children:[jsxRuntime.jsx("div",{className:"novatx:flex novatx:items-center novatx:gap-4",children:i&&r&&l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:r,className:`novatx:cursor-pointer novatx:text-sm novatx:font-medium
|
10
|
+
novatx:text-[var(--tuwa-text-accent)] novatx:transition-opacity novatx:hover:opacity-80`,children:e.speedUp}),jsxRuntime.jsx("button",{type:"button",onClick:l,className:`novatx:cursor-pointer novatx:text-sm novatx:font-medium
|
11
|
+
novatx:text-[var(--tuwa-text-secondary)] novatx:transition-opacity novatx:hover:opacity-80`,children:e.cancel})]})}),jsxRuntime.jsxs("div",{className:"novatx:flex novatx:items-center novatx:gap-3",children:[jsxRuntime.jsx(x,{}),jsxRuntime.jsx("button",{type:"button",onClick:t,disabled:n&&!i,className:`novatx:cursor-pointer novatx:rounded-md novatx:bg-[var(--tuwa-bg-muted)] novatx:px-4 novatx:py-2 novatx:text-sm novatx:font-semibold
|
12
|
+
novatx:text-[var(--tuwa-text-primary)] novatx:transition-colors novatx:hover:bg-[var(--tuwa-border-primary)]
|
13
|
+
novatx:disabled:cursor-not-allowed novatx:disabled:opacity-50`,children:n&&!i?a.processing:a.close})]})]})};function yt({error:t,className:o}){let{isCopied:n,copy:c}=novaCore.useCopyToClipboard(),{actions:r,txError:l}=v();return t?jsxRuntime.jsxs("div",{className:novaCore.cn("novatx:rounded-lg novatx:border novatx:border-[var(--tuwa-error-icon)]/30 novatx:bg-[var(--tuwa-error-bg)] novatx:p-3 novatx:text-sm",o),children:[jsxRuntime.jsxs("div",{className:"novatx:mb-2 novatx:flex novatx:items-center novatx:justify-between",children:[jsxRuntime.jsxs("div",{className:"novatx:flex novatx:items-center novatx:gap-2 novatx:font-bold novatx:text-[var(--tuwa-error-icon)]",children:[jsxRuntime.jsx(solid.ExclamationTriangleIcon,{className:"novatx:h-5 novatx:w-5"}),jsxRuntime.jsx("span",{children:l.title})]}),jsxRuntime.jsx("button",{type:"button",onClick:()=>c(t),title:n?l.copied:r.copy,"aria-label":n?l.copied:`${r.copy} error message`,className:"novatx:cursor-pointer novatx:text-[var(--tuwa-error-icon)]/50 novatx:transition-colors novatx:hover:text-[var(--tuwa-error-icon)]",children:n?jsxRuntime.jsx(solid.CheckIcon,{className:"novatx:h-5 novatx:w-5 novatx:text-[var(--tuwa-success-icon)]"}):jsxRuntime.jsx(solid.DocumentDuplicateIcon,{className:"novatx:h-5 novatx:w-5"})})]}),jsxRuntime.jsx("div",{className:"novatx:max-h-24 novatx:overflow-y-auto novatx:rounded novatx:bg-[var(--tuwa-bg-primary)] novatx:p-2",children:jsxRuntime.jsx("p",{className:"novatx:font-mono novatx:text-xs novatx:text-[var(--tuwa-error-text)] novatx:break-all",children:t})})]}):null}function Do({label:t,value:o}){return jsxRuntime.jsxs("div",{className:"novatx:flex novatx:items-center novatx:justify-between novatx:text-sm",children:[jsxRuntime.jsx("span",{className:"novatx:text-[var(--tuwa-text-secondary)]",children:t}),jsxRuntime.jsx("span",{className:"novatx:font-medium novatx:text-[var(--tuwa-text-primary)]",children:o})]})}function bt({tx:t,adapter:o,className:n,customization:c}){let{txInfo:r,statuses:l,hashLabels:i}=v(),s=orbitCore.selectAdapterByKey({adapterKey:t.adapter,adapter:o});if(!s)return null;let{InfoRow:p=Do}=c?.components??{},a="chainId"in t?t.chainId:t.desiredChainID,e=t.adapter===orbitCore.OrbitAdapter.SOLANA,x=e?t:void 0;return jsxRuntime.jsxs("div",{className:novaCore.cn("novatx:flex novatx:flex-col novatx:gap-3 novatx:rounded-lg novatx:border novatx:border-[var(--tuwa-border-primary)] novatx:bg-[var(--tuwa-bg-primary)] novatx:p-3",n),children:[jsxRuntime.jsx(p,{label:r.network,value:jsxRuntime.jsxs("div",{className:"novatx:flex novatx:items-center novatx:justify-end novatx:gap-2",children:[jsxRuntime.jsx("div",{className:"novatx:h-4 novatx:w-4",children:jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:orbitCore.setChainId(a)})}),jsxRuntime.jsx("span",{children:utils.getChainName(orbitCore.setChainId(a))})]})}),t.localTimestamp&&jsxRuntime.jsx(p,{label:r.started,value:It__default.default.unix(t.localTimestamp).format("MMM D, HH:mm:ss")}),e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[x?.slot&&jsxRuntime.jsx(p,{label:r.slot,value:jsxRuntime.jsx(D,{hash:x.slot.toString(),explorerUrl:s?.getExplorerUrl?`${s?.getExplorerUrl(`/block/${x.slot}`)}`:void 0})}),(typeof x?.confirmations=="number"||typeof x?.confirmations=="string")&&jsxRuntime.jsx(p,{label:l.confirmationsLabel,value:x.confirmations}),x?.recentBlockhash&&jsxRuntime.jsx(p,{label:i.recentBlockhash,value:jsxRuntime.jsx(D,{hash:x.recentBlockhash})})]}),"txKey"in t&&t.txKey&&jsxRuntime.jsx("div",{className:"novatx:border-t novatx:border-[var(--tuwa-border-primary)] novatx:pt-3",children:jsxRuntime.jsx(L,{tx:t,adapter:o,variant:"history",renderHashLink:c?.components?.transactionKey})})]})}var zo={completed:{line:"novatx:bg-[var(--tuwa-success-icon)]",border:"novatx:border-[var(--tuwa-success-icon)]",fill:"novatx:bg-[var(--tuwa-success-icon)]"},error:{line:"novatx:bg-[var(--tuwa-error-icon)]",border:"novatx:border-[var(--tuwa-error-icon)]",fill:"novatx:bg-[var(--tuwa-error-icon)]"},replaced:{line:"novatx:bg-[var(--tuwa-info-icon)]",border:"novatx:border-[var(--tuwa-info-icon)]",fill:"novatx:bg-[var(--tuwa-info-icon)]"},active:{line:"novatx:bg-[var(--tuwa-pending-icon)]",border:"novatx:border-[var(--tuwa-pending-icon)]",fill:"novatx:bg-transparent",pulse:"novatx:bg-[var(--tuwa-pending-icon)]"},inactive:{line:"novatx:bg-[var(--tuwa-border-primary)]",border:"novatx:border-[var(--tuwa-border-primary)]",fill:"novatx:bg-transparent"}};function Vo({status:t,label:o,isFirst:n=false}){let c=zo[t],r=()=>{switch(t){case "completed":return jsxRuntime.jsx(solid.CheckIcon,{className:"novatx:h-3 novatx:w-3 novatx:text-white"});case "error":return jsxRuntime.jsx(solid.ExclamationTriangleIcon,{className:"novatx:h-3 novatx:w-3 novatx:text-white"});case "replaced":return jsxRuntime.jsx(solid.ArrowPathIcon,{className:"novatx:h-3 novatx:w-3 novatx:text-white"});case "active":return jsxRuntime.jsx("div",{className:novaCore.cn("novatx:h-2 novatx:w-2 novatx:animate-pulse novatx:rounded-full",c.pulse)});default:return null}};return jsxRuntime.jsxs("div",{className:"novatx:relative novatx:flex novatx:min-w-[80px] novatx:flex-1 novatx:flex-col novatx:items-center",children:[!n&&jsxRuntime.jsx("div",{className:novaCore.cn("novatx:absolute novatx:right-1/2 novatx:top-[10px] novatx:h-0.5 novatx:w-full",c.line)}),jsxRuntime.jsx("div",{className:novaCore.cn("novatx:relative novatx:z-10 novatx:flex novatx:h-5 novatx:w-5 novatx:items-center novatx:justify-center novatx:rounded-full novatx:border-2",c.border,c.fill),children:r()}),jsxRuntime.jsx("span",{className:novaCore.cn("novatx:mt-2 novatx:text-center novatx:text-xs",t!=="inactive"?"novatx:font-semibold novatx:text-[var(--tuwa-text-primary)]":"novatx:text-[var(--tuwa-text-secondary)]"),children:o})]})}function Ct({isProcessing:t,isSucceed:o,isFailed:n,isReplaced:c,className:r,StepComponent:l=Vo}){let{trackingModal:i,statuses:s}=v(),p=react.useMemo(()=>{let a=x=>{if(x===1)return "completed";if(x===2){if(o||n||c)return "completed";if(t)return "active"}if(x===3){if(o)return "completed";if(n)return "error";if(c)return "replaced";if(t)return "active"}return "inactive"},e=x=>x===1?i.progressIndicator.created:x===2?i.progressIndicator.processing:n?s.failed:c?s.replaced:i.progressIndicator.succeed;return [{status:a(1),label:e(1),isFirst:true},{status:a(2),label:e(2)},{status:a(3),label:e(3),isLast:true}]},[t,o,n,c,i,s]);return jsxRuntime.jsx("div",{className:novaCore.cn("novatx:flex novatx:w-full novatx:items-start novatx:px-4 novatx:pt-2 novatx:pb-1",r),children:p.map((a,e)=>jsxRuntime.jsx(l,{...a},e))})}var $o={succeed:{Icon:solid.CheckCircleIcon,className:"novatx:text-[var(--tuwa-success-icon)]"},failed:{Icon:solid.ExclamationCircleIcon,className:"novatx:text-[var(--tuwa-error-icon)]"},replaced:{Icon:solid.ArrowPathIcon,className:"novatx:text-[var(--tuwa-info-icon)]"},processing:{Icon:solid.ArrowPathIcon,className:"novatx:animate-spin novatx:text-[var(--tuwa-text-accent)]"},initializing:{Icon:solid.ClockIcon,className:"novatx:animate-pulse novatx:text-[var(--tuwa-pending-icon)]"}};function wt({isProcessing:t,isSucceed:o,isFailed:n,isReplaced:c}){let r=o&&"succeed"||n&&"failed"||c&&"replaced"||t&&"processing"||"initializing",{Icon:l,className:i}=$o[r];return jsxRuntime.jsx("div",{className:"novatx:flex novatx:justify-center novatx:py-4",children:jsxRuntime.jsx(l,{className:novaCore.cn("novatx:h-16 novatx:w-16",i)})})}It__default.default.extend(jo__default.default);var ta=({chainId:t})=>jsxRuntime.jsx("div",{className:"novatx:h-8 novatx:w-8 novatx:text-[var(--tuwa-text-secondary)]",children:jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:orbitCore.setChainId(t)})}),oa=({timestamp:t})=>jsxRuntime.jsx("span",{className:"novatx:mb-1 novatx:block novatx:text-xs novatx:text-[var(--tuwa-text-secondary)]",children:t?It__default.default.unix(t).fromNow():"..."});function kt({tx:t,adapter:o,className:n,customization:c}){let{Icon:r=ta,Title:l=S,Description:i=S,Timestamp:s=oa,StatusBadge:p=F,TransactionKey:a=L}=c?.components??{};return jsxRuntime.jsxs("div",{className:novaCore.cn("novatx:flex novatx:flex-col novatx:gap-2 novatx:border-b novatx:border-[var(--tuwa-border-secondary)] novatx:p-3 novatx:transition-colors novatx:hover:bg-[var(--tuwa-bg-secondary)]",n),children:[jsxRuntime.jsxs("div",{className:"novatx:flex novatx:items-start novatx:justify-between",children:[jsxRuntime.jsxs("div",{className:"novatx:flex novatx:items-center novatx:gap-4",children:[jsxRuntime.jsx("div",{className:"novatx:flex novatx:h-10 novatx:w-10 novatx:flex-shrink-0 novatx:items-center novatx:justify-center novatx:rounded-full novatx:bg-[var(--tuwa-bg-muted)]",children:jsxRuntime.jsx(r,{chainId:t.chainId})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(l,{txStatus:t.status,source:t.title,fallback:t.type,variant:"title",applyColor:true}),jsxRuntime.jsx(s,{timestamp:t.localTimestamp}),jsxRuntime.jsx(i,{txStatus:t.status,source:t.description,variant:"description"})]})]}),jsxRuntime.jsx(p,{tx:t})]}),jsxRuntime.jsx(a,{tx:t,adapter:o,variant:"history"})]})}function na({title:t,message:o,className:n}){return jsxRuntime.jsxs("div",{className:novaCore.cn("novatx:rounded-lg novatx:bg-[var(--tuwa-bg-muted)] novatx:p-8 novatx:text-center",n),children:[jsxRuntime.jsx("h4",{className:"novatx:font-semibold novatx:text-[var(--tuwa-text-primary)]",children:t}),jsxRuntime.jsx("p",{className:"novatx:mt-1 novatx:text-sm novatx:text-[var(--tuwa-text-secondary)]",children:o})]})}function St({adapter:t,connectedWalletAddress:o,transactionsPool:n,className:c,customization:r}){let{transactionsModal:l}=v(),i=react.useMemo(()=>o?pulsarCore.selectAllTransactionsByActiveWallet(n,o).sort((x,g)=>(g.localTimestamp??0)-(x.localTimestamp??0)):[],[n,o]),{Placeholder:s=na,HistoryItem:p=kt}=r?.components??{},a=()=>o?i.length>0?jsxRuntime.jsx("div",{className:novaCore.cn("NovaCustomScroll novatx:max-h-[400px] novatx:overflow-y-auto novatx:rounded-lg novatx:border novatx:border-[var(--tuwa-border-primary)] novatx:bg-[var(--tuwa-bg-primary)]",r?.classNames?.listWrapper),children:i.map(e=>jsxRuntime.jsx(p,{tx:e,adapter:t},e.txKey))}):jsxRuntime.jsx(s,{title:l.history.noTransactionsTitle,message:l.history.noTransactionsMessage}):jsxRuntime.jsx(s,{title:l.history.connectWalletTitle,message:l.history.connectWalletMessage});return jsxRuntime.jsxs("div",{className:novaCore.cn("novatx:flex novatx:flex-col novatx:gap-y-3",c),children:[r?.title&&jsxRuntime.jsx("h3",{className:"novatx:text-lg novatx:font-bold novatx:text-[var(--tuwa-text-primary)]",children:r?.title}),a()]})}var xa=({closeModal:t,title:o})=>{let{actions:n}=v();return jsxRuntime.jsxs(novaCore.DialogHeader,{children:[jsxRuntime.jsx(novaCore.DialogTitle,{children:o}),jsxRuntime.jsx(novaCore.DialogClose,{asChild:true,children:jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":n.close,className:`novatx:cursor-pointer novatx:rounded-full novatx:p-1
|
14
|
+
novatx:text-[var(--tuwa-text-tertiary)] novatx:transition-colors
|
15
|
+
novatx:hover:bg-[var(--tuwa-bg-muted)] novatx:hover:text-[var(--tuwa-text-primary)]`,children:jsxRuntime.jsx(novaCore.CloseIcon,{})})})]})};function zt({isOpen:t,setIsOpen:o,customization:n,adapter:c,connectedWalletAddress:r,transactionsPool:l}){let{transactionsModal:i}=v(),s=()=>o(false),p=n?.components?.Header,a=n?.components?.History;return jsxRuntime.jsx(novaCore.Dialog,{open:t,onOpenChange:e=>!e&&s(),children:jsxRuntime.jsx(novaCore.DialogContent,{className:novaCore.cn("novatx:w-full novatx:sm:max-w-2xl",n?.modalProps?.className),...n?.modalProps,children:jsxRuntime.jsxs("div",{className:novaCore.cn("novatx:relative novatx:max-h-[95dvh] novatx:w-full novatx:flex novatx:flex-col",n?.classNames?.contentWrapper),children:[p?jsxRuntime.jsx(p,{closeModal:s}):jsxRuntime.jsx(xa,{closeModal:s,title:i.history.title}),a?jsxRuntime.jsx(a,{adapter:c,transactionsPool:l,connectedWalletAddress:r}):jsxRuntime.jsx(St,{adapter:c,transactionsPool:l,connectedWalletAddress:r})]})})})}var fa=t=>({replaced:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(solid.ArrowPathIcon,{className:"novatx:h-4 novatx:w-4"}),jsxRuntime.jsx("span",{children:t.replaced})]}),loading:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(solid.ArrowPathIcon,{className:"novatx:h-4 novatx:w-4 novatx:animate-spin"}),jsxRuntime.jsx("span",{children:t.loading})]}),succeed:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(solid.CheckCircleIcon,{className:"novatx:h-4 novatx:w-4"}),jsxRuntime.jsx("span",{children:t.succeed})]}),failed:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(solid.ExclamationCircleIcon,{className:"novatx:h-4 novatx:w-4"}),jsxRuntime.jsx("span",{children:t.failed})]})});function Or({children:t,action:o,getLastTxKey:n,transactionsPool:c,walletAddress:r,loadingContent:l,succeedContent:i,failedContent:s,replacedContent:p,resetTimeout:a=2500,className:e,...x}){let{trackedTxButton:g}=v(),[u,m]=react.useState("idle"),[f,T]=react.useState(void 0),w=react.useMemo(()=>fa(g),[g]);react.useEffect(()=>{m("idle"),T(void 0);},[r]),react.useEffect(()=>{if(!f)return;let N=c[f];if(N)switch(N.status){case pulsarCore.TransactionStatus.Success:m("succeed");break;case pulsarCore.TransactionStatus.Replaced:m("replaced");break;case pulsarCore.TransactionStatus.Failed:m("failed");break}},[c,f,r]),react.useEffect(()=>{if(["succeed","failed","replaced"].includes(u)){let N=setTimeout(()=>{m("idle"),T(void 0);},a);return ()=>clearTimeout(N)}},[u,a]);let b=async()=>{m("loading");try{await o(),T(n());}catch(N){console.error("Transaction initiation failed:",N),m("failed");}},O=()=>{switch(u){case "loading":return l??w.loading;case "succeed":return i??w.succeed;case "failed":return s??w.failed;case "replaced":return p??w.replaced;default:return t}};return jsxRuntime.jsx("button",{...x,disabled:u!=="idle"||x.disabled,onClick:b,className:novaCore.cn("novatx:flex novatx:cursor-pointer novatx:items-center novatx:justify-center novatx:gap-1.5 novatx:rounded-md novatx:px-3 novatx:py-1.5 novatx:text-sm novatx:font-medium novatx:transition-all novatx:duration-200 novatx:disabled:cursor-not-allowed novatx:disabled:opacity-70",{"novatx:bg-gradient-to-r novatx:from-[var(--tuwa-button-gradient-from)] novatx:to-[var(--tuwa-button-gradient-to)] novatx:text-[var(--tuwa-text-on-accent)] novatx:hover:opacity-90":u==="idle","novatx:bg-gray-400 novatx:text-white":u==="loading","novatx:bg-gray-500 novatx:text-white":u==="replaced","novatx:bg-[var(--tuwa-success-bg)] novatx:text-[var(--tuwa-success-text)]":u==="succeed","novatx:bg-[var(--tuwa-error-bg)] novatx:text-[var(--tuwa-error-text)]":u==="failed"},e),children:O()})}exports.HashLink=D;exports.StatusAwareText=S;exports.ToastCloseButton=Ut;exports.ToastTransaction=Ft;exports.TrackingTxModal=Wt;exports.TransactionHistoryItem=kt;exports.TransactionKey=L;exports.TransactionStatusBadge=F;exports.TransactionsHistory=St;exports.TransactionsInfoModal=zt;exports.TxActionButton=Or;exports.TxErrorBlock=yt;exports.TxInfoBlock=bt;exports.TxProgressIndicator=Ct;exports.TxStatusVisual=wt;exports.defaultLabels=J;//# sourceMappingURL=index.cjs.map
|
16
16
|
//# sourceMappingURL=index.cjs.map
|