@tuwaio/nova-transactions 0.0.1

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.
@@ -0,0 +1,173 @@
1
+ import { T as TuwaLabels } from './types-bqi7UbSO.cjs';
2
+ export { H as HashLink, S as StatusAwareText, n as StepProps, m as StepStatus, c as ToastTransaction, a as ToastTransactionCustomization, v as ToastTransactionKeyProps, b as ToastTransactionProps, g as TrackingTxModal, e as TrackingTxModalCustomization, f as TrackingTxModalProps, u as TransactionHistoryItem, s as TransactionHistoryItemCustomization, t as TransactionHistoryItemProps, w as TransactionKey, z as TransactionStatusBadge, y as TransactionsHistory, x as TransactionsHistoryCustomization, d as TxActions, i as TxErrorBlock, h as TxErrorBlockProps, l as TxInfoBlock, j as TxInfoBlockCustomization, k as TxInfoBlockProps, p as TxProgressIndicator, o as TxProgressIndicatorProps, r as TxStatusVisual, q as TxStatusVisualProps, B as WalletInfoModal, W as WalletInfoModalCustomization, A as WalletInfoModalProps } from './types-bqi7UbSO.cjs';
3
+ import { JSX, ReactNode, ButtonHTMLAttributes } from 'react';
4
+ import { Transaction, IInitializeTxTrackingStore } from '@tuwaio/pulsar-core';
5
+ import { Chain, Address } from 'viem';
6
+ import '@wagmi/core';
7
+ import 'react-toastify';
8
+ import '@radix-ui/react-dialog';
9
+ import '@tuwaio/pulsar-evm';
10
+ import 'framer-motion';
11
+ import 'react/jsx-runtime';
12
+
13
+ /**
14
+ * @file This file contains a reusable close button component, typically for toast notifications.
15
+ */
16
+
17
+ type ToastCloseButtonProps = {
18
+ /**
19
+ * The function to call when the button is clicked.
20
+ * This is typically provided by a toast library to dismiss the notification.
21
+ */
22
+ closeToast?: (e: React.MouseEvent<HTMLElement>) => void;
23
+ };
24
+ /**
25
+ * A simple, styled close button component (X icon) designed for use within toast notifications.
26
+ *
27
+ * @param {ToastCloseButtonProps} props - The component props.
28
+ * @returns {JSX.Element} The rendered close button.
29
+ */
30
+ declare function ToastCloseButton({ closeToast }: ToastCloseButtonProps): JSX.Element;
31
+
32
+ /**
33
+ * @file This file contains the `WalletAddressDisplay` component, a UI element for showing a wallet address.
34
+ */
35
+
36
+ type WalletAddressDisplayProps = {
37
+ /** The wallet address to display. */
38
+ address: string;
39
+ /**
40
+ * The viem `Chain` object for the network the address belongs to.
41
+ * This is used to generate the correct block explorer link.
42
+ */
43
+ chain?: Chain;
44
+ /** Optional additional CSS classes for the container. */
45
+ className?: string;
46
+ };
47
+ /**
48
+ * A component that renders a wallet address in a styled "pill" format,
49
+ * including a copy button and a link to the appropriate block explorer.
50
+ *
51
+ * @param {WalletAddressDisplayProps} props - The component props.
52
+ * @returns {JSX.Element} The rendered component.
53
+ */
54
+ declare function WalletAddressDisplay({ address, chain, className }: WalletAddressDisplayProps): JSX.Element;
55
+
56
+ /**
57
+ * @file This file contains the `WalletAvatar` component for displaying a user's avatar.
58
+ */
59
+
60
+ type WalletAvatarProps = {
61
+ /** The user's wallet address. Used for the blockie fallback and background color generation. */
62
+ address: string;
63
+ /** An optional URL for the user's ENS avatar image. */
64
+ ensAvatar?: string;
65
+ /** Optional additional CSS classes for the container. */
66
+ className?: string;
67
+ };
68
+ /**
69
+ * A component that displays a user's avatar.
70
+ * It prioritizes showing the provided `ensAvatar`. If unavailable, it falls back
71
+ * to a procedurally generated "blockie" based on the user's address.
72
+ * It also generates a unique background color from the address as a placeholder.
73
+ *
74
+ * @param {WalletAvatarProps} props - The component props.
75
+ * @returns {JSX.Element} The rendered avatar component.
76
+ */
77
+ declare function WalletAvatar({ address, ensAvatar, className }: WalletAvatarProps): JSX.Element;
78
+
79
+ /**
80
+ * @file This file contains the `WalletHeader` component, used to display user avatar, name, and address.
81
+ */
82
+
83
+ type AvatarRenderProps = {
84
+ address: string;
85
+ ensAvatar?: string;
86
+ };
87
+ type NameRenderProps = {
88
+ ensName?: string;
89
+ isLoading: boolean;
90
+ address: string;
91
+ };
92
+ type AddressRenderProps = {
93
+ address: string;
94
+ chain?: Chain;
95
+ };
96
+ /**
97
+ * Defines the props for the `WalletHeader` component, including extensive customization options.
98
+ */
99
+ interface WalletHeaderProps {
100
+ /** The user's wallet address. If undefined, the 'not connected' state is shown. */
101
+ walletAddress?: Address;
102
+ /** The viem `Chain` object for the currently connected network. */
103
+ chain?: Chain;
104
+ /** Optional additional CSS classes for the container. */
105
+ className?: string;
106
+ /** A render prop to replace the default `WalletAvatar` component. */
107
+ renderAvatar?: (props: AvatarRenderProps) => ReactNode;
108
+ /** A render prop to replace the default ENS name display. */
109
+ renderName?: (props: NameRenderProps) => ReactNode;
110
+ /** A render prop to replace the default `WalletAddressDisplay` component. */
111
+ renderAddressDisplay?: (props: AddressRenderProps) => ReactNode;
112
+ /** A render prop to replace the default content shown when no wallet is connected. */
113
+ renderNoWalletContent?: () => ReactNode;
114
+ }
115
+ /**
116
+ * A component that displays the header for the wallet modal, including the user's avatar,
117
+ * ENS name (if available), and address. It handles loading states for ENS data and
118
+ * provides a "not connected" view.
119
+ *
120
+ * @param {WalletHeaderProps} props - The component props.
121
+ * @returns {JSX.Element} The rendered wallet header.
122
+ */
123
+ declare function WalletHeader({ walletAddress, chain, className, renderAvatar, renderName, renderAddressDisplay, renderNoWalletContent, }: WalletHeaderProps): JSX.Element;
124
+
125
+ /**
126
+ * @file This file contains the `TxActionButton`, a stateful button for initiating and tracking transactions.
127
+ * It provides users with immediate visual feedback throughout the lifecycle of a transaction,
128
+ * from initiation to success, failure, or replacement.
129
+ */
130
+
131
+ interface TxActionButtonProps<TR, T extends Transaction<TR>> extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'>, Pick<IInitializeTxTrackingStore<TR, T>, 'transactionsPool'> {
132
+ /** The default content to display when the button is in its 'idle' state. Typically the button's primary call to action text. */
133
+ children: ReactNode;
134
+ /** The asynchronous function to execute when the button is clicked. This function should initiate the transaction and return a promise. */
135
+ action: () => Promise<void>;
136
+ /** A function that returns the unique key (e.g., transaction hash) of the most recently initiated transaction. This is used to link the button's state to a specific transaction in the pool. */
137
+ getLastTxKey: () => string | undefined;
138
+ /** Optional custom content to display in the 'loading' state. If not provided, a default spinner and text will be used. */
139
+ loadingContent?: ReactNode;
140
+ /** Optional custom content to display in the 'succeed' state. If not provided, a default success icon and text will be used. */
141
+ succeedContent?: ReactNode;
142
+ /** Optional custom content to display in the 'failed' state. If not provided, a default error icon and text will be used. */
143
+ failedContent?: ReactNode;
144
+ /** Optional custom content to display in the 'replaced' state. If not provided, a default icon and text will be used. */
145
+ replacedContent?: ReactNode;
146
+ /** The duration (in milliseconds) to display the 'succeed', 'failed', or 'replaced' state before automatically resetting the button to 'idle'. Defaults to 2500ms. */
147
+ resetTimeout?: number;
148
+ }
149
+ /**
150
+ * A stateful button that provides real-time feedback for a transaction's lifecycle.
151
+ * It listens for changes in the global `transactionsPool` to automatically update its
152
+ * visual state, showing loading, success, failure, and replaced statuses.
153
+ *
154
+ * @template TR - The generic type for the transaction tracker registry.
155
+ * @template T - The generic type for the transaction object.
156
+ * @param {TxActionButtonProps<TR, T>} props - The component props.
157
+ * @returns {JSX.Element} The rendered stateful action button.
158
+ */
159
+ declare function TxActionButton<TR, T extends Transaction<TR>>({ children, action, getLastTxKey, loadingContent, succeedContent, failedContent, replacedContent, resetTimeout, transactionsPool, className, ...props }: TxActionButtonProps<TR, T>): JSX.Element;
160
+
161
+ /**
162
+ * @file This file contains the default English labels for all UI components.
163
+ * It serves as the default language pack for the library.
164
+ */
165
+
166
+ /**
167
+ * An object containing the default English text for all labels used in the UI.
168
+ * This object implements the `TuwaLabels` type and can be used as a template
169
+ * for creating other language translations.
170
+ */
171
+ declare const defaultLabels: TuwaLabels;
172
+
173
+ export { ToastCloseButton, TuwaLabels, TxActionButton, type TxActionButtonProps, WalletAddressDisplay, type WalletAddressDisplayProps, WalletAvatar, type WalletAvatarProps, WalletHeader, type WalletHeaderProps, defaultLabels };
@@ -0,0 +1,173 @@
1
+ import { T as TuwaLabels } from './types-bqi7UbSO.js';
2
+ export { H as HashLink, S as StatusAwareText, n as StepProps, m as StepStatus, c as ToastTransaction, a as ToastTransactionCustomization, v as ToastTransactionKeyProps, b as ToastTransactionProps, g as TrackingTxModal, e as TrackingTxModalCustomization, f as TrackingTxModalProps, u as TransactionHistoryItem, s as TransactionHistoryItemCustomization, t as TransactionHistoryItemProps, w as TransactionKey, z as TransactionStatusBadge, y as TransactionsHistory, x as TransactionsHistoryCustomization, d as TxActions, i as TxErrorBlock, h as TxErrorBlockProps, l as TxInfoBlock, j as TxInfoBlockCustomization, k as TxInfoBlockProps, p as TxProgressIndicator, o as TxProgressIndicatorProps, r as TxStatusVisual, q as TxStatusVisualProps, B as WalletInfoModal, W as WalletInfoModalCustomization, A as WalletInfoModalProps } from './types-bqi7UbSO.js';
3
+ import { JSX, ReactNode, ButtonHTMLAttributes } from 'react';
4
+ import { Transaction, IInitializeTxTrackingStore } from '@tuwaio/pulsar-core';
5
+ import { Chain, Address } from 'viem';
6
+ import '@wagmi/core';
7
+ import 'react-toastify';
8
+ import '@radix-ui/react-dialog';
9
+ import '@tuwaio/pulsar-evm';
10
+ import 'framer-motion';
11
+ import 'react/jsx-runtime';
12
+
13
+ /**
14
+ * @file This file contains a reusable close button component, typically for toast notifications.
15
+ */
16
+
17
+ type ToastCloseButtonProps = {
18
+ /**
19
+ * The function to call when the button is clicked.
20
+ * This is typically provided by a toast library to dismiss the notification.
21
+ */
22
+ closeToast?: (e: React.MouseEvent<HTMLElement>) => void;
23
+ };
24
+ /**
25
+ * A simple, styled close button component (X icon) designed for use within toast notifications.
26
+ *
27
+ * @param {ToastCloseButtonProps} props - The component props.
28
+ * @returns {JSX.Element} The rendered close button.
29
+ */
30
+ declare function ToastCloseButton({ closeToast }: ToastCloseButtonProps): JSX.Element;
31
+
32
+ /**
33
+ * @file This file contains the `WalletAddressDisplay` component, a UI element for showing a wallet address.
34
+ */
35
+
36
+ type WalletAddressDisplayProps = {
37
+ /** The wallet address to display. */
38
+ address: string;
39
+ /**
40
+ * The viem `Chain` object for the network the address belongs to.
41
+ * This is used to generate the correct block explorer link.
42
+ */
43
+ chain?: Chain;
44
+ /** Optional additional CSS classes for the container. */
45
+ className?: string;
46
+ };
47
+ /**
48
+ * A component that renders a wallet address in a styled "pill" format,
49
+ * including a copy button and a link to the appropriate block explorer.
50
+ *
51
+ * @param {WalletAddressDisplayProps} props - The component props.
52
+ * @returns {JSX.Element} The rendered component.
53
+ */
54
+ declare function WalletAddressDisplay({ address, chain, className }: WalletAddressDisplayProps): JSX.Element;
55
+
56
+ /**
57
+ * @file This file contains the `WalletAvatar` component for displaying a user's avatar.
58
+ */
59
+
60
+ type WalletAvatarProps = {
61
+ /** The user's wallet address. Used for the blockie fallback and background color generation. */
62
+ address: string;
63
+ /** An optional URL for the user's ENS avatar image. */
64
+ ensAvatar?: string;
65
+ /** Optional additional CSS classes for the container. */
66
+ className?: string;
67
+ };
68
+ /**
69
+ * A component that displays a user's avatar.
70
+ * It prioritizes showing the provided `ensAvatar`. If unavailable, it falls back
71
+ * to a procedurally generated "blockie" based on the user's address.
72
+ * It also generates a unique background color from the address as a placeholder.
73
+ *
74
+ * @param {WalletAvatarProps} props - The component props.
75
+ * @returns {JSX.Element} The rendered avatar component.
76
+ */
77
+ declare function WalletAvatar({ address, ensAvatar, className }: WalletAvatarProps): JSX.Element;
78
+
79
+ /**
80
+ * @file This file contains the `WalletHeader` component, used to display user avatar, name, and address.
81
+ */
82
+
83
+ type AvatarRenderProps = {
84
+ address: string;
85
+ ensAvatar?: string;
86
+ };
87
+ type NameRenderProps = {
88
+ ensName?: string;
89
+ isLoading: boolean;
90
+ address: string;
91
+ };
92
+ type AddressRenderProps = {
93
+ address: string;
94
+ chain?: Chain;
95
+ };
96
+ /**
97
+ * Defines the props for the `WalletHeader` component, including extensive customization options.
98
+ */
99
+ interface WalletHeaderProps {
100
+ /** The user's wallet address. If undefined, the 'not connected' state is shown. */
101
+ walletAddress?: Address;
102
+ /** The viem `Chain` object for the currently connected network. */
103
+ chain?: Chain;
104
+ /** Optional additional CSS classes for the container. */
105
+ className?: string;
106
+ /** A render prop to replace the default `WalletAvatar` component. */
107
+ renderAvatar?: (props: AvatarRenderProps) => ReactNode;
108
+ /** A render prop to replace the default ENS name display. */
109
+ renderName?: (props: NameRenderProps) => ReactNode;
110
+ /** A render prop to replace the default `WalletAddressDisplay` component. */
111
+ renderAddressDisplay?: (props: AddressRenderProps) => ReactNode;
112
+ /** A render prop to replace the default content shown when no wallet is connected. */
113
+ renderNoWalletContent?: () => ReactNode;
114
+ }
115
+ /**
116
+ * A component that displays the header for the wallet modal, including the user's avatar,
117
+ * ENS name (if available), and address. It handles loading states for ENS data and
118
+ * provides a "not connected" view.
119
+ *
120
+ * @param {WalletHeaderProps} props - The component props.
121
+ * @returns {JSX.Element} The rendered wallet header.
122
+ */
123
+ declare function WalletHeader({ walletAddress, chain, className, renderAvatar, renderName, renderAddressDisplay, renderNoWalletContent, }: WalletHeaderProps): JSX.Element;
124
+
125
+ /**
126
+ * @file This file contains the `TxActionButton`, a stateful button for initiating and tracking transactions.
127
+ * It provides users with immediate visual feedback throughout the lifecycle of a transaction,
128
+ * from initiation to success, failure, or replacement.
129
+ */
130
+
131
+ interface TxActionButtonProps<TR, T extends Transaction<TR>> extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'>, Pick<IInitializeTxTrackingStore<TR, T>, 'transactionsPool'> {
132
+ /** The default content to display when the button is in its 'idle' state. Typically the button's primary call to action text. */
133
+ children: ReactNode;
134
+ /** The asynchronous function to execute when the button is clicked. This function should initiate the transaction and return a promise. */
135
+ action: () => Promise<void>;
136
+ /** A function that returns the unique key (e.g., transaction hash) of the most recently initiated transaction. This is used to link the button's state to a specific transaction in the pool. */
137
+ getLastTxKey: () => string | undefined;
138
+ /** Optional custom content to display in the 'loading' state. If not provided, a default spinner and text will be used. */
139
+ loadingContent?: ReactNode;
140
+ /** Optional custom content to display in the 'succeed' state. If not provided, a default success icon and text will be used. */
141
+ succeedContent?: ReactNode;
142
+ /** Optional custom content to display in the 'failed' state. If not provided, a default error icon and text will be used. */
143
+ failedContent?: ReactNode;
144
+ /** Optional custom content to display in the 'replaced' state. If not provided, a default icon and text will be used. */
145
+ replacedContent?: ReactNode;
146
+ /** The duration (in milliseconds) to display the 'succeed', 'failed', or 'replaced' state before automatically resetting the button to 'idle'. Defaults to 2500ms. */
147
+ resetTimeout?: number;
148
+ }
149
+ /**
150
+ * A stateful button that provides real-time feedback for a transaction's lifecycle.
151
+ * It listens for changes in the global `transactionsPool` to automatically update its
152
+ * visual state, showing loading, success, failure, and replaced statuses.
153
+ *
154
+ * @template TR - The generic type for the transaction tracker registry.
155
+ * @template T - The generic type for the transaction object.
156
+ * @param {TxActionButtonProps<TR, T>} props - The component props.
157
+ * @returns {JSX.Element} The rendered stateful action button.
158
+ */
159
+ declare function TxActionButton<TR, T extends Transaction<TR>>({ children, action, getLastTxKey, loadingContent, succeedContent, failedContent, replacedContent, resetTimeout, transactionsPool, className, ...props }: TxActionButtonProps<TR, T>): JSX.Element;
160
+
161
+ /**
162
+ * @file This file contains the default English labels for all UI components.
163
+ * It serves as the default language pack for the library.
164
+ */
165
+
166
+ /**
167
+ * An object containing the default English text for all labels used in the UI.
168
+ * This object implements the `TuwaLabels` type and can be used as a template
169
+ * for creating other language translations.
170
+ */
171
+ declare const defaultLabels: TuwaLabels;
172
+
173
+ export { ToastCloseButton, TuwaLabels, TxActionButton, type TxActionButtonProps, WalletAddressDisplay, type WalletAddressDisplayProps, WalletAvatar, type WalletAvatarProps, WalletHeader, type WalletHeaderProps, defaultLabels };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export{e as HashLink,f as StatusAwareText,g as ToastCloseButton,j as ToastTransaction,o as TrackingTxModal,p as TransactionHistoryItem,h as TransactionKey,i as TransactionStatusBadge,q as TransactionsHistory,r as TxActionButton,k as TxErrorBlock,l as TxInfoBlock,m as TxProgressIndicator,n as TxStatusVisual,s as WalletAddressDisplay,t as WalletAvatar,u as WalletHeader,v as WalletInfoModal,a as defaultLabels}from'./chunk-HIULR6AD.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,2 @@
1
+ 'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime'),novaCore=require('@tuwaio/nova-core'),pulsarCore=require('@tuwaio/pulsar-core'),reactToastify=require('react-toastify'),solid=require('@heroicons/react/24/solid'),reactWeb3Icons=require('@bgd-labs/react-web3-icons'),utils=require('@bgd-labs/react-web3-icons/dist/utils'),pulsarEvm=require('@tuwaio/pulsar-evm'),h=require('@radix-ui/react-dialog'),core=require('@wagmi/core'),framerMotion=require('framer-motion'),viem=require('viem'),Dt=require('dayjs'),qe=require('dayjs/plugin/relativeTime'),zt=require('ethereum-blockies-base64');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var h__namespace=/*#__PURE__*/_interopNamespace(h);var Dt__default=/*#__PURE__*/_interopDefault(Dt);var qe__default=/*#__PURE__*/_interopDefault(qe);var zt__default=/*#__PURE__*/_interopDefault(zt);var _={walletModal:{title:"Wallet & Transactions",header:{notConnected:"Wallet not connected",avatarAlt:"Avatar for"},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:{openWalletInfo:"Open wallet info"},statuses:{pending:"Pending",success:"Success",failed:"Failed",reverted:"Reverted",replaced:"Replaced",unknown:"Unknown"},hashLabels:{gelato:"Gelato Task ID",safe:"Safe Tx Hash",original:"Original Tx Hash",replaced:"Replaced Tx Hash",default:"Tx Hash"},txInfo:{started:"Started",network:"Network"},txError:{title:"Error",copied:"Copied!"},trackingModal:{title:"Transaction Overview",processing:"Processing...",close:"Close",walletInfo:"Wallet Info",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 ft=react.createContext(_),Tt=({labels:t,children:e})=>jsxRuntime.jsx(ft.Provider,{value:t,children:e}),u=()=>react.useContext(ft);function vt({label:t,hash:e,explorerUrl:o,variant:a="default",className:s}){let{isCopied:r,copy:i}=novaCore.useCopyToClipboard(),d=u(),l=novaCore.cn("flex items-center justify-between",a==="default"&&"text-sm",a==="compact"&&"text-xs",s),n=novaCore.cn("pr-1",a==="default"&&"font-bold text-[var(--tuwa-text-primary)]",a==="compact"&&"font-medium text-[var(--tuwa-text-secondary)]"),p=jsxRuntime.jsx("span",{className:"font-mono",children:novaCore.textCenterEllipsis(e,5,5)});return jsxRuntime.jsxs("div",{className:l,children:[t&&jsxRuntime.jsxs("span",{className:n,children:[t,":"]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[o?jsxRuntime.jsxs("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-x-1 text-[var(--tuwa-text-accent)] hover:underline",title:d.actions.viewOnExplorer,"aria-label":d.actions.viewOnExplorer,children:[p,jsxRuntime.jsx(solid.ArrowTopRightOnSquareIcon,{className:"h-4 w-4"})]}):p,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:r?d.txError.copied:d.actions.copy,"aria-label":r?d.txError.copied:d.actions.copy,children:r?jsxRuntime.jsx(solid.CheckIcon,{className:"h-4 w-4 text-[var(--tuwa-success-icon)]"}):jsxRuntime.jsx(solid.DocumentDuplicateIcon,{className:"h-4 w-4"})})]})]})}var yt={[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 P({txStatus:t,source:e,fallback:o,variant:a,className:s,applyColor:r=false}){let i=a==="title"?"text-sm font-semibold text-[var(--tuwa-text-primary)]":"mt-1 text-xs text-[var(--tuwa-text-secondary)]";if(typeof e=="string")return jsxRuntime.jsx("div",{className:novaCore.cn(i,s),children:e});if(Array.isArray(e)){let l=yt[t||"default"]||yt.default,n=e[l.index],p=r?l.colorClass:"";return jsxRuntime.jsx("div",{className:novaCore.cn(i,p,s),children:n})}return o?jsxRuntime.jsx("div",{className:novaCore.cn(i,s),children:o}):null}function bt({closeToast:t}){let e=u();return jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":e.actions.close,title:e.actions.close,className:"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 O({tx:t,appChains:e,transactionsPool:o,variant:a="toast",className:s,renderHashLink:r}){let i=u();if(t.adapter!==pulsarCore.TransactionAdapter.EVM)return null;let d=!!t.replacedTxHash,l=a==="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",n=p=>r?r(p):jsxRuntime.jsx(vt,{...p});return jsxRuntime.jsxs("div",{className:novaCore.cn(l,s),children:[t.tracker===pulsarEvm.TransactionTracker.Gelato&&n({label:i.hashLabels.gelato,hash:t.txKey,variant:"compact"}),t.tracker===pulsarEvm.TransactionTracker.Safe&&n({label:i.hashLabels.safe,hash:t.txKey,variant:"compact"}),d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.hash&&n({label:i.hashLabels.original,hash:t.hash,variant:"compact"}),n({label:i.hashLabels.replaced,hash:t.replacedTxHash,explorerUrl:pulsarEvm.selectEvmTxExplorerLink(o,e,t.txKey,t.replacedTxHash)})]}):t.hash&&n({label:i.hashLabels.default,hash:t.hash,explorerUrl:pulsarEvm.selectEvmTxExplorerLink(o,e,t.txKey)})]})}function q({tx:t,className:e}){let o=u(),a={Pending:{label:o.statuses.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:o.statuses.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:o.statuses.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:o.statuses.replaced,Icon:solid.ArrowPathIcon,badgeClasses:"bg-[var(--tuwa-info-bg)] text-[var(--tuwa-info-text)]",iconClasses:"text-[var(--tuwa-info-icon)]"}},s="inline-flex items-center gap-x-1.5 rounded-full px-2 py-1 text-xs font-medium",r=t.pending?"Pending":t.status,i=r?a[r]: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??o.statuses.unknown});let{label:d,Icon:l,badgeClasses:n,iconClasses:p}=i;return jsxRuntime.jsxs("div",{className:novaCore.cn(s,n,e),children:[jsxRuntime.jsx(l,{className:novaCore.cn("h-4 w-4",p)}),d]})}function Nt({openWalletInfoModal:t,tx:e,transactionsPool:o,appChains:a,icon:s,className:r,customization:i,config:d}){let l=u(),n=i?.components,p=d&&e.adapter===pulsarCore.TransactionAdapter.EVM&&e.nonce!==void 0&&e.pending&&e.maxFeePerGas&&e.maxPriorityFeePerGas,m=async()=>{p&&await pulsarEvm.speedUpTxAction({config:d,tx:e});},c=async()=>{p&&await pulsarEvm.cancelTxAction({config:d,tx:e});};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",r),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-[40px] flex-shrink-0",title:utils.getChainName(e.chainId),children:s??jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:e.chainId})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[n?.statusAwareText?n.statusAwareText({txStatus:e.status,source:e.title,fallback:e.type,variant:"title",applyColor:true}):jsxRuntime.jsx(P,{txStatus:e.status,source:e.title,fallback:e.type,variant:"title",applyColor:true}),n?.statusAwareText?n.statusAwareText({txStatus:e.status,source:e.description,variant:"description"}):jsxRuntime.jsx(P,{txStatus:e.status,source:e.description,variant:"description"})]})]}),jsxRuntime.jsxs("div",{children:[n?.transactionKey?n.transactionKey({transactionsPool:o,appChains:a,tx:e,variant:"toast"}):jsxRuntime.jsx(O,{transactionsPool:o,appChains:a,tx:e,variant:"toast"}),jsxRuntime.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[n?.statusBadge?n.statusBadge({tx:e}):jsxRuntime.jsx(q,{tx:e}),p?jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[n?.speedUpButton?n.speedUpButton({onClick:m,children:l.actions.speedUp}):jsxRuntime.jsx("button",{onClick:m,type:"button",className:"cursor-pointer text-sm font-medium text-[var(--tuwa-text-accent)] transition-opacity hover:opacity-80",children:l.actions.speedUp}),n?.cancelButton?n.cancelButton({onClick:c,children:l.actions.cancel}):jsxRuntime.jsx("button",{onClick:c,type:"button",className:"cursor-pointer text-sm font-medium text-[var(--tuwa-text-secondary)] transition-opacity hover:opacity-80",children:l.actions.cancel})]}):t&&(n?.walletInfoButton?n.walletInfoButton({onClick:()=>t(true),children:l.toast.openWalletInfo}):jsxRuntime.jsx("button",{className:"cursor-pointer bg-gradient-to-r from-[var(--tuwa-button-gradient-from)] to-[var(--tuwa-button-gradient-to)] text-[var(--tuwa-text-on-accent)] font-bold text-xs py-1 px-3 rounded-md shadow-lg hover:shadow-xl hover:from-[var(--tuwa-button-gradient-from-hover)] hover:to-[var(--tuwa-button-gradient-to-hover)] active:scale-95 transition-all duration-200 ease-in-out",onClick:()=>t(true),type:"button",children:l.toast.openWalletInfo}))]})]})]})}function It({error:t,className:e}){let{isCopied:o,copy:a}=novaCore.useCopyToClipboard(),s=u();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:s.txError.title})]}),jsxRuntime.jsx("button",{type:"button",onClick:()=>a(t),title:s.actions.copy,"aria-label":s.actions.copy,className:"cursor-pointer text-[var(--tuwa-error-icon)]/50 transition-colors hover:text-[var(--tuwa-error-icon)]",children: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})}),jsxRuntime.jsx("div",{className:"mt-1 h-5 text-right",children:jsxRuntime.jsx("p",{className:novaCore.cn("text-xs text-[var(--tuwa-success-icon)] transition-opacity duration-300 ease-in-out",o?"opacity-100":"opacity-0"),children:s.txError.copied})})]}):null}function Se({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 St({tx:t,appChains:e,transactionsPool:o,className:a,customization:s}){let r=u(),i=d=>s?.components?.infoRow?s.components.infoRow(d):jsxRuntime.jsx(Se,{...d});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",a),children:[i({label:r.txInfo.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:t.chainId??t?.desiredChainID??1})}),jsxRuntime.jsx("span",{children:utils.getChainName(t.chainId??t?.desiredChainID??1)})]})}),t.localTimestamp&&i({label:r.txInfo.started,value:Dt__default.default.unix(t.localTimestamp).format("MMM D, HH:mm:ss")}),jsxRuntime.jsx("div",{className:"border-t border-[var(--tuwa-border-primary)] pt-3",children:jsxRuntime.jsx(O,{tx:t,appChains:e,transactionsPool:o,variant:"history",renderHashLink:s?.components?.transactionKey})})]})}function Be({status:t,label:e,isFirst:o=false}){let a={isCompleted:t==="completed",isError:t==="error",isReplaced:t==="replaced",isActive:t==="active"},s={line:novaCore.cn({"bg-[var(--tuwa-success-icon)]":a.isCompleted,"bg-[var(--tuwa-error-icon)]":a.isError,"bg-[var(--tuwa-info-icon)]":a.isReplaced,"bg-[var(--tuwa-pending-icon)]":a.isActive,"bg-[var(--tuwa-border-primary)]":t==="inactive"}),border:novaCore.cn({"border-[var(--tuwa-success-icon)]":a.isCompleted,"border-[var(--tuwa-error-icon)]":a.isError,"border-[var(--tuwa-info-icon)]":a.isReplaced,"border-[var(--tuwa-pending-icon)]":a.isActive,"border-[var(--tuwa-border-primary)]":t==="inactive"}),fill:novaCore.cn({"bg-[var(--tuwa-success-icon)]":a.isCompleted,"bg-[var(--tuwa-error-icon)]":a.isError,"bg-[var(--tuwa-info-icon)]":a.isReplaced}),pulse:novaCore.cn({"bg-[var(--tuwa-pending-icon)]":a.isActive})};return jsxRuntime.jsxs("div",{className:"relative flex flex-1 flex-col items-center min-w-[80px]",children:[!o&&jsxRuntime.jsx("div",{className:novaCore.cn("absolute right-1/2 top-[10px] h-0.5 w-full",s.line)}),jsxRuntime.jsxs("div",{className:novaCore.cn("relative z-10 flex h-5 w-5 items-center justify-center rounded-full border-2",s.border,s.fill),children:[a.isCompleted&&jsxRuntime.jsx(solid.CheckIcon,{className:"h-3 w-3 text-white"}),a.isError&&jsxRuntime.jsx(solid.ExclamationTriangleIcon,{className:"h-3 w-3 text-white"}),a.isReplaced&&jsxRuntime.jsx(solid.ArrowPathIcon,{className:"h-3 w-3 text-white"}),a.isActive&&jsxRuntime.jsx("div",{className:novaCore.cn("h-2 w-2 animate-pulse rounded-full",s.pulse)})]}),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 At({isProcessing:t,isSucceed:e,isFailed:o,isReplaced:a,className:s,StepComponent:r=Be}){let i=u(),d=p=>{if(p===1)return "completed";if(p===2){if(e||o||a)return "completed";if(t)return "active"}if(p===3){if(e)return "completed";if(o)return "error";if(a)return "replaced";if(t)return "active"}return "inactive"},l=p=>p===1?i.trackingModal.progressIndicator.created:p===2?i.trackingModal.progressIndicator.processing:o?i.statuses.failed:a?i.statuses.replaced:i.trackingModal.progressIndicator.succeed,n=[{status:d(1),label:l(1),isFirst:true},{status:d(2),label:l(2)},{status:d(3),label:l(3),isLast:true}];return jsxRuntime.jsx("div",{className:novaCore.cn("flex w-full items-start px-4 pt-2 pb-1",s),children:n.map((p,m)=>jsxRuntime.jsx(r,{...p},m))})}function Bt({isProcessing:t,isSucceed:e,isFailed:o,isReplaced:a}){let s;return e?s=jsxRuntime.jsx(solid.CheckCircleIcon,{className:"h-16 w-16 text-[var(--tuwa-success-icon)]"}):o?s=jsxRuntime.jsx(solid.ExclamationCircleIcon,{className:"h-16 w-16 text-[var(--tuwa-error-icon)]"}):a?s=jsxRuntime.jsx(solid.ArrowPathIcon,{className:"h-16 w-16 text-[var(--tuwa-info-icon)]"}):t?s=jsxRuntime.jsx(solid.ArrowPathIcon,{className:"h-16 w-16 animate-spin text-[var(--tuwa-text-accent)]"}):s=jsxRuntime.jsx(solid.ClockIcon,{className:"h-16 w-16 animate-pulse text-[var(--tuwa-pending-icon)]"}),jsxRuntime.jsx("div",{className:"flex justify-center py-4",children:s})}function Kt({onClose:t,onOpenWalletInfo:e,className:o,customization:a,appChains:s,transactionsPool:r,actions:i,handleTransaction:d,config:l,initialTx:n}){let p=u(),m=a?.components,[c,L]=react.useState(void 0);react.useEffect(()=>{let I;n?.lastTxKey?I=r[n.lastTxKey]:c&&(I=r[c.txKey]),L(I);},[r,n,c]);let f=c??n,y=c?.status,b=n?.isInitializing??false,U=c?.pending??true,C=b||U,H=c?.isError||!!n?.errorMessage,v=f?.actionKey&&i?.[f.actionKey]&&d&&l,x=l&&c?.adapter===pulsarCore.TransactionAdapter.EVM&&c?.nonce!==void 0&&c.pending&&c.maxFeePerGas&&c.maxPriorityFeePerGas,K={initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2,ease:"easeOut"},...a?.motionProps},D=async()=>{if(!v||!f?.actionKey)return;let I=core.getAccount(l),Zt={adapter:pulsarCore.TransactionAdapter.EVM,type:f.type,desiredChainID:c?.chainId||n?.desiredChainID||1,actionKey:f.actionKey,title:f.title,description:f.description,payload:f.payload,withTrackedModal:true,from:I.address??viem.zeroAddress,walletType:I.connector?.type??""};t(c?.txKey),await d({actionFunction:()=>i[f.actionKey]({config:l,...f.payload}),params:Zt,defaultTracker:pulsarEvm.TransactionTracker.Ethereum});},G=async()=>{x&&c&&await pulsarEvm.cancelTxAction({config:l,tx:c});},mt=async()=>{x&&c&&await pulsarEvm.speedUpTxAction({config:l,tx:c});},ut=(c?.isTrackedModalOpen||n?.withTrackedModal)??false;return jsxRuntime.jsx(h__namespace.Root,{open:ut,onOpenChange:I=>!I&&t(c?.txKey),children:jsxRuntime.jsx(h__namespace.Portal,{children:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ut&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(h__namespace.Overlay,{asChild:true,children:jsxRuntime.jsx(framerMotion.motion.div,{className:"fixed inset-0 bg-black/60 z-50",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}})}),jsxRuntime.jsx(h__namespace.Content,{className:"fixed left-1/2 top-1/2 w-full max-w-md -translate-x-1/2 -translate-y-1/2 outline-none z-50",onOpenAutoFocus:()=>L(void 0),...a?.modalProps,asChild:true,children:jsxRuntime.jsx(framerMotion.motion.div,{...K,children:jsxRuntime.jsxs("div",{className:novaCore.cn("relative flex flex-col gap-3 rounded-2xl bg-[var(--tuwa-bg-primary)] p-5 pt-0 shadow-2xl max-h-[98dvh] overflow-y-auto",o),children:[m?.header?m.header({onClose:()=>t(c?.txKey)}):jsxRuntime.jsxs("header",{className:"flex items-start justify-between sticky top-0 w-full z-10 pt-5 pb-2 bg-[var(--tuwa-bg-primary)]",children:[jsxRuntime.jsx(h__namespace.Title,{className:"text-lg font-bold text-[var(--tuwa-text-primary)]",children:p.trackingModal.title}),jsxRuntime.jsx(h__namespace.Close,{asChild:true,children:jsxRuntime.jsx("button",{type:"button",onClick:()=>t(c?.txKey),"aria-label":p.actions.close,className:"cursor-pointer ml-2 -mt-1 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"})})})]}),jsxRuntime.jsxs("main",{className:"flex flex-col gap-3",children:[m?.statusVisual?m.statusVisual({isProcessing:C,isSucceed:y===pulsarCore.TransactionStatus.Success,isFailed:H,isReplaced:y===pulsarCore.TransactionStatus.Replaced}):jsxRuntime.jsx(Bt,{isProcessing:C,isSucceed:y===pulsarCore.TransactionStatus.Success,isFailed:H,isReplaced:y===pulsarCore.TransactionStatus.Replaced}),jsxRuntime.jsxs("div",{className:"flex flex-col items-center text-center -mt-2",children:[jsxRuntime.jsx(P,{txStatus:y,source:f?.title,fallback:f?.type,variant:"title",applyColor:true,className:"text-xl"}),jsxRuntime.jsx(P,{txStatus:y,source:f?.description,variant:"description",className:"mt-0"})]}),m?.progressIndicator?m.progressIndicator({isProcessing:C,isSucceed:y===pulsarCore.TransactionStatus.Success,isFailed:H,isReplaced:y===pulsarCore.TransactionStatus.Replaced}):jsxRuntime.jsx(At,{isProcessing:C,isSucceed:y===pulsarCore.TransactionStatus.Success,isFailed:H,isReplaced:y===pulsarCore.TransactionStatus.Replaced}),m?.infoBlock?m.infoBlock({tx:f,appChains:s,transactionsPool:r}):jsxRuntime.jsx(St,{tx:f,appChains:s,transactionsPool:r}),m?.errorBlock?m.errorBlock({error:c?.errorMessage||n?.errorMessage}):jsxRuntime.jsx(It,{error:c?.errorMessage||n?.errorMessage})]}),m?.footer?m.footer({onClose:()=>t(c?.txKey),onOpenWalletInfo:e,isProcessing:C,onRetry:v?D:void 0,onSpeedUp:x?mt:void 0,onCancel:x?G:void 0}):jsxRuntime.jsxs("footer",{className:"mt-2 flex w-full items-center justify-between border-t border-[var(--tuwa-border-primary)] pt-4",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:mt,className:"cursor-pointer text-sm font-medium text-[var(--tuwa-text-accent)] transition-opacity hover:opacity-80",children:p.actions.speedUp}),jsxRuntime.jsx("button",{type:"button",onClick:G,className:"cursor-pointer text-sm font-medium text-[var(--tuwa-text-secondary)] transition-opacity hover:opacity-80",children:p.actions.cancel})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[H&&v?jsxRuntime.jsx("button",{type:"button",onClick:D,className:"cursor-pointer rounded-md bg-[var(--tuwa-button-gradient-from)] px-4 py-2 text-sm font-semibold text-[var(--tuwa-text-on-accent)] transition-opacity hover:opacity-90",children:p.trackingModal.retry}):!x&&jsxRuntime.jsx("button",{type:"button",onClick:e,className:"cursor-pointer rounded-md bg-[var(--tuwa-bg-muted)] px-4 py-2 text-sm font-semibold text-[var(--tuwa-text-primary)] transition-colors hover:bg-[var(--tuwa-border-primary)]",children:p.trackingModal.walletInfo}),jsxRuntime.jsx("button",{type:"button",onClick:()=>t(c?.txKey),disabled:C&&!x,className:"cursor-pointer rounded-md bg-[var(--tuwa-bg-muted)] px-4 py-2 text-sm font-semibold text-[var(--tuwa-text-primary)] transition-colors hover:bg-[var(--tuwa-border-primary)] disabled:cursor-not-allowed disabled:opacity-50",children:C&&!x?p.trackingModal.processing:p.trackingModal.close})]})]})]})})})]})})})})}Dt__default.default.extend(qe__default.default);function Ot({tx:t,appChains:e,transactionsPool:o,className:a,customization:s}){let r=s?.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)]",a),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:r?.icon?r.icon({chainId:t.chainId}):jsxRuntime.jsx("div",{className:"h-8 w-8 text-[var(--tuwa-text-secondary)]",children:jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:t.chainId})})}),jsxRuntime.jsxs("div",{children:[r?.title?r.title({txStatus:t.status,source:t.title,fallback:t.type,variant:"title",applyColor:true}):jsxRuntime.jsx(P,{txStatus:t.status,source:t.title,fallback:t.type,variant:"title",applyColor:true}),r?.timestamp?r.timestamp({timestamp:t.localTimestamp}):jsxRuntime.jsx("span",{className:"mb-1 block text-xs text-[var(--tuwa-text-secondary)]",children:t.localTimestamp?Dt__default.default.unix(t.localTimestamp).fromNow():"..."}),r?.description?r.description({txStatus:t.status,source:t.description,variant:"description"}):jsxRuntime.jsx(P,{txStatus:t.status,source:t.description,variant:"description"})]})]}),r?.statusBadge?r.statusBadge({tx:t}):jsxRuntime.jsx(q,{tx:t})]}),r?.transactionKey?r.transactionKey({tx:t,appChains:e,transactionsPool:o,variant:"history"}):jsxRuntime.jsx(O,{tx:t,appChains:e,transactionsPool:o,variant:"history"})]})}function je({title:t,message:e,className:o}){return jsxRuntime.jsxs("div",{className:novaCore.cn("rounded-lg bg-[var(--tuwa-bg-muted)] p-8 text-center",o),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 Xt({walletAddress:t,transactionsPool:e,appChains:o,className:a,customization:s}){let r=u(),i=s?.components,l=[...t?pulsarCore.selectAllTransactionsByActiveWallet(e,t):[]].sort((m,c)=>(c.localTimestamp??0)-(m.localTimestamp??0)),n=(m,c)=>i?.placeholder?i.placeholder({title:m,message:c}):jsxRuntime.jsx(je,{title:m,message:c}),p=i?.HistoryItem||Ot;return jsxRuntime.jsxs("div",{className:novaCore.cn("flex flex-col gap-y-3",a),children:[jsxRuntime.jsx("h3",{className:"text-lg font-bold text-[var(--tuwa-text-primary)]",children:r.walletModal.history.title}),t?l.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:l.map(m=>jsxRuntime.jsx(p,{tx:m,transactionsPool:e,appChains:o},m.txKey))}):n(r.walletModal.history.noTransactionsTitle,r.walletModal.history.noTransactionsMessage):n(r.walletModal.history.connectWalletTitle,r.walletModal.history.connectWalletMessage)]})}function lt({address:t,chain:e,className:o}){let{isCopied:a,copy:s}=novaCore.useCopyToClipboard(),r=u(),i=e?.blockExplorers?.default.url,d=i?`${i}/address/${t}`:void 0;return jsxRuntime.jsxs("div",{className:novaCore.cn("flex items-center gap-x-3 rounded-full bg-[var(--tuwa-bg-muted)] px-3 py-1 font-mono text-xs text-[var(--tuwa-text-secondary)]",o),children:[jsxRuntime.jsx("span",{children:novaCore.textCenterEllipsis(t,6,6)}),jsxRuntime.jsx("button",{type:"button",title:a?r.txError.copied:r.actions.copy,"aria-label":a?r.txError.copied:r.actions.copy,onClick:()=>s(t),className:"cursor-pointer transition-colors hover:text-[var(--tuwa-text-primary)]",children:a?jsxRuntime.jsx(solid.CheckIcon,{className:"h-4 w-4 text-[var(--tuwa-success-icon)]"}):jsxRuntime.jsx(solid.DocumentDuplicateIcon,{className:"h-4 w-4"})}),d&&jsxRuntime.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"transition-colors hover:text-[var(--tuwa-text-accent)]",title:r.actions.viewOnExplorer,"aria-label":r.actions.viewOnExplorer,children:jsxRuntime.jsx(solid.ArrowTopRightOnSquareIcon,{className:"h-4 w-4"})})]})}function Gt({address:t,ensAvatar:e,className:o}){let a=u(),s=`#${t.slice(2,8)}`,[r,i]=react.useState(void 0);return react.useEffect(()=>{i(e??zt__default.default(viem.isHex(t)?t:viem.zeroAddress));},[e,t]),jsxRuntime.jsx("div",{className:novaCore.cn("h-12 w-12 flex-shrink-0 rounded-full",o),style:{backgroundColor:s},children:jsxRuntime.jsx("img",{className:"h-full w-full rounded-full object-cover",src:r,alt:`${a.walletModal.header.avatarAlt} ${t}`,onError:()=>i(zt__default.default(viem.isHex(t)?t:viem.zeroAddress))})})}function qt({walletAddress:t,chain:e,className:o,renderAvatar:a,renderName:s,renderAddressDisplay:r,renderNoWalletContent:i}){let d=u(),[l,n]=react.useState(void 0),[p,m]=react.useState(void 0),[c,L]=react.useState(true);if(react.useEffect(()=>{(async()=>{if(t){L(true),n(void 0),m(void 0);try{let b=await pulsarEvm.getName(t);if(b){n(b);let U=await pulsarEvm.getAvatar(b);m(U);}}finally{L(false);}}})();},[t]),!t)return i?jsxRuntime.jsx(jsxRuntime.Fragment,{children:i()}):jsxRuntime.jsx("div",{className:novaCore.cn("flex h-20 items-center justify-center rounded-lg bg-[var(--tuwa-bg-muted)] text-[var(--tuwa-text-secondary)]",o),children:d.walletModal.header.notConnected});let f=l?l.length>30?novaCore.textCenterEllipsis(l,12,12):l:void 0;return jsxRuntime.jsxs("div",{className:novaCore.cn("flex items-center gap-4 min-h-[4rem]",o),children:[jsxRuntime.jsx("div",{children:a?a({address:t,ensAvatar:p}):jsxRuntime.jsx(Gt,{address:t,ensAvatar:p})}),jsxRuntime.jsx("div",{className:"flex flex-col justify-center min-h-[3.5rem] min-w-[200px]",children:s?s({ensName:f,isLoading:c,address:t}):jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"h-7 flex items-center mb-1.5",children:c?jsxRuntime.jsx("div",{className:"h-full w-48 animate-pulse rounded-md bg-[var(--tuwa-bg-muted)]"}):f?jsxRuntime.jsx("h2",{className:"text-xl font-bold text-[var(--tuwa-text-primary)]",children:f}):jsxRuntime.jsx(lt,{address:t,chain:e,className:"text-xl font-bold text-[var(--tuwa-text-primary)] bg-transparent px-0 py-0 rounded-none"})}),jsxRuntime.jsx("div",{className:"h-5 flex items-center",children:!c&&f&&(r?r({address:t,chain:e}):jsxRuntime.jsx(lt,{address:t,chain:e}))})]})})]})}function jt({isOpen:t,setIsOpen:e,customization:o,...a}){let s=u(),i={...{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2,ease:"easeOut"}},...o?.motionProps},d=()=>e(false);return jsxRuntime.jsx(h__namespace.Root,{open:t,onOpenChange:l=>!l&&d(),children:jsxRuntime.jsx(h__namespace.Portal,{children:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(h__namespace.Overlay,{asChild:true,children:jsxRuntime.jsx(framerMotion.motion.div,{className:"fixed inset-0 bg-black/45 flex items-center justify-center p-2 z-50",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15}})}),jsxRuntime.jsx(h__namespace.Content,{className:"fixed left-1/2 top-1/2 w-full max-w-2xl -translate-x-1/2 -translate-y-1/2 outline-none z-50",...o?.modalProps,asChild:true,children:jsxRuntime.jsx(framerMotion.motion.div,{...i,children:jsxRuntime.jsxs("div",{className:novaCore.cn("relative w-full max-w-2xl outline-none rounded-2xl bg-[var(--tuwa-bg-secondary)] shadow-xl max-h-[98dvh] overflow-y-auto",o?.classNames?.contentWrapper),children:[o?.components?.header?o.components.header({closeModal:d}):jsxRuntime.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--tuwa-border-primary)] p-4 sticky top-0 left-0 w-full bg-[var(--tuwa-bg-secondary)] z-10",children:[jsxRuntime.jsx(h__namespace.Title,{className:"text-lg font-bold text-[var(--tuwa-text-primary)]",children:s.walletModal.title}),jsxRuntime.jsx(h__namespace.Close,{asChild:true,children:jsxRuntime.jsx("button",{type:"button",onClick:d,"aria-label":s.actions.close,className:"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-6 w-6"})})})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-4 p-4 sm:p-6 sm:gap-6",children:[o?.components?.walletInfo?o.components.walletInfo(a):jsxRuntime.jsx(qt,{walletAddress:a.walletAddress,chain:a.chain}),o?.components?.history?o.components.history(a):jsxRuntime.jsx(Xt,{...a})]})]})})})]})})})})}var wa={[pulsarCore.TransactionStatus.Success]:"success",[pulsarCore.TransactionStatus.Failed]:"error",[pulsarCore.TransactionStatus.Replaced]:"info"};function wn({labels:t,features:e,customization:o,closeTxTrackedModal:a,actions:s,config:r,handleTransaction:i,initialTx:d,appChains:l,transactionsPool:n,walletAddress:p,chain:m,...c}){let[L,f]=react.useState(false),y=react.useRef(n),b=react.useMemo(()=>({toasts:e?.toasts??true,walletInfoModal:e?.walletInfoModal??true,trackingTxModal:e?.trackingTxModal??true}),[e]),U=react.useMemo(()=>novaCore.deepMerge(_,t||{}),[t]);return react.useEffect(()=>{if(!b.toasts)return;let C=(v,x)=>{let K=D=>jsxRuntime.jsx(Nt,{...D,tx:v,transactionsPool:n,appChains:l,openWalletInfoModal:b.walletInfoModal?()=>f(true):void 0,customization:o?.toast,config:r});reactToastify.toast.isActive(v.txKey)?reactToastify.toast.update(v.txKey,{render:K,type:x}):reactToastify.toast(K,{toastId:v.txKey,type:x,closeOnClick:false});},H=y.current;Object.values(n).forEach(v=>{let x=H[v.txKey],K=x&&x.status!==v.status,D=x.adapter===pulsarCore.TransactionAdapter.EVM&&x&&!x.hash&&v.adapter===pulsarCore.TransactionAdapter.EVM&&v.hash;if(!x&&v.pending&&C(v,"info"),(x&&x.adapter===pulsarCore.TransactionAdapter.EVM&&x.nonce)!==(v.adapter===pulsarCore.TransactionAdapter.EVM&&v?.nonce))C(v,"info");else if(K||D){let G=wa[v.status]??"info";C(v,G);}}),y.current=n;},[n,l,o?.toast,b]),jsxRuntime.jsxs(Tt,{labels:U,children:[b.toasts&&jsxRuntime.jsx(reactToastify.ToastContainer,{position:"bottom-right",stacked:true,autoClose:false,hideProgressBar:true,closeOnClick:false,icon:false,closeButton:bt,toastClassName:"!p-0 !bg-transparent !shadow-none !min-h-0",...c}),b.walletInfoModal&&jsxRuntime.jsx(jt,{transactionsPool:n,walletAddress:p,chain:m,isOpen:L,setIsOpen:f,appChains:l,customization:o?.walletInfoModal}),b.trackingTxModal&&jsxRuntime.jsx(Kt,{initialTx:d,onClose:a,onOpenWalletInfo:()=>f(true),appChains:l,transactionsPool:n,customization:o?.trackingTxModal,actions:s,config:r,handleTransaction:i})]})}exports.LabelsProvider=Tt;exports.TransactionsWidget=wn;exports.useLabels=u;//# sourceMappingURL=index.cjs.map
2
+ //# sourceMappingURL=index.cjs.map