@rango-dev/widget-embedded 0.45.1-next.0 → 0.45.1-next.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/dist/components/CustomDestination/CustomDestination.styles.d.ts +1 -0
- package/dist/components/CustomDestination/CustomDestination.styles.d.ts.map +1 -1
- package/dist/components/NamespaceItem/NamespaceItem.d.ts +4 -0
- package/dist/components/NamespaceItem/NamespaceItem.d.ts.map +1 -0
- package/dist/components/{WalletStatefulConnect/Namespaces.helpers.d.ts → NamespaceItem/NamespaceItem.helpers.d.ts} +1 -1
- package/dist/components/NamespaceItem/NamespaceItem.helpers.d.ts.map +1 -0
- package/dist/components/NamespaceItem/NamespaceItem.styles.d.ts +1450 -0
- package/dist/components/NamespaceItem/NamespaceItem.styles.d.ts.map +1 -0
- package/dist/components/NamespaceItem/NamespaceItem.types.d.ts +13 -0
- package/dist/components/NamespaceItem/NamespaceItem.types.d.ts.map +1 -0
- package/dist/components/{WalletStatefulConnect → NamespaceItem}/NamespaceUnsupportedItem.d.ts +1 -1
- package/dist/components/NamespaceItem/NamespaceUnsupportedItem.d.ts.map +1 -0
- package/dist/components/NamespaceItem/SupportedChainsList.d.ts.map +1 -0
- package/dist/components/NamespaceItem/SupportedChainsList.styles.d.ts.map +1 -0
- package/dist/components/NamespaceItem/SupportedChainsList.types.d.ts.map +1 -0
- package/dist/components/NamespaceItem/index.d.ts +2 -0
- package/dist/components/NamespaceItem/index.d.ts.map +1 -0
- package/dist/components/Slippage/Slippage.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.styles.d.ts +0 -162
- package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
- package/dist/components/StatefulConnectModal/StatefulConnectModal.d.ts.map +1 -1
- package/dist/components/SwapDetails/RequestIdRow.d.ts +4 -0
- package/dist/components/SwapDetails/RequestIdRow.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDateRow.d.ts +4 -0
- package/dist/components/SwapDetails/SwapDateRow.d.ts.map +1 -0
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.types.d.ts +7 -0
- package/dist/components/SwapDetails/SwapDetails.types.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.ConnectWallet.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.ConnectWallet.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.InstallWallet.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.InstallWallet.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.NetworkState.d.ts +4 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.NetworkState.d.ts.map +1 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +320 -0
- package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +29 -10
- package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/Detached.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/Detached.styles.d.ts +161 -0
- package/dist/components/WalletStatefulConnect/Detached.styles.d.ts.map +1 -0
- package/dist/components/WalletStatefulConnect/Detached.types.d.ts +1 -0
- package/dist/components/WalletStatefulConnect/Detached.types.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/NamespaceDetachedItem.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/NamespaceListItem.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/Namespaces.styles.d.ts +281 -1730
- package/dist/components/WalletStatefulConnect/Namespaces.styles.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/Namespaces.types.d.ts +0 -3
- package/dist/components/WalletStatefulConnect/Namespaces.types.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.d.ts +1 -2
- package/dist/hooks/useStatefulConnect/useStatefulConnect.d.ts.map +1 -1
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/store/slices/wallets.d.ts +2 -2
- package/dist/store/slices/wallets.d.ts.map +1 -1
- package/dist/types/quote.d.ts +1 -1
- package/dist/types/quote.d.ts.map +1 -1
- package/dist/types/wallets.d.ts +1 -0
- package/dist/types/wallets.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +1 -0
- package/dist/utils/swap.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +7 -7
- package/src/components/{WalletStatefulConnect/Namespaces.helpers.ts → NamespaceItem/NamespaceItem.helpers.ts} +1 -1
- package/src/components/NamespaceItem/NamespaceItem.styles.ts +93 -0
- package/src/components/NamespaceItem/NamespaceItem.tsx +117 -0
- package/src/components/NamespaceItem/NamespaceItem.types.ts +14 -0
- package/src/components/{WalletStatefulConnect → NamespaceItem}/NamespaceUnsupportedItem.tsx +3 -3
- package/src/components/NamespaceItem/index.ts +1 -0
- package/src/components/Quote/Quote.tsx +4 -4
- package/src/components/Slippage/Slippage.styles.ts +0 -23
- package/src/components/Slippage/Slippage.tsx +24 -26
- package/src/components/StatefulConnectModal/StatefulConnectModal.tsx +4 -0
- package/src/components/SwapDetails/RequestIdRow.tsx +73 -0
- package/src/components/SwapDetails/SwapDateRow.tsx +21 -0
- package/src/components/SwapDetails/SwapDetails.tsx +39 -83
- package/src/components/SwapDetails/SwapDetails.types.ts +7 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.ConnectWallet.tsx +177 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.InstallWallet.tsx +52 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.NetworkState.tsx +17 -0
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +22 -62
- package/src/components/SwapDetailsModal/SwapDetailsModal.styles.ts +20 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +24 -35
- package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +31 -10
- package/src/components/WalletStatefulConnect/Detached.styles.ts +6 -0
- package/src/components/WalletStatefulConnect/Detached.tsx +21 -4
- package/src/components/WalletStatefulConnect/Detached.types.ts +1 -0
- package/src/components/WalletStatefulConnect/NamespaceDetachedItem.tsx +20 -106
- package/src/components/WalletStatefulConnect/NamespaceListItem.tsx +9 -34
- package/src/components/WalletStatefulConnect/Namespaces.styles.ts +2 -94
- package/src/components/WalletStatefulConnect/Namespaces.tsx +1 -1
- package/src/components/WalletStatefulConnect/Namespaces.types.tsx +0 -4
- package/src/containers/Wallets/useUpdates.ts +1 -1
- package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +10 -23
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +19 -4
- package/src/hooks/useStatefulConnect/useStatefulConnect.ts +23 -7
- package/src/hooks/useSwapInput.ts +13 -4
- package/src/hooks/useWalletList.ts +1 -1
- package/src/store/slices/wallets.ts +11 -5
- package/src/types/quote.ts +1 -1
- package/src/types/wallets.ts +1 -0
- package/src/utils/swap.ts +10 -5
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts +0 -4
- package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/NamespaceUnsupportedItem.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/Namespaces.helpers.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/SupportedChainsList.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/SupportedChainsList.styles.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/SupportedChainsList.types.d.ts.map +0 -1
- package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +0 -26
- /package/dist/components/{WalletStatefulConnect → NamespaceItem}/SupportedChainsList.d.ts +0 -0
- /package/dist/components/{WalletStatefulConnect → NamespaceItem}/SupportedChainsList.styles.d.ts +0 -0
- /package/dist/components/{WalletStatefulConnect → NamespaceItem}/SupportedChainsList.types.d.ts +0 -0
- /package/src/components/{WalletStatefulConnect → NamespaceItem}/SupportedChainsList.styles.ts +0 -0
- /package/src/components/{WalletStatefulConnect → NamespaceItem}/SupportedChainsList.tsx +0 -0
- /package/src/components/{WalletStatefulConnect → NamespaceItem}/SupportedChainsList.types.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.45.1-next.
|
|
3
|
+
"version": "0.45.1-next.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"@lingui/core": "4.2.1",
|
|
26
26
|
"@lingui/react": "4.2.1",
|
|
27
27
|
"@rango-dev/logging-core": "^0.9.1-next.0",
|
|
28
|
-
"@rango-dev/provider-all": "^0.48.1-next.
|
|
28
|
+
"@rango-dev/provider-all": "^0.48.1-next.4",
|
|
29
29
|
"@rango-dev/queue-manager-core": "^0.30.1-next.0",
|
|
30
|
-
"@rango-dev/queue-manager-rango-preset": "^0.47.1-next.
|
|
30
|
+
"@rango-dev/queue-manager-rango-preset": "^0.47.1-next.5",
|
|
31
31
|
"@rango-dev/queue-manager-react": "^0.30.1-next.0",
|
|
32
32
|
"@rango-dev/signer-solana": "^0.41.1-next.0",
|
|
33
|
-
"@rango-dev/ui": "^0.48.1-next.
|
|
34
|
-
"@rango-dev/wallets-core": "^0.45.1-next.
|
|
35
|
-
"@rango-dev/wallets-react": "^0.32.1-next.
|
|
36
|
-
"@rango-dev/wallets-shared": "^0.46.1-next.
|
|
33
|
+
"@rango-dev/ui": "^0.48.1-next.6",
|
|
34
|
+
"@rango-dev/wallets-core": "^0.45.1-next.3",
|
|
35
|
+
"@rango-dev/wallets-react": "^0.32.1-next.3",
|
|
36
|
+
"@rango-dev/wallets-shared": "^0.46.1-next.3",
|
|
37
37
|
"bignumber.js": "^9.1.1",
|
|
38
38
|
"copy-to-clipboard": "^3.3.3",
|
|
39
39
|
"dayjs": "^1.11.7",
|
|
@@ -3,7 +3,7 @@ import type { BlockchainMeta } from 'rango-types';
|
|
|
3
3
|
export function getBlockchainLogo(
|
|
4
4
|
blockchains: BlockchainMeta[],
|
|
5
5
|
blockchainName: string
|
|
6
|
-
) {
|
|
6
|
+
): string | undefined {
|
|
7
7
|
return blockchains.find((blockchain) => blockchain.name === blockchainName)
|
|
8
8
|
?.logo;
|
|
9
9
|
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { darkTheme, Image, styled, Typography } from '@rango-dev/ui';
|
|
2
|
+
|
|
3
|
+
export const NamespaceItemContainer = styled('li', {
|
|
4
|
+
backgroundColor: '$neutral200',
|
|
5
|
+
padding: '$16',
|
|
6
|
+
borderRadius: '$sm',
|
|
7
|
+
variants: {
|
|
8
|
+
clickable: {
|
|
9
|
+
true: {
|
|
10
|
+
cursor: 'pointer',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
hasError: {
|
|
14
|
+
true: {
|
|
15
|
+
background: '$error100',
|
|
16
|
+
[`.${darkTheme} &`]: {
|
|
17
|
+
backgroundColor: '$error700',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
unsupported: {
|
|
22
|
+
true: {
|
|
23
|
+
cursor: 'not-allowed',
|
|
24
|
+
paddingTop: '$8',
|
|
25
|
+
paddingBottom: '$8',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const NamespaceItemContent = styled('div', {
|
|
32
|
+
display: 'flex',
|
|
33
|
+
gap: '$8',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const NamespaceItemInnerContent = styled('div', {
|
|
38
|
+
flex: '1',
|
|
39
|
+
display: 'flex',
|
|
40
|
+
flexDirection: 'column',
|
|
41
|
+
justifyContent: 'space-between',
|
|
42
|
+
height: '$40',
|
|
43
|
+
variants: {
|
|
44
|
+
showSupportedChains: {
|
|
45
|
+
true: {
|
|
46
|
+
justifyContent: 'space-between',
|
|
47
|
+
},
|
|
48
|
+
false: {
|
|
49
|
+
justifyContent: 'center',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export const UnsupportedNamespaceItemInnerContent = styled('div', {
|
|
56
|
+
flex: '1',
|
|
57
|
+
display: 'flex',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
gap: '$4',
|
|
60
|
+
opacity: '0.5',
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export const NamespaceItemInfo = styled('div', {
|
|
64
|
+
display: 'flex',
|
|
65
|
+
gap: '$6',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export const NamespaceItemError = styled('div', {
|
|
70
|
+
paddingLeft: '48px',
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export const NamespaceItemErrorDropdownToggle = styled('div', {
|
|
74
|
+
display: 'flex',
|
|
75
|
+
gap: '$2',
|
|
76
|
+
cursor: 'pointer',
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
width: 'fit-content',
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export const NamespaceAccountAddress = styled(Typography, {
|
|
82
|
+
maxWidth: '100px',
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export const NamespaceLogo = styled(Image, {
|
|
86
|
+
variants: {
|
|
87
|
+
disabled: {
|
|
88
|
+
true: {
|
|
89
|
+
opacity: '0.5',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
});
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { PropTypes } from './NamespaceItem.types';
|
|
2
|
+
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
4
|
+
import {
|
|
5
|
+
ChevronDownIcon,
|
|
6
|
+
ChevronUpIcon,
|
|
7
|
+
Divider,
|
|
8
|
+
Typography,
|
|
9
|
+
} from '@rango-dev/ui';
|
|
10
|
+
import React, { useEffect, useState } from 'react';
|
|
11
|
+
|
|
12
|
+
import { useAppStore } from '../../store/AppStore';
|
|
13
|
+
|
|
14
|
+
import { getBlockchainLogo } from './NamespaceItem.helpers';
|
|
15
|
+
import {
|
|
16
|
+
NamespaceAccountAddress,
|
|
17
|
+
NamespaceItemContainer,
|
|
18
|
+
NamespaceItemContent,
|
|
19
|
+
NamespaceItemError,
|
|
20
|
+
NamespaceItemErrorDropdownToggle,
|
|
21
|
+
NamespaceItemInfo,
|
|
22
|
+
NamespaceItemInnerContent,
|
|
23
|
+
NamespaceLogo,
|
|
24
|
+
} from './NamespaceItem.styles';
|
|
25
|
+
import { SupportedChainsList } from './SupportedChainsList';
|
|
26
|
+
|
|
27
|
+
export function NamespaceItem(props: PropTypes) {
|
|
28
|
+
const { namespace, error, suffix, connected, address, onClick } = props;
|
|
29
|
+
|
|
30
|
+
const [errorIsExpanded, setErrorIsExpanded] = useState(false);
|
|
31
|
+
const blockchains = useAppStore().blockchains();
|
|
32
|
+
|
|
33
|
+
useEffect(() => setErrorIsExpanded(false), [error]);
|
|
34
|
+
|
|
35
|
+
const supportedChains = namespace.getSupportedChains(blockchains);
|
|
36
|
+
const isSupportedChainsDisplayed =
|
|
37
|
+
!error && !connected && supportedChains.length > 1;
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<NamespaceItemContainer
|
|
41
|
+
hasError={!!error}
|
|
42
|
+
clickable={!!onClick}
|
|
43
|
+
onClick={onClick}>
|
|
44
|
+
<NamespaceItemContent>
|
|
45
|
+
<NamespaceLogo
|
|
46
|
+
src={getBlockchainLogo(blockchains, namespace.id)}
|
|
47
|
+
size={40}
|
|
48
|
+
/>
|
|
49
|
+
<NamespaceItemInnerContent
|
|
50
|
+
showSupportedChains={
|
|
51
|
+
isSupportedChainsDisplayed || connected || !!error
|
|
52
|
+
}>
|
|
53
|
+
<NamespaceItemInfo>
|
|
54
|
+
<Typography variant="label" size="large">
|
|
55
|
+
{namespace.label}
|
|
56
|
+
</Typography>
|
|
57
|
+
{connected && (
|
|
58
|
+
<Typography variant="body" size="small" color="success500">
|
|
59
|
+
{i18n.t('Connected')}
|
|
60
|
+
</Typography>
|
|
61
|
+
)}
|
|
62
|
+
{!!error && (
|
|
63
|
+
<Typography variant="body" size="small" color="error500">
|
|
64
|
+
{i18n.t('Connection failed')}
|
|
65
|
+
</Typography>
|
|
66
|
+
)}
|
|
67
|
+
</NamespaceItemInfo>
|
|
68
|
+
{isSupportedChainsDisplayed && (
|
|
69
|
+
<SupportedChainsList chains={supportedChains} />
|
|
70
|
+
)}
|
|
71
|
+
{connected && (
|
|
72
|
+
<NamespaceAccountAddress
|
|
73
|
+
variant="body"
|
|
74
|
+
size="small"
|
|
75
|
+
color="neutral700">
|
|
76
|
+
{address}
|
|
77
|
+
</NamespaceAccountAddress>
|
|
78
|
+
)}
|
|
79
|
+
{error && (
|
|
80
|
+
<NamespaceItemErrorDropdownToggle
|
|
81
|
+
onClick={() =>
|
|
82
|
+
setErrorIsExpanded((errorIsExpanded) => !errorIsExpanded)
|
|
83
|
+
}>
|
|
84
|
+
<Typography
|
|
85
|
+
variant="body"
|
|
86
|
+
size="small"
|
|
87
|
+
color="neutral700"
|
|
88
|
+
style={{
|
|
89
|
+
textDecoration: 'underline',
|
|
90
|
+
userSelect: 'none',
|
|
91
|
+
textDecorationSkipInk: 'none',
|
|
92
|
+
}}>
|
|
93
|
+
{i18n.t('See why')}
|
|
94
|
+
</Typography>
|
|
95
|
+
{errorIsExpanded ? (
|
|
96
|
+
<ChevronUpIcon size={12} color="gray" />
|
|
97
|
+
) : (
|
|
98
|
+
<ChevronDownIcon size={12} color="gray" />
|
|
99
|
+
)}
|
|
100
|
+
</NamespaceItemErrorDropdownToggle>
|
|
101
|
+
)}
|
|
102
|
+
</NamespaceItemInnerContent>
|
|
103
|
+
{suffix}
|
|
104
|
+
</NamespaceItemContent>
|
|
105
|
+
{!!error && errorIsExpanded && (
|
|
106
|
+
<>
|
|
107
|
+
<Divider size={4} />
|
|
108
|
+
<NamespaceItemError>
|
|
109
|
+
<Typography variant="body" size="small" color="neutral700">
|
|
110
|
+
{error}
|
|
111
|
+
</Typography>
|
|
112
|
+
</NamespaceItemError>
|
|
113
|
+
</>
|
|
114
|
+
)}
|
|
115
|
+
</NamespaceItemContainer>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LegacyNamespaceMeta } from '@rango-dev/wallets-core/legacy';
|
|
2
|
+
|
|
3
|
+
export type PropTypes = {
|
|
4
|
+
namespace: LegacyNamespaceMeta;
|
|
5
|
+
error?: string;
|
|
6
|
+
suffix?: React.ReactNode;
|
|
7
|
+
connected?: boolean;
|
|
8
|
+
address?: string | null;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type NamespaceUnsupportedItemPropTypes = {
|
|
13
|
+
namespace: LegacyNamespaceMeta;
|
|
14
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NamespaceUnsupportedItemPropTypes } from './
|
|
1
|
+
import type { NamespaceUnsupportedItemPropTypes } from './NamespaceItem.types';
|
|
2
2
|
|
|
3
3
|
import { i18n } from '@lingui/core';
|
|
4
4
|
import { Typography } from '@rango-dev/ui';
|
|
@@ -6,13 +6,13 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { useAppStore } from '../../store/AppStore';
|
|
8
8
|
|
|
9
|
-
import { getBlockchainLogo } from './
|
|
9
|
+
import { getBlockchainLogo } from './NamespaceItem.helpers';
|
|
10
10
|
import {
|
|
11
11
|
NamespaceItemContainer,
|
|
12
12
|
NamespaceItemContent,
|
|
13
13
|
NamespaceLogo,
|
|
14
14
|
UnsupportedNamespaceItemInnerContent,
|
|
15
|
-
} from './
|
|
15
|
+
} from './NamespaceItem.styles';
|
|
16
16
|
|
|
17
17
|
export function NamespaceUnsupportedItem(
|
|
18
18
|
props: NamespaceUnsupportedItemPropTypes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NamespaceItem } from './NamespaceItem';
|
|
@@ -134,11 +134,11 @@ export function Quote(props: QuoteProps) {
|
|
|
134
134
|
|
|
135
135
|
const hasSlippageError =
|
|
136
136
|
error?.type === QuoteErrorType.INSUFFICIENT_SLIPPAGE &&
|
|
137
|
-
error.recommendedSlippages?.
|
|
137
|
+
!!error.recommendedSlippages?.[index];
|
|
138
138
|
|
|
139
139
|
const hasSlippageWarning =
|
|
140
140
|
warning?.type === QuoteWarningType.INSUFFICIENT_SLIPPAGE &&
|
|
141
|
-
warning.recommendedSlippages?.
|
|
141
|
+
!!warning.recommendedSlippages?.[index];
|
|
142
142
|
|
|
143
143
|
const stepHasError = hasBridgeLimitError || hasSlippageError;
|
|
144
144
|
const stepHasWarning = hasSlippageWarning;
|
|
@@ -269,12 +269,12 @@ export function Quote(props: QuoteProps) {
|
|
|
269
269
|
...(error?.type ===
|
|
270
270
|
QuoteErrorType.INSUFFICIENT_SLIPPAGE && {
|
|
271
271
|
minRequiredSlippage:
|
|
272
|
-
error.recommendedSlippages?.
|
|
272
|
+
error.recommendedSlippages?.[index],
|
|
273
273
|
}),
|
|
274
274
|
...(warning?.type ===
|
|
275
275
|
QuoteWarningType.INSUFFICIENT_SLIPPAGE && {
|
|
276
276
|
minRequiredSlippage:
|
|
277
|
-
warning.recommendedSlippages?.
|
|
277
|
+
warning.recommendedSlippages?.[index],
|
|
278
278
|
}),
|
|
279
279
|
},
|
|
280
280
|
})}
|
|
@@ -32,26 +32,3 @@ export const SlippageChip = styled(Chip, {
|
|
|
32
32
|
width: '61px',
|
|
33
33
|
flexShrink: 0,
|
|
34
34
|
});
|
|
35
|
-
|
|
36
|
-
export const SlippageTextFieldContainer = styled('div', {
|
|
37
|
-
outlineWidth: 1,
|
|
38
|
-
outlineStyle: 'solid',
|
|
39
|
-
borderRadius: '$xs',
|
|
40
|
-
flex: 1,
|
|
41
|
-
variants: {
|
|
42
|
-
status: {
|
|
43
|
-
safe: {
|
|
44
|
-
outlineColor: '$secondary500',
|
|
45
|
-
},
|
|
46
|
-
error: {
|
|
47
|
-
outlineColor: '$error500',
|
|
48
|
-
},
|
|
49
|
-
warning: {
|
|
50
|
-
outlineColor: '$warning500',
|
|
51
|
-
},
|
|
52
|
-
empty: {
|
|
53
|
-
outlineWidth: 0,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
});
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
Head,
|
|
22
22
|
SlippageChip,
|
|
23
23
|
SlippageChipsContainer,
|
|
24
|
-
SlippageTextFieldContainer,
|
|
25
24
|
} from './Slippage.styles';
|
|
26
25
|
import { SlippageTooltipContent } from './SlippageTooltipContent';
|
|
27
26
|
|
|
@@ -92,32 +91,31 @@ export function Slippage() {
|
|
|
92
91
|
/>
|
|
93
92
|
);
|
|
94
93
|
})}
|
|
95
|
-
|
|
94
|
+
|
|
95
|
+
<TextField
|
|
96
|
+
type="number"
|
|
97
|
+
min="0.01"
|
|
98
|
+
max="30"
|
|
99
|
+
step="0.01"
|
|
96
100
|
status={
|
|
97
|
-
slippageValidation?.type || (customSlippage ? '
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
</Typography>
|
|
116
|
-
)
|
|
117
|
-
}
|
|
118
|
-
placeholder={i18n.t('Custom')}
|
|
119
|
-
/>
|
|
120
|
-
</SlippageTextFieldContainer>
|
|
101
|
+
slippageValidation?.type || (customSlippage ? 'success' : 'default')
|
|
102
|
+
}
|
|
103
|
+
id="widget-slippage-chip-text-input"
|
|
104
|
+
onInput={onInput}
|
|
105
|
+
fullWidth
|
|
106
|
+
variant="contained"
|
|
107
|
+
value={customSlippage === null ? '' : customSlippage}
|
|
108
|
+
color="dark"
|
|
109
|
+
onChange={onSlippageValueChange}
|
|
110
|
+
suffix={
|
|
111
|
+
customSlippage && (
|
|
112
|
+
<Typography variant="body" size="small">
|
|
113
|
+
%
|
|
114
|
+
</Typography>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
placeholder={i18n.t('Custom')}
|
|
118
|
+
/>
|
|
121
119
|
</SlippageChipsContainer>
|
|
122
120
|
|
|
123
121
|
{slippageValidation && (
|
|
@@ -55,6 +55,7 @@ export function StatefulConnectModal(props: PropTypes) {
|
|
|
55
55
|
handleNamespace,
|
|
56
56
|
getState,
|
|
57
57
|
resetState,
|
|
58
|
+
handleDisconnect,
|
|
58
59
|
} = useStatefulConnect();
|
|
59
60
|
|
|
60
61
|
const handleConfirmNamespaces = (selectedNamespaces: Namespace[]) => {
|
|
@@ -194,6 +195,9 @@ export function StatefulConnectModal(props: PropTypes) {
|
|
|
194
195
|
{isOnDetached(getState) && (
|
|
195
196
|
<Detached
|
|
196
197
|
onConfirm={handleDetachedConfirm}
|
|
198
|
+
onDisconnectWallet={() =>
|
|
199
|
+
void handleDisconnect(getState().namespace.targetWallet)
|
|
200
|
+
}
|
|
197
201
|
value={getState().namespace}
|
|
198
202
|
selectedNamespaces={getState().selectedNamespaces}
|
|
199
203
|
/>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { RequestIdProps } from './SwapDetails.types';
|
|
2
|
+
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
4
|
+
import {
|
|
5
|
+
CopyIcon,
|
|
6
|
+
DoneIcon,
|
|
7
|
+
IconButton,
|
|
8
|
+
RangoExplorerIcon,
|
|
9
|
+
Tooltip,
|
|
10
|
+
Typography,
|
|
11
|
+
useCopyToClipboard,
|
|
12
|
+
} from '@rango-dev/ui';
|
|
13
|
+
import React from 'react';
|
|
14
|
+
|
|
15
|
+
import { SCANNER_BASE_URL } from '../../constants';
|
|
16
|
+
import { getContainer } from '../../utils/common';
|
|
17
|
+
|
|
18
|
+
import { RESET_INTERVAL } from './SwapDetails.helpers';
|
|
19
|
+
import {
|
|
20
|
+
RequestIdContainer,
|
|
21
|
+
requestIdStyles,
|
|
22
|
+
rowStyles,
|
|
23
|
+
StyledLink,
|
|
24
|
+
} from './SwapDetails.styles';
|
|
25
|
+
|
|
26
|
+
export function RequestIdRow(props: RequestIdProps) {
|
|
27
|
+
const { requestId } = props;
|
|
28
|
+
const [isCopied, handleCopy] = useCopyToClipboard(RESET_INTERVAL);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<RequestIdContainer className={rowStyles()}>
|
|
32
|
+
<Typography variant="label" size="large" color="neutral700">
|
|
33
|
+
{i18n.t('Request ID')}
|
|
34
|
+
</Typography>
|
|
35
|
+
<div className={requestIdStyles()}>
|
|
36
|
+
<Typography variant="label" size="small" color="neutral700">
|
|
37
|
+
{requestId}
|
|
38
|
+
</Typography>
|
|
39
|
+
<Tooltip
|
|
40
|
+
container={getContainer()}
|
|
41
|
+
content={
|
|
42
|
+
isCopied ? i18n.t('Copied To Clipboard') : i18n.t('Copy Request ID')
|
|
43
|
+
}
|
|
44
|
+
open={isCopied || undefined}
|
|
45
|
+
side="bottom"
|
|
46
|
+
alignOffset={-16}
|
|
47
|
+
align="end">
|
|
48
|
+
<IconButton
|
|
49
|
+
id="widget-swap-details-done-copy-icon-btn"
|
|
50
|
+
variant="ghost"
|
|
51
|
+
onClick={handleCopy.bind(null, requestId || '')}>
|
|
52
|
+
{isCopied ? (
|
|
53
|
+
<DoneIcon size={16} color="secondary" />
|
|
54
|
+
) : (
|
|
55
|
+
<CopyIcon size={16} color="gray" />
|
|
56
|
+
)}
|
|
57
|
+
</IconButton>
|
|
58
|
+
</Tooltip>
|
|
59
|
+
|
|
60
|
+
<StyledLink
|
|
61
|
+
target="_blank"
|
|
62
|
+
href={`${SCANNER_BASE_URL}/swap/${requestId}`}>
|
|
63
|
+
<Tooltip
|
|
64
|
+
container={getContainer()}
|
|
65
|
+
content={i18n.t('View on Rango Explorer')}
|
|
66
|
+
side="bottom">
|
|
67
|
+
<RangoExplorerIcon size={20} />
|
|
68
|
+
</Tooltip>
|
|
69
|
+
</StyledLink>
|
|
70
|
+
</div>
|
|
71
|
+
</RequestIdContainer>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SwapDateRowProps } from './SwapDetails.types';
|
|
2
|
+
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
4
|
+
import { Typography } from '@rango-dev/ui';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { rowStyles } from './SwapDetails.styles';
|
|
8
|
+
|
|
9
|
+
export function SwapDateRow(props: SwapDateRowProps) {
|
|
10
|
+
const { date, isFinished } = props;
|
|
11
|
+
return (
|
|
12
|
+
<div className={rowStyles()}>
|
|
13
|
+
<Typography variant="label" size="large" color="neutral700">
|
|
14
|
+
{isFinished ? i18n.t('Finished at') : i18n.t('Created at')}
|
|
15
|
+
</Typography>
|
|
16
|
+
<Typography variant="label" size="small" color="neutral700">
|
|
17
|
+
{date}
|
|
18
|
+
</Typography>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|