@tuwaio/nova-transactions 1.0.0-fix-integrate-orbit-alpha.2.172b680 → 1.0.0-fix-integrate-orbit-alpha.4.010ceeb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{WalletInfoModal-DQiw6rqS.d.cts → WalletInfoModal-BbL1VOb1.d.cts} +42 -44
- package/dist/{WalletInfoModal-DQiw6rqS.d.ts → WalletInfoModal-BbL1VOb1.d.ts} +42 -44
- package/dist/index.cjs +15 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +441 -103
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +15 -1
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.d.cts +4 -4
- package/dist/providers/index.d.ts +4 -4
- package/dist/providers/index.js +15 -1
- package/dist/providers/index.js.map +1 -1
- package/package.json +4 -4
@@ -1,10 +1,10 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import
|
2
|
+
import { DialogContent } from '@tuwaio/nova-core';
|
3
3
|
import { TransactionStatus, Transaction, TxAdapter, TransactionPool, ITxTrackingStore, InitialTransaction } from '@tuwaio/pulsar-core';
|
4
|
-
import { MotionProps } from 'framer-motion';
|
5
4
|
import { ReactNode, ComponentType, JSX, ComponentPropsWithoutRef } from 'react';
|
6
5
|
import { OrbitAdapter } from '@tuwaio/orbit-core';
|
7
6
|
import { ToastContainerProps, ToastContentProps } from 'react-toastify';
|
7
|
+
import { MotionProps } from 'framer-motion';
|
8
8
|
|
9
9
|
/**
|
10
10
|
* @file This file contains the `HashLink` component, a UI element for displaying
|
@@ -296,6 +296,45 @@ type ToastTransactionProps<T extends Transaction> = {
|
|
296
296
|
*/
|
297
297
|
declare function ToastTransaction<T extends Transaction>({ openWalletInfoModal, tx, icon, className, customization, connectedWalletAddress, adapter, }: ToastTransactionProps<T>): JSX.Element;
|
298
298
|
|
299
|
+
type CustomHeaderProps$1 = {
|
300
|
+
onClose: () => void;
|
301
|
+
title: ReactNode;
|
302
|
+
};
|
303
|
+
type CustomFooterProps = {
|
304
|
+
onClose: () => void;
|
305
|
+
onOpenWalletInfo: () => void;
|
306
|
+
onRetry?: () => void;
|
307
|
+
onSpeedUp?: () => void;
|
308
|
+
onCancel?: () => void;
|
309
|
+
isProcessing?: boolean;
|
310
|
+
isFailed?: boolean;
|
311
|
+
canReplace?: boolean;
|
312
|
+
connectedWalletAddress?: string;
|
313
|
+
};
|
314
|
+
type TrackingTxModalCustomization<T extends Transaction> = {
|
315
|
+
modalProps?: Partial<ComponentPropsWithoutRef<typeof DialogContent>>;
|
316
|
+
motionProps?: MotionProps;
|
317
|
+
components?: {
|
318
|
+
Header?: ComponentType<CustomHeaderProps$1>;
|
319
|
+
Footer?: ComponentType<CustomFooterProps>;
|
320
|
+
StatusVisual?: ComponentType<TxStatusVisualProps>;
|
321
|
+
ProgressIndicator?: ComponentType<TxProgressIndicatorProps>;
|
322
|
+
InfoBlock?: ComponentType<TxInfoBlockProps<T>>;
|
323
|
+
ErrorBlock?: ComponentType<TxErrorBlockProps>;
|
324
|
+
};
|
325
|
+
};
|
326
|
+
type TrackingTxModalProps<T extends Transaction> = Pick<NovaProviderProps<T>, 'executeTxAction' | 'initialTx' | 'transactionsPool' | 'adapter' | 'connectedWalletAddress'> & {
|
327
|
+
onClose: (txKey?: string) => void;
|
328
|
+
onOpenWalletInfo: () => void;
|
329
|
+
className?: string;
|
330
|
+
customization?: TrackingTxModalCustomization<T>;
|
331
|
+
};
|
332
|
+
/**
|
333
|
+
* A detailed modal that displays the real-time status and lifecycle of a transaction.
|
334
|
+
* It opens automatically for transactions initiated with `withTrackedModal: true`.
|
335
|
+
*/
|
336
|
+
declare function TrackingTxModal<T extends Transaction>({ adapter, onClose, onOpenWalletInfo, className, customization, transactionsPool, executeTxAction, initialTx, connectedWalletAddress, }: TrackingTxModalProps<T>): react_jsx_runtime.JSX.Element | null;
|
337
|
+
|
299
338
|
/**
|
300
339
|
* @file This file contains the `TxErrorBlock` component for displaying transaction error messages.
|
301
340
|
*/
|
@@ -373,45 +412,6 @@ type TxStatusVisualProps = {
|
|
373
412
|
*/
|
374
413
|
declare function TxStatusVisual({ isProcessing, isSucceed, isFailed, isReplaced }: TxStatusVisualProps): react_jsx_runtime.JSX.Element;
|
375
414
|
|
376
|
-
type CustomHeaderProps$1 = {
|
377
|
-
onClose: () => void;
|
378
|
-
title: ReactNode;
|
379
|
-
};
|
380
|
-
type CustomFooterProps = {
|
381
|
-
onClose: () => void;
|
382
|
-
onOpenWalletInfo: () => void;
|
383
|
-
onRetry?: () => void;
|
384
|
-
onSpeedUp?: () => void;
|
385
|
-
onCancel?: () => void;
|
386
|
-
isProcessing?: boolean;
|
387
|
-
isFailed?: boolean;
|
388
|
-
canReplace?: boolean;
|
389
|
-
connectedWalletAddress?: string;
|
390
|
-
};
|
391
|
-
type TrackingTxModalCustomization<T extends Transaction> = {
|
392
|
-
modalProps?: Partial<ComponentPropsWithoutRef<typeof Dialog.Content>>;
|
393
|
-
motionProps?: MotionProps;
|
394
|
-
components?: {
|
395
|
-
Header?: ComponentType<CustomHeaderProps$1>;
|
396
|
-
Footer?: ComponentType<CustomFooterProps>;
|
397
|
-
StatusVisual?: ComponentType<TxStatusVisualProps>;
|
398
|
-
ProgressIndicator?: ComponentType<TxProgressIndicatorProps>;
|
399
|
-
InfoBlock?: ComponentType<TxInfoBlockProps<T>>;
|
400
|
-
ErrorBlock?: ComponentType<TxErrorBlockProps>;
|
401
|
-
};
|
402
|
-
};
|
403
|
-
type TrackingTxModalProps<T extends Transaction> = Pick<NovaProviderProps<T>, 'executeTxAction' | 'initialTx' | 'transactionsPool' | 'adapter' | 'connectedWalletAddress'> & {
|
404
|
-
onClose: (txKey?: string) => void;
|
405
|
-
onOpenWalletInfo: () => void;
|
406
|
-
className?: string;
|
407
|
-
customization?: TrackingTxModalCustomization<T>;
|
408
|
-
};
|
409
|
-
/**
|
410
|
-
* A detailed modal that displays the real-time status and lifecycle of a transaction.
|
411
|
-
* It opens automatically for transactions initiated with `withTrackedModal: true`.
|
412
|
-
*/
|
413
|
-
declare function TrackingTxModal<T extends Transaction>({ adapter, onClose, onOpenWalletInfo, className, customization, transactionsPool, executeTxAction, initialTx, connectedWalletAddress, }: TrackingTxModalProps<T>): react_jsx_runtime.JSX.Element | null;
|
414
|
-
|
415
415
|
/**
|
416
416
|
* @file This file contains the `TransactionHistoryItem` component, which renders a single transaction
|
417
417
|
* in a list format for the transaction history view.
|
@@ -549,8 +549,7 @@ type CustomHeaderProps = {
|
|
549
549
|
* Defines the customization options for the WalletInfoModal.
|
550
550
|
*/
|
551
551
|
type WalletInfoModalCustomization<T extends Transaction> = {
|
552
|
-
modalProps?: Partial<ComponentPropsWithoutRef<typeof
|
553
|
-
motionProps?: MotionProps;
|
552
|
+
modalProps?: Partial<ComponentPropsWithoutRef<typeof DialogContent>>;
|
554
553
|
classNames?: {
|
555
554
|
contentWrapper?: string;
|
556
555
|
};
|
@@ -570,7 +569,6 @@ type WalletInfoModalProps<T extends Transaction> = Pick<NovaProviderProps<T>, 'a
|
|
570
569
|
};
|
571
570
|
/**
|
572
571
|
* The main modal component for displaying wallet information and transaction history.
|
573
|
-
* It is highly customizable and built with accessibility in mind using Radix UI.
|
574
572
|
*/
|
575
573
|
declare function WalletInfoModal<T extends Transaction>({ isOpen, setIsOpen, customization, adapter, connectedAdapterType, connectedWalletAddress, transactionsPool, }: WalletInfoModalProps<T>): react_jsx_runtime.JSX.Element;
|
576
574
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import
|
2
|
+
import { DialogContent } from '@tuwaio/nova-core';
|
3
3
|
import { TransactionStatus, Transaction, TxAdapter, TransactionPool, ITxTrackingStore, InitialTransaction } from '@tuwaio/pulsar-core';
|
4
|
-
import { MotionProps } from 'framer-motion';
|
5
4
|
import { ReactNode, ComponentType, JSX, ComponentPropsWithoutRef } from 'react';
|
6
5
|
import { OrbitAdapter } from '@tuwaio/orbit-core';
|
7
6
|
import { ToastContainerProps, ToastContentProps } from 'react-toastify';
|
7
|
+
import { MotionProps } from 'framer-motion';
|
8
8
|
|
9
9
|
/**
|
10
10
|
* @file This file contains the `HashLink` component, a UI element for displaying
|
@@ -296,6 +296,45 @@ type ToastTransactionProps<T extends Transaction> = {
|
|
296
296
|
*/
|
297
297
|
declare function ToastTransaction<T extends Transaction>({ openWalletInfoModal, tx, icon, className, customization, connectedWalletAddress, adapter, }: ToastTransactionProps<T>): JSX.Element;
|
298
298
|
|
299
|
+
type CustomHeaderProps$1 = {
|
300
|
+
onClose: () => void;
|
301
|
+
title: ReactNode;
|
302
|
+
};
|
303
|
+
type CustomFooterProps = {
|
304
|
+
onClose: () => void;
|
305
|
+
onOpenWalletInfo: () => void;
|
306
|
+
onRetry?: () => void;
|
307
|
+
onSpeedUp?: () => void;
|
308
|
+
onCancel?: () => void;
|
309
|
+
isProcessing?: boolean;
|
310
|
+
isFailed?: boolean;
|
311
|
+
canReplace?: boolean;
|
312
|
+
connectedWalletAddress?: string;
|
313
|
+
};
|
314
|
+
type TrackingTxModalCustomization<T extends Transaction> = {
|
315
|
+
modalProps?: Partial<ComponentPropsWithoutRef<typeof DialogContent>>;
|
316
|
+
motionProps?: MotionProps;
|
317
|
+
components?: {
|
318
|
+
Header?: ComponentType<CustomHeaderProps$1>;
|
319
|
+
Footer?: ComponentType<CustomFooterProps>;
|
320
|
+
StatusVisual?: ComponentType<TxStatusVisualProps>;
|
321
|
+
ProgressIndicator?: ComponentType<TxProgressIndicatorProps>;
|
322
|
+
InfoBlock?: ComponentType<TxInfoBlockProps<T>>;
|
323
|
+
ErrorBlock?: ComponentType<TxErrorBlockProps>;
|
324
|
+
};
|
325
|
+
};
|
326
|
+
type TrackingTxModalProps<T extends Transaction> = Pick<NovaProviderProps<T>, 'executeTxAction' | 'initialTx' | 'transactionsPool' | 'adapter' | 'connectedWalletAddress'> & {
|
327
|
+
onClose: (txKey?: string) => void;
|
328
|
+
onOpenWalletInfo: () => void;
|
329
|
+
className?: string;
|
330
|
+
customization?: TrackingTxModalCustomization<T>;
|
331
|
+
};
|
332
|
+
/**
|
333
|
+
* A detailed modal that displays the real-time status and lifecycle of a transaction.
|
334
|
+
* It opens automatically for transactions initiated with `withTrackedModal: true`.
|
335
|
+
*/
|
336
|
+
declare function TrackingTxModal<T extends Transaction>({ adapter, onClose, onOpenWalletInfo, className, customization, transactionsPool, executeTxAction, initialTx, connectedWalletAddress, }: TrackingTxModalProps<T>): react_jsx_runtime.JSX.Element | null;
|
337
|
+
|
299
338
|
/**
|
300
339
|
* @file This file contains the `TxErrorBlock` component for displaying transaction error messages.
|
301
340
|
*/
|
@@ -373,45 +412,6 @@ type TxStatusVisualProps = {
|
|
373
412
|
*/
|
374
413
|
declare function TxStatusVisual({ isProcessing, isSucceed, isFailed, isReplaced }: TxStatusVisualProps): react_jsx_runtime.JSX.Element;
|
375
414
|
|
376
|
-
type CustomHeaderProps$1 = {
|
377
|
-
onClose: () => void;
|
378
|
-
title: ReactNode;
|
379
|
-
};
|
380
|
-
type CustomFooterProps = {
|
381
|
-
onClose: () => void;
|
382
|
-
onOpenWalletInfo: () => void;
|
383
|
-
onRetry?: () => void;
|
384
|
-
onSpeedUp?: () => void;
|
385
|
-
onCancel?: () => void;
|
386
|
-
isProcessing?: boolean;
|
387
|
-
isFailed?: boolean;
|
388
|
-
canReplace?: boolean;
|
389
|
-
connectedWalletAddress?: string;
|
390
|
-
};
|
391
|
-
type TrackingTxModalCustomization<T extends Transaction> = {
|
392
|
-
modalProps?: Partial<ComponentPropsWithoutRef<typeof Dialog.Content>>;
|
393
|
-
motionProps?: MotionProps;
|
394
|
-
components?: {
|
395
|
-
Header?: ComponentType<CustomHeaderProps$1>;
|
396
|
-
Footer?: ComponentType<CustomFooterProps>;
|
397
|
-
StatusVisual?: ComponentType<TxStatusVisualProps>;
|
398
|
-
ProgressIndicator?: ComponentType<TxProgressIndicatorProps>;
|
399
|
-
InfoBlock?: ComponentType<TxInfoBlockProps<T>>;
|
400
|
-
ErrorBlock?: ComponentType<TxErrorBlockProps>;
|
401
|
-
};
|
402
|
-
};
|
403
|
-
type TrackingTxModalProps<T extends Transaction> = Pick<NovaProviderProps<T>, 'executeTxAction' | 'initialTx' | 'transactionsPool' | 'adapter' | 'connectedWalletAddress'> & {
|
404
|
-
onClose: (txKey?: string) => void;
|
405
|
-
onOpenWalletInfo: () => void;
|
406
|
-
className?: string;
|
407
|
-
customization?: TrackingTxModalCustomization<T>;
|
408
|
-
};
|
409
|
-
/**
|
410
|
-
* A detailed modal that displays the real-time status and lifecycle of a transaction.
|
411
|
-
* It opens automatically for transactions initiated with `withTrackedModal: true`.
|
412
|
-
*/
|
413
|
-
declare function TrackingTxModal<T extends Transaction>({ adapter, onClose, onOpenWalletInfo, className, customization, transactionsPool, executeTxAction, initialTx, connectedWalletAddress, }: TrackingTxModalProps<T>): react_jsx_runtime.JSX.Element | null;
|
414
|
-
|
415
415
|
/**
|
416
416
|
* @file This file contains the `TransactionHistoryItem` component, which renders a single transaction
|
417
417
|
* in a list format for the transaction history view.
|
@@ -549,8 +549,7 @@ type CustomHeaderProps = {
|
|
549
549
|
* Defines the customization options for the WalletInfoModal.
|
550
550
|
*/
|
551
551
|
type WalletInfoModalCustomization<T extends Transaction> = {
|
552
|
-
modalProps?: Partial<ComponentPropsWithoutRef<typeof
|
553
|
-
motionProps?: MotionProps;
|
552
|
+
modalProps?: Partial<ComponentPropsWithoutRef<typeof DialogContent>>;
|
554
553
|
classNames?: {
|
555
554
|
contentWrapper?: string;
|
556
555
|
};
|
@@ -570,7 +569,6 @@ type WalletInfoModalProps<T extends Transaction> = Pick<NovaProviderProps<T>, 'a
|
|
570
569
|
};
|
571
570
|
/**
|
572
571
|
* The main modal component for displaying wallet information and transaction history.
|
573
|
-
* It is highly customizable and built with accessibility in mind using Radix UI.
|
574
572
|
*/
|
575
573
|
declare function WalletInfoModal<T extends Transaction>({ isOpen, setIsOpen, customization, adapter, connectedAdapterType, connectedWalletAddress, transactionsPool, }: WalletInfoModalProps<T>): react_jsx_runtime.JSX.Element;
|
576
574
|
|
package/dist/index.cjs
CHANGED
@@ -1,2 +1,16 @@
|
|
1
|
-
'use strict';var solid=require('@heroicons/react/24/solid'),novaCore=require('@tuwaio/nova-core'),react=require('react'),jsxRuntime=require('react/jsx-runtime'),pulsarCore=require('@tuwaio/pulsar-core');require('react-toastify');var reactWeb3Icons=require('@bgd-labs/react-web3-icons'),utils=require('@bgd-labs/react-web3-icons/dist/utils'),orbitCore=require('@tuwaio/orbit-core'),h=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 h__namespace=/*#__PURE__*/_interopNamespace(h);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 ht({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,executeTxAction: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,executeTxAction: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(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,{...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(ht,{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(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"})})})]})},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(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 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(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(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=ht;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
|
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'),Mt=require('dayjs'),lo=require('dayjs/plugin/relativeTime'),So=require('ethereum-blockies-base64');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Mt__default=/*#__PURE__*/_interopDefault(Mt);var lo__default=/*#__PURE__*/_interopDefault(lo);var So__default=/*#__PURE__*/_interopDefault(So);var Y={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 Gt=react.createContext(Y);var u=()=>react.useContext(Gt);({[pulsarCore.TransactionStatus.Success]:"success",[pulsarCore.TransactionStatus.Failed]:"error",[pulsarCore.TransactionStatus.Replaced]:"info"});function U({label:t,hash:e,explorerUrl:o,variant:r="default",className:s}){let{isCopied:n,copy:l}=novaCore.useCopyToClipboard(),{actions:c,txError:p}=u(),a=novaCore.cn("flex items-center justify-between",{"text-sm":r==="default","text-xs":r==="compact"},s),i=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:i,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:()=>l(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 xt={[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 B({txStatus:t,source:e,fallback:o,variant:r,className:s,applyColor:n=false}){let l,c="";if(typeof e=="string")l=e;else if(Array.isArray(e)){let i=xt[t||"default"]??xt.default;l=e[i.index],n&&(c=i.colorClass);}else l=o;return l?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:l}):null}function Yt({closeToast:t}){let{actions:e}=u();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 W({tx:t,adapter:e,variant:o="toast",className:r,renderHashLink:s,confirmations:n}){let{hashLabels:l,statuses:c}=u(),p=orbitCore.selectAdapterByKey({adapterKey:t.adapter,adapter:e});if(!p)return null;let a=x=>s?s(x):jsxRuntime.jsx(U,{...x}),i=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=l[String(t.tracker)],g=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,f=(()=>{let x=t.hash,y=t.replacedTxHash;return !x&&!y?null:y?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[x&&a({label:l.original,hash:x,variant:"compact"}),typeof p.getExplorerTxUrl<"u"&&a({label:l.replaced,hash:y,explorerUrl:p.getExplorerTxUrl(t)})]}):x&&typeof p.getExplorerTxUrl<"u"&&a({label:l.default,hash:x,explorerUrl:p.getExplorerTxUrl(t)})})(),v=d&&d!==l.default&&t.txKey!==t.hash;return jsxRuntime.jsxs("div",{className:novaCore.cn(i,r),children:[v&&g,f,typeof n=="number"&&jsxRuntime.jsxs("p",{className:"text-xs text-[var(--tuwa-text-tertiary)]",children:[c.confirmationsLabel,": ",n]})]})}var xe=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}=u(),r=react.useMemo(()=>xe(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,l=n?r[n]:null;if(!l)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:i}=l;return jsxRuntime.jsxs("div",{className:novaCore.cn(s,a,e),children:[jsxRuntime.jsx(p,{className:novaCore.cn("h-4 w-4",i)}),c]})}var we=({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}),Ce=({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}),he=({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 qt({openWalletInfoModal:t,tx:e,icon:o,className:r,customization:s,connectedWalletAddress:n,adapter:l}){let{actions:c,toast:p}=u(),a=orbitCore.selectAdapterByKey({adapterKey:e.adapter,adapter:l}),i=!!(e.tracker==="ethereum"&&e.pending&&a?.speedUpTxAction&&a?.cancelTxAction&&e.from.toLowerCase()===n?.toLowerCase()),d=()=>{i&&a.cancelTxAction(e);},g=()=>{i&&a.speedUpTxAction(e);},{StatusAwareText:f=B,TransactionKey:v=W,StatusBadge:x=_,SpeedUpButton:y=we,CancelButton:P=Ce,WalletInfoButton:T=he}=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(f,{txStatus:e.status,source:e.title,fallback:e.type,variant:"title",applyColor:true}),jsxRuntime.jsx(f,{txStatus:e.status,source:e.description,variant:"description"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(v,{adapter:l,tx:e,variant:"toast"}),jsxRuntime.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[jsxRuntime.jsx(x,{tx:e}),i?jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(y,{onClick:g,children:c.speedUp}),jsxRuntime.jsx(P,{onClick:d,children:c.cancel})]}):t&&!!n&&jsxRuntime.jsx(T,{onClick:t,children:p.openWalletInfo})]})]})]})}function Qt({adapter:t,onClose:e,onOpenWalletInfo:o,className:r,customization:s,transactionsPool:n,executeTxAction:l,initialTx:c,connectedWalletAddress:p}){let a=react.useMemo(()=>c?.lastTxKey?n[c.lastTxKey]:void 0,[n,c]),i=a??c,d=c?.withTrackedModal&&!a||(a?.isTrackedModalOpen??false),{isProcessing:g,isSucceed:f,isFailed:v,isReplaced:x}=react.useMemo(()=>{let R=a?.status,_t=c?.isInitializing??false,$t=a?.pending??false;return {isProcessing:_t||$t,isSucceed:R===pulsarCore.TransactionStatus.Success,isFailed:a?.isError||!!c?.errorMessage,isReplaced:R===pulsarCore.TransactionStatus.Replaced}},[a,c]),y=react.useMemo(()=>i?orbitCore.selectAdapterByKey({adapterKey:i.adapter,adapter:t}):void 0,[i,t]),P=!!(v&&i&&c?.actionFunction&&l),T=!!(y?.speedUpTxAction&&y?.cancelTxAction&&a?.pending&&a.tracker==="ethereum"),L=()=>{if(!P||!y?.retryTxAction)return;let R={adapter:i.adapter,type:i.type,desiredChainID:"desiredChainID"in i?i.desiredChainID:i.chainId,actionFunction:c?.actionFunction,title:i.title,description:i.description,payload:i.payload,withTrackedModal:true};y.retryTxAction({tx:R,txKey:a?.txKey??"",onClose:e,executeTxAction:l});},N=()=>{T&&a&&y.cancelTxAction(a);},A=()=>{T&&a&&y.speedUpTxAction(a);},z=s?.components?.Header,ct=s?.components?.Footer,pt=s?.components?.StatusVisual,dt=s?.components?.ProgressIndicator,ut=s?.components?.InfoBlock,mt=s?.components?.ErrorBlock;return i?jsxRuntime.jsx(novaCore.Dialog,{open:d,onOpenChange:R=>!R&&e(a?.txKey),children:jsxRuntime.jsx(novaCore.DialogContent,{className:novaCore.cn("max-w-md",s?.modalProps?.className),...s?.modalProps,children:jsxRuntime.jsxs("div",{className:novaCore.cn("relative flex w-full flex-col",r),children:[z?jsxRuntime.jsx(z,{onClose:()=>e(a?.txKey),title:jsxRuntime.jsx(ht,{tx:i})}):jsxRuntime.jsx(Me,{onClose:()=>e(a?.txKey),title:jsxRuntime.jsx(ht,{tx:i})}),jsxRuntime.jsxs("main",{className:"flex flex-col gap-4 p-4",children:[pt?jsxRuntime.jsx(pt,{isProcessing:g,isSucceed:f,isFailed:v,isReplaced:x}):jsxRuntime.jsx(kt,{isProcessing:g,isSucceed:f,isFailed:v,isReplaced:x}),dt?jsxRuntime.jsx(dt,{isProcessing:g,isSucceed:f,isFailed:v,isReplaced:x}):jsxRuntime.jsx(It,{isProcessing:g,isSucceed:f,isFailed:v,isReplaced:x}),ut?jsxRuntime.jsx(ut,{tx:i,adapter:t}):jsxRuntime.jsx(Nt,{tx:i,adapter:t}),mt?jsxRuntime.jsx(mt,{error:a?.errorMessage||c?.errorMessage}):jsxRuntime.jsx(Pt,{error:a?.errorMessage||c?.errorMessage})]}),ct?jsxRuntime.jsx(ct,{onClose:()=>e(a?.txKey),onOpenWalletInfo:o,isProcessing:g,isFailed:v,canReplace:T,onRetry:P?L:void 0,onSpeedUp:T?A:void 0,onCancel:T?N:void 0,connectedWalletAddress:p}):jsxRuntime.jsx(He,{onClose:()=>e(a?.txKey),onOpenWalletInfo:o,isProcessing:g,isFailed:v,canReplace:T,onRetry:P?L:void 0,onSpeedUp:T?A:void 0,onCancel:T?N:void 0,connectedWalletAddress:p})]})})}):null}function ht({tx:t}){return jsxRuntime.jsx(B,{txStatus:"status"in t?t.status:void 0,source:t.title,fallback:t.type,variant:"title",className:"text-lg"})}var Me=({onClose:t,title:e})=>{let{actions:o}=u();return jsxRuntime.jsxs(novaCore.DialogHeader,{children:[jsxRuntime.jsx(novaCore.DialogTitle,{children:e}),jsxRuntime.jsx(novaCore.DialogClose,{asChild:true,children:jsxRuntime.jsx("button",{type:"button",onClick:()=>t(),"aria-label":o.close,className:`cursor-pointer rounded-full p-1
|
2
|
+
text-[var(--tuwa-text-tertiary)] transition-colors
|
3
|
+
hover:bg-[var(--tuwa-bg-muted)] hover:text-[var(--tuwa-text-primary)]`,children:jsxRuntime.jsx(novaCore.CloseIcon,{})})})]})},He=({onClose:t,onOpenWalletInfo:e,isProcessing:o,onRetry:r,onSpeedUp:s,onCancel:n,canReplace:l,isFailed:c,connectedWalletAddress:p})=>{let{trackingModal:a,actions:i}=u(),d=()=>c&&r?jsxRuntime.jsx("button",{type:"button",onClick:r,className:`cursor-pointer rounded-md
|
4
|
+
bg-gradient-to-r from-[var(--tuwa-button-gradient-from)] to-[var(--tuwa-button-gradient-to)]
|
5
|
+
px-4 py-2 text-sm font-semibold text-[var(--tuwa-text-on-accent)] transition-opacity
|
6
|
+
hover:from-[var(--tuwa-button-gradient-from-hover)] hover:to-[var(--tuwa-button-gradient-to-hover)]`,children:a.retry}):!o&&!l&&p?jsxRuntime.jsx("button",{type:"button",onClick:e,className:`cursor-pointer rounded-md
|
7
|
+
bg-[var(--tuwa-bg-muted)] px-4 py-2 text-sm font-semibold text-[var(--tuwa-text-primary)]
|
8
|
+
transition-colors hover:bg-[var(--tuwa-border-primary)]`,children:a.walletInfo}):null;return jsxRuntime.jsxs("footer",{className:`flex w-full items-center justify-between
|
9
|
+
border-t border-[var(--tuwa-border-primary)] p-4`,children:[jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:l&&s&&n&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:s,className:`cursor-pointer text-sm font-medium
|
10
|
+
text-[var(--tuwa-text-accent)] transition-opacity hover:opacity-80`,children:i.speedUp}),jsxRuntime.jsx("button",{type:"button",onClick:n,className:`cursor-pointer text-sm font-medium
|
11
|
+
text-[var(--tuwa-text-secondary)] transition-opacity hover:opacity-80`,children:i.cancel})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(d,{}),jsxRuntime.jsx("button",{type:"button",onClick:t,disabled:o&&!l,className:`cursor-pointer rounded-md bg-[var(--tuwa-bg-muted)] px-4 py-2 text-sm font-semibold
|
12
|
+
text-[var(--tuwa-text-primary)] transition-colors hover:bg-[var(--tuwa-border-primary)]
|
13
|
+
disabled:cursor-not-allowed disabled:opacity-50`,children:o&&!l?a.processing:a.close})]})]})};function Pt({error:t,className:e}){let{isCopied:o,copy:r}=novaCore.useCopyToClipboard(),{actions:s,txError:n}=u();return t?jsxRuntime.jsxs("div",{className:novaCore.cn("rounded-lg border border-[var(--tuwa-error-icon)]/30 bg-[var(--tuwa-error-bg)] p-3 text-sm",e),children:[jsxRuntime.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 font-bold text-[var(--tuwa-error-icon)]",children:[jsxRuntime.jsx(solid.ExclamationTriangleIcon,{className:"h-5 w-5"}),jsxRuntime.jsx("span",{children: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 $e({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:l}=u(),c=orbitCore.selectAdapterByKey({adapterKey:t.adapter,adapter:e});if(!c)return null;let{InfoRow:p=$e}=r?.components??{},a="chainId"in t?t.chainId:t.desiredChainID,i=t.adapter===orbitCore.OrbitAdapter.SOLANA,d=i?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:Mt__default.default.unix(t.localTimestamp).format("MMM D, HH:mm:ss")}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d?.slot&&jsxRuntime.jsx(p,{label:s.slot,value:jsxRuntime.jsx(U,{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:l.recentBlockhash,value:jsxRuntime.jsx(U,{hash:d.recentBlockhash})})]}),"txKey"in t&&t.txKey&&jsxRuntime.jsx("div",{className:"border-t border-[var(--tuwa-border-primary)] pt-3",children:jsxRuntime.jsx(W,{tx:t,adapter:e,variant:"history",renderHashLink:r?.components?.transactionKey})})]})}var Qe={completed:{line:"bg-[var(--tuwa-success-icon)]",border:"border-[var(--tuwa-success-icon)]",fill:"bg-[var(--tuwa-success-icon)]"},error:{line:"bg-[var(--tuwa-error-icon)]",border:"border-[var(--tuwa-error-icon)]",fill:"bg-[var(--tuwa-error-icon)]"},replaced:{line:"bg-[var(--tuwa-info-icon)]",border:"border-[var(--tuwa-info-icon)]",fill:"bg-[var(--tuwa-info-icon)]"},active:{line:"bg-[var(--tuwa-pending-icon)]",border:"border-[var(--tuwa-pending-icon)]",fill:"bg-transparent",pulse:"bg-[var(--tuwa-pending-icon)]"},inactive:{line:"bg-[var(--tuwa-border-primary)]",border:"border-[var(--tuwa-border-primary)]",fill:"bg-transparent"}};function Ze({status:t,label:e,isFirst:o=false}){let r=Qe[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=Ze}){let{trackingModal:l,statuses:c}=u(),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"},i=d=>d===1?l.progressIndicator.created:d===2?l.progressIndicator.processing:o?c.failed:r?c.replaced:l.progressIndicator.succeed;return [{status:a(1),label:i(1),isFirst:true},{status:a(2),label:i(2)},{status:a(3),label:i(3),isLast:true}]},[t,e,o,r,l,c]);return jsxRuntime.jsx("div",{className:novaCore.cn("flex w-full items-start px-4 pt-2 pb-1",s),children:p.map((a,i)=>jsxRuntime.jsx(n,{...a},i))})}var ro={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:l}=ro[s];return jsxRuntime.jsx("div",{className:"flex justify-center py-4",children:jsxRuntime.jsx(n,{className:novaCore.cn("h-16 w-16",l)})})}Mt__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?Mt__default.default.unix(t).fromNow():"..."});function Ht({tx:t,adapter:e,className:o,customization:r}){let{Icon:s=co,Title:n=B,Description:l=B,Timestamp:c=po,StatusBadge:p=_,TransactionKey:a=W}=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(l,{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 Lt({adapter:t,connectedWalletAddress:e,transactionsPool:o,className:r,customization:s}){let{walletModal:n}=u(),l=react.useMemo(()=>e?pulsarCore.selectAllTransactionsByActiveWallet(o,e).sort((d,g)=>(g.localTimestamp??0)-(d.localTimestamp??0)):[],[o,e]),{Placeholder:c=fo,HistoryItem:p=Ht}=s?.components??{},a=()=>e?l.length>0?jsxRuntime.jsx("div",{className:novaCore.cn("max-h-[400px] overflow-y-auto rounded-lg border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)]",s?.classNames?.listWrapper),children:l.map(i=>jsxRuntime.jsx(p,{tx:i,adapter:t},i.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 yo=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 nn({children:t,action:e,getLastTxKey:o,transactionsPool:r,walletAddress:s,loadingContent:n,succeedContent:l,failedContent:c,replacedContent:p,resetTimeout:a=2500,className:i,...d}){let{trackedTxButton:g}=u(),[f,v]=react.useState("idle"),[x,y]=react.useState(void 0),P=react.useMemo(()=>yo(g),[g]);react.useEffect(()=>{v("idle"),y(void 0);},[s]),react.useEffect(()=>{if(!x)return;let N=r[x];if(N)switch(N.status){case pulsarCore.TransactionStatus.Success:v("succeed");break;case pulsarCore.TransactionStatus.Replaced:v("replaced");break;case pulsarCore.TransactionStatus.Failed:v("failed");break}},[r,x,s]),react.useEffect(()=>{if(["succeed","failed","replaced"].includes(f)){let N=setTimeout(()=>{v("idle"),y(void 0);},a);return ()=>clearTimeout(N)}},[f,a]);let T=async()=>{v("loading");try{await e(),y(o());}catch(N){console.error("Transaction initiation failed:",N),v("failed");}},L=()=>{switch(f){case "loading":return n??P.loading;case "succeed":return l??P.succeed;case "failed":return c??P.failed;case "replaced":return p??P.replaced;default:return t}};return jsxRuntime.jsx("button",{...d,disabled:f!=="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":f==="idle","bg-gray-400 text-white":f==="loading","bg-gray-500 text-white":f==="replaced","bg-[var(--tuwa-success-bg)] text-[var(--tuwa-success-text)]":f==="succeed","bg-[var(--tuwa-error-bg)] text-[var(--tuwa-error-text)]":f==="failed"},i),children:L()})}function nt({address:t,explorerUrl:e,className:o}){let{isCopied:r,copy:s}=novaCore.useCopyToClipboard(),{actions:n,txError:l}=u();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?l.copied:n.copy,"aria-label":r?l.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 Mo(t,{strict:e=true}={}){return !t||typeof t!="string"?false:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}var Ho="0x0000000000000000000000000000000000000000";function Ot({address:t,ensAvatar:e,className:o}){let{walletModal:r}=u(),[s,n]=react.useState(e),l=react.useMemo(()=>So__default.default(Mo(t)?t:Ho),[t]),c=react.useMemo(()=>`#${t.slice(2,8)}`,[t]);react.useEffect(()=>{n(e);},[e]);let p=()=>{n(l);};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||l,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(nt,{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(nt,{address:o,explorerUrl:r}))})]});function Ft({walletAddress:t,adapter:e,connectedAdapterType:o,className:r,renderAvatar:s,renderName:n,renderAddressDisplay:l,renderNoWalletContent:c,explorerUrl:p}){let{walletModal:a}=u(),[i,d]=react.useState(null),[g,f]=react.useState(null),[v,x]=react.useState(true);if(react.useEffect(()=>{(async()=>{if(!t||!o){x(false);return}let T=orbitCore.selectAdapterByKey({adapterKey:o,adapter:e}),L=T&&"getName"in T&&typeof T.getName=="function",N=T&&"getAvatar"in T&&typeof T.getAvatar=="function";if(!L){x(false);return}x(true),d(null),f(null);try{let A=T?.getName?await T.getName(t):null;if(A&&(d(A),N)){let z=T?.getAvatar?await T.getAvatar(A):null;f(z);}}catch(A){console.error("Failed to fetch name service data:",A);}finally{x(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=i?i.length>30?novaCore.textCenterEllipsis(i,12,12):i: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:g}):jsxRuntime.jsx(Ot,{address:t,ensAvatar:g})}),jsxRuntime.jsx("div",{className:"flex min-h-[3.5rem] min-w-[200px] flex-col justify-center",children:n?n({ensName:y,isLoading:v,address:t}):jsxRuntime.jsx(Wo,{isLoading:v,ensName:y,walletAddress:t,explorerUrl:p,renderAddressDisplay:l})})]})}var Jo=({closeModal:t,title:e})=>{let{actions:o}=u();return jsxRuntime.jsxs(novaCore.DialogHeader,{children:[jsxRuntime.jsx(novaCore.DialogTitle,{children:e}),jsxRuntime.jsx(novaCore.DialogClose,{asChild:true,children:jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":o.close,className:`cursor-pointer rounded-full p-1
|
14
|
+
text-[var(--tuwa-text-tertiary)] transition-colors
|
15
|
+
hover:bg-[var(--tuwa-bg-muted)] hover:text-[var(--tuwa-text-primary)]`,children:jsxRuntime.jsx(novaCore.CloseIcon,{})})})]})};function Zt({isOpen:t,setIsOpen:e,customization:o,adapter:r,connectedAdapterType:s,connectedWalletAddress:n,transactionsPool:l}){let{walletModal:c}=u(),{explorerUrl:p}=react.useMemo(()=>s?{explorerUrl:orbitCore.selectAdapterByKey({adapterKey:s,adapter:r})?.getExplorerUrl(n?`/address/${n}`:"")}:{explorerUrl:void 0},[s,r,n]),a=()=>e(false),i=o?.components?.Header,d=o?.components?.WalletInfo,g=o?.components?.History;return jsxRuntime.jsx(novaCore.Dialog,{open:t,onOpenChange:f=>!f&&a(),children:jsxRuntime.jsx(novaCore.DialogContent,{className:novaCore.cn("max-w-2xl",o?.modalProps?.className),...o?.modalProps,children:jsxRuntime.jsxs("div",{className:novaCore.cn("relative max-h-[95dvh] w-full flex flex-col",o?.classNames?.contentWrapper),children:[i?jsxRuntime.jsx(i,{closeModal:a}):jsxRuntime.jsx(Jo,{closeModal:a,title:c.title}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-4 p-4 overflow-y-auto",children:[d?jsxRuntime.jsx(d,{adapter:r,connectedAdapterType:s,walletAddress:n,explorerUrl:p}):jsxRuntime.jsx(Ft,{adapter:r,connectedAdapterType:s,walletAddress:n,explorerUrl:p}),g?jsxRuntime.jsx(g,{adapter:r,transactionsPool:l,connectedWalletAddress:n}):jsxRuntime.jsx(Lt,{adapter:r,transactionsPool:l,connectedWalletAddress:n})]})]})})})}exports.HashLink=U;exports.StatusAwareText=B;exports.ToastCloseButton=Yt;exports.ToastTransaction=qt;exports.TrackingTxModal=Qt;exports.TransactionHistoryItem=Ht;exports.TransactionKey=W;exports.TransactionStatusBadge=_;exports.TransactionsHistory=Lt;exports.TxActionButton=nn;exports.TxErrorBlock=Pt;exports.TxInfoBlock=Nt;exports.TxProgressIndicator=It;exports.TxStatusVisual=kt;exports.WalletAddressDisplay=nt;exports.WalletAvatar=Ot;exports.WalletHeader=Ft;exports.WalletInfoModal=Zt;exports.defaultLabels=Y;//# sourceMappingURL=index.cjs.map
|
2
16
|
//# sourceMappingURL=index.cjs.map
|