@tuwaio/nova-transactions 0.0.23 → 0.0.25

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/README.md CHANGED
@@ -10,15 +10,13 @@ The official React UI component library for the Pulsar transaction engine. It pr
10
10
 
11
11
  ## 🏛️ Architecture
12
12
 
13
- This package provides the **View Layer** for TUWA's transaction tracking ecosystem. It works by consuming the state from your headless Pulsar store and rendering the appropriate UI.
14
-
15
- You must connect your Pulsar store's state and actions to the `<NovaProvider />` component, which acts as a self-contained UI manager that renders modals and toasts via React Portals.
13
+ This package provides the **View Layer** for TUWA's transaction tracking ecosystem. It works by consuming the state from your headless Pulsar store and rendering the appropriate UI. You must connect your Pulsar store's state and actions to the `<NovaProvider />` component, which acts as a self-contained UI manager that renders modals and toasts.
16
14
 
17
15
  ---
18
16
 
19
17
  ## ✨ Core Features
20
18
 
21
- - **🧩 Pre-built UI Suite:** A set of accessible components including `TrackingTxModal`, `WalletInfoModal`, and `ToastContainer`, all managed internally by the `NovaProvider`.
19
+ - **🧩 Pre-built UI Suite:** A set of accessible components including `TrackingTxModal`, `WalletInfoModal`, and `ToastTransaction`, all managed internally by the `NovaProvider`.
22
20
  - **🔌 Plug-and-Play Integration:** Once connected to your Pulsar store, the UI automatically reacts to all transaction state changes.
23
21
  - **🌐 Internationalization (i18n):** Built-in support for multiple languages with easy overrides for all text content via the `labels` prop.
24
22
  - **🎨 Highly Customizable:** Styled with `@tuwaio/nova-core` to be easily themed using CSS variables. Almost every sub-component can be replaced with your own implementation via the `customization` prop.
@@ -29,17 +27,17 @@ You must connect your Pulsar store's state and actions to the `<NovaProvider />`
29
27
 
30
28
  First, install all required packages for the Pulsar & Nova stack.
31
29
 
32
- Next, you need to install a few peer dependencies that `nova-transactions` relies on for UI rendering.
30
+ Next, you need to install a peer dependencies that `nova-transactions` relies on for UI rendering.
33
31
 
34
32
  ```bash
35
33
  # Using pnpm
36
- pnpm add react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons @tuwaio/pulsar-core @tuwaio/nova-core
34
+ pnpm add react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons @tuwaio/pulsar-core @tuwaio/nova-core dayjs ethereum-blockies-base64 react immer zustand clsx tailwind-merge
37
35
 
38
36
  # Using npm
39
- npm install react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons @tuwaio/pulsar-core @tuwaio/nova-core
37
+ npm install react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons @tuwaio/pulsar-core @tuwaio/nova-core dayjs ethereum-blockies-base64 react immer zustand clsx tailwind-merge
40
38
 
41
39
  # Using yarn
42
- yarn add react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons @tuwaio/pulsar-core @tuwaio/nova-core
40
+ yarn add react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons @tuwaio/pulsar-core @tuwaio/nova-core dayjs ethereum-blockies-base64 react immer zustand clsx tailwind-merge
43
41
  ````
44
42
 
45
43
  -----
@@ -48,66 +46,99 @@ yarn add react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @b
48
46
 
49
47
  To use this library, you must render the `<NovaProvider />` component at a high level in your application and pass the state and actions from your Pulsar store to it as props.
50
48
 
51
- Here is a complete example of a `Providers.tsx` file that configures the entire system.
49
+ Here is a complete example of a `src/providers/index.tsx` file that configures the entire system.
50
+
51
+ ```tsx
52
+ // src/hooks/txTrackingHooks.tsx
53
+ 'use client';
54
+
55
+ import { createBoundedUseStore, createPulsarStore } from '@tuwaio/pulsar-core';
56
+ import { evmAdapter } from '@tuwaio/pulsar-evm';
57
+
58
+ import { appChains, config } from '@/configs/wagmiConfig';
59
+
60
+ const storageName = 'transactions-tracking-storage';
61
+
62
+ export enum TxType {
63
+ example = 'example',
64
+ }
65
+
66
+ type ExampleTx = Transaction & {
67
+ type: TxType.example;
68
+ payload: {
69
+ value: number;
70
+ };
71
+ };
72
+
73
+ export type TransactionUnion = ExampleTx;
74
+
75
+ export const usePulsarStore = createBoundedUseStore(
76
+ createPulsarStore<TransactionUnion>({
77
+ name: storageName,
78
+ adapter: evmAdapter(config, appChains),
79
+ }),
80
+ );
81
+ ```
82
+
83
+ ```tsx
84
+ // src/providers/NovaProvider.tsx
85
+ import { NovaProvider as NP } from '@tuwaio/nova-transactions/providers';
86
+ import { TransactionAdapter } from '@tuwaio/pulsar-core';
87
+ import { useInitializeTransactionsPool } from '@tuwaio/pulsar-react';
88
+ import { useAccount } from 'wagmi';
89
+
90
+ import { usePulsarStore } from '@/hooks/txTrackingHooks';
91
+
92
+ export function NovaProvider() {
93
+ const transactionsPool = usePulsarStore((state) => state.transactionsPool);
94
+ const initialTx = usePulsarStore((state) => state.initialTx);
95
+ const closeTxTrackedModal = usePulsarStore((state) => state.closeTxTrackedModal);
96
+ const handleTransaction = usePulsarStore((state) => state.handleTransaction);
97
+ const initializeTransactionsPool = usePulsarStore((state) => state.initializeTransactionsPool);
98
+ const getAdapter = usePulsarStore((state) => state.getAdapter);
99
+
100
+ useInitializeTransactionsPool({ initializeTransactionsPool });
101
+
102
+ const { address } = useAccount();
103
+
104
+ return (
105
+ <NP
106
+ transactionsPool={transactionsPool}
107
+ initialTx={initialTx}
108
+ closeTxTrackedModal={closeTxTrackedModal}
109
+ handleTransaction={handleTransaction}
110
+ connectedWalletAddress={address}
111
+ connectedAdapterType={TransactionAdapter.EVM}
112
+ adapter={getAdapter()}
113
+ />
114
+ );
115
+ }
116
+
117
+ ```
52
118
 
53
119
  ```tsx
54
120
  // src/providers/index.tsx
55
121
  'use client';
56
122
 
57
- import {usePulsar} from '@/store/pulsar';
58
- import {NovaProvider} from '@tuwaio/nova-transactions';
59
- import {useAccount} from 'wagmi';
60
- import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
61
- import {WagmiProvider} from 'wagmi';
62
- import {PulsarInitializer} from '@/components/PulsarInitializer';
63
- import {wagmiConfig, chains, pulsarStore} from '@/configs'; // Your app's configs
64
- import {TransactionAdapter} from '@tuwaio/pulsar-core';
65
- import {evmAdapter} from '@tuwaio/pulsar-evm';
66
-
67
- // Import required CSS
68
- import '@tuwaio/nova-core/dist/index.css';
69
- import '@tuwaio/nova-transactions/dist/index.css';
70
- import 'react-toastify/dist/ReactToastify.css';
123
+ import { RainbowKitProvider } from '@rainbow-me/rainbowkit';
124
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
125
+ import { ReactNode } from 'react';
126
+ import { WagmiProvider } from 'wagmi';
71
127
 
72
- const queryClient = new QueryClient();
128
+ import { config } from '@/configs/wagmiConfig';
73
129
 
74
- export function Providers({children}: { children: React.ReactNode }) {
75
- // 1. Get live state and actions from your Pulsar store hook
76
- const {
77
- transactionsPool,
78
- initialTx,
79
- handleTransaction,
80
- closeTxTrackedModal,
81
- actions,
82
- } = usePulsar();
130
+ import { NovaProvider } from './NovaProvider';
83
131
 
84
- // 2. Get live wallet data from wagmi
85
- const {address, chain} = useAccount();
132
+ const queryClient = new QueryClient();
86
133
 
134
+ export function Providers({ children }: { children: ReactNode }) {
87
135
  return (
88
- <WagmiProvider config={wagmiConfig}>
136
+ <WagmiProvider config={config}>
89
137
  <QueryClientProvider client={queryClient}>
90
- {/* PulsarInitializer handles rehydrating the store on page load */}
91
- <PulsarInitializer/>
92
-
93
- {/* Your application's pages */}
94
- {children}
95
-
96
- {/* 3. Render NovaProvider as a self-contained UI manager */}
97
- <NovaProvider
98
- // Pass all required state and actions from Pulsar as props
99
- transactionsPool={transactionsPool}
100
- initialTx={initialTx}
101
- handleTransaction={handleTransaction}
102
- closeTxTrackedModal={closeTxTrackedModal}
103
-
104
- // Pass live wallet and adapter data
105
- connectedWalletAddress={address}
106
- connectedAdapterType={chain?.id ? TransactionAdapter.EVM : undefined} // Example for EVM
107
-
108
- // Pass static configuration
109
- adapter={evmAdapter(wagmiConfig, chains)}
110
- />
138
+ <RainbowKitProvider>
139
+ <NovaProvider />
140
+ {children}
141
+ </RainbowKitProvider>
111
142
  </QueryClientProvider>
112
143
  </WagmiProvider>
113
144
  );
@@ -153,4 +184,4 @@ If you find this library useful, please consider supporting its development. Eve
153
184
 
154
185
  ## 📄 License
155
186
 
156
- This project is licensed under the **Apache-2.0 License** - see the [LICENSE](./LICENSE) file for details.
187
+ This project is licensed under the **Apache-2.0 License** - see the [LICENSE](./LICENSE) file for details.
@@ -417,7 +417,7 @@ declare function TrackingTxModal<T extends Transaction>({ adapter, onClose, onOp
417
417
  */
418
418
 
419
419
  type CustomIconProps = {
420
- chainId: number;
420
+ chainId: number | string;
421
421
  };
422
422
  type CustomTimestampProps = {
423
423
  timestamp?: number;
@@ -417,7 +417,7 @@ declare function TrackingTxModal<T extends Transaction>({ adapter, onClose, onOp
417
417
  */
418
418
 
419
419
  type CustomIconProps = {
420
- chainId: number;
420
+ chainId: number | string;
421
421
  };
422
422
  type CustomTimestampProps = {
423
423
  timestamp?: number;
package/dist/index.cjs CHANGED
@@ -1,2 +1,13 @@
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'),h=require('@radix-ui/react-dialog'),framerMotion=require('framer-motion'),Rt=require('dayjs'),so=require('dayjs/plugin/relativeTime'),No=require('ethereum-blockies-base64'),viem=require('viem');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 Rt__default=/*#__PURE__*/_interopDefault(Rt);var so__default=/*#__PURE__*/_interopDefault(so);var No__default=/*#__PURE__*/_interopDefault(No);var j={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",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",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 qt=react.createContext(j);var m=()=>react.useContext(qt);({[pulsarCore.TransactionStatus.Success]:"success",[pulsarCore.TransactionStatus.Failed]:"error",[pulsarCore.TransactionStatus.Replaced]:"info"});function z({label:t,hash:e,explorerUrl:o,variant:r="default",className:s}){let{isCopied:n,copy:i}=novaCore.useCopyToClipboard(),{actions:c,txError:p}=m(),a=novaCore.cn("flex items-center justify-between",{"text-sm":r==="default","text-xs":r==="compact"},s),l=novaCore.cn("pr-1",{"font-bold text-[var(--tuwa-text-primary)]":r==="default","font-medium text-[var(--tuwa-text-secondary)]":r==="compact"}),d=jsxRuntime.jsx("span",{className:"font-mono",children:novaCore.textCenterEllipsis(e,5,5)});return jsxRuntime.jsxs("div",{className:a,children:[t&&jsxRuntime.jsxs("span",{className:l,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)] transition-colors hover:underline",title:c.viewOnExplorer,"aria-label":c.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:n?p.copied:c.copy,"aria-label":n?p.copied:c.copy,children:n?jsxRuntime.jsx(solid.CheckIcon,{className:"h-4 w-4 text-[var(--tuwa-success-icon)]"}):jsxRuntime.jsx(solid.DocumentDuplicateIcon,{className:"h-4 w-4"})})]})]})}var vt={[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 R({txStatus:t,source:e,fallback:o,variant:r,className:s,applyColor:n=false}){let i,c="";if(typeof e=="string")i=e;else if(Array.isArray(e)){let l=vt[t||"default"]??vt.default;i=e[l.index],n&&(c=l.colorClass);}else i=o;return i?jsxRuntime.jsx("div",{className:novaCore.cn(r==="title"?"text-sm font-semibold text-[var(--tuwa-text-primary)]":"mt-1 text-xs text-[var(--tuwa-text-secondary)]",c,s),children:i}):null}function Qt({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 O({tx:t,adapter:e,variant:o="toast",className:r,renderHashLink:s,confirmations:n}){let{hashLabels:i,statuses:c}=m(),p=pulsarCore.selectAdapterByKey({adapterKey:t.adapter,adapter:e});if(!p)return null;let a=f=>s?s(f):jsxRuntime.jsx(z,{...f}),l=o==="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)],y=d?a({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,x=(()=>{let f=t.hash,g=t.replacedTxHash;return !f&&!g?null:g?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f&&a({label:i.original,hash:f,variant:"compact"}),typeof p.getExplorerTxUrl<"u"&&a({label:i.replaced,hash:g,explorerUrl:p.getExplorerTxUrl(t)})]}):f&&typeof p.getExplorerTxUrl<"u"&&a({label:i.default,hash:f,explorerUrl:p.getExplorerTxUrl(t)})})(),T=d&&d!==i.default&&t.txKey!==t.hash;return jsxRuntime.jsxs("div",{className:novaCore.cn(l,r),children:[T&&y,x,typeof n=="number"&&jsxRuntime.jsxs("p",{className:"text-xs text-[var(--tuwa-text-tertiary)]",children:[c.confirmationsLabel,": ",n]})]})}var ve=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 $({tx:t,className:e}){let{statuses:o}=m(),r=react.useMemo(()=>ve(o),[o]),s="inline-flex items-center gap-x-1.5 rounded-full px-2 py-1 text-xs font-medium",n=t.pending?"Pending":t.status,i=n?r[n]: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.unknown});let{label:c,Icon:p,badgeClasses:a,iconClasses:l}=i;return jsxRuntime.jsxs("div",{className:novaCore.cn(s,a,e),children:[jsxRuntime.jsx(p,{className:novaCore.cn("h-4 w-4",l)}),c]})}var he=({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}),Pe=({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}),Ne=({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 jt({openWalletInfoModal:t,tx:e,icon:o,className:r,customization:s,connectedWalletAddress:n,adapter:i}){let{actions:c,toast:p}=m(),a=pulsarCore.selectAdapterByKey({adapterKey:e.adapter,adapter:i}),l=!!(e.tracker==="ethereum"&&e.pending&&a?.speedUpTxAction&&a?.cancelTxAction&&e.from.toLowerCase()===n?.toLowerCase()),d=()=>{l&&a.cancelTxAction(e);},y=()=>{l&&a.speedUpTxAction(e);},{StatusAwareText:x=R,TransactionKey:T=O,StatusBadge:f=$,SpeedUpButton:g=he,CancelButton:I=Pe,WalletInfoButton:v=Ne}=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",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:o??jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:e.chainId})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(x,{txStatus:e.status,source:e.title,fallback:e.type,variant:"title",applyColor:true}),jsxRuntime.jsx(x,{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(f,{tx:e}),l?jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(g,{onClick:y,children:c.speedUp}),jsxRuntime.jsx(I,{onClick:d,children:c.cancel})]}):t&&!!n&&jsxRuntime.jsx(v,{onClick:t,children:p.openWalletInfo})]})]})]})}function Ct({error:t,className:e}){let{isCopied:o,copy:r}=novaCore.useCopyToClipboard(),{actions:s,txError:n}=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:n.title})]}),jsxRuntime.jsx("button",{type:"button",onClick:()=>r(t),title:o?n.copied:s.copy,"aria-label":o?n.copied:`${s.copy} error message`,className:"cursor-pointer text-[var(--tuwa-error-icon)]/50 transition-colors hover:text-[var(--tuwa-error-icon)]",children:o?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 We({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 ht({tx:t,adapter:e,className:o,customization:r}){let{txInfo:s,statuses:n,hashLabels:i}=m(),c=pulsarCore.selectAdapterByKey({adapterKey:t.adapter,adapter:e});if(!c)return null;let{InfoRow:p=We}=r?.components??{},a="chainId"in t?t.chainId:t.desiredChainID,l=t.adapter===pulsarCore.TransactionAdapter.SOLANA,d=l?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",o),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:a})}),jsxRuntime.jsx("span",{children:utils.getChainName(a)})]})}),t.localTimestamp&&jsxRuntime.jsx(p,{label:s.started,value:Rt__default.default.unix(t.localTimestamp).format("MMM D, HH:mm:ss")}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d?.slot&&jsxRuntime.jsx(p,{label:s.slot,value:jsxRuntime.jsx(z,{hash:d.slot.toString(),explorerUrl:c?.getExplorerUrl?`${c?.getExplorerUrl(`/block/${d.slot}`)}`:void 0})}),(typeof d?.confirmations=="number"||typeof d?.confirmations=="string")&&jsxRuntime.jsx(p,{label:n.confirmationsLabel,value:d.confirmations}),d?.recentBlockhash&&jsxRuntime.jsx(p,{label:i.recentBlockhash,value:jsxRuntime.jsx(z,{hash:d.recentBlockhash})})]}),"txKey"in t&&t.txKey&&jsxRuntime.jsx("div",{className:"border-t border-[var(--tuwa-border-primary)] pt-3",children:jsxRuntime.jsx(O,{tx:t,adapter:e,variant:"history",renderHashLink:r?.components?.transactionKey})})]})}var Ve={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 _e({status:t,label:e,isFirst:o=false}){let r=Ve[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",r.pulse)});default:return null}};return jsxRuntime.jsxs("div",{className:"relative flex min-w-[80px] flex-1 flex-col items-center",children:[!o&&jsxRuntime.jsx("div",{className:novaCore.cn("absolute right-1/2 top-[10px] h-0.5 w-full",r.line)}),jsxRuntime.jsx("div",{className:novaCore.cn("relative z-10 flex h-5 w-5 items-center justify-center rounded-full border-2",r.border,r.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 Pt({isProcessing:t,isSucceed:e,isFailed:o,isReplaced:r,className:s,StepComponent:n=_e}){let{trackingModal:i,statuses:c}=m(),p=react.useMemo(()=>{let a=d=>{if(d===1)return "completed";if(d===2){if(e||o||r)return "completed";if(t)return "active"}if(d===3){if(e)return "completed";if(o)return "error";if(r)return "replaced";if(t)return "active"}return "inactive"},l=d=>d===1?i.progressIndicator.created:d===2?i.progressIndicator.processing:o?c.failed:r?c.replaced:i.progressIndicator.succeed;return [{status:a(1),label:l(1),isFirst:true},{status:a(2),label:l(2)},{status:a(3),label:l(3),isLast:true}]},[t,e,o,r,i,c]);return jsxRuntime.jsx("div",{className:novaCore.cn("flex w-full items-start px-4 pt-2 pb-1",s),children:p.map((a,l)=>jsxRuntime.jsx(n,{...a},l))})}var qe={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 kt({isProcessing:t,isSucceed:e,isFailed:o,isReplaced:r}){let s=e&&"succeed"||o&&"failed"||r&&"replaced"||t&&"processing"||"initializing",{Icon:n,className:i}=qe[s];return jsxRuntime.jsx("div",{className:"flex justify-center py-4",children:jsxRuntime.jsx(n,{className:novaCore.cn("h-16 w-16",i)})})}function Zt({adapter:t,onClose:e,onOpenWalletInfo:o,className:r,customization:s,transactionsPool:n,handleTransaction:i,initialTx:c,connectedWalletAddress:p}){let a=react.useMemo(()=>c?.lastTxKey?n[c.lastTxKey]:void 0,[n,c]),l=a??c,d=c?.withTrackedModal&&!a||(a?.isTrackedModalOpen??false),{isProcessing:y,isSucceed:x,isFailed:T,isReplaced:f}=react.useMemo(()=>{let W=a?.status,$t=c?.isInitializing??false,Jt=a?.pending??false;return {isProcessing:$t||Jt,isSucceed:W===pulsarCore.TransactionStatus.Success,isFailed:a?.isError||!!c?.errorMessage,isReplaced:W===pulsarCore.TransactionStatus.Replaced}},[a,c]),g=react.useMemo(()=>l?pulsarCore.selectAdapterByKey({adapterKey:l.adapter,adapter:t}):void 0,[l,t]),I=!!(T&&l&&c?.actionFunction&&i),v=!!(g?.speedUpTxAction&&g?.cancelTxAction&&a?.pending&&a.tracker==="ethereum"),K=()=>{if(!I||!g?.retryTxAction)return;let W={adapter:l.adapter,type:l.type,desiredChainID:"desiredChainID"in l?l.desiredChainID:l.chainId,actionFunction:c?.actionFunction,title:l.title,description:l.description,payload:l.payload,withTrackedModal:true};g.retryTxAction({tx:W,txKey:a?.txKey??"",onClose:e,handleTransaction:i});},k=()=>{v&&a&&g.cancelTxAction(a);},B=()=>{v&&a&&g.speedUpTxAction(a);},_=s?.components?.Header,dt=s?.components?.Footer,ut=s?.components?.StatusVisual,mt=s?.components?.ProgressIndicator,ft=s?.components?.InfoBlock,xt=s?.components?.ErrorBlock,Xt={initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2,ease:"easeOut"},...s?.motionProps};return l?jsxRuntime.jsx(h__namespace.Root,{open:d,onOpenChange:W=>!W&&e(a?.txKey),children:jsxRuntime.jsx(h__namespace.Portal,{children:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(h__namespace.Overlay,{asChild:true,children:jsxRuntime.jsx(framerMotion.motion.div,{className:"fixed inset-0 z-50 bg-black/60",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}})}),jsxRuntime.jsx(h__namespace.Content,{className:"fixed left-1/2 top-1/2 z-50 w-full max-w-md -translate-x-1/2 -translate-y-1/2 outline-none",...s?.modalProps,asChild:true,children:jsxRuntime.jsx(framerMotion.motion.div,{...Xt,children:jsxRuntime.jsxs("div",{className:novaCore.cn("relative flex max-h-[98dvh] w-full flex-col gap-3 overflow-y-auto rounded-2xl bg-[var(--tuwa-bg-primary)] p-5 pt-0 shadow-2xl",r),children:[_?jsxRuntime.jsx(_,{onClose:()=>e(a?.txKey),title:jsxRuntime.jsx(Mt,{tx:l})}):jsxRuntime.jsx(eo,{onClose:()=>e(a?.txKey),title:jsxRuntime.jsx(Mt,{tx:l})}),jsxRuntime.jsxs("main",{className:"flex flex-col gap-3",children:[ut?jsxRuntime.jsx(ut,{isProcessing:y,isSucceed:x,isFailed:T,isReplaced:f}):jsxRuntime.jsx(kt,{isProcessing:y,isSucceed:x,isFailed:T,isReplaced:f}),mt?jsxRuntime.jsx(mt,{isProcessing:y,isSucceed:x,isFailed:T,isReplaced:f}):jsxRuntime.jsx(Pt,{isProcessing:y,isSucceed:x,isFailed:T,isReplaced:f}),ft?jsxRuntime.jsx(ft,{tx:l,adapter:t}):jsxRuntime.jsx(ht,{tx:l,adapter:t}),xt?jsxRuntime.jsx(xt,{error:a?.errorMessage||c?.errorMessage}):jsxRuntime.jsx(Ct,{error:a?.errorMessage||c?.errorMessage})]}),dt?jsxRuntime.jsx(dt,{onClose:()=>e(a?.txKey),onOpenWalletInfo:o,isProcessing:y,isFailed:T,canReplace:v,onRetry:I?K:void 0,onSpeedUp:v?B:void 0,onCancel:v?k:void 0,connectedWalletAddress:p}):jsxRuntime.jsx(oo,{onClose:()=>e(a?.txKey),onOpenWalletInfo:o,isProcessing:y,isFailed:T,canReplace:v,onRetry:I?K:void 0,onSpeedUp:v?B:void 0,onCancel:v?k:void 0,connectedWalletAddress:p})]})})})]})})})}):null}function Mt({tx:t}){return jsxRuntime.jsx(R,{txStatus:"status"in t?t.status:void 0,source:t.title,fallback:t.type,variant:"title",className:"text-lg"})}var eo=({onClose:t,title:e})=>{let{actions:o}=m();return jsxRuntime.jsxs("header",{className:"sticky top-0 z-10 flex w-full items-start justify-between bg-[var(--tuwa-bg-primary)] pt-5 pb-2",children:[jsxRuntime.jsx(h__namespace.Title,{children:e}),jsxRuntime.jsx(h__namespace.Close,{asChild:true,children:jsxRuntime.jsx("button",{type:"button",onClick:()=>t(),"aria-label":o.close,className:"cursor-pointer -mt-1 ml-2 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"})})})]})},oo=({onClose:t,onOpenWalletInfo:e,isProcessing:o,onRetry:r,onSpeedUp:s,onCancel:n,canReplace:i,isFailed:c,connectedWalletAddress:p})=>{let{trackingModal:a,actions:l}=m(),d=()=>c&&r?jsxRuntime.jsx("button",{type:"button",onClick:r,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:a.retry}):!o&&!i&&p?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:a.walletInfo}):null;return 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:i&&s&&n&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:s,className:"cursor-pointer text-sm font-medium text-[var(--tuwa-text-accent)] transition-opacity hover:opacity-80",children:l.speedUp}),jsxRuntime.jsx("button",{type:"button",onClick:n,className:"cursor-pointer text-sm font-medium text-[var(--tuwa-text-secondary)] transition-opacity hover:opacity-80",children:l.cancel})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(d,{}),jsxRuntime.jsx("button",{type:"button",onClick:t,disabled:o&&!i,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:o&&!i?a.processing:a.close})]})]})};Rt__default.default.extend(so__default.default);var no=({chainId:t})=>jsxRuntime.jsx("div",{className:"h-8 w-8 text-[var(--tuwa-text-secondary)]",children:jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:t})}),io=({timestamp:t})=>jsxRuntime.jsx("span",{className:"mb-1 block text-xs text-[var(--tuwa-text-secondary)]",children:t?Rt__default.default.unix(t).fromNow():"..."});function Lt({tx:t,adapter:e,className:o,customization:r}){let{Icon:s=no,Title:n=R,Description:i=R,Timestamp:c=io,StatusBadge:p=$,TransactionKey:a=O}=r?.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)]",o),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(n,{txStatus:t.status,source:t.title,fallback:t.type,variant:"title",applyColor:true}),jsxRuntime.jsx(c,{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:e,variant:"history"})]})}function po({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 Ht({adapter:t,connectedWalletAddress:e,transactionsPool:o,className:r,customization:s}){let{walletModal:n}=m(),i=react.useMemo(()=>e?pulsarCore.selectAllTransactionsByActiveWallet(o,e).sort((d,y)=>(y.localTimestamp??0)-(d.localTimestamp??0)):[],[o,e]),{Placeholder:c=po,HistoryItem:p=Lt}=s?.components??{},a=()=>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(l=>jsxRuntime.jsx(p,{tx:l,adapter:t},l.txKey))}):jsxRuntime.jsx(c,{title:n.history.noTransactionsTitle,message:n.history.noTransactionsMessage}):jsxRuntime.jsx(c,{title:n.history.connectWalletTitle,message:n.history.connectWalletMessage});return jsxRuntime.jsxs("div",{className:novaCore.cn("flex flex-col gap-y-3",r),children:[jsxRuntime.jsx("h3",{className:"text-lg font-bold text-[var(--tuwa-text-primary)]",children:n.history.title}),a()]})}var To=t=>({replaced:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(solid.ArrowPathIcon,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.replaced})]}),loading:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(solid.ArrowPathIcon,{className:"h-4 w-4 animate-spin"}),jsxRuntime.jsx("span",{children:t.loading})]}),succeed:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(solid.CheckCircleIcon,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.succeed})]}),failed:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(solid.ExclamationCircleIcon,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.failed})]})});function pn({children:t,action:e,getLastTxKey:o,transactionsPool:r,walletAddress:s,loadingContent:n,succeedContent:i,failedContent:c,replacedContent:p,resetTimeout:a=2500,className:l,...d}){let{trackedTxButton:y}=m(),[x,T]=react.useState("idle"),[f,g]=react.useState(void 0),I=react.useMemo(()=>To(y),[y]);react.useEffect(()=>{T("idle"),g(void 0);},[s]),react.useEffect(()=>{if(!f)return;let k=r[f];if(k)switch(k.status){case pulsarCore.TransactionStatus.Success:T("succeed");break;case pulsarCore.TransactionStatus.Replaced:T("replaced");break;case pulsarCore.TransactionStatus.Failed:T("failed");break}},[r,f,s]),react.useEffect(()=>{if(["succeed","failed","replaced"].includes(x)){let k=setTimeout(()=>{T("idle"),g(void 0);},a);return ()=>clearTimeout(k)}},[x,a]);let v=async()=>{T("loading");try{await e(),g(o());}catch(k){console.error("Transaction initiation failed:",k),T("failed");}},K=()=>{switch(x){case "loading":return n??I.loading;case "succeed":return i??I.succeed;case "failed":return c??I.failed;case "replaced":return p??I.replaced;default:return t}};return jsxRuntime.jsx("button",{...d,disabled:x!=="idle"||d.disabled,onClick:v,className:novaCore.cn("flex cursor-pointer items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-70",{"bg-gradient-to-r from-[var(--tuwa-button-gradient-from)] to-[var(--tuwa-button-gradient-to)] text-[var(--tuwa-text-on-accent)] hover:opacity-90":x==="idle","bg-gray-400 text-white":x==="loading","bg-gray-500 text-white":x==="replaced","bg-[var(--tuwa-success-bg)] text-[var(--tuwa-success-text)]":x==="succeed","bg-[var(--tuwa-error-bg)] text-[var(--tuwa-error-text)]":x==="failed"},l),children:K()})}function ct({address:t,explorerUrl:e,className:o}){let{isCopied:r,copy:s}=novaCore.useCopyToClipboard(),{actions:n,txError:i}=m();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:r?i.copied:n.copy,"aria-label":r?i.copied:`${n.copy} address`,onClick:()=>s(t),className:"cursor-pointer transition-colors hover:text-[var(--tuwa-text-primary)]",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"})}),e&&jsxRuntime.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"transition-colors hover:text-[var(--tuwa-text-accent)]",title:n.viewOnExplorer,"aria-label":n.viewOnExplorer,children:jsxRuntime.jsx(solid.ArrowTopRightOnSquareIcon,{className:"h-4 w-4"})})]})}function Ut({address:t,ensAvatar:e,className:o}){let{walletModal:r}=m(),[s,n]=react.useState(e),i=react.useMemo(()=>No__default.default(viem.isHex(t)?t:viem.zeroAddress),[t]),c=react.useMemo(()=>`#${t.slice(2,8)}`,[t]);react.useEffect(()=>{n(e);},[e]);let p=()=>{n(i);};return jsxRuntime.jsx("div",{className:novaCore.cn("h-12 w-12 flex-shrink-0 rounded-full",o),style:{backgroundColor:c},children:jsxRuntime.jsx("img",{className:"h-full w-full rounded-full object-cover",src:s||i,alt:`${r.header.avatarAlt} ${t}`,onError:p},e)})}var Lo=({isLoading:t,ensName:e,walletAddress:o,explorerUrl:r,renderAddressDisplay:s})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"mb-1.5 flex h-7 items-center",children:t?jsxRuntime.jsx("div",{className:"h-full w-48 animate-pulse rounded-md bg-[var(--tuwa-bg-muted)]"}):e?jsxRuntime.jsx("h2",{className:"text-xl font-bold text-[var(--tuwa-text-primary)]",children:e}):jsxRuntime.jsx(ct,{address:o,explorerUrl:r,className:"rounded-none bg-transparent px-0 py-0 text-xl font-bold text-[var(--tuwa-text-primary)]"})}),jsxRuntime.jsx("div",{className:"flex h-5 items-center",children:!t&&e&&(s?s({address:o,explorerUrl:r}):jsxRuntime.jsx(ct,{address:o,explorerUrl:r}))})]});function zt({walletAddress:t,adapter:e,connectedAdapterType:o,className:r,renderAvatar:s,renderName:n,renderAddressDisplay:i,renderNoWalletContent:c,explorerUrl:p}){let{walletModal:a}=m(),[l,d]=react.useState(null),[y,x]=react.useState(null),[T,f]=react.useState(true);if(react.useEffect(()=>{(async()=>{if(!t||!o){f(false);return}let v=pulsarCore.selectAdapterByKey({adapterKey:o,adapter:e}),K=v&&"getName"in v&&typeof v.getName=="function",k=v&&"getAvatar"in v&&typeof v.getAvatar=="function";if(!K){f(false);return}f(true),d(null),x(null);try{let B=v?.getName?await v.getName(t):null;if(B&&(d(B),k)){let _=v?.getAvatar?await v.getAvatar(B):null;x(_);}}catch(B){console.error("Failed to fetch name service data:",B);}finally{f(false);}})();},[t,e,o]),!t)return c?jsxRuntime.jsx(jsxRuntime.Fragment,{children:c()}):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)]",r),children:a.header.notConnected});let g=l?l.length>30?novaCore.textCenterEllipsis(l,12,12):l:void 0;return jsxRuntime.jsxs("div",{className:novaCore.cn("flex min-h-[4rem] items-center gap-4",r),children:[jsxRuntime.jsx("div",{children:s?s({address:t,ensAvatar:y}):jsxRuntime.jsx(Ut,{address:t,ensAvatar:y})}),jsxRuntime.jsx("div",{className:"flex min-h-[3.5rem] min-w-[200px] flex-col justify-center",children:n?n({ensName:g,isLoading:T,address:t}):jsxRuntime.jsx(Lo,{isLoading:T,ensName:g,walletAddress:t,explorerUrl:p,renderAddressDisplay:i})})]})}var Uo=({closeModal:t,title:e})=>{let{actions:o}=m();return jsxRuntime.jsxs("div",{className:"sticky top-0 left-0 z-10 flex w-full items-center justify-between border-b border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-secondary)] p-4",children:[jsxRuntime.jsx(h__namespace.Title,{className:"text-lg font-bold text-[var(--tuwa-text-primary)]",children:e}),jsxRuntime.jsx(h__namespace.Close,{asChild:true,children:jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":o.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"})})})]})};function te({isOpen:t,setIsOpen:e,customization:o,adapter:r,connectedAdapterType:s,connectedWalletAddress:n,transactionsPool:i}){let{walletModal:c}=m(),{explorerUrl:p}=react.useMemo(()=>s?{explorerUrl:pulsarCore.selectAdapterByKey({adapterKey:s,adapter:r})?.getExplorerUrl(`/address/${n}`)}:{explorerUrl:void 0},[s,r,n]),a=()=>e(false),d={...{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2,ease:"easeOut"}},...o?.motionProps},y=o?.components?.Header,x=o?.components?.WalletInfo,T=o?.components?.History;return jsxRuntime.jsx(h__namespace.Root,{open:t,onOpenChange:f=>!f&&a(),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 z-50 bg-black/45",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 z-50 w-full max-w-2xl -translate-x-1/2 -translate-y-1/2 outline-none",...o?.modalProps,asChild:true,children:jsxRuntime.jsx(framerMotion.motion.div,{...d,children:jsxRuntime.jsxs("div",{className:novaCore.cn("relative max-h-[98dvh] w-full max-w-2xl overflow-y-auto rounded-2xl bg-[var(--tuwa-bg-secondary)] shadow-xl outline-none",o?.classNames?.contentWrapper),children:[y?jsxRuntime.jsx(y,{closeModal:a}):jsxRuntime.jsx(Uo,{closeModal:a,title:c.title}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-4 p-4 sm:gap-6 sm:p-6",children:[x?jsxRuntime.jsx(x,{adapter:r,connectedAdapterType:s,walletAddress:n,explorerUrl:p}):jsxRuntime.jsx(zt,{adapter:r,connectedAdapterType:s,walletAddress:n,explorerUrl:p}),T?jsxRuntime.jsx(T,{adapter:r,transactionsPool:i,connectedWalletAddress:n}):jsxRuntime.jsx(Ht,{adapter:r,transactionsPool:i,connectedWalletAddress:n})]})]})})})]})})})})}exports.HashLink=z;exports.StatusAwareText=R;exports.ToastCloseButton=Qt;exports.ToastTransaction=jt;exports.TrackingTxModal=Zt;exports.TransactionHistoryItem=Lt;exports.TransactionKey=O;exports.TransactionStatusBadge=$;exports.TransactionsHistory=Ht;exports.TxActionButton=pn;exports.TxErrorBlock=Ct;exports.TxInfoBlock=ht;exports.TxProgressIndicator=Pt;exports.TxStatusVisual=kt;exports.WalletAddressDisplay=ct;exports.WalletAvatar=Ut;exports.WalletHeader=zt;exports.WalletInfoModal=te;exports.defaultLabels=j;//# sourceMappingURL=index.cjs.map
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'),C=require('@radix-ui/react-dialog'),framerMotion=require('framer-motion'),Wt=require('dayjs'),co=require('dayjs/plugin/relativeTime'),Ao=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 C__namespace=/*#__PURE__*/_interopNamespace(C);var Wt__default=/*#__PURE__*/_interopDefault(Wt);var co__default=/*#__PURE__*/_interopDefault(co);var Ao__default=/*#__PURE__*/_interopDefault(Ao);var ot={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",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",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 te=react.createContext(ot);var m=()=>react.useContext(te);({[pulsarCore.TransactionStatus.Success]:"success",[pulsarCore.TransactionStatus.Failed]:"error",[pulsarCore.TransactionStatus.Replaced]:"info"});function _({label:t,hash:e,explorerUrl:o,variant:r="default",className:s}){let{isCopied:n,copy:i}=novaCore.useCopyToClipboard(),{actions:c,txError:p}=m(),a=novaCore.cn("flex items-center justify-between",{"text-sm":r==="default","text-xs":r==="compact"},s),l=novaCore.cn("pr-1",{"font-bold text-[var(--tuwa-text-primary)]":r==="default","font-medium text-[var(--tuwa-text-secondary)]":r==="compact"}),d=jsxRuntime.jsx("span",{className:"font-mono",children:novaCore.textCenterEllipsis(e,5,5)});return jsxRuntime.jsxs("div",{className:a,children:[t&&jsxRuntime.jsxs("span",{className:l,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)] transition-colors hover:underline",title:c.viewOnExplorer,"aria-label":c.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:n?p.copied:c.copy,"aria-label":n?p.copied:c.copy,children:n?jsxRuntime.jsx(solid.CheckIcon,{className:"h-4 w-4 text-[var(--tuwa-success-icon)]"}):jsxRuntime.jsx(solid.DocumentDuplicateIcon,{className:"h-4 w-4"})})]})]})}var wt={[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 H({txStatus:t,source:e,fallback:o,variant:r,className:s,applyColor:n=false}){let i,c="";if(typeof e=="string")i=e;else if(Array.isArray(e)){let l=wt[t||"default"]??wt.default;i=e[l.index],n&&(c=l.colorClass);}else i=o;return i?jsxRuntime.jsx("div",{className:novaCore.cn(r==="title"?"text-sm font-semibold text-[var(--tuwa-text-primary)]":"mt-1 text-xs text-[var(--tuwa-text-secondary)]",c,s),children:i}):null}function ee({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 Y(t){switch(t){case "solana:mainnet":return "Solana Mainnet";case "solana:devnet":return "Solana Devnet";case "solana:testnet":return "Solana Testent";default:return t}}var J=({svgCode:t,...e})=>jsxRuntime.jsx("img",{...e,draggable:false,onDragStart:o=>o.preventDefault(),src:`data:image/svg+xml;base64,${btoa(t)}`,style:{outline:"none !important",pointerEvents:"none"},alt:e.alt});function O({chainId:t,...e}){switch(t){case "solana:mainnet":return jsxRuntime.jsx(J,{svgCode:'<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="solanamainnet__a" x1="0" x2=".5" y1=".5" y2="0"><stop offset="0%" stop-color="#9844FE"/><stop offset="50%" stop-color="#5496D4" stop-opacity=".8"/><stop offset="100%" stop-color="#16FA9A"/></linearGradient></defs><g fill="none"><circle cx="16" cy="16" r="16" fill="#000"/><path fill="url(#solanamainnet__a)" d="M9.925 19.687a.6.6 0 0 1 .415-.17h14.366a.29.29 0 0 1 .207.497l-2.838 2.815a.6.6 0 0 1-.415.171H7.294a.291.291 0 0 1-.207-.498zm0-10.517A.6.6 0 0 1 10.34 9h14.366c.261 0 .392.314.207.498l-2.838 2.815a.6.6 0 0 1-.415.17H7.294a.291.291 0 0 1-.207-.497zm12.15 5.225a.6.6 0 0 0-.415-.17H7.294a.291.291 0 0 0-.207.498l2.838 2.815c.11.109.26.17.415.17h14.366a.291.291 0 0 0 .207-.498z"/></g></svg>',alt:t,...e});case "solana:devnet":return jsxRuntime.jsx(J,{svgCode:`<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
2
+ <path
3
+ fill="#C4BFB8"
4
+ d="M16 0c8.837 0 16 7.163 16 16s-7.163 16-16 16S0 24.837 0 16 7.163 0 16 0m8.706 19.517H10.34a.6.6 0 0 0-.415.17l-2.838 2.815a.291.291 0 0 0 .207.498H21.66a.6.6 0 0 0 .415-.17l2.838-2.816a.291.291 0 0 0-.207-.497m-3.046-5.292H7.294l-.068.007a.291.291 0 0 0-.14.49l2.84 2.816.07.06c.1.07.22.11.344.11h14.366l.068-.007a.291.291 0 0 0 .14-.49l-2.84-2.816-.07-.06a.6.6 0 0 0-.344-.11M24.706 9H10.34a.6.6 0 0 0-.415.17l-2.838 2.816a.291.291 0 0 0 .207.497H21.66a.6.6 0 0 0 .415-.17l2.838-2.815A.291.291 0 0 0 24.706 9"
5
+ />
6
+ </svg>`,alt:t,...e});case "solana:testnet":return jsxRuntime.jsx(J,{svgCode:`<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
7
+ <path
8
+ fill="#C4BFB8"
9
+ d="M16 0c8.837 0 16 7.163 16 16s-7.163 16-16 16S0 24.837 0 16 7.163 0 16 0m8.706 19.517H10.34a.6.6 0 0 0-.415.17l-2.838 2.815a.291.291 0 0 0 .207.498H21.66a.6.6 0 0 0 .415-.17l2.838-2.816a.291.291 0 0 0-.207-.497m-3.046-5.292H7.294l-.068.007a.291.291 0 0 0-.14.49l2.84 2.816.07.06c.1.07.22.11.344.11h14.366l.068-.007a.291.291 0 0 0 .14-.49l-2.84-2.816-.07-.06a.6.6 0 0 0-.344-.11M24.706 9H10.34a.6.6 0 0 0-.415.17l-2.838 2.816a.291.291 0 0 0 .207.497H21.66a.6.6 0 0 0 .415-.17l2.838-2.815A.291.291 0 0 0 24.706 9"
10
+ />
11
+ </svg>`,alt:t,...e});default:return jsxRuntime.jsx(J,{svgCode:'<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="solanamainnet__a" x1="0" x2=".5" y1=".5" y2="0"><stop offset="0%" stop-color="#9844FE"/><stop offset="50%" stop-color="#5496D4" stop-opacity=".8"/><stop offset="100%" stop-color="#16FA9A"/></linearGradient></defs><g fill="none"><circle cx="16" cy="16" r="16" fill="#000"/><path fill="url(#solanamainnet__a)" d="M9.925 19.687a.6.6 0 0 1 .415-.17h14.366a.29.29 0 0 1 .207.497l-2.838 2.815a.6.6 0 0 1-.415.171H7.294a.291.291 0 0 1-.207-.498zm0-10.517A.6.6 0 0 1 10.34 9h14.366c.261 0 .392.314.207.498l-2.838 2.815a.6.6 0 0 1-.415.17H7.294a.291.291 0 0 1-.207-.497zm12.15 5.225a.6.6 0 0 0-.415-.17H7.294a.291.291 0 0 0-.207.498l2.838 2.815c.11.109.26.17.415.17h14.366a.291.291 0 0 0 .207-.498z"/></g></svg>',alt:t,...e})}}function U({tx:t,adapter:e,variant:o="toast",className:r,renderHashLink:s,confirmations:n}){let{hashLabels:i,statuses:c}=m(),p=pulsarCore.selectAdapterByKey({adapterKey:t.adapter,adapter:e});if(!p)return null;let a=f=>s?s(f):jsxRuntime.jsx(_,{...f}),l=o==="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?a({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,x=(()=>{let f=t.hash,y=t.replacedTxHash;return !f&&!y?null:y?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f&&a({label:i.original,hash:f,variant:"compact"}),typeof p.getExplorerTxUrl<"u"&&a({label:i.replaced,hash:y,explorerUrl:p.getExplorerTxUrl(t)})]}):f&&typeof p.getExplorerTxUrl<"u"&&a({label:i.default,hash:f,explorerUrl:p.getExplorerTxUrl(t)})})(),g=d&&d!==i.default&&t.txKey!==t.hash;return jsxRuntime.jsxs("div",{className:novaCore.cn(l,r),children:[g&&v,x,typeof n=="number"&&jsxRuntime.jsxs("p",{className:"text-xs text-[var(--tuwa-text-tertiary)]",children:[c.confirmationsLabel,": ",n]})]})}var we=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 q({tx:t,className:e}){let{statuses:o}=m(),r=react.useMemo(()=>we(o),[o]),s="inline-flex items-center gap-x-1.5 rounded-full px-2 py-1 text-xs font-medium",n=t.pending?"Pending":t.status,i=n?r[n]: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.unknown});let{label:c,Icon:p,badgeClasses:a,iconClasses:l}=i;return jsxRuntime.jsxs("div",{className:novaCore.cn(s,a,e),children:[jsxRuntime.jsx(p,{className:novaCore.cn("h-4 w-4",l)}),c]})}var ke=({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}),Se=({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}),Ae=({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 oe({openWalletInfoModal:t,tx:e,icon:o,className:r,customization:s,connectedWalletAddress:n,adapter:i}){let{actions:c,toast:p}=m(),a=pulsarCore.selectAdapterByKey({adapterKey:e.adapter,adapter:i}),l=!!(e.tracker==="ethereum"&&e.pending&&a?.speedUpTxAction&&a?.cancelTxAction&&e.from.toLowerCase()===n?.toLowerCase()),d=()=>{l&&a.cancelTxAction(e);},v=()=>{l&&a.speedUpTxAction(e);},{StatusAwareText:x=H,TransactionKey:g=U,StatusBadge:f=q,SpeedUpButton:y=ke,CancelButton:I=Se,WalletInfoButton:T=Ae}=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",r),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-[40px] flex-shrink-0",title:typeof e.chainId=="string"?Y(e.chainId):utils.getChainName(e.chainId),children:o??typeof e.chainId=="string"?jsxRuntime.jsx(O,{chainId:e.chainId}):jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:e.chainId})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx(x,{txStatus:e.status,source:e.title,fallback:e.type,variant:"title",applyColor:true}),jsxRuntime.jsx(x,{txStatus:e.status,source:e.description,variant:"description"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(g,{adapter:i,tx:e,variant:"toast"}),jsxRuntime.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[jsxRuntime.jsx(f,{tx:e}),l?jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(y,{onClick:v,children:c.speedUp}),jsxRuntime.jsx(I,{onClick:d,children:c.cancel})]}):t&&!!n&&jsxRuntime.jsx(T,{onClick:t,children:p.openWalletInfo})]})]})]})}function It({error:t,className:e}){let{isCopied:o,copy:r}=novaCore.useCopyToClipboard(),{actions:s,txError:n}=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:n.title})]}),jsxRuntime.jsx("button",{type:"button",onClick:()=>r(t),title:o?n.copied:s.copy,"aria-label":o?n.copied:`${s.copy} error message`,className:"cursor-pointer text-[var(--tuwa-error-icon)]/50 transition-colors hover:text-[var(--tuwa-error-icon)]",children:o?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 Fe({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 kt({tx:t,adapter:e,className:o,customization:r}){let{txInfo:s,statuses:n,hashLabels:i}=m(),c=pulsarCore.selectAdapterByKey({adapterKey:t.adapter,adapter:e});if(!c)return null;let{InfoRow:p=Fe}=r?.components??{},a="chainId"in t?t.chainId:t.desiredChainID,l=t.adapter===pulsarCore.TransactionAdapter.SOLANA,d=l?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",o),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:typeof a=="string"?jsxRuntime.jsx(O,{chainId:a}):jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:a})}),jsxRuntime.jsx("span",{children:typeof a=="string"?Y(a):utils.getChainName(a)})]})}),t.localTimestamp&&jsxRuntime.jsx(p,{label:s.started,value:Wt__default.default.unix(t.localTimestamp).format("MMM D, HH:mm:ss")}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d?.slot&&jsxRuntime.jsx(p,{label:s.slot,value:jsxRuntime.jsx(_,{hash:d.slot.toString(),explorerUrl:c?.getExplorerUrl?`${c?.getExplorerUrl(`/block/${d.slot}`)}`:void 0})}),(typeof d?.confirmations=="number"||typeof d?.confirmations=="string")&&jsxRuntime.jsx(p,{label:n.confirmationsLabel,value:d.confirmations}),d?.recentBlockhash&&jsxRuntime.jsx(p,{label:i.recentBlockhash,value:jsxRuntime.jsx(_,{hash:d.recentBlockhash})})]}),"txKey"in t&&t.txKey&&jsxRuntime.jsx("div",{className:"border-t border-[var(--tuwa-border-primary)] pt-3",children:jsxRuntime.jsx(U,{tx:t,adapter:e,variant:"history",renderHashLink:r?.components?.transactionKey})})]})}var Xe={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 Je({status:t,label:e,isFirst:o=false}){let r=Xe[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",r.pulse)});default:return null}};return jsxRuntime.jsxs("div",{className:"relative flex min-w-[80px] flex-1 flex-col items-center",children:[!o&&jsxRuntime.jsx("div",{className:novaCore.cn("absolute right-1/2 top-[10px] h-0.5 w-full",r.line)}),jsxRuntime.jsx("div",{className:novaCore.cn("relative z-10 flex h-5 w-5 items-center justify-center rounded-full border-2",r.border,r.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 St({isProcessing:t,isSucceed:e,isFailed:o,isReplaced:r,className:s,StepComponent:n=Je}){let{trackingModal:i,statuses:c}=m(),p=react.useMemo(()=>{let a=d=>{if(d===1)return "completed";if(d===2){if(e||o||r)return "completed";if(t)return "active"}if(d===3){if(e)return "completed";if(o)return "error";if(r)return "replaced";if(t)return "active"}return "inactive"},l=d=>d===1?i.progressIndicator.created:d===2?i.progressIndicator.processing:o?c.failed:r?c.replaced:i.progressIndicator.succeed;return [{status:a(1),label:l(1),isFirst:true},{status:a(2),label:l(2)},{status:a(3),label:l(3),isLast:true}]},[t,e,o,r,i,c]);return jsxRuntime.jsx("div",{className:novaCore.cn("flex w-full items-start px-4 pt-2 pb-1",s),children:p.map((a,l)=>jsxRuntime.jsx(n,{...a},l))})}var to={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 Bt({isProcessing:t,isSucceed:e,isFailed:o,isReplaced:r}){let s=e&&"succeed"||o&&"failed"||r&&"replaced"||t&&"processing"||"initializing",{Icon:n,className:i}=to[s];return jsxRuntime.jsx("div",{className:"flex justify-center py-4",children:jsxRuntime.jsx(n,{className:novaCore.cn("h-16 w-16",i)})})}function ae({adapter:t,onClose:e,onOpenWalletInfo:o,className:r,customization:s,transactionsPool:n,handleTransaction:i,initialTx:c,connectedWalletAddress:p}){let a=react.useMemo(()=>c?.lastTxKey?n[c.lastTxKey]:void 0,[n,c]),l=a??c,d=c?.withTrackedModal&&!a||(a?.isTrackedModalOpen??false),{isProcessing:v,isSucceed:x,isFailed:g,isReplaced:f}=react.useMemo(()=>{let K=a?.status,qt=c?.isInitializing??false,Qt=a?.pending??false;return {isProcessing:qt||Qt,isSucceed:K===pulsarCore.TransactionStatus.Success,isFailed:a?.isError||!!c?.errorMessage,isReplaced:K===pulsarCore.TransactionStatus.Replaced}},[a,c]),y=react.useMemo(()=>l?pulsarCore.selectAdapterByKey({adapterKey:l.adapter,adapter:t}):void 0,[l,t]),I=!!(g&&l&&c?.actionFunction&&i),T=!!(y?.speedUpTxAction&&y?.cancelTxAction&&a?.pending&&a.tracker==="ethereum"),W=()=>{if(!I||!y?.retryTxAction)return;let K={adapter:l.adapter,type:l.type,desiredChainID:"desiredChainID"in l?l.desiredChainID:l.chainId,actionFunction:c?.actionFunction,title:l.title,description:l.description,payload:l.payload,withTrackedModal:true};y.retryTxAction({tx:K,txKey:a?.txKey??"",onClose:e,handleTransaction:i});},k=()=>{T&&a&&y.cancelTxAction(a);},B=()=>{T&&a&&y.speedUpTxAction(a);},G=s?.components?.Header,xt=s?.components?.Footer,gt=s?.components?.StatusVisual,Tt=s?.components?.ProgressIndicator,vt=s?.components?.InfoBlock,yt=s?.components?.ErrorBlock,Yt={initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2,ease:"easeOut"},...s?.motionProps};return l?jsxRuntime.jsx(C__namespace.Root,{open:d,onOpenChange:K=>!K&&e(a?.txKey),children:jsxRuntime.jsx(C__namespace.Portal,{children:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(C__namespace.Overlay,{asChild:true,children:jsxRuntime.jsx(framerMotion.motion.div,{className:"fixed inset-0 z-50 bg-black/60",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}})}),jsxRuntime.jsx(C__namespace.Content,{className:"fixed left-1/2 top-1/2 z-50 w-full max-w-md -translate-x-1/2 -translate-y-1/2 outline-none",...s?.modalProps,asChild:true,children:jsxRuntime.jsx(framerMotion.motion.div,{...Yt,children:jsxRuntime.jsxs("div",{className:novaCore.cn("relative flex max-h-[98dvh] w-full flex-col gap-3 overflow-y-auto rounded-2xl bg-[var(--tuwa-bg-primary)] p-5 pt-0 shadow-2xl",r),children:[G?jsxRuntime.jsx(G,{onClose:()=>e(a?.txKey),title:jsxRuntime.jsx(Dt,{tx:l})}):jsxRuntime.jsx(so,{onClose:()=>e(a?.txKey),title:jsxRuntime.jsx(Dt,{tx:l})}),jsxRuntime.jsxs("main",{className:"flex flex-col gap-3",children:[gt?jsxRuntime.jsx(gt,{isProcessing:v,isSucceed:x,isFailed:g,isReplaced:f}):jsxRuntime.jsx(Bt,{isProcessing:v,isSucceed:x,isFailed:g,isReplaced:f}),Tt?jsxRuntime.jsx(Tt,{isProcessing:v,isSucceed:x,isFailed:g,isReplaced:f}):jsxRuntime.jsx(St,{isProcessing:v,isSucceed:x,isFailed:g,isReplaced:f}),vt?jsxRuntime.jsx(vt,{tx:l,adapter:t}):jsxRuntime.jsx(kt,{tx:l,adapter:t}),yt?jsxRuntime.jsx(yt,{error:a?.errorMessage||c?.errorMessage}):jsxRuntime.jsx(It,{error:a?.errorMessage||c?.errorMessage})]}),xt?jsxRuntime.jsx(xt,{onClose:()=>e(a?.txKey),onOpenWalletInfo:o,isProcessing:v,isFailed:g,canReplace:T,onRetry:I?W:void 0,onSpeedUp:T?B:void 0,onCancel:T?k:void 0,connectedWalletAddress:p}):jsxRuntime.jsx(no,{onClose:()=>e(a?.txKey),onOpenWalletInfo:o,isProcessing:v,isFailed:g,canReplace:T,onRetry:I?W:void 0,onSpeedUp:T?B:void 0,onCancel:T?k:void 0,connectedWalletAddress:p})]})})})]})})})}):null}function Dt({tx:t}){return jsxRuntime.jsx(H,{txStatus:"status"in t?t.status:void 0,source:t.title,fallback:t.type,variant:"title",className:"text-lg"})}var so=({onClose:t,title:e})=>{let{actions:o}=m();return jsxRuntime.jsxs("header",{className:"sticky top-0 z-10 flex w-full items-start justify-between bg-[var(--tuwa-bg-primary)] pt-5 pb-2",children:[jsxRuntime.jsx(C__namespace.Title,{children:e}),jsxRuntime.jsx(C__namespace.Close,{asChild:true,children:jsxRuntime.jsx("button",{type:"button",onClick:()=>t(),"aria-label":o.close,className:"cursor-pointer -mt-1 ml-2 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"})})})]})},no=({onClose:t,onOpenWalletInfo:e,isProcessing:o,onRetry:r,onSpeedUp:s,onCancel:n,canReplace:i,isFailed:c,connectedWalletAddress:p})=>{let{trackingModal:a,actions:l}=m(),d=()=>c&&r?jsxRuntime.jsx("button",{type:"button",onClick:r,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:a.retry}):!o&&!i&&p?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:a.walletInfo}):null;return 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:i&&s&&n&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:s,className:"cursor-pointer text-sm font-medium text-[var(--tuwa-text-accent)] transition-opacity hover:opacity-80",children:l.speedUp}),jsxRuntime.jsx("button",{type:"button",onClick:n,className:"cursor-pointer text-sm font-medium text-[var(--tuwa-text-secondary)] transition-opacity hover:opacity-80",children:l.cancel})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(d,{}),jsxRuntime.jsx("button",{type:"button",onClick:t,disabled:o&&!i,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:o&&!i?a.processing:a.close})]})]})};Wt__default.default.extend(co__default.default);var po=({chainId:t})=>jsxRuntime.jsx("div",{className:"h-8 w-8 text-[var(--tuwa-text-secondary)]",children:typeof t=="string"?jsxRuntime.jsx(O,{chainId:t}):jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:t})}),uo=({timestamp:t})=>jsxRuntime.jsx("span",{className:"mb-1 block text-xs text-[var(--tuwa-text-secondary)]",children:t?Wt__default.default.unix(t).fromNow():"..."});function Kt({tx:t,adapter:e,className:o,customization:r}){let{Icon:s=po,Title:n=H,Description:i=H,Timestamp:c=uo,StatusBadge:p=q,TransactionKey:a=U}=r?.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)]",o),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(n,{txStatus:t.status,source:t.title,fallback:t.type,variant:"title",applyColor:true}),jsxRuntime.jsx(c,{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:e,variant:"history"})]})}function xo({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 Et({adapter:t,connectedWalletAddress:e,transactionsPool:o,className:r,customization:s}){let{walletModal:n}=m(),i=react.useMemo(()=>e?pulsarCore.selectAllTransactionsByActiveWallet(o,e).sort((d,v)=>(v.localTimestamp??0)-(d.localTimestamp??0)):[],[o,e]),{Placeholder:c=xo,HistoryItem:p=Kt}=s?.components??{},a=()=>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(l=>jsxRuntime.jsx(p,{tx:l,adapter:t},l.txKey))}):jsxRuntime.jsx(c,{title:n.history.noTransactionsTitle,message:n.history.noTransactionsMessage}):jsxRuntime.jsx(c,{title:n.history.connectWalletTitle,message:n.history.connectWalletMessage});return jsxRuntime.jsxs("div",{className:novaCore.cn("flex flex-col gap-y-3",r),children:[jsxRuntime.jsx("h3",{className:"text-lg font-bold text-[var(--tuwa-text-primary)]",children:n.history.title}),a()]})}var bo=t=>({replaced:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(solid.ArrowPathIcon,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.replaced})]}),loading:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(solid.ArrowPathIcon,{className:"h-4 w-4 animate-spin"}),jsxRuntime.jsx("span",{children:t.loading})]}),succeed:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(solid.CheckCircleIcon,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.succeed})]}),failed:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(solid.ExclamationCircleIcon,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.failed})]})});function yn({children:t,action:e,getLastTxKey:o,transactionsPool:r,walletAddress:s,loadingContent:n,succeedContent:i,failedContent:c,replacedContent:p,resetTimeout:a=2500,className:l,...d}){let{trackedTxButton:v}=m(),[x,g]=react.useState("idle"),[f,y]=react.useState(void 0),I=react.useMemo(()=>bo(v),[v]);react.useEffect(()=>{g("idle"),y(void 0);},[s]),react.useEffect(()=>{if(!f)return;let k=r[f];if(k)switch(k.status){case pulsarCore.TransactionStatus.Success:g("succeed");break;case pulsarCore.TransactionStatus.Replaced:g("replaced");break;case pulsarCore.TransactionStatus.Failed:g("failed");break}},[r,f,s]),react.useEffect(()=>{if(["succeed","failed","replaced"].includes(x)){let k=setTimeout(()=>{g("idle"),y(void 0);},a);return ()=>clearTimeout(k)}},[x,a]);let T=async()=>{g("loading");try{await e(),y(o());}catch(k){console.error("Transaction initiation failed:",k),g("failed");}},W=()=>{switch(x){case "loading":return n??I.loading;case "succeed":return i??I.succeed;case "failed":return c??I.failed;case "replaced":return p??I.replaced;default:return t}};return jsxRuntime.jsx("button",{...d,disabled:x!=="idle"||d.disabled,onClick:T,className:novaCore.cn("flex cursor-pointer items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-70",{"bg-gradient-to-r from-[var(--tuwa-button-gradient-from)] to-[var(--tuwa-button-gradient-to)] text-[var(--tuwa-text-on-accent)] hover:opacity-90":x==="idle","bg-gray-400 text-white":x==="loading","bg-gray-500 text-white":x==="replaced","bg-[var(--tuwa-success-bg)] text-[var(--tuwa-success-text)]":x==="succeed","bg-[var(--tuwa-error-bg)] text-[var(--tuwa-error-text)]":x==="failed"},l),children:W()})}function mt({address:t,explorerUrl:e,className:o}){let{isCopied:r,copy:s}=novaCore.useCopyToClipboard(),{actions:n,txError:i}=m();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:r?i.copied:n.copy,"aria-label":r?i.copied:`${n.copy} address`,onClick:()=>s(t),className:"cursor-pointer transition-colors hover:text-[var(--tuwa-text-primary)]",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"})}),e&&jsxRuntime.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"transition-colors hover:text-[var(--tuwa-text-accent)]",title:n.viewOnExplorer,"aria-label":n.viewOnExplorer,children:jsxRuntime.jsx(solid.ArrowTopRightOnSquareIcon,{className:"h-4 w-4"})})]})}function Ho(t,{strict:e=true}={}){return !t||typeof t!="string"?false:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}var Ro="0x0000000000000000000000000000000000000000";function Vt({address:t,ensAvatar:e,className:o}){let{walletModal:r}=m(),[s,n]=react.useState(e),i=react.useMemo(()=>Ao__default.default(Ho(t)?t:Ro),[t]),c=react.useMemo(()=>`#${t.slice(2,8)}`,[t]);react.useEffect(()=>{n(e);},[e]);let p=()=>{n(i);};return jsxRuntime.jsx("div",{className:novaCore.cn("h-12 w-12 flex-shrink-0 rounded-full",o),style:{backgroundColor:c},children:jsxRuntime.jsx("img",{className:"h-full w-full rounded-full object-cover",src:s||i,alt:`${r.header.avatarAlt} ${t}`,onError:p},e)})}var Ko=({isLoading:t,ensName:e,walletAddress:o,explorerUrl:r,renderAddressDisplay:s})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"mb-1.5 flex h-7 items-center",children:t?jsxRuntime.jsx("div",{className:"h-full w-48 animate-pulse rounded-md bg-[var(--tuwa-bg-muted)]"}):e?jsxRuntime.jsx("h2",{className:"text-xl font-bold text-[var(--tuwa-text-primary)]",children:e}):jsxRuntime.jsx(mt,{address:o,explorerUrl:r,className:"rounded-none bg-transparent px-0 py-0 text-xl font-bold text-[var(--tuwa-text-primary)]"})}),jsxRuntime.jsx("div",{className:"flex h-5 items-center",children:!t&&e&&(s?s({address:o,explorerUrl:r}):jsxRuntime.jsx(mt,{address:o,explorerUrl:r}))})]});function Gt({walletAddress:t,adapter:e,connectedAdapterType:o,className:r,renderAvatar:s,renderName:n,renderAddressDisplay:i,renderNoWalletContent:c,explorerUrl:p}){let{walletModal:a}=m(),[l,d]=react.useState(null),[v,x]=react.useState(null),[g,f]=react.useState(true);if(react.useEffect(()=>{(async()=>{if(!t||!o){f(false);return}let T=pulsarCore.selectAdapterByKey({adapterKey:o,adapter:e}),W=T&&"getName"in T&&typeof T.getName=="function",k=T&&"getAvatar"in T&&typeof T.getAvatar=="function";if(!W){f(false);return}f(true),d(null),x(null);try{let B=T?.getName?await T.getName(t):null;if(B&&(d(B),k)){let G=T?.getAvatar?await T.getAvatar(B):null;x(G);}}catch(B){console.error("Failed to fetch name service data:",B);}finally{f(false);}})();},[t,e,o]),!t)return c?jsxRuntime.jsx(jsxRuntime.Fragment,{children:c()}):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)]",r),children:a.header.notConnected});let y=l?l.length>30?novaCore.textCenterEllipsis(l,12,12):l:void 0;return jsxRuntime.jsxs("div",{className:novaCore.cn("flex min-h-[4rem] items-center gap-4",r),children:[jsxRuntime.jsx("div",{children:s?s({address:t,ensAvatar:v}):jsxRuntime.jsx(Vt,{address:t,ensAvatar:v})}),jsxRuntime.jsx("div",{className:"flex min-h-[3.5rem] min-w-[200px] flex-col justify-center",children:n?n({ensName:y,isLoading:g,address:t}):jsxRuntime.jsx(Ko,{isLoading:g,ensName:y,walletAddress:t,explorerUrl:p,renderAddressDisplay:i})})]})}var Vo=({closeModal:t,title:e})=>{let{actions:o}=m();return jsxRuntime.jsxs("div",{className:"sticky top-0 left-0 z-10 flex w-full items-center justify-between border-b border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-secondary)] p-4",children:[jsxRuntime.jsx(C__namespace.Title,{className:"text-lg font-bold text-[var(--tuwa-text-primary)]",children:e}),jsxRuntime.jsx(C__namespace.Close,{asChild:true,children:jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":o.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"})})})]})};function re({isOpen:t,setIsOpen:e,customization:o,adapter:r,connectedAdapterType:s,connectedWalletAddress:n,transactionsPool:i}){let{walletModal:c}=m(),{explorerUrl:p}=react.useMemo(()=>s?{explorerUrl:pulsarCore.selectAdapterByKey({adapterKey:s,adapter:r})?.getExplorerUrl(`/address/${n}`)}:{explorerUrl:void 0},[s,r,n]),a=()=>e(false),d={...{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2,ease:"easeOut"}},...o?.motionProps},v=o?.components?.Header,x=o?.components?.WalletInfo,g=o?.components?.History;return jsxRuntime.jsx(C__namespace.Root,{open:t,onOpenChange:f=>!f&&a(),children:jsxRuntime.jsx(C__namespace.Portal,{children:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(C__namespace.Overlay,{asChild:true,children:jsxRuntime.jsx(framerMotion.motion.div,{className:"fixed inset-0 z-50 bg-black/45",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15}})}),jsxRuntime.jsx(C__namespace.Content,{className:"fixed left-1/2 top-1/2 z-50 w-full max-w-2xl -translate-x-1/2 -translate-y-1/2 outline-none",...o?.modalProps,asChild:true,children:jsxRuntime.jsx(framerMotion.motion.div,{...d,children:jsxRuntime.jsxs("div",{className:novaCore.cn("relative max-h-[98dvh] w-full max-w-2xl overflow-y-auto rounded-2xl bg-[var(--tuwa-bg-secondary)] shadow-xl outline-none",o?.classNames?.contentWrapper),children:[v?jsxRuntime.jsx(v,{closeModal:a}):jsxRuntime.jsx(Vo,{closeModal:a,title:c.title}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-4 p-4 sm:gap-6 sm:p-6",children:[x?jsxRuntime.jsx(x,{adapter:r,connectedAdapterType:s,walletAddress:n,explorerUrl:p}):jsxRuntime.jsx(Gt,{adapter:r,connectedAdapterType:s,walletAddress:n,explorerUrl:p}),g?jsxRuntime.jsx(g,{adapter:r,transactionsPool:i,connectedWalletAddress:n}):jsxRuntime.jsx(Et,{adapter:r,transactionsPool:i,connectedWalletAddress:n})]})]})})})]})})})})}
12
+ exports.HashLink=_;exports.StatusAwareText=H;exports.ToastCloseButton=ee;exports.ToastTransaction=oe;exports.TrackingTxModal=ae;exports.TransactionHistoryItem=Kt;exports.TransactionKey=U;exports.TransactionStatusBadge=q;exports.TransactionsHistory=Et;exports.TxActionButton=yn;exports.TxErrorBlock=It;exports.TxInfoBlock=kt;exports.TxProgressIndicator=St;exports.TxStatusVisual=Bt;exports.WalletAddressDisplay=mt;exports.WalletAvatar=Vt;exports.WalletHeader=Gt;exports.WalletInfoModal=re;exports.defaultLabels=ot;//# sourceMappingURL=index.cjs.map
2
13
  //# sourceMappingURL=index.cjs.map