@rango-dev/ui 0.1.10-next.102
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/README.md +181 -0
- package/dist/components/Alert/Alert.d.ts +7 -0
- package/dist/components/Alert/Alert.stories.d.ts +5 -0
- package/dist/components/Alert/LoadingFailedAlert.d.ts +2 -0
- package/dist/components/Alert/NotFoundAlert.d.ts +7 -0
- package/dist/components/Alert/index.d.ts +2 -0
- package/dist/components/BestRoute/BestRoute.d.ts +12 -0
- package/dist/components/BestRoute/BestRoute.stories.d.ts +8 -0
- package/dist/components/BestRoute/index.d.ts +1 -0
- package/dist/components/BestRoute/mock.d.ts +4 -0
- package/dist/components/BlockchainSelector/BlockchainSelector.d.ts +17 -0
- package/dist/components/BlockchainSelector/BlockchainSelector.stories.d.ts +5 -0
- package/dist/components/BlockchainSelector/index.d.ts +1 -0
- package/dist/components/BlockchainsList/BlockchainsList.d.ts +10 -0
- package/dist/components/BlockchainsList/BlockchainsList.stories.d.ts +5 -0
- package/dist/components/BlockchainsList/index.d.ts +1 -0
- package/dist/components/BlockchainsList/mockData.d.ts +2 -0
- package/dist/components/Button/Button.d.ts +17 -0
- package/dist/components/Button/Button.stories.d.ts +8 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +11 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts +5 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Chip/Chip.d.ts +12 -0
- package/dist/components/Chip/Chip.stories.d.ts +7 -0
- package/dist/components/Chip/index.d.ts +1 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +9 -0
- package/dist/components/ColorPicker/ColorPicker.stories.d.ts +5 -0
- package/dist/components/ColorPicker/index.d.ts +1 -0
- package/dist/components/ConnectWalletsModal/ConnectWallets.stories.d.ts +5 -0
- package/dist/components/ConnectWalletsModal/ConnectWalletsModal.d.ts +11 -0
- package/dist/components/ConnectWalletsModal/index.d.ts +1 -0
- package/dist/components/ConnectWalletsModal/mockData.d.ts +2 -0
- package/dist/components/Divider/Divider.d.ts +6 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/Drawer/Drawer.d.ts +13 -0
- package/dist/components/Drawer/Drawer.stories.d.ts +8 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Header/Header.d.ts +9 -0
- package/dist/components/Header/index.d.ts +1 -0
- package/dist/components/Icon/AddCircleIcon.d.ts +3 -0
- package/dist/components/Icon/AddIcon.d.ts +3 -0
- package/dist/components/Icon/AddWalletIcon.d.ts +3 -0
- package/dist/components/Icon/AngleDownIcon.d.ts +3 -0
- package/dist/components/Icon/AngleLeftIcon.d.ts +3 -0
- package/dist/components/Icon/AngleRightIcon.d.ts +3 -0
- package/dist/components/Icon/AngleUpIcon.d.ts +3 -0
- package/dist/components/Icon/ArrowRightIcon.d.ts +3 -0
- package/dist/components/Icon/BagIcon.d.ts +3 -0
- package/dist/components/Icon/BanIcon.d.ts +3 -0
- package/dist/components/Icon/CheckCircleIcon.d.ts +3 -0
- package/dist/components/Icon/CheckIcon.d.ts +3 -0
- package/dist/components/Icon/CheckSquareIcon.d.ts +3 -0
- package/dist/components/Icon/CheckWalletIcon.d.ts +3 -0
- package/dist/components/Icon/ChevronRightIcon.d.ts +3 -0
- package/dist/components/Icon/CloseIcon.d.ts +1 -0
- package/dist/components/Icon/CopyIcon.d.ts +3 -0
- package/dist/components/Icon/DeleteCircleIcon.d.ts +3 -0
- package/dist/components/Icon/DeleteWalletIcon.d.ts +3 -0
- package/dist/components/Icon/DisconnectIcon.d.ts +3 -0
- package/dist/components/Icon/DownloadIcon.d.ts +3 -0
- package/dist/components/Icon/GasIcon.d.ts +3 -0
- package/dist/components/Icon/HistoryIcon.d.ts +3 -0
- package/dist/components/Icon/HorizontalSwapIcon.d.ts +3 -0
- package/dist/components/Icon/Icons.stories.d.ts +5 -0
- package/dist/components/Icon/InfoCircleIcon.d.ts +3 -0
- package/dist/components/Icon/MinusCircleIcon.d.ts +3 -0
- package/dist/components/Icon/RetryIcon.d.ts +3 -0
- package/dist/components/Icon/RetryLeftIcon.d.ts +3 -0
- package/dist/components/Icon/RetryRightIcon.d.ts +3 -0
- package/dist/components/Icon/SearchIcon.d.ts +3 -0
- package/dist/components/Icon/SearchMinusIcon.d.ts +3 -0
- package/dist/components/Icon/SettingIcon.d.ts +3 -0
- package/dist/components/Icon/SignatureIcon.d.ts +3 -0
- package/dist/components/Icon/SwapWalletIcon.d.ts +3 -0
- package/dist/components/Icon/TimeIcon.d.ts +3 -0
- package/dist/components/Icon/TrashIcon.d.ts +3 -0
- package/dist/components/Icon/TryAgainIcon.d.ts +3 -0
- package/dist/components/Icon/VerticalSwapIcon.d.ts +3 -0
- package/dist/components/Icon/WalletIconIcon.d.ts +3 -0
- package/dist/components/Icon/WarningIcon.d.ts +3 -0
- package/dist/components/Icon/common.d.ts +2 -0
- package/dist/components/Icon/index.d.ts +40 -0
- package/dist/components/Icon/types.d.ts +6 -0
- package/dist/components/LiquiditySourceList/LiquiditySource.stories.d.ts +5 -0
- package/dist/components/LiquiditySourceList/LiquiditySourceList.d.ts +11 -0
- package/dist/components/LiquiditySourceList/index.d.ts +1 -0
- package/dist/components/LiquiditySourceList/mockData.d.ts +2 -0
- package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.d.ts +13 -0
- package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.stories.d.ts +5 -0
- package/dist/components/LiquiditySourcesSelector/index.d.ts +1 -0
- package/dist/components/Modal/Modal.d.ts +12 -0
- package/dist/components/Modal/Modal.stories.d.ts +5 -0
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +13 -0
- package/dist/components/Radio/Radio.stories.d.ts +5 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/SecondaryPage/SecondaryPage.d.ts +16 -0
- package/dist/components/SecondaryPage/SecondaryPage.stories.d.ts +2 -0
- package/dist/components/SecondaryPage/index.d.ts +1 -0
- package/dist/components/SelectableWalletList/SelectableWalletList.d.ts +7 -0
- package/dist/components/SelectableWalletList/SelectableWalletList.stories.d.ts +5 -0
- package/dist/components/SelectableWalletList/index.d.ts +1 -0
- package/dist/components/SelectableWalletList/mock.d.ts +2 -0
- package/dist/components/Settings/Settings.d.ts +23 -0
- package/dist/components/Settings/Settings.stories.d.ts +5 -0
- package/dist/components/Settings/index.d.ts +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +6 -0
- package/dist/components/Skeleton/Skeleton.stories.d.ts +5 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Spacer/Spacer.d.ts +6 -0
- package/dist/components/Spacer/Spacer.stories.d.ts +5 -0
- package/dist/components/Spacer/index.d.ts +1 -0
- package/dist/components/Spinner/Spinner.d.ts +6 -0
- package/dist/components/Spinner/Spinner.stories.d.ts +5 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/StatusDrawer/StatusDrawer.d.ts +11 -0
- package/dist/components/StatusDrawer/StatusDrawer.stories.d.ts +5 -0
- package/dist/components/StatusDrawer/index.d.ts +1 -0
- package/dist/components/StepDetail/StepDetail.d.ts +10 -0
- package/dist/components/StepDetail/StepDetail.stories.d.ts +5 -0
- package/dist/components/StepDetail/index.d.ts +1 -0
- package/dist/components/SwapContainer/SwapContainer.d.ts +7 -0
- package/dist/components/SwapContainer/SwapContainer.stories.d.ts +5 -0
- package/dist/components/SwapContainer/index.d.ts +1 -0
- package/dist/components/SwapDetail/SwapDetail.d.ts +8 -0
- package/dist/components/SwapDetail/SwapDetail.stories.d.ts +5 -0
- package/dist/components/SwapDetail/Token.d.ts +16 -0
- package/dist/components/SwapDetail/index.d.ts +1 -0
- package/dist/components/SwapDetail/mock.d.ts +2 -0
- package/dist/components/Switch/Switch.d.ts +6 -0
- package/dist/components/Switch/Switch.stories.d.ts +5 -0
- package/dist/components/Switch/index.d.ts +1 -0
- package/dist/components/TextField/TextField.d.ts +10 -0
- package/dist/components/TextField/TextField.stories.d.ts +7 -0
- package/dist/components/TextField/index.d.ts +1 -0
- package/dist/components/TokenList/TokenItem.d.ts +11 -0
- package/dist/components/TokenList/TokenList.d.ts +17 -0
- package/dist/components/TokenList/TokenList.stories.d.ts +5 -0
- package/dist/components/TokenList/index.d.ts +1 -0
- package/dist/components/TokenList/mockData.d.ts +2 -0
- package/dist/components/TokenSelector/TokenSelector.d.ts +16 -0
- package/dist/components/TokenSelector/TokenSelector.stories.d.ts +5 -0
- package/dist/components/TokenSelector/index.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +7 -0
- package/dist/components/Tooltip/Tooltip.stories.d.ts +5 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Typography/Typography.d.ts +18 -0
- package/dist/components/Typography/Typography.stories.d.ts +5 -0
- package/dist/components/Typography/index.d.ts +1 -0
- package/dist/components/VirtualizedList/VirtualizedList.d.ts +17 -0
- package/dist/components/Wallet/State.d.ts +7 -0
- package/dist/components/Wallet/Wallet.d.ts +7 -0
- package/dist/components/Wallet/Wallet.stories.d.ts +5 -0
- package/dist/components/Wallet/index.d.ts +1 -0
- package/dist/components/common/FilledCircle.d.ts +1 -0
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/index.d.ts +31 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +20 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.stories.d.ts +6 -0
- package/dist/containers/ConfirmSwap/index.d.ts +1 -0
- package/dist/containers/ConfirmSwap/mock.d.ts +5 -0
- package/dist/containers/History/History.d.ts +13 -0
- package/dist/containers/History/History.stories.d.ts +5 -0
- package/dist/containers/History/index.d.ts +1 -0
- package/dist/containers/History/mock.d.ts +2 -0
- package/dist/containers/History/types.d.ts +39 -0
- package/dist/containers/SwapHistory/SwapHistory.d.ts +24 -0
- package/dist/containers/SwapHistory/SwapHistory.stories.d.ts +5 -0
- package/dist/containers/SwapHistory/SwapMessages.d.ts +17 -0
- package/dist/containers/SwapHistory/index.d.ts +1 -0
- package/dist/containers/SwapHistory/mock.d.ts +2 -0
- package/dist/containers/index.d.ts +3 -0
- package/dist/helper/index.d.ts +2 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8 -0
- package/dist/theme.d.ts +8 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/meta.d.ts +23 -0
- package/dist/types/swaps.d.ts +29 -0
- package/dist/types/wallet.d.ts +23 -0
- package/dist/ui.cjs.development.js +4956 -0
- package/dist/ui.cjs.development.js.map +1 -0
- package/dist/ui.cjs.production.min.js +2 -0
- package/dist/ui.cjs.production.min.js.map +1 -0
- package/dist/ui.esm.js +4870 -0
- package/dist/ui.esm.js.map +1 -0
- package/package.json +88 -0
- package/src/components/Alert/Alert.stories.tsx +22 -0
- package/src/components/Alert/Alert.tsx +102 -0
- package/src/components/Alert/LoadingFailedAlert.tsx +11 -0
- package/src/components/Alert/NotFoundAlert.tsx +19 -0
- package/src/components/Alert/index.ts +2 -0
- package/src/components/BestRoute/BestRoute.stories.tsx +31 -0
- package/src/components/BestRoute/BestRoute.tsx +232 -0
- package/src/components/BestRoute/index.ts +1 -0
- package/src/components/BestRoute/mock.ts +554 -0
- package/src/components/BlockchainSelector/BlockchainSelector.stories.tsx +25 -0
- package/src/components/BlockchainSelector/BlockchainSelector.tsx +93 -0
- package/src/components/BlockchainSelector/index.ts +1 -0
- package/src/components/BlockchainsList/BlockchainsList.stories.tsx +25 -0
- package/src/components/BlockchainsList/BlockchainsList.tsx +70 -0
- package/src/components/BlockchainsList/index.ts +1 -0
- package/src/components/BlockchainsList/mockData.ts +2972 -0
- package/src/components/Button/Button.stories.tsx +59 -0
- package/src/components/Button/Button.tsx +421 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +22 -0
- package/src/components/Checkbox/Checkbox.tsx +56 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Chip/Chip.stories.tsx +37 -0
- package/src/components/Chip/Chip.tsx +48 -0
- package/src/components/Chip/index.ts +1 -0
- package/src/components/ColorPicker/ColorPicker.stories.tsx +36 -0
- package/src/components/ColorPicker/ColorPicker.tsx +85 -0
- package/src/components/ColorPicker/index.ts +1 -0
- package/src/components/ConnectWalletsModal/ConnectWallets.stories.tsx +13 -0
- package/src/components/ConnectWalletsModal/ConnectWalletsModal.tsx +42 -0
- package/src/components/ConnectWalletsModal/index.ts +1 -0
- package/src/components/ConnectWalletsModal/mockData.ts +134 -0
- package/src/components/Divider/Divider.tsx +41 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/Drawer/Drawer.stories.tsx +86 -0
- package/src/components/Drawer/Drawer.tsx +124 -0
- package/src/components/Drawer/index.ts +1 -0
- package/src/components/Header/Header.tsx +39 -0
- package/src/components/Header/index.ts +1 -0
- package/src/components/Icon/AddCircleIcon.tsx +31 -0
- package/src/components/Icon/AddIcon.tsx +31 -0
- package/src/components/Icon/AddWalletIcon.tsx +50 -0
- package/src/components/Icon/AngleDownIcon.tsx +30 -0
- package/src/components/Icon/AngleLeftIcon.tsx +33 -0
- package/src/components/Icon/AngleRightIcon.tsx +32 -0
- package/src/components/Icon/AngleUpIcon.tsx +32 -0
- package/src/components/Icon/ArrowRightIcon.tsx +31 -0
- package/src/components/Icon/BagIcon.tsx +39 -0
- package/src/components/Icon/BanIcon.tsx +32 -0
- package/src/components/Icon/CheckCircleIcon.tsx +39 -0
- package/src/components/Icon/CheckIcon.tsx +30 -0
- package/src/components/Icon/CheckSquareIcon.tsx +37 -0
- package/src/components/Icon/CheckWalletIcon.tsx +45 -0
- package/src/components/Icon/ChevronRightIcon.tsx +29 -0
- package/src/components/Icon/CloseIcon.tsx +9 -0
- package/src/components/Icon/CopyIcon.tsx +59 -0
- package/src/components/Icon/DeleteCircleIcon.tsx +31 -0
- package/src/components/Icon/DeleteWalletIcon.tsx +50 -0
- package/src/components/Icon/DisconnectIcon.tsx +31 -0
- package/src/components/Icon/DownloadIcon.tsx +37 -0
- package/src/components/Icon/GasIcon.tsx +37 -0
- package/src/components/Icon/HistoryIcon.tsx +34 -0
- package/src/components/Icon/HorizontalSwapIcon.tsx +38 -0
- package/src/components/Icon/Icons.stories.tsx +44 -0
- package/src/components/Icon/InfoCircleIcon.tsx +39 -0
- package/src/components/Icon/MinusCircleIcon.tsx +31 -0
- package/src/components/Icon/RetryIcon.tsx +30 -0
- package/src/components/Icon/RetryLeftIcon.tsx +31 -0
- package/src/components/Icon/RetryRightIcon.tsx +31 -0
- package/src/components/Icon/SearchIcon.tsx +31 -0
- package/src/components/Icon/SearchMinusIcon.tsx +31 -0
- package/src/components/Icon/SettingIcon.tsx +31 -0
- package/src/components/Icon/SignatureIcon.tsx +32 -0
- package/src/components/Icon/SwapWalletIcon.tsx +50 -0
- package/src/components/Icon/TimeIcon.tsx +29 -0
- package/src/components/Icon/TrashIcon.tsx +31 -0
- package/src/components/Icon/TryAgainIcon.tsx +31 -0
- package/src/components/Icon/VerticalSwapIcon.tsx +38 -0
- package/src/components/Icon/WalletIconIcon.tsx +40 -0
- package/src/components/Icon/WarningIcon.tsx +37 -0
- package/src/components/Icon/common.ts +69 -0
- package/src/components/Icon/index.ts +48 -0
- package/src/components/Icon/types.tsx +45 -0
- package/src/components/LiquiditySourceList/LiquiditySource.stories.tsx +13 -0
- package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +195 -0
- package/src/components/LiquiditySourceList/index.ts +1 -0
- package/src/components/LiquiditySourceList/mockData.ts +316 -0
- package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.stories.tsx +16 -0
- package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +61 -0
- package/src/components/LiquiditySourcesSelector/index.ts +1 -0
- package/src/components/Modal/Modal.stories.tsx +22 -0
- package/src/components/Modal/Modal.tsx +93 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/Radio/Radio.stories.tsx +23 -0
- package/src/components/Radio/Radio.tsx +100 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/SecondaryPage/SecondaryPage.stories.tsx +7 -0
- package/src/components/SecondaryPage/SecondaryPage.tsx +68 -0
- package/src/components/SecondaryPage/index.ts +1 -0
- package/src/components/SelectableWalletList/SelectableWalletList.stories.tsx +14 -0
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +118 -0
- package/src/components/SelectableWalletList/index.ts +1 -0
- package/src/components/SelectableWalletList/mock.ts +13 -0
- package/src/components/Settings/Settings.stories.tsx +34 -0
- package/src/components/Settings/Settings.tsx +208 -0
- package/src/components/Settings/index.ts +1 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +24 -0
- package/src/components/Skeleton/Skeleton.tsx +66 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Spacer/Spacer.stories.tsx +31 -0
- package/src/components/Spacer/Spacer.tsx +128 -0
- package/src/components/Spacer/index.ts +1 -0
- package/src/components/Spinner/Spinner.stories.tsx +25 -0
- package/src/components/Spinner/Spinner.tsx +61 -0
- package/src/components/Spinner/index.ts +1 -0
- package/src/components/StatusDrawer/StatusDrawer.stories.tsx +38 -0
- package/src/components/StatusDrawer/StatusDrawer.tsx +82 -0
- package/src/components/StatusDrawer/index.ts +1 -0
- package/src/components/StepDetail/StepDetail.stories.tsx +37 -0
- package/src/components/StepDetail/StepDetail.tsx +109 -0
- package/src/components/StepDetail/index.ts +1 -0
- package/src/components/SwapContainer/SwapContainer.stories.tsx +13 -0
- package/src/components/SwapContainer/SwapContainer.tsx +43 -0
- package/src/components/SwapContainer/index.ts +1 -0
- package/src/components/SwapDetail/SwapDetail.stories.tsx +19 -0
- package/src/components/SwapDetail/SwapDetail.tsx +112 -0
- package/src/components/SwapDetail/Token.tsx +68 -0
- package/src/components/SwapDetail/index.ts +1 -0
- package/src/components/SwapDetail/mock.ts +276 -0
- package/src/components/Switch/Switch.stories.tsx +9 -0
- package/src/components/Switch/Switch.tsx +55 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/TextField/TextField.stories.tsx +31 -0
- package/src/components/TextField/TextField.tsx +141 -0
- package/src/components/TextField/index.ts +1 -0
- package/src/components/TokenList/TokenItem.tsx +73 -0
- package/src/components/TokenList/TokenList.stories.tsx +18 -0
- package/src/components/TokenList/TokenList.tsx +95 -0
- package/src/components/TokenList/index.ts +1 -0
- package/src/components/TokenList/mockData.ts +1721 -0
- package/src/components/TokenSelector/TokenSelector.stories.tsx +18 -0
- package/src/components/TokenSelector/TokenSelector.tsx +95 -0
- package/src/components/TokenSelector/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +52 -0
- package/src/components/Tooltip/Tooltip.tsx +116 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Typography/Typography.stories.tsx +72 -0
- package/src/components/Typography/Typography.tsx +216 -0
- package/src/components/Typography/index.ts +1 -0
- package/src/components/VirtualizedList/VirtualizedList.tsx +62 -0
- package/src/components/Wallet/State.tsx +34 -0
- package/src/components/Wallet/Wallet.stories.tsx +36 -0
- package/src/components/Wallet/Wallet.tsx +69 -0
- package/src/components/Wallet/index.ts +1 -0
- package/src/components/common/FilledCircle.tsx +8 -0
- package/src/components/common/index.ts +1 -0
- package/src/components/index.ts +31 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.stories.tsx +22 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.tsx +180 -0
- package/src/containers/ConfirmSwap/index.ts +1 -0
- package/src/containers/ConfirmSwap/mock.ts +223 -0
- package/src/containers/History/History.stories.tsx +14 -0
- package/src/containers/History/History.tsx +115 -0
- package/src/containers/History/index.ts +1 -0
- package/src/containers/History/mock.ts +826 -0
- package/src/containers/History/types.tsx +47 -0
- package/src/containers/SwapHistory/SwapHistory.stories.tsx +13 -0
- package/src/containers/SwapHistory/SwapHistory.tsx +442 -0
- package/src/containers/SwapHistory/SwapMessages.tsx +116 -0
- package/src/containers/SwapHistory/index.ts +1 -0
- package/src/containers/SwapHistory/mock.ts +276 -0
- package/src/containers/index.ts +3 -0
- package/src/helper/index.ts +16 -0
- package/src/index.ts +4 -0
- package/src/theme.ts +163 -0
- package/src/types/index.ts +3 -0
- package/src/types/meta.ts +22 -0
- package/src/types/swaps.ts +44 -0
- package/src/types/wallet.ts +30 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CosmosTransaction,
|
|
3
|
+
EvmTransaction,
|
|
4
|
+
SolanaTransaction,
|
|
5
|
+
SwapExplorerUrl,
|
|
6
|
+
SwapperStatusStep,
|
|
7
|
+
Transfer,
|
|
8
|
+
} from 'rango-sdk';
|
|
9
|
+
import { PendingSwapNetworkStatus, StepStatus } from '../../types/swaps';
|
|
10
|
+
export { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
11
|
+
|
|
12
|
+
export type PendingSwapStep = {
|
|
13
|
+
id: number;
|
|
14
|
+
fromBlockchain: string;
|
|
15
|
+
fromSymbol: string;
|
|
16
|
+
fromSymbolAddress: string | null;
|
|
17
|
+
fromDecimals: number;
|
|
18
|
+
fromAmountPrecision: string | null;
|
|
19
|
+
fromAmountMinValue: string | null;
|
|
20
|
+
fromAmountMaxValue: string | null;
|
|
21
|
+
fromLogo: string;
|
|
22
|
+
fromBlockchainLogo: string;
|
|
23
|
+
toBlockchainLogo: string;
|
|
24
|
+
toBlockchain: string;
|
|
25
|
+
toSymbol: string;
|
|
26
|
+
toSymbolAddress: string | null;
|
|
27
|
+
toDecimals: number;
|
|
28
|
+
toLogo: string;
|
|
29
|
+
swapperId: string;
|
|
30
|
+
swapperLogo: string;
|
|
31
|
+
swapperType: string;
|
|
32
|
+
feeInUsd: string;
|
|
33
|
+
expectedOutputAmountHumanReadable: string | null;
|
|
34
|
+
startTransactionTime: number;
|
|
35
|
+
outputAmount: string;
|
|
36
|
+
status: StepStatus;
|
|
37
|
+
networkStatus: PendingSwapNetworkStatus | null;
|
|
38
|
+
executedTransactionId: string | null;
|
|
39
|
+
explorerUrl: SwapExplorerUrl[] | null;
|
|
40
|
+
evmApprovalTransaction: EvmTransaction | null;
|
|
41
|
+
evmTransaction: EvmTransaction | null;
|
|
42
|
+
cosmosTransaction: CosmosTransaction | null;
|
|
43
|
+
transferTransaction: Transfer | null;
|
|
44
|
+
solanaTransaction: SolanaTransaction | null;
|
|
45
|
+
diagnosisUrl: string | null;
|
|
46
|
+
internalSteps: SwapperStatusStep[] | null;
|
|
47
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
import { PropTypes, SwapHistory } from './SwapHistory';
|
|
4
|
+
import { pendingSwap } from './mock';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Swap History',
|
|
8
|
+
component: SwapHistory,
|
|
9
|
+
} as ComponentMeta<typeof SwapHistory>;
|
|
10
|
+
|
|
11
|
+
export const Main = (args: PropTypes) => (
|
|
12
|
+
<SwapHistory {...args} pendingSwap={pendingSwap} />
|
|
13
|
+
);
|
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
StepDetail,
|
|
4
|
+
SecondaryPage,
|
|
5
|
+
GasIcon,
|
|
6
|
+
Typography,
|
|
7
|
+
CheckCircleIcon,
|
|
8
|
+
InfoCircleIcon,
|
|
9
|
+
Spacer,
|
|
10
|
+
Button,
|
|
11
|
+
Alert,
|
|
12
|
+
Drawer,
|
|
13
|
+
Spinner,
|
|
14
|
+
Divider,
|
|
15
|
+
} from '../../components';
|
|
16
|
+
import { styled } from '../../theme';
|
|
17
|
+
import { PendingSwap } from '../History/types';
|
|
18
|
+
import { pulse } from '../../components/BestRoute/BestRoute';
|
|
19
|
+
import {
|
|
20
|
+
SwapMessages,
|
|
21
|
+
PropTypes as SwapMessagesPropTypes,
|
|
22
|
+
} from './SwapMessages';
|
|
23
|
+
|
|
24
|
+
export const SwapperContainer = styled('div', {
|
|
25
|
+
display: 'flex',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
marginLeft: '6px',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const BodyError = styled('div', {
|
|
31
|
+
height: '100%',
|
|
32
|
+
display: 'flex',
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const ErrorMsg = styled(Typography, {
|
|
38
|
+
color: '$error',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const Fee = styled('div', {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const SwapperLogo = styled('img', {
|
|
47
|
+
width: '$16',
|
|
48
|
+
height: '$16',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export const RelativeContainer = styled('div', {
|
|
52
|
+
position: 'relative',
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export const Footer = styled('div', {
|
|
56
|
+
display: 'flex',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const Dot = styled('div', {
|
|
61
|
+
width: '$8',
|
|
62
|
+
height: '$8',
|
|
63
|
+
backgroundColor: '$foreground',
|
|
64
|
+
borderRadius: '4px',
|
|
65
|
+
marginLeft: '$8',
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const ArrowDown = styled('div', {
|
|
69
|
+
width: '0px',
|
|
70
|
+
height: '0px',
|
|
71
|
+
borderLeft: '5px solid transparent',
|
|
72
|
+
borderRight: '5px solid transparent',
|
|
73
|
+
borderTop: '5px solid $foreground',
|
|
74
|
+
marginLeft: '$8',
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const StyledAnchor = styled('a', {
|
|
78
|
+
color: '$primary',
|
|
79
|
+
fontWeight: '$600',
|
|
80
|
+
marginLeft: '$12',
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const SwapInfoContainer = styled('div', {
|
|
84
|
+
display: 'flex',
|
|
85
|
+
flexDirection: 'column',
|
|
86
|
+
paddingBottom: '$16',
|
|
87
|
+
borderBottom: '1px solid $neutrals300',
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const InternalDetailsContainer = styled('div', {
|
|
91
|
+
display: 'flex',
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const InternalDetail = styled('div', {
|
|
95
|
+
display: 'flex',
|
|
96
|
+
padding: '$10',
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const DescriptionContainer = styled('div', {
|
|
100
|
+
display: 'flex',
|
|
101
|
+
alignItems: 'center',
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const Description = styled(Typography, {
|
|
105
|
+
color: '$success',
|
|
106
|
+
marginLeft: '$8',
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const Error = styled(Description, {
|
|
110
|
+
color: '$error',
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
export const Line = styled('div', {
|
|
114
|
+
width: '0',
|
|
115
|
+
minHeight: '$16',
|
|
116
|
+
marginLeft: '$12',
|
|
117
|
+
border: '1px dashed $foreground',
|
|
118
|
+
borderRadius: 'inherit',
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const Row = styled('div', {
|
|
122
|
+
display: 'flex',
|
|
123
|
+
justifyContent: 'space-between',
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
fontSize: '$14',
|
|
126
|
+
padding: '$8 0',
|
|
127
|
+
|
|
128
|
+
'.name': {
|
|
129
|
+
color: '$neutrals600',
|
|
130
|
+
},
|
|
131
|
+
'.value': {
|
|
132
|
+
display: 'flex',
|
|
133
|
+
alignItems: 'center',
|
|
134
|
+
color: '$neutrals800',
|
|
135
|
+
},
|
|
136
|
+
'.status': {
|
|
137
|
+
fontWeight: 'bold',
|
|
138
|
+
textTransform: 'uppercase',
|
|
139
|
+
},
|
|
140
|
+
'.status.failed': {
|
|
141
|
+
color: '$error',
|
|
142
|
+
},
|
|
143
|
+
'.status.success': {
|
|
144
|
+
color: '$success',
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const RequestId = styled('div', {
|
|
149
|
+
width: '150px',
|
|
150
|
+
whiteSpace: 'nowrap',
|
|
151
|
+
overflow: 'hidden',
|
|
152
|
+
textOverflow: 'ellipsis',
|
|
153
|
+
'@md': {
|
|
154
|
+
width: 'auto',
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
const ExtraDetails = styled('div', {
|
|
159
|
+
padding: '$8 0',
|
|
160
|
+
color: '$neutrals600',
|
|
161
|
+
fontSize: '$12',
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
const StepContainer = styled('div', {
|
|
165
|
+
variants: {
|
|
166
|
+
hasNotStarted: {
|
|
167
|
+
true: {
|
|
168
|
+
filter: 'grayscale(100%)',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
isRunning: {
|
|
172
|
+
true: {
|
|
173
|
+
animation: `${pulse} 2s ease-in-out infinite`,
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
const SwapFlowContainer = styled('div', {
|
|
180
|
+
overflowY: 'auto',
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
export type PropTypes = {
|
|
184
|
+
pendingSwap: PendingSwap;
|
|
185
|
+
onCopy: (requestId: string) => void;
|
|
186
|
+
onBack: () => void;
|
|
187
|
+
isCopied: boolean;
|
|
188
|
+
onCancel: (requestId: string) => void;
|
|
189
|
+
onRetry?: () => void;
|
|
190
|
+
date: string;
|
|
191
|
+
previewInputs?: React.ReactNode;
|
|
192
|
+
} & SwapMessagesPropTypes;
|
|
193
|
+
|
|
194
|
+
export function SwapHistory(props: PropTypes) {
|
|
195
|
+
const {
|
|
196
|
+
pendingSwap,
|
|
197
|
+
onBack,
|
|
198
|
+
onCopy,
|
|
199
|
+
isCopied,
|
|
200
|
+
onCancel,
|
|
201
|
+
date,
|
|
202
|
+
onRetry,
|
|
203
|
+
previewInputs,
|
|
204
|
+
...extraMessageProps
|
|
205
|
+
} = props;
|
|
206
|
+
const [showDrawer, setShowDrawer] = useState(false);
|
|
207
|
+
|
|
208
|
+
return (
|
|
209
|
+
<SecondaryPage
|
|
210
|
+
title="Swap Details"
|
|
211
|
+
textField={false}
|
|
212
|
+
onBack={onBack}
|
|
213
|
+
Footer={
|
|
214
|
+
<>
|
|
215
|
+
{pendingSwap?.status === 'running' && (
|
|
216
|
+
<Button
|
|
217
|
+
variant="outlined"
|
|
218
|
+
fullWidth
|
|
219
|
+
type="error"
|
|
220
|
+
onClick={setShowDrawer.bind(null, true)}
|
|
221
|
+
>
|
|
222
|
+
Cancel
|
|
223
|
+
</Button>
|
|
224
|
+
)}
|
|
225
|
+
{!!onRetry && (
|
|
226
|
+
<Button
|
|
227
|
+
variant="contained"
|
|
228
|
+
fullWidth
|
|
229
|
+
type="primary"
|
|
230
|
+
onClick={onRetry}
|
|
231
|
+
>
|
|
232
|
+
Try again
|
|
233
|
+
</Button>
|
|
234
|
+
)}
|
|
235
|
+
</>
|
|
236
|
+
}
|
|
237
|
+
>
|
|
238
|
+
<div>
|
|
239
|
+
<SwapInfoContainer>
|
|
240
|
+
<Row>
|
|
241
|
+
<div className="name">Request ID:</div>
|
|
242
|
+
<div
|
|
243
|
+
className="value requestId"
|
|
244
|
+
onClick={onCopy.bind(null, pendingSwap?.requestId)}
|
|
245
|
+
>
|
|
246
|
+
<RequestId>{pendingSwap?.requestId}</RequestId>
|
|
247
|
+
<Spacer size={4} />
|
|
248
|
+
<Button type="primary" variant="ghost" size="compact">
|
|
249
|
+
{isCopied ? 'Copied!' : 'Copy'}
|
|
250
|
+
</Button>
|
|
251
|
+
</div>
|
|
252
|
+
</Row>
|
|
253
|
+
<Row>
|
|
254
|
+
<div className="name">Status:</div>
|
|
255
|
+
<div className={`value status ${pendingSwap?.status || ''}`}>
|
|
256
|
+
{pendingSwap?.status}
|
|
257
|
+
{pendingSwap?.status === 'running' && (
|
|
258
|
+
<Spinner size={16} color="primary" />
|
|
259
|
+
)}
|
|
260
|
+
</div>
|
|
261
|
+
</Row>
|
|
262
|
+
<ExtraDetails>{date}</ExtraDetails>
|
|
263
|
+
</SwapInfoContainer>
|
|
264
|
+
{/* TODO: It was temporarily removed to find a better solution.
|
|
265
|
+
|
|
266
|
+
<Divider size={16} />*/}
|
|
267
|
+
</div>
|
|
268
|
+
<SwapFlowContainer>
|
|
269
|
+
{/*{previewInputs} */}
|
|
270
|
+
|
|
271
|
+
{extraMessageProps.shortMessage && (
|
|
272
|
+
<SwapMessages {...extraMessageProps} />
|
|
273
|
+
)}
|
|
274
|
+
|
|
275
|
+
<Divider size={32} />
|
|
276
|
+
|
|
277
|
+
{pendingSwap?.steps.map((step, index) => (
|
|
278
|
+
<StepContainer
|
|
279
|
+
key={index}
|
|
280
|
+
hasNotStarted={step.status === 'created'}
|
|
281
|
+
isRunning={
|
|
282
|
+
step.status != 'failed' &&
|
|
283
|
+
step.status != 'success' &&
|
|
284
|
+
step.status != 'created'
|
|
285
|
+
}
|
|
286
|
+
>
|
|
287
|
+
{index === 0 && (
|
|
288
|
+
<RelativeContainer>
|
|
289
|
+
<StepDetail
|
|
290
|
+
logo={step.fromLogo}
|
|
291
|
+
symbol={step.fromSymbol}
|
|
292
|
+
// @ts-ignore
|
|
293
|
+
chainLogo={step.fromBlockchainLogo}
|
|
294
|
+
blockchain={step.fromBlockchain}
|
|
295
|
+
amount={pendingSwap.inputAmount}
|
|
296
|
+
/>
|
|
297
|
+
<Dot />
|
|
298
|
+
</RelativeContainer>
|
|
299
|
+
)}
|
|
300
|
+
<Line />
|
|
301
|
+
<SwapperContainer>
|
|
302
|
+
<SwapperLogo
|
|
303
|
+
// @ts-ignore
|
|
304
|
+
src={step.swapperLogo}
|
|
305
|
+
alt={step.swapperId}
|
|
306
|
+
/>
|
|
307
|
+
<div>
|
|
308
|
+
<Typography ml={4} variant="caption">
|
|
309
|
+
{
|
|
310
|
+
// @ts-ignore
|
|
311
|
+
step.swapperType
|
|
312
|
+
}{' '}
|
|
313
|
+
from {step.fromSymbol} to {step.toSymbol}
|
|
314
|
+
via {step.swapperId}
|
|
315
|
+
</Typography>
|
|
316
|
+
<Fee>
|
|
317
|
+
<GasIcon />
|
|
318
|
+
<Typography ml={4} variant="caption">
|
|
319
|
+
$
|
|
320
|
+
{
|
|
321
|
+
// @ts-ignore
|
|
322
|
+
step.feeInUsd
|
|
323
|
+
}{' '}
|
|
324
|
+
estimated gas fee
|
|
325
|
+
</Typography>
|
|
326
|
+
</Fee>
|
|
327
|
+
</div>
|
|
328
|
+
</SwapperContainer>
|
|
329
|
+
<div
|
|
330
|
+
style={{
|
|
331
|
+
display: 'flex',
|
|
332
|
+
}}
|
|
333
|
+
>
|
|
334
|
+
<InternalDetailsContainer>
|
|
335
|
+
<Line />
|
|
336
|
+
{!!step.explorerUrl && (
|
|
337
|
+
<div>
|
|
338
|
+
{step.explorerUrl.map((item, index) => (
|
|
339
|
+
<InternalDetail key={index}>
|
|
340
|
+
<DescriptionContainer>
|
|
341
|
+
<CheckCircleIcon color="success" />
|
|
342
|
+
<Description variant="body2">
|
|
343
|
+
{!item.description ? (
|
|
344
|
+
<b>View transaction</b>
|
|
345
|
+
) : (
|
|
346
|
+
<b>
|
|
347
|
+
{item.description.substring(0, 1).toUpperCase()}
|
|
348
|
+
{item.description.substring(1)}
|
|
349
|
+
</b>
|
|
350
|
+
)}
|
|
351
|
+
</Description>
|
|
352
|
+
</DescriptionContainer>
|
|
353
|
+
<StyledAnchor
|
|
354
|
+
href={item.url}
|
|
355
|
+
target="_blank"
|
|
356
|
+
rel="noreferrer"
|
|
357
|
+
key={index}
|
|
358
|
+
>
|
|
359
|
+
TX-Link
|
|
360
|
+
</StyledAnchor>
|
|
361
|
+
</InternalDetail>
|
|
362
|
+
))}
|
|
363
|
+
{step.status === 'failed' && (
|
|
364
|
+
<InternalDetail>
|
|
365
|
+
<DescriptionContainer>
|
|
366
|
+
<InfoCircleIcon color="error" />
|
|
367
|
+
<Error variant="body2">Step failed</Error>
|
|
368
|
+
</DescriptionContainer>
|
|
369
|
+
</InternalDetail>
|
|
370
|
+
)}
|
|
371
|
+
</div>
|
|
372
|
+
)}
|
|
373
|
+
</InternalDetailsContainer>
|
|
374
|
+
</div>
|
|
375
|
+
{index + 1 === pendingSwap.steps.length && <ArrowDown />}
|
|
376
|
+
<StepDetail
|
|
377
|
+
logo={step.toLogo}
|
|
378
|
+
symbol={step.toSymbol}
|
|
379
|
+
// @ts-ignore
|
|
380
|
+
chainLogo={step.toBlockchainLogo}
|
|
381
|
+
blockchain={step.toBlockchain}
|
|
382
|
+
amount={step.outputAmount || ''}
|
|
383
|
+
/>
|
|
384
|
+
</StepContainer>
|
|
385
|
+
))}
|
|
386
|
+
|
|
387
|
+
<Divider size={32} />
|
|
388
|
+
</SwapFlowContainer>
|
|
389
|
+
<Drawer
|
|
390
|
+
onClose={setShowDrawer.bind(null, false)}
|
|
391
|
+
open={showDrawer}
|
|
392
|
+
showClose={true}
|
|
393
|
+
anchor="bottom"
|
|
394
|
+
title="Cancel Progress"
|
|
395
|
+
content={
|
|
396
|
+
<Alert type="warning">
|
|
397
|
+
<p>
|
|
398
|
+
Warning: Rango <u>neither reverts</u> your transaction
|
|
399
|
+
<u>nor refunds</u> you if you've already signed and sent a
|
|
400
|
+
transaction to the blockchain since it's out of Rango's control.
|
|
401
|
+
Beware that "Cancel" only stops next steps from being executed.
|
|
402
|
+
</p>
|
|
403
|
+
<Spacer size={12} direction="vertical" />
|
|
404
|
+
<p>
|
|
405
|
+
If you have already signed your transaction to blockchain, you
|
|
406
|
+
should wait for that to complete or rollback
|
|
407
|
+
</p>
|
|
408
|
+
</Alert>
|
|
409
|
+
}
|
|
410
|
+
footer={
|
|
411
|
+
<div
|
|
412
|
+
style={{
|
|
413
|
+
display: 'flex',
|
|
414
|
+
justifyContent: 'center',
|
|
415
|
+
alignItems: 'center',
|
|
416
|
+
}}
|
|
417
|
+
>
|
|
418
|
+
<Button
|
|
419
|
+
variant="contained"
|
|
420
|
+
type="success"
|
|
421
|
+
onClick={setShowDrawer.bind(null, false)}
|
|
422
|
+
>
|
|
423
|
+
Skip
|
|
424
|
+
</Button>
|
|
425
|
+
<Spacer size={16} />
|
|
426
|
+
<Button
|
|
427
|
+
variant="contained"
|
|
428
|
+
type="error"
|
|
429
|
+
onClick={() => {
|
|
430
|
+
onCancel(pendingSwap.requestId);
|
|
431
|
+
setShowDrawer(false);
|
|
432
|
+
}}
|
|
433
|
+
>
|
|
434
|
+
Cancel progress
|
|
435
|
+
</Button>
|
|
436
|
+
</div>
|
|
437
|
+
}
|
|
438
|
+
container={document.getElementById('swap-box')!}
|
|
439
|
+
/>
|
|
440
|
+
</SecondaryPage>
|
|
441
|
+
);
|
|
442
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Alert, Button, Typography } from '../../components';
|
|
3
|
+
import { styled } from '../../theme';
|
|
4
|
+
|
|
5
|
+
const getAlertType = (messageType: PropTypes['type']) => {
|
|
6
|
+
if (!messageType || messageType === 'info') return 'secondary';
|
|
7
|
+
else return messageType;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const DetailedMessage = styled('div', {
|
|
11
|
+
width: '90%',
|
|
12
|
+
overflowWrap: 'break-word',
|
|
13
|
+
color: '$error500 !important',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type PropTypes = {
|
|
17
|
+
currentStepBlockchain: string;
|
|
18
|
+
switchNetwork?: () => Promise<any>;
|
|
19
|
+
shortMessage: string;
|
|
20
|
+
detailedMessage: { content: string; long: boolean };
|
|
21
|
+
type?: 'success' | 'error' | 'warning' | 'info';
|
|
22
|
+
lastConvertedTokenInFailedSwap?: {
|
|
23
|
+
symbol: string;
|
|
24
|
+
blockchain: string;
|
|
25
|
+
outputAmount: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const SuccessText = styled(Typography, {
|
|
30
|
+
color: '$success500 !important',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const SwapMessages: React.FC<PropTypes> = (props) => {
|
|
34
|
+
const {
|
|
35
|
+
shortMessage,
|
|
36
|
+
detailedMessage,
|
|
37
|
+
currentStepBlockchain,
|
|
38
|
+
type,
|
|
39
|
+
lastConvertedTokenInFailedSwap,
|
|
40
|
+
} = props;
|
|
41
|
+
|
|
42
|
+
const [expandedMessage, setExpandedMessage] = useState(false);
|
|
43
|
+
|
|
44
|
+
const allowedNumberOfChars = detailedMessage.long ? 0 : 150;
|
|
45
|
+
|
|
46
|
+
const shouldShowMoreDetailsButton =
|
|
47
|
+
!expandedMessage && detailedMessage.content.length > allowedNumberOfChars;
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Alert
|
|
51
|
+
type={getAlertType(type)}
|
|
52
|
+
title={shortMessage}
|
|
53
|
+
{...(shouldShowMoreDetailsButton && {
|
|
54
|
+
footer: (
|
|
55
|
+
<Button
|
|
56
|
+
variant="outlined"
|
|
57
|
+
type="primary"
|
|
58
|
+
onClick={setExpandedMessage.bind(null, (prevState) => !prevState)}
|
|
59
|
+
>
|
|
60
|
+
Show more details
|
|
61
|
+
</Button>
|
|
62
|
+
),
|
|
63
|
+
})}
|
|
64
|
+
{...(!!props.switchNetwork && {
|
|
65
|
+
footer: (
|
|
66
|
+
<Button
|
|
67
|
+
variant={'outlined'}
|
|
68
|
+
type="primary"
|
|
69
|
+
onClick={props.switchNetwork}
|
|
70
|
+
>
|
|
71
|
+
Change network to {currentStepBlockchain}
|
|
72
|
+
</Button>
|
|
73
|
+
),
|
|
74
|
+
})}
|
|
75
|
+
>
|
|
76
|
+
{!!detailedMessage.content ? (
|
|
77
|
+
<DetailedMessage>
|
|
78
|
+
<Typography variant="body2">
|
|
79
|
+
{shouldShowMoreDetailsButton && !expandedMessage
|
|
80
|
+
? detailedMessage.content.substring(0, allowedNumberOfChars) +
|
|
81
|
+
(allowedNumberOfChars > 0 ? '...' : '')
|
|
82
|
+
: detailedMessage.content}
|
|
83
|
+
</Typography>
|
|
84
|
+
</DetailedMessage>
|
|
85
|
+
) : null}
|
|
86
|
+
{!!lastConvertedTokenInFailedSwap && (
|
|
87
|
+
<>
|
|
88
|
+
<p>
|
|
89
|
+
<Typography variant="body2">
|
|
90
|
+
Don't worry, your fund is
|
|
91
|
+
</Typography>
|
|
92
|
+
<SuccessText variant="body2">
|
|
93
|
+
<b>Safe</b>
|
|
94
|
+
</SuccessText>
|
|
95
|
+
</p>
|
|
96
|
+
|
|
97
|
+
<p>
|
|
98
|
+
<Typography variant="body2">
|
|
99
|
+
It is converted to
|
|
100
|
+
<u>{lastConvertedTokenInFailedSwap.outputAmount}</u>
|
|
101
|
+
|
|
102
|
+
</Typography>
|
|
103
|
+
<SuccessText variant="body2">
|
|
104
|
+
<b>{lastConvertedTokenInFailedSwap.symbol} </b>
|
|
105
|
+
</SuccessText>
|
|
106
|
+
<Typography variant="body2">on your </Typography>
|
|
107
|
+
<SuccessText variant="body2">
|
|
108
|
+
<b>{lastConvertedTokenInFailedSwap.blockchain} </b>
|
|
109
|
+
</SuccessText>
|
|
110
|
+
<Typography variant="body2">wallet</Typography>
|
|
111
|
+
</p>
|
|
112
|
+
</>
|
|
113
|
+
)}
|
|
114
|
+
</Alert>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SwapHistory } from './SwapHistory';
|