@rango-dev/widget-embedded 0.45.1-next.2 → 0.45.1-next.4
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/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/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/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/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/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/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.tsx +2 -1
- package/src/components/WalletStatefulConnect/NamespaceDetachedItem.tsx +19 -105
- package/src/components/WalletStatefulConnect/NamespaceListItem.tsx +9 -34
- package/src/components/WalletStatefulConnect/Namespaces.styles.ts +1 -93
- 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/store/slices/wallets.ts +11 -5
- package/src/types/wallets.ts +1 -0
- package/src/utils/swap.ts +6 -1
- 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
|
@@ -3,49 +3,25 @@ import type { NamespaceData } from '@rango-dev/wallets-core/dist/hub/store/names
|
|
|
3
3
|
import type { Namespace } from '@rango-dev/wallets-core/namespaces/common';
|
|
4
4
|
|
|
5
5
|
import { i18n } from '@lingui/core';
|
|
6
|
-
import {
|
|
7
|
-
Button,
|
|
8
|
-
ChevronDownIcon,
|
|
9
|
-
ChevronUpIcon,
|
|
10
|
-
Divider,
|
|
11
|
-
Spinner,
|
|
12
|
-
Typography,
|
|
13
|
-
} from '@rango-dev/ui';
|
|
6
|
+
import { Button, Spinner } from '@rango-dev/ui';
|
|
14
7
|
import { useWallets } from '@rango-dev/wallets-react';
|
|
15
|
-
import React, {
|
|
8
|
+
import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
16
9
|
|
|
17
|
-
import { useAppStore } from '../../store/AppStore';
|
|
18
10
|
import { getConciseAddress } from '../../utils/wallets';
|
|
19
|
-
|
|
20
|
-
import { getBlockchainLogo } from './Namespaces.helpers';
|
|
21
|
-
import {
|
|
22
|
-
NamespaceAccountAddress,
|
|
23
|
-
NamespaceDetachedItemInfo,
|
|
24
|
-
NamespaceItemContainer,
|
|
25
|
-
NamespaceItemContent,
|
|
26
|
-
NamespaceItemError,
|
|
27
|
-
NamespaceItemErrorDropdownToggle,
|
|
28
|
-
NamespaceItemInnerContent,
|
|
29
|
-
NamespaceLogo,
|
|
30
|
-
} from './Namespaces.styles';
|
|
31
|
-
import { SupportedChainsList } from './SupportedChainsList';
|
|
11
|
+
import { NamespaceItem } from '../NamespaceItem';
|
|
32
12
|
|
|
33
13
|
export const NamespaceDetachedItem = function NamespaceDetachedItem(
|
|
34
14
|
props: NamespaceDetachedItemPropTypes
|
|
35
15
|
) {
|
|
36
16
|
const { walletType, namespace, initialConnect } = props;
|
|
37
|
-
const blockchains = useAppStore().blockchains();
|
|
38
17
|
const { connect, disconnect, state } = useWallets();
|
|
39
18
|
const [error, setError] = useState<Error | null>(null);
|
|
40
|
-
const [errorIsExpanded, setErrorIsExpanded] = useState(false);
|
|
41
19
|
|
|
42
20
|
const walletState = state(walletType);
|
|
43
21
|
|
|
44
22
|
const namespaceState = walletState.namespaces?.get(namespace.value);
|
|
45
23
|
const firstAccountArray = namespaceState.accounts?.[0]?.split(':');
|
|
46
24
|
|
|
47
|
-
const supportedChains = namespace.getSupportedChains(blockchains);
|
|
48
|
-
|
|
49
25
|
/*
|
|
50
26
|
* Ref to track ongoing connection attempts.
|
|
51
27
|
* In React Strict Mode, effects run twice for safety checks.
|
|
@@ -53,8 +29,6 @@ export const NamespaceDetachedItem = function NamespaceDetachedItem(
|
|
|
53
29
|
*/
|
|
54
30
|
const processingConnectAttempt = useRef(false);
|
|
55
31
|
|
|
56
|
-
useEffect(() => setErrorIsExpanded(false), [error]);
|
|
57
|
-
|
|
58
32
|
useLayoutEffect(() => {
|
|
59
33
|
if (initialConnect && !processingConnectAttempt.current) {
|
|
60
34
|
void handleConnectNamespace(walletType, namespace.value);
|
|
@@ -100,69 +74,19 @@ export const NamespaceDetachedItem = function NamespaceDetachedItem(
|
|
|
100
74
|
};
|
|
101
75
|
|
|
102
76
|
return (
|
|
103
|
-
<
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
{i18n.t('Connected')}
|
|
117
|
-
</Typography>
|
|
118
|
-
)}
|
|
119
|
-
{!namespaceState.connected && !!error && (
|
|
120
|
-
<Typography variant="body" size="small" color="error500">
|
|
121
|
-
{i18n.t('Connection failed')}
|
|
122
|
-
</Typography>
|
|
123
|
-
)}
|
|
124
|
-
</NamespaceDetachedItemInfo>
|
|
125
|
-
{namespaceState.connected && (
|
|
126
|
-
<NamespaceAccountAddress
|
|
127
|
-
variant="body"
|
|
128
|
-
size="small"
|
|
129
|
-
color="neutral700">
|
|
130
|
-
{getConciseAddress(
|
|
131
|
-
firstAccountArray?.[firstAccountArray?.length - 1]
|
|
132
|
-
)}
|
|
133
|
-
</NamespaceAccountAddress>
|
|
134
|
-
)}
|
|
135
|
-
{!namespaceState.connected && error && (
|
|
136
|
-
<NamespaceItemErrorDropdownToggle
|
|
137
|
-
className="widget-namespace-detached-item-error-toggle-btn"
|
|
138
|
-
onClick={() =>
|
|
139
|
-
setErrorIsExpanded((errorIsExpanded) => !errorIsExpanded)
|
|
140
|
-
}>
|
|
141
|
-
<Typography
|
|
142
|
-
variant="body"
|
|
143
|
-
size="small"
|
|
144
|
-
color="neutral700"
|
|
145
|
-
style={{
|
|
146
|
-
textDecoration: 'underline',
|
|
147
|
-
userSelect: 'none',
|
|
148
|
-
textDecorationSkipInk: 'none',
|
|
149
|
-
}}>
|
|
150
|
-
{i18n.t('See why')}
|
|
151
|
-
</Typography>
|
|
152
|
-
{errorIsExpanded ? (
|
|
153
|
-
<ChevronUpIcon size={12} color="gray" />
|
|
154
|
-
) : (
|
|
155
|
-
<ChevronDownIcon size={12} color="gray" />
|
|
156
|
-
)}
|
|
157
|
-
</NamespaceItemErrorDropdownToggle>
|
|
158
|
-
)}
|
|
159
|
-
{!namespaceState.connected &&
|
|
160
|
-
!error &&
|
|
161
|
-
supportedChains.length > 1 && (
|
|
162
|
-
<SupportedChainsList chains={supportedChains} />
|
|
163
|
-
)}
|
|
164
|
-
</NamespaceItemInnerContent>
|
|
165
|
-
{namespaceState.connecting ? (
|
|
77
|
+
<NamespaceItem
|
|
78
|
+
namespace={namespace}
|
|
79
|
+
connected={namespaceState.connected}
|
|
80
|
+
error={error?.message}
|
|
81
|
+
address={
|
|
82
|
+
namespaceState.connected
|
|
83
|
+
? getConciseAddress(
|
|
84
|
+
firstAccountArray?.[firstAccountArray?.length - 1]
|
|
85
|
+
)
|
|
86
|
+
: ''
|
|
87
|
+
}
|
|
88
|
+
suffix={
|
|
89
|
+
namespaceState.connecting ? (
|
|
166
90
|
<Spinner color="info" />
|
|
167
91
|
) : (
|
|
168
92
|
<Button
|
|
@@ -173,18 +97,8 @@ export const NamespaceDetachedItem = function NamespaceDetachedItem(
|
|
|
173
97
|
onClick={async () => handleButtonClick(namespaceState)}>
|
|
174
98
|
{getButtonText()}
|
|
175
99
|
</Button>
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
<>
|
|
180
|
-
<Divider size={4} />
|
|
181
|
-
<NamespaceItemError id="widget-namespace-item-error-div">
|
|
182
|
-
<Typography variant="body" size="small" color="neutral700">
|
|
183
|
-
{(error.cause as Error)?.message || error.message}
|
|
184
|
-
</Typography>
|
|
185
|
-
</NamespaceItemError>
|
|
186
|
-
</>
|
|
187
|
-
)}
|
|
188
|
-
</NamespaceItemContainer>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
/>
|
|
189
103
|
);
|
|
190
104
|
};
|
|
@@ -1,49 +1,24 @@
|
|
|
1
1
|
import type { NamespaceItemPropTypes } from './Namespaces.types';
|
|
2
2
|
|
|
3
|
-
import { Checkbox, Radio
|
|
3
|
+
import { Checkbox, Radio } from '@rango-dev/ui';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { getBlockchainLogo } from './Namespaces.helpers';
|
|
9
|
-
import {
|
|
10
|
-
NamespaceItemContainer,
|
|
11
|
-
NamespaceItemContent,
|
|
12
|
-
NamespaceItemInnerContent,
|
|
13
|
-
NamespaceLogo,
|
|
14
|
-
} from './Namespaces.styles';
|
|
15
|
-
import { SupportedChainsList } from './SupportedChainsList';
|
|
6
|
+
import { NamespaceItem } from '../NamespaceItem';
|
|
16
7
|
|
|
17
8
|
export function NamespaceListItem(props: NamespaceItemPropTypes) {
|
|
18
9
|
const { onClick, type, namespace } = props;
|
|
19
|
-
const blockchains = useAppStore().blockchains();
|
|
20
10
|
|
|
21
|
-
const supportedChains = namespace.getSupportedChains(blockchains);
|
|
22
|
-
const showSupportedChains = supportedChains.length > 1;
|
|
23
11
|
return (
|
|
24
|
-
<
|
|
12
|
+
<NamespaceItem
|
|
13
|
+
namespace={namespace}
|
|
25
14
|
onClick={onClick}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<NamespaceItemContent>
|
|
29
|
-
<NamespaceLogo
|
|
30
|
-
src={getBlockchainLogo(blockchains, namespace.id)}
|
|
31
|
-
size={40}
|
|
32
|
-
/>
|
|
33
|
-
<NamespaceItemInnerContent showSupportedChains={showSupportedChains}>
|
|
34
|
-
<Typography variant="label" size="large">
|
|
35
|
-
{namespace.label}
|
|
36
|
-
</Typography>
|
|
37
|
-
{showSupportedChains && (
|
|
38
|
-
<SupportedChainsList chains={supportedChains} />
|
|
39
|
-
)}
|
|
40
|
-
</NamespaceItemInnerContent>
|
|
41
|
-
{type === 'radio' ? (
|
|
15
|
+
suffix={
|
|
16
|
+
type === 'radio' ? (
|
|
42
17
|
<Radio value={namespace.value} />
|
|
43
18
|
) : (
|
|
44
19
|
<Checkbox checked={props.value} />
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
/>
|
|
48
23
|
);
|
|
49
24
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button,
|
|
1
|
+
import { Button, styled } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const NamespaceList = styled('ul', {
|
|
4
4
|
padding: 0,
|
|
@@ -7,98 +7,6 @@ export const NamespaceList = styled('ul', {
|
|
|
7
7
|
margin: 0,
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
export const NamespaceItemContainer = styled('li', {
|
|
11
|
-
backgroundColor: '$neutral200',
|
|
12
|
-
padding: '$16',
|
|
13
|
-
borderRadius: '$sm',
|
|
14
|
-
variants: {
|
|
15
|
-
clickable: {
|
|
16
|
-
true: {
|
|
17
|
-
cursor: 'pointer',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
hasError: {
|
|
21
|
-
true: {
|
|
22
|
-
background: '$error100 ',
|
|
23
|
-
[`.${darkTheme} &`]: {
|
|
24
|
-
backgroundColor: '$error700',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
unsupported: {
|
|
29
|
-
true: {
|
|
30
|
-
cursor: 'not-allowed',
|
|
31
|
-
paddingTop: '$8',
|
|
32
|
-
paddingBottom: '$8',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export const NamespaceItemContent = styled('div', {
|
|
39
|
-
display: 'flex',
|
|
40
|
-
gap: '$8',
|
|
41
|
-
alignItems: 'center',
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
export const NamespaceItemInnerContent = styled('div', {
|
|
45
|
-
flex: '1',
|
|
46
|
-
display: 'flex',
|
|
47
|
-
flexDirection: 'column',
|
|
48
|
-
justifyContent: 'space-between',
|
|
49
|
-
height: '$40',
|
|
50
|
-
variants: {
|
|
51
|
-
showSupportedChains: {
|
|
52
|
-
true: {
|
|
53
|
-
justifyContent: 'space-between',
|
|
54
|
-
},
|
|
55
|
-
false: {
|
|
56
|
-
justifyContent: 'center',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
export const UnsupportedNamespaceItemInnerContent = styled('div', {
|
|
63
|
-
flex: '1',
|
|
64
|
-
display: 'flex',
|
|
65
|
-
alignItems: 'center',
|
|
66
|
-
gap: '$4',
|
|
67
|
-
opacity: '0.5',
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
export const NamespaceLogo = styled(Image, {
|
|
71
|
-
variants: {
|
|
72
|
-
disabled: {
|
|
73
|
-
true: {
|
|
74
|
-
opacity: '0.5',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
|
|
80
10
|
export const StyledButton = styled(Button, {
|
|
81
11
|
minHeight: '$40',
|
|
82
12
|
});
|
|
83
|
-
|
|
84
|
-
export const NamespaceAccountAddress = styled(Typography, {
|
|
85
|
-
maxWidth: '100px',
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
export const NamespaceItemError = styled('div', {
|
|
89
|
-
paddingLeft: '48px',
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
export const NamespaceItemErrorDropdownToggle = styled('div', {
|
|
93
|
-
display: 'flex',
|
|
94
|
-
gap: '2px',
|
|
95
|
-
cursor: 'pointer',
|
|
96
|
-
alignItems: 'center',
|
|
97
|
-
width: 'fit-content',
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
export const NamespaceDetachedItemInfo = styled('div', {
|
|
101
|
-
display: 'flex',
|
|
102
|
-
gap: '6px',
|
|
103
|
-
alignItems: 'center',
|
|
104
|
-
});
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
14
14
|
|
|
15
15
|
import { useAppStore } from '../../store/AppStore';
|
|
16
|
+
import { NamespaceUnsupportedItem } from '../NamespaceItem/NamespaceUnsupportedItem';
|
|
16
17
|
|
|
17
18
|
import { NamespaceListItem } from './NamespaceListItem';
|
|
18
19
|
import { NamespaceList, StyledButton } from './Namespaces.styles';
|
|
19
|
-
import { NamespaceUnsupportedItem } from './NamespaceUnsupportedItem';
|
|
20
20
|
|
|
21
21
|
export function Namespaces(props: PropTypes) {
|
|
22
22
|
const { targetWallet } = props.value;
|
|
@@ -100,7 +100,11 @@ export interface WalletsSlice {
|
|
|
100
100
|
namespaces?: Namespace[];
|
|
101
101
|
}
|
|
102
102
|
) => void;
|
|
103
|
-
addConnectedWallet: (
|
|
103
|
+
addConnectedWallet: (
|
|
104
|
+
accounts: Wallet[],
|
|
105
|
+
namespace?: Namespace,
|
|
106
|
+
derivationPath?: string
|
|
107
|
+
) => void;
|
|
104
108
|
setWalletsAsSelected: (
|
|
105
109
|
wallets: { walletType: string; chain: string }[]
|
|
106
110
|
) => void;
|
|
@@ -109,7 +113,8 @@ export interface WalletsSlice {
|
|
|
109
113
|
*/
|
|
110
114
|
newWalletConnected: (
|
|
111
115
|
accounts: Wallet[],
|
|
112
|
-
namespace?: Namespace
|
|
116
|
+
namespace?: Namespace,
|
|
117
|
+
derivationPath?: string
|
|
113
118
|
) => Promise<void>;
|
|
114
119
|
disconnectNamespaces: (walletType: string, namespaces: Namespace[]) => void;
|
|
115
120
|
/**
|
|
@@ -231,7 +236,7 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
|
|
|
231
236
|
};
|
|
232
237
|
});
|
|
233
238
|
},
|
|
234
|
-
addConnectedWallet: (accounts, namespace) => {
|
|
239
|
+
addConnectedWallet: (accounts, namespace, derivationPath) => {
|
|
235
240
|
/*
|
|
236
241
|
* When we are going to add a new account, there are two thing that can be happens:
|
|
237
242
|
* 1. Wallet hasn't add yet.
|
|
@@ -276,6 +281,7 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
|
|
|
276
281
|
walletType: account.walletType,
|
|
277
282
|
selected: shouldMarkWalletAsSelected,
|
|
278
283
|
namespace: namespace,
|
|
284
|
+
derivationPath: derivationPath,
|
|
279
285
|
loading: false,
|
|
280
286
|
error: false,
|
|
281
287
|
};
|
|
@@ -435,13 +441,13 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
|
|
|
435
441
|
connectedWallets: nextConnectedWalletsWithUpdatedSelectedStatus,
|
|
436
442
|
});
|
|
437
443
|
},
|
|
438
|
-
newWalletConnected: async (accounts, namespace) => {
|
|
444
|
+
newWalletConnected: async (accounts, namespace, derivationPath) => {
|
|
439
445
|
eventEmitter.emit(WidgetEvents.WalletEvent, {
|
|
440
446
|
type: WalletEventTypes.CONNECT,
|
|
441
447
|
payload: { walletType: accounts[0].walletType, accounts },
|
|
442
448
|
});
|
|
443
449
|
|
|
444
|
-
get().addConnectedWallet(accounts, namespace);
|
|
450
|
+
get().addConnectedWallet(accounts, namespace, derivationPath);
|
|
445
451
|
|
|
446
452
|
void get().fetchBalances(accounts);
|
|
447
453
|
},
|
package/src/types/wallets.ts
CHANGED
package/src/utils/swap.ts
CHANGED
|
@@ -534,13 +534,18 @@ export function getWalletsForNewSwap(selectedWallets: Wallet[]) {
|
|
|
534
534
|
const wallets = selectedWallets.reduce(
|
|
535
535
|
(
|
|
536
536
|
selectedWalletsMap: {
|
|
537
|
-
[p: string]: {
|
|
537
|
+
[p: string]: {
|
|
538
|
+
address: string;
|
|
539
|
+
walletType: WalletType;
|
|
540
|
+
derivationPath?: string;
|
|
541
|
+
};
|
|
538
542
|
},
|
|
539
543
|
selectedWallet
|
|
540
544
|
) => (
|
|
541
545
|
(selectedWalletsMap[selectedWallet.chain] = {
|
|
542
546
|
address: selectedWallet.address,
|
|
543
547
|
walletType: selectedWallet.walletType,
|
|
548
|
+
derivationPath: selectedWallet.derivationPath,
|
|
544
549
|
}),
|
|
545
550
|
selectedWalletsMap
|
|
546
551
|
),
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ModalNetworkValueTypes } from './SwapDetailsModal.types';
|
|
2
|
-
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
3
|
-
export declare const modalNetworkValues: Record<Exclude<PendingSwapNetworkStatus, PendingSwapNetworkStatus.WaitingForQueue>, ModalNetworkValueTypes>;
|
|
4
|
-
//# sourceMappingURL=SwapDetailsModal.helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SwapDetailsModal.helpers.d.ts","sourceRoot":"","sources":["../../../src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CACrC,OAAO,CAAC,wBAAwB,EAAE,wBAAwB,CAAC,eAAe,CAAC,EAC3E,sBAAsB,CAkBvB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NamespaceUnsupportedItem.d.ts","sourceRoot":"","sources":["../../../src/components/WalletStatefulConnect/NamespaceUnsupportedItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,oBAAoB,CAAC;AAI5E,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,iCAAiC,qBAwBzC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Namespaces.helpers.d.ts","sourceRoot":"","sources":["../../../src/components/WalletStatefulConnect/Namespaces.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,cAAc,EAAE,EAC7B,cAAc,EAAE,MAAM,sBAIvB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedChainsList.d.ts","sourceRoot":"","sources":["../../../src/components/WalletStatefulConnect/SupportedChainsList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,qBA2CnD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedChainsList.styles.d.ts","sourceRoot":"","sources":["../../../src/components/WalletStatefulConnect/SupportedChainsList.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAKnC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAe7B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedChainsList.types.d.ts","sourceRoot":"","sources":["../../../src/components/WalletStatefulConnect/SupportedChainsList.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ModalNetworkValueTypes } from './SwapDetailsModal.types';
|
|
2
|
-
|
|
3
|
-
import { i18n } from '@lingui/core';
|
|
4
|
-
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
5
|
-
|
|
6
|
-
export const modalNetworkValues: Record<
|
|
7
|
-
Exclude<PendingSwapNetworkStatus, PendingSwapNetworkStatus.WaitingForQueue>,
|
|
8
|
-
ModalNetworkValueTypes
|
|
9
|
-
> = {
|
|
10
|
-
[PendingSwapNetworkStatus.WaitingForNetworkChange]: {
|
|
11
|
-
type: 'loading',
|
|
12
|
-
title: i18n.t('Change Network'),
|
|
13
|
-
},
|
|
14
|
-
[PendingSwapNetworkStatus.WaitingForConnectingWallet]: {
|
|
15
|
-
type: 'warning',
|
|
16
|
-
title: i18n.t('Connect Wallet'),
|
|
17
|
-
},
|
|
18
|
-
[PendingSwapNetworkStatus.NetworkChanged]: {
|
|
19
|
-
type: 'success',
|
|
20
|
-
title: i18n.t('Network Changed'),
|
|
21
|
-
},
|
|
22
|
-
[PendingSwapNetworkStatus.NetworkChangeFailed]: {
|
|
23
|
-
type: 'warning',
|
|
24
|
-
title: i18n.t('Network Change Failed'),
|
|
25
|
-
},
|
|
26
|
-
};
|
|
File without changes
|
/package/dist/components/{WalletStatefulConnect → NamespaceItem}/SupportedChainsList.styles.d.ts
RENAMED
|
File without changes
|
/package/dist/components/{WalletStatefulConnect → NamespaceItem}/SupportedChainsList.types.d.ts
RENAMED
|
File without changes
|
/package/src/components/{WalletStatefulConnect → NamespaceItem}/SupportedChainsList.styles.ts
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/components/{WalletStatefulConnect → NamespaceItem}/SupportedChainsList.types.ts
RENAMED
|
File without changes
|