@rango-dev/widget-embedded 0.17.1-next.17 → 0.17.1-next.19
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/AppRouter.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.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 +159 -0
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.types.d.ts +0 -1
- package/dist/components/Quote/Quote.types.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +1 -0
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -1
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +316 -0
- package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +3 -0
- package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -1
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +6 -3
- package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -1
- package/dist/hooks/useSwapInput.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/types/swap.d.ts +3 -13
- package/dist/types/swap.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +2 -1
- package/dist/utils/meta.d.ts.map +1 -1
- package/dist/utils/quote.d.ts.map +1 -1
- package/dist/utils/swap.d.ts +12 -4
- package/dist/utils/swap.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/AppRouter.tsx +2 -27
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +9 -3
- package/src/components/NoResult/NoResult.helpers.ts +12 -12
- package/src/components/NotificationContent/NotificationContent.tsx +2 -1
- package/src/components/Quote/Quote.styles.ts +20 -0
- package/src/components/Quote/Quote.tsx +98 -30
- package/src/components/Quote/Quote.types.ts +0 -1
- package/src/components/Quote/QuoteSkeleton.tsx +1 -1
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +11 -4
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +13 -13
- package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +1 -0
- package/src/components/SwapDetails/SwapDetails.tsx +2 -2
- package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
- package/src/constants/errors.ts +9 -5
- package/src/containers/QuoteInfo/QuoteInfo.styles.ts +17 -1
- package/src/containers/QuoteInfo/QuoteInfo.tsx +44 -43
- package/src/containers/QuoteInfo/QuoteInfo.types.ts +3 -0
- package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +15 -11
- package/src/hooks/useConfirmSwap/useConfirmSwap.ts +16 -17
- package/src/hooks/useSwapInput.ts +79 -25
- package/src/pages/ConfirmSwapPage.tsx +29 -6
- package/src/pages/Home.tsx +36 -45
- package/src/types/swap.ts +3 -12
- package/src/utils/meta.ts +8 -1
- package/src/utils/quote.ts +6 -6
- package/src/utils/swap.ts +44 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,
|
|
1
|
+
{"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAqD5E,wBAAgB,eAAe,sBA4S9B"}
|
package/dist/pages/Home.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAgD3D,wBAAgB,IAAI,sBAkPnB"}
|
package/dist/types/swap.d.ts
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import type { SwapSavedSettings } from 'rango-types/lib';
|
|
2
2
|
export type PendingSwapSettings = Omit<SwapSavedSettings, 'disabledSwappersIds'>;
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
SWAP = "swap",
|
|
6
|
-
NEEDTOCONFIRM = "needToConfirm",
|
|
7
|
-
WARNING = "warning"
|
|
8
|
-
}
|
|
9
|
-
export type SwapButtonState = ({
|
|
10
|
-
disabled: true;
|
|
11
|
-
} | {
|
|
12
|
-
disabled: false;
|
|
13
|
-
hasWarning?: boolean;
|
|
14
|
-
}) & {
|
|
3
|
+
export type SwapButtonState = {
|
|
4
|
+
disabled: boolean;
|
|
15
5
|
title: string;
|
|
16
|
-
|
|
6
|
+
action: 'connect-wallet' | 'confirm-warning' | 'confirm-swap';
|
|
17
7
|
};
|
|
18
8
|
export type ConvertedToken = {
|
|
19
9
|
symbol: string;
|
package/dist/types/swap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/types/swap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,iBAAiB,EACjB,qBAAqB,CACtB,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/types/swap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,iBAAiB,EACjB,qBAAqB,CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,gBAAgB,GAAG,iBAAiB,GAAG,cAAc,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,GAAG,IAAI,CAAC"}
|
package/dist/utils/meta.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Asset, BlockchainMeta, Token } from 'rango-sdk';
|
|
1
|
+
import type { Asset, BlockchainMeta, SwapperMeta, Token } from 'rango-sdk';
|
|
2
2
|
export declare function getBlockchainDisplayNameFor(blockchainName: string, blockchains: BlockchainMeta[]): string | undefined;
|
|
3
3
|
export declare function getBlockchainShortNameFor(blockchainName: string, blockchains: BlockchainMeta[]): string | undefined;
|
|
4
|
+
export declare function getSwapperDisplayName(swapperId: string, swappers: SwapperMeta[]): string | undefined;
|
|
4
5
|
export declare function findToken(t: Asset, tokens: Token[]): Token | null;
|
|
5
6
|
export declare function findBlockchain(name: string, blockchains: BlockchainMeta[]): BlockchainMeta | null;
|
|
6
7
|
//# sourceMappingURL=meta.d.ts.map
|
package/dist/utils/meta.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/utils/meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/utils/meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAI3E,wBAAgB,2BAA2B,CACzC,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,cAAc,EAAE,GAC5B,MAAM,GAAG,SAAS,CAGpB;AACD,wBAAgB,yBAAyB,CACvC,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,cAAc,EAAE,GAC5B,MAAM,GAAG,SAAS,CAGpB;AAED,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,WAAW,EAAE,sBAGxB;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,gBAElD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,yBAEzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quote.d.ts","sourceRoot":"","sources":["../../src/utils/quote.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,8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AAE,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB,GACA,YAAY,GAAG,IAAI,CAiDrB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iBAAiB,GACvB,UAAU,GAAG,IAAI,CA+BnB;AAED,wBAAgB,cAAc,CAC5B,aAAa,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,EACxC,cAAc,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,GACxC,MAAM,GAAG,IAAI,CAcf"}
|
package/dist/utils/swap.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { FetchStatus } from '../store/slices/data';
|
|
2
|
-
import type {
|
|
3
|
-
import type { ConvertedToken, RecommendedSlippages, SwapButtonState, Wallet } from '../types';
|
|
2
|
+
import type { ConvertedToken, QuoteError, QuoteWarning, RecommendedSlippages, SwapButtonState, Wallet } from '../types';
|
|
4
3
|
import type { PendingSwap, PendingSwapStep } from '@rango-dev/queue-manager-rango-preset';
|
|
5
4
|
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
6
5
|
import type { BestRouteRequest, BestRouteResponse, BlockchainMeta, RecommendedSlippage, SwapResult, Token } from 'rango-sdk';
|
|
@@ -13,7 +12,16 @@ export declare function getLimitErrorMessage(quote: BestRouteResponse): {
|
|
|
13
12
|
fromAmountRangeError: string;
|
|
14
13
|
recommendation: string;
|
|
15
14
|
};
|
|
16
|
-
export declare function getSwapButtonState(
|
|
15
|
+
export declare function getSwapButtonState(params: {
|
|
16
|
+
fetchMetaStatus: FetchStatus;
|
|
17
|
+
anyWalletConnected: boolean;
|
|
18
|
+
fetchingQuote: boolean;
|
|
19
|
+
inputAmount: string;
|
|
20
|
+
quote: BestRouteResponse | null;
|
|
21
|
+
warning: QuoteWarning | null;
|
|
22
|
+
error: QuoteError | null;
|
|
23
|
+
needsToWarnEthOnPath: boolean;
|
|
24
|
+
}): SwapButtonState;
|
|
17
25
|
export declare function canComputePriceImpact(quote: BestRouteResponse | null, inputAmount: string, usdValue: BigNumber | null): boolean;
|
|
18
26
|
export declare function requiredWallets(quote: BestRouteResponse | null): string[];
|
|
19
27
|
export declare const getUsdPrice: (blockchain: string, symbol: string, address: string | null, allTokens: Token[]) => number | null;
|
|
@@ -54,7 +62,7 @@ export declare function getWalletsForNewSwap(selectedWallets: Wallet[]): {
|
|
|
54
62
|
export declare function getQuoteOutputAmount(quote: BestRouteResponse): string | null;
|
|
55
63
|
export declare function getPercentageChange(input: string, output: string): number;
|
|
56
64
|
export declare function isOutputAmountChangedALot(oldQuote: BestRouteResponse, newQuote: BestRouteResponse): boolean;
|
|
57
|
-
export declare function
|
|
65
|
+
export declare function generateBalanceWarnings(quote: BestRouteResponse, selectedWallets: Wallet[], blockchains: BlockchainMeta[]): string[];
|
|
58
66
|
export declare function calcOutputUsdValue(outputAmount?: string, tokenPrice?: number | null): BigNumber;
|
|
59
67
|
export declare function isNetworkStatusInWarningState(pendingSwapStep: PendingSwapStep | null): boolean;
|
|
60
68
|
export declare function getSwapMessages(pendingSwap: PendingSwap, currentStep: PendingSwapStep | null): {
|
package/dist/utils/swap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/utils/swap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/utils/swap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,MAAM,EACP,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EAChB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BA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CAAC;CACrD,CAyCA;AAED,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,WAAW,GACvB,cAAc,CAkBhB;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,WAAW,WAMvD;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,OAAO,EACjB,qBAAqB,EAAE,OAAO,EAC9B,iBAAiB,EAAE,MAAM,EACzB,KAAK,EAAE,iBAAiB,GAAG,IAAI,EAC/B,eAAe,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,EACxD,oBAAoB,CAAC,EAAE,cAAc,uBActC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.17.1-next.
|
|
3
|
+
"version": "0.17.1-next.19",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@rango-dev/queue-manager-core": "^0.22.1-next.0",
|
|
24
24
|
"@rango-dev/queue-manager-rango-preset": "^0.22.1-next.5",
|
|
25
25
|
"@rango-dev/queue-manager-react": "^0.22.1-next.0",
|
|
26
|
-
"@rango-dev/ui": "^0.22.1-next.
|
|
26
|
+
"@rango-dev/ui": "^0.22.1-next.9",
|
|
27
27
|
"@rango-dev/wallets-react": "^0.8.1-next.3",
|
|
28
28
|
"@rango-dev/wallets-shared": "^0.21.1-next.3",
|
|
29
29
|
"bignumber.js": "^9.1.1",
|
|
@@ -4,39 +4,14 @@ import type { PropsWithChildren } from 'react';
|
|
|
4
4
|
import { useQueueManager } from '@rango-dev/queue-manager-rango-preset';
|
|
5
5
|
import { useWallets } from '@rango-dev/wallets-react';
|
|
6
6
|
import { isEvmBlockchain } from 'rango-types';
|
|
7
|
-
import React, {
|
|
7
|
+
import React, { Fragment } from 'react';
|
|
8
8
|
import { MemoryRouter, useInRouterContext } from 'react-router';
|
|
9
|
-
import { useLocation, useNavigate } from 'react-router-dom';
|
|
10
9
|
|
|
11
|
-
import { navigationRoutes } from '../constants/navigationRoutes';
|
|
12
10
|
import { useForceAutoConnect } from '../hooks/useForceAutoConnect';
|
|
13
|
-
import { Home } from '../pages/Home';
|
|
14
11
|
import { useAppStore } from '../store/AppStore';
|
|
15
12
|
|
|
16
13
|
import { UpdateUrl } from './UpdateUrl';
|
|
17
14
|
|
|
18
|
-
function Route(props: PropsWithChildren) {
|
|
19
|
-
const location = useLocation();
|
|
20
|
-
const navigate = useNavigate();
|
|
21
|
-
const firstRender = useRef(true);
|
|
22
|
-
const paths = location.pathname.split('/');
|
|
23
|
-
const pathMatched = paths[paths.length - 1] === navigationRoutes.confirmSwap;
|
|
24
|
-
const shouldRedirectToMainPage = pathMatched && firstRender.current;
|
|
25
|
-
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (shouldRedirectToMainPage) {
|
|
28
|
-
navigate('.');
|
|
29
|
-
}
|
|
30
|
-
firstRender.current = false;
|
|
31
|
-
}, []);
|
|
32
|
-
|
|
33
|
-
if (shouldRedirectToMainPage) {
|
|
34
|
-
return <Home />;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return <> {props.children}</>;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
15
|
export function AppRouter({
|
|
41
16
|
children,
|
|
42
17
|
...props
|
|
@@ -46,7 +21,7 @@ export function AppRouter({
|
|
|
46
21
|
clearDisconnectedWallet: () => void;
|
|
47
22
|
}) {
|
|
48
23
|
const isRouterInContext = useInRouterContext();
|
|
49
|
-
const Router = isRouterInContext ?
|
|
24
|
+
const Router = isRouterInContext ? Fragment : MemoryRouter;
|
|
50
25
|
const blockchains = useAppStore().blockchains();
|
|
51
26
|
const { canSwitchNetworkTo } = useWallets();
|
|
52
27
|
|
|
@@ -23,6 +23,7 @@ import { getQuoteUpdateWarningMessage } from '../../constants/warnings';
|
|
|
23
23
|
import { useAppStore } from '../../store/AppStore';
|
|
24
24
|
import { useQuoteStore } from '../../store/quote';
|
|
25
25
|
import { useWalletsStore } from '../../store/wallets';
|
|
26
|
+
import { getBlockchainShortNameFor } from '../../utils/meta';
|
|
26
27
|
import { confirmSwapDisabled } from '../../utils/swap';
|
|
27
28
|
|
|
28
29
|
import { getRequiredWallets, isValidAddress } from './ConfirmWallets.helpers';
|
|
@@ -285,7 +286,12 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
285
286
|
<Typography variant="headline" size="small">
|
|
286
287
|
{i18n.t({
|
|
287
288
|
id: 'Your {blockchainName} wallets',
|
|
288
|
-
values: {
|
|
289
|
+
values: {
|
|
290
|
+
blockchainName: getBlockchainShortNameFor(
|
|
291
|
+
showMoreWalletFor,
|
|
292
|
+
blockchains
|
|
293
|
+
),
|
|
294
|
+
},
|
|
289
295
|
})}
|
|
290
296
|
</Typography>
|
|
291
297
|
</ShowMoreHeader>
|
|
@@ -355,7 +361,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
355
361
|
<Typography variant="title" size="xmedium">
|
|
356
362
|
{i18n.t({
|
|
357
363
|
id: 'Your {blockchainName} wallets',
|
|
358
|
-
values: { blockchainName: blockchain?.
|
|
364
|
+
values: { blockchainName: blockchain?.shortName },
|
|
359
365
|
})}
|
|
360
366
|
</Typography>
|
|
361
367
|
<Typography
|
|
@@ -364,7 +370,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
364
370
|
size="medium">
|
|
365
371
|
{i18n.t({
|
|
366
372
|
id: 'You need to connect a {blockchainName} wallet.',
|
|
367
|
-
values: { blockchainName: blockchain?.
|
|
373
|
+
values: { blockchainName: blockchain?.shortName },
|
|
368
374
|
})}
|
|
369
375
|
</Typography>
|
|
370
376
|
</Title>
|
|
@@ -27,18 +27,6 @@ export function makeInfo(
|
|
|
27
27
|
},
|
|
28
28
|
description: '',
|
|
29
29
|
};
|
|
30
|
-
} else if (
|
|
31
|
-
error?.type === QuoteErrorType.NO_RESULT &&
|
|
32
|
-
error.diagnosisMessage
|
|
33
|
-
) {
|
|
34
|
-
return {
|
|
35
|
-
alert: {
|
|
36
|
-
type: 'error',
|
|
37
|
-
text: error.diagnosisMessage,
|
|
38
|
-
action: null,
|
|
39
|
-
},
|
|
40
|
-
description: '',
|
|
41
|
-
};
|
|
42
30
|
} else if (disabledLiquiditySources.length) {
|
|
43
31
|
return {
|
|
44
32
|
alert: {
|
|
@@ -51,6 +39,18 @@ export function makeInfo(
|
|
|
51
39
|
},
|
|
52
40
|
description: errorMessages().liquiditySourcesError.description,
|
|
53
41
|
};
|
|
42
|
+
} else if (
|
|
43
|
+
error?.type === QuoteErrorType.NO_RESULT &&
|
|
44
|
+
error.diagnosisMessage
|
|
45
|
+
) {
|
|
46
|
+
return {
|
|
47
|
+
alert: {
|
|
48
|
+
type: 'error',
|
|
49
|
+
text: error.diagnosisMessage,
|
|
50
|
+
action: null,
|
|
51
|
+
},
|
|
52
|
+
description: '',
|
|
53
|
+
};
|
|
54
54
|
}
|
|
55
55
|
return {
|
|
56
56
|
alert: null,
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { useNavigate } from 'react-router-dom';
|
|
12
12
|
|
|
13
|
+
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
13
14
|
import { useAppStore } from '../../store/AppStore';
|
|
14
15
|
import { useNotificationStore } from '../../store/notification';
|
|
15
16
|
import { useUiStore } from '../../store/ui';
|
|
@@ -34,7 +35,7 @@ export function NotificationContent() {
|
|
|
34
35
|
|
|
35
36
|
const handleOnClick = (requestId: Notification['requestId']) => {
|
|
36
37
|
setSelectedSwap(requestId);
|
|
37
|
-
navigate(`${requestId}`);
|
|
38
|
+
navigate(`${navigationRoutes.swaps}/${requestId}`);
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
return (
|
|
@@ -13,6 +13,7 @@ export const QuoteContainer = styled(Collapsible.Root, {
|
|
|
13
13
|
overflowY: 'hidden',
|
|
14
14
|
width: '100%',
|
|
15
15
|
borderRadius: '$xm',
|
|
16
|
+
cursor: 'default',
|
|
16
17
|
variants: {
|
|
17
18
|
recommended: {
|
|
18
19
|
true: {
|
|
@@ -107,6 +108,7 @@ export const SummaryContainer = styled('div', {
|
|
|
107
108
|
'& .summary': {
|
|
108
109
|
width: '100%',
|
|
109
110
|
padding: '$15 $15 $10 $15',
|
|
111
|
+
cursor: 'default',
|
|
110
112
|
},
|
|
111
113
|
'& .basic-info': {
|
|
112
114
|
paddingTop: '$10',
|
|
@@ -169,6 +171,24 @@ export const Chains = styled(Collapsible.Trigger, {
|
|
|
169
171
|
'& div:nth-child(1)': { display: 'flex' },
|
|
170
172
|
});
|
|
171
173
|
|
|
174
|
+
export const ChainImageContainer = styled('div', {
|
|
175
|
+
width: '18px',
|
|
176
|
+
height: '18px',
|
|
177
|
+
borderRadius: '100%',
|
|
178
|
+
border: '1.5px transparent solid',
|
|
179
|
+
display: 'flex',
|
|
180
|
+
justifyContent: 'center',
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
variants: {
|
|
183
|
+
state: {
|
|
184
|
+
error: {
|
|
185
|
+
borderColor: '$error500',
|
|
186
|
+
},
|
|
187
|
+
warning: { borderColor: '$warning500' },
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
|
|
172
192
|
export const Content = styled(CollapsibleContent, {
|
|
173
193
|
width: '100%',
|
|
174
194
|
});
|
|
@@ -25,6 +25,8 @@ import {
|
|
|
25
25
|
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
26
26
|
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
27
27
|
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
28
|
+
USD_VALUE_MAX_DECIMALS,
|
|
29
|
+
USD_VALUE_MIN_DECIMALS,
|
|
28
30
|
} from '../../constants/routing';
|
|
29
31
|
import {
|
|
30
32
|
FooterAlert,
|
|
@@ -32,6 +34,11 @@ import {
|
|
|
32
34
|
} from '../../containers/QuoteInfo/QuoteInfo.styles';
|
|
33
35
|
import { useAppStore } from '../../store/AppStore';
|
|
34
36
|
import { QuoteErrorType, QuoteWarningType } from '../../types';
|
|
37
|
+
import { getContainer } from '../../utils/common';
|
|
38
|
+
import {
|
|
39
|
+
getBlockchainShortNameFor,
|
|
40
|
+
getSwapperDisplayName,
|
|
41
|
+
} from '../../utils/meta';
|
|
35
42
|
import {
|
|
36
43
|
numberToString,
|
|
37
44
|
secondsToString,
|
|
@@ -41,6 +48,7 @@ import { getPriceImpact, getPriceImpactLevel } from '../../utils/quote';
|
|
|
41
48
|
import { getTotalFeeInUsd } from '../../utils/swap';
|
|
42
49
|
|
|
43
50
|
import {
|
|
51
|
+
ChainImageContainer,
|
|
44
52
|
Chains,
|
|
45
53
|
Content,
|
|
46
54
|
EXPANDABLE_QUOTE_TRANSITION_DURATION,
|
|
@@ -63,19 +71,38 @@ export function Quote(props: QuoteProps) {
|
|
|
63
71
|
recommended = true,
|
|
64
72
|
} = props;
|
|
65
73
|
const tokens = useAppStore().tokens();
|
|
74
|
+
const blockchains = useAppStore().blockchains();
|
|
75
|
+
const swappers = useAppStore().swappers();
|
|
66
76
|
|
|
67
77
|
const [expanded, setExpanded] = useState(props.expanded);
|
|
68
78
|
const quoteRef = useRef<HTMLButtonElement | null>(null);
|
|
79
|
+
const prevExpanded = useRef(expanded);
|
|
69
80
|
const totalFee = numberToString(
|
|
70
81
|
getTotalFeeInUsd(quote.result?.swaps ?? [], tokens),
|
|
71
82
|
GAS_FEE_MIN_DECIMALS,
|
|
72
83
|
GAS_FEE_MAX_DECIMALS
|
|
73
84
|
);
|
|
74
85
|
const totalTime = secondsToString(totalArrivalTime(quote.result?.swaps));
|
|
75
|
-
|
|
86
|
+
const roundedInput = numberToString(
|
|
87
|
+
input.value,
|
|
88
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
89
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
90
|
+
);
|
|
91
|
+
const roundedOutput = numberToString(
|
|
92
|
+
output.value,
|
|
93
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
94
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
95
|
+
);
|
|
96
|
+
const roundedOutputUsdValue = output.usdValue
|
|
97
|
+
? numberToString(
|
|
98
|
+
output.usdValue,
|
|
99
|
+
USD_VALUE_MIN_DECIMALS,
|
|
100
|
+
USD_VALUE_MAX_DECIMALS
|
|
101
|
+
)
|
|
102
|
+
: '';
|
|
76
103
|
const priceImpact = getPriceImpact(input.usdValue, output.usdValue ?? null);
|
|
77
104
|
const percentageChange = numberToString(
|
|
78
|
-
|
|
105
|
+
priceImpact,
|
|
79
106
|
PERCENTAGE_CHANGE_MIN_DECIMALS,
|
|
80
107
|
PERCENTAGE_CHANGE_MAX_DECIMALS
|
|
81
108
|
);
|
|
@@ -87,8 +114,8 @@ export function Quote(props: QuoteProps) {
|
|
|
87
114
|
const stepHasError =
|
|
88
115
|
(error?.type === QuoteErrorType.BRIDGE_LIMIT &&
|
|
89
116
|
error.swap.swapperId === swap.swapperId) ||
|
|
90
|
-
(
|
|
91
|
-
|
|
117
|
+
(error?.type === QuoteErrorType.INSUFFICIENT_SLIPPAGE &&
|
|
118
|
+
error.recommendedSlippages?.has(index));
|
|
92
119
|
const stepHasWarning =
|
|
93
120
|
warning?.type === QuoteWarningType.INSUFFICIENT_SLIPPAGE &&
|
|
94
121
|
warning.recommendedSlippages?.has(index);
|
|
@@ -100,11 +127,17 @@ export function Quote(props: QuoteProps) {
|
|
|
100
127
|
}
|
|
101
128
|
|
|
102
129
|
return {
|
|
103
|
-
swapper: {
|
|
130
|
+
swapper: {
|
|
131
|
+
displayName: getSwapperDisplayName(swap.swapperId, swappers),
|
|
132
|
+
image: swap.swapperLogo,
|
|
133
|
+
},
|
|
104
134
|
from: {
|
|
105
135
|
token: { displayName: swap.from.symbol, image: swap.from.logo },
|
|
106
136
|
chain: {
|
|
107
|
-
displayName:
|
|
137
|
+
displayName: getBlockchainShortNameFor(
|
|
138
|
+
swap.from.blockchain,
|
|
139
|
+
blockchains
|
|
140
|
+
),
|
|
108
141
|
image: swap.from.blockchainLogo,
|
|
109
142
|
},
|
|
110
143
|
price: {
|
|
@@ -115,17 +148,38 @@ export function Quote(props: QuoteProps) {
|
|
|
115
148
|
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
116
149
|
TOKEN_AMOUNT_MAX_DECIMALS
|
|
117
150
|
)
|
|
118
|
-
:
|
|
151
|
+
: numberToString(
|
|
152
|
+
swap.fromAmount,
|
|
153
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
154
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
155
|
+
),
|
|
156
|
+
usdValue: numberToString(
|
|
157
|
+
(swap.from.usdPrice ?? 0) * parseFloat(swap.fromAmount),
|
|
158
|
+
USD_VALUE_MIN_DECIMALS,
|
|
159
|
+
USD_VALUE_MAX_DECIMALS
|
|
160
|
+
),
|
|
119
161
|
},
|
|
120
162
|
},
|
|
121
163
|
to: {
|
|
122
164
|
token: { displayName: swap.to.symbol, image: swap.to.logo },
|
|
123
165
|
chain: {
|
|
124
|
-
displayName:
|
|
166
|
+
displayName: getBlockchainShortNameFor(
|
|
167
|
+
swap.to.blockchain,
|
|
168
|
+
blockchains
|
|
169
|
+
),
|
|
125
170
|
image: swap.to.blockchainLogo,
|
|
126
171
|
},
|
|
127
172
|
price: {
|
|
128
|
-
value:
|
|
173
|
+
value: numberToString(
|
|
174
|
+
swap.toAmount,
|
|
175
|
+
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
176
|
+
TOKEN_AMOUNT_MAX_DECIMALS
|
|
177
|
+
),
|
|
178
|
+
usdValue: numberToString(
|
|
179
|
+
(swap.to.usdPrice ?? 0) * parseFloat(swap.toAmount),
|
|
180
|
+
USD_VALUE_MIN_DECIMALS,
|
|
181
|
+
USD_VALUE_MAX_DECIMALS
|
|
182
|
+
),
|
|
129
183
|
},
|
|
130
184
|
},
|
|
131
185
|
state: stepState,
|
|
@@ -183,7 +237,7 @@ export function Quote(props: QuoteProps) {
|
|
|
183
237
|
variant="body"
|
|
184
238
|
color="neutral900">
|
|
185
239
|
{i18n.t({
|
|
186
|
-
id: '
|
|
240
|
+
id: 'Minimum required slippage is {minRequiredSlippage}',
|
|
187
241
|
values: {
|
|
188
242
|
...(error?.type ===
|
|
189
243
|
QuoteErrorType.INSUFFICIENT_SLIPPAGE && {
|
|
@@ -209,14 +263,16 @@ export function Quote(props: QuoteProps) {
|
|
|
209
263
|
};
|
|
210
264
|
const steps = getQuoteSteps(quote.result?.swaps ?? []);
|
|
211
265
|
const numberOfSteps = steps.length;
|
|
266
|
+
const tooltipContainer = getContainer();
|
|
212
267
|
|
|
213
268
|
useLayoutEffect(() => {
|
|
214
|
-
if (expanded && quoteRef.current) {
|
|
269
|
+
if (expanded && !prevExpanded.current && quoteRef.current) {
|
|
215
270
|
setTimeout(() => {
|
|
216
271
|
quoteRef?.current?.scrollIntoView({ behavior: 'smooth' });
|
|
217
272
|
}, EXPANDABLE_QUOTE_TRANSITION_DURATION);
|
|
218
273
|
}
|
|
219
|
-
|
|
274
|
+
prevExpanded.current = expanded;
|
|
275
|
+
}, [expanded, prevExpanded]);
|
|
220
276
|
|
|
221
277
|
return (
|
|
222
278
|
<>
|
|
@@ -235,16 +291,18 @@ export function Quote(props: QuoteProps) {
|
|
|
235
291
|
size="small"
|
|
236
292
|
variant="body"
|
|
237
293
|
style={{ letterSpacing: 0.4 }}>
|
|
238
|
-
{`${
|
|
239
|
-
|
|
240
|
-
} ${
|
|
294
|
+
{`${roundedInput} ${
|
|
295
|
+
steps[0].from.token.displayName
|
|
296
|
+
} = ${roundedOutput} ${
|
|
297
|
+
steps[steps.length - 1].to.token.displayName
|
|
298
|
+
}`}
|
|
241
299
|
</Typography>
|
|
242
300
|
<Typography
|
|
243
301
|
color="$neutral600"
|
|
244
302
|
ml={2}
|
|
245
303
|
size="xsmall"
|
|
246
304
|
variant="body">
|
|
247
|
-
{`($${
|
|
305
|
+
{`($${roundedOutputUsdValue})`}
|
|
248
306
|
</Typography>
|
|
249
307
|
</div>
|
|
250
308
|
)}
|
|
@@ -252,7 +310,7 @@ export function Quote(props: QuoteProps) {
|
|
|
252
310
|
<TokenAmount
|
|
253
311
|
type="output"
|
|
254
312
|
direction="vertical"
|
|
255
|
-
price={{ value:
|
|
313
|
+
price={{ value: roundedOutput, usdValue: roundedOutputUsdValue }}
|
|
256
314
|
token={{
|
|
257
315
|
displayName: steps[numberOfSteps - 1].to.token.displayName,
|
|
258
316
|
image: steps[numberOfSteps - 1].to.token.image,
|
|
@@ -281,38 +339,48 @@ export function Quote(props: QuoteProps) {
|
|
|
281
339
|
<Chains
|
|
282
340
|
ref={(ref) => (quoteRef.current = ref)}
|
|
283
341
|
recommended={recommended}
|
|
284
|
-
onClick={
|
|
342
|
+
onClick={() => setExpanded((prevState) => !prevState)}>
|
|
285
343
|
<div>
|
|
286
344
|
{steps.map((step, index) => {
|
|
287
345
|
const key = `item-${index}`;
|
|
346
|
+
const arrow = (
|
|
347
|
+
<IconContainer>
|
|
348
|
+
<ChevronRightIcon
|
|
349
|
+
size={12}
|
|
350
|
+
color="black"
|
|
351
|
+
{...(step.state && {
|
|
352
|
+
color: step.state === 'error' ? 'error' : 'warning',
|
|
353
|
+
})}
|
|
354
|
+
/>
|
|
355
|
+
</IconContainer>
|
|
356
|
+
);
|
|
288
357
|
return (
|
|
289
358
|
<React.Fragment key={key}>
|
|
290
359
|
<Tooltip
|
|
291
|
-
container={
|
|
360
|
+
container={tooltipContainer}
|
|
292
361
|
side="bottom"
|
|
293
362
|
sideOffset={4}
|
|
294
363
|
content={step.from.chain.displayName}>
|
|
295
|
-
<
|
|
364
|
+
<ChainImageContainer
|
|
365
|
+
state={step.state || steps[index - 1]?.state}>
|
|
366
|
+
<Image src={step.from.chain.image} size={16} />
|
|
367
|
+
</ChainImageContainer>
|
|
296
368
|
</Tooltip>
|
|
297
369
|
{index === numberOfSteps - 1 && (
|
|
298
370
|
<>
|
|
299
|
-
|
|
300
|
-
<ChevronRightIcon size={12} color="black" />
|
|
301
|
-
</IconContainer>
|
|
371
|
+
{arrow}
|
|
302
372
|
<Tooltip
|
|
303
|
-
container={
|
|
373
|
+
container={tooltipContainer}
|
|
304
374
|
side="bottom"
|
|
305
375
|
sideOffset={4}
|
|
306
376
|
content={step.to.chain.displayName}>
|
|
307
|
-
<
|
|
377
|
+
<ChainImageContainer state={step.state}>
|
|
378
|
+
<Image src={step.to.chain.image} size={16} />
|
|
379
|
+
</ChainImageContainer>
|
|
308
380
|
</Tooltip>
|
|
309
381
|
</>
|
|
310
382
|
)}
|
|
311
|
-
{index !== numberOfSteps - 1 &&
|
|
312
|
-
<IconContainer>
|
|
313
|
-
<ChevronRightIcon size={12} color="black" />
|
|
314
|
-
</IconContainer>
|
|
315
|
-
)}
|
|
383
|
+
{index !== numberOfSteps - 1 && <>{arrow}</>}
|
|
316
384
|
</React.Fragment>
|
|
317
385
|
);
|
|
318
386
|
})}
|
|
@@ -31,6 +31,7 @@ export function makeAlerts(
|
|
|
31
31
|
if (warningLevel === 'high') {
|
|
32
32
|
alertInfo.alertType = 'error';
|
|
33
33
|
}
|
|
34
|
+
alertInfo.action = null;
|
|
34
35
|
alertInfo.title = errorMessages().highValueLossError.title;
|
|
35
36
|
}
|
|
36
37
|
if (warning.type === QuoteWarningType.UNKNOWN_PRICE) {
|
|
@@ -38,14 +39,15 @@ export function makeAlerts(
|
|
|
38
39
|
}
|
|
39
40
|
if (warning.type === QuoteWarningType.INSUFFICIENT_SLIPPAGE) {
|
|
40
41
|
alertInfo.title = i18n.t({
|
|
41
|
-
id: '
|
|
42
|
+
id: 'We recommend you to increase slippage to at least {minRequiredSlippage} for this route.',
|
|
42
43
|
values: {
|
|
43
44
|
minRequiredSlippage: warning.minRequiredSlippage,
|
|
44
45
|
},
|
|
45
46
|
});
|
|
47
|
+
alertInfo.action = 'change-settings';
|
|
46
48
|
}
|
|
47
49
|
if (warning.type === QuoteWarningType.HIGH_SLIPPAGE) {
|
|
48
|
-
alertInfo.title = i18n.t('Caution, your slippage is high');
|
|
50
|
+
alertInfo.title = i18n.t('Caution, your slippage is high.');
|
|
49
51
|
}
|
|
50
52
|
return alertInfo;
|
|
51
53
|
}
|
|
@@ -53,11 +55,16 @@ export function makeAlerts(
|
|
|
53
55
|
alertInfo.alertType = 'error';
|
|
54
56
|
if (error.type === QuoteErrorType.BRIDGE_LIMIT) {
|
|
55
57
|
alertInfo.title = error.recommendation;
|
|
56
|
-
alertInfo.action =
|
|
58
|
+
alertInfo.action = 'show-info';
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
if (error.type === QuoteErrorType.INSUFFICIENT_SLIPPAGE) {
|
|
60
|
-
alertInfo.title =
|
|
62
|
+
alertInfo.title = i18n.t({
|
|
63
|
+
id: 'You need to increase slippage to at least {minRequiredSlippage} for this route.',
|
|
64
|
+
values: {
|
|
65
|
+
minRequiredSlippage: error.minRequiredSlippage,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
61
68
|
alertInfo.action = 'change-settings';
|
|
62
69
|
}
|
|
63
70
|
|