@tuwaio/nova-transactions 1.0.0-fix-explorer-link-alpha.1.611ff3c → 1.0.0-fix-integrate-orbit-alpha.1.64ac306
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 +89 -58
- package/dist/{WalletInfoModal-BeE6SSek.d.cts → WalletInfoModal-CWCY7Pwm.d.cts} +4 -3
- package/dist/{WalletInfoModal-BeE6SSek.d.ts → WalletInfoModal-CWCY7Pwm.d.ts} +4 -3
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +1 -1
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.d.cts +3 -2
- package/dist/providers/index.d.ts +3 -2
- package/dist/providers/index.js +1 -1
- package/dist/providers/index.js.map +1 -1
- package/package.json +8 -16
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 `
|
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
|
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 @tuwaio/orbit-core
|
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 @tuwaio/orbit-core
|
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 @tuwaio/orbit-core
|
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 `
|
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 {
|
58
|
-
import {
|
59
|
-
import {
|
60
|
-
import {
|
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
|
-
|
128
|
+
import { config } from '@/configs/wagmiConfig';
|
73
129
|
|
74
|
-
|
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
|
-
|
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={
|
136
|
+
<WagmiProvider config={config}>
|
89
137
|
<QueryClientProvider client={queryClient}>
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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.
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
2
|
import * as Dialog from '@radix-ui/react-dialog';
|
3
|
-
import { TransactionStatus, Transaction, TxAdapter,
|
3
|
+
import { TransactionStatus, Transaction, TxAdapter, TransactionPool, ITxTrackingStore, InitialTransaction } from '@tuwaio/pulsar-core';
|
4
4
|
import { MotionProps } from 'framer-motion';
|
5
5
|
import { ReactNode, ComponentType, JSX, ComponentPropsWithoutRef } from 'react';
|
6
|
+
import { OrbitAdapter } from '@tuwaio/orbit-core';
|
6
7
|
import { ToastContainerProps, ToastContentProps } from 'react-toastify';
|
7
8
|
|
8
9
|
/**
|
@@ -198,7 +199,7 @@ type TuwaLabels = {
|
|
198
199
|
type NovaProviderProps<T extends Transaction> = {
|
199
200
|
adapter: TxAdapter<T> | TxAdapter<T>[];
|
200
201
|
connectedWalletAddress?: string;
|
201
|
-
connectedAdapterType?:
|
202
|
+
connectedAdapterType?: OrbitAdapter;
|
202
203
|
transactionsPool: TransactionPool<T>;
|
203
204
|
labels?: Partial<TuwaLabels>;
|
204
205
|
features?: {
|
@@ -417,7 +418,7 @@ declare function TrackingTxModal<T extends Transaction>({ adapter, onClose, onOp
|
|
417
418
|
*/
|
418
419
|
|
419
420
|
type CustomIconProps = {
|
420
|
-
chainId: number;
|
421
|
+
chainId: number | string;
|
421
422
|
};
|
422
423
|
type CustomTimestampProps = {
|
423
424
|
timestamp?: number;
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
2
|
import * as Dialog from '@radix-ui/react-dialog';
|
3
|
-
import { TransactionStatus, Transaction, TxAdapter,
|
3
|
+
import { TransactionStatus, Transaction, TxAdapter, TransactionPool, ITxTrackingStore, InitialTransaction } from '@tuwaio/pulsar-core';
|
4
4
|
import { MotionProps } from 'framer-motion';
|
5
5
|
import { ReactNode, ComponentType, JSX, ComponentPropsWithoutRef } from 'react';
|
6
|
+
import { OrbitAdapter } from '@tuwaio/orbit-core';
|
6
7
|
import { ToastContainerProps, ToastContentProps } from 'react-toastify';
|
7
8
|
|
8
9
|
/**
|
@@ -198,7 +199,7 @@ type TuwaLabels = {
|
|
198
199
|
type NovaProviderProps<T extends Transaction> = {
|
199
200
|
adapter: TxAdapter<T> | TxAdapter<T>[];
|
200
201
|
connectedWalletAddress?: string;
|
201
|
-
connectedAdapterType?:
|
202
|
+
connectedAdapterType?: OrbitAdapter;
|
202
203
|
transactionsPool: TransactionPool<T>;
|
203
204
|
labels?: Partial<TuwaLabels>;
|
204
205
|
features?: {
|
@@ -417,7 +418,7 @@ declare function TrackingTxModal<T extends Transaction>({ adapter, onClose, onOp
|
|
417
418
|
*/
|
418
419
|
|
419
420
|
type CustomIconProps = {
|
420
|
-
chainId: number;
|
421
|
+
chainId: number | string;
|
421
422
|
};
|
422
423
|
type CustomTimestampProps = {
|
423
424
|
timestamp?: number;
|
package/dist/index.cjs
CHANGED
@@ -1,2 +1,2 @@
|
|
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'),ko=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 ko__default=/*#__PURE__*/_interopDefault(ko);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:l,txError:p}=m(),a=novaCore.cn("flex items-center justify-between",{"text-sm":r==="default","text-xs":r==="compact"},s),c=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:c,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:l.viewOnExplorer,"aria-label":l.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:l.copy,"aria-label":n?p.copied:l.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,l="";if(typeof e=="string")i=e;else if(Array.isArray(e)){let c=vt[t||"default"]??vt.default;i=e[c.index],n&&(l=c.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)]",l,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:l}=m(),p=pulsarCore.selectAdapterByKey({adapterKey:t.adapter,adapter:e});if(!p)return null;let a=f=>s?s(f):jsxRuntime.jsx(z,{...f}),c=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(c,r),children:[T&&y,x,typeof n=="number"&&jsxRuntime.jsxs("p",{className:"text-xs text-[var(--tuwa-text-tertiary)]",children:[l.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 X({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:l,Icon:p,badgeClasses:a,iconClasses:c}=i;return jsxRuntime.jsxs("div",{className:novaCore.cn(s,a,e),children:[jsxRuntime.jsx(p,{className:novaCore.cn("h-4 w-4",c)}),l]})}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:l,toast:p}=m(),a=pulsarCore.selectAdapterByKey({adapterKey:e.adapter,adapter:i}),c=!!(e.tracker==="ethereum"&&e.pending&&a?.speedUpTxAction&&a?.cancelTxAction&&e.from.toLowerCase()===n?.toLowerCase()),d=()=>{c&&a.cancelTxAction(e);},y=()=>{c&&a.speedUpTxAction(e);},{StatusAwareText:x=R,TransactionKey:T=O,StatusBadge:f=X,SpeedUpButton:g=he,CancelButton:k=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}),c?jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(g,{onClick:y,children:l.speedUp}),jsxRuntime.jsx(k,{onClick:d,children:l.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 Ke({label:t,value:e}){return jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-[var(--tuwa-text-secondary)]",children:t}),jsxRuntime.jsx("span",{className:"font-medium text-[var(--tuwa-text-primary)]",children:e})]})}function ht({tx:t,adapter:e,className:o,customization:r}){let{txInfo:s,statuses:n,hashLabels:i}=m(),l=pulsarCore.selectAdapterByKey({adapterKey:t.adapter,adapter:e});if(!l)return null;let{InfoRow:p=Ke}=r?.components??{},a="chainId"in t?t.chainId:t.desiredChainID,c=t.adapter===pulsarCore.TransactionAdapter.SOLANA,d=c?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")}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d?.slot&&jsxRuntime.jsx(p,{label:s.slot,value:jsxRuntime.jsx(z,{hash:d.slot.toString(),explorerUrl:l?.getExplorerUrl?`${l?.getExplorerUrl(`/block/${d.slot}`)}`:void 0})}),typeof d?.confirmations=="number"&&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:l}=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"},c=d=>d===1?i.progressIndicator.created:d===2?i.progressIndicator.processing:o?l.failed:r?l.replaced:i.progressIndicator.succeed;return [{status:a(1),label:c(1),isFirst:true},{status:a(2),label:c(2)},{status:a(3),label:c(3),isLast:true}]},[t,e,o,r,i,l]);return jsxRuntime.jsx("div",{className:novaCore.cn("flex w-full items-start px-4 pt-2 pb-1",s),children:p.map((a,c)=>jsxRuntime.jsx(n,{...a},c))})}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 It({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:l,connectedWalletAddress:p}){let a=react.useMemo(()=>l?.lastTxKey?n[l.lastTxKey]:void 0,[n,l]),c=a??l,d=l?.withTrackedModal&&!a||(a?.isTrackedModalOpen??false),{isProcessing:y,isSucceed:x,isFailed:T,isReplaced:f}=react.useMemo(()=>{let K=a?.status,Xt=l?.isInitializing??false,Jt=a?.pending??false;return {isProcessing:Xt||Jt,isSucceed:K===pulsarCore.TransactionStatus.Success,isFailed:a?.isError||!!l?.errorMessage,isReplaced:K===pulsarCore.TransactionStatus.Replaced}},[a,l]),g=react.useMemo(()=>c?pulsarCore.selectAdapterByKey({adapterKey:c.adapter,adapter:t}):void 0,[c,t]),k=!!(T&&c&&l?.actionFunction&&i),v=!!(g?.speedUpTxAction&&g?.cancelTxAction&&a?.pending&&a.tracker==="ethereum"),W=()=>{if(!k||!g?.retryTxAction)return;let K={adapter:c.adapter,type:c.type,desiredChainID:"desiredChainID"in c?c.desiredChainID:c.chainId,actionFunction:l?.actionFunction,title:c.title,description:c.description,payload:c.payload,withTrackedModal:true};g.retryTxAction({tx:K,txKey:a?.txKey??"",onClose:e,handleTransaction:i});},I=()=>{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,$t={initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2,ease:"easeOut"},...s?.motionProps};return c?jsxRuntime.jsx(h__namespace.Root,{open:d,onOpenChange:K=>!K&&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,{...$t,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:c})}):jsxRuntime.jsx(eo,{onClose:()=>e(a?.txKey),title:jsxRuntime.jsx(Mt,{tx:c})}),jsxRuntime.jsxs("main",{className:"flex flex-col gap-3",children:[ut?jsxRuntime.jsx(ut,{isProcessing:y,isSucceed:x,isFailed:T,isReplaced:f}):jsxRuntime.jsx(It,{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:c,adapter:t}):jsxRuntime.jsx(ht,{tx:c,adapter:t}),xt?jsxRuntime.jsx(xt,{error:a?.errorMessage||l?.errorMessage}):jsxRuntime.jsx(Ct,{error:a?.errorMessage||l?.errorMessage})]}),dt?jsxRuntime.jsx(dt,{onClose:()=>e(a?.txKey),onOpenWalletInfo:o,isProcessing:y,isFailed:T,canReplace:v,onRetry:k?W:void 0,onSpeedUp:v?B:void 0,onCancel:v?I:void 0,connectedWalletAddress:p}):jsxRuntime.jsx(oo,{onClose:()=>e(a?.txKey),onOpenWalletInfo:o,isProcessing:y,isFailed:T,canReplace:v,onRetry:k?W:void 0,onSpeedUp:v?B:void 0,onCancel:v?I: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:l,connectedWalletAddress:p})=>{let{trackingModal:a,actions:c}=m(),d=()=>l&&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:c.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:c.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:l=io,StatusBadge:p=X,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(l,{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:l=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(c=>jsxRuntime.jsx(p,{tx:c,adapter:t},c.txKey))}):jsxRuntime.jsx(l,{title:n.history.noTransactionsTitle,message:n.history.noTransactionsMessage}):jsxRuntime.jsx(l,{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 dn({children:t,action:e,getLastTxKey:o,transactionsPool:r,walletAddress:s,loadingContent:n,succeedContent:i,failedContent:l,replacedContent:p,resetTimeout:a=2500,className:c,...d}){let{trackedTxButton:y}=m(),[x,T]=react.useState("idle"),[f,g]=react.useState(void 0),k=react.useMemo(()=>To(y),[y]);react.useEffect(()=>{T("idle"),g(void 0);},[s]),react.useEffect(()=>{if(!f)return;let I=r[f];if(I)switch(I.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 I=setTimeout(()=>{T("idle"),g(void 0);},a);return ()=>clearTimeout(I)}},[x,a]);let v=async()=>{T("loading");try{await e(),g(o());}catch(I){console.error("Transaction initiation failed:",I),T("failed");}},W=()=>{switch(x){case "loading":return n??k.loading;case "succeed":return i??k.succeed;case "failed":return l??k.failed;case "replaced":return p??k.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"},c),children:W()})}function ct({address:t,explorerUrl:e,className:o}){let{isCopied:r,copy:s}=novaCore.useCopyToClipboard(),{actions:n,txError:i}=m(),l=react.useMemo(()=>e&&t?`${e}/address/${t}`:void 0,[e,t]);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"})}),l&&jsxRuntime.jsx("a",{href:l,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(()=>ko__default.default(viem.isHex(t)?t:viem.zeroAddress),[t]),l=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:l},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 Ho=({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:l,explorerUrl:p}){let{walletModal:a}=m(),[c,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}),W=v&&"getName"in v&&typeof v.getName=="function",I=v&&"getAvatar"in v&&typeof v.getAvatar=="function";if(!W){f(false);return}f(true),d(null),x(null);try{let B=v?.getName?await v.getName(t):null;if(B&&(d(B),I)){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 l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:l()}):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=c?c.length>30?novaCore.textCenterEllipsis(c,12,12):c: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(Ho,{isLoading:T,ensName:g,walletAddress:t,explorerUrl:p,renderAddressDisplay:i})})]})}var Fo=({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:l}=m(),{explorerUrl:p}=react.useMemo(()=>s?{explorerUrl:pulsarCore.selectAdapterByKey({adapterKey:s,adapter:r})?.getExplorerUrl()}:{explorerUrl:void 0},[s,r]),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(Fo,{closeModal:a,title:l.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=X;exports.TransactionsHistory=Ht;exports.TxActionButton=dn;exports.TxErrorBlock=Ct;exports.TxInfoBlock=ht;exports.TxProgressIndicator=Pt;exports.TxStatusVisual=It;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'),orbitCore=require('@tuwaio/orbit-core'),C=require('@radix-ui/react-dialog'),framerMotion=require('framer-motion'),Ht=require('dayjs'),lo=require('dayjs/plugin/relativeTime'),So=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 Ht__default=/*#__PURE__*/_interopDefault(Ht);var lo__default=/*#__PURE__*/_interopDefault(lo);var So__default=/*#__PURE__*/_interopDefault(So);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 jt=react.createContext(j);var m=()=>react.useContext(jt);({[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 Zt({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=orbitCore.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 ge=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 X({tx:t,className:e}){let{statuses:o}=m(),r=react.useMemo(()=>ge(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 Ne=({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}),Ie=({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}),ke=({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 te({openWalletInfoModal:t,tx:e,icon:o,className:r,customization:s,connectedWalletAddress:n,adapter:i}){let{actions:c,toast:p}=m(),a=orbitCore.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=X,SpeedUpButton:g=Ne,CancelButton:I=Ie,WalletInfoButton:v=ke}=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(orbitCore.setChainId(e.chainId)),children:o??jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:orbitCore.setChainId(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 Oe({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 Nt({tx:t,adapter:e,className:o,customization:r}){let{txInfo:s,statuses:n,hashLabels:i}=m(),c=orbitCore.selectAdapterByKey({adapterKey:t.adapter,adapter:e});if(!c)return null;let{InfoRow:p=Oe}=r?.components??{},a="chainId"in t?t.chainId:t.desiredChainID,l=t.adapter===orbitCore.OrbitAdapter.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:orbitCore.setChainId(a)})}),jsxRuntime.jsx("span",{children:utils.getChainName(orbitCore.setChainId(a))})]})}),t.localTimestamp&&jsxRuntime.jsx(p,{label:s.started,value:Ht__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 $e={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 Xe({status:t,label:e,isFirst:o=false}){let r=$e[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 It({isProcessing:t,isSucceed:e,isFailed:o,isReplaced:r,className:s,StepComponent:n=Xe}){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 je={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 At({isProcessing:t,isSucceed:e,isFailed:o,isReplaced:r}){let s=e&&"succeed"||o&&"failed"||r&&"replaced"||t&&"processing"||"initializing",{Icon:n,className:i}=je[s];return jsxRuntime.jsx("div",{className:"flex justify-center py-4",children:jsxRuntime.jsx(n,{className:novaCore.cn("h-16 w-16",i)})})}function ee({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 K=a?.status,Gt=c?.isInitializing??false,Yt=a?.pending??false;return {isProcessing:Gt||Yt,isSucceed:K===pulsarCore.TransactionStatus.Success,isFailed:a?.isError||!!c?.errorMessage,isReplaced:K===pulsarCore.TransactionStatus.Replaced}},[a,c]),g=react.useMemo(()=>l?orbitCore.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"),W=()=>{if(!I||!g?.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};g.retryTxAction({tx:K,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,Jt={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,{...Jt,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(Rt,{tx:l})}):jsxRuntime.jsx(ao,{onClose:()=>e(a?.txKey),title:jsxRuntime.jsx(Rt,{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(At,{isProcessing:y,isSucceed:x,isFailed:T,isReplaced:f}),mt?jsxRuntime.jsx(mt,{isProcessing:y,isSucceed:x,isFailed:T,isReplaced:f}):jsxRuntime.jsx(It,{isProcessing:y,isSucceed:x,isFailed:T,isReplaced:f}),ft?jsxRuntime.jsx(ft,{tx:l,adapter:t}):jsxRuntime.jsx(Nt,{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?W:void 0,onSpeedUp:v?B:void 0,onCancel:v?k:void 0,connectedWalletAddress:p}):jsxRuntime.jsx(ro,{onClose:()=>e(a?.txKey),onOpenWalletInfo:o,isProcessing:y,isFailed:T,canReplace:v,onRetry:I?W:void 0,onSpeedUp:v?B:void 0,onCancel:v?k:void 0,connectedWalletAddress:p})]})})})]})})})}):null}function Rt({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 ao=({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"})})})]})},ro=({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})]})]})};Ht__default.default.extend(lo__default.default);var co=({chainId:t})=>jsxRuntime.jsx("div",{className:"h-8 w-8 text-[var(--tuwa-text-secondary)]",children:jsxRuntime.jsx(reactWeb3Icons.Web3Icon,{chainId:orbitCore.setChainId(t)})}),po=({timestamp:t})=>jsxRuntime.jsx("span",{className:"mb-1 block text-xs text-[var(--tuwa-text-secondary)]",children:t?Ht__default.default.unix(t).fromNow():"..."});function Dt({tx:t,adapter:e,className:o,customization:r}){let{Icon:s=co,Title:n=R,Description:i=R,Timestamp:c=po,StatusBadge:p=X,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 fo({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 Wt({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=fo,HistoryItem:p=Dt}=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 go=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 dn({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(()=>go(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");}},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: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:W()})}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 Bo(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 zt({address:t,ensAvatar:e,className:o}){let{walletModal:r}=m(),[s,n]=react.useState(e),i=react.useMemo(()=>So__default.default(Bo(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 Wo=({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 _t({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=orbitCore.selectAdapterByKey({adapterKey:o,adapter:e}),W=v&&"getName"in v&&typeof v.getName=="function",k=v&&"getAvatar"in v&&typeof v.getAvatar=="function";if(!W){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(zt,{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(Wo,{isLoading:T,ensName:g,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 oe({isOpen:t,setIsOpen:e,customization:o,adapter:r,connectedAdapterType:s,connectedWalletAddress:n,transactionsPool:i}){let{walletModal:c}=m(),{explorerUrl:p}=react.useMemo(()=>s?{explorerUrl:orbitCore.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(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:[y?jsxRuntime.jsx(y,{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(_t,{adapter:r,connectedAdapterType:s,walletAddress:n,explorerUrl:p}),T?jsxRuntime.jsx(T,{adapter:r,transactionsPool:i,connectedWalletAddress:n}):jsxRuntime.jsx(Wt,{adapter:r,transactionsPool:i,connectedWalletAddress:n})]})]})})})]})})})})}exports.HashLink=z;exports.StatusAwareText=R;exports.ToastCloseButton=Zt;exports.ToastTransaction=te;exports.TrackingTxModal=ee;exports.TransactionHistoryItem=Dt;exports.TransactionKey=O;exports.TransactionStatusBadge=X;exports.TransactionsHistory=Wt;exports.TxActionButton=dn;exports.TxErrorBlock=Ct;exports.TxInfoBlock=Nt;exports.TxProgressIndicator=It;exports.TxStatusVisual=At;exports.WalletAddressDisplay=ct;exports.WalletAvatar=zt;exports.WalletHeader=_t;exports.WalletInfoModal=oe;exports.defaultLabels=j;//# sourceMappingURL=index.cjs.map
|
2
2
|
//# sourceMappingURL=index.cjs.map
|