@xswap-link/sdk 0.3.5 → 0.4.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/.eslintrc.json +9 -5
- package/CHANGELOG.md +16 -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 +856 -307
- 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 +62 -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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const SuccessModalStatusIcon = () => {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
width="81"
|
|
5
|
+
height="80"
|
|
6
|
+
viewBox="0 0 81 80"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<g id="check_circle_FILL0_wght400_GRAD0_opsz24 (1) 1">
|
|
10
|
+
<path
|
|
11
|
+
id="Vector"
|
|
12
|
+
d="M35.8334 55.3332L59.3334 31.8332L54.6667 27.1665L35.8334 45.9998L26.3334 36.4998L21.6667 41.1665L35.8334 55.3332ZM40.5001 73.3332C35.889 73.3332 31.5556 72.4582 27.5001 70.7082C23.4445 68.9582 19.9167 66.5832 16.9167 63.5832C13.9167 60.5832 11.5417 57.0554 9.79175 52.9998C8.04175 48.9443 7.16675 44.6109 7.16675 39.9998C7.16675 35.3887 8.04175 31.0554 9.79175 26.9998C11.5417 22.9443 13.9167 19.4165 16.9167 16.4165C19.9167 13.4165 23.4445 11.0415 27.5001 9.2915C31.5556 7.5415 35.889 6.6665 40.5001 6.6665C45.1112 6.6665 49.4445 7.5415 53.5001 9.2915C57.5556 11.0415 61.0834 13.4165 64.0834 16.4165C67.0834 19.4165 69.4584 22.9443 71.2084 26.9998C72.9584 31.0554 73.8334 35.3887 73.8334 39.9998C73.8334 44.6109 72.9584 48.9443 71.2084 52.9998C69.4584 57.0554 67.0834 60.5832 64.0834 63.5832C61.0834 66.5832 57.5556 68.9582 53.5001 70.7082C49.4445 72.4582 45.1112 73.3332 40.5001 73.3332ZM40.5001 66.6665C47.9445 66.6665 54.2501 64.0832 59.4167 58.9165C64.5834 53.7498 67.1667 47.4443 67.1667 39.9998C67.1667 32.5554 64.5834 26.2498 59.4167 21.0832C54.2501 15.9165 47.9445 13.3332 40.5001 13.3332C33.0556 13.3332 26.7501 15.9165 21.5834 21.0832C16.4167 26.2498 13.8334 32.5554 13.8334 39.9998C13.8334 47.4443 16.4167 53.7498 21.5834 58.9165C26.7501 64.0832 33.0556 66.6665 40.5001 66.6665Z"
|
|
13
|
+
fill="url(#paint0_linear_230_393)"
|
|
14
|
+
/>
|
|
15
|
+
</g>
|
|
16
|
+
<defs>
|
|
17
|
+
<linearGradient
|
|
18
|
+
id="paint0_linear_230_393"
|
|
19
|
+
x1="7.16675"
|
|
20
|
+
y1="6.6665"
|
|
21
|
+
x2="77.4571"
|
|
22
|
+
y2="10.7355"
|
|
23
|
+
gradientUnits="userSpaceOnUse"
|
|
24
|
+
>
|
|
25
|
+
<stop stopColor="#4CAF50" />
|
|
26
|
+
<stop offset="1" stopColor="#2E7D32" />
|
|
27
|
+
</linearGradient>
|
|
28
|
+
</defs>
|
|
29
|
+
</svg>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const ThumbUpRoundedIcon = () => {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
width="20"
|
|
5
|
+
height="20"
|
|
6
|
+
viewBox="0 0 20 20"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M7 16H12.5C12.7833 16 13.0458 15.9292 13.2875 15.7875C13.5292 15.6458 13.7 15.45 13.8 15.2L15.9 10.3C15.9333 10.2167 15.9583 10.1333 15.975 10.05C15.9917 9.96667 16 9.88333 16 9.8V9C16 8.71667 15.9042 8.47917 15.7125 8.2875C15.5208 8.09583 15.2833 8 15 8H10.4L11 4.6C11.0333 4.43333 11.025 4.275 10.975 4.125C10.925 3.975 10.8417 3.84167 10.725 3.725L10 3L5.4 8C5.26667 8.13333 5.16667 8.28333 5.1 8.45C5.03333 8.61667 5 8.8 5 9V14C5 14.55 5.19583 15.0208 5.5875 15.4125C5.97917 15.8042 6.45 16 7 16ZM10 20C8.61667 20 7.31667 19.7375 6.1 19.2125C4.88333 18.6875 3.825 17.975 2.925 17.075C2.025 16.175 1.3125 15.1167 0.7875 13.9C0.2625 12.6833 0 11.3833 0 10C0 8.61667 0.2625 7.31667 0.7875 6.1C1.3125 4.88333 2.025 3.825 2.925 2.925C3.825 2.025 4.88333 1.3125 6.1 0.7875C7.31667 0.2625 8.61667 0 10 0C11.3833 0 12.6833 0.2625 13.9 0.7875C15.1167 1.3125 16.175 2.025 17.075 2.925C17.975 3.825 18.6875 4.88333 19.2125 6.1C19.7375 7.31667 20 8.61667 20 10C20 11.3833 19.7375 12.6833 19.2125 13.9C18.6875 15.1167 17.975 16.175 17.075 17.075C16.175 17.975 15.1167 18.6875 13.9 19.2125C12.6833 19.7375 11.3833 20 10 20ZM10 18C12.2333 18 14.125 17.225 15.675 15.675C17.225 14.125 18 12.2333 18 10C18 7.76667 17.225 5.875 15.675 4.325C14.125 2.775 12.2333 2 10 2C7.76667 2 5.875 2.775 4.325 4.325C2.775 5.875 2 7.76667 2 10C2 12.2333 2.775 14.125 4.325 15.675C5.875 17.225 7.76667 18 10 18Z"
|
|
11
|
+
fill="#FFFFFF"
|
|
12
|
+
/>
|
|
13
|
+
</svg>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
@@ -7,7 +7,6 @@ export const TimerIcon = () => {
|
|
|
7
7
|
height="16"
|
|
8
8
|
viewBox="0 -960 960 960"
|
|
9
9
|
width="16"
|
|
10
|
-
fill="currentColor"
|
|
11
10
|
>
|
|
12
11
|
<path d="M360-840v-80h240v80H360Zm80 440h80v-240h-80v240Zm40 320q-74 0-139.5-28.5T226-186q-49-49-77.5-114.5T120-440q0-74 28.5-139.5T226-694q49-49 114.5-77.5T480-800q62 0 119 20t107 58l56-56 56 56-56 56q38 50 58 107t20 119q0 74-28.5 139.5T734-186q-49 49-114.5 77.5T480-80Zm0-80q116 0 198-82t82-198q0-116-82-198t-198-82q-116 0-198 82t-82 198q0 116 82 198t198 82Zm0-280Z" />
|
|
13
12
|
</svg>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const TokensIcon = () => {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
width="18"
|
|
5
|
+
height="18"
|
|
6
|
+
viewBox="0 0 18 18"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M11.5 15C9.825 15 8.40625 14.4188 7.24375 13.2563C6.08125 12.0938 5.5 10.675 5.5 9C5.5 7.325 6.08125 5.90625 7.24375 4.74375C8.40625 3.58125 9.825 3 11.5 3C13.175 3 14.5938 3.58125 15.7563 4.74375C16.9188 5.90625 17.5 7.325 17.5 9C17.5 10.675 16.9188 12.0938 15.7563 13.2563C14.5938 14.4188 13.175 15 11.5 15ZM5.5 14.8125C4.175 14.4625 3.09375 13.75 2.25625 12.675C1.41875 11.6 1 10.375 1 9C1 7.625 1.41875 6.4 2.25625 5.325C3.09375 4.25 4.175 3.5375 5.5 3.1875V4.7625C4.6 5.075 3.875 5.61875 3.325 6.39375C2.775 7.16875 2.5 8.0375 2.5 9C2.5 9.9625 2.775 10.8313 3.325 11.6063C3.875 12.3813 4.6 12.925 5.5 13.2375V14.8125ZM11.5 13.5C12.75 13.5 13.8125 13.0625 14.6875 12.1875C15.5625 11.3125 16 10.25 16 9C16 7.75 15.5625 6.6875 14.6875 5.8125C13.8125 4.9375 12.75 4.5 11.5 4.5C10.25 4.5 9.1875 4.9375 8.3125 5.8125C7.4375 6.6875 7 7.75 7 9C7 10.25 7.4375 11.3125 8.3125 12.1875C9.1875 13.0625 10.25 13.5 11.5 13.5Z"
|
|
11
|
+
fill="white"
|
|
12
|
+
fillOpacity="0.6"
|
|
13
|
+
/>
|
|
14
|
+
</svg>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const WaitingIcon = () => {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
width="16"
|
|
5
|
+
height="16"
|
|
6
|
+
viewBox="0 0 16 16"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M8 16C5.76667 16 3.875 15.225 2.325 13.675C0.775 12.125 0 10.2333 0 8C0 5.76667 0.775 3.875 2.325 2.325C3.875 0.775 5.76667 0 8 0C9.15 0 10.25 0.2375 11.3 0.7125C12.35 1.1875 13.25 1.86667 14 2.75V0H16V7H9V5H13.2C12.6667 4.06667 11.9375 3.33333 11.0125 2.8C10.0875 2.26667 9.08333 2 8 2C6.33333 2 4.91667 2.58333 3.75 3.75C2.58333 4.91667 2 6.33333 2 8C2 9.66667 2.58333 11.0833 3.75 12.25C4.91667 13.4167 6.33333 14 8 14C9.28333 14 10.4417 13.6333 11.475 12.9C12.5083 12.1667 13.2333 11.2 13.65 10H15.75C15.2833 11.7667 14.3333 13.2083 12.9 14.325C11.4667 15.4417 9.83333 16 8 16Z"
|
|
11
|
+
fill="#3681C6"
|
|
12
|
+
/>
|
|
13
|
+
</svg>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
export const XMarkIcon = () => {
|
|
2
2
|
return (
|
|
3
|
-
<svg
|
|
4
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
-
viewBox="0 0 384 512"
|
|
6
|
-
fill="current"
|
|
7
|
-
>
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512">
|
|
8
4
|
<path d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z" />
|
|
9
5
|
</svg>
|
|
10
6
|
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const XPowerIcon = () => {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
width="20"
|
|
5
|
+
height="20"
|
|
6
|
+
viewBox="0 0 20 20"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M6 16L10 12.95L14 16L12.5 11.05L16.5 8.2H11.6L10 3L8.4 8.2H3.5L7.5 11.05L6 16ZM10 20C8.61667 20 7.31667 19.7375 6.1 19.2125C4.88333 18.6875 3.825 17.975 2.925 17.075C2.025 16.175 1.3125 15.1167 0.7875 13.9C0.2625 12.6833 0 11.3833 0 10C0 8.61667 0.2625 7.31667 0.7875 6.1C1.3125 4.88333 2.025 3.825 2.925 2.925C3.825 2.025 4.88333 1.3125 6.1 0.7875C7.31667 0.2625 8.61667 0 10 0C11.3833 0 12.6833 0.2625 13.9 0.7875C15.1167 1.3125 16.175 2.025 17.075 2.925C17.975 3.825 18.6875 4.88333 19.2125 6.1C19.7375 7.31667 20 8.61667 20 10C20 11.3833 19.7375 12.6833 19.2125 13.9C18.6875 15.1167 17.975 16.175 17.075 17.075C16.175 17.975 15.1167 18.6875 13.9 19.2125C12.6833 19.7375 11.3833 20 10 20ZM10 18C12.2333 18 14.125 17.225 15.675 15.675C17.225 14.125 18 12.2333 18 10C18 7.76667 17.225 5.875 15.675 4.325C14.125 2.775 12.2333 2 10 2C7.76667 2 5.875 2.775 4.325 4.325C2.775 5.875 2 7.76667 2 10C2 12.2333 2.775 14.125 4.325 15.675C5.875 17.225 7.76667 18 10 18Z"
|
|
11
|
+
fill="url(#paint0_linear_184_1614)"
|
|
12
|
+
/>
|
|
13
|
+
<defs>
|
|
14
|
+
<linearGradient
|
|
15
|
+
id="paint0_linear_184_1614"
|
|
16
|
+
x1="0"
|
|
17
|
+
y1="0"
|
|
18
|
+
x2="21.0871"
|
|
19
|
+
y2="1.22071"
|
|
20
|
+
gradientUnits="userSpaceOnUse"
|
|
21
|
+
>
|
|
22
|
+
<stop stopColor="#3681C6" />
|
|
23
|
+
<stop offset="1" stopColor="#2B4A9D" />
|
|
24
|
+
</linearGradient>
|
|
25
|
+
</defs>
|
|
26
|
+
</svg>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./ArrowRightIcon";
|
|
2
2
|
export * from "./ArrowDownIcon";
|
|
3
|
+
export * from "./ArrowDownLongIcon";
|
|
3
4
|
export * from "./ArrowLeftIcon";
|
|
4
5
|
export * from "./ArrowUpRightIcon";
|
|
5
6
|
export * from "./CheckIcon";
|
|
@@ -9,6 +10,7 @@ export * from "./CircularProgressIcon";
|
|
|
9
10
|
export * from "./CloseIcon";
|
|
10
11
|
export * from "./CoinsIcon";
|
|
11
12
|
export * from "./DownArrorIcon";
|
|
13
|
+
export * from "./DotGreenIcon";
|
|
12
14
|
export * from "./HistoryIcon";
|
|
13
15
|
export * from "./HourGlassIcon";
|
|
14
16
|
export * from "./SearchIcon";
|
|
@@ -23,3 +25,17 @@ export * from "./XSwapLogo";
|
|
|
23
25
|
export * from "./SignIcon";
|
|
24
26
|
export * from "./SuccessIcon";
|
|
25
27
|
export * from "./ErrorIcon";
|
|
28
|
+
export * from "./ErrorModalStatusIcon";
|
|
29
|
+
export * from "./SuccessModalStatusIcon";
|
|
30
|
+
export * from "./LinkExternalIcon";
|
|
31
|
+
export * from "./CopyIcon";
|
|
32
|
+
export * from "./HistoryGradientBgIcon";
|
|
33
|
+
export * from "./SettingsGradientBgIcon";
|
|
34
|
+
export * from "./HelpIcon";
|
|
35
|
+
export * from "./XPowerIcon";
|
|
36
|
+
export * from "./RankIcon";
|
|
37
|
+
export * from "./CashbacklIcon";
|
|
38
|
+
export * from "./ArrowUpIcon";
|
|
39
|
+
export * from "./ThumbUpRoundedIcon";
|
|
40
|
+
export * from "./WaitingIcon";
|
|
41
|
+
export * from "./TokensIcon";
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
export const Alert = ({ desc }: { desc: string }) => {
|
|
4
4
|
return (
|
|
5
|
-
<div className="
|
|
5
|
+
<div className="border border-solid border-x_alert rounded-3xl text-x_alert_light text-xs py-0.5 px-2">
|
|
6
6
|
⚠️ {desc}
|
|
7
7
|
</div>
|
|
8
8
|
);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { MouseEvent, ReactElement, forwardRef } from "react";
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
variant?:
|
|
5
|
+
| "outlined"
|
|
6
|
+
| "contained"
|
|
7
|
+
| "filled-rounded"
|
|
8
|
+
| "filled-squared"
|
|
9
|
+
| "default";
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
children: ReactElement | ReactElement[] | string;
|
|
12
|
+
type?: "submit" | "reset" | "button";
|
|
13
|
+
value?: string | string[] | number;
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
16
|
+
className?: string;
|
|
17
|
+
size?: "large" | "medium" | "small";
|
|
18
|
+
secondary?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const Button = forwardRef<HTMLButtonElement, Props>(
|
|
22
|
+
(
|
|
23
|
+
{
|
|
24
|
+
variant,
|
|
25
|
+
disabled,
|
|
26
|
+
children,
|
|
27
|
+
type,
|
|
28
|
+
value,
|
|
29
|
+
fullWidth,
|
|
30
|
+
onClick,
|
|
31
|
+
className = "",
|
|
32
|
+
size = "medium",
|
|
33
|
+
secondary = false,
|
|
34
|
+
}: Props,
|
|
35
|
+
ref,
|
|
36
|
+
) => {
|
|
37
|
+
return (
|
|
38
|
+
<button
|
|
39
|
+
ref={ref}
|
|
40
|
+
type={type ? type : undefined}
|
|
41
|
+
value={value ? value : undefined}
|
|
42
|
+
className={`btn ${
|
|
43
|
+
!variant && disabled ? "btn-disabled" : ""
|
|
44
|
+
} ${className} btn-${size} btn-${variant}${
|
|
45
|
+
disabled ? "-disabled" : secondary ? "-secondary" : ""
|
|
46
|
+
} ${fullWidth ? "btn--full-width" : ""}`}
|
|
47
|
+
disabled={disabled}
|
|
48
|
+
onClick={onClick}
|
|
49
|
+
>
|
|
50
|
+
{children}
|
|
51
|
+
</button>
|
|
52
|
+
);
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
Button.displayName = "Button";
|
|
57
|
+
export { Button };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { MessageBar, MessageType } from "./index";
|
|
2
|
+
import { SnackbarContent } from "notistack";
|
|
3
|
+
import React, { forwardRef } from "react";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
message: {
|
|
7
|
+
text: string;
|
|
8
|
+
variant: MessageType;
|
|
9
|
+
className?: string;
|
|
10
|
+
action?: React.FunctionComponent;
|
|
11
|
+
animation?: React.FunctionComponent;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const SnackMessage = forwardRef<HTMLDivElement, Props>(({ message }, ref) => {
|
|
15
|
+
const { text, variant, className, action, animation } = message;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<SnackbarContent ref={ref}>
|
|
19
|
+
<MessageBar
|
|
20
|
+
text={text}
|
|
21
|
+
type={variant}
|
|
22
|
+
className={className}
|
|
23
|
+
isSnackbar={true}
|
|
24
|
+
Action={action}
|
|
25
|
+
Animation={animation}
|
|
26
|
+
/>
|
|
27
|
+
</SnackbarContent>
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
SnackMessage.displayName = "SnackMessage";
|
|
32
|
+
export { SnackMessage };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { FunctionComponent } from "react";
|
|
2
|
+
|
|
3
|
+
export type MessageType = "error" | "warning" | "info" | "success";
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
text: string;
|
|
7
|
+
type: MessageType;
|
|
8
|
+
className?: string;
|
|
9
|
+
isSnackbar?: boolean;
|
|
10
|
+
Action?: FunctionComponent;
|
|
11
|
+
Animation?: FunctionComponent;
|
|
12
|
+
};
|
|
13
|
+
export const MessageBar = ({
|
|
14
|
+
text,
|
|
15
|
+
type,
|
|
16
|
+
className,
|
|
17
|
+
isSnackbar,
|
|
18
|
+
Action,
|
|
19
|
+
Animation,
|
|
20
|
+
}: Props) => {
|
|
21
|
+
return (
|
|
22
|
+
<div
|
|
23
|
+
className={`my-5 mx-0 bg-[#252525] rounded-2xl max-w-[500px] min-h-[43px] flex items-center text-xs font-medium text-white border border-solid ${
|
|
24
|
+
type === "error"
|
|
25
|
+
? `border-x_red_400`
|
|
26
|
+
: type === "warning"
|
|
27
|
+
? `border-x_orange_400`
|
|
28
|
+
: type === "info"
|
|
29
|
+
? `border-x-x_blue_300`
|
|
30
|
+
: type === "success"
|
|
31
|
+
? `border-x_green_300`
|
|
32
|
+
: ""
|
|
33
|
+
} ${isSnackbar && "m-0"}`}
|
|
34
|
+
>
|
|
35
|
+
<p className="p-[15px]">{text}</p>
|
|
36
|
+
{Animation && <Animation />}
|
|
37
|
+
{Action && (
|
|
38
|
+
<div className={`pl-4 fill-white text-white ${className}`}>
|
|
39
|
+
<Action />
|
|
40
|
+
</div>
|
|
41
|
+
)}
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { xpayShadowRoot } from "@src/config";
|
|
2
|
+
import { MouseEvent, ReactElement } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
|
|
5
|
+
export type ModalType = "neutral" | "waiting" | "warning" | "error" | "success";
|
|
6
|
+
type Props = {
|
|
7
|
+
id: string;
|
|
8
|
+
children: ReactElement | ReactElement[];
|
|
9
|
+
onCloseClick: () => void;
|
|
10
|
+
type?: ModalType;
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
export const Modal = ({
|
|
14
|
+
id,
|
|
15
|
+
children,
|
|
16
|
+
onCloseClick,
|
|
17
|
+
type = "waiting",
|
|
18
|
+
className,
|
|
19
|
+
}: Props) => {
|
|
20
|
+
const onBackdropClick = (e: MouseEvent<HTMLDivElement>) => {
|
|
21
|
+
e.stopPropagation();
|
|
22
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
23
|
+
if (e.target === e.currentTarget) {
|
|
24
|
+
onCloseClick();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return createPortal(
|
|
29
|
+
<div
|
|
30
|
+
className="fixed box-border inset-0 z-20 flex items-center justify-center bg-black bg-opacity-80"
|
|
31
|
+
onMouseDown={onBackdropClick}
|
|
32
|
+
>
|
|
33
|
+
<div
|
|
34
|
+
className={`relative bg-black rounded-3xl p-4 w-full min-w-[340px] overflow-auto max-w-x_modal border-2 ${
|
|
35
|
+
type === "error"
|
|
36
|
+
? "border-x_red_300"
|
|
37
|
+
: type === "success"
|
|
38
|
+
? "border-x_green"
|
|
39
|
+
: type === "warning"
|
|
40
|
+
? "border-x_orange"
|
|
41
|
+
: type === "waiting"
|
|
42
|
+
? "border-x_blue_300"
|
|
43
|
+
: "border-white border-opacity-10"
|
|
44
|
+
} ${className}`}
|
|
45
|
+
>
|
|
46
|
+
{children}
|
|
47
|
+
</div>
|
|
48
|
+
</div>,
|
|
49
|
+
xpayShadowRoot!,
|
|
50
|
+
id,
|
|
51
|
+
);
|
|
52
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ChainlinkCCIPIcon, XSwapBadgeIcon } from "@src/assets/icons";
|
|
2
|
+
|
|
3
|
+
export const PoweredBy = () => {
|
|
4
|
+
return (
|
|
5
|
+
<div className="flex justify-center items-center gap-2 my-3">
|
|
6
|
+
<span className="text-x_grey">Powered by</span>
|
|
7
|
+
<XSwapBadgeIcon />
|
|
8
|
+
<span>✕</span>
|
|
9
|
+
<ChainlinkCCIPIcon />
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ChangeEvent, forwardRef, useCallback, useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
const SafeInput = forwardRef<
|
|
4
|
+
HTMLInputElement,
|
|
5
|
+
{
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
regex: RegExp;
|
|
9
|
+
id: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
>(({ value, onChange, id, placeholder, regex, className, disabled }, ref) => {
|
|
15
|
+
const size = useMemo(() => (value.length < 2 ? 2 : value.length), [value]);
|
|
16
|
+
|
|
17
|
+
const handleChange = useCallback(
|
|
18
|
+
(e: ChangeEvent<HTMLInputElement>) => {
|
|
19
|
+
if (e.target.value === ".") {
|
|
20
|
+
// todo temporary fix
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (regex.test(e.target.value)) {
|
|
24
|
+
onChange(e.target.value.replace(/,/g, "."));
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
[onChange, regex, id],
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<input
|
|
32
|
+
ref={ref}
|
|
33
|
+
id={id}
|
|
34
|
+
type="text"
|
|
35
|
+
size={size}
|
|
36
|
+
placeholder={placeholder || "0"}
|
|
37
|
+
pattern={regex.toString()}
|
|
38
|
+
inputMode="decimal"
|
|
39
|
+
spellCheck="false"
|
|
40
|
+
autoComplete="off"
|
|
41
|
+
autoCorrect="off"
|
|
42
|
+
disabled={disabled}
|
|
43
|
+
value={value}
|
|
44
|
+
onChange={handleChange}
|
|
45
|
+
className={className}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
SafeInput.displayName = "SafeInput";
|
|
51
|
+
export { SafeInput };
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from "react";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
width: string;
|
|
5
|
-
height: string;
|
|
6
|
-
other?: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const Skeleton = ({ width, height }: Props) => {
|
|
3
|
+
export const Skeleton: FC<{ className?: string }> = ({ className }) => {
|
|
10
4
|
return (
|
|
11
5
|
<div
|
|
12
|
-
className={`
|
|
6
|
+
className={`bg-x_skeleton_background rounded animate-pulse ${
|
|
7
|
+
className || ""
|
|
8
|
+
}`}
|
|
13
9
|
/>
|
|
14
10
|
);
|
|
15
11
|
};
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
width: string;
|
|
3
|
-
height: string;
|
|
4
|
-
other?: string;
|
|
5
|
-
};
|
|
1
|
+
import { FC } from "react";
|
|
6
2
|
|
|
7
|
-
export const Spinner = ({
|
|
3
|
+
export const Spinner: FC<{ className?: string }> = ({ className }) => {
|
|
8
4
|
return (
|
|
9
|
-
<div role="status">
|
|
5
|
+
<div role="status" className={className || ""}>
|
|
10
6
|
<svg
|
|
11
7
|
aria-hidden="true"
|
|
12
|
-
className={`
|
|
8
|
+
className={`animate-spin fill-white text-white text-opacity-10 ${
|
|
9
|
+
className || ""
|
|
10
|
+
}`}
|
|
13
11
|
viewBox="0 0 100 101"
|
|
14
12
|
fill="none"
|
|
15
13
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CloseIcon,
|
|
3
|
+
HistoryGradientBgIcon,
|
|
4
|
+
SettingsGradientBgIcon,
|
|
5
|
+
} from "@src/assets/icons";
|
|
6
|
+
import { useSwapContext } from "@src/context";
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
};
|
|
11
|
+
export const Controls = ({ onClose }: Props) => {
|
|
12
|
+
const { tab, setTab } = useSwapContext();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className="flex gap-5 items-center">
|
|
16
|
+
{tab === "Swap" ? (
|
|
17
|
+
<>
|
|
18
|
+
<button
|
|
19
|
+
type="button"
|
|
20
|
+
onClick={() => setTab("Settings")}
|
|
21
|
+
aria-label="Open settings"
|
|
22
|
+
className="fill-white"
|
|
23
|
+
>
|
|
24
|
+
<SettingsGradientBgIcon />
|
|
25
|
+
</button>
|
|
26
|
+
<button
|
|
27
|
+
type="button"
|
|
28
|
+
onClick={() => setTab("History")}
|
|
29
|
+
aria-label="Open history"
|
|
30
|
+
className="fill-white"
|
|
31
|
+
>
|
|
32
|
+
<HistoryGradientBgIcon />
|
|
33
|
+
</button>
|
|
34
|
+
<button
|
|
35
|
+
type="button"
|
|
36
|
+
onClick={() => onClose()}
|
|
37
|
+
aria-label="Close"
|
|
38
|
+
className="fill-white"
|
|
39
|
+
>
|
|
40
|
+
<CloseIcon />
|
|
41
|
+
</button>
|
|
42
|
+
</>
|
|
43
|
+
) : (
|
|
44
|
+
<button
|
|
45
|
+
type="button"
|
|
46
|
+
onClick={() => {
|
|
47
|
+
setTab("Swap");
|
|
48
|
+
}}
|
|
49
|
+
aria-label="Switch to swap view"
|
|
50
|
+
className="fill-white"
|
|
51
|
+
>
|
|
52
|
+
<CloseIcon />
|
|
53
|
+
</button>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useSwapContext } from "@src/context";
|
|
2
|
+
import { Controls } from "./Controls";
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
};
|
|
7
|
+
export const Header = ({ onClose }: Props) => {
|
|
8
|
+
const { tab } = useSwapContext();
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<div className="flex justify-between">
|
|
12
|
+
<div className="text-xl">{tab}</div>
|
|
13
|
+
<Controls onClose={onClose} />
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Spinner, TxDataCard } from "@src/components";
|
|
2
|
+
import { useHistory } from "@src/context";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { Virtuoso } from "react-virtuoso";
|
|
5
|
+
|
|
6
|
+
export const HistoryView = () => {
|
|
7
|
+
const { history, historyLoadedOnce } = useHistory();
|
|
8
|
+
|
|
9
|
+
const view = useMemo(() => {
|
|
10
|
+
if (!history || history.length === 0) {
|
|
11
|
+
return historyLoadedOnce ? (
|
|
12
|
+
<div className="text-center py-4 text-[#9e9e9e]">
|
|
13
|
+
Your history is empty
|
|
14
|
+
</div>
|
|
15
|
+
) : (
|
|
16
|
+
<div className="flex justify-center w-full py-4 fill-white">
|
|
17
|
+
<Spinner className="w-8 h-8" />
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Virtuoso
|
|
24
|
+
data={history}
|
|
25
|
+
style={{ height: "100%" }}
|
|
26
|
+
itemContent={(_, transaction) => {
|
|
27
|
+
return <TxDataCard transaction={transaction} />;
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}, [history, historyLoadedOnce]);
|
|
32
|
+
|
|
33
|
+
return <div className="h-[50vh] overflow-hidden">{view}</div>;
|
|
34
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { HelpIcon } from "@src/assets/icons";
|
|
2
|
+
import { ToggleButton, Tooltip } from "@src/components";
|
|
3
|
+
import { useSwapContext } from "@src/context";
|
|
4
|
+
import { useRef } from "react";
|
|
5
|
+
|
|
6
|
+
export const Delivery = () => {
|
|
7
|
+
const tooltipTriggerRef = useRef<SVGSVGElement>(null);
|
|
8
|
+
const { expressDelivery, setExpressDelivery } = useSwapContext();
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<div className="flex flex-col gap-5 pt-5 border-t border-solid border-white border-opacity-10">
|
|
12
|
+
<h1 className="text-sm font-medium">Delivery</h1>
|
|
13
|
+
<div className="flex gap-2 items-center justify-between flex-wrap">
|
|
14
|
+
<div className="flex items-center">
|
|
15
|
+
<h2 className="text-xs">Express delivery: </h2>
|
|
16
|
+
<ToggleButton
|
|
17
|
+
checked={expressDelivery}
|
|
18
|
+
onClick={() => {
|
|
19
|
+
setExpressDelivery((x) => !x);
|
|
20
|
+
}}
|
|
21
|
+
/>
|
|
22
|
+
<Tooltip
|
|
23
|
+
text={
|
|
24
|
+
"Express delivery is a special feature of XSwap that reduces transaction time across chains to around 30 seconds. It is currently available for swaps below a value of $1000 USD."
|
|
25
|
+
}
|
|
26
|
+
position="BOTTOM"
|
|
27
|
+
triggerRef={tooltipTriggerRef}
|
|
28
|
+
id="express-delivery-tooltip"
|
|
29
|
+
/>
|
|
30
|
+
<HelpIcon
|
|
31
|
+
ref={tooltipTriggerRef}
|
|
32
|
+
className="cursor-help fill-x_blue_300 w-[18px] h-[18px]"
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
<div className="text-xs font-medium">
|
|
36
|
+
<span className="text-xs font-medium opacity-60">{`Max time: `}</span>
|
|
37
|
+
{expressDelivery ? "30 sec" : "30 min"}
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
};
|