@ensofinance/checkout-widget 0.0.1
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/checkout-widget.es.js +52889 -0
- package/dist/checkout-widget.es.js.map +1 -0
- package/dist/checkout-widget.umd.js +203 -0
- package/dist/checkout-widget.umd.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/enso-api.yaml +1982 -0
- package/orval.config.ts +25 -0
- package/package.json +79 -0
- package/src/assets/BinanceBadge.svg +4 -0
- package/src/assets/CoinbaseIcon.svg +4 -0
- package/src/assets/USD Coin (USDC).svg +5 -0
- package/src/assets/avecIcon.svg +5 -0
- package/src/assets/base.webp +0 -0
- package/src/assets/depositIcon.svg +6 -0
- package/src/assets/eth.webp +0 -0
- package/src/assets/ethMainnetIcon.svg +10 -0
- package/src/assets/fail.svg +5 -0
- package/src/assets/kraken.png +0 -0
- package/src/assets/logo.svg +10 -0
- package/src/assets/mastercard.png +0 -0
- package/src/assets/metamask.png +0 -0
- package/src/assets/rabby.png +0 -0
- package/src/assets/success.svg +4 -0
- package/src/assets/usdc.webp +0 -0
- package/src/assets/usdt.webp +0 -0
- package/src/assets/visa.png +0 -0
- package/src/assets/visa.webp +0 -0
- package/src/components/BridgeFee.tsx +58 -0
- package/src/components/ChakraProvider.tsx +372 -0
- package/src/components/Checkout.tsx +127 -0
- package/src/components/CheckoutModal.tsx +22 -0
- package/src/components/CircleTimer.tsx +66 -0
- package/src/components/CurrencySwapDisplay.tsx +153 -0
- package/src/components/DepositProcessing.tsx +116 -0
- package/src/components/ExchangeConfirmSecurity.tsx +110 -0
- package/src/components/QuoteParameters.tsx +341 -0
- package/src/components/TransactionDetailRow.tsx +124 -0
- package/src/components/cards/AssetCard.tsx +167 -0
- package/src/components/cards/ExchangeCard.tsx +53 -0
- package/src/components/cards/OptionCard.tsx +59 -0
- package/src/components/cards/WalletCard.tsx +99 -0
- package/src/components/cards/index.ts +6 -0
- package/src/components/modal.tsx +83 -0
- package/src/components/steps/ExchangeFlow.tsx +1402 -0
- package/src/components/steps/InitialStep.tsx +169 -0
- package/src/components/steps/QuoteStep.tsx +121 -0
- package/src/components/steps/WalletAmountStep.tsx +258 -0
- package/src/components/steps/WalletConfirmStep.tsx +404 -0
- package/src/components/steps/WalletTokenStep.tsx +128 -0
- package/src/components/ui/index.tsx +394 -0
- package/src/components/ui/styled.tsx +85 -0
- package/src/components/ui/toaster.tsx +43 -0
- package/src/components/ui/tooltip.tsx +46 -0
- package/src/enso-api/api.ts +173 -0
- package/src/enso-api/custom-instance.ts +35 -0
- package/src/enso-api/index.ts +5119 -0
- package/src/enso-api/model/action.ts +17 -0
- package/src/enso-api/model/actionAction.ts +52 -0
- package/src/enso-api/model/actionInputs.ts +12 -0
- package/src/enso-api/model/actionToBundle.ts +19 -0
- package/src/enso-api/model/actionToBundleAction.ts +53 -0
- package/src/enso-api/model/actionToBundleArgs.ts +12 -0
- package/src/enso-api/model/bundleControllerBundleShortcutTransactionParams.ts +53 -0
- package/src/enso-api/model/bundleControllerBundleShortcutTransactionRoutingStrategy.ts +23 -0
- package/src/enso-api/model/bundleShortcutTransaction.ts +35 -0
- package/src/enso-api/model/bundleShortcutTransactionAmountsOut.ts +15 -0
- package/src/enso-api/model/bundleShortcutTransactionFeeAmount.ts +12 -0
- package/src/enso-api/model/connectedNetwork.ts +16 -0
- package/src/enso-api/model/hop.ts +24 -0
- package/src/enso-api/model/hopArgs.ts +12 -0
- package/src/enso-api/model/index.ts +70 -0
- package/src/enso-api/model/iporControllerIporShortcutTransactionParams.ts +21 -0
- package/src/enso-api/model/iporShortcutInput.ts +33 -0
- package/src/enso-api/model/iporShortcutTransaction.ts +22 -0
- package/src/enso-api/model/lZDestinationTokenData.ts +19 -0
- package/src/enso-api/model/lZPoolLookupResponse.ts +26 -0
- package/src/enso-api/model/layerZeroControllerGetPoolAddressParams.ts +29 -0
- package/src/enso-api/model/network.ts +15 -0
- package/src/enso-api/model/networksControllerNetworksParams.ts +21 -0
- package/src/enso-api/model/nonTokenizedControllerTokens200.ts +15 -0
- package/src/enso-api/model/nonTokenizedControllerTokens200AllOf.ts +16 -0
- package/src/enso-api/model/nonTokenizedControllerTokensParams.ts +41 -0
- package/src/enso-api/model/nonTokenizedModel.ts +27 -0
- package/src/enso-api/model/nontokenizedControllerRouteNontokenizedShorcutTransactionParams.ts +64 -0
- package/src/enso-api/model/nontokenizedControllerRouteNontokenizedShorcutTransactionRoutingStrategy.ts +22 -0
- package/src/enso-api/model/paginatedResult.ts +16 -0
- package/src/enso-api/model/paginationMeta.ts +27 -0
- package/src/enso-api/model/positionModel.ts +77 -0
- package/src/enso-api/model/price.ts +20 -0
- package/src/enso-api/model/pricesControllerGetPricesParams.ts +17 -0
- package/src/enso-api/model/project.ts +15 -0
- package/src/enso-api/model/protocol.ts +15 -0
- package/src/enso-api/model/protocolModel.ts +26 -0
- package/src/enso-api/model/protocolsControllerFindAllParams.ts +21 -0
- package/src/enso-api/model/routeShortcutTransaction.ts +33 -0
- package/src/enso-api/model/routeShortcutVariableInputs.ts +68 -0
- package/src/enso-api/model/routeShortcutVariableInputsRoutingStrategy.ts +27 -0
- package/src/enso-api/model/routeShortcutVariableInputsVariableEstimates.ts +14 -0
- package/src/enso-api/model/routerControllerRouteShortcutTransactionParams.ts +91 -0
- package/src/enso-api/model/routerControllerRouteShortcutTransactionRoutingStrategy.ts +23 -0
- package/src/enso-api/model/standard.ts +18 -0
- package/src/enso-api/model/standardAction.ts +20 -0
- package/src/enso-api/model/standardActionAction.ts +53 -0
- package/src/enso-api/model/tokenModel.ts +36 -0
- package/src/enso-api/model/tokensControllerTokens200.ts +15 -0
- package/src/enso-api/model/tokensControllerTokens200AllOf.ts +16 -0
- package/src/enso-api/model/tokensControllerTokensParams.ts +91 -0
- package/src/enso-api/model/tokensControllerTokensType.ts +19 -0
- package/src/enso-api/model/transaction.ts +17 -0
- package/src/enso-api/model/userOperation.ts +28 -0
- package/src/enso-api/model/walletApproveTransaction.ts +24 -0
- package/src/enso-api/model/walletApproveTransactionTx.ts +15 -0
- package/src/enso-api/model/walletBalance.ts +29 -0
- package/src/enso-api/model/walletControllerCreateApproveTransactionParams.ts +35 -0
- package/src/enso-api/model/walletControllerCreateApproveTransactionRoutingStrategy.ts +23 -0
- package/src/enso-api/model/walletControllerWalletBalancesParams.ts +25 -0
- package/src/index.ts +17 -0
- package/src/store.ts +68 -0
- package/src/types/assets.d.ts +29 -0
- package/src/types/index.ts +21 -0
- package/src/util/common.tsx +324 -0
- package/src/util/constants.tsx +213 -0
- package/src/util/enso-hooks.tsx +203 -0
- package/src/util/index.tsx +68 -0
- package/src/util/tx-tracker.tsx +301 -0
- package/src/util/wallet.tsx +258 -0
- package/tsconfig.json +13 -0
- package/vite.config.ts +51 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
ReactElement,
|
|
4
|
+
useEffect,
|
|
5
|
+
useMemo,
|
|
6
|
+
useState,
|
|
7
|
+
ComponentType,
|
|
8
|
+
} from "react";
|
|
9
|
+
import { Box } from "@chakra-ui/react";
|
|
10
|
+
import InitialStep from "./steps/InitialStep";
|
|
11
|
+
import SelectTokenStep from "./steps/WalletTokenStep";
|
|
12
|
+
import SelectAmountStep from "./steps/WalletAmountStep";
|
|
13
|
+
import QuoteStep from "./steps/QuoteStep";
|
|
14
|
+
import WalletConfirmStep from "./steps/WalletConfirmStep";
|
|
15
|
+
import ExchangeFlow from "./steps/ExchangeFlow";
|
|
16
|
+
import { useAppStore } from "@/store";
|
|
17
|
+
import { TxTracker } from "@/util/tx-tracker";
|
|
18
|
+
import ChakraProvider from "./ChakraProvider";
|
|
19
|
+
import { CheckoutConfig, SupportedExchanges } from "@/types";
|
|
20
|
+
|
|
21
|
+
type ICheckoutContext = {
|
|
22
|
+
step: string;
|
|
23
|
+
setStep: (step: string) => void;
|
|
24
|
+
|
|
25
|
+
flow: string;
|
|
26
|
+
setFlow: (flow: string) => void;
|
|
27
|
+
|
|
28
|
+
handleClose: () => void;
|
|
29
|
+
|
|
30
|
+
enableExchanges?: SupportedExchanges[];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const FLOWS: Record<
|
|
34
|
+
string,
|
|
35
|
+
{
|
|
36
|
+
steps: Record<string, ReactElement>;
|
|
37
|
+
}
|
|
38
|
+
> = {
|
|
39
|
+
mainFlow: {
|
|
40
|
+
steps: {
|
|
41
|
+
selectToken: <SelectTokenStep />,
|
|
42
|
+
selectAmount: <SelectAmountStep />,
|
|
43
|
+
quote: <QuoteStep />,
|
|
44
|
+
confirmTransfer: <WalletConfirmStep />,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
exchangeFlow: {
|
|
48
|
+
steps: {
|
|
49
|
+
connectExchange: <ExchangeFlow />,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const CheckoutContext = createContext<ICheckoutContext>(
|
|
55
|
+
{} as ICheckoutContext,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
export const Checkout = ({
|
|
59
|
+
config: { apiKey, tokenOut, chainIdOut, theme, enableExchange },
|
|
60
|
+
onClose,
|
|
61
|
+
wrapper,
|
|
62
|
+
}: {
|
|
63
|
+
config: CheckoutConfig;
|
|
64
|
+
wrapper?: ComponentType;
|
|
65
|
+
onClose?: () => void;
|
|
66
|
+
}) => {
|
|
67
|
+
const [step, setStep] = useState("");
|
|
68
|
+
const [flow, setFlow] = useState("");
|
|
69
|
+
|
|
70
|
+
const setEnsoApiToken = useAppStore((state) => state.setEnsoApiToken);
|
|
71
|
+
const setTokenOut = useAppStore((state) => state.setTokenOut);
|
|
72
|
+
const setChainIdOut = useAppStore((state) => state.setChainIdOut);
|
|
73
|
+
|
|
74
|
+
const handleClose = useMemo(
|
|
75
|
+
() =>
|
|
76
|
+
onClose
|
|
77
|
+
? () => {
|
|
78
|
+
if (onClose) {
|
|
79
|
+
onClose();
|
|
80
|
+
}
|
|
81
|
+
setStep("");
|
|
82
|
+
setFlow("");
|
|
83
|
+
}
|
|
84
|
+
: undefined,
|
|
85
|
+
[onClose],
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
setTokenOut(tokenOut);
|
|
90
|
+
setChainIdOut(chainIdOut);
|
|
91
|
+
}, [tokenOut, chainIdOut]);
|
|
92
|
+
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
setEnsoApiToken(apiKey);
|
|
95
|
+
}, [apiKey]);
|
|
96
|
+
|
|
97
|
+
const WrapperComponent = useMemo(
|
|
98
|
+
() =>
|
|
99
|
+
wrapper ??
|
|
100
|
+
(({ children, ...args }) => (
|
|
101
|
+
<Box p={4} w="374px" {...args}>
|
|
102
|
+
{children}
|
|
103
|
+
</Box>
|
|
104
|
+
)),
|
|
105
|
+
[wrapper],
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<CheckoutContext.Provider
|
|
110
|
+
value={{
|
|
111
|
+
step,
|
|
112
|
+
setStep,
|
|
113
|
+
flow,
|
|
114
|
+
setFlow,
|
|
115
|
+
handleClose,
|
|
116
|
+
enableExchanges: enableExchange,
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
<ChakraProvider themeConfig={theme}>
|
|
120
|
+
<WrapperComponent>
|
|
121
|
+
<TxTracker />
|
|
122
|
+
{!flow && !step ? <InitialStep /> : FLOWS[flow].steps[step]}
|
|
123
|
+
</WrapperComponent>
|
|
124
|
+
</ChakraProvider>
|
|
125
|
+
</CheckoutContext.Provider>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { Checkout } from "./Checkout";
|
|
3
|
+
import Modal from "./modal";
|
|
4
|
+
import { CheckoutModalProps } from "@/types";
|
|
5
|
+
|
|
6
|
+
export const CheckoutModal = ({
|
|
7
|
+
config,
|
|
8
|
+
setIsActive,
|
|
9
|
+
isActive,
|
|
10
|
+
onClose,
|
|
11
|
+
}: CheckoutModalProps) => {
|
|
12
|
+
const handleClose = useCallback(() => {
|
|
13
|
+
setIsActive(false);
|
|
14
|
+
onClose?.();
|
|
15
|
+
}, [setIsActive, onClose]);
|
|
16
|
+
|
|
17
|
+
if (!isActive) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return <Checkout wrapper={Modal} config={config} onClose={handleClose} />;
|
|
22
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Text, Center, chakra } from "@chakra-ui/react";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
|
|
4
|
+
export const TimerWrapper = chakra("div", {
|
|
5
|
+
base: {
|
|
6
|
+
w: "58px",
|
|
7
|
+
h: "58px",
|
|
8
|
+
borderRadius: "full",
|
|
9
|
+
border: "1px solid",
|
|
10
|
+
borderColor: "border",
|
|
11
|
+
display: "flex",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
justifyContent: "center",
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
interface CircleTimerProps {
|
|
18
|
+
onFinish?: () => void;
|
|
19
|
+
start?: boolean;
|
|
20
|
+
duration?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const CircleTimer = ({ onFinish, start, duration = 60 }: CircleTimerProps) => {
|
|
24
|
+
const [secondsLeft, setSecondsLeft] = useState(duration);
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setSecondsLeft(duration);
|
|
28
|
+
}, [duration]);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!start) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const interval = setInterval(() => {
|
|
36
|
+
setSecondsLeft((prev) => {
|
|
37
|
+
if (prev <= 1) {
|
|
38
|
+
clearInterval(interval);
|
|
39
|
+
onFinish?.();
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
return prev - 1;
|
|
43
|
+
});
|
|
44
|
+
}, 1000);
|
|
45
|
+
|
|
46
|
+
return () => clearInterval(interval);
|
|
47
|
+
}, [start, onFinish]);
|
|
48
|
+
|
|
49
|
+
const formatTime = (secs: number) => {
|
|
50
|
+
const mins = Math.floor(secs / 60)
|
|
51
|
+
.toString()
|
|
52
|
+
.padStart(2, "0");
|
|
53
|
+
const secsStr = (secs % 60).toString().padStart(2, "0");
|
|
54
|
+
return `${mins}:${secsStr}`;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<Center>
|
|
59
|
+
<TimerWrapper>
|
|
60
|
+
<Text fontSize="xs" color="fg.muted" fontWeight="medium">
|
|
61
|
+
{formatTime(secondsLeft)}
|
|
62
|
+
</Text>
|
|
63
|
+
</TimerWrapper>
|
|
64
|
+
</Center>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { Box, chakra, Flex, Text } from "@chakra-ui/react";
|
|
2
|
+
import { ChevronRightIcon } from "lucide-react";
|
|
3
|
+
import { Token } from "@/util/common";
|
|
4
|
+
import {
|
|
5
|
+
MOCK_IMAGE_URL,
|
|
6
|
+
SupportedChainId,
|
|
7
|
+
STARGATE_CHAIN_NAMES,
|
|
8
|
+
} from "@/util/constants";
|
|
9
|
+
|
|
10
|
+
const GECKO_HOSTNAME = "coingecko";
|
|
11
|
+
|
|
12
|
+
export const SwapWrapper = chakra("div", {
|
|
13
|
+
base: {
|
|
14
|
+
display: "flex",
|
|
15
|
+
gap: "8px",
|
|
16
|
+
alignItems: "center",
|
|
17
|
+
justifyContent: "center",
|
|
18
|
+
p: "8px 12px",
|
|
19
|
+
borderRadius: "114px",
|
|
20
|
+
bg: "bg.subtle",
|
|
21
|
+
w: "fit-content",
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// uplift default image quality
|
|
26
|
+
const transformGeckoUrl = (originalUrl: string): string =>
|
|
27
|
+
originalUrl.includes(GECKO_HOSTNAME)
|
|
28
|
+
? originalUrl.replace("/thumb/", "/large/")
|
|
29
|
+
: originalUrl;
|
|
30
|
+
|
|
31
|
+
export const TokenIcon = ({
|
|
32
|
+
token,
|
|
33
|
+
chainId,
|
|
34
|
+
size = 32,
|
|
35
|
+
}: {
|
|
36
|
+
token: Token;
|
|
37
|
+
chainId?: SupportedChainId;
|
|
38
|
+
size?: number;
|
|
39
|
+
}) => (
|
|
40
|
+
<Box
|
|
41
|
+
position="relative"
|
|
42
|
+
borderRadius={"50%"}
|
|
43
|
+
minW={`${size}px`}
|
|
44
|
+
minH={`${size}px`}
|
|
45
|
+
>
|
|
46
|
+
<Box
|
|
47
|
+
borderRadius={"50%"}
|
|
48
|
+
overflow={"hidden"}
|
|
49
|
+
width={`${size}px`}
|
|
50
|
+
height={`${size}px`}
|
|
51
|
+
>
|
|
52
|
+
<img
|
|
53
|
+
src={
|
|
54
|
+
token?.logoURI
|
|
55
|
+
? transformGeckoUrl(token?.logoURI)
|
|
56
|
+
: MOCK_IMAGE_URL
|
|
57
|
+
}
|
|
58
|
+
title={token?.symbol}
|
|
59
|
+
alt={token?.symbol}
|
|
60
|
+
width={`${size}px`}
|
|
61
|
+
height={`${size}px`}
|
|
62
|
+
/>
|
|
63
|
+
</Box>
|
|
64
|
+
{chainId && (
|
|
65
|
+
<Box
|
|
66
|
+
position="absolute"
|
|
67
|
+
bottom="0"
|
|
68
|
+
right={"-2px"}
|
|
69
|
+
width={`${size / 2}px`}
|
|
70
|
+
height={`${size / 2}px`}
|
|
71
|
+
borderRadius="50%"
|
|
72
|
+
overflow="hidden"
|
|
73
|
+
border="1px solid white"
|
|
74
|
+
zIndex="1"
|
|
75
|
+
>
|
|
76
|
+
<img
|
|
77
|
+
src={`https://icons-ckg.pages.dev/stargate-light/networks/${STARGATE_CHAIN_NAMES[chainId]}.svg`}
|
|
78
|
+
alt={`Chain ${chainId}`}
|
|
79
|
+
width="100%"
|
|
80
|
+
height="100%"
|
|
81
|
+
/>
|
|
82
|
+
</Box>
|
|
83
|
+
)}
|
|
84
|
+
</Box>
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const SwapItem = ({
|
|
88
|
+
token,
|
|
89
|
+
chainId,
|
|
90
|
+
size = 32,
|
|
91
|
+
title,
|
|
92
|
+
subTitle,
|
|
93
|
+
}: {
|
|
94
|
+
token: Token;
|
|
95
|
+
chainId?: SupportedChainId;
|
|
96
|
+
size?: number;
|
|
97
|
+
title: string;
|
|
98
|
+
subTitle: string;
|
|
99
|
+
}) => {
|
|
100
|
+
return (
|
|
101
|
+
<Flex align="center" gap={2}>
|
|
102
|
+
<TokenIcon token={token} chainId={chainId} size={size} />
|
|
103
|
+
<Box>
|
|
104
|
+
<Text fontWeight="medium" fontSize="xs" color="fg.muted">
|
|
105
|
+
{title}
|
|
106
|
+
</Text>
|
|
107
|
+
<Text fontSize="xs" color="fg">
|
|
108
|
+
{subTitle}
|
|
109
|
+
</Text>
|
|
110
|
+
</Box>
|
|
111
|
+
</Flex>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const CurrencySwapDisplay = ({
|
|
116
|
+
tokenIn,
|
|
117
|
+
tokenOut,
|
|
118
|
+
chainIdIn,
|
|
119
|
+
chainIdOut,
|
|
120
|
+
size = 24,
|
|
121
|
+
}: {
|
|
122
|
+
tokenIn: Token;
|
|
123
|
+
tokenOut: Token;
|
|
124
|
+
chainIdIn: number;
|
|
125
|
+
chainIdOut: number;
|
|
126
|
+
size?: number;
|
|
127
|
+
}) => {
|
|
128
|
+
return (
|
|
129
|
+
<SwapWrapper>
|
|
130
|
+
<SwapItem
|
|
131
|
+
token={tokenIn}
|
|
132
|
+
chainId={chainIdIn}
|
|
133
|
+
title={"You send"}
|
|
134
|
+
subTitle={tokenIn?.symbol}
|
|
135
|
+
size={size}
|
|
136
|
+
/>
|
|
137
|
+
<ChevronRightIcon
|
|
138
|
+
color={"#707070"}
|
|
139
|
+
width={"16px"}
|
|
140
|
+
height={"16px"}
|
|
141
|
+
/>
|
|
142
|
+
<SwapItem
|
|
143
|
+
token={tokenOut}
|
|
144
|
+
chainId={chainIdOut}
|
|
145
|
+
title={"You receive"}
|
|
146
|
+
subTitle={tokenOut?.symbol}
|
|
147
|
+
size={size}
|
|
148
|
+
/>
|
|
149
|
+
</SwapWrapper>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export default CurrencySwapDisplay;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Box, Icon, Text, chakra, Image } from "@chakra-ui/react";
|
|
2
|
+
import { X } from "lucide-react";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import DepositIcon from "../assets/depositIcon.svg";
|
|
5
|
+
|
|
6
|
+
// Styled components for icons
|
|
7
|
+
const MainIcon = chakra(Image, {
|
|
8
|
+
base: {
|
|
9
|
+
boxSize: "36px",
|
|
10
|
+
borderRadius: "full",
|
|
11
|
+
objectFit: "contain",
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const SubIcon = chakra(Image, {
|
|
16
|
+
base: {
|
|
17
|
+
boxSize: "16px",
|
|
18
|
+
position: "absolute",
|
|
19
|
+
bottom: "-2px",
|
|
20
|
+
right: "-2px",
|
|
21
|
+
borderRadius: "full",
|
|
22
|
+
border: "1px solid",
|
|
23
|
+
borderColor: "bg",
|
|
24
|
+
objectFit: "contain",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
interface DepositProcessingProps {
|
|
29
|
+
onClose?: () => void;
|
|
30
|
+
currencyIcon: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const DepositProcessing = ({
|
|
34
|
+
onClose,
|
|
35
|
+
currencyIcon,
|
|
36
|
+
}: DepositProcessingProps) => {
|
|
37
|
+
const getCurrentTime = () => {
|
|
38
|
+
const now = new Date();
|
|
39
|
+
const month = now.toLocaleString("en-US", { month: "short" });
|
|
40
|
+
const time = now.toLocaleTimeString("en-US", {
|
|
41
|
+
hour12: false,
|
|
42
|
+
hour: "2-digit",
|
|
43
|
+
minute: "2-digit",
|
|
44
|
+
second: "2-digit",
|
|
45
|
+
});
|
|
46
|
+
return `${month} - ${time}`;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Box
|
|
51
|
+
border="1px solid"
|
|
52
|
+
borderColor="border.subtle"
|
|
53
|
+
borderRadius="12px"
|
|
54
|
+
width="100%"
|
|
55
|
+
bg="bg"
|
|
56
|
+
>
|
|
57
|
+
{/* Header with icon and text */}
|
|
58
|
+
<Box
|
|
59
|
+
display="flex"
|
|
60
|
+
alignItems="center"
|
|
61
|
+
gap="12px"
|
|
62
|
+
borderBottom="1px solid"
|
|
63
|
+
borderColor="border.subtle"
|
|
64
|
+
padding="10px 16px"
|
|
65
|
+
>
|
|
66
|
+
<Box position="relative">
|
|
67
|
+
<MainIcon src={currencyIcon} alt="Currency icon" />
|
|
68
|
+
<SubIcon src={DepositIcon} alt="deposit icon" />
|
|
69
|
+
</Box>
|
|
70
|
+
|
|
71
|
+
<Box flex="1">
|
|
72
|
+
<Text
|
|
73
|
+
fontSize="lg"
|
|
74
|
+
fontWeight="semibold"
|
|
75
|
+
color="fg"
|
|
76
|
+
marginBottom="4px"
|
|
77
|
+
>
|
|
78
|
+
Deposit processing
|
|
79
|
+
</Text>
|
|
80
|
+
<Text fontSize="sm" color="fg.muted" lineHeight="1.4">
|
|
81
|
+
Your deposit will be added to your account soon.
|
|
82
|
+
</Text>
|
|
83
|
+
</Box>
|
|
84
|
+
|
|
85
|
+
{onClose && (
|
|
86
|
+
<Icon
|
|
87
|
+
as={X}
|
|
88
|
+
width="16px"
|
|
89
|
+
height="16px"
|
|
90
|
+
color="fg.subtle"
|
|
91
|
+
cursor="pointer"
|
|
92
|
+
_hover={{ color: "fg.muted" }}
|
|
93
|
+
onClick={onClose}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
96
|
+
</Box>
|
|
97
|
+
|
|
98
|
+
{/* Order started time */}
|
|
99
|
+
<Box
|
|
100
|
+
display="flex"
|
|
101
|
+
justifyContent="space-between"
|
|
102
|
+
alignItems="center"
|
|
103
|
+
padding="10px 16px"
|
|
104
|
+
>
|
|
105
|
+
<Text fontSize="sm" color="fg.muted">
|
|
106
|
+
Order started
|
|
107
|
+
</Text>
|
|
108
|
+
<Text fontSize="sm" color="fg" fontWeight="medium">
|
|
109
|
+
{getCurrentTime()}
|
|
110
|
+
</Text>
|
|
111
|
+
</Box>
|
|
112
|
+
</Box>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export default DepositProcessing;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Box, chakra, Icon, Image } from "@chakra-ui/react";
|
|
2
|
+
import { Handshake, Lock, ShieldCheck } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
import { Button, Helper } from "./ui";
|
|
5
|
+
import LogoSvg from "../assets/logo.svg";
|
|
6
|
+
import { BodyWrapper } from "./ui/styled";
|
|
7
|
+
|
|
8
|
+
export const HeaderTitle = chakra("h2", {
|
|
9
|
+
base: {
|
|
10
|
+
fontWeight: "600",
|
|
11
|
+
fontSize: "16px",
|
|
12
|
+
lineHeight: "100%",
|
|
13
|
+
letterSpacing: "-0.4px",
|
|
14
|
+
color: "fg",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const SecurityFeature = ({
|
|
19
|
+
icon,
|
|
20
|
+
title,
|
|
21
|
+
description,
|
|
22
|
+
}: {
|
|
23
|
+
icon: any;
|
|
24
|
+
title: string;
|
|
25
|
+
description: string;
|
|
26
|
+
}) => (
|
|
27
|
+
<Box
|
|
28
|
+
display="flex"
|
|
29
|
+
flexDirection="row"
|
|
30
|
+
gap="16px"
|
|
31
|
+
width="100%"
|
|
32
|
+
alignItems="flex-start"
|
|
33
|
+
>
|
|
34
|
+
<Icon
|
|
35
|
+
as={icon}
|
|
36
|
+
color="fg.muted"
|
|
37
|
+
width="20px"
|
|
38
|
+
height="20px"
|
|
39
|
+
marginTop="2px"
|
|
40
|
+
/>
|
|
41
|
+
<Box display="flex" flexDirection="column" gap="4px" flex="1">
|
|
42
|
+
<Box fontWeight="600" fontSize="14px" lineHeight="120%" color="fg">
|
|
43
|
+
{title}
|
|
44
|
+
</Box>
|
|
45
|
+
<Box
|
|
46
|
+
fontWeight="400"
|
|
47
|
+
fontSize="12px"
|
|
48
|
+
lineHeight="140%"
|
|
49
|
+
color="fg.subtle"
|
|
50
|
+
>
|
|
51
|
+
{description}
|
|
52
|
+
</Box>
|
|
53
|
+
</Box>
|
|
54
|
+
</Box>
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const ConfirmExchangeStep = ({ onConfirm }: { onConfirm: () => void }) => {
|
|
58
|
+
return (
|
|
59
|
+
<BodyWrapper>
|
|
60
|
+
<Box display="flex" justifyContent="center" width="100%">
|
|
61
|
+
<Box
|
|
62
|
+
height="48px"
|
|
63
|
+
width="48px"
|
|
64
|
+
backgroundColor="gray.200"
|
|
65
|
+
borderRadius="90%"
|
|
66
|
+
/>
|
|
67
|
+
</Box>
|
|
68
|
+
|
|
69
|
+
<Box
|
|
70
|
+
fontWeight="600"
|
|
71
|
+
fontSize="16px"
|
|
72
|
+
lineHeight="140%"
|
|
73
|
+
color="fg"
|
|
74
|
+
textAlign="center"
|
|
75
|
+
>
|
|
76
|
+
Enso Checkout uses a 3rd party to connect your Binance account.
|
|
77
|
+
</Box>
|
|
78
|
+
|
|
79
|
+
<Box display="flex" flexDirection="column" gap="12px" width="100%">
|
|
80
|
+
<SecurityFeature
|
|
81
|
+
icon={Handshake}
|
|
82
|
+
title="Your sign-in credentials are never stored"
|
|
83
|
+
description="All data is encrypted between enso and Binance"
|
|
84
|
+
/>
|
|
85
|
+
|
|
86
|
+
<SecurityFeature
|
|
87
|
+
icon={ShieldCheck}
|
|
88
|
+
title="2fa always required"
|
|
89
|
+
description="Transfers cannot be made without your approval."
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
<SecurityFeature
|
|
93
|
+
icon={Lock}
|
|
94
|
+
title="Assets never touch 3rd parties"
|
|
95
|
+
description="Your funds are transferred directly to your wallet."
|
|
96
|
+
/>
|
|
97
|
+
|
|
98
|
+
<Helper>
|
|
99
|
+
<Image src={LogoSvg} color={"gray"} w={"24px"}/>
|
|
100
|
+
Enso securely encrypts all user data.
|
|
101
|
+
</Helper>
|
|
102
|
+
</Box>
|
|
103
|
+
|
|
104
|
+
<Button onClick={onConfirm}>Continue to 3rd Party</Button>
|
|
105
|
+
</BodyWrapper>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export { ConfirmExchangeStep };
|
|
110
|
+
export default ConfirmExchangeStep;
|