@0xsquid/ui 0.13.6 → 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 +140 -114
- 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 +140 -114
- 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 +10 -29
- package/dist/index.d.ts +15 -16
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2569,6 +2569,16 @@ function debounce(func, delay) {
|
|
|
2569
2569
|
};
|
|
2570
2570
|
return debounced;
|
|
2571
2571
|
}
|
|
2572
|
+
const formatTime = (elapsedTime) => {
|
|
2573
|
+
const totalSeconds = Math.floor(elapsedTime / 1000);
|
|
2574
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
2575
|
+
// Show only seconds if total time is less than 1 minute
|
|
2576
|
+
if (minutes === 0) {
|
|
2577
|
+
return `${totalSeconds}s`;
|
|
2578
|
+
}
|
|
2579
|
+
// Show only minutes if total time is 1 minute or more
|
|
2580
|
+
return `${minutes}m`;
|
|
2581
|
+
};
|
|
2572
2582
|
|
|
2573
2583
|
const badgeSizeClassMap = {
|
|
2574
2584
|
sm: 'tw-w-4 tw-h-4',
|
|
@@ -2682,7 +2692,6 @@ const roundedClassMap = {
|
|
|
2682
2692
|
md: 'tw-rounded-squid-m',
|
|
2683
2693
|
lg: 'tw-rounded-squid-xxl',
|
|
2684
2694
|
};
|
|
2685
|
-
const buttonBorderClassName = 'tw-border-material-light-thin hover:tw-border-material-light-average';
|
|
2686
2695
|
const buttonVariantClassMap = {
|
|
2687
2696
|
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',
|
|
2688
2697
|
secondary: 'tw-bg-grey-100 tw-text-grey-800',
|
|
@@ -2700,7 +2709,7 @@ function Button(_a) {
|
|
|
2700
2709
|
icon) : (
|
|
2701
2710
|
// icon and label
|
|
2702
2711
|
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon, jsxRuntime.jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })] }));
|
|
2703
|
-
const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonVariantClassMap[variant],
|
|
2712
|
+
const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonVariantClassMap[variant], 'tw-border-material-light-thin', !disabled && 'hover:tw-border-material-light-average', roundedClassMap[size],
|
|
2704
2713
|
// disabled styles
|
|
2705
2714
|
disabled && buttonDisabledClass,
|
|
2706
2715
|
// custom classes from props
|
|
@@ -2740,15 +2749,15 @@ function ChevronRightSmallIcon() {
|
|
|
2740
2749
|
function ArrowLeftIcon({ className, size = '24', }) {
|
|
2741
2750
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: jsxRuntime.jsx("path", { d: "M10 6L4 12L10 18M5 12H20", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
2742
2751
|
}
|
|
2743
|
-
function ArrowRightUpCircleIcon() {
|
|
2744
|
-
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: jsxRuntime.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" }) }));
|
|
2745
|
-
}
|
|
2746
2752
|
function ChevronGrabberVerticalIcon({ size = '16', className, }) {
|
|
2747
2753
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsxRuntime.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" }) }));
|
|
2748
2754
|
}
|
|
2749
2755
|
function SquareArrowTopRight2Icon({ className, size = '16', }) {
|
|
2750
2756
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsxRuntime.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" }) }));
|
|
2751
2757
|
}
|
|
2758
|
+
function ArrowsSwapIcon({ size = '24', className, }) {
|
|
2759
|
+
return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: [jsxRuntime.jsx("path", { d: "M14 4L20 9.99998H4", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), jsxRuntime.jsx("path", { d: "M10 20L4 14H20", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })] }));
|
|
2760
|
+
}
|
|
2752
2761
|
|
|
2753
2762
|
function ArrowButton(_a) {
|
|
2754
2763
|
var { label, disabled } = _a, props = __rest(_a, ["label", "disabled"]);
|
|
@@ -2860,16 +2869,26 @@ const CSS_VARS = {
|
|
|
2860
2869
|
SCALE_AND_FADE_UP_DURATION: '--squid-animation-scale-and-fade-up-duration',
|
|
2861
2870
|
SCALE_AND_FADE_DOWN_DURATION: '--squid-animation-scale-and-fade-down-duration',
|
|
2862
2871
|
TRANSLATE_TOP_OR_BOTTOM: '--squid-animation-translate-top-or-bottom',
|
|
2872
|
+
SHOW_MODAL_DURATION: '--squid-animation-show-modal-duration',
|
|
2873
|
+
HIDE_MODAL_DURATION: '--squid-animation-hide-modal-duration',
|
|
2874
|
+
SLIDE_TO_TOP_DURATION: '--squid-animation-slide-to-top-duration',
|
|
2875
|
+
SLIDE_TO_BOTTOM_DURATION: '--squid-animation-slide-to-bottom-duration',
|
|
2876
|
+
BLUR_IN_DURATION: '--squid-animation-blur-in-duration',
|
|
2877
|
+
BLUR_OUT_DURATION: '--squid-animation-blur-out-duration',
|
|
2863
2878
|
};
|
|
2864
2879
|
const ANIMATION_DURATIONS = {
|
|
2865
2880
|
SHOW_ROUTE: 300,
|
|
2866
2881
|
HIDE_ROUTE: 300,
|
|
2867
2882
|
CHANGE_SWAP_STEP: 300,
|
|
2883
|
+
SHOW_MODAL: 400,
|
|
2884
|
+
HIDE_MODAL: 400,
|
|
2868
2885
|
};
|
|
2869
2886
|
const ANIMATION_TIMINGS = {
|
|
2870
2887
|
EXPAND_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
2871
2888
|
COLLAPSE_ROUTE: 'linear', //'cubic-bezier(.32, .72, 0, 1)',
|
|
2872
2889
|
CHANGE_SWAP_STEP: 'linear', //'cubic-bezier(.4,0,.2,1)',
|
|
2890
|
+
SHOW_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
|
|
2891
|
+
HIDE_ROUTE: 'cubic-bezier(.165,.84,.44,1)',
|
|
2873
2892
|
};
|
|
2874
2893
|
|
|
2875
2894
|
function SearchIcon() {
|
|
@@ -3446,7 +3465,7 @@ function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = fals
|
|
|
3446
3465
|
.map((word, i) => (jsxRuntime.jsx(BodyText, { size: "small", className: "!tw-leading-[13px]", children: word }, i))));
|
|
3447
3466
|
}
|
|
3448
3467
|
else if (type === 'image') {
|
|
3449
|
-
return (jsxRuntime.jsx("img", { src: value, className: "tw-h-squid-m tw-w-squid-m tw-rounded-
|
|
3468
|
+
return (jsxRuntime.jsx("img", { src: value, className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs" }, index));
|
|
3450
3469
|
}
|
|
3451
3470
|
return null;
|
|
3452
3471
|
}) })] })] }));
|
|
@@ -3467,7 +3486,7 @@ function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, m
|
|
|
3467
3486
|
return setIsOpen(true);
|
|
3468
3487
|
const timeoutId = setTimeout(() => {
|
|
3469
3488
|
setIsOpen(false);
|
|
3470
|
-
},
|
|
3489
|
+
}, ANIMATION_DURATIONS.HIDE_MODAL);
|
|
3471
3490
|
return () => {
|
|
3472
3491
|
clearTimeout(timeoutId);
|
|
3473
3492
|
};
|
|
@@ -3480,7 +3499,13 @@ function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, m
|
|
|
3480
3499
|
onBackdropClick();
|
|
3481
3500
|
}
|
|
3482
3501
|
}
|
|
3483
|
-
: undefined,
|
|
3502
|
+
: undefined, style: {
|
|
3503
|
+
[CSS_VARS.BLUR_IN_DURATION]: `${ANIMATION_DURATIONS.SHOW_MODAL}ms`,
|
|
3504
|
+
[CSS_VARS.BLUR_OUT_DURATION]: `${ANIMATION_DURATIONS.HIDE_MODAL}ms`,
|
|
3505
|
+
}, 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: jsxRuntime.jsx("div", { style: {
|
|
3506
|
+
[CSS_VARS.SLIDE_TO_TOP_DURATION]: `${ANIMATION_DURATIONS.SHOW_MODAL}ms`,
|
|
3507
|
+
[CSS_VARS.SLIDE_TO_BOTTOM_DURATION]: `${ANIMATION_DURATIONS.HIDE_MODAL}ms`,
|
|
3508
|
+
}, 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 }) })));
|
|
3484
3509
|
}
|
|
3485
3510
|
|
|
3486
3511
|
const borderTypeClassMap = {
|
|
@@ -38507,14 +38532,6 @@ const transactionRejectedAnimation = TransactionRejectedAnimation;
|
|
|
38507
38532
|
const useTimer = ({ immediateStart = true, }) => {
|
|
38508
38533
|
const [timer, setTimer] = React.useState('0s');
|
|
38509
38534
|
const intervalRef = React.useRef(null);
|
|
38510
|
-
const formatTime = (elapsedTime) => {
|
|
38511
|
-
const totalSeconds = Math.floor(elapsedTime / 1000);
|
|
38512
|
-
const minutes = Math.floor(totalSeconds / 60);
|
|
38513
|
-
const seconds = totalSeconds % 60;
|
|
38514
|
-
const formattedMinutes = minutes > 0 ? `${minutes}m` : '';
|
|
38515
|
-
const formattedSeconds = seconds > 0 ? `${seconds}s` : '';
|
|
38516
|
-
return `${formattedMinutes}${formattedSeconds}`.trim();
|
|
38517
|
-
};
|
|
38518
38535
|
const startTimer = () => {
|
|
38519
38536
|
if (intervalRef.current !== null)
|
|
38520
38537
|
return; // Prevent multiple intervals
|
|
@@ -38541,26 +38558,34 @@ const useTimer = ({ immediateStart = true, }) => {
|
|
|
38541
38558
|
return { timer, stopTimer, startTimer };
|
|
38542
38559
|
};
|
|
38543
38560
|
|
|
38544
|
-
var
|
|
38545
|
-
(function (
|
|
38546
|
-
//
|
|
38547
|
-
|
|
38548
|
-
|
|
38549
|
-
|
|
38550
|
-
|
|
38551
|
-
|
|
38552
|
-
//
|
|
38553
|
-
|
|
38554
|
-
|
|
38555
|
-
|
|
38556
|
-
|
|
38557
|
-
|
|
38558
|
-
|
|
38561
|
+
var SwapState;
|
|
38562
|
+
(function (SwapState) {
|
|
38563
|
+
// user needs to sign the transaction in their wallet
|
|
38564
|
+
SwapState[SwapState["CONFIRM"] = 0] = "CONFIRM";
|
|
38565
|
+
// transaction is ongoing
|
|
38566
|
+
SwapState[SwapState["PROGRESS"] = 1] = "PROGRESS";
|
|
38567
|
+
// transaction is successful
|
|
38568
|
+
SwapState[SwapState["COMPLETED"] = 2] = "COMPLETED";
|
|
38569
|
+
// transaction failed
|
|
38570
|
+
SwapState[SwapState["ERROR"] = 3] = "ERROR";
|
|
38571
|
+
// transaction failed halfway and user received fallback tokens
|
|
38572
|
+
SwapState[SwapState["PARTIAL_SUCCESS"] = 4] = "PARTIAL_SUCCESS";
|
|
38573
|
+
// user hasn't signed the transaction in their wallet after some time
|
|
38574
|
+
SwapState[SwapState["CONFIRMATION_TOO_LONG"] = 5] = "CONFIRMATION_TOO_LONG";
|
|
38575
|
+
// user rejected the transaction in their wallet
|
|
38576
|
+
SwapState[SwapState["CONFIRMATION_REJECTED"] = 6] = "CONFIRMATION_REJECTED";
|
|
38577
|
+
// user needs to add gas to the transaction to complete its execution
|
|
38578
|
+
SwapState[SwapState["NEEDS_GAS"] = 7] = "NEEDS_GAS";
|
|
38579
|
+
})(SwapState || (SwapState = {}));
|
|
38559
38580
|
|
|
38560
38581
|
function ChainLink({ size = '16', strokeWidth = '2', }) {
|
|
38561
38582
|
return (jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.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" }) }));
|
|
38562
38583
|
}
|
|
38563
38584
|
|
|
38585
|
+
function TimeFliesIcon({ size = '24', className, }) {
|
|
38586
|
+
return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: [jsxRuntime.jsx("circle", { cx: "15", cy: "12", r: "7", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), jsxRuntime.jsx("path", { d: "M2 12H4M3 16H5M3 8H5", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), jsxRuntime.jsx("path", { d: "M15 9V12L16.5 13.5", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })] }));
|
|
38587
|
+
}
|
|
38588
|
+
|
|
38564
38589
|
function XSocial({ className, size = '24', }) {
|
|
38565
38590
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: jsxRuntime.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" }) }));
|
|
38566
38591
|
}
|
|
@@ -38608,68 +38633,79 @@ const AnimationWrapper = ({ lottieJsonFile, animReplacement, hideAnimations = fa
|
|
|
38608
38633
|
};
|
|
38609
38634
|
|
|
38610
38635
|
const swapProgressAnimations = {
|
|
38611
|
-
|
|
38612
|
-
|
|
38613
|
-
|
|
38614
|
-
|
|
38615
|
-
|
|
38616
|
-
|
|
38617
|
-
|
|
38618
|
-
|
|
38636
|
+
[SwapState.CONFIRM]: transactionPendingAnimation,
|
|
38637
|
+
[SwapState.ERROR]: transactionErrorPauseAnimation,
|
|
38638
|
+
[SwapState.PARTIAL_SUCCESS]: transactionHalfSuccessAnimation,
|
|
38639
|
+
[SwapState.PROGRESS]: transactionProcessinganimation,
|
|
38640
|
+
[SwapState.COMPLETED]: transactionSuccessAnimation,
|
|
38641
|
+
[SwapState.CONFIRMATION_TOO_LONG]: transactionPendingAnimation,
|
|
38642
|
+
[SwapState.CONFIRMATION_REJECTED]: transactionRejectedAnimation,
|
|
38643
|
+
[SwapState.NEEDS_GAS]: transactionErrorPauseAnimation,
|
|
38619
38644
|
};
|
|
38620
|
-
const
|
|
38621
|
-
|
|
38622
|
-
|
|
38623
|
-
|
|
38624
|
-
|
|
38625
|
-
|
|
38626
|
-
|
|
38627
|
-
|
|
38628
|
-
|
|
38629
|
-
|
|
38630
|
-
|
|
38645
|
+
const getSwapProgressTitle = ({ fromToken, toToken, swapState, }) => {
|
|
38646
|
+
switch (swapState) {
|
|
38647
|
+
case SwapState.CONFIRM:
|
|
38648
|
+
return 'Confirm swap';
|
|
38649
|
+
case SwapState.PROGRESS:
|
|
38650
|
+
return `Swap ${fromToken.symbol} to ${toToken.symbol}`;
|
|
38651
|
+
case SwapState.COMPLETED:
|
|
38652
|
+
return 'Swap complete';
|
|
38653
|
+
case SwapState.ERROR:
|
|
38654
|
+
return 'Swap failed';
|
|
38655
|
+
case SwapState.CONFIRMATION_TOO_LONG:
|
|
38656
|
+
return 'Confirmation taking too long';
|
|
38657
|
+
case SwapState.CONFIRMATION_REJECTED:
|
|
38658
|
+
return 'Swap rejected';
|
|
38659
|
+
case SwapState.PARTIAL_SUCCESS:
|
|
38660
|
+
return 'Swap failed halfway';
|
|
38661
|
+
case SwapState.NEEDS_GAS:
|
|
38662
|
+
return 'Needs gas on destination';
|
|
38663
|
+
}
|
|
38631
38664
|
};
|
|
38632
|
-
const getSwapProgressDescriptions = ({
|
|
38633
|
-
switch (
|
|
38634
|
-
case
|
|
38665
|
+
const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, }) => {
|
|
38666
|
+
switch (swapState) {
|
|
38667
|
+
case SwapState.CONFIRM: {
|
|
38635
38668
|
return 'Authenticate the transaction in your wallet.';
|
|
38636
38669
|
}
|
|
38637
|
-
case
|
|
38670
|
+
case SwapState.PROGRESS: {
|
|
38638
38671
|
return 'Feel free to dismiss this dialog, we’ll notify you when the swap is complete.';
|
|
38639
38672
|
}
|
|
38640
|
-
case
|
|
38673
|
+
case SwapState.COMPLETED: {
|
|
38641
38674
|
return `You received ${toAmount} ${toToken === null || toToken === void 0 ? void 0 : toToken.symbol} on ${toChain === null || toChain === void 0 ? void 0 : toChain.networkName}`;
|
|
38642
38675
|
}
|
|
38643
|
-
case
|
|
38676
|
+
case SwapState.ERROR: {
|
|
38644
38677
|
return 'Your tokens were safely returned to your wallet.';
|
|
38645
38678
|
}
|
|
38646
|
-
case
|
|
38679
|
+
case SwapState.CONFIRMATION_TOO_LONG: {
|
|
38647
38680
|
return 'Please go back and get a new quote.';
|
|
38648
38681
|
}
|
|
38649
|
-
case
|
|
38682
|
+
case SwapState.CONFIRMATION_REJECTED: {
|
|
38650
38683
|
return 'You declined the transaction in your wallet.';
|
|
38651
38684
|
}
|
|
38652
|
-
case
|
|
38685
|
+
case SwapState.PARTIAL_SUCCESS: {
|
|
38653
38686
|
return `You received a refund of axlUSDC on ${toChain === null || toChain === void 0 ? void 0 : toChain.networkName}`;
|
|
38654
38687
|
}
|
|
38655
|
-
case
|
|
38688
|
+
case SwapState.NEEDS_GAS: {
|
|
38656
38689
|
return 'Add gas to the transaction via Axelarscan to complete the swap';
|
|
38657
38690
|
}
|
|
38658
38691
|
}
|
|
38659
38692
|
};
|
|
38660
38693
|
const swapProgressButtonTexts = {
|
|
38661
|
-
|
|
38662
|
-
|
|
38663
|
-
|
|
38664
|
-
|
|
38665
|
-
|
|
38666
|
-
|
|
38667
|
-
|
|
38668
|
-
|
|
38694
|
+
[SwapState.CONFIRM]: 'Cancel',
|
|
38695
|
+
[SwapState.PROGRESS]: 'Ok, done',
|
|
38696
|
+
[SwapState.COMPLETED]: 'Ok, done',
|
|
38697
|
+
[SwapState.ERROR]: 'Ok, go back',
|
|
38698
|
+
[SwapState.CONFIRMATION_TOO_LONG]: 'Cancel',
|
|
38699
|
+
[SwapState.CONFIRMATION_REJECTED]: 'Ok, go back',
|
|
38700
|
+
[SwapState.PARTIAL_SUCCESS]: 'Ok, done',
|
|
38701
|
+
[SwapState.NEEDS_GAS]: 'Go to Axelarscan',
|
|
38669
38702
|
};
|
|
38670
|
-
function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted,
|
|
38703
|
+
function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, }) {
|
|
38671
38704
|
const [showSwapInfoSection, setShowSwapInfoSection] = React.useState(true);
|
|
38672
38705
|
const isFirstRenderRef = React.useRef(true);
|
|
38706
|
+
const { timer, stopTimer, startTimer } = useTimer({
|
|
38707
|
+
immediateStart: false,
|
|
38708
|
+
});
|
|
38673
38709
|
const handleRouteStepsOpen = React.useCallback(() => {
|
|
38674
38710
|
if (isFirstRenderRef.current) {
|
|
38675
38711
|
isFirstRenderRef.current = false;
|
|
@@ -38682,28 +38718,23 @@ function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, suppo
|
|
|
38682
38718
|
}
|
|
38683
38719
|
setShowSwapInfoSection(true);
|
|
38684
38720
|
}, []);
|
|
38685
|
-
const
|
|
38686
|
-
|
|
38687
|
-
|
|
38688
|
-
|
|
38689
|
-
|
|
38690
|
-
|
|
38691
|
-
|
|
38692
|
-
|
|
38693
|
-
|
|
38694
|
-
|
|
38695
|
-
|
|
38696
|
-
|
|
38697
|
-
|
|
38698
|
-
|
|
38699
|
-
|
|
38700
|
-
|
|
38701
|
-
|
|
38702
|
-
case 'pending':
|
|
38703
|
-
default:
|
|
38704
|
-
return 'confirm';
|
|
38705
|
-
}
|
|
38706
|
-
}, [txStatus]);
|
|
38721
|
+
const { headerDescription, headerTitle } = React.useMemo(() => {
|
|
38722
|
+
const headerTitle = getSwapProgressTitle({
|
|
38723
|
+
swapState: swapState,
|
|
38724
|
+
fromToken,
|
|
38725
|
+
toToken,
|
|
38726
|
+
});
|
|
38727
|
+
const headerDescription = getSwapProgressDescriptions({
|
|
38728
|
+
swapState: swapState,
|
|
38729
|
+
toAmount,
|
|
38730
|
+
toChain,
|
|
38731
|
+
toToken,
|
|
38732
|
+
});
|
|
38733
|
+
return {
|
|
38734
|
+
headerTitle,
|
|
38735
|
+
headerDescription,
|
|
38736
|
+
};
|
|
38737
|
+
}, [swapState, fromToken, toToken, toAmount, toChain]);
|
|
38707
38738
|
return (jsxRuntime.jsxs(Modal, { isOpen: isOpen, onBackdropClick: handleClose, children: [jsxRuntime.jsxs(ModalContent, { style: {
|
|
38708
38739
|
[CSS_VARS.SCALE_AND_FADE_DOWN_DURATION]: `${ANIMATION_DURATIONS.SHOW_ROUTE}ms`,
|
|
38709
38740
|
[CSS_VARS.SCALE_AND_FADE_UP_DURATION]: `${ANIMATION_DURATIONS.HIDE_ROUTE}ms`,
|
|
@@ -38716,26 +38747,18 @@ function SwapProgressView({ steps, isOpen = true, handleClose, socialLink, suppo
|
|
|
38716
38747
|
: 'tw-animate-scale-and-fade-down'), children: [jsxRuntime.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: {
|
|
38717
38748
|
// box shadow simulating bottom outline (we do not use css outline because cannot apply it to only one side)
|
|
38718
38749
|
boxShadow: '0 1px 0 currentColor',
|
|
38719
|
-
}, children: jsxRuntime.jsx("div", { children: jsxRuntime.jsx(AnimationWrapper, { lottieJsonFile: swapProgressAnimations[
|
|
38720
|
-
|
|
38750
|
+
}, children: jsxRuntime.jsx("div", { children: jsxRuntime.jsx(AnimationWrapper, { lottieJsonFile: swapProgressAnimations[swapState], hideAnimations: false, animReplacement: jsxRuntime.jsx(Loader, { size: "60" }) }) }) }), jsxRuntime.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 ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: jsxRuntime.jsx(CircleCheckIcon, {}) }), jsxRuntime.jsx(Button, { size: "md", variant: "secondary", icon: jsxRuntime.jsx(XSocial, {}), label: "Share", link: socialLink, title: "Share on X" })] })) : swapState === SwapState.ERROR ||
|
|
38751
|
+
swapState === SwapState.PARTIAL_SUCCESS ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "-tw-mb-1 -tw-ml-1", children: jsxRuntime.jsx(EmojiSadFilledIcon, {}) }), jsxRuntime.jsx(Button, { size: "md", variant: "secondary", label: "Get help", link: supportLink, title: "Contact support" })] })) : (jsxRuntime.jsx(TokenPair, { firstToken: {
|
|
38721
38752
|
bgColor: fromToken.bgColor,
|
|
38722
38753
|
imageUrl: fromToken.logoUrl,
|
|
38723
38754
|
}, secondToken: {
|
|
38724
38755
|
bgColor: toToken.bgColor,
|
|
38725
38756
|
imageUrl: toToken.logoUrl,
|
|
38726
|
-
} })) }), jsxRuntime.jsx(SwapProgressViewHeader, { title:
|
|
38727
|
-
state: animationProgressState,
|
|
38728
|
-
toAmount,
|
|
38729
|
-
toChain,
|
|
38730
|
-
toToken,
|
|
38731
|
-
}) }), jsxRuntime.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: [jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(ArrowRightUpCircleIcon, {}), label: `Swap ${fromToken === null || fromToken === void 0 ? void 0 : fromToken.symbol}`, detail: jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromToken.logoUrl }), animationProgressState === 'error' ? (jsxRuntime.jsx(CaptionText, { children: "0" })) : (fromAmount)] }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx("span", { className: "tw-inline-block tw-rotate-90", children: jsxRuntime.jsx(ArrowRightUpCircleIcon, {}) }), label: `Receive ${toToken === null || toToken === void 0 ? void 0 : toToken.symbol}`, detail: jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toToken.logoUrl }), animationProgressState === 'error' ? (jsxRuntime.jsx(CaptionText, { children: "0" })) : (toAmount)] }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(ChainLink, { size: "24", strokeWidth: "1.5" }), label: "Chain", detail: jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromChain.networkName }), jsxRuntime.jsx("span", { className: "tw-text-grey-500", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toChain.networkName })] }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(CaptionText, { children: fromAddressFormatted }), jsxRuntime.jsx("span", { className: "tw-text-grey-500", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), jsxRuntime.jsx(CaptionText, { children: toAddressFormatted })] }) })] })] }), jsxRuntime.jsx(TrackTransactionView, { rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, txStatus: txStatus }), jsxRuntime.jsx(Button, { size: "lg", variant: "primary", label: swapProgressButtonTexts[animationProgressState], onClick: handleClose, className: "tw-min-h-button" })] }));
|
|
38757
|
+
} })) }), jsxRuntime.jsx(SwapProgressViewHeader, { title: headerTitle, description: headerDescription }), jsxRuntime.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: [jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(ArrowsSwapIcon, {}), label: "Swap", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: fromToken.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromAmount })] }), toContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-full", src: toToken.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toAmount })] }) }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(ChainLink, { size: "24", strokeWidth: "1.5" }), label: "Chain", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: fromChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: fromChain.networkName })] }), toContent: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: "tw-h-squid-m tw-w-squid-m tw-rounded-squid-xxs", src: toChain.logoUrl }), jsxRuntime.jsx(CaptionText, { children: toChain.networkName })] }) }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(WalletFilledIcon, { size: "24" }), label: "Wallet", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: fromAddressFormatted, toContent: toAddressFormatted }) }), jsxRuntime.jsx(SwapDetailListItem, { icon: jsxRuntime.jsx(TimeFliesIcon, {}), label: "Time to complete", detail: jsxRuntime.jsx(SwapDetailItemValues, { fromContent: timer, toContent: estimatedTimeToComplete }) })] })] }), jsxRuntime.jsx(TrackTransactionView, { onTxEnd: () => stopTimer(), onTxStart: () => startTimer(), rawSteps: steps, onClose: handleRouteStepsClosed, onOpen: handleRouteStepsOpen, swapState: swapState }), jsxRuntime.jsx(Button, { size: "lg", variant: "primary", label: swapProgressButtonTexts[swapState], onClick: handleClose, className: "tw-min-h-button" })] }));
|
|
38732
38758
|
}
|
|
38733
|
-
const TrackTransactionView = ({
|
|
38734
|
-
const { timer, stopTimer, startTimer } = useTimer({
|
|
38735
|
-
immediateStart: false,
|
|
38736
|
-
});
|
|
38759
|
+
const TrackTransactionView = ({ swapState, rawSteps, onOpen, onClose, onTxStart, onTxEnd, }) => {
|
|
38737
38760
|
const { currentStepIndex, steps } = React.useMemo(() => {
|
|
38738
|
-
if (rawSteps.every((s) => s.status ===
|
|
38761
|
+
if (rawSteps.every((s) => s.status === SwapState.COMPLETED)) {
|
|
38739
38762
|
return {
|
|
38740
38763
|
steps: rawSteps,
|
|
38741
38764
|
currentStepIndex: rawSteps.length - 1,
|
|
@@ -38744,9 +38767,9 @@ const TrackTransactionView = ({ txStatus, rawSteps, onOpen, onClose, }) => {
|
|
|
38744
38767
|
// TODO: Fix this
|
|
38745
38768
|
// Vercel build throws an error for findLastIndex, probably related to the Node version being used
|
|
38746
38769
|
// @ts-ignore
|
|
38747
|
-
const lastSuccessfulStepIndex = rawSteps.findLastIndex((s) => s.status ===
|
|
38748
|
-
if (
|
|
38749
|
-
|
|
38770
|
+
const lastSuccessfulStepIndex = rawSteps.findLastIndex((s) => s.status === SwapState.COMPLETED);
|
|
38771
|
+
if (swapState === SwapState.PROGRESS) {
|
|
38772
|
+
onTxStart();
|
|
38750
38773
|
const noSuccessfulStep = lastSuccessfulStepIndex < 0;
|
|
38751
38774
|
// If no successful step, but transaction is ongoing, this means user signed the tx in their wallet,
|
|
38752
38775
|
// so we show the second step, because the first step is "waiting for confirmation"
|
|
@@ -38754,13 +38777,13 @@ const TrackTransactionView = ({ txStatus, rawSteps, onOpen, onClose, }) => {
|
|
|
38754
38777
|
const currentOngoingStepIndex = noSuccessfulStep
|
|
38755
38778
|
? 1
|
|
38756
38779
|
: lastSuccessfulStepIndex + 1;
|
|
38757
|
-
// If current step is not the last one, show the
|
|
38780
|
+
// If current step is not the last one, show the loader
|
|
38758
38781
|
if (currentOngoingStepIndex < rawSteps.length) {
|
|
38759
|
-
// Show
|
|
38782
|
+
// Show loader in the current ongoing step
|
|
38760
38783
|
// @ts-ignore Vercel build error - TODO: Fix this
|
|
38761
|
-
const
|
|
38784
|
+
const stepsWithLoader = rawSteps.with(currentOngoingStepIndex, Object.assign(Object.assign({}, rawSteps[currentOngoingStepIndex]), { chipContent: jsxRuntime.jsx(Loader, { size: "16", strokeWidth: "2" }) }));
|
|
38762
38785
|
return {
|
|
38763
|
-
steps:
|
|
38786
|
+
steps: stepsWithLoader,
|
|
38764
38787
|
currentStepIndex: currentOngoingStepIndex,
|
|
38765
38788
|
};
|
|
38766
38789
|
}
|
|
@@ -38769,8 +38792,8 @@ const TrackTransactionView = ({ txStatus, rawSteps, onOpen, onClose, }) => {
|
|
|
38769
38792
|
currentStepIndex: rawSteps.length - 1,
|
|
38770
38793
|
};
|
|
38771
38794
|
}
|
|
38772
|
-
else if (
|
|
38773
|
-
|
|
38795
|
+
else if (swapState === SwapState.COMPLETED) {
|
|
38796
|
+
onTxEnd();
|
|
38774
38797
|
return {
|
|
38775
38798
|
steps: rawSteps,
|
|
38776
38799
|
currentStepIndex: rawSteps.length - 1,
|
|
@@ -38780,9 +38803,12 @@ const TrackTransactionView = ({ txStatus, rawSteps, onOpen, onClose, }) => {
|
|
|
38780
38803
|
steps: rawSteps,
|
|
38781
38804
|
currentStepIndex: 0,
|
|
38782
38805
|
};
|
|
38783
|
-
}, [
|
|
38806
|
+
}, [swapState, rawSteps]);
|
|
38784
38807
|
return rawSteps.length > 0 ? (jsxRuntime.jsx(SwapStepsCollapsed, { steps: steps, currentStepIndex: currentStepIndex, onClose: onClose, onOpen: onOpen })) : null;
|
|
38785
38808
|
};
|
|
38809
|
+
const SwapDetailItemValues = ({ fromContent, toContent, }) => {
|
|
38810
|
+
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: [typeof fromContent === 'string' ? (jsxRuntime.jsx(CaptionText, { children: fromContent })) : (fromContent), jsxRuntime.jsx("span", { className: "tw-text-grey-500", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), typeof toContent === 'string' ? (jsxRuntime.jsx(CaptionText, { children: toContent })) : (toContent)] }));
|
|
38811
|
+
};
|
|
38786
38812
|
|
|
38787
38813
|
const lightTheme = {
|
|
38788
38814
|
// 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
|
-
}
|