@rango-dev/widget-embedded 0.17.1-next.18 → 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.
Files changed (58) hide show
  1. package/dist/components/AppRouter.d.ts.map +1 -1
  2. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  3. package/dist/components/Quote/Quote.d.ts.map +1 -1
  4. package/dist/components/Quote/Quote.styles.d.ts +159 -0
  5. package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
  6. package/dist/components/Quote/Quote.types.d.ts +0 -1
  7. package/dist/components/Quote/Quote.types.d.ts.map +1 -1
  8. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -1
  9. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -1
  10. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +1 -0
  11. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -1
  12. package/dist/constants/errors.d.ts.map +1 -1
  13. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  14. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +316 -0
  15. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
  16. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +3 -0
  17. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  18. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -1
  19. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +6 -3
  20. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -1
  21. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/index.js.map +4 -4
  24. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  25. package/dist/pages/Home.d.ts.map +1 -1
  26. package/dist/types/swap.d.ts +3 -13
  27. package/dist/types/swap.d.ts.map +1 -1
  28. package/dist/utils/meta.d.ts +2 -1
  29. package/dist/utils/meta.d.ts.map +1 -1
  30. package/dist/utils/quote.d.ts.map +1 -1
  31. package/dist/utils/swap.d.ts +12 -4
  32. package/dist/utils/swap.d.ts.map +1 -1
  33. package/package.json +2 -2
  34. package/src/components/AppRouter.tsx +2 -27
  35. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +9 -3
  36. package/src/components/NoResult/NoResult.helpers.ts +12 -12
  37. package/src/components/Quote/Quote.styles.ts +20 -0
  38. package/src/components/Quote/Quote.tsx +98 -30
  39. package/src/components/Quote/Quote.types.ts +0 -1
  40. package/src/components/Quote/QuoteSkeleton.tsx +1 -1
  41. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +11 -4
  42. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +13 -13
  43. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +1 -0
  44. package/src/components/SwapDetails/SwapDetails.tsx +2 -2
  45. package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
  46. package/src/constants/errors.ts +9 -5
  47. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +17 -1
  48. package/src/containers/QuoteInfo/QuoteInfo.tsx +44 -43
  49. package/src/containers/QuoteInfo/QuoteInfo.types.ts +3 -0
  50. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +15 -11
  51. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +16 -17
  52. package/src/hooks/useSwapInput.ts +79 -25
  53. package/src/pages/ConfirmSwapPage.tsx +29 -6
  54. package/src/pages/Home.tsx +36 -45
  55. package/src/types/swap.ts +3 -12
  56. package/src/utils/meta.ts +8 -1
  57. package/src/utils/quote.ts +6 -6
  58. package/src/utils/swap.ts +44 -35
@@ -18,7 +18,7 @@ import {
18
18
  Typography,
19
19
  WalletIcon,
20
20
  } from '@rango-dev/ui';
21
- import React, { useEffect, useState } from 'react';
21
+ import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
22
22
  import { flushSync } from 'react-dom';
23
23
  import { useNavigate } from 'react-router-dom';
24
24
 
@@ -31,6 +31,7 @@ import { getQuoteUpdateWarningMessage } from '../constants/warnings';
31
31
  import { QuoteInfo } from '../containers/QuoteInfo';
32
32
  import { useConfirmSwap } from '../hooks/useConfirmSwap';
33
33
  import { useQuoteStore } from '../store/quote';
34
+ import { useSettingsStore } from '../store/settings';
34
35
  import { useUiStore } from '../store/ui';
35
36
  import { useWalletsStore } from '../store/wallets';
36
37
  import { QuoteWarningType } from '../types';
@@ -43,7 +44,6 @@ const Container = styled('div', {
43
44
  display: 'flex',
44
45
  justifyContent: 'space-between',
45
46
  alignItems: 'center',
46
- paddingBottom: '$10',
47
47
  },
48
48
  '& .icon': {
49
49
  width: '$24',
@@ -52,6 +52,9 @@ const Container = styled('div', {
52
52
  justifyContent: 'center',
53
53
  alignItems: 'center',
54
54
  },
55
+ '& .quote-update__alert': {
56
+ paddingTop: '$10',
57
+ },
55
58
  });
56
59
 
57
60
  const Buttons = styled('div', {
@@ -86,6 +89,9 @@ export function ConfirmSwapPage() {
86
89
  const showWalletsOnInit = !quoteWalletsConfirmed;
87
90
  const [showWallets, setShowWallets] = useState(false);
88
91
  const setSelectedSwap = useUiStore.use.setSelectedSwap();
92
+ const disabledLiquiditySources =
93
+ useSettingsStore.use.disabledLiquiditySources();
94
+ const prevDisabledLiquiditySources = useRef(disabledLiquiditySources);
89
95
  const { manager } = useManager();
90
96
  const {
91
97
  fetch: confirmSwap,
@@ -151,13 +157,23 @@ export function ConfirmSwapPage() {
151
157
  swap: null,
152
158
  warnings: null,
153
159
  });
154
- confirmSwap({ selectedWallets })
160
+ confirmSwap({ selectedWallets, customDestination })
155
161
  .then((res) => {
156
162
  setConfirmSwapResult(res);
157
163
  })
158
164
  .catch((error) => console.error(error));
159
165
  };
160
166
 
167
+ useEffect(() => {
168
+ const disabledLiquiditySourceReset =
169
+ !!prevDisabledLiquiditySources.current.length &&
170
+ !disabledLiquiditySources.length;
171
+ if (disabledLiquiditySourceReset) {
172
+ void onRefresh();
173
+ }
174
+ prevDisabledLiquiditySources.current = disabledLiquiditySources;
175
+ }, [disabledLiquiditySources.length]);
176
+
161
177
  useEffect(() => {
162
178
  if (showWalletsOnInit) {
163
179
  cancelFetch();
@@ -237,6 +253,12 @@ export function ConfirmSwapPage() {
237
253
  connectedWallets.length,
238
254
  ]);
239
255
 
256
+ useLayoutEffect(() => {
257
+ if (!quote) {
258
+ navigate(`../`);
259
+ }
260
+ }, []);
261
+
240
262
  return (
241
263
  <Layout
242
264
  header={{
@@ -315,7 +337,7 @@ export function ConfirmSwapPage() {
315
337
  </>
316
338
  )}
317
339
  {confirmSwapResult.warnings?.quoteUpdate && (
318
- <>
340
+ <div className="quote-update__alert">
319
341
  <Alert
320
342
  variant="alarm"
321
343
  type="warning"
@@ -326,13 +348,13 @@ export function ConfirmSwapPage() {
326
348
  )
327
349
  }
328
350
  />
329
- <Divider size={12} />
330
- </>
351
+ </div>
331
352
  )}
332
353
  <QuoteInfo
333
354
  quote={quote}
334
355
  type="swap-preview"
335
356
  expanded={true}
357
+ alertPosition="top"
336
358
  error={confirmSwapResult.error}
337
359
  loading={fetchingConfirmationQuote}
338
360
  warning={confirmSwapResult.warnings?.quote ?? null}
@@ -344,6 +366,7 @@ export function ConfirmSwapPage() {
344
366
  setShowQuoteWarningModal(false);
345
367
  await addNewSwap();
346
368
  }}
369
+ onChangeSettings={() => navigate('../' + navigationRoutes.settings)}
347
370
  />
348
371
  </Container>
349
372
  </Layout>
@@ -24,23 +24,18 @@ import { useAppStore } from '../store/AppStore';
24
24
  import { useQuoteStore } from '../store/quote';
25
25
  import { useUiStore } from '../store/ui';
26
26
  import { useWalletsStore } from '../store/wallets';
27
- import { ButtonState } from '../types';
28
27
  import { numberToString } from '../utils/numbers';
29
28
  import { getPriceImpact, getPriceImpactLevel } from '../utils/quote';
30
- import {
31
- canComputePriceImpact,
32
- getOutputRatio,
33
- getPercentageChange,
34
- getSwapButtonState,
35
- hasHighValueLoss,
36
- hasLimitError,
37
- } from '../utils/swap';
29
+ import { canComputePriceImpact, getSwapButtonState } from '../utils/swap';
38
30
  import { getBalanceFromWallet } from '../utils/wallets';
39
31
 
40
32
  const Container = styled('div', {
41
33
  display: 'flex',
42
34
  flexDirection: 'column',
43
35
  overflowY: 'visible',
36
+ '& .quote__container': {
37
+ paddingTop: '$2',
38
+ },
44
39
  });
45
40
 
46
41
  const FromContainer = styled('div', {
@@ -85,9 +80,6 @@ export function Home() {
85
80
 
86
81
  const needsToWarnEthOnPath = false;
87
82
 
88
- const outToInRatio = getOutputRatio(inputUsdValue, outputUsdValue);
89
- const highValueLoss = hasHighValueLoss(inputUsdValue, outToInRatio);
90
-
91
83
  const priceImpactInputCanNotBeComputed = !canComputePriceImpact(
92
84
  quote,
93
85
  inputAmount,
@@ -99,17 +91,17 @@ export function Home() {
99
91
  inputAmount,
100
92
  outputUsdValue
101
93
  );
102
- const swapButtonState = getSwapButtonState(
94
+
95
+ const swapButtonState = getSwapButtonState({
103
96
  fetchMetaStatus,
104
- connectedWallets,
105
97
  fetchingQuote,
98
+ inputAmount,
106
99
  quote,
107
- hasLimitError(quote),
108
- highValueLoss,
109
- priceImpactInputCanNotBeComputed || priceImpactOutputCanNotBeComputed,
100
+ anyWalletConnected: connectedWallets.length > 0,
101
+ error: quoteError,
102
+ warning: quoteWarning,
110
103
  needsToWarnEthOnPath,
111
- inputAmount
112
- );
104
+ });
113
105
 
114
106
  const tokenBalance =
115
107
  !!fromBlockchain && !!fromToken
@@ -152,10 +144,8 @@ export function Home() {
152
144
  const percentageChange =
153
145
  !inputUsdValue || !outputUsdValue || !outputUsdValue.gt(0)
154
146
  ? null
155
- : getPercentageChange(
156
- inputUsdValue.toString(),
157
- outputUsdValue.toString()
158
- );
147
+ : getPriceImpact(inputUsdValue.toString(), outputUsdValue.toString());
148
+
159
149
  return (
160
150
  <Layout
161
151
  ref={layoutRef}
@@ -167,14 +157,13 @@ export function Home() {
167
157
  size="large"
168
158
  disabled={swapButtonState.disabled}
169
159
  prefix={
170
- !swapButtonState.disabled &&
171
- swapButtonState.hasWarning && <WarningIcon />
160
+ swapButtonState.action === 'confirm-warning' && <WarningIcon />
172
161
  }
173
162
  fullWidth
174
163
  onClick={() => {
175
- if (swapButtonState.state === ButtonState.WAITFORCONNECTING) {
164
+ if (swapButtonState.action === 'connect-wallet') {
176
165
  navigate(navigationRoutes.wallets);
177
- } else if (quoteWarning) {
166
+ } else if (swapButtonState.action === 'confirm-warning') {
178
167
  setShowQuoteWarningModal(true);
179
168
  } else {
180
169
  navigate(navigationRoutes.confirmSwap);
@@ -203,8 +192,6 @@ export function Home() {
203
192
  <FromContainer>
204
193
  <SwapInput
205
194
  label={i18n.t('From')}
206
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
207
- //@ts-ignore
208
195
  mode="From"
209
196
  onInputChange={setInputAmount}
210
197
  balance={tokenBalance}
@@ -244,6 +231,7 @@ export function Home() {
244
231
  sharpBottomStyle={!!quote?.result || fetchingQuote}
245
232
  label={i18n.t('To')}
246
233
  mode="To"
234
+ fetchingQuote={fetchingQuote}
247
235
  chain={{
248
236
  displayName: toBlockchain?.displayName || '',
249
237
  image: toBlockchain?.logo || '',
@@ -280,22 +268,25 @@ export function Home() {
280
268
  loading={fetchMetaStatus === 'loading'}
281
269
  />
282
270
  </InputsContainer>
283
- <QuoteInfo
284
- quote={quote}
285
- loading={fetchingQuote}
286
- error={quoteError}
287
- warning={quoteWarning}
288
- type="basic"
289
- refetchQuote={fetchQuote}
290
- showWarningModal={showQuoteWarningModal}
291
- onOpenWarningModal={() => setShowQuoteWarningModal(true)}
292
- onCloseWarningModal={() => setShowQuoteWarningModal(false)}
293
- onConfirmWarningModal={() => {
294
- setShowQuoteWarningModal(false);
295
- setQuoteWarningsConfirmed(true);
296
- navigate(navigationRoutes.confirmSwap);
297
- }}
298
- />
271
+ <div className="quote__container">
272
+ <QuoteInfo
273
+ quote={quote}
274
+ loading={fetchingQuote}
275
+ error={quoteError}
276
+ warning={quoteWarning}
277
+ type="basic"
278
+ refetchQuote={fetchQuote}
279
+ showWarningModal={showQuoteWarningModal}
280
+ onOpenWarningModal={() => setShowQuoteWarningModal(true)}
281
+ onCloseWarningModal={() => setShowQuoteWarningModal(false)}
282
+ onConfirmWarningModal={() => {
283
+ setShowQuoteWarningModal(false);
284
+ setQuoteWarningsConfirmed(true);
285
+ navigate(navigationRoutes.confirmSwap);
286
+ }}
287
+ onChangeSettings={() => navigate(navigationRoutes.settings)}
288
+ />
289
+ </div>
299
290
  </Container>
300
291
  </Layout>
301
292
  );
package/src/types/swap.ts CHANGED
@@ -5,19 +5,10 @@ export type PendingSwapSettings = Omit<
5
5
  'disabledSwappersIds'
6
6
  >;
7
7
 
8
- export enum ButtonState {
9
- WAITFORCONNECTING = 'waitForConnecting',
10
- SWAP = 'swap',
11
- NEEDTOCONFIRM = 'needToConfirm',
12
- WARNING = 'warning',
13
- }
14
-
15
- export type SwapButtonState = (
16
- | { disabled: true }
17
- | { disabled: false; hasWarning?: boolean }
18
- ) & {
8
+ export type SwapButtonState = {
9
+ disabled: boolean;
19
10
  title: string;
20
- state: ButtonState;
11
+ action: 'connect-wallet' | 'confirm-warning' | 'confirm-swap';
21
12
  };
22
13
 
23
14
  export type ConvertedToken = {
package/src/utils/meta.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Asset, BlockchainMeta, Token } from 'rango-sdk';
1
+ import type { Asset, BlockchainMeta, SwapperMeta, Token } from 'rango-sdk';
2
2
 
3
3
  import { tokensAreEqual } from './wallets';
4
4
 
@@ -17,6 +17,13 @@ export function getBlockchainShortNameFor(
17
17
  ?.shortName;
18
18
  }
19
19
 
20
+ export function getSwapperDisplayName(
21
+ swapperId: string,
22
+ swappers: SwapperMeta[]
23
+ ) {
24
+ return swappers.find((swapper) => swapper.id === swapperId)?.swapperGroup;
25
+ }
26
+
20
27
  export function findToken(t: Asset, tokens: Token[]) {
21
28
  return tokens.find((token) => tokensAreEqual(token, t)) ?? null;
22
29
  }
@@ -238,11 +238,12 @@ export function generateQuoteWarnings(
238
238
  const outputUsdValue = getUsdValue(toToken, quote.result?.outputAmount ?? '');
239
239
 
240
240
  if (quote.result && inputUsdValue && outputUsdValue) {
241
- const priceImpact = getPercentageChange(
241
+ const priceImpact = getPriceImpact(
242
242
  inputUsdValue.toString(),
243
243
  outputUsdValue.toString()
244
244
  );
245
- const highValueLoss = hasHighValueLoss(inputUsdValue, priceImpact);
245
+ const highValueLoss =
246
+ !!priceImpact && hasHighValueLoss(inputUsdValue, priceImpact);
246
247
 
247
248
  if (highValueLoss) {
248
249
  const totalFee = getTotalFeeInUsd(quote.result.swaps, tokens);
@@ -320,13 +321,12 @@ export function generateQuoteErrors(
320
321
  export function getPriceImpact(
321
322
  inputUsdValue: BigNumber | string | null,
322
323
  outputUsdValue: BigNumber | string | null
323
- ) {
324
+ ): number | null {
324
325
  const outputUsdValueIsInvalid =
325
326
  typeof outputUsdValue === 'string'
326
327
  ? parseFloat(outputUsdValue) <= 0
327
328
  : !outputUsdValue?.gt(0);
328
-
329
- const priceImpact =
329
+ const percentageChange =
330
330
  !inputUsdValue || !outputUsdValue || outputUsdValueIsInvalid
331
331
  ? null
332
332
  : getPercentageChange(
@@ -334,5 +334,5 @@ export function getPriceImpact(
334
334
  outputUsdValue.toString()
335
335
  );
336
336
 
337
- return priceImpact;
337
+ return percentageChange && percentageChange < 0 ? percentageChange : null;
338
338
  }
package/src/utils/swap.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  /* eslint-disable @typescript-eslint/no-magic-numbers */
2
2
  import type { FetchStatus } from '../store/slices/data';
3
- import type { ConnectedWallet } from '../store/wallets';
4
3
  import type {
5
4
  ConvertedToken,
5
+ QuoteError,
6
+ QuoteWarning,
6
7
  RecommendedSlippages,
7
8
  SwapButtonState,
8
9
  Wallet,
@@ -35,11 +36,11 @@ import {
35
36
  TOKEN_AMOUNT_MAX_DECIMALS,
36
37
  TOKEN_AMOUNT_MIN_DECIMALS,
37
38
  } from '../constants/routing';
38
- import { ButtonState } from '../types';
39
39
 
40
40
  import { removeDuplicateFrom } from './common';
41
+ import { getBlockchainShortNameFor } from './meta';
41
42
  import { numberToString } from './numbers';
42
- import { getRequiredBalanceOfWallet } from './quote';
43
+ import { getPriceImpact, getRequiredBalanceOfWallet } from './quote';
43
44
  import { getRequiredChains } from './wallets';
44
45
 
45
46
  export function getOutputRatio(
@@ -179,63 +180,70 @@ export function getLimitErrorMessage(quote: BestRouteResponse): {
179
180
  return { swap, fromAmountRangeError, recommendation };
180
181
  }
181
182
 
182
- export function getSwapButtonState(
183
- loadingMetaStatus: FetchStatus,
184
- connectedWallets: ConnectedWallet[],
185
- loading: boolean,
186
- quote: BestRouteResponse | null,
187
- hasLimitError: boolean,
188
- highValueLoss: boolean,
189
- priceImpactCanNotBeComputed: boolean,
190
- needsToWarnEthOnPath: boolean,
191
- inputAmount: string
192
- ): SwapButtonState {
193
- if (loadingMetaStatus !== 'success') {
183
+ export function getSwapButtonState(params: {
184
+ fetchMetaStatus: FetchStatus;
185
+ anyWalletConnected: boolean;
186
+ fetchingQuote: boolean;
187
+ inputAmount: string;
188
+ quote: BestRouteResponse | null;
189
+ warning: QuoteWarning | null;
190
+ error: QuoteError | null;
191
+ needsToWarnEthOnPath: boolean;
192
+ }): SwapButtonState {
193
+ const {
194
+ fetchMetaStatus,
195
+ anyWalletConnected,
196
+ fetchingQuote,
197
+ inputAmount,
198
+ quote,
199
+ warning,
200
+ error,
201
+ needsToWarnEthOnPath,
202
+ } = params;
203
+ if (fetchMetaStatus !== 'success') {
194
204
  return {
195
205
  title: swapButtonTitles().connectWallet,
196
- state: ButtonState.WAITFORCONNECTING,
206
+ action: 'connect-wallet',
197
207
  disabled: true,
198
208
  };
199
209
  }
200
- if (connectedWallets.length == 0) {
210
+ if (!anyWalletConnected) {
201
211
  return {
202
212
  title: swapButtonTitles().connectWallet,
203
- state: ButtonState.WAITFORCONNECTING,
213
+ action: 'connect-wallet',
204
214
  disabled: false,
205
215
  };
206
216
  }
207
217
  if (
208
- loading ||
218
+ fetchingQuote ||
209
219
  !quote ||
210
220
  !quote.result ||
211
- hasLimitError ||
221
+ error ||
212
222
  !inputAmount ||
213
223
  inputAmount === '0'
214
224
  ) {
215
225
  return {
216
226
  title: swapButtonTitles().swap,
227
+ action: 'confirm-swap',
217
228
  disabled: true,
218
- state: ButtonState.SWAP,
219
229
  };
220
- } else if (highValueLoss || priceImpactCanNotBeComputed) {
230
+ } else if (warning) {
221
231
  return {
222
232
  title: swapButtonTitles().swapAnyway,
233
+ action: 'confirm-warning',
223
234
  disabled: false,
224
- hasWarning: true,
225
- state: ButtonState.NEEDTOCONFIRM,
226
235
  };
227
236
  } else if (needsToWarnEthOnPath) {
228
237
  return {
229
238
  title: swapButtonTitles().ethWarning,
239
+ action: 'confirm-warning',
230
240
  disabled: false,
231
- hasWarning: true,
232
- state: ButtonState.WARNING,
233
241
  };
234
242
  }
235
243
  return {
236
244
  title: swapButtonTitles().swap,
245
+ action: 'confirm-swap',
237
246
  disabled: false,
238
- state: ButtonState.SWAP,
239
247
  };
240
248
  }
241
249
 
@@ -359,7 +367,7 @@ export function checkSlippageWarnings(
359
367
  quote.result?.swaps.forEach((swap, index) => {
360
368
  if (
361
369
  swap.recommendedSlippage?.slippage &&
362
- parseInt(swap.recommendedSlippage?.slippage) > userSlippage
370
+ parseFloat(swap.recommendedSlippage.slippage) > userSlippage
363
371
  ) {
364
372
  recommendedSlippages.set(index, swap.recommendedSlippage.slippage);
365
373
  }
@@ -590,10 +598,7 @@ export function isOutputAmountChangedALot(
590
598
  if (!oldOutputAmount || !newOutputAmount) {
591
599
  return false;
592
600
  }
593
- const percentageChange = getPercentageChange(
594
- oldOutputAmount,
595
- newOutputAmount
596
- );
601
+ const percentageChange = getPriceImpact(oldOutputAmount, newOutputAmount);
597
602
  if (!percentageChange) {
598
603
  return true;
599
604
  }
@@ -601,9 +606,10 @@ export function isOutputAmountChangedALot(
601
606
  return percentageChange <= -1;
602
607
  }
603
608
 
604
- export function getBalanceWarnings(
609
+ export function generateBalanceWarnings(
605
610
  quote: BestRouteResponse,
606
- selectedWallets: Wallet[]
611
+ selectedWallets: Wallet[],
612
+ blockchains: BlockchainMeta[]
607
613
  ) {
608
614
  const fee = quote.validationStatus;
609
615
  const requiredWallets = getRequiredChains(quote);
@@ -648,7 +654,10 @@ export function getBalanceWarnings(
648
654
  symbol,
649
655
  reason,
650
656
  currentAmount,
651
- blockchain: asset.asset.blockchain,
657
+ blockchain: getBlockchainShortNameFor(
658
+ asset.asset.blockchain,
659
+ blockchains
660
+ ),
652
661
  },
653
662
  });
654
663
  return warningMessage;