@rango-dev/widget-embedded 0.21.1-next.1 → 0.21.1-next.3
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/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModal.d.ts.map +1 -1
- package/dist/constants/index.d.ts +7 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/types/config.d.ts +1 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/notification.d.ts +4 -4
- package/dist/types/notification.d.ts.map +1 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +1 -1
- package/package.json +2 -2
- package/readme.md +1 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +2 -2
- package/src/components/ConfirmWalletsModal/WalletList.tsx +2 -2
- package/src/components/Layout/Layout.styles.ts +0 -1
- package/src/components/Layout/Layout.tsx +5 -2
- package/src/components/NotificationContent/NotificationContent.tsx +13 -22
- package/src/components/NotificationContent/NotificationNotFound.tsx +1 -1
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +4 -2
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +4 -2
- package/src/components/WalletModal/WalletModal.tsx +4 -2
- package/src/constants/index.ts +7 -1
- package/src/hooks/useSwapInput.ts +2 -2
- package/src/hooks/useSyncStoresWithConfig.ts +3 -3
- package/src/index.ts +2 -0
- package/src/pages/Home.tsx +2 -2
- package/src/store/notification.ts +4 -4
- package/src/store/slices/config.ts +1 -0
- package/src/store/slices/data.ts +2 -2
- package/src/types/config.ts +1 -0
- package/src/types/notification.ts +4 -4
- package/src/utils/common.ts +2 -2
- package/src/utils/configs.ts +3 -3
- package/src/utils/meta.ts +2 -2
- package/src/utils/wallets.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/store/slices/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAC;AAE1D,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/store/slices/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAC;AAE1D,eAAO,MAAM,cAAc,EAAE,YAM5B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,YAAY,CAAC;IAErB,YAAY,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,2BAA2B,CACzD,YAAY,EACZ,WAAW,EACX,WAAW,CAiBZ,CAAC"}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -172,6 +172,7 @@ export type Features = Partial<Record<'theme' | 'language' | 'connectWalletButto
|
|
|
172
172
|
export type WidgetConfig = {
|
|
173
173
|
apiKey: string;
|
|
174
174
|
apiUrl?: string;
|
|
175
|
+
title?: string;
|
|
175
176
|
walletConnectProjectId?: string;
|
|
176
177
|
affiliate?: WidgetAffiliate;
|
|
177
178
|
amount?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|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AAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,wBAAwB,CAAC;IAChC,EAAE,CAAC,EAAE,wBAAwB,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,CAAC,UAAU,GAAG,iBAAiB,CAAC,EAAE,CAAC;IAC7C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC"}
|
|
@@ -2,13 +2,13 @@ import { type Route, type RouteEvent, type Step, type StepEvent } from '@rango-d
|
|
|
2
2
|
type NotificationRoute = {
|
|
3
3
|
from: {
|
|
4
4
|
blockchain: Step['fromBlockchain'];
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
symbol: Step['fromSymbol'];
|
|
6
|
+
address: Step['fromSymbolAddress'];
|
|
7
7
|
};
|
|
8
8
|
to: {
|
|
9
9
|
blockchain: Step['toBlockchain'];
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
symbol: Step['toSymbol'];
|
|
11
|
+
address: Step['toSymbolAddress'];
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
export type Notification = Pick<Route, 'requestId'> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../src/types/notification.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,SAAS,EACf,MAAM,uCAAuC,CAAC;AAE/C,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE;QACJ,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACnC,
|
|
1
|
+
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../src/types/notification.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,SAAS,EACf,MAAM,uCAAuC,CAAC;AAE/C,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE;QACJ,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACnC,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3B,OAAO,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;KACpC,CAAC;IACF,EAAE,EAAE;QACF,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACjC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACzB,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;KAClC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG;IACpD,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,iBAAiB,CAAC;CAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEtD;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAC3B,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,WAK5B;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAGvB,GAAG,UAS9B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAGtE;AAED,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEtD;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAC3B,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,WAK5B;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAGvB,GAAG,UAS9B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAGtE;AAED,eAAO,MAAM,YAAY,mBACyC,CAAC"}
|
package/dist/utils/wallets.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare const isExperimentalChain: (blockchains: BlockchainMeta[], wallet
|
|
|
18
18
|
export declare const getKeplrCompatibleConnectedWallets: (selectableWallets: Wallet[]) => WalletType[];
|
|
19
19
|
export declare function formatBalance(balance: Balance | null): Balance | null;
|
|
20
20
|
export declare function sortTokens(tokens: Token[], getBalanceFor: (token: Token) => Balance | null, isTokenPinned: (token: Token) => boolean): Token[];
|
|
21
|
-
export declare function
|
|
21
|
+
export declare function areTokensEqual(tokenA: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null, tokenB: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null): boolean;
|
|
22
22
|
export declare function sortWalletsBasedOnConnectionState(wallets: ModalWalletInfo[]): ModalWalletInfo[];
|
|
23
23
|
export declare function getConciseAddress(address: string, maxChars?: number, ellipsisLength?: number): string;
|
|
24
24
|
export declare function getAddress({ chain, connectedWallets, walletType, }: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.21.1-next.
|
|
3
|
+
"version": "0.21.1-next.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@rango-dev/queue-manager-core": "^0.25.0",
|
|
26
26
|
"@rango-dev/queue-manager-rango-preset": "^0.26.0",
|
|
27
27
|
"@rango-dev/queue-manager-react": "^0.25.0",
|
|
28
|
-
"@rango-dev/ui": "^0.27.1-next.
|
|
28
|
+
"@rango-dev/ui": "^0.27.1-next.1",
|
|
29
29
|
"@rango-dev/wallets-react": "^0.12.0",
|
|
30
30
|
"@rango-dev/wallets-shared": "^0.26.0",
|
|
31
31
|
"bignumber.js": "^9.1.1",
|
package/readme.md
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import React, { useEffect, useState } from 'react';
|
|
19
19
|
import { useNavigate } from 'react-router-dom';
|
|
20
20
|
|
|
21
|
-
import {
|
|
21
|
+
import { WIDGET_UI_ID } from '../../constants';
|
|
22
22
|
import { getQuoteErrorMessage } from '../../constants/errors';
|
|
23
23
|
import { getQuoteUpdateWarningMessage } from '../../constants/warnings';
|
|
24
24
|
import { useAppStore } from '../../store/AppStore';
|
|
@@ -228,7 +228,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
228
228
|
}, [connectedWallets.length]);
|
|
229
229
|
|
|
230
230
|
const modalContainer = document.getElementById(
|
|
231
|
-
|
|
231
|
+
WIDGET_UI_ID.SWAP_BOX_ID
|
|
232
232
|
) as HTMLDivElement;
|
|
233
233
|
|
|
234
234
|
const navigate = useNavigate();
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import React, { useEffect, useState } from 'react';
|
|
19
19
|
|
|
20
20
|
import { useWallets } from '../..';
|
|
21
|
-
import {
|
|
21
|
+
import { WIDGET_UI_ID } from '../../constants';
|
|
22
22
|
import { useWalletList } from '../../hooks/useWalletList';
|
|
23
23
|
import {
|
|
24
24
|
TIME_TO_CLOSE_MODAL,
|
|
@@ -112,7 +112,7 @@ export function WalletList(props: PropTypes) {
|
|
|
112
112
|
}, [JSON.stringify(list)]);
|
|
113
113
|
|
|
114
114
|
const modalContainer = document.getElementById(
|
|
115
|
-
|
|
115
|
+
WIDGET_UI_ID.SWAP_BOX_ID
|
|
116
116
|
) as HTMLDivElement;
|
|
117
117
|
|
|
118
118
|
useEffect(() => {
|
|
@@ -6,7 +6,7 @@ import { useManager } from '@rango-dev/queue-manager-react';
|
|
|
6
6
|
import { BottomLogo, Divider, Header } from '@rango-dev/ui';
|
|
7
7
|
import React, { useEffect, useRef } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { WIDGET_UI_ID } from '../../constants';
|
|
10
10
|
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
11
11
|
import { useTheme } from '../../hooks/useTheme';
|
|
12
12
|
import { useAppStore } from '../../store/AppStore';
|
|
@@ -76,7 +76,10 @@ function Layout(props: PropsWithChildren<PropTypes>) {
|
|
|
76
76
|
}, []);
|
|
77
77
|
|
|
78
78
|
return (
|
|
79
|
-
<Container
|
|
79
|
+
<Container
|
|
80
|
+
height={height}
|
|
81
|
+
id={WIDGET_UI_ID.SWAP_BOX_ID}
|
|
82
|
+
className={activeTheme()}>
|
|
80
83
|
<Header
|
|
81
84
|
prefix={<>{showBackButton && <BackButton onClick={navigateBack} />}</>}
|
|
82
85
|
title={header.title}
|
|
@@ -14,6 +14,7 @@ import { useNavigate } from 'react-router-dom';
|
|
|
14
14
|
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
15
15
|
import { useAppStore } from '../../store/AppStore';
|
|
16
16
|
import { useNotificationStore } from '../../store/notification';
|
|
17
|
+
import { areTokensEqual } from '../../utils/wallets';
|
|
17
18
|
|
|
18
19
|
import { Container, Images, List } from './NotificationContent.styles';
|
|
19
20
|
import { NotificationNotFound } from './NotificationNotFound';
|
|
@@ -41,50 +42,40 @@ export function NotificationContent() {
|
|
|
41
42
|
{sortedNotification.length ? (
|
|
42
43
|
<List>
|
|
43
44
|
{sortedNotification.map((notificationItem) => {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
notificationItem.route.from.tokenAddress &&
|
|
48
|
-
tokenItem.blockchain ===
|
|
49
|
-
notificationItem.route.from.blockchain &&
|
|
50
|
-
tokenItem.symbol === notificationItem.route.from.tokenSymbol
|
|
45
|
+
const { route, requestId, event } = notificationItem;
|
|
46
|
+
const fromToken = tokens.find((tokenItem) =>
|
|
47
|
+
areTokensEqual(tokenItem, route.from)
|
|
51
48
|
);
|
|
52
49
|
|
|
53
50
|
const fromBlockchain = blockchains.find(
|
|
54
|
-
(blockchainItem) =>
|
|
55
|
-
blockchainItem.name === notificationItem.route.from.blockchain
|
|
51
|
+
(blockchainItem) => blockchainItem.name === route.from.blockchain
|
|
56
52
|
);
|
|
57
53
|
|
|
58
|
-
const toToken = tokens.find(
|
|
59
|
-
(tokenItem)
|
|
60
|
-
tokenItem.address === notificationItem.route.to.tokenAddress &&
|
|
61
|
-
tokenItem.blockchain === notificationItem.route.to.blockchain &&
|
|
62
|
-
tokenItem.symbol === notificationItem.route.to.tokenSymbol
|
|
54
|
+
const toToken = tokens.find((tokenItem) =>
|
|
55
|
+
areTokensEqual(tokenItem, route.to)
|
|
63
56
|
);
|
|
64
57
|
|
|
65
58
|
const toBlockchain = blockchains.find(
|
|
66
|
-
(blockchainItem) =>
|
|
67
|
-
blockchainItem.name === notificationItem.route.to.blockchain
|
|
59
|
+
(blockchainItem) => blockchainItem.name === route.to.blockchain
|
|
68
60
|
);
|
|
69
61
|
|
|
70
62
|
return (
|
|
71
63
|
<ListItemButton
|
|
72
|
-
key={
|
|
73
|
-
onClick={() => handleOnClick(
|
|
64
|
+
key={requestId}
|
|
65
|
+
onClick={() => handleOnClick(requestId)}
|
|
74
66
|
title={
|
|
75
67
|
<Typography
|
|
76
68
|
variant="body"
|
|
77
69
|
size="small"
|
|
78
70
|
color={
|
|
79
|
-
|
|
80
|
-
EventSeverity.WARNING
|
|
71
|
+
event.messageSeverity === EventSeverity.WARNING
|
|
81
72
|
? '$foreground'
|
|
82
73
|
: '$neutral700'
|
|
83
74
|
}>
|
|
84
|
-
{i18n.t(
|
|
75
|
+
{i18n.t(event.message)}
|
|
85
76
|
</Typography>
|
|
86
77
|
}
|
|
87
|
-
id={
|
|
78
|
+
id={requestId}
|
|
88
79
|
start={
|
|
89
80
|
<Images>
|
|
90
81
|
<div className="from-chain-token">
|
|
@@ -10,7 +10,7 @@ export function NotificationNotFound() {
|
|
|
10
10
|
<NoNotificationIcon color="secondary" size={26} />
|
|
11
11
|
<Divider size={12} />
|
|
12
12
|
<Typography variant="body" size="medium" color="neutral700">
|
|
13
|
-
{i18n.t('
|
|
13
|
+
{i18n.t('There are no notifications.')}
|
|
14
14
|
</Typography>
|
|
15
15
|
</NotFoundContainer>
|
|
16
16
|
);
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { useNavigate } from 'react-router-dom';
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { WIDGET_UI_ID } from '../../constants';
|
|
16
16
|
import { getContainer } from '../../utils/common';
|
|
17
17
|
|
|
18
18
|
export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
@@ -36,7 +36,9 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
|
36
36
|
<Modal
|
|
37
37
|
open={open}
|
|
38
38
|
onClose={onClose}
|
|
39
|
-
container={
|
|
39
|
+
container={
|
|
40
|
+
document.getElementById(WIDGET_UI_ID.SWAP_BOX_ID) || document.body
|
|
41
|
+
}>
|
|
40
42
|
{status === 'success' ? (
|
|
41
43
|
<MessageBox type="success" title={i18n.t('Swap Successful')}>
|
|
42
44
|
<TokenAmount
|
|
@@ -4,7 +4,7 @@ import { Modal } from '@rango-dev/ui';
|
|
|
4
4
|
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { WIDGET_UI_ID } from '../../constants';
|
|
8
8
|
|
|
9
9
|
import { CancelContent } from './SwapDetailsModal.Cancel';
|
|
10
10
|
import { DeleteContent } from './SwapDetailsModal.Delete';
|
|
@@ -31,7 +31,9 @@ export function SwapDetailsModal(props: ModalPropTypes) {
|
|
|
31
31
|
<Modal
|
|
32
32
|
open={!!state}
|
|
33
33
|
onClose={onClose}
|
|
34
|
-
container={
|
|
34
|
+
container={
|
|
35
|
+
document.getElementById(WIDGET_UI_ID.SWAP_BOX_ID) || document.body
|
|
36
|
+
}>
|
|
35
37
|
{showWalletStateContent && (
|
|
36
38
|
<WalletStateContent
|
|
37
39
|
type={modalNetworkValues[state].type}
|
|
@@ -3,7 +3,7 @@ import type { PropTypes } from './WalletModal.types';
|
|
|
3
3
|
import { Divider, Modal } from '@rango-dev/ui';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { WIDGET_UI_ID } from '../../constants';
|
|
7
7
|
|
|
8
8
|
import { ModalContent } from './WalletModalContent';
|
|
9
9
|
|
|
@@ -14,7 +14,9 @@ export function WalletModal(props: PropTypes) {
|
|
|
14
14
|
<Modal
|
|
15
15
|
open={open}
|
|
16
16
|
onClose={onClose}
|
|
17
|
-
container={
|
|
17
|
+
container={
|
|
18
|
+
document.getElementById(WIDGET_UI_ID.SWAP_BOX_ID) || document.body
|
|
19
|
+
}>
|
|
18
20
|
<ModalContent {...otherProps} />
|
|
19
21
|
<Divider direction="vertical" size={32} />
|
|
20
22
|
</Modal>
|
package/src/constants/index.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import { UI_ID } from '@rango-dev/ui';
|
|
2
|
+
|
|
1
3
|
export const RANGO_PUBLIC_API_KEY = 'c6381a79-2817-4602-83bf-6a641a409e32';
|
|
2
4
|
export const DEFAULT_BASE_URL = 'https://api.rango.exchange';
|
|
3
|
-
export const RANGO_SWAP_BOX_ID = 'rango-swap-box';
|
|
4
5
|
export const SCANNER_BASE_URL = 'https://scan.rango.exchange';
|
|
6
|
+
|
|
7
|
+
export const WIDGET_UI_ID = {
|
|
8
|
+
SWAP_BOX_ID: 'rango-swap-box',
|
|
9
|
+
...UI_ID,
|
|
10
|
+
};
|
|
@@ -11,7 +11,7 @@ import { isPositiveNumber } from '../utils/numbers';
|
|
|
11
11
|
import { generateQuoteWarnings } from '../utils/quote';
|
|
12
12
|
import { isFeatureEnabled } from '../utils/settings';
|
|
13
13
|
import { createQuoteRequestBody } from '../utils/swap';
|
|
14
|
-
import {
|
|
14
|
+
import { areTokensEqual } from '../utils/wallets';
|
|
15
15
|
|
|
16
16
|
import {
|
|
17
17
|
handleQuoteErrors,
|
|
@@ -68,7 +68,7 @@ export function useSwapInput(): UseSwapInput {
|
|
|
68
68
|
const tokensValueInvalid = !fromToken || !toToken;
|
|
69
69
|
const shouldSkipRequest =
|
|
70
70
|
tokensValueInvalid ||
|
|
71
|
-
|
|
71
|
+
areTokensEqual(fromToken, toToken) ||
|
|
72
72
|
!isPositiveNumber(inputAmount);
|
|
73
73
|
|
|
74
74
|
const resetState = (loading: boolean) => {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
isBlockchainExcludedInConfig,
|
|
9
9
|
isTokenExcludedInConfig,
|
|
10
10
|
} from '../utils/configs';
|
|
11
|
-
import {
|
|
11
|
+
import { areTokensEqual } from '../utils/wallets';
|
|
12
12
|
|
|
13
13
|
export function useSyncStoresWithConfig() {
|
|
14
14
|
const {
|
|
@@ -50,7 +50,7 @@ export function useSyncStoresWithConfig() {
|
|
|
50
50
|
(chain) => chain.name === config?.from?.blockchain
|
|
51
51
|
);
|
|
52
52
|
const token = tokens.find((t) =>
|
|
53
|
-
|
|
53
|
+
areTokensEqual(t, config?.from?.token || null)
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
if (chain || (!chain && prevConfigFromBlockchain.current)) {
|
|
@@ -99,7 +99,7 @@ export function useSyncStoresWithConfig() {
|
|
|
99
99
|
(chain) => chain.name === config?.to?.blockchain
|
|
100
100
|
);
|
|
101
101
|
const token = tokens.find((t) =>
|
|
102
|
-
|
|
102
|
+
areTokensEqual(t, config?.to?.token || null)
|
|
103
103
|
);
|
|
104
104
|
|
|
105
105
|
if (chain || (!chain && prevConfigToBlockchain.current)) {
|
package/src/index.ts
CHANGED
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
import { Networks, WalletTypes } from '@rango-dev/wallets-shared';
|
|
56
56
|
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
57
57
|
|
|
58
|
+
import { WIDGET_UI_ID as UI_ID } from './constants';
|
|
58
59
|
import { WidgetWallets } from './containers/Wallets';
|
|
59
60
|
import { Widget } from './containers/Widget';
|
|
60
61
|
import { useWidget } from './containers/WidgetInfo';
|
|
@@ -105,6 +106,7 @@ export {
|
|
|
105
106
|
StepEventType,
|
|
106
107
|
StepExecutionEventStatus,
|
|
107
108
|
StepExecutionBlockedEventStatus,
|
|
109
|
+
UI_ID,
|
|
108
110
|
};
|
|
109
111
|
|
|
110
112
|
// Internal type exports for Rango
|
package/src/pages/Home.tsx
CHANGED
|
@@ -62,7 +62,7 @@ export function Home() {
|
|
|
62
62
|
setQuoteWarningsConfirmed,
|
|
63
63
|
} = useQuoteStore();
|
|
64
64
|
|
|
65
|
-
const fetchMetaStatus = useAppStore()
|
|
65
|
+
const { config, fetchStatus: fetchMetaStatus } = useAppStore();
|
|
66
66
|
|
|
67
67
|
const { connectedWallets, getBalanceFor } = useWalletsStore();
|
|
68
68
|
const { isActiveTab } = useUiStore();
|
|
@@ -152,7 +152,7 @@ export function Home() {
|
|
|
152
152
|
navigate(navigationRoutes.wallets);
|
|
153
153
|
},
|
|
154
154
|
hasBackButton: false,
|
|
155
|
-
title: i18n.t('Swap'),
|
|
155
|
+
title: config.title || i18n.t('Swap'),
|
|
156
156
|
suffix: (
|
|
157
157
|
<HomeButtons
|
|
158
158
|
onClickRefresh={
|
|
@@ -34,13 +34,13 @@ export const useNotificationStore = createSelectors(
|
|
|
34
34
|
route: {
|
|
35
35
|
from: {
|
|
36
36
|
blockchain: fromStep.fromBlockchain,
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
address: fromStep.fromSymbolAddress,
|
|
38
|
+
symbol: fromStep.fromSymbol,
|
|
39
39
|
},
|
|
40
40
|
to: {
|
|
41
41
|
blockchain: toStep.toBlockchain,
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
address: toStep.toSymbolAddress,
|
|
43
|
+
symbol: toStep.toSymbol,
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
46
|
};
|
package/src/store/slices/data.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { httpService as sdk } from '../../services/httpService';
|
|
|
8
8
|
import { containsText } from '../../utils/common';
|
|
9
9
|
import { isTokenExcludedInConfig } from '../../utils/configs';
|
|
10
10
|
import { sortLiquiditySourcesByGroupTitle } from '../../utils/settings';
|
|
11
|
-
import {
|
|
11
|
+
import { areTokensEqual } from '../../utils/wallets';
|
|
12
12
|
|
|
13
13
|
type BlockchainOptions = {
|
|
14
14
|
type?: 'source' | 'destination';
|
|
@@ -163,7 +163,7 @@ export const createDataSlice: StateCreator<
|
|
|
163
163
|
? get().config.from?.pinnedTokens
|
|
164
164
|
: get().config.to?.pinnedTokens;
|
|
165
165
|
const pinned = !!pinnedTokens?.some((pinnedToken) =>
|
|
166
|
-
|
|
166
|
+
areTokensEqual(pinnedToken, token)
|
|
167
167
|
);
|
|
168
168
|
return pinned;
|
|
169
169
|
},
|
package/src/types/config.ts
CHANGED
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
type NotificationRoute = {
|
|
9
9
|
from: {
|
|
10
10
|
blockchain: Step['fromBlockchain'];
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
symbol: Step['fromSymbol'];
|
|
12
|
+
address: Step['fromSymbolAddress'];
|
|
13
13
|
};
|
|
14
14
|
to: {
|
|
15
15
|
blockchain: Step['toBlockchain'];
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
symbol: Step['toSymbol'];
|
|
17
|
+
address: Step['toSymbolAddress'];
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
|
package/src/utils/common.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WIDGET_UI_ID } from '../constants';
|
|
2
2
|
|
|
3
3
|
export function removeDuplicateFrom<T>(array: T[]): T[] {
|
|
4
4
|
return Array.from(new Set(array));
|
|
@@ -33,4 +33,4 @@ export function containsText(text: string, searchText: string): boolean {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export const getContainer = () =>
|
|
36
|
-
document.getElementById(
|
|
36
|
+
document.getElementById(WIDGET_UI_ID.SWAP_BOX_ID) as HTMLElement;
|
package/src/utils/configs.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Asset, BlockchainMeta, Token } from 'rango-sdk';
|
|
|
3
3
|
|
|
4
4
|
import { RANGO_PUBLIC_API_KEY } from '../constants';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { areTokensEqual } from './wallets';
|
|
7
7
|
|
|
8
8
|
export interface Configs {
|
|
9
9
|
API_KEY: string;
|
|
@@ -57,10 +57,10 @@ export const isTokenExcludedInConfig = (
|
|
|
57
57
|
let result = false;
|
|
58
58
|
if (tokensConfig && token) {
|
|
59
59
|
if (Array.isArray(tokensConfig)) {
|
|
60
|
-
result = !tokensConfig.some((asset) =>
|
|
60
|
+
result = !tokensConfig.some((asset) => areTokensEqual(asset, token));
|
|
61
61
|
} else if (!Array.isArray(tokensConfig) && tokensConfig[token.blockchain]) {
|
|
62
62
|
result = tokensConfig[token.blockchain].tokens.some((asset) =>
|
|
63
|
-
|
|
63
|
+
areTokensEqual(asset, token)
|
|
64
64
|
);
|
|
65
65
|
const isExcluded = tokensConfig[token.blockchain].isExcluded;
|
|
66
66
|
return (!isExcluded && !result) || (isExcluded && result);
|
package/src/utils/meta.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Asset, BlockchainMeta, SwapperMeta, Token } from 'rango-sdk';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { areTokensEqual } from './wallets';
|
|
4
4
|
|
|
5
5
|
export function getBlockchainDisplayNameFor(
|
|
6
6
|
blockchainName: string,
|
|
@@ -25,7 +25,7 @@ export function getSwapperDisplayName(
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export function findToken(t: Asset, tokens: Token[]) {
|
|
28
|
-
return tokens.find((token) =>
|
|
28
|
+
return tokens.find((token) => areTokensEqual(token, t)) ?? null;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function findBlockchain(name: string, blockchains: BlockchainMeta[]) {
|
package/src/utils/wallets.ts
CHANGED
|
@@ -443,7 +443,7 @@ export function sortTokens(
|
|
|
443
443
|
return tokens;
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
export function
|
|
446
|
+
export function areTokensEqual(
|
|
447
447
|
tokenA: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null,
|
|
448
448
|
tokenB: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null
|
|
449
449
|
) {
|