@0xsquid/ui 0.13.5 → 0.13.7
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/cjs/index.js +156 -123
- package/dist/cjs/types/components/icons/Arrow.d.ts +4 -0
- package/dist/cjs/types/components/icons/Clock.d.ts +4 -0
- package/dist/cjs/types/components/views/SwapProgressView.d.ts +8 -5
- package/dist/cjs/types/core/constants.d.ts +10 -0
- package/dist/cjs/types/core/utils.d.ts +1 -0
- package/dist/cjs/types/types/components.d.ts +11 -14
- package/dist/cjs/types/types/index.d.ts +1 -0
- package/dist/esm/index.js +156 -123
- package/dist/esm/types/components/icons/Arrow.d.ts +4 -0
- package/dist/esm/types/components/icons/Clock.d.ts +4 -0
- package/dist/esm/types/components/views/SwapProgressView.d.ts +8 -5
- package/dist/esm/types/core/constants.d.ts +10 -0
- package/dist/esm/types/core/utils.d.ts +1 -0
- package/dist/esm/types/types/components.d.ts +11 -14
- package/dist/esm/types/types/index.d.ts +1 -0
- package/dist/index.css +31 -73
- package/dist/index.d.ts +15 -16
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -2549,6 +2549,16 @@ function debounce(func, delay) {
|
|
|
2549
2549
|
};
|
|
2550
2550
|
return debounced;
|
|
2551
2551
|
}
|
|
2552
|
+
const formatTime = (elapsedTime) => {
|
|
2553
|
+
const totalSeconds = Math.floor(elapsedTime / 1000);
|
|
2554
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
2555
|
+
// Show only seconds if total time is less than 1 minute
|
|
2556
|
+
if (minutes === 0) {
|
|
2557
|
+
return `${totalSeconds}s`;
|
|
2558
|
+
}
|
|
2559
|
+
// Show only minutes if total time is 1 minute or more
|
|
2560
|
+
return `${minutes}m`;
|
|
2561
|
+
};
|
|
2552
2562
|
|
|
2553
2563
|
const badgeSizeClassMap = {
|
|
2554
2564
|
sm: 'tw-w-4 tw-h-4',
|
|
@@ -2663,9 +2673,9 @@ const roundedClassMap = {
|
|
|
2663
2673
|
lg: 'tw-rounded-squid-xxl',
|
|
2664
2674
|
};
|
|
2665
2675
|
const buttonVariantClassMap = {
|
|
2666
|
-
primary: 'tw-bg-royal-500 group-data-[squid-theme-type=light]:tw-text-grey-900 group-data-[squid-theme-type=dark]:tw-text-grey-100
|
|
2667
|
-
secondary: 'tw-bg-grey-100 tw-text-grey-800
|
|
2668
|
-
tertiary: 'tw-bg-grey-800 tw-text-grey-300
|
|
2676
|
+
primary: 'tw-bg-royal-500 group-data-[squid-theme-type=light]:tw-text-grey-900 group-data-[squid-theme-type=dark]:tw-text-grey-100',
|
|
2677
|
+
secondary: 'tw-bg-grey-100 tw-text-grey-800',
|
|
2678
|
+
tertiary: 'tw-bg-grey-800 tw-text-grey-300',
|
|
2669
2679
|
};
|
|
2670
2680
|
// right now all variants have the same disabled styles
|
|
2671
2681
|
// in the future, we can add more disabled styles for different variants
|
|
@@ -2679,7 +2689,7 @@ function Button(_a) {
|
|
|
2679
2689
|
icon) : (
|
|
2680
2690
|
// icon and label
|
|
2681
2691
|
jsxs(Fragment, { children: [icon, jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })] }));
|
|
2682
|
-
const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonVariantClassMap[variant], roundedClassMap[size],
|
|
2692
|
+
const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonVariantClassMap[variant], 'tw-border-material-light-thin', !disabled && 'hover:tw-border-material-light-average', roundedClassMap[size],
|
|
2683
2693
|
// disabled styles
|
|
2684
2694
|
disabled && buttonDisabledClass,
|
|
2685
2695
|
// custom classes from props
|
|
@@ -2719,15 +2729,15 @@ function ChevronRightSmallIcon() {
|
|
|
2719
2729
|
function ArrowLeftIcon({ className, size = '24', }) {
|
|
2720
2730
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: jsx("path", { d: "M10 6L4 12L10 18M5 12H20", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
2721
2731
|
}
|
|
2722
|
-
function ArrowRightUpCircleIcon() {
|
|
2723
|
-
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: jsx("path", { d: "M9 15L14.5 9.5M15 14V9H10M21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12Z", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
2724
|
-
}
|
|
2725
2732
|
function ChevronGrabberVerticalIcon({ size = '16', className, }) {
|
|
2726
2733
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsx("path", { d: "M5.33301 6.00002L7.52827 3.80476C7.78862 3.54441 8.21073 3.54441 8.47108 3.80476L10.6663 6.00002M5.33301 10L7.52827 12.1953C7.78862 12.4556 8.21073 12.4556 8.47108 12.1953L10.6663 10", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
2727
2734
|
}
|
|
2728
2735
|
function SquareArrowTopRight2Icon({ className, size = '16', }) {
|
|
2729
2736
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsx("path", { d: "M6.00033 2.66663H4.80033C4.05359 2.66663 3.68022 2.66663 3.395 2.81195C3.14412 2.93978 2.94015 3.14376 2.81232 3.39464C2.66699 3.67985 2.66699 4.05322 2.66699 4.79996L2.66699 11.2C2.66699 11.9467 2.66699 12.3201 2.81232 12.6053C2.94015 12.8562 3.14412 13.0601 3.395 13.188C3.68022 13.3333 4.05359 13.3333 4.80033 13.3333L11.2003 13.3333C11.9471 13.3333 12.3204 13.3333 12.6056 13.188C12.8565 13.0601 13.0605 12.8562 13.1883 12.6053C13.3337 12.3201 13.3337 11.9467 13.3337 11.2V9.99996M9.33366 2.66663L13.3337 2.66663M13.3337 2.66663V6.66663M13.3337 2.66663L7.33366 8.66663", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
2730
2737
|
}
|
|
2738
|
+
function ArrowsSwapIcon({ size = '24', className, }) {
|
|
2739
|
+
return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: [jsx("path", { d: "M14 4L20 9.99998H4", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), jsx("path", { d: "M10 20L4 14H20", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })] }));
|
|
2740
|
+
}
|
|
2731
2741
|
|
|
2732
2742
|
function ArrowButton(_a) {
|
|
2733
2743
|
var { label, disabled } = _a, props = __rest(_a, ["label", "disabled"]);
|
|
@@ -2839,16 +2849,26 @@ const CSS_VARS = {
|
|
|
2839
2849
|
SCALE_AND_FADE_UP_DURATION: '--squid-animation-scale-and-fade-up-duration',
|
|
2840
2850
|
SCALE_AND_FADE_DOWN_DURATION: '--squid-animation-scale-and-fade-down-duration',
|
|
2841
2851
|
TRANSLATE_TOP_OR_BOTTOM: '--squid-animation-translate-top-or-bottom',
|
|
2852
|
+
SHOW_MODAL_DURATION: '--squid-animation-show-modal-duration',
|
|
2853
|
+
HIDE_MODAL_DURATION: '--squid-animation-hide-modal-duration',
|
|
2854
|
+
SLIDE_TO_TOP_DURATION: '--squid-animation-slide-to-top-duration',
|
|
2855
|
+
SLIDE_TO_BOTTOM_DURATION: '--squid-animation-slide-to-bottom-duration',
|
|
2856
|
+
BLUR_IN_DURATION: '--squid-animation-blur-in-duration',
|
|
2857
|
+
BLUR_OUT_DURATION: '--squid-animation-blur-out-duration',
|
|
2842
2858
|
};
|
|
2843
2859
|
const ANIMATION_DURATIONS = {
|
|
2844
2860
|
SHOW_ROUTE: 300,
|
|
2845
2861
|
HIDE_ROUTE: 300,
|
|
2846
2862
|
CHANGE_SWAP_STEP: 300,
|
|
2863
|
+
SHOW_MODAL: 400,
|
|
2864
|
+
HIDE_MODAL: 400,
|
|
2847
2865
|
};
|
|
2848
2866
|
const ANIMATION_TIMINGS = {
|
|
2849
2867
|
EXPAND_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
2850
2868
|
COLLAPSE_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
2851
2869
|
CHANGE_SWAP_STEP: 'linear', //'cubic-bezier(.4,0,.2,1)',
|
|
2870
|
+
SHOW_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
|
|
2871
|
+
HIDE_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
|
|
2852
2872
|
};
|
|
2853
2873
|
|
|
2854
2874
|
function SearchIcon() {
|
|
@@ -3425,7 +3445,7 @@ function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = fals
|
|
|
3425
3445
|
.map((word, i) => (jsx(BodyText, { size: "small", className: "!tw-leading-[13px]", children: word }, i))));
|
|
3426
3446
|
}
|
|
3427
3447
|
else if (type === 'image') {
|
|
3428
|
-
return (jsx("img", { src: value, className: "tw-h-squid-m tw-w-squid-m tw-rounded-
|
|
3448
|
+
return (jsx("img", { src: value, className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs" }, index));
|
|
3429
3449
|
}
|
|
3430
3450
|
return null;
|
|
3431
3451
|
}) })] })] }));
|
|
@@ -3446,7 +3466,7 @@ function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, m
|
|
|
3446
3466
|
return setIsOpen(true);
|
|
3447
3467
|
const timeoutId = setTimeout(() => {
|
|
3448
3468
|
setIsOpen(false);
|
|
3449
|
-
},
|
|
3469
|
+
}, ANIMATION_DURATIONS.HIDE_MODAL);
|
|
3450
3470
|
return () => {
|
|
3451
3471
|
clearTimeout(timeoutId);
|
|
3452
3472
|
};
|
|
@@ -3459,7 +3479,13 @@ function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, m
|
|
|
3459
3479
|
onBackdropClick();
|
|
3460
3480
|
}
|
|
3461
3481
|
}
|
|
3462
|
-
: undefined,
|
|
3482
|
+
: undefined, style: {
|
|
3483
|
+
[CSS_VARS.BLUR_IN_DURATION]: `${ANIMATION_DURATIONS.SHOW_MODAL}ms`,
|
|
3484
|
+
[CSS_VARS.BLUR_OUT_DURATION]: `${ANIMATION_DURATIONS.HIDE_MODAL}ms`,
|
|
3485
|
+
}, className: cn('tw-absolute tw-inset-0 tw-z-40 tw-flex tw-items-start tw-justify-center tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m', _isOpen ? 'tw-animate-blur-in' : 'tw-animate-blur-out'), children: jsx("div", { style: {
|
|
3486
|
+
[CSS_VARS.SLIDE_TO_TOP_DURATION]: `${ANIMATION_DURATIONS.SHOW_MODAL}ms`,
|
|
3487
|
+
[CSS_VARS.SLIDE_TO_BOTTOM_DURATION]: `${ANIMATION_DURATIONS.HIDE_MODAL}ms`,
|
|
3488
|
+
}, className: cn('tw-relative tw-flex tw-max-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end', className, _isOpen ? 'tw-animate-slide-to-top' : 'tw-animate-slide-to-bottom', maxHeight && 'tw-h-full'), children: children }) })));
|
|
3463
3489
|
}
|
|
3464
3490
|
|
|
3465
3491
|
const borderTypeClassMap = {
|
|
@@ -3572,15 +3598,18 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, onOpen, on
|
|
|
3572
3598
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
3573
3599
|
}
|
|
3574
3600
|
};
|
|
3575
|
-
return (jsx("div", { className: "tw-relative tw-h-[60px] tw-w-[400px]", children: jsxs("div", { className: cn('tw-absolute tw-bottom-0 tw-z-
|
|
3601
|
+
return (jsx("div", { className: "tw-relative tw-h-[60px] tw-min-w-[400px] tw-rounded-squid-l", children: jsxs("div", { className: cn('tw-absolute tw-bottom-0 tw-z-10 tw-flex tw-w-full tw-max-w-[400px] tw-flex-col tw-justify-end tw-gap-squid-xxs tw-overflow-hidden tw-rounded-squid-l', isRouteVisible ? 'tw-h-[535px]' : 'tw-h-[60px]'), children: [!isRouteVisible && (jsxs(Fragment, { children: [jsx("span", { className: "tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-[21px] tw-w-full tw-bg-gradient-to-b tw-from-grey-800 tw-transition-colors group-hover/swap-step-item-button:tw-from-grey-700" }), jsx("span", { className: "tw-absolute tw-bottom-0 tw-left-0 tw-z-10 tw-h-[21px] tw-w-full tw-bg-gradient-to-t tw-from-grey-800 tw-transition-colors group-hover/swap-step-item-button:tw-from-grey-700" })] })), jsx("div", { style: {
|
|
3576
3602
|
[CSS_VARS.FADE_OUT_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
|
|
3577
3603
|
[CSS_VARS.FADE_IN_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
|
|
3578
|
-
}, className: cn('tw-absolute tw-top-0 tw-h-[
|
|
3604
|
+
}, className: cn('tw-absolute tw-top-0 tw-h-[535px] tw-w-full tw-rounded-squid-l tw-bg-material-dark-thick tw-opacity-0 tw-backdrop-blur/10') }), jsx("div", { style: {
|
|
3605
|
+
zIndex: 20,
|
|
3606
|
+
display: isRouteVisible ? 'none' : 'block',
|
|
3607
|
+
}, onClick: handleToggleRouteSteps, className: "tw-absolute tw-inset-0 tw-h-[60px] tw-cursor-pointer tw-rounded-squid-l tw-border tw-border-material-light-thin" }), jsx("div", { onClick: isShowRouteAnimationRunning ? undefined : handleToggleRouteSteps, style: {
|
|
3579
3608
|
[CSS_VARS.COLLAPSE_ROUTE_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
|
|
3580
3609
|
[CSS_VARS.EXPAND_ROUTE_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
|
|
3581
|
-
}, className: cn('tw-h-[60px] tw-max-h-[
|
|
3610
|
+
}, className: cn('tw-relative tw-h-[60px] tw-max-h-[535px] tw-w-full tw-overflow-hidden tw-rounded-squid-l tw-border tw-border-material-light-thin tw-bg-grey-800 tw-backdrop-blur-2xl', isShowRouteAnimationRunning
|
|
3582
3611
|
? 'tw-animate-expand-route'
|
|
3583
|
-
: 'tw-animate-collapse-route'), children: jsxs("div", { className: "tw-flex tw-flex-col tw-gap-squid-xxs", style: {
|
|
3612
|
+
: 'tw-animate-collapse-route'), children: jsxs("div", { className: "tw-flex tw-h-[535px] tw-flex-col tw-gap-squid-xxs", style: {
|
|
3584
3613
|
transition: isShowRouteAnimationRunning
|
|
3585
3614
|
? `transform ${ANIMATION_DURATIONS.SHOW_ROUTE}ms ${ANIMATION_TIMINGS.CHANGE_SWAP_STEP}`
|
|
3586
3615
|
: isRouteVisible
|
|
@@ -3588,12 +3617,15 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, onOpen, on
|
|
|
3588
3617
|
: `transform ${ANIMATION_DURATIONS.CHANGE_SWAP_STEP}ms ${ANIMATION_TIMINGS.CHANGE_SWAP_STEP}`,
|
|
3589
3618
|
transform: isShowRouteAnimationRunning
|
|
3590
3619
|
? 'translateY(0)'
|
|
3591
|
-
: `translateY(-${
|
|
3592
|
-
}, children: [jsx("div", { className: cn('tw-
|
|
3620
|
+
: `translateY(-${535 - 50 - (newStepIndex + 1) * 50 - 30}px)`,
|
|
3621
|
+
}, children: [jsx("div", { className: cn('tw-absolute tw-z-10 tw-flex tw-h-[52px] tw-w-full tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-bg-transparent tw-p-squid-xs'), children: jsx("button", { onClick: handleToggleRouteSteps, className: "tw-flex tw-h-squid-xl tw-w-40 tw-items-center tw-justify-center tw-rounded-squid-xs tw-px-10 hover:tw-bg-material-light-thin", children: jsx("span", { className: "tw-flex tw-h-8 tw-w-8 tw-items-center tw-justify-center tw-text-grey-300", children: jsx(ChevronLargeDownIcon, { size: "32" }) }) }) }), jsx("ul", { style: {
|
|
3622
|
+
zIndex: isRouteVisible ? 0 : -10,
|
|
3623
|
+
scrollbarWidth: 'none',
|
|
3624
|
+
}, className: "tw-relative tw-top-[52px] tw-flex tw-max-h-[413px] tw-w-[400px] tw-flex-1 tw-flex-col-reverse tw-items-center tw-self-stretch tw-overflow-y-auto tw-overflow-x-hidden tw-px-squid-xs tw-py-[15px]", children: steps.map((step, index) => (jsx(SwapStepItem, { descriptionBlocks: step.descriptionBlocks, chipContent: step.chipContent, showStepSeparator: !(index === steps.length - 1), link: step.link, status: newStepIndex < index
|
|
3593
3625
|
? 'pending'
|
|
3594
3626
|
: newStepIndex > index
|
|
3595
3627
|
? 'executed'
|
|
3596
|
-
: 'progress' }, index))) }), jsx("footer", { className: "tw-flex tw-items-end tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-s", children: jsx(Button, { size: "md", variant: "secondary", label: "View on Squidscan", className: "tw-w-full" }) })] }) })] }) }));
|
|
3628
|
+
: 'progress' }, index))) }), jsx("footer", { className: "tw-absolute tw-bottom-0 tw-flex tw-w-full tw-items-end tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-s", children: jsx(Button, { size: "md", variant: "secondary", label: "View on Squidscan", className: "tw-w-full" }) })] }) })] }) }));
|
|
3597
3629
|
}
|
|
3598
3630
|
|
|
3599
3631
|
function TokenPair({ firstToken, secondToken }) {
|
|
@@ -38480,14 +38512,6 @@ const transactionRejectedAnimation = TransactionRejectedAnimation;
|
|
|
38480
38512
|
const useTimer = ({ immediateStart = true, }) => {
|
|
38481
38513
|
const [timer, setTimer] = useState('0s');
|
|
38482
38514
|
const intervalRef = useRef(null);
|
|
38483
|
-
const formatTime = (elapsedTime) => {
|
|
38484
|
-
const totalSeconds = Math.floor(elapsedTime / 1000);
|
|
38485
|
-
const minutes = Math.floor(totalSeconds / 60);
|
|
38486
|
-
const seconds = totalSeconds % 60;
|
|
38487
|
-
const formattedMinutes = minutes > 0 ? `${minutes}m` : '';
|
|
38488
|
-
const formattedSeconds = seconds > 0 ? `${seconds}s` : '';
|
|
38489
|
-
return `${formattedMinutes}${formattedSeconds}`.trim();
|
|
38490
|
-
};
|
|
38491
38515
|
const startTimer = () => {
|
|
38492
38516
|
if (intervalRef.current !== null)
|
|
38493
38517
|
return; // Prevent multiple intervals
|
|
@@ -38514,26 +38538,34 @@ const useTimer = ({ immediateStart = true, }) => {
|
|
|
38514
38538
|
return { timer, stopTimer, startTimer };
|
|
38515
38539
|
};
|
|
38516
38540
|
|
|
38517
|
-
var
|
|
38518
|
-
(function (
|
|
38519
|
-
//
|
|
38520
|
-
|
|
38521
|
-
|
|
38522
|
-
|
|
38523
|
-
|
|
38524
|
-
|
|
38525
|
-
//
|
|
38526
|
-
|
|
38527
|
-
|
|
38528
|
-
|
|
38529
|
-
|
|
38530
|
-
|
|
38531
|
-
|
|
38541
|
+
var SwapState;
|
|
38542
|
+
(function (SwapState) {
|
|
38543
|
+
// user needs to sign the transaction in their wallet
|
|
38544
|
+
SwapState[SwapState["CONFIRM"] = 0] = "CONFIRM";
|
|
38545
|
+
// transaction is ongoing
|
|
38546
|
+
SwapState[SwapState["PROGRESS"] = 1] = "PROGRESS";
|
|
38547
|
+
// transaction is successful
|
|
38548
|
+
SwapState[SwapState["COMPLETED"] = 2] = "COMPLETED";
|
|
38549
|
+
// transaction failed
|
|
38550
|
+
SwapState[SwapState["ERROR"] = 3] = "ERROR";
|
|
38551
|
+
// transaction failed halfway and user received fallback tokens
|
|
38552
|
+
SwapState[SwapState["PARTIAL_SUCCESS"] = 4] = "PARTIAL_SUCCESS";
|
|
38553
|
+
// user hasn't signed the transaction in their wallet after some time
|
|
38554
|
+
SwapState[SwapState["CONFIRMATION_TOO_LONG"] = 5] = "CONFIRMATION_TOO_LONG";
|
|
38555
|
+
// user rejected the transaction in their wallet
|
|
38556
|
+
SwapState[SwapState["CONFIRMATION_REJECTED"] = 6] = "CONFIRMATION_REJECTED";
|
|
38557
|
+
// user needs to add gas to the transaction to complete its execution
|
|
38558
|
+
SwapState[SwapState["NEEDS_GAS"] = 7] = "NEEDS_GAS";
|
|
38559
|
+
})(SwapState || (SwapState = {}));
|
|
38532
38560
|
|
|
38533
38561
|
function ChainLink({ size = '16', strokeWidth = '2', }) {
|
|
38534
38562
|
return (jsx("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M6.66667 3.66667L7.16763 3.17225C8.73063 1.60925 11.2648 1.60925 12.8278 3.17225C14.3907 4.73525 14.3907 7.26937 12.8278 8.83237L12.3333 9.33333M3.66667 6.66667L3.17225 7.16763C1.60925 8.73063 1.60925 11.2648 3.17225 12.8278C4.73525 14.3907 7.26937 14.3907 8.83237 12.8278L9.33333 12.3333M6.66667 9.33333L9.33333 6.66667", stroke: "currentColor", strokeWidth: strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
38535
38563
|
}
|
|
38536
38564
|
|
|
38565
|
+
function TimeFliesIcon({ size = '24', className, }) {
|
|
38566
|
+
return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: [jsx("circle", { cx: "15", cy: "12", r: "7", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), jsx("path", { d: "M2 12H4M3 16H5M3 8H5", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), jsx("path", { d: "M15 9V12L16.5 13.5", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })] }));
|
|
38567
|
+
}
|
|
38568
|
+
|
|
38537
38569
|
function XSocial({ className, size = '24', }) {
|
|
38538
38570
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: jsx("path", { d: "M17.4033 3.5H20.2852L13.989 10.701L21.396 20.5H15.5964L11.054 14.557L5.85637 20.5H2.97269L9.70709 12.7977L2.60156 3.5H8.54839L12.6544 8.93215L17.4033 3.5ZM16.3918 18.7738H17.9887L7.68067 5.13549H5.96702L16.3918 18.7738Z", fill: "currentColor" }) }));
|
|
38539
38571
|
}
|
|
@@ -38581,68 +38613,79 @@ const AnimationWrapper = ({ lottieJsonFile, animReplacement, hideAnimations = fa
|
|
|
38581
38613
|
};
|
|
38582
38614
|
|
|
38583
38615
|
const swapProgressAnimations = {
|
|
38584
|
-
|
|
38585
|
-
|
|
38586
|
-
|
|
38587
|
-
|
|
38588
|
-
|
|
38589
|
-
|
|
38590
|
-
|
|
38591
|
-
|
|
38616
|
+
[SwapState.CONFIRM]: transactionPendingAnimation,
|
|
38617
|
+
[SwapState.ERROR]: transactionErrorPauseAnimation,
|
|
38618
|
+
[SwapState.PARTIAL_SUCCESS]: transactionHalfSuccessAnimation,
|
|
38619
|
+
[SwapState.PROGRESS]: transactionProcessinganimation,
|
|
38620
|
+
[SwapState.COMPLETED]: transactionSuccessAnimation,
|
|
38621
|
+
[SwapState.CONFIRMATION_TOO_LONG]: transactionPendingAnimation,
|
|
38622
|
+
[SwapState.CONFIRMATION_REJECTED]: transactionRejectedAnimation,
|
|
38623
|
+
[SwapState.NEEDS_GAS]: transactionErrorPauseAnimation,
|
|
38592
38624
|
};
|
|
38593
|
-
const
|
|
38594
|
-
|
|
38595
|
-
|
|
38596
|
-
|
|
38597
|
-
|
|
38598
|
-
|
|
38599
|
-
|
|
38600
|
-
|
|
38601
|
-
|
|
38602
|
-
|
|
38603
|
-
|
|
38625
|
+
const getSwapProgressTitle = ({ fromToken, toToken, swapState, }) => {
|
|
38626
|
+
switch (swapState) {
|
|
38627
|
+
case SwapState.CONFIRM:
|
|
38628
|
+
return 'Confirm swap';
|
|
38629
|
+
case SwapState.PROGRESS:
|
|
38630
|
+
return `Swap ${fromToken.symbol} to ${toToken.symbol}`;
|
|
38631
|
+
case SwapState.COMPLETED:
|
|
38632
|
+
return 'Swap complete';
|
|
38633
|
+
case SwapState.ERROR:
|
|
38634
|
+
return 'Swap failed';
|
|
38635
|
+
case SwapState.CONFIRMATION_TOO_LONG:
|
|
38636
|
+
return 'Confirmation taking too long';
|
|
38637
|
+
case SwapState.CONFIRMATION_REJECTED:
|
|
38638
|
+
return 'Swap rejected';
|
|
38639
|
+
case SwapState.PARTIAL_SUCCESS:
|
|
38640
|
+
return 'Swap failed halfway';
|
|
38641
|
+
case SwapState.NEEDS_GAS:
|
|
38642
|
+
return 'Needs gas on destination';
|
|
38643
|
+
}
|
|
38604
38644
|
};
|
|
38605
|
-
const getSwapProgressDescriptions = ({
|
|
38606
|
-
switch (
|
|
38607
|
-
case
|
|
38645
|
+
const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, }) => {
|
|
38646
|
+
switch (swapState) {
|
|
38647
|
+
case SwapState.CONFIRM: {
|
|
38608
38648
|
return 'Authenticate the transaction in your wallet.';
|
|
38609
38649
|
}
|
|
38610
|
-
case
|
|
38650
|
+
case SwapState.PROGRESS: {
|
|
38611
38651
|
return 'Feel free to dismiss this dialog, we’ll notify you when the swap is complete.';
|
|
38612
38652
|
}
|
|
38613
|
-
case
|
|
38653
|
+
case SwapState.COMPLETED: {
|
|
38614
38654
|
return `You received ${toAmount} ${toToken === null || toToken === void 0 ? void 0 : toToken.symbol} on ${toChain === null || toChain === void 0 ? void 0 : toChain.networkName}`;
|
|
38615
38655
|
}
|
|
38616
|
-
case
|
|
38656
|
+
case SwapState.ERROR: {
|
|
38617
38657
|
return 'Your tokens were safely returned to your wallet.';
|
|
38618
38658
|
}
|
|
38619
|
-
case
|
|
38659
|
+
case SwapState.CONFIRMATION_TOO_LONG: {
|
|
38620
38660
|
return 'Please go back and get a new quote.';
|
|
38621
38661
|
}
|
|
38622
|
-
case
|
|
38662
|
+
case SwapState.CONFIRMATION_REJECTED: {
|
|
38623
38663
|
return 'You declined the transaction in your wallet.';
|
|
38624
38664
|
}
|
|
38625
|
-
case
|
|
38665
|
+
case SwapState.PARTIAL_SUCCESS: {
|
|
38626
38666
|
return `You received a refund of axlUSDC on ${toChain === null || toChain === void 0 ? void 0 : toChain.networkName}`;
|
|
38627
38667
|
}
|
|
38628
|
-
case
|
|
38668
|
+
case SwapState.NEEDS_GAS: {
|
|
38629
38669
|
return 'Add gas to the transaction via Axelarscan to complete the swap';
|
|
38630
38670
|
}
|
|
38631
38671
|
}
|
|
38632
38672
|
};
|
|
38633
38673
|
const swapProgressButtonTexts = {
|
|
38634
|
-
|
|
38635
|
-
|
|
38636
|
-
|
|
38637
|
-
|
|
38638
|
-
|
|
38639
|
-
|
|
38640
|
-
|
|
38641
|
-
|
|
38674
|
+
[SwapState.CONFIRM]: 'Cancel',
|
|
38675
|
+
[SwapState.PROGRESS]: 'Ok, done',
|
|
38676
|
+
[SwapState.COMPLETED]: 'Ok, done',
|
|
38677
|
+
[SwapState.ERROR]: 'Ok, go back',
|
|
38678
|
+
[SwapState.CONFIRMATION_TOO_LONG]: 'Cancel',
|
|
38679
|
+
[SwapState.CONFIRMATION_REJECTED]: 'Ok, go back',
|
|
38680
|
+
[SwapState.PARTIAL_SUCCESS]: 'Ok, done',
|
|
38681
|
+
[SwapState.NEEDS_GAS]: 'Go to Axelarscan',
|
|
38642
38682
|
};
|
|
38643
|
-
function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted,
|
|
38683
|
+
function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }) {
|
|
38644
38684
|
const [showSwapInfoSection, setShowSwapInfoSection] = useState(true);
|
|
38645
38685
|
const isFirstRenderRef = useRef(true);
|
|
38686
|
+
const { timer, stopTimer, startTimer } = useTimer({
|
|
38687
|
+
immediateStart: false,
|
|
38688
|
+
});
|
|
38646
38689
|
const handleRouteStepsOpen = useCallback(() => {
|
|
38647
38690
|
if (isFirstRenderRef.current) {
|
|
38648
38691
|
isFirstRenderRef.current = false;
|
|
@@ -38655,28 +38698,23 @@ function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, suppo
|
|
|
38655
38698
|
}
|
|
38656
38699
|
setShowSwapInfoSection(true);
|
|
38657
38700
|
}, []);
|
|
38658
|
-
const
|
|
38659
|
-
|
|
38660
|
-
|
|
38661
|
-
|
|
38662
|
-
|
|
38663
|
-
|
|
38664
|
-
|
|
38665
|
-
|
|
38666
|
-
|
|
38667
|
-
|
|
38668
|
-
|
|
38669
|
-
|
|
38670
|
-
|
|
38671
|
-
|
|
38672
|
-
|
|
38673
|
-
|
|
38674
|
-
|
|
38675
|
-
case 'pending':
|
|
38676
|
-
default:
|
|
38677
|
-
return 'confirm';
|
|
38678
|
-
}
|
|
38679
|
-
}, [txStatus]);
|
|
38701
|
+
const { headerDescription, headerTitle } = useMemo(() => {
|
|
38702
|
+
const headerTitle = getSwapProgressTitle({
|
|
38703
|
+
swapState: swapState,
|
|
38704
|
+
fromToken,
|
|
38705
|
+
toToken,
|
|
38706
|
+
});
|
|
38707
|
+
const headerDescription = getSwapProgressDescriptions({
|
|
38708
|
+
swapState: swapState,
|
|
38709
|
+
toAmount,
|
|
38710
|
+
toChain,
|
|
38711
|
+
toToken,
|
|
38712
|
+
});
|
|
38713
|
+
return {
|
|
38714
|
+
headerTitle,
|
|
38715
|
+
headerDescription,
|
|
38716
|
+
};
|
|
38717
|
+
}, [swapState, fromToken, toToken, toAmount, toChain]);
|
|
38680
38718
|
return (jsxs(Modal, { isOpen: isOpen, onBackdropClick: handleClose, children: [jsxs(ModalContent, { style: {
|
|
38681
38719
|
[CSS_VARS.SCALE_AND_FADE_DOWN_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
|
|
38682
38720
|
[CSS_VARS.SCALE_AND_FADE_UP_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
|
|
@@ -38689,26 +38727,18 @@ function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, suppo
|
|
|
38689
38727
|
: 'tw-animate-scale-and-fade-down'), children: [jsx("div", { className: "tw-flex tw-h-[160px] tw-w-full tw-items-center tw-justify-center tw-rounded-tl-squid-l tw-rounded-tr-squid-l tw-bg-royal-500 tw-text-material-light-thin", style: {
|
|
38690
38728
|
// box shadow simulating bottom outline (we do not use css outline because cannot apply it to only one side)
|
|
38691
38729
|
boxShadow: '0 1px 0 currentColor',
|
|
38692
|
-
}, children: jsx("div", { children: jsx(AnimationWrapper, { lottieJsonFile: swapProgressAnimations[
|
|
38693
|
-
|
|
38730
|
+
}, children: jsx("div", { children: jsx(AnimationWrapper, { lottieJsonFile: swapProgressAnimations[swapState], hideAnimations: false, animReplacement: jsx(Loader, { size: "60" }) }) }) }), jsx("div", { className: "tw-relative tw-flex tw-h-squid-m tw-w-full tw-items-end tw-justify-between tw-self-stretch tw-px-squid-m", children: swapState === SwapState.COMPLETED ? (jsxs(Fragment, { children: [jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: jsx(CircleCheckIcon, {}) }), jsx(Button, { size: "md", variant: "secondary", icon: jsx(XSocial, {}), label: "Share", link: socialLink, title: "Share on X" })] })) : swapState === SwapState.ERROR ||
|
|
38731
|
+
swapState === SwapState.PARTIAL_SUCCESS ? (jsxs(Fragment, { children: [jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: jsx(EmojiSadFilledIcon, {}) }), jsx(Button, { size: "md", variant: "secondary", label: "Get help", link: supportLink, title: "Contact support" })] })) : (jsx(TokenPair, { firstToken: {
|
|
38694
38732
|
bgColor: fromToken.bgColor,
|
|
38695
38733
|
imageUrl: fromToken.logoUrl,
|
|
38696
38734
|
}, secondToken: {
|
|
38697
38735
|
bgColor: toToken.bgColor,
|
|
38698
38736
|
imageUrl: toToken.logoUrl,
|
|
38699
|
-
} })) }), jsx(SwapProgressViewHeader, { title:
|
|
38700
|
-
state: animationProgressState,
|
|
38701
|
-
toAmount,
|
|
38702
|
-
toChain,
|
|
38703
|
-
toToken,
|
|
38704
|
-
}) }), jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsx(SwapDetailListItem, { icon: jsx(ArrowRightUpCircleIcon, {}), label: `Swap ${fromToken === null || fromToken === void 0 ? void 0 : fromToken.symbol}`, detail: jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromToken.logoUrl }), animationProgressState === 'error' ? (jsx(CaptionText, { children: "0" })) : (fromAmount)] }) }), jsx(SwapDetailListItem, { icon: jsx("span", { className: "tw-inline-block tw-rotate-90", children: jsx(ArrowRightUpCircleIcon, {}) }), label: `Receive ${toToken === null || toToken === void 0 ? void 0 : toToken.symbol}`, detail: jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toToken.logoUrl }), animationProgressState === 'error' ? (jsx(CaptionText, { children: "0" })) : (toAmount)] }) }), jsx(SwapDetailListItem, { icon: jsx(ChainLink, { size: "24", strokeWidth: "1.5" }), label: "Chain", detail: jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromChain.logoUrl }), jsx(CaptionText, { children: fromChain.networkName }), jsx("span", { className: "tw-text-grey-500", children: jsx(ChevronLargeRightIcon, {}) }), jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toChain.logoUrl }), jsx(CaptionText, { children: toChain.networkName })] }) }), jsx(SwapDetailListItem, { icon: jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [jsx(CaptionText, { children: fromAddressFormatted }), jsx("span", { className: "tw-text-grey-500", children: jsx(ChevronLargeRightIcon, {}) }), jsx(CaptionText, { children: toAddressFormatted })] }) })] })] }), jsx(TrackTransactionView, { rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, txStatus: txStatus }), jsx(Button, { size: "lg", variant: "primary", label: swapProgressButtonTexts[animationProgressState], onClick: handleClose, className: "tw-min-h-button" })] }));
|
|
38737
|
+
} })) }), jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxs("ul", { className: "tw-flex tw-h-[195px] tw-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xxs tw-rounded-squid-l tw-py-squid-s", children: [jsx(SwapDetailListItem, { icon: jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsx(SwapDetailItemValues, { fromContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromToken.logoUrl }), jsx(CaptionText, { children: fromAmount })] }), toContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toToken.logoUrl }), jsx(CaptionText, { children: toAmount })] }) }) }), jsx(SwapDetailListItem, { icon: jsx(ChainLink, { size: "24", strokeWidth: "1.5" }), label: "Chain", detail: jsx(SwapDetailItemValues, { fromContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsx(CaptionText, { children: fromChain.networkName })] }), toContent: jsxs(Fragment, { children: [jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsx(SwapDetailListItem, { icon: jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsx(SwapDetailItemValues, { fromContent: fromAddressFormatted, toContent: toAddressFormatted }) }), jsx(SwapDetailListItem, { icon: jsx(TimeFliesIcon, {}), label: "Time to complete", detail: jsx(SwapDetailItemValues, { fromContent: timer, toContent: estimatedTimeToComplete }) })] })] }), jsx(TrackTransactionView, { onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState }), jsx(Button, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" })] }));
|
|
38705
38738
|
}
|
|
38706
|
-
const TrackTransactionView = ({
|
|
38707
|
-
const { timer, stopTimer, startTimer } = useTimer({
|
|
38708
|
-
immediateStart: false,
|
|
38709
|
-
});
|
|
38739
|
+
const TrackTransactionView = ({ swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, }) => {
|
|
38710
38740
|
const { currentStepIndex, steps } = useMemo(() => {
|
|
38711
|
-
if (rawSteps.every((s) => s.status ===
|
|
38741
|
+
if (rawSteps.every((s) => s.status === SwapState.COMPLETED)) {
|
|
38712
38742
|
return {
|
|
38713
38743
|
steps: rawSteps,
|
|
38714
38744
|
currentStepIndex: rawSteps.length - 1,
|
|
@@ -38717,9 +38747,9 @@ const TrackTransactionView = ({ txStatus, rawSteps, onOpen, onClose, }) => {
|
|
|
38717
38747
|
// TODO: Fix this
|
|
38718
38748
|
// Vercel build throws an error for findLastIndex, probably related to the Node version being used
|
|
38719
38749
|
// @ts-ignore
|
|
38720
|
-
const lastSuccessfulStepIndex = rawSteps.findLastIndex((s) => s.status ===
|
|
38721
|
-
if (
|
|
38722
|
-
|
|
38750
|
+
const lastSuccessfulStepIndex = rawSteps.findLastIndex((s) => s.status === SwapState.COMPLETED);
|
|
38751
|
+
if (swapState === SwapState.PROGRESS) {
|
|
38752
|
+
onTxStart();
|
|
38723
38753
|
const noSuccessfulStep = lastSuccessfulStepIndex < 0;
|
|
38724
38754
|
// If no successful step, but transaction is ongoing, this means user signed the tx in their wallet,
|
|
38725
38755
|
// so we show the second step, because the first step is "waiting for confirmation"
|
|
@@ -38727,13 +38757,13 @@ const TrackTransactionView = ({ txStatus, rawSteps, onOpen, onClose, }) => {
|
|
|
38727
38757
|
const currentOngoingStepIndex = noSuccessfulStep
|
|
38728
38758
|
? 1
|
|
38729
38759
|
: lastSuccessfulStepIndex + 1;
|
|
38730
|
-
// If current step is not the last one, show the
|
|
38760
|
+
// If current step is not the last one, show the loader
|
|
38731
38761
|
if (currentOngoingStepIndex < rawSteps.length) {
|
|
38732
|
-
// Show
|
|
38762
|
+
// Show loader in the current ongoing step
|
|
38733
38763
|
// @ts-ignore Vercel build error - TODO: Fix this
|
|
38734
|
-
const
|
|
38764
|
+
const stepsWithLoader = rawSteps.with(currentOngoingStepIndex, Object.assign(Object.assign({}, rawSteps[currentOngoingStepIndex]), { chipContent: jsx(Loader, { size: "16", strokeWidth: "2" }) }));
|
|
38735
38765
|
return {
|
|
38736
|
-
steps:
|
|
38766
|
+
steps: stepsWithLoader,
|
|
38737
38767
|
currentStepIndex: currentOngoingStepIndex,
|
|
38738
38768
|
};
|
|
38739
38769
|
}
|
|
@@ -38742,8 +38772,8 @@ const TrackTransactionView = ({ txStatus, rawSteps, onOpen, onClose, }) => {
|
|
|
38742
38772
|
currentStepIndex: rawSteps.length - 1,
|
|
38743
38773
|
};
|
|
38744
38774
|
}
|
|
38745
|
-
else if (
|
|
38746
|
-
|
|
38775
|
+
else if (swapState === SwapState.COMPLETED) {
|
|
38776
|
+
onTxEnd();
|
|
38747
38777
|
return {
|
|
38748
38778
|
steps: rawSteps,
|
|
38749
38779
|
currentStepIndex: rawSteps.length - 1,
|
|
@@ -38753,9 +38783,12 @@ const TrackTransactionView = ({ txStatus, rawSteps, onOpen, onClose, }) => {
|
|
|
38753
38783
|
steps: rawSteps,
|
|
38754
38784
|
currentStepIndex: 0,
|
|
38755
38785
|
};
|
|
38756
|
-
}, [
|
|
38786
|
+
}, [swapState, rawSteps]);
|
|
38757
38787
|
return rawSteps.length > 0 ? (jsx(SwapStepsCollapsed, { steps: steps, currentStepIndex: currentStepIndex, onClose: onClose, onOpen: onOpen })) : null;
|
|
38758
38788
|
};
|
|
38789
|
+
const SwapDetailItemValues = ({ fromContent, toContent, }) => {
|
|
38790
|
+
return (jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [typeof fromContent === 'string' ? (jsx(CaptionText, { children: fromContent })) : (fromContent), jsx("span", { className: "tw-text-grey-500", children: jsx(ChevronLargeRightIcon, {}) }), typeof toContent === 'string' ? (jsx(CaptionText, { children: toContent })) : (toContent)] }));
|
|
38791
|
+
};
|
|
38759
38792
|
|
|
38760
38793
|
const lightTheme = {
|
|
38761
38794
|
// content
|
|
@@ -41,3 +41,7 @@ export declare function ReorderIcon({ size, className, }: {
|
|
|
41
41
|
size?: string;
|
|
42
42
|
className?: string;
|
|
43
43
|
}): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export declare function ArrowsSwapIcon({ size, className, }: {
|
|
45
|
+
size?: string;
|
|
46
|
+
className?: string;
|
|
47
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,3 +14,7 @@ export declare const ExplosionIcon: ({ size, className, }: {
|
|
|
14
14
|
className?: string;
|
|
15
15
|
size?: string;
|
|
16
16
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function TimeFliesIcon({ size, className, }: {
|
|
18
|
+
size?: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SwapState, SwapStep } from '../../types/components';
|
|
2
2
|
type ChainData = {
|
|
3
3
|
networkName: string;
|
|
4
4
|
logoUrl: string;
|
|
@@ -9,7 +9,7 @@ type Token = {
|
|
|
9
9
|
logoUrl: string;
|
|
10
10
|
bgColor: string;
|
|
11
11
|
};
|
|
12
|
-
export declare function SwapProgressView({ steps, isOpen, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted,
|
|
12
|
+
export declare function SwapProgressView({ steps, isOpen, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }: {
|
|
13
13
|
steps: SwapStep[];
|
|
14
14
|
handleClose?: () => void;
|
|
15
15
|
isOpen?: boolean;
|
|
@@ -23,13 +23,16 @@ export declare function SwapProgressView({ steps, isOpen, handleClose, socialLin
|
|
|
23
23
|
toChain: ChainData;
|
|
24
24
|
fromAddressFormatted: string;
|
|
25
25
|
toAddressFormatted: string;
|
|
26
|
-
|
|
26
|
+
swapState: SwapState;
|
|
27
|
+
estimatedTimeToComplete?: string;
|
|
27
28
|
}): import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
interface Props {
|
|
29
30
|
rawSteps: SwapStep[];
|
|
30
|
-
|
|
31
|
+
swapState?: SwapState;
|
|
31
32
|
onOpen?: () => void;
|
|
32
33
|
onClose?: () => void;
|
|
34
|
+
onTxStart: () => void;
|
|
35
|
+
onTxEnd: () => void;
|
|
33
36
|
}
|
|
34
|
-
export declare const TrackTransactionView: ({
|
|
37
|
+
export declare const TrackTransactionView: ({ swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
35
38
|
export {};
|
|
@@ -8,14 +8,24 @@ export declare const CSS_VARS: {
|
|
|
8
8
|
SCALE_AND_FADE_UP_DURATION: string;
|
|
9
9
|
SCALE_AND_FADE_DOWN_DURATION: string;
|
|
10
10
|
TRANSLATE_TOP_OR_BOTTOM: string;
|
|
11
|
+
SHOW_MODAL_DURATION: string;
|
|
12
|
+
HIDE_MODAL_DURATION: string;
|
|
13
|
+
SLIDE_TO_TOP_DURATION: string;
|
|
14
|
+
SLIDE_TO_BOTTOM_DURATION: string;
|
|
15
|
+
BLUR_IN_DURATION: string;
|
|
16
|
+
BLUR_OUT_DURATION: string;
|
|
11
17
|
};
|
|
12
18
|
export declare const ANIMATION_DURATIONS: {
|
|
13
19
|
SHOW_ROUTE: number;
|
|
14
20
|
HIDE_ROUTE: number;
|
|
15
21
|
CHANGE_SWAP_STEP: number;
|
|
22
|
+
SHOW_MODAL: number;
|
|
23
|
+
HIDE_MODAL: number;
|
|
16
24
|
};
|
|
17
25
|
export declare const ANIMATION_TIMINGS: {
|
|
18
26
|
EXPAND_ROUTE: string;
|
|
19
27
|
COLLAPSE_ROUTE: string;
|
|
20
28
|
CHANGE_SWAP_STEP: string;
|
|
29
|
+
SHOW_ROUTE: string;
|
|
30
|
+
HIDE_ROUTE: string;
|
|
21
31
|
};
|
|
@@ -14,4 +14,5 @@ interface DebouncedFunction<F extends AnyFunction> {
|
|
|
14
14
|
cancel: () => void;
|
|
15
15
|
}
|
|
16
16
|
export declare function debounce<F extends AnyFunction>(func: F, delay: number): DebouncedFunction<F>;
|
|
17
|
+
export declare const formatTime: (elapsedTime: number) => string;
|
|
17
18
|
export {};
|
|
@@ -13,21 +13,18 @@ export type SwapStep = {
|
|
|
13
13
|
descriptionBlocks: SwapStepDescriptionBlock[];
|
|
14
14
|
chipContent: React.ReactNode;
|
|
15
15
|
link?: string;
|
|
16
|
-
status:
|
|
16
|
+
status: SwapState;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export declare enum SwapState {
|
|
19
|
+
CONFIRM = 0,
|
|
20
|
+
PROGRESS = 1,
|
|
21
|
+
COMPLETED = 2,
|
|
22
|
+
ERROR = 3,
|
|
23
|
+
PARTIAL_SUCCESS = 4,
|
|
24
|
+
CONFIRMATION_TOO_LONG = 5,
|
|
25
|
+
CONFIRMATION_REJECTED = 6,
|
|
26
|
+
NEEDS_GAS = 7
|
|
27
|
+
}
|
|
19
28
|
export type DetailsToolbarState = 'full' | 'loading' | 'empty' | 'error';
|
|
20
29
|
export type ThemeType = 'light' | 'dark';
|
|
21
30
|
export type SwapStepItemStatus = 'executed' | 'progress' | 'pending';
|
|
22
|
-
export declare enum TransactionStatus {
|
|
23
|
-
SUCCESS = "success",
|
|
24
|
-
NEEDS_GAS = "needs_gas",
|
|
25
|
-
ONGOING = "ongoing",
|
|
26
|
-
PARTIAL_SUCCESS = "partial_success",
|
|
27
|
-
NOT_FOUND = "not_found",
|
|
28
|
-
INITIAL_LOADING = "initialLoading",
|
|
29
|
-
ERROR = "error",
|
|
30
|
-
WARNING = "warning",
|
|
31
|
-
PENDING = "pending",
|
|
32
|
-
REJECTED = "rejected"
|
|
33
|
-
}
|