@rango-dev/widget-embedded 0.29.1-next.2 → 0.29.1-next.21
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/QueueManager.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +6 -0
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +1 -1
- package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -1
- package/dist/components/RefreshModal/RefreshModal.styles.d.ts +1 -1
- package/dist/components/SearchInput/SearchInput.types.d.ts +2 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.d.ts +4 -0
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.d.ts.map +1 -0
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.styles.d.ts +325 -0
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.styles.d.ts.map +1 -0
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.types.d.ts +10 -0
- package/dist/components/WalletDerivationPathModal/WalletDerivationPathModal.types.d.ts.map +1 -0
- package/dist/components/WalletDerivationPathModal/index.d.ts +2 -0
- package/dist/components/WalletDerivationPathModal/index.d.ts.map +1 -0
- package/dist/components/WalletNamespacesModal/WalletNamespacesModal.d.ts +0 -2
- package/dist/components/WalletNamespacesModal/WalletNamespacesModal.d.ts.map +1 -1
- package/dist/components/WalletNamespacesModal/WalletNamespacesModal.types.d.ts +1 -1
- package/dist/components/WalletNamespacesModal/WalletNamespacesModal.types.d.ts.map +1 -1
- package/dist/constants/namespaces.d.ts +8 -0
- package/dist/constants/namespaces.d.ts.map +1 -0
- package/dist/constants/quote.d.ts +2 -1
- package/dist/constants/quote.d.ts.map +1 -1
- package/dist/constants/routing.d.ts +0 -1
- package/dist/constants/routing.d.ts.map +1 -1
- package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
- package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -1
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +3 -1
- package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -1
- package/dist/hooks/useBootstrap/useBootstrap.d.ts.map +1 -1
- package/dist/hooks/useSubscribeToWidgetEvents/useSubscribeToWidgetEvents.d.ts.map +1 -1
- package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts +4 -3
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/hooks/useWalletProviders/index.d.ts +2 -0
- package/dist/hooks/useWalletProviders/index.d.ts.map +1 -0
- package/dist/hooks/{useWalletProviders.d.ts → useWalletProviders/useWalletProviders.d.ts} +2 -2
- package/dist/hooks/useWalletProviders/useWalletProviders.d.ts.map +1 -0
- package/dist/hooks/useWalletProviders/useWalletProviders.helpers.d.ts +3 -0
- package/dist/hooks/useWalletProviders/useWalletProviders.helpers.d.ts.map +1 -0
- package/dist/hooks/useWidgetEvents/index.d.ts +2 -0
- package/dist/hooks/useWidgetEvents/index.d.ts.map +1 -0
- package/dist/hooks/useWidgetEvents/useWidgetEvents.d.ts +3 -0
- package/dist/hooks/useWidgetEvents/useWidgetEvents.d.ts.map +1 -0
- package/dist/index.d.ts +16 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/services/eventEmitter.d.ts +4 -0
- package/dist/services/eventEmitter.d.ts.map +1 -0
- package/dist/store/notification.d.ts.map +1 -1
- package/dist/store/quote.d.ts +2 -1
- package/dist/store/quote.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/settings.d.ts.map +1 -1
- package/dist/store/wallets.d.ts.map +1 -1
- package/dist/types/config.d.ts +8 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/event.d.ts +68 -0
- package/dist/types/event.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/wallets.d.ts +2 -1
- package/dist/types/wallets.d.ts.map +1 -1
- package/dist/utils/common.d.ts +2 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +1 -0
- package/dist/utils/meta.d.ts.map +1 -1
- package/dist/utils/numbers.d.ts +0 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/providers.d.ts +1 -0
- package/dist/utils/providers.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +4 -4
- package/dist/utils/wallets.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +7 -7
- package/src/QueueManager.tsx +4 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +19 -9
- package/src/components/ConfirmWalletsModal/WalletList.tsx +81 -14
- package/src/components/HistoryGroupedList/HistoryGroupedList.tsx +5 -5
- package/src/components/NotificationContent/NotificationContent.tsx +12 -113
- package/src/components/Quote/Quote.tsx +18 -25
- package/src/components/Quote/QuoteCostDetails.tsx +10 -9
- package/src/components/SearchInput/SearchInput.types.ts +2 -0
- package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.tsx +9 -10
- package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +77 -11
- package/src/components/TokenList/TokenList.tsx +5 -5
- package/src/components/WalletDerivationPathModal/WalletDerivationPathModal.styles.ts +17 -0
- package/src/components/WalletDerivationPathModal/WalletDerivationPathModal.tsx +154 -0
- package/src/components/WalletDerivationPathModal/WalletDerivationPathModal.types.tsx +10 -0
- package/src/components/WalletDerivationPathModal/index.ts +1 -0
- package/src/components/WalletNamespacesModal/WalletNamespacesModal.tsx +10 -15
- package/src/components/WalletNamespacesModal/WalletNamespacesModal.types.tsx +1 -1
- package/src/constants/namespaces.ts +62 -0
- package/src/constants/quote.ts +11 -9
- package/src/constants/routing.ts +0 -2
- package/src/containers/Inputs/Inputs.tsx +4 -4
- package/src/containers/Wallets/Wallets.tsx +2 -1
- package/src/containers/WidgetInfo/WidgetInfo.tsx +3 -0
- package/src/containers/WidgetInfo/WidgetInfo.types.ts +3 -1
- package/src/hooks/useBootstrap/useBootstrap.ts +4 -0
- package/src/hooks/useSubscribeToWidgetEvents/useSubscribeToWidgetEvents.ts +8 -10
- package/src/hooks/useSyncStoresWithConfig.ts +3 -1
- package/src/hooks/useWalletList.ts +14 -9
- package/src/hooks/useWalletProviders/index.ts +1 -0
- package/src/hooks/useWalletProviders/useWalletProviders.helpers.ts +14 -0
- package/src/hooks/{useWalletProviders.ts → useWalletProviders/useWalletProviders.ts} +11 -5
- package/src/hooks/useWidgetEvents/index.ts +1 -0
- package/src/hooks/useWidgetEvents/useWidgetEvents.ts +9 -0
- package/src/index.ts +26 -2
- package/src/pages/WalletsPage.tsx +99 -26
- package/src/services/eventEmitter.ts +11 -0
- package/src/store/notification.ts +3 -1
- package/src/store/quote.ts +63 -1
- package/src/store/slices/config.ts +4 -0
- package/src/store/slices/settings.ts +6 -0
- package/src/store/wallets.ts +194 -173
- package/src/types/config.ts +9 -0
- package/src/types/event.ts +89 -0
- package/src/types/index.ts +1 -0
- package/src/types/wallets.ts +2 -1
- package/src/utils/common.ts +12 -1
- package/src/utils/meta.ts +8 -0
- package/src/utils/numbers.ts +0 -12
- package/src/utils/providers.ts +4 -0
- package/src/utils/wallets.ts +7 -5
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts +0 -1559
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +0 -1
- package/dist/components/NotificationContent/NotificationNotFound.d.ts +0 -3
- package/dist/components/NotificationContent/NotificationNotFound.d.ts.map +0 -1
- package/dist/hooks/useWalletProviders.d.ts.map +0 -1
- package/src/components/NotificationContent/NotificationContent.styles.ts +0 -63
- package/src/components/NotificationContent/NotificationNotFound.tsx +0 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.29.1-next.
|
|
3
|
+
"version": "0.29.1-next.21",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"@lingui/core": "4.2.1",
|
|
26
26
|
"@lingui/react": "4.2.1",
|
|
27
27
|
"@rango-dev/logging-core": "^0.4.0",
|
|
28
|
-
"@rango-dev/provider-all": "^0.34.1-next.
|
|
28
|
+
"@rango-dev/provider-all": "^0.34.1-next.8",
|
|
29
29
|
"@rango-dev/queue-manager-core": "^0.26.0",
|
|
30
|
-
"@rango-dev/queue-manager-rango-preset": "^0.34.1-next.
|
|
30
|
+
"@rango-dev/queue-manager-rango-preset": "^0.34.1-next.8",
|
|
31
31
|
"@rango-dev/queue-manager-react": "^0.26.0",
|
|
32
|
-
"@rango-dev/signer-solana": "^0.29.1-next.
|
|
33
|
-
"@rango-dev/ui": "^0.35.1-next.
|
|
34
|
-
"@rango-dev/wallets-react": "^0.20.1-next.
|
|
35
|
-
"@rango-dev/wallets-shared": "^0.34.1-next.
|
|
32
|
+
"@rango-dev/signer-solana": "^0.29.1-next.1",
|
|
33
|
+
"@rango-dev/ui": "^0.35.1-next.11",
|
|
34
|
+
"@rango-dev/wallets-react": "^0.20.1-next.6",
|
|
35
|
+
"@rango-dev/wallets-shared": "^0.34.1-next.6",
|
|
36
36
|
"bignumber.js": "^9.1.1",
|
|
37
37
|
"copy-to-clipboard": "^3.3.3",
|
|
38
38
|
"dayjs": "^1.11.7",
|
package/src/QueueManager.tsx
CHANGED
|
@@ -12,6 +12,7 @@ import { convertEvmBlockchainMetaToEvmChainInfo } from '@rango-dev/wallets-share
|
|
|
12
12
|
import { isEvmBlockchain } from 'rango-types';
|
|
13
13
|
import React, { useMemo } from 'react';
|
|
14
14
|
|
|
15
|
+
import { eventEmitter } from './services/eventEmitter';
|
|
15
16
|
import { useAppStore } from './store/AppStore';
|
|
16
17
|
import { useUiStore } from './store/ui';
|
|
17
18
|
import { useWalletsStore } from './store/wallets';
|
|
@@ -32,6 +33,9 @@ function QueueManager(props: PropsWithChildren<{ apiKey?: string }>) {
|
|
|
32
33
|
return makeQueueDefinition({
|
|
33
34
|
API_KEY: props.apiKey || getConfig('API_KEY'),
|
|
34
35
|
BASE_URL: getConfig('BASE_URL'),
|
|
36
|
+
emitter: {
|
|
37
|
+
emit: eventEmitter.emit,
|
|
38
|
+
},
|
|
35
39
|
});
|
|
36
40
|
}, [props.apiKey]);
|
|
37
41
|
|
|
@@ -18,7 +18,13 @@ import {
|
|
|
18
18
|
Typography,
|
|
19
19
|
WalletIcon,
|
|
20
20
|
} from '@rango-dev/ui';
|
|
21
|
-
import React, {
|
|
21
|
+
import React, {
|
|
22
|
+
useCallback,
|
|
23
|
+
useEffect,
|
|
24
|
+
useMemo,
|
|
25
|
+
useRef,
|
|
26
|
+
useState,
|
|
27
|
+
} from 'react';
|
|
22
28
|
import { useNavigate } from 'react-router-dom';
|
|
23
29
|
|
|
24
30
|
import { WIDGET_UI_ID } from '../../constants';
|
|
@@ -87,10 +93,14 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
87
93
|
|
|
88
94
|
const isFirefox = navigator?.userAgent.includes('Firefox');
|
|
89
95
|
|
|
90
|
-
const quoteWallets =
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
const quoteWallets = useMemo(
|
|
97
|
+
() =>
|
|
98
|
+
getQuoteWallets({
|
|
99
|
+
filter: 'all',
|
|
100
|
+
quote: selectedQuote,
|
|
101
|
+
}),
|
|
102
|
+
[selectedQuote]
|
|
103
|
+
);
|
|
94
104
|
|
|
95
105
|
const requiredWallets = getQuoteWallets({
|
|
96
106
|
filter: 'required',
|
|
@@ -113,7 +123,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
113
123
|
quoteWallets.includes(connectedWallet.chain)
|
|
114
124
|
);
|
|
115
125
|
}),
|
|
116
|
-
[connectedWallets
|
|
126
|
+
[connectedWallets, quoteWallets]
|
|
117
127
|
);
|
|
118
128
|
|
|
119
129
|
const [selectableWallets, setSelectableWallets] = useState<ConnectedWallet[]>(
|
|
@@ -333,7 +343,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
333
343
|
);
|
|
334
344
|
return nextState;
|
|
335
345
|
});
|
|
336
|
-
}, [connectedWallets
|
|
346
|
+
}, [connectedWallets, quoteWallets]);
|
|
337
347
|
|
|
338
348
|
useEffect(() => {
|
|
339
349
|
const nextState: typeof nextSelectedWallets = [];
|
|
@@ -353,7 +363,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
353
363
|
});
|
|
354
364
|
setNextSelectedWallets(nextState);
|
|
355
365
|
}
|
|
356
|
-
}, [connectedWallets
|
|
366
|
+
}, [connectedWallets, nextSelectedWallets]);
|
|
357
367
|
|
|
358
368
|
const modalContainer = document.getElementById(
|
|
359
369
|
WIDGET_UI_ID.SWAP_BOX_ID
|
|
@@ -513,7 +523,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
513
523
|
/>
|
|
514
524
|
</ListContainer>
|
|
515
525
|
{!isLastWallet && <Divider size={32} />}
|
|
516
|
-
{isLastWallet && config?.customDestination && (
|
|
526
|
+
{isLastWallet && config?.customDestination !== false && (
|
|
517
527
|
<CustomDestination>
|
|
518
528
|
<CustomCollapsible
|
|
519
529
|
onOpenChange={
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropTypes } from './WalletList.type';
|
|
2
|
-
import type { Wallet,
|
|
2
|
+
import type { Wallet, WalletInfoWithExtra } from '../../types';
|
|
3
3
|
import type { Namespace, WalletType } from '@rango-dev/wallets-shared';
|
|
4
4
|
|
|
5
5
|
import { i18n } from '@lingui/core';
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
isExperimentalChain,
|
|
32
32
|
} from '../../utils/wallets';
|
|
33
33
|
import { WatermarkedModal } from '../common/WatermarkedModal';
|
|
34
|
+
import { WalletDerivationPathModal } from '../WalletDerivationPathModal';
|
|
34
35
|
import { WalletModal } from '../WalletModal';
|
|
35
36
|
import { WalletNamespacesModal } from '../WalletNamespacesModal';
|
|
36
37
|
|
|
@@ -42,12 +43,20 @@ import {
|
|
|
42
43
|
} from './WalletList.styles';
|
|
43
44
|
|
|
44
45
|
interface WalletNamespacesModalState {
|
|
46
|
+
open: boolean;
|
|
45
47
|
providerType: string;
|
|
46
48
|
providerImage: string;
|
|
47
49
|
availableNamespaces?: Namespace[];
|
|
48
50
|
singleNamespace?: boolean;
|
|
49
51
|
}
|
|
50
52
|
|
|
53
|
+
interface DerivationPathModalState {
|
|
54
|
+
open: boolean;
|
|
55
|
+
providerType: string;
|
|
56
|
+
providerImage: string;
|
|
57
|
+
namespace: Namespace;
|
|
58
|
+
}
|
|
59
|
+
|
|
51
60
|
const ACCOUNT_ADDRESS_MAX_CHARACTERS = 7;
|
|
52
61
|
export function WalletList(props: PropTypes) {
|
|
53
62
|
const { chain, isSelected, selectWallet, limit, onShowMore, onConnect } =
|
|
@@ -66,6 +75,8 @@ export function WalletList(props: PropTypes) {
|
|
|
66
75
|
useState<'in-progress' | 'completed' | 'rejected' | null>(null);
|
|
67
76
|
const [namespacesModalState, setNamespacesModalState] =
|
|
68
77
|
useState<WalletNamespacesModalState | null>(null);
|
|
78
|
+
const [derivationPathModalState, setDerivationPathModalState] =
|
|
79
|
+
useState<DerivationPathModalState | null>(null);
|
|
69
80
|
const { suggestAndConnect } = useWallets();
|
|
70
81
|
let modalTimerId: ReturnType<typeof setTimeout> | null = null;
|
|
71
82
|
const {
|
|
@@ -91,8 +102,7 @@ export function WalletList(props: PropTypes) {
|
|
|
91
102
|
}, TIME_TO_CLOSE_MODAL);
|
|
92
103
|
},
|
|
93
104
|
});
|
|
94
|
-
const [sortedList, setSortedList] =
|
|
95
|
-
useState<WalletInfoWithNamespaces[]>(list);
|
|
105
|
+
const [sortedList, setSortedList] = useState<WalletInfoWithExtra[]>(list);
|
|
96
106
|
const numberOfSupportedWallets = list.length;
|
|
97
107
|
const shouldShowMoreWallets = limit && numberOfSupportedWallets - limit > 0;
|
|
98
108
|
|
|
@@ -107,8 +117,27 @@ export function WalletList(props: PropTypes) {
|
|
|
107
117
|
}
|
|
108
118
|
};
|
|
109
119
|
|
|
110
|
-
const
|
|
120
|
+
const handleCloseNamespaceModal = () => {
|
|
121
|
+
if (namespacesModalState) {
|
|
122
|
+
setNamespacesModalState({
|
|
123
|
+
...namespacesModalState,
|
|
124
|
+
open: false,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const handleCloseDerivationPathModal = () => {
|
|
130
|
+
if (derivationPathModalState) {
|
|
131
|
+
setDerivationPathModalState({
|
|
132
|
+
...derivationPathModalState,
|
|
133
|
+
open: false,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const handleOpenNamespacesModal = (wallet: WalletInfoWithExtra) => {
|
|
111
139
|
setNamespacesModalState({
|
|
140
|
+
open: true,
|
|
112
141
|
providerType: wallet.type,
|
|
113
142
|
providerImage: wallet.image,
|
|
114
143
|
availableNamespaces: wallet.namespaces,
|
|
@@ -116,6 +145,42 @@ export function WalletList(props: PropTypes) {
|
|
|
116
145
|
});
|
|
117
146
|
};
|
|
118
147
|
|
|
148
|
+
const handleConfirmNamespaces = (selectedNamespaces: Namespace[]) => {
|
|
149
|
+
const wallet = sortedList.find(
|
|
150
|
+
(wallet) => wallet.type === namespacesModalState?.providerType
|
|
151
|
+
);
|
|
152
|
+
if (
|
|
153
|
+
wallet?.singleNamespace && // Currently we support derivation path only for single namespace wallets
|
|
154
|
+
wallet?.needsDerivationPath &&
|
|
155
|
+
selectedNamespaces[0]
|
|
156
|
+
) {
|
|
157
|
+
setDerivationPathModalState({
|
|
158
|
+
open: true,
|
|
159
|
+
providerType: wallet.type,
|
|
160
|
+
providerImage: wallet.image,
|
|
161
|
+
namespace: selectedNamespaces[0],
|
|
162
|
+
});
|
|
163
|
+
} else {
|
|
164
|
+
void handleClick(
|
|
165
|
+
namespacesModalState?.providerType as string,
|
|
166
|
+
selectedNamespaces.map((namespace) => ({
|
|
167
|
+
namespace,
|
|
168
|
+
}))
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
handleCloseNamespaceModal();
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const handleDerivationPathConfirm = (derivationPath: string) => {
|
|
175
|
+
if (derivationPath && derivationPathModalState?.namespace) {
|
|
176
|
+
void handleClick(derivationPathModalState.providerType, [
|
|
177
|
+
{ namespace: derivationPathModalState.namespace, derivationPath },
|
|
178
|
+
]);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
handleCloseDerivationPathModal();
|
|
182
|
+
};
|
|
183
|
+
|
|
119
184
|
useEffect(() => {
|
|
120
185
|
setSortedList((sortedList) => {
|
|
121
186
|
const selectedWalletIndex = list.findIndex((wallet) =>
|
|
@@ -238,19 +303,21 @@ export function WalletList(props: PropTypes) {
|
|
|
238
303
|
error={error}
|
|
239
304
|
/>
|
|
240
305
|
<WalletNamespacesModal
|
|
241
|
-
open={!!namespacesModalState}
|
|
242
|
-
onClose={
|
|
243
|
-
onConfirm={
|
|
244
|
-
void handleClick(
|
|
245
|
-
namespacesModalState?.providerType as string,
|
|
246
|
-
namespaces
|
|
247
|
-
);
|
|
248
|
-
setNamespacesModalState(null);
|
|
249
|
-
}}
|
|
306
|
+
open={!!namespacesModalState?.open}
|
|
307
|
+
onClose={handleCloseNamespaceModal}
|
|
308
|
+
onConfirm={handleConfirmNamespaces}
|
|
250
309
|
image={namespacesModalState?.providerImage}
|
|
251
|
-
|
|
310
|
+
availableNamespaces={namespacesModalState?.availableNamespaces}
|
|
252
311
|
singleNamespace={namespacesModalState?.singleNamespace}
|
|
253
312
|
/>
|
|
313
|
+
<WalletDerivationPathModal
|
|
314
|
+
open={!!derivationPathModalState?.open}
|
|
315
|
+
selectedNamespace={derivationPathModalState?.namespace}
|
|
316
|
+
type={derivationPathModalState?.providerType}
|
|
317
|
+
image={derivationPathModalState?.providerImage}
|
|
318
|
+
onClose={handleCloseDerivationPathModal}
|
|
319
|
+
onConfirm={handleDerivationPathConfirm}
|
|
320
|
+
/>
|
|
254
321
|
{!!experimentalChainWallet && (
|
|
255
322
|
<WatermarkedModal
|
|
256
323
|
open={!!experimentalChainWallet && showExperimentalChainModal}
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
16
16
|
} from '../../constants/routing';
|
|
17
17
|
import { getContainer } from '../../utils/common';
|
|
18
|
-
import {
|
|
18
|
+
import { numberToString } from '../../utils/numbers';
|
|
19
19
|
|
|
20
20
|
import { calculateGroupsSoFar } from './HistoryGroupedList.helpers';
|
|
21
21
|
import {
|
|
@@ -130,7 +130,7 @@ export function HistoryGroupedList(props: PropTypes) {
|
|
|
130
130
|
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
131
131
|
TOKEN_AMOUNT_MAX_DECIMALS
|
|
132
132
|
),
|
|
133
|
-
realAmount:
|
|
133
|
+
realAmount: swap.inputAmount,
|
|
134
134
|
},
|
|
135
135
|
to: {
|
|
136
136
|
token: {
|
|
@@ -147,10 +147,10 @@ export function HistoryGroupedList(props: PropTypes) {
|
|
|
147
147
|
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
148
148
|
TOKEN_AMOUNT_MAX_DECIMALS
|
|
149
149
|
),
|
|
150
|
-
realAmount:
|
|
150
|
+
realAmount:
|
|
151
151
|
lastStep.outputAmount ||
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
lastStep.expectedOutputAmountHumanReadable ||
|
|
153
|
+
'',
|
|
154
154
|
},
|
|
155
155
|
}}
|
|
156
156
|
/>
|
|
@@ -1,32 +1,13 @@
|
|
|
1
1
|
import type { Notification } from '../../types/notification';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { EventSeverity } from '@rango-dev/queue-manager-rango-preset';
|
|
5
|
-
import {
|
|
6
|
-
ChainToken,
|
|
7
|
-
ChevronRightIcon,
|
|
8
|
-
Divider,
|
|
9
|
-
Typography,
|
|
10
|
-
} from '@rango-dev/ui';
|
|
3
|
+
import { Notifications } from '@rango-dev/ui';
|
|
11
4
|
import React from 'react';
|
|
12
5
|
import { useNavigate } from 'react-router-dom';
|
|
13
6
|
|
|
14
7
|
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
15
8
|
import { useAppStore } from '../../store/AppStore';
|
|
16
9
|
import { useNotificationStore } from '../../store/notification';
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
ClearAllButton,
|
|
20
|
-
Container,
|
|
21
|
-
Header,
|
|
22
|
-
IconContainer,
|
|
23
|
-
Images,
|
|
24
|
-
List,
|
|
25
|
-
ListItem,
|
|
26
|
-
} from './NotificationContent.styles';
|
|
27
|
-
import { NotificationNotFound } from './NotificationNotFound';
|
|
28
|
-
|
|
29
|
-
const MAX_NOTIFICATIONS_DISPLAYED = 4;
|
|
10
|
+
import { getBlockchainImage } from '../../utils/meta';
|
|
30
11
|
|
|
31
12
|
export function NotificationContent() {
|
|
32
13
|
const navigate = useNavigate();
|
|
@@ -36,102 +17,20 @@ export function NotificationContent() {
|
|
|
36
17
|
const notifications: Notification[] = getNotifications();
|
|
37
18
|
const blockchains = useAppStore().blockchains();
|
|
38
19
|
const { findToken } = useAppStore();
|
|
39
|
-
const sortedNotification = notifications
|
|
40
|
-
.sort((a, b) => b.creationTime - a.creationTime)
|
|
41
|
-
.slice(0, MAX_NOTIFICATIONS_DISPLAYED);
|
|
42
20
|
|
|
43
|
-
const
|
|
21
|
+
const onClickItem = (requestId: Notification['requestId']) => {
|
|
44
22
|
navigate(`${navigationRoutes.swaps}/${requestId}`);
|
|
45
23
|
};
|
|
46
24
|
|
|
47
25
|
return (
|
|
48
|
-
<
|
|
49
|
-
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
size="xsmall"
|
|
58
|
-
onClick={clearNotifications}>
|
|
59
|
-
<Typography variant="body" size="xsmall">
|
|
60
|
-
{i18n.t('Clear all')}
|
|
61
|
-
</Typography>
|
|
62
|
-
</ClearAllButton>
|
|
63
|
-
</Header>
|
|
64
|
-
<Divider direction="vertical" size={4} />
|
|
65
|
-
</>
|
|
66
|
-
)}
|
|
67
|
-
{sortedNotification.length ? (
|
|
68
|
-
<List>
|
|
69
|
-
{sortedNotification.map((notificationItem, index) => {
|
|
70
|
-
const { route, requestId, event } = notificationItem;
|
|
71
|
-
const fromToken = findToken(route.from);
|
|
72
|
-
|
|
73
|
-
const fromBlockchain = blockchains.find(
|
|
74
|
-
(blockchainItem) => blockchainItem.name === route.from.blockchain
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
const toToken = findToken(route.to);
|
|
78
|
-
|
|
79
|
-
const toBlockchain = blockchains.find(
|
|
80
|
-
(blockchainItem) => blockchainItem.name === route.to.blockchain
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<React.Fragment key={requestId}>
|
|
85
|
-
{index > 0 && <Divider size={4} />}
|
|
86
|
-
<ListItem
|
|
87
|
-
onClick={() => handleOnClick(requestId)}
|
|
88
|
-
actionRequired={
|
|
89
|
-
event.messageSeverity === EventSeverity.WARNING
|
|
90
|
-
}
|
|
91
|
-
title={
|
|
92
|
-
<Typography
|
|
93
|
-
variant="body"
|
|
94
|
-
size="small"
|
|
95
|
-
color={
|
|
96
|
-
event.messageSeverity === EventSeverity.WARNING
|
|
97
|
-
? '$foreground'
|
|
98
|
-
: '$neutral700'
|
|
99
|
-
}>
|
|
100
|
-
{i18n.t(event.message)}
|
|
101
|
-
</Typography>
|
|
102
|
-
}
|
|
103
|
-
id={requestId}
|
|
104
|
-
start={
|
|
105
|
-
<Images>
|
|
106
|
-
<div className="from-chain-token">
|
|
107
|
-
<ChainToken
|
|
108
|
-
tokenImage={fromToken ? fromToken.image : ''}
|
|
109
|
-
chainImage={fromBlockchain ? fromBlockchain.logo : ''}
|
|
110
|
-
size="small"
|
|
111
|
-
/>
|
|
112
|
-
</div>
|
|
113
|
-
<div className="to-chain-token">
|
|
114
|
-
<ChainToken
|
|
115
|
-
tokenImage={toToken ? toToken.image : ''}
|
|
116
|
-
chainImage={toBlockchain ? toBlockchain.logo : ''}
|
|
117
|
-
size="small"
|
|
118
|
-
/>
|
|
119
|
-
</div>
|
|
120
|
-
</Images>
|
|
121
|
-
}
|
|
122
|
-
end={
|
|
123
|
-
<IconContainer>
|
|
124
|
-
<ChevronRightIcon size={12} color="gray" />
|
|
125
|
-
</IconContainer>
|
|
126
|
-
}
|
|
127
|
-
/>
|
|
128
|
-
</React.Fragment>
|
|
129
|
-
);
|
|
130
|
-
})}
|
|
131
|
-
</List>
|
|
132
|
-
) : (
|
|
133
|
-
<NotificationNotFound />
|
|
134
|
-
)}
|
|
135
|
-
</Container>
|
|
26
|
+
<Notifications
|
|
27
|
+
list={notifications}
|
|
28
|
+
getBlockchainImage={(blockchain) =>
|
|
29
|
+
getBlockchainImage(blockchain, blockchains) ?? ''
|
|
30
|
+
}
|
|
31
|
+
getTokenImage={(token) => findToken(token)?.image ?? ''}
|
|
32
|
+
onClickItem={onClickItem}
|
|
33
|
+
onClearAll={clearNotifications}
|
|
34
|
+
/>
|
|
136
35
|
);
|
|
137
36
|
}
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
Divider,
|
|
9
9
|
FullExpandedQuote,
|
|
10
10
|
InfoIcon,
|
|
11
|
+
NumericTooltip,
|
|
11
12
|
QuoteTag,
|
|
12
13
|
StepDetails,
|
|
13
14
|
TokenAmount,
|
|
14
|
-
Tooltip,
|
|
15
15
|
Typography,
|
|
16
16
|
} from '@rango-dev/ui';
|
|
17
17
|
import BigNumber from 'bignumber.js';
|
|
@@ -40,7 +40,6 @@ import {
|
|
|
40
40
|
getSwapperDisplayName,
|
|
41
41
|
} from '../../utils/meta';
|
|
42
42
|
import {
|
|
43
|
-
formatTooltipNumbers,
|
|
44
43
|
numberToString,
|
|
45
44
|
roundedSecondsToString,
|
|
46
45
|
totalArrivalTime,
|
|
@@ -186,14 +185,10 @@ export function Quote(props: QuoteProps) {
|
|
|
186
185
|
USD_VALUE_MIN_DECIMALS,
|
|
187
186
|
USD_VALUE_MAX_DECIMALS
|
|
188
187
|
),
|
|
189
|
-
realValue:
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
new BigNumber(swap.from.usdPrice ?? 0).multipliedBy(
|
|
194
|
-
swap.fromAmount
|
|
195
|
-
)
|
|
196
|
-
),
|
|
188
|
+
realValue: index === 0 ? input.value : swap.fromAmount,
|
|
189
|
+
realUsdValue: new BigNumber(swap.from.usdPrice ?? 0)
|
|
190
|
+
.multipliedBy(swap.fromAmount)
|
|
191
|
+
.toString(),
|
|
197
192
|
},
|
|
198
193
|
},
|
|
199
194
|
to: {
|
|
@@ -216,10 +211,10 @@ export function Quote(props: QuoteProps) {
|
|
|
216
211
|
USD_VALUE_MIN_DECIMALS,
|
|
217
212
|
USD_VALUE_MAX_DECIMALS
|
|
218
213
|
),
|
|
219
|
-
realValue:
|
|
220
|
-
realUsdValue:
|
|
221
|
-
|
|
222
|
-
|
|
214
|
+
realValue: swap.toAmount,
|
|
215
|
+
realUsdValue: new BigNumber(swap.to.usdPrice ?? 0)
|
|
216
|
+
.multipliedBy(swap.toAmount)
|
|
217
|
+
.toString(),
|
|
223
218
|
},
|
|
224
219
|
},
|
|
225
220
|
state: stepState,
|
|
@@ -343,8 +338,8 @@ export function Quote(props: QuoteProps) {
|
|
|
343
338
|
outputPrice={{
|
|
344
339
|
value: roundedOutput,
|
|
345
340
|
usdValue: roundedOutputUsdValue,
|
|
346
|
-
realValue:
|
|
347
|
-
realUsdValue:
|
|
341
|
+
realValue: output.value,
|
|
342
|
+
realUsdValue: output.usdValue,
|
|
348
343
|
}}
|
|
349
344
|
/>
|
|
350
345
|
) : (
|
|
@@ -414,8 +409,8 @@ export function Quote(props: QuoteProps) {
|
|
|
414
409
|
<BasicInfoOutput size="small" variant="body">
|
|
415
410
|
{`${roundedInput} ${steps[0].from.token.displayName} = `}
|
|
416
411
|
</BasicInfoOutput>
|
|
417
|
-
<
|
|
418
|
-
content={
|
|
412
|
+
<NumericTooltip
|
|
413
|
+
content={output.value}
|
|
419
414
|
container={container}
|
|
420
415
|
open={!output.value ? false : undefined}>
|
|
421
416
|
<BasicInfoOutput size="small" variant="body">
|
|
@@ -424,16 +419,14 @@ export function Quote(props: QuoteProps) {
|
|
|
424
419
|
steps[steps.length - 1].to.token.displayName
|
|
425
420
|
}`}
|
|
426
421
|
</BasicInfoOutput>
|
|
427
|
-
</
|
|
422
|
+
</NumericTooltip>
|
|
428
423
|
</ContainerInfoOutput>
|
|
429
|
-
<
|
|
430
|
-
content={formatTooltipNumbers(output.usdValue)}
|
|
431
|
-
container={container}>
|
|
424
|
+
<NumericTooltip content={output.usdValue} container={container}>
|
|
432
425
|
<Divider size={2} direction="horizontal" />
|
|
433
426
|
<Typography color="$neutral600" size="xsmall" variant="body">
|
|
434
427
|
{`($${roundedOutputUsdValue})`}
|
|
435
428
|
</Typography>
|
|
436
|
-
</
|
|
429
|
+
</NumericTooltip>
|
|
437
430
|
</div>
|
|
438
431
|
)}
|
|
439
432
|
{type === 'list-item' && (
|
|
@@ -444,8 +437,8 @@ export function Quote(props: QuoteProps) {
|
|
|
444
437
|
price={{
|
|
445
438
|
value: roundedOutput,
|
|
446
439
|
usdValue: roundedOutputUsdValue,
|
|
447
|
-
realValue:
|
|
448
|
-
realUsdValue:
|
|
440
|
+
realValue: output.value,
|
|
441
|
+
realUsdValue: output.usdValue,
|
|
449
442
|
}}
|
|
450
443
|
token={{
|
|
451
444
|
displayName: steps[numberOfSteps - 1].to.token.displayName,
|
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
CloseIcon,
|
|
9
9
|
Divider,
|
|
10
10
|
IconButton,
|
|
11
|
+
NumericTooltip,
|
|
11
12
|
QuoteCost,
|
|
12
|
-
Tooltip,
|
|
13
13
|
Typography,
|
|
14
14
|
} from '@rango-dev/ui';
|
|
15
15
|
import React, { useState } from 'react';
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { getFeeLabel } from '../../constants/quote';
|
|
18
18
|
import {
|
|
19
19
|
GAS_FEE_MAX_DECIMALS,
|
|
20
20
|
GAS_FEE_MIN_DECIMALS,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
USD_VALUE_MIN_DECIMALS,
|
|
23
23
|
} from '../../constants/routing';
|
|
24
24
|
import { getContainer } from '../../utils/common';
|
|
25
|
-
import {
|
|
25
|
+
import { numberToString } from '../../utils/numbers';
|
|
26
26
|
import { getFeesGroup, getTotalFeesInUsd, getUsdFee } from '../../utils/swap';
|
|
27
27
|
import { WatermarkedModal } from '../common/WatermarkedModal';
|
|
28
28
|
import { CustomCollapsible } from '../CustomCollapsible/CustomCollapsible';
|
|
@@ -115,11 +115,9 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
|
|
|
115
115
|
variant="label"
|
|
116
116
|
size="medium"
|
|
117
117
|
color="neutral600">
|
|
118
|
-
{
|
|
118
|
+
{getFeeLabel(payableFeesKey as NameOfFees, i18n.t)}
|
|
119
119
|
</Typography>
|
|
120
|
-
<
|
|
121
|
-
content={formatTooltipNumbers(fee.amount)}
|
|
122
|
-
container={container}>
|
|
120
|
+
<NumericTooltip content={fee.amount} container={container}>
|
|
123
121
|
<Typography variant="label" size="medium">
|
|
124
122
|
{numberToString(
|
|
125
123
|
fee.amount,
|
|
@@ -134,7 +132,7 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
|
|
|
134
132
|
)}
|
|
135
133
|
)
|
|
136
134
|
</Typography>
|
|
137
|
-
</
|
|
135
|
+
</NumericTooltip>
|
|
138
136
|
</FeeSection>
|
|
139
137
|
);
|
|
140
138
|
})
|
|
@@ -184,7 +182,10 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
|
|
|
184
182
|
{Object.entries(feesGroup.nonePayable).map(
|
|
185
183
|
([nonPayableFeesKey, fees], index) => {
|
|
186
184
|
const totalFeeInUsd = getTotalFeesInUsd(fees);
|
|
187
|
-
const label =
|
|
185
|
+
const label = getFeeLabel(
|
|
186
|
+
nonPayableFeesKey as NameOfFees,
|
|
187
|
+
i18n.t
|
|
188
|
+
);
|
|
188
189
|
const key = `non-payable-fee-${index}`;
|
|
189
190
|
return (
|
|
190
191
|
<NonPayableFee
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as Stitches from '@stitches/react';
|
|
1
2
|
import type React from 'react';
|
|
2
3
|
|
|
3
4
|
export type PropTypes = {
|
|
@@ -7,4 +8,5 @@ export type PropTypes = {
|
|
|
7
8
|
size?: 'small' | 'large';
|
|
8
9
|
value: string;
|
|
9
10
|
setValue?: (value: string) => void;
|
|
11
|
+
style?: Stitches.CSS;
|
|
10
12
|
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'value'>;
|