@rango-dev/ui 0.1.10-next.92 → 0.1.10
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 +1 -181
- 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 +1 -0
- package/dist/components/BlockchainSelector/BlockchainSelector.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Divider/Divider.d.ts +6 -0
- package/dist/components/Divider/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/ArrowRightIcon.d.ts +3 -0
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/LiquiditySourceList/LiquiditySourceList.d.ts +3 -1
- package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.d.ts +2 -1
- package/dist/components/SelectableWalletList/mock.d.ts +1 -1
- package/dist/components/Settings/Settings.d.ts +2 -1
- package/dist/components/SwapContainer/SwapContainer.d.ts +1 -0
- package/dist/components/SwapDetail/Token.d.ts +16 -0
- package/dist/components/TokenSelector/TokenSelector.d.ts +3 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +10 -17
- package/dist/containers/ConfirmSwap/ConfirmSwap.stories.d.ts +1 -0
- package/dist/containers/ConfirmSwap/mock.d.ts +3 -0
- package/dist/containers/History/History.d.ts +6 -1
- package/dist/containers/History/index.d.ts +1 -1
- package/dist/containers/History/types.d.ts +3 -24
- package/dist/containers/SwapHistory/SwapHistory.d.ts +16 -3
- package/dist/containers/SwapHistory/SwapMessages.d.ts +17 -0
- package/dist/containers/index.d.ts +0 -1
- package/dist/helper/index.d.ts +1 -0
- package/dist/types/meta.d.ts +1 -0
- package/dist/ui.cjs.development.js +1062 -838
- package/dist/ui.cjs.development.js.map +1 -1
- package/dist/ui.cjs.production.min.js +1 -1
- package/dist/ui.cjs.production.min.js.map +1 -1
- package/dist/ui.esm.js +1061 -840
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -2
- package/src/components/Alert/Alert.tsx +33 -12
- package/src/components/Alert/LoadingFailedAlert.tsx +11 -0
- package/src/components/Alert/NotFoundAlert.tsx +19 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/BestRoute/mock.ts +10 -0
- package/src/components/BlockchainSelector/BlockchainSelector.tsx +13 -19
- package/src/components/Button/Button.tsx +2 -1
- package/src/components/ConnectWalletsModal/mockData.ts +16 -0
- package/src/components/Divider/Divider.tsx +41 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/Header/Header.tsx +39 -0
- package/src/components/Header/index.ts +1 -0
- package/src/components/Icon/ArrowRightIcon.tsx +31 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +72 -22
- package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +15 -10
- package/src/components/SecondaryPage/SecondaryPage.tsx +26 -52
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +5 -0
- package/src/components/SelectableWalletList/mock.ts +4 -3
- package/src/components/Settings/Settings.tsx +30 -11
- package/src/components/StatusDrawer/StatusDrawer.tsx +1 -0
- package/src/components/StepDetail/StepDetail.tsx +1 -0
- package/src/components/SwapContainer/SwapContainer.tsx +21 -16
- package/src/components/SwapDetail/SwapDetail.tsx +77 -115
- package/src/components/SwapDetail/Token.tsx +68 -0
- package/src/components/SwapDetail/mock.ts +1 -0
- package/src/components/TextField/TextField.tsx +1 -0
- package/src/components/TokenList/TokenItem.tsx +4 -1
- package/src/components/TokenList/TokenList.tsx +16 -18
- package/src/components/TokenSelector/TokenSelector.tsx +47 -10
- package/src/components/Wallet/Wallet.tsx +1 -1
- package/src/components/index.ts +2 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.stories.tsx +11 -2
- package/src/containers/ConfirmSwap/ConfirmSwap.tsx +103 -117
- package/src/containers/ConfirmSwap/mock.ts +79 -2
- package/src/containers/History/History.tsx +57 -38
- package/src/containers/History/index.ts +1 -1
- package/src/containers/History/mock.ts +1 -0
- package/src/containers/History/types.tsx +2 -30
- package/src/containers/SwapHistory/SwapHistory.tsx +309 -165
- package/src/containers/SwapHistory/SwapMessages.tsx +116 -0
- package/src/containers/SwapHistory/mock.ts +1 -0
- package/src/containers/index.ts +0 -1
- package/src/helper/index.ts +14 -0
- package/src/types/meta.ts +2 -0
- package/dist/containers/ConfirmWallets/ConfirmWallets.d.ts +0 -16
- package/dist/containers/ConfirmWallets/ConfirmWallets.stories.d.ts +0 -6
- package/dist/containers/ConfirmWallets/index.d.ts +0 -1
- package/dist/containers/ConfirmWallets/mock.d.ts +0 -5
- package/dist/helper/swaps.d.ts +0 -5
- package/src/containers/ConfirmWallets/ConfirmWallets.stories.tsx +0 -26
- package/src/containers/ConfirmWallets/ConfirmWallets.tsx +0 -143
- package/src/containers/ConfirmWallets/index.ts +0 -1
- package/src/containers/ConfirmWallets/mock.ts +0 -222
- package/src/helper/swaps.ts +0 -23
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { Divider } from '../../components';
|
|
2
3
|
import { SecondaryPage } from '../../components/SecondaryPage';
|
|
3
4
|
import { SwapDetail } from '../../components/SwapDetail';
|
|
4
5
|
import { Typography } from '../../components/Typography';
|
|
5
6
|
import { containsText } from '../../helper';
|
|
6
|
-
import { groupingOfSwaps } from '../../helper/swaps';
|
|
7
7
|
import { styled } from '../../theme';
|
|
8
8
|
import { PendingSwap } from './types';
|
|
9
|
+
import { NotFoundAlert } from '../../components/Alert/NotFoundAlert';
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
alignItems: 'center',
|
|
11
|
+
const Group = styled('div', {
|
|
12
|
+
'.group-title': {
|
|
13
|
+
textTransform: 'uppercase',
|
|
14
|
+
},
|
|
15
15
|
});
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
|
|
17
|
+
const Container = styled('div', {
|
|
18
|
+
overflowY: 'auto',
|
|
18
19
|
});
|
|
19
20
|
const filteredHistory = (
|
|
20
21
|
list: PendingSwap[],
|
|
@@ -32,39 +33,50 @@ const filteredHistory = (
|
|
|
32
33
|
);
|
|
33
34
|
});
|
|
34
35
|
};
|
|
35
|
-
const Group = styled('div', {
|
|
36
|
-
marginBottom: '$24',
|
|
37
|
-
paddingRight: '$8',
|
|
38
|
-
maxHeight: '600px',
|
|
39
|
-
});
|
|
40
|
-
const GroupTitle = styled(Typography, {
|
|
41
|
-
color: '$neutrals500',
|
|
42
|
-
});
|
|
43
36
|
|
|
37
|
+
export type GroupBy = (list: PendingSwap[]) => {
|
|
38
|
+
title: string;
|
|
39
|
+
swaps: PendingSwap[];
|
|
40
|
+
}[];
|
|
44
41
|
export interface PropTypes {
|
|
45
42
|
list: PendingSwap[];
|
|
46
43
|
onBack: () => void;
|
|
47
44
|
onSwapClick: (requestId: string) => void;
|
|
45
|
+
groupBy?: GroupBy;
|
|
48
46
|
}
|
|
49
47
|
const SwapsGroup = (props: Omit<PropTypes, 'onBack'>) => {
|
|
50
|
-
const { list, onSwapClick } = props;
|
|
51
|
-
const
|
|
48
|
+
const { list, onSwapClick, groupBy } = props;
|
|
49
|
+
const groups = groupBy ? groupBy(list) : [{ title: 'History', swaps: list }];
|
|
52
50
|
|
|
53
51
|
return (
|
|
54
52
|
<>
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
{groups
|
|
54
|
+
.filter((group) => group.swaps.length > 0)
|
|
55
|
+
.map((group, index) => (
|
|
56
|
+
<>
|
|
57
|
+
<Group key={index}>
|
|
58
|
+
<Typography
|
|
59
|
+
variant="body2"
|
|
60
|
+
color="neutrals600"
|
|
61
|
+
className="group-title"
|
|
62
|
+
>
|
|
63
|
+
{group.title}
|
|
64
|
+
</Typography>
|
|
65
|
+
{group.swaps.map((swap: PendingSwap, index: number) => (
|
|
66
|
+
<>
|
|
67
|
+
<SwapDetail
|
|
68
|
+
key={index}
|
|
69
|
+
swap={swap}
|
|
70
|
+
status={swap.status}
|
|
71
|
+
onClick={onSwapClick}
|
|
72
|
+
/>
|
|
73
|
+
<Divider size={12} />
|
|
74
|
+
</>
|
|
75
|
+
))}
|
|
76
|
+
</Group>
|
|
77
|
+
<Divider size={24} />
|
|
78
|
+
</>
|
|
79
|
+
))}
|
|
68
80
|
</>
|
|
69
81
|
);
|
|
70
82
|
};
|
|
@@ -73,22 +85,29 @@ export function History({
|
|
|
73
85
|
list = [],
|
|
74
86
|
onBack,
|
|
75
87
|
onSwapClick,
|
|
88
|
+
groupBy,
|
|
76
89
|
}: PropsWithChildren<PropTypes>) {
|
|
77
90
|
return (
|
|
78
91
|
<SecondaryPage
|
|
79
92
|
onBack={onBack}
|
|
80
93
|
textField={true}
|
|
81
|
-
textFieldPlaceholder="Search By Blockchain Or Token"
|
|
94
|
+
textFieldPlaceholder="Search By Blockchain Or Token Or Request ID"
|
|
82
95
|
title="Swaps"
|
|
83
96
|
>
|
|
84
97
|
{(searchedFor) => {
|
|
85
98
|
const filterSwaps = filteredHistory(list, searchedFor);
|
|
86
|
-
return
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
99
|
+
return (
|
|
100
|
+
<Container>
|
|
101
|
+
{filterSwaps.length ? (
|
|
102
|
+
<SwapsGroup
|
|
103
|
+
list={filterSwaps}
|
|
104
|
+
onSwapClick={onSwapClick}
|
|
105
|
+
groupBy={groupBy}
|
|
106
|
+
/>
|
|
107
|
+
) : (
|
|
108
|
+
<NotFoundAlert catergory="Swap" />
|
|
109
|
+
)}
|
|
110
|
+
</Container>
|
|
92
111
|
);
|
|
93
112
|
}}
|
|
94
113
|
</SecondaryPage>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { History } from './History';
|
|
1
|
+
export { History, GroupBy } from './History';
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CosmosTransaction,
|
|
3
3
|
EvmTransaction,
|
|
4
|
-
SimulationResult,
|
|
5
4
|
SolanaTransaction,
|
|
6
5
|
SwapExplorerUrl,
|
|
7
6
|
SwapperStatusStep,
|
|
8
7
|
Transfer,
|
|
9
8
|
} from 'rango-sdk';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
PendingSwapNetworkStatus,
|
|
13
|
-
StepStatus,
|
|
14
|
-
SwapSavedSettings,
|
|
15
|
-
SwapStatus,
|
|
16
|
-
WalletTypeAndAddress,
|
|
17
|
-
} from '../../types/swaps';
|
|
9
|
+
import { PendingSwapNetworkStatus, StepStatus } from '../../types/swaps';
|
|
10
|
+
export { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
|
|
18
11
|
|
|
19
12
|
export type PendingSwapStep = {
|
|
20
13
|
id: number;
|
|
@@ -52,24 +45,3 @@ export type PendingSwapStep = {
|
|
|
52
45
|
diagnosisUrl: string | null;
|
|
53
46
|
internalSteps: SwapperStatusStep[] | null;
|
|
54
47
|
};
|
|
55
|
-
|
|
56
|
-
export type PendingSwap = {
|
|
57
|
-
creationTime: string;
|
|
58
|
-
finishTime: string | null;
|
|
59
|
-
requestId: string;
|
|
60
|
-
inputAmount: string;
|
|
61
|
-
status: SwapStatus;
|
|
62
|
-
isPaused: boolean;
|
|
63
|
-
extraMessage: string | null;
|
|
64
|
-
extraMessageSeverity: MessageSeverity | null;
|
|
65
|
-
extraMessageErrorCode: string | null;
|
|
66
|
-
extraMessageDetail: string | null | undefined;
|
|
67
|
-
networkStatusExtraMessage: string | null;
|
|
68
|
-
networkStatusExtraMessageDetail: string | null;
|
|
69
|
-
lastNotificationTime: string | null;
|
|
70
|
-
wallets: { [p: string]: WalletTypeAndAddress };
|
|
71
|
-
settings: SwapSavedSettings;
|
|
72
|
-
steps: PendingSwapStep[];
|
|
73
|
-
simulationResult: SimulationResult;
|
|
74
|
-
validateBalanceOrFee: boolean;
|
|
75
|
-
};
|