@xswap-link/sdk 0.3.5 → 0.4.0
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/.eslintrc.json +9 -5
- package/CHANGELOG.md +10 -0
- package/README.md +2 -1
- package/dist/index.d.mts +106 -20
- package/dist/index.d.ts +106 -20
- package/dist/index.global.js +963 -164
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +105 -3564
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +105 -3534
- package/dist/index.mjs.map +1 -0
- package/nodemon.json +1 -1
- package/package.json +16 -9
- package/postcss.config.js +8 -1
- package/src/{components → assets}/icons/ArrowDownIcon.tsx +1 -2
- package/src/assets/icons/ArrowDownLongIcon.tsx +12 -0
- package/src/{components → assets}/icons/ArrowLeftIcon.tsx +1 -5
- package/src/{components → assets}/icons/ArrowRightIcon.tsx +1 -5
- package/src/assets/icons/ArrowUpIcon.tsx +12 -0
- package/src/{components → assets}/icons/ArrowUpRightIcon.tsx +1 -5
- package/src/assets/icons/CashbacklIcon.tsx +28 -0
- package/src/{components → assets}/icons/CheckIcon.tsx +1 -5
- package/src/assets/icons/ChevronDownIcon.tsx +12 -0
- package/src/assets/icons/ChevronUpIcon.tsx +7 -0
- package/src/{components → assets}/icons/CircularProgressIcon.tsx +1 -2
- package/src/assets/icons/CloseIcon.tsx +15 -0
- package/src/{components → assets}/icons/CoinsIcon.tsx +0 -2
- package/src/assets/icons/CopyIcon.tsx +15 -0
- package/src/assets/icons/DotGreenIcon.tsx +12 -0
- package/src/{components → assets}/icons/DownArrorIcon.tsx +0 -2
- package/src/{components → assets}/icons/ErrorIcon.tsx +0 -1
- package/src/assets/icons/ErrorModalStatusIcon.tsx +31 -0
- package/src/assets/icons/HelpIcon.tsx +21 -0
- package/src/assets/icons/HistoryGradientBgIcon.tsx +32 -0
- package/src/assets/icons/HistoryIcon.tsx +12 -0
- package/src/{components → assets}/icons/HourGlassIcon.tsx +1 -5
- package/src/assets/icons/Icon.tsx +5 -0
- package/src/{components → assets}/icons/InfoIcon.tsx +0 -1
- package/src/assets/icons/LinkExternalIcon.tsx +15 -0
- package/src/{components → assets}/icons/PercentageIcon.tsx +0 -1
- package/src/assets/icons/RankIcon.tsx +28 -0
- package/src/assets/icons/SettingsGradientBgIcon.tsx +32 -0
- package/src/assets/icons/SettingsIcon.tsx +12 -0
- package/src/{components → assets}/icons/SignIcon.tsx +0 -2
- package/src/{components → assets}/icons/SuccessIcon.tsx +0 -1
- package/src/assets/icons/SuccessModalStatusIcon.tsx +31 -0
- package/src/assets/icons/ThumbUpRoundedIcon.tsx +15 -0
- package/src/{components → assets}/icons/TimerIcon.tsx +0 -1
- package/src/assets/icons/TokensIcon.tsx +16 -0
- package/src/assets/icons/WaitingIcon.tsx +15 -0
- package/src/{components → assets}/icons/XMarkIcon.tsx +1 -5
- package/src/assets/icons/XPowerIcon.tsx +28 -0
- package/src/{components → assets}/icons/index.ts +16 -0
- package/src/components/Alert/index.tsx +1 -1
- package/src/components/Button/index.tsx +57 -0
- package/src/components/MessageBar/SnackMessage.tsx +32 -0
- package/src/components/MessageBar/index.tsx +44 -0
- package/src/components/Modal/index.tsx +52 -0
- package/src/components/PoweredBy/index.tsx +12 -0
- package/src/components/SafeInput/index.tsx +51 -0
- package/src/components/Skeleton/index.tsx +5 -9
- package/src/components/Spinner/index.tsx +6 -8
- package/src/components/Swap/Header/Controls/index.tsx +57 -0
- package/src/components/Swap/Header/index.tsx +16 -0
- package/src/components/Swap/HistoryView/index.tsx +34 -0
- package/src/components/Swap/SettingsView/Delivery/index.tsx +42 -0
- package/src/components/Swap/SettingsView/Slippage/index.tsx +80 -0
- package/src/components/Swap/SettingsView/index.tsx +11 -0
- package/src/components/Swap/SwapView/ConfirmationView/TxOverview/ArrowIcon.tsx +13 -0
- package/src/components/Swap/SwapView/ConfirmationView/TxOverview/Header/index.tsx +37 -0
- package/src/components/Swap/SwapView/ConfirmationView/TxOverview/Steps/index.tsx +145 -0
- package/src/components/Swap/SwapView/ConfirmationView/TxOverview/SwapPanel/index.tsx +61 -0
- package/src/components/Swap/SwapView/ConfirmationView/TxOverview/index.tsx +291 -0
- package/src/components/Swap/SwapView/ConfirmationView/TxResult/TokenItem/index.tsx +24 -0
- package/src/components/Swap/SwapView/ConfirmationView/TxResult/index.tsx +84 -0
- package/src/components/Swap/SwapView/ConfirmationView/index.tsx +17 -0
- package/src/components/Swap/SwapView/FeesPanel/DeliveryInfo/index.tsx +25 -0
- package/src/components/Swap/SwapView/FeesPanel/Fee/index.tsx +18 -0
- package/src/components/Swap/SwapView/FeesPanel/Fees/index.tsx +71 -0
- package/src/components/Swap/SwapView/FeesPanel/index.tsx +67 -0
- package/src/components/Swap/SwapView/SwapButton/index.tsx +154 -0
- package/src/components/Swap/SwapView/SwapPanel/AmountPanel/Balance/index.tsx +23 -0
- package/src/components/Swap/SwapView/SwapPanel/AmountPanel/index.tsx +56 -0
- package/src/components/Swap/SwapView/SwapPanel/ChainPanel/ChainPicker/ChainItem/index.tsx +70 -0
- package/src/components/Swap/SwapView/SwapPanel/ChainPanel/ChainPicker/index.tsx +62 -0
- package/src/components/Swap/SwapView/SwapPanel/ChainPanel/index.tsx +74 -0
- package/src/components/Swap/SwapView/SwapPanel/MaxPanel/index.tsx +35 -0
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/QuickPickTokenItem/index.tsx +40 -0
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/TokenItem/index.tsx +62 -0
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/index.tsx +399 -0
- package/src/components/Swap/SwapView/SwapPanel/TokenPanel/index.tsx +104 -0
- package/src/components/Swap/SwapView/SwapPanel/index.tsx +42 -0
- package/src/components/Swap/SwapView/index.tsx +20 -0
- package/src/components/Swap/index.tsx +34 -0
- package/src/components/TextInput/index.tsx +67 -0
- package/src/components/Timer/index.tsx +57 -0
- package/src/components/ToggleButton/index.tsx +24 -0
- package/src/components/{UnknownTokenLogo/UnknownTokenLogo.tsx → TokenLogo/Unknown/index.tsx} +3 -4
- package/src/components/TokenLogo/WithChain/index.tsx +34 -0
- package/src/components/TokenLogo/index.tsx +22 -0
- package/src/components/Tooltip/index.tsx +108 -0
- package/src/components/TxConfigForm/index.tsx +63 -42
- package/src/components/TxDataCard/TokenDetails/index.tsx +30 -0
- package/src/components/TxDataCard/TxDataCardUI/index.tsx +133 -0
- package/src/components/TxDataCard/index.tsx +30 -0
- package/src/components/TxStatusButton/index.tsx +64 -108
- package/src/components/global.css +115 -4
- package/src/components/index.ts +18 -1
- package/src/config/fonts.ts +114 -0
- package/src/config/global.d.ts +4 -0
- package/src/config/init.tsx +35 -31
- package/src/constants/crosschainEstimationTimes.ts +52 -0
- package/src/constants/index.ts +8 -0
- package/src/context/GlobalDataProvider.tsx +165 -0
- package/src/context/HistoryProvider.tsx +339 -0
- package/src/context/ModalProvider.tsx +47 -0
- package/src/context/SwapProvider.tsx +664 -0
- package/src/context/TransactionProvider.tsx +86 -0
- package/src/context/TxUIWrapper.tsx +388 -0
- package/src/context/index.ts +5 -0
- package/src/contracts/abi/CustomXSwapRouter.json +953 -0
- package/src/contracts/abi/StakingStableAPR.json +1438 -0
- package/src/contracts/abi/XSwapRouter.json +1242 -0
- package/src/contracts/abi/XSwapTokenFeeDistributor.json +350 -0
- package/src/contracts/abi/index.ts +8 -0
- package/src/contracts/addresses.ts +24 -6
- package/src/fonts/Satoshi-Black.woff2 +0 -0
- package/src/fonts/Satoshi-BlackItalic.woff2 +0 -0
- package/src/fonts/Satoshi-Bold.woff2 +0 -0
- package/src/fonts/Satoshi-BoldItalic.woff2 +0 -0
- package/src/fonts/Satoshi-Light.woff2 +0 -0
- package/src/fonts/Satoshi-LightItalic.woff2 +0 -0
- package/src/fonts/Satoshi-Medium.woff2 +0 -0
- package/src/fonts/Satoshi-MediumItalic.woff2 +0 -0
- package/src/fonts/Satoshi-Regular.woff2 +0 -0
- package/src/fonts/Satoshi-RegularItalic.woff2 +0 -0
- package/src/fonts/Satoshi-Variable.woff2 +0 -0
- package/src/fonts/Satoshi-VariableItalic.woff2 +0 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/networkManagement/clientToSigner.tsx +17 -0
- package/src/hooks/networkManagement/useNetworks.ts +51 -0
- package/src/hooks/useBatchQuery.ts +46 -0
- package/src/hooks/useDebounce.tsx +28 -0
- package/src/hooks/useEvmContractApi.ts +85 -0
- package/src/hooks/usePortal.ts +79 -0
- package/src/hooks/useXPower.ts +58 -0
- package/src/models/Addresses.ts +8 -2
- package/src/models/TokenData.ts +13 -0
- package/src/models/TransactionHistory.ts +2 -0
- package/src/models/TxUIWrapper.ts +51 -0
- package/src/models/XSwapConfig.ts +1 -0
- package/src/models/index.ts +1 -0
- package/src/models/payloads/GetBalancesPayload.ts +3 -0
- package/src/models/payloads/GetFinishedLeaderboardQuestsPayload.ts +3 -0
- package/src/models/payloads/GetLeaderboardChangePayload.ts +4 -0
- package/src/models/payloads/{GetSwapTxPayload.ts → ModalIntegrationPayload.ts} +3 -1
- package/src/models/payloads/index.ts +5 -2
- package/src/services/api.ts +34 -5
- package/src/services/integrations/monitoring.ts +49 -37
- package/src/services/integrations/transactions.ts +50 -6
- package/src/utils/contracts.ts +29 -0
- package/src/utils/index.ts +3 -3
- package/src/utils/numbers.ts +14 -0
- package/src/utils/parseWeb3Error.ts +7 -3
- package/tailwind.config.js +15 -5
- package/tsconfig.json +7 -7
- package/tsup.config.ts +61 -0
- package/xswap.config.ts +1 -0
- package/dist/index.css +0 -1
- package/src/components/TxConfigForm/BalanceComponent.tsx +0 -52
- package/src/components/TxConfigForm/Button.tsx +0 -20
- package/src/components/TxConfigForm/ChainListElement.tsx +0 -36
- package/src/components/TxConfigForm/ConfirmationAmount.tsx +0 -91
- package/src/components/TxConfigForm/ConfirmationView/ErrorView.tsx +0 -38
- package/src/components/TxConfigForm/ConfirmationView/SuccessView.tsx +0 -159
- package/src/components/TxConfigForm/ConfirmationView/index.tsx +0 -149
- package/src/components/TxConfigForm/ConnectWalletPrompt.tsx +0 -21
- package/src/components/TxConfigForm/Description.tsx +0 -17
- package/src/components/TxConfigForm/ErrorField.tsx +0 -19
- package/src/components/TxConfigForm/FeesDetails.tsx +0 -117
- package/src/components/TxConfigForm/Form.tsx +0 -574
- package/src/components/TxConfigForm/History.tsx +0 -131
- package/src/components/TxConfigForm/HistoryCard.tsx +0 -182
- package/src/components/TxConfigForm/PoweredBy.tsx +0 -12
- package/src/components/TxConfigForm/Settings.tsx +0 -143
- package/src/components/TxConfigForm/Summary.tsx +0 -105
- package/src/components/TxConfigForm/SwapPanel.tsx +0 -185
- package/src/components/TxConfigForm/TokenPicker.tsx +0 -176
- package/src/components/TxConfigForm/TopBar.tsx +0 -58
- package/src/components/TxConfigForm/UsdPrice.tsx +0 -44
- package/src/components/icons/ChevronDownIcon.tsx +0 -15
- package/src/components/icons/ChevronUpIcon.tsx +0 -10
- package/src/components/icons/CloseIcon.tsx +0 -15
- package/src/components/icons/HistoryIcon.tsx +0 -16
- package/src/components/icons/SettingsIcon.tsx +0 -16
- /package/src/{components → assets}/icons/ChainlinkCCIPIcon.tsx +0 -0
- /package/src/{components → assets}/icons/SearchIcon.tsx +0 -0
- /package/src/{components → assets}/icons/XSwapBadgeIcon.tsx +0 -0
- /package/src/{components → assets}/icons/XSwapLogo.tsx +0 -0
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { ethers } from "ethers";
|
|
2
|
-
import React, { FC } from "react";
|
|
3
|
-
import {
|
|
4
|
-
ArrowDownIcon,
|
|
5
|
-
CheckIcon,
|
|
6
|
-
CloseIcon,
|
|
7
|
-
SignIcon,
|
|
8
|
-
} from "@src/components/icons";
|
|
9
|
-
import { Spinner } from "@src/components/Spinner";
|
|
10
|
-
import { ConfirmationAmount } from "../ConfirmationAmount";
|
|
11
|
-
import { Chain, Route, Token } from "@src/models";
|
|
12
|
-
import { ErrorView } from "./ErrorView";
|
|
13
|
-
import { SuccessView } from "./SuccessView";
|
|
14
|
-
|
|
15
|
-
interface Props {
|
|
16
|
-
txError: string | null;
|
|
17
|
-
onClose: () => void;
|
|
18
|
-
txSuccessHash?: string;
|
|
19
|
-
srcChain?: Chain;
|
|
20
|
-
dstChain?: Chain;
|
|
21
|
-
isExpressDelivery: boolean;
|
|
22
|
-
srcToken?: Token;
|
|
23
|
-
amount: string;
|
|
24
|
-
dstDisplayToken?: Token;
|
|
25
|
-
dstToken?: Token;
|
|
26
|
-
route?: Route;
|
|
27
|
-
supportedChains: Chain[];
|
|
28
|
-
approveTxLoading: boolean;
|
|
29
|
-
approveTxDone: boolean;
|
|
30
|
-
txLoading: boolean;
|
|
31
|
-
}
|
|
32
|
-
export const ConfirmationView: FC<Props> = ({
|
|
33
|
-
txError,
|
|
34
|
-
onClose,
|
|
35
|
-
txSuccessHash,
|
|
36
|
-
srcChain,
|
|
37
|
-
dstChain,
|
|
38
|
-
isExpressDelivery,
|
|
39
|
-
srcToken,
|
|
40
|
-
amount,
|
|
41
|
-
dstDisplayToken,
|
|
42
|
-
dstToken,
|
|
43
|
-
route,
|
|
44
|
-
supportedChains,
|
|
45
|
-
approveTxLoading,
|
|
46
|
-
approveTxDone,
|
|
47
|
-
txLoading,
|
|
48
|
-
}) => {
|
|
49
|
-
return (
|
|
50
|
-
<div className="xpay-flex xpay-flex-col xpay-gap-2 xpay-z-10 xpay-my-0 xpay-p-2 md:xpay-p-4 xpay-rounded-3xl xpay-overflow-hidden xpay-font-light sm:xpay-w-x_desktop xpay-w-screen">
|
|
51
|
-
{txError ? (
|
|
52
|
-
<ErrorView txError={txError} onClose={onClose} />
|
|
53
|
-
) : txSuccessHash ? (
|
|
54
|
-
<SuccessView
|
|
55
|
-
onClose={onClose}
|
|
56
|
-
isExpressDelivery={isExpressDelivery}
|
|
57
|
-
amount={amount}
|
|
58
|
-
supportedChains={supportedChains}
|
|
59
|
-
txSuccessHash={txSuccessHash}
|
|
60
|
-
srcChain={srcChain}
|
|
61
|
-
dstChain={dstChain}
|
|
62
|
-
srcToken={srcToken}
|
|
63
|
-
dstDisplayToken={dstDisplayToken}
|
|
64
|
-
dstToken={dstToken}
|
|
65
|
-
route={route}
|
|
66
|
-
/>
|
|
67
|
-
) : (
|
|
68
|
-
// Tx Confirmation modal
|
|
69
|
-
<>
|
|
70
|
-
<div className="xpay-flex xpay-w-full xpay-justify-between xpay-items-center xpay-mx-auto xpay-p-2 xpay-font-light ">
|
|
71
|
-
<p className="xpay-text-white xpay-text-xl">Confirmation</p>
|
|
72
|
-
<div className="xpay-flex xpay-w-full xpay-justify-end xpay-items-center xpay-mx-auto xpay-p-2">
|
|
73
|
-
<div
|
|
74
|
-
className="xpay-cursor-pointer xpay-text-white"
|
|
75
|
-
onClick={onClose}
|
|
76
|
-
>
|
|
77
|
-
<CloseIcon />
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<div className="xpay-flex xpay-flex-col xpay-gap-2">
|
|
83
|
-
<ConfirmationAmount
|
|
84
|
-
amount={ethers.utils
|
|
85
|
-
.parseUnits(amount, srcToken?.decimals)
|
|
86
|
-
.toString()}
|
|
87
|
-
chain={srcChain}
|
|
88
|
-
token={srcToken}
|
|
89
|
-
type="src"
|
|
90
|
-
/>
|
|
91
|
-
</div>
|
|
92
|
-
|
|
93
|
-
<div className="xpay-flex xpay-justify-center xpay-globalBorder xpay-rounded-xl xpay-p-[5px] xpay--mt-7 xpay--mb-6 ">
|
|
94
|
-
<div className="xpay-flex xpay-items-center xpay-justify-center xpay-rounded-lg xpay-w-8 xpay-h-8 xpay-bg-gradient-to-l xpay-from-[rgba(54,129,198,1)] xpay-to-[rgba(43,74,157,1)] ">
|
|
95
|
-
<ArrowDownIcon />
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
|
|
99
|
-
<div className="xpay-flex xpay-flex-col xpay-gap-2">
|
|
100
|
-
<ConfirmationAmount
|
|
101
|
-
amount={route?.estAmountOut || "0"}
|
|
102
|
-
chain={dstChain}
|
|
103
|
-
token={dstDisplayToken ? dstDisplayToken : dstToken}
|
|
104
|
-
type="dst"
|
|
105
|
-
/>
|
|
106
|
-
</div>
|
|
107
|
-
<div className="xpay-flex xpay-flex-col xpay-globalBorder xpay-p-4 xpay-justify-center xpay-rounded-xl xpay-bg-[rgba(15,15,15,1)] xpay-relative">
|
|
108
|
-
{route?.transactions.approve && (
|
|
109
|
-
<>
|
|
110
|
-
<div className="xpay-flex xpay-justify-between xpay-items-center">
|
|
111
|
-
<div className="xpay-flex xpay-items-center xpay-gap-2">
|
|
112
|
-
<SignIcon />
|
|
113
|
-
<p className="xpay-opacity-50">
|
|
114
|
-
{approveTxLoading
|
|
115
|
-
? "Wait for approval confirmation"
|
|
116
|
-
: "Approve token spending"}
|
|
117
|
-
</p>
|
|
118
|
-
</div>
|
|
119
|
-
<div className="xpay-flex xpay-items-center">
|
|
120
|
-
{approveTxLoading && <Spinner width="5" height="5" />}
|
|
121
|
-
{approveTxDone && (
|
|
122
|
-
<div className="xpay-text-x_green xpay-w-5 xpay-h-5">
|
|
123
|
-
<CheckIcon />
|
|
124
|
-
</div>
|
|
125
|
-
)}
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
<div className="xpay-w-px xpay-h-6 xpay-mt-1 xpay-mb-1 xpay-ml-2.5 xpay-bg-white xpay-opacity-50"></div>
|
|
129
|
-
</>
|
|
130
|
-
)}
|
|
131
|
-
<div className="xpay-flex xpay-justify-between xpay-items-center">
|
|
132
|
-
<div className="xpay-flex xpay-items-center xpay-gap-2">
|
|
133
|
-
<SignIcon />
|
|
134
|
-
<p className="xpay-opacity-50">
|
|
135
|
-
{txLoading
|
|
136
|
-
? "Wait for transaction confirmation"
|
|
137
|
-
: "Confirm transaction"}
|
|
138
|
-
</p>
|
|
139
|
-
</div>
|
|
140
|
-
<div className="xpay-flex xpay-items-center">
|
|
141
|
-
{txLoading && <Spinner width="5" height="5" />}
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
</div>
|
|
145
|
-
</>
|
|
146
|
-
)}
|
|
147
|
-
</div>
|
|
148
|
-
);
|
|
149
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { FC } from "react";
|
|
3
|
-
import { CloseIcon } from "../icons";
|
|
4
|
-
|
|
5
|
-
type Props = {
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
};
|
|
8
|
-
export const ConnectWalletPrompt: FC<Props> = ({ onClose }) => {
|
|
9
|
-
return (
|
|
10
|
-
<div className="xpay-flex xpay-flex-col xpay-gap-2 xpay-z-10 xpay-my-0 xpay-p-2 md:xpay-p-4 xpay-rounded-3xl xpay-overflow-hidden xpay-font-light sm:xpay-w-x_desktop xpay-w-screen">
|
|
11
|
-
<div className="xpay-flex xpay-w-full xpay-justify-end xpay-items-center xpay-mx-auto xpay-p-2">
|
|
12
|
-
<div className="xpay-cursor-pointer xpay-text-white" onClick={onClose}>
|
|
13
|
-
<CloseIcon />
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
<p className="xpay-text-xl xpay-font-bold xpay-leading-8 xpay-text-center xpay-text-white">
|
|
17
|
-
Please connect the wallet first.
|
|
18
|
-
</p>
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
21
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React, { FC } from "react";
|
|
2
|
-
|
|
3
|
-
interface Props {
|
|
4
|
-
description: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const Description: FC<Props> = ({ description }) => {
|
|
8
|
-
return (
|
|
9
|
-
<div className="xpay-flex xpay-flex-col xpay-gap-3 xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-2 sm:xpay-p-4 ">
|
|
10
|
-
<div className="xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-text-xs sm:xpay-text-sm">
|
|
11
|
-
<div className="xpay-flex xpay-items-center xpay-gap-1 xpay-font-medium xpay-text-white xpay-opacity-60">
|
|
12
|
-
{description}
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React, { FC } from "react";
|
|
2
|
-
|
|
3
|
-
interface Props {
|
|
4
|
-
error: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const ErrorField: FC<Props> = ({ error }) => {
|
|
8
|
-
return (
|
|
9
|
-
<div
|
|
10
|
-
className={`xpay-flex xpay-justify-center xpay-mb-1 xpay-items-center xpay-w-full xpay-rounded-2xl xpay-bg-x_error_background xpay-border xpay-border-solid ${
|
|
11
|
-
error.length > 0
|
|
12
|
-
? "xpay-border-x_error_border"
|
|
13
|
-
: "xpay-border-transparent"
|
|
14
|
-
}`}
|
|
15
|
-
>
|
|
16
|
-
{error}
|
|
17
|
-
</div>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { FC, useMemo } from "react";
|
|
2
|
-
import { CoinsIcon, TimerIcon, ChevronUpIcon, ChevronDownIcon } from "../icons";
|
|
3
|
-
import { safeBigNumberFrom, weiToHumanReadable } from "@src/utils";
|
|
4
|
-
import { Route, Token } from "@src/models";
|
|
5
|
-
import { Skeleton } from "@src/components";
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
route: Route | undefined;
|
|
9
|
-
isGettingRoute: boolean;
|
|
10
|
-
paymentToken: Token | undefined;
|
|
11
|
-
dstToken: Token | undefined;
|
|
12
|
-
slippage: string | undefined;
|
|
13
|
-
feesDetailsShown: boolean;
|
|
14
|
-
isExpressDelivery: boolean;
|
|
15
|
-
setFeesDetailsShown: React.Dispatch<React.SetStateAction<boolean>>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const FeesDetails: FC<Props> = ({
|
|
19
|
-
isGettingRoute,
|
|
20
|
-
route,
|
|
21
|
-
paymentToken,
|
|
22
|
-
dstToken,
|
|
23
|
-
slippage,
|
|
24
|
-
feesDetailsShown,
|
|
25
|
-
isExpressDelivery,
|
|
26
|
-
setFeesDetailsShown,
|
|
27
|
-
}) => {
|
|
28
|
-
return (
|
|
29
|
-
<div className="xpay-flex xpay-flex-col xpay-gap-3 xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-2 sm:xpay-p-4 ">
|
|
30
|
-
<div className="xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-text-xs sm:xpay-text-sm">
|
|
31
|
-
<div className="xpay-flex xpay-items-center xpay-gap-1 xpay-font-medium xpay-text-white xpay-opacity-60">
|
|
32
|
-
<CoinsIcon />
|
|
33
|
-
<div className="xpay-mr-1">Fees:</div>
|
|
34
|
-
{isGettingRoute ? (
|
|
35
|
-
<Skeleton width="xpay-w-20" height="xpay-h-4" />
|
|
36
|
-
) : (
|
|
37
|
-
` ${weiToHumanReadable({
|
|
38
|
-
amount: safeBigNumberFrom(
|
|
39
|
-
route?.xSwapFees.xSwapFee.nativeFee || "0",
|
|
40
|
-
)
|
|
41
|
-
.add(safeBigNumberFrom(route?.xSwapFees.ccipFee || "0"))
|
|
42
|
-
.add(
|
|
43
|
-
safeBigNumberFrom(route?.xSwapFees.expressDeliveryFee || "0"),
|
|
44
|
-
)
|
|
45
|
-
.toString(),
|
|
46
|
-
decimals: 18,
|
|
47
|
-
precisionFractionalPlaces: 5,
|
|
48
|
-
})} ${paymentToken?.symbol}`
|
|
49
|
-
)}
|
|
50
|
-
</div>
|
|
51
|
-
<div className="xpay-flex xpay-gap-1 xpay-items-center">
|
|
52
|
-
{route?.xSwapFees.expressDeliveryFee && !isGettingRoute && (
|
|
53
|
-
<div
|
|
54
|
-
className={`xpay-flex xpay-gap-1 xpay-items-center xpay-font-medium ${
|
|
55
|
-
isExpressDelivery
|
|
56
|
-
? "xpay-text-x_green"
|
|
57
|
-
: "xpay-text-white xpay-opacity-60"
|
|
58
|
-
}`}
|
|
59
|
-
>
|
|
60
|
-
<TimerIcon />
|
|
61
|
-
{isExpressDelivery ? "Fast ~ 30sec " : "Normal ~ 30min"}
|
|
62
|
-
</div>
|
|
63
|
-
)}
|
|
64
|
-
<div
|
|
65
|
-
onClick={() => setFeesDetailsShown((x) => !x)}
|
|
66
|
-
className="xpay-font-medium xpay-text-white xpay-opacity-60 xpay-cursor-pointer xpay-flex xpay-items-center xpay-w-[15px] xpay-h-[9px]"
|
|
67
|
-
>
|
|
68
|
-
{feesDetailsShown ? <ChevronUpIcon /> : <ChevronDownIcon />}
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
|
-
{feesDetailsShown && (
|
|
73
|
-
<div className="xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-gap-2">
|
|
74
|
-
<div className="xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1">
|
|
75
|
-
<div className="xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1">
|
|
76
|
-
<div>CCIP Fee:</div>
|
|
77
|
-
<div className="xpay-whitespace-nowrap">
|
|
78
|
-
{` ${weiToHumanReadable({
|
|
79
|
-
amount: route?.xSwapFees.ccipFee || "0",
|
|
80
|
-
decimals: 18,
|
|
81
|
-
precisionFractionalPlaces: 5,
|
|
82
|
-
})} ${paymentToken?.symbol}`}
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
<div className="xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1">
|
|
86
|
-
<div>Native Fee:</div>
|
|
87
|
-
<div className="xpay-whitespace-nowrap">
|
|
88
|
-
{` ${weiToHumanReadable({
|
|
89
|
-
amount: route?.xSwapFees.xSwapFee.nativeFee || "0",
|
|
90
|
-
decimals: 18,
|
|
91
|
-
precisionFractionalPlaces: 5,
|
|
92
|
-
})} ${paymentToken?.symbol}`}
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
<div className="xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1">
|
|
97
|
-
<div className="xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1">
|
|
98
|
-
<div>Slippage:</div>
|
|
99
|
-
<div className="xpay-whitespace-nowrap">{`${slippage}%`}</div>
|
|
100
|
-
</div>
|
|
101
|
-
<div className="xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1">
|
|
102
|
-
<div>Min amount out:</div>
|
|
103
|
-
<div className="xpay-whitespace-nowrap">
|
|
104
|
-
{weiToHumanReadable({
|
|
105
|
-
amount: route?.minAmountOut || "0",
|
|
106
|
-
decimals: dstToken?.decimals || 18,
|
|
107
|
-
precisionFractionalPlaces: 5,
|
|
108
|
-
})}{" "}
|
|
109
|
-
{dstToken?.symbol}
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
|
-
)}
|
|
115
|
-
</div>
|
|
116
|
-
);
|
|
117
|
-
};
|