@rango-dev/widget-embedded 0.36.1-next.12 → 0.36.1-next.13

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 (38) hide show
  1. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  2. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -1
  3. package/dist/components/Quotes/Quotes.d.ts.map +1 -1
  4. package/dist/constants/quote.d.ts +8 -0
  5. package/dist/constants/quote.d.ts.map +1 -1
  6. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  7. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -1
  8. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +6 -4
  9. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -1
  10. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  11. package/dist/index.js +2 -2
  12. package/dist/index.js.map +4 -4
  13. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  14. package/dist/store/quote.d.ts.map +1 -1
  15. package/dist/types/quote.d.ts +8 -17
  16. package/dist/types/quote.d.ts.map +1 -1
  17. package/dist/utils/quote.d.ts +5 -6
  18. package/dist/utils/quote.d.ts.map +1 -1
  19. package/dist/utils/swap.d.ts +4 -4
  20. package/dist/utils/swap.d.ts.map +1 -1
  21. package/dist/widget-embedded.build.json +1 -1
  22. package/package.json +2 -2
  23. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +2 -19
  24. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +42 -22
  25. package/src/components/Quotes/Quotes.tsx +2 -3
  26. package/src/constants/quote.ts +23 -0
  27. package/src/containers/QuoteInfo/QuoteInfo.tsx +3 -9
  28. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +29 -66
  29. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +10 -15
  30. package/src/hooks/useSwapInput.ts +2 -9
  31. package/src/pages/ConfirmSwapPage.tsx +7 -15
  32. package/src/store/quote.ts +3 -13
  33. package/src/types/quote.ts +10 -24
  34. package/src/utils/quote.ts +57 -45
  35. package/src/utils/swap.ts +55 -36
  36. package/dist/constants/warnings.d.ts +0 -3
  37. package/dist/constants/warnings.d.ts.map +0 -1
  38. package/src/constants/warnings.ts +0 -26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.36.1-next.12",
3
+ "version": "0.36.1-next.13",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -54,4 +54,4 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  }
57
- }
57
+ }
@@ -1,6 +1,6 @@
1
1
  import type { PropTypes } from './ConfirmWalletsModal.types';
2
2
  import type { ConnectedWallet } from '../../store/slices/wallets';
3
- import type { ConfirmSwapWarnings, Wallet } from '../../types';
3
+ import type { Wallet } from '../../types';
4
4
 
5
5
  import { i18n } from '@lingui/core';
6
6
  import {
@@ -17,7 +17,6 @@ import { useNavigate } from 'react-router-dom';
17
17
 
18
18
  import { WIDGET_UI_ID } from '../../constants';
19
19
  import { getQuoteErrorMessage } from '../../constants/errors';
20
- import { getQuoteUpdateWarningMessage } from '../../constants/warnings';
21
20
  import { useAppStore } from '../../store/AppStore';
22
21
  import { useQuoteStore } from '../../store/quote';
23
22
  import { getBlockchainShortNameFor } from '../../utils/meta';
@@ -58,9 +57,6 @@ export function ConfirmWalletsModal(props: PropTypes) {
58
57
  const [showMoreWalletFor, setShowMoreWalletFor] = useState('');
59
58
  const [balanceWarnings, setBalanceWarnings] = useState<string[]>([]);
60
59
  const [error, setError] = useState('');
61
- const [quoteWarning, setQuoteWarning] = useState<
62
- ConfirmSwapWarnings['quoteUpdate'] | null
63
- >(null);
64
60
 
65
61
  const [isCustomDestinationOpen, setCustomDestinationOpen] = useState(
66
62
  !!customDestination
@@ -224,7 +220,6 @@ export function ConfirmWalletsModal(props: PropTypes) {
224
220
  const onConfirmWallets = async () => {
225
221
  setBalanceWarnings([]);
226
222
  setError('');
227
- setQuoteWarning(null);
228
223
 
229
224
  const result = await onCheckBalance?.({
230
225
  selectedWallets: selectableWallets.filter((wallet) => wallet.selected),
@@ -234,9 +229,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
234
229
  if (warnings?.balance?.messages) {
235
230
  setBalanceWarnings(warnings.balance.messages);
236
231
  }
237
- if (warnings?.quoteUpdate) {
238
- setQuoteWarning(warnings.quoteUpdate);
239
- }
232
+
240
233
  if (result.error) {
241
234
  setError(getQuoteErrorMessage(result.error));
242
235
  }
@@ -416,16 +409,6 @@ export function ConfirmWalletsModal(props: PropTypes) {
416
409
  <Divider size={12} />
417
410
  </>
418
411
  )}
419
- {quoteWarning && (
420
- <>
421
- <Alert
422
- variant="alarm"
423
- type="warning"
424
- title={getQuoteUpdateWarningMessage(quoteWarning)}
425
- />
426
- <Divider size={12} />
427
- </>
428
- )}
429
412
  <Wallets>
430
413
  {quoteWallets.map((requiredWallet, index) => {
431
414
  const blockchain = blockchains.find(
@@ -44,30 +44,50 @@ export function makeAlerts(
44
44
  return alertInfo;
45
45
  }
46
46
  if (warning) {
47
- if (warning.type === QuoteWarningType.HIGH_VALUE_LOSS) {
48
- const warningLevel = getPriceImpactLevel(warning.priceImpact);
49
- if (warningLevel === 'high') {
50
- alertInfo.alertType = 'error';
47
+ switch (warning.type) {
48
+ case QuoteWarningType.HIGH_VALUE_LOSS: {
49
+ const warningLevel = getPriceImpactLevel(warning.priceImpact);
50
+ if (warningLevel === 'high') {
51
+ alertInfo.alertType = 'error';
52
+ }
53
+ alertInfo.action = 'show-info';
54
+ alertInfo.title = errorMessages().highValueLossError.title;
55
+ break;
51
56
  }
52
- alertInfo.action = 'show-info';
53
- alertInfo.title = errorMessages().highValueLossError.title;
54
- }
55
- if (warning.type === QuoteWarningType.UNKNOWN_PRICE) {
56
- alertInfo.title = errorMessages().unknownPriceError.title;
57
- }
58
- if (warning.type === QuoteWarningType.INSUFFICIENT_SLIPPAGE) {
59
- alertInfo.title = i18n.t({
60
- id: 'We recommend you to increase slippage to at least {minRequiredSlippage} for this route.',
61
- values: {
62
- minRequiredSlippage: warning.minRequiredSlippage,
63
- },
64
- });
65
- alertInfo.action = 'change-settings';
66
- }
67
- if (warning.type === QuoteWarningType.HIGH_SLIPPAGE) {
68
- alertInfo.title = i18n.t('Caution, your slippage is high.');
69
- alertInfo.action = 'change-settings';
57
+ case QuoteWarningType.EXCESSIVE_OUTPUT_AMOUNT_CHANGE: {
58
+ alertInfo.title = i18n.t({
59
+ id: 'Output amount changed by {percentageChange}% (${usdValueChange}).',
60
+ values: {
61
+ percentageChange: warning.percentageChange,
62
+ usdValueChange: warning.usdValueChange,
63
+ },
64
+ });
65
+ break;
66
+ }
67
+ case QuoteWarningType.UNKNOWN_PRICE: {
68
+ alertInfo.title = errorMessages().unknownPriceError.title;
69
+ break;
70
+ }
71
+ case QuoteWarningType.INSUFFICIENT_SLIPPAGE: {
72
+ alertInfo.title = i18n.t({
73
+ id: 'We recommend you to increase slippage to at least {minRequiredSlippage} for this route.',
74
+ values: {
75
+ minRequiredSlippage: warning.minRequiredSlippage,
76
+ },
77
+ });
78
+ alertInfo.action = 'change-settings';
79
+ break;
80
+ }
81
+ case QuoteWarningType.HIGH_SLIPPAGE: {
82
+ alertInfo.title = i18n.t('Caution, your slippage is high.');
83
+ alertInfo.action = 'change-settings';
84
+ break;
85
+ }
86
+
87
+ default:
88
+ break;
70
89
  }
90
+
71
91
  return alertInfo;
72
92
  }
73
93
  return null;
@@ -53,9 +53,8 @@ export function Quotes(props: PropTypes) {
53
53
  ...quote,
54
54
  };
55
55
 
56
- return generateQuoteWarnings(mergedQuote, {
57
- fromToken,
58
- toToken,
56
+ return generateQuoteWarnings({
57
+ currentQuote: mergedQuote,
59
58
  userSlippage,
60
59
  findToken,
61
60
  });
@@ -32,6 +32,29 @@ export const HIGH_PRIORITY_TAGS: TagValue[] = [
32
32
  'HIGH_IMPACT',
33
33
  ];
34
34
 
35
+ export type Criteria = {
36
+ threshold: number;
37
+ minInput: number;
38
+ };
39
+
40
+ export const PERCENT_MULTIPLIER = 100;
35
41
  export const GAS_FEE_MAX = 30;
36
42
  export const ROUTE_TIME_MAX = 15;
37
43
  export const SECONDS_IN_MINUTE = 60;
44
+ export const HIGH_FEE_THRESHOLD_USD = 30;
45
+
46
+ export const HIGH_VALUE_LOSS_CRITERIA: Criteria[] = [
47
+ { threshold: -10, minInput: 400 },
48
+ { threshold: -5, minInput: 1000 },
49
+ ];
50
+
51
+ export const OUTPUT_CHANGE_WARNING_CRITERIA: Criteria[] = [
52
+ {
53
+ threshold: -1,
54
+ minInput: 1000,
55
+ },
56
+ {
57
+ threshold: -2,
58
+ minInput: 500,
59
+ },
60
+ ];
@@ -7,8 +7,7 @@ import { Quote } from '../../components/Quote';
7
7
  import { QuoteSkeleton } from '../../components/QuoteSkeleton';
8
8
  import { useQuoteStore } from '../../store/quote';
9
9
  import { QuoteErrorType } from '../../types';
10
- import { getQuoteToTokenUsdPrice } from '../../utils/quote';
11
- import { calcOutputUsdValue } from '../../utils/swap';
10
+ import { getUsdOutputFrom } from '../../utils/swap';
12
11
 
13
12
  import { QuoteContainer } from './QuoteInfo.styles';
14
13
 
@@ -28,17 +27,12 @@ export function QuoteInfo(props: PropTypes) {
28
27
  fullExpandedMode = false,
29
28
  container,
30
29
  } = props;
31
- const { inputAmount, inputUsdValue, toToken } = useQuoteStore();
30
+ const { inputAmount, inputUsdValue } = useQuoteStore();
32
31
 
33
32
  const outputAmount = !!quote?.outputAmount
34
33
  ? new BigNumber(quote?.outputAmount)
35
34
  : null;
36
- const outputUsdValue = !!quote?.outputAmount
37
- ? calcOutputUsdValue(
38
- quote?.outputAmount,
39
- getQuoteToTokenUsdPrice(quote) || toToken?.usdPrice
40
- )
41
- : null;
35
+ const outputUsdValue = quote ? getUsdOutputFrom(quote) : null;
42
36
 
43
37
  const noResult =
44
38
  error &&
@@ -7,27 +7,18 @@ import type {
7
7
  SelectedQuote,
8
8
  Wallet,
9
9
  } from '../../types';
10
- import type { BlockchainMeta, SwapResult, Token } from 'rango-sdk';
10
+ import type BigNumber from 'bignumber.js';
11
+ import type { BlockchainMeta, SwapResult } from 'rango-sdk';
11
12
 
12
13
  import { errorMessages } from '../../constants/errors';
13
- import { QuoteErrorType, QuoteUpdateType } from '../../types';
14
- import { numberToString } from '../../utils/numbers';
15
- import {
16
- generateQuoteWarnings,
17
- getPriceImpact,
18
- isNumberOfSwapsChanged,
19
- isQuoteChanged,
20
- isQuoteInternalCoinsUpdated,
21
- isQuoteSwappersUpdated,
22
- } from '../../utils/quote';
14
+ import { QuoteErrorType } from '../../types';
15
+ import { generateQuoteWarnings } from '../../utils/quote';
23
16
  import {
24
17
  checkSlippageErrors,
25
18
  generateBalanceWarnings,
26
19
  getLimitErrorMessage,
27
20
  getMinRequiredSlippage,
28
- getQuoteOutputAmount,
29
21
  hasLimitError,
30
- isOutputAmountChangedALot,
31
22
  } from '../../utils/swap';
32
23
 
33
24
  /**
@@ -82,72 +73,44 @@ export function getQuoteError(swaps: SwapResult[]): QuoteErrorResponse | null {
82
73
  return null;
83
74
  }
84
75
 
85
- export function generateWarnings(
86
- previousQuote: SelectedQuote | undefined,
87
- currentQuote: SelectedQuote,
88
- params: {
89
- fromToken: Token;
90
- toToken: Token;
91
- meta: { blockchains: BlockchainMeta[] };
92
- selectedWallets: Wallet[];
93
- userSlippage: number;
94
- findToken: FindToken;
95
- }
96
- ): ConfirmSwapWarnings {
97
- let quoteChanged = false;
98
- if (previousQuote) {
99
- quoteChanged = isQuoteChanged(previousQuote, currentQuote);
100
- }
76
+ export function generateWarnings(params: {
77
+ currentQuote: SelectedQuote;
78
+ previousQuote?: SelectedQuote;
79
+ meta: { blockchains: BlockchainMeta[] };
80
+ selectedWallets: Wallet[];
81
+ userSlippage: number;
82
+ inputUsdValue: BigNumber | null;
83
+ findToken: FindToken;
84
+ }): ConfirmSwapWarnings {
85
+ const {
86
+ currentQuote,
87
+ previousQuote,
88
+ meta,
89
+ selectedWallets,
90
+ userSlippage,
91
+ findToken,
92
+ } = params;
93
+
101
94
  const output: ConfirmSwapWarnings = {
102
95
  quote: null,
103
- quoteUpdate: null,
104
96
  balance: null,
105
97
  };
106
98
 
107
- const quoteWarning = generateQuoteWarnings(currentQuote, {
108
- fromToken: params.fromToken,
109
- toToken: params.toToken,
110
- findToken: params.findToken,
111
- userSlippage: params.userSlippage,
99
+ const quoteWarning = generateQuoteWarnings({
100
+ previousQuote,
101
+ currentQuote,
102
+ findToken,
103
+ userSlippage,
112
104
  });
113
105
 
114
106
  if (quoteWarning) {
115
107
  output.quote = quoteWarning;
116
108
  }
117
109
 
118
- if (previousQuote && quoteChanged) {
119
- if (isOutputAmountChangedALot(previousQuote, currentQuote)) {
120
- output.quoteUpdate = {
121
- type: QuoteUpdateType.QUOTE_AND_OUTPUT_AMOUNT_UPDATED,
122
- newOutputAmount: numberToString(getQuoteOutputAmount(currentQuote)),
123
- percentageChange: numberToString(
124
- getPriceImpact(
125
- getQuoteOutputAmount(previousQuote) ?? '',
126
- getQuoteOutputAmount(currentQuote) ?? ''
127
- ),
128
- null,
129
- 2
130
- ),
131
- };
132
- } else if (isNumberOfSwapsChanged(previousQuote, currentQuote)) {
133
- output.quoteUpdate = {
134
- type: QuoteUpdateType.QUOTE_UPDATED,
135
- };
136
- } else if (isQuoteSwappersUpdated(previousQuote, currentQuote)) {
137
- output.quoteUpdate = {
138
- type: QuoteUpdateType.QUOTE_SWAPPERS_UPDATED,
139
- };
140
- } else if (isQuoteInternalCoinsUpdated(previousQuote, currentQuote)) {
141
- output.quoteUpdate = {
142
- type: QuoteUpdateType.QUOTE_COINS_UPDATED,
143
- };
144
- }
145
- }
146
-
147
110
  const balanceWarnings = generateBalanceWarnings(
148
111
  currentQuote,
149
- params.selectedWallets,
150
- params.meta.blockchains
112
+ selectedWallets,
113
+ meta.blockchains
151
114
  );
152
115
 
153
116
  const enoughBalance = balanceWarnings.length === 0;
@@ -21,10 +21,10 @@ export function useConfirmSwap(): ConfirmSwap {
21
21
  fromToken,
22
22
  toToken,
23
23
  inputAmount,
24
+ inputUsdValue,
24
25
  setSelectedQuote,
25
26
  selectedQuote: initialQuote,
26
27
  customDestination: customDestinationFromStore,
27
- setQuoteWarningsConfirmed,
28
28
  resetAlerts,
29
29
  } = useQuoteStore();
30
30
 
@@ -95,21 +95,16 @@ export function useConfirmSwap(): ConfirmSwap {
95
95
  disabledSwappersGroups: disabledLiquiditySources,
96
96
  };
97
97
 
98
- const confirmSwapWarnings = generateWarnings(
99
- initialQuote ?? undefined,
98
+ const confirmSwapWarnings = generateWarnings({
99
+ previousQuote: initialQuote ?? undefined,
100
100
  currentQuote,
101
- {
102
- fromToken,
103
- toToken,
104
- meta: { blockchains },
105
- findToken,
106
- selectedWallets,
107
- userSlippage,
108
- }
109
- );
110
- if (confirmSwapWarnings.quoteUpdate) {
111
- setQuoteWarningsConfirmed(false);
112
- }
101
+ meta: { blockchains },
102
+ selectedWallets,
103
+ userSlippage,
104
+ inputUsdValue,
105
+ findToken,
106
+ });
107
+
113
108
  resetAlerts();
114
109
 
115
110
  const proceedAnyway = !!confirmSwapWarnings.balance;
@@ -10,8 +10,6 @@ import { isPositiveNumber } from '../utils/numbers';
10
10
  import {
11
11
  generateQuoteWarnings,
12
12
  getDefaultQuote,
13
- getQuoteFromTokenUsdPrice,
14
- getQuoteToTokenUsdPrice,
15
13
  sortQuotesBy,
16
14
  } from '../utils/quote';
17
15
  import { isRoutingEnabled } from '../utils/settings';
@@ -156,15 +154,10 @@ export function useSwapInput({
156
154
  requestId: quote?.requestId || '',
157
155
  swaps: quote?.swaps,
158
156
  });
159
- const outputUsdValue =
160
- getQuoteToTokenUsdPrice(quote) || toToken?.usdPrice;
161
- const inputUsdValue =
162
- getQuoteFromTokenUsdPrice(quote) || fromToken?.usdPrice;
163
157
  const quoteWarning =
164
158
  quote &&
165
- generateQuoteWarnings(quote, {
166
- fromToken: { ...fromToken, usdPrice: inputUsdValue },
167
- toToken: { ...toToken, usdPrice: outputUsdValue },
159
+ generateQuoteWarnings({
160
+ currentQuote: quote,
168
161
  userSlippage,
169
162
  findToken,
170
163
  });
@@ -24,12 +24,12 @@ import { RefreshButton } from '../components/HeaderButtons/RefreshButton';
24
24
  import { Layout, PageContainer } from '../components/Layout';
25
25
  import { QuoteWarningsAndErrors } from '../components/QuoteWarningsAndErrors';
26
26
  import { navigationRoutes } from '../constants/navigationRoutes';
27
- import { getQuoteUpdateWarningMessage } from '../constants/warnings';
28
27
  import { QuoteInfo } from '../containers/QuoteInfo';
29
28
  import { useConfirmSwap } from '../hooks/useConfirmSwap';
30
29
  import { useAppStore } from '../store/AppStore';
31
30
  import { useQuoteStore } from '../store/quote';
32
31
  import { useUiStore } from '../store/ui';
32
+ import { isQuoteWarningConfirmationRequired } from '../utils/quote';
33
33
  import { joinList } from '../utils/ui';
34
34
 
35
35
  const Buttons = styled('div', {
@@ -133,7 +133,12 @@ export function ConfirmSwapPage() {
133
133
  };
134
134
 
135
135
  const onStartConfirmSwap = async () => {
136
- if (confirmSwapResult?.warnings?.quote && !quoteWarningsConfirmed) {
136
+ const shouldShowWarningModal =
137
+ confirmSwapResult.warnings?.quote &&
138
+ isQuoteWarningConfirmationRequired(confirmSwapResult.warnings.quote) &&
139
+ !quoteWarningsConfirmed;
140
+
141
+ if (shouldShowWarningModal) {
137
142
  setShowQuoteWarningModal(true);
138
143
  } else {
139
144
  await onConfirm();
@@ -196,19 +201,6 @@ export function ConfirmSwapPage() {
196
201
  alerts.push(<Alert type="error" variant="alarm" title={dbErrorMessage} />);
197
202
  }
198
203
 
199
- if (confirmSwapResult.warnings?.quoteUpdate) {
200
- alerts.push(
201
- <Alert
202
- variant="alarm"
203
- type="warning"
204
- title={
205
- confirmSwapResult.warnings.quoteUpdate &&
206
- getQuoteUpdateWarningMessage(confirmSwapResult.warnings.quoteUpdate)
207
- }
208
- />
209
- );
210
- }
211
-
212
204
  if (quoteWarning || quoteError) {
213
205
  const settings_url = `../${navigationRoutes.settings}`;
214
206
  alerts.push(
@@ -21,11 +21,7 @@ import {
21
21
  WidgetEvents,
22
22
  } from '../types';
23
23
  import { isPositiveNumber } from '../utils/numbers';
24
- import {
25
- getQuoteFromTokenUsdPrice,
26
- getQuoteToTokenUsdPrice,
27
- } from '../utils/quote';
28
- import { calcOutputUsdValue } from '../utils/swap';
24
+ import { getUsdInputFrom, getUsdOutputFrom } from '../utils/swap';
29
25
 
30
26
  import createSelectors from './selectors';
31
27
 
@@ -137,14 +133,8 @@ export const useQuoteStore = createSelectors(
137
133
  outputAmount = !!quote?.outputAmount
138
134
  ? new BigNumber(quote?.outputAmount)
139
135
  : null;
140
- inputUsdValue = calcOutputUsdValue(
141
- state.inputAmount,
142
- getQuoteFromTokenUsdPrice(quote) || state.fromToken?.usdPrice
143
- );
144
- outputUsdValue = calcOutputUsdValue(
145
- quote.outputAmount,
146
- getQuoteToTokenUsdPrice(quote) || state.toToken?.usdPrice
147
- );
136
+ inputUsdValue = getUsdInputFrom(quote) ?? ZERO;
137
+ outputUsdValue = getUsdOutputFrom(quote) ?? ZERO;
148
138
  }
149
139
  return {
150
140
  selectedQuote: quote,
@@ -51,29 +51,9 @@ export enum QuoteWarningType {
51
51
  UNKNOWN_PRICE,
52
52
  INSUFFICIENT_SLIPPAGE,
53
53
  HIGH_SLIPPAGE,
54
+ EXCESSIVE_OUTPUT_AMOUNT_CHANGE,
54
55
  }
55
56
 
56
- export enum QuoteUpdateType {
57
- QUOTE_UPDATED,
58
- QUOTE_SWAPPERS_UPDATED,
59
- QUOTE_COINS_UPDATED,
60
- QUOTE_AND_OUTPUT_AMOUNT_UPDATED,
61
- QUOTE_UPDATED_WITH_HIGH_VALUE_LOSS,
62
- }
63
-
64
- export type QuoteUpdateWarning =
65
- | {
66
- type: QuoteUpdateType.QUOTE_AND_OUTPUT_AMOUNT_UPDATED;
67
- newOutputAmount: string;
68
- percentageChange: string;
69
- }
70
- | {
71
- type: Exclude<
72
- QuoteUpdateType,
73
- QuoteUpdateType.QUOTE_AND_OUTPUT_AMOUNT_UPDATED
74
- >;
75
- };
76
-
77
57
  export type RecommendedSlippages = Map<number, string>;
78
58
 
79
59
  export type InsufficientSlippageWarning = {
@@ -100,15 +80,21 @@ export type UnknownPriceWarning = {
100
80
  type: QuoteWarningType.UNKNOWN_PRICE;
101
81
  };
102
82
 
83
+ export type ExcessiveOutputAmountChange = {
84
+ type: QuoteWarningType.EXCESSIVE_OUTPUT_AMOUNT_CHANGE;
85
+ usdValueChange: string;
86
+ percentageChange: string;
87
+ };
88
+
103
89
  export type QuoteWarning =
104
90
  | HighValueLossWarning
91
+ | ExcessiveOutputAmountChange
92
+ | UnknownPriceWarning
105
93
  | InsufficientSlippageWarning
106
- | HighSlippageWarning
107
- | UnknownPriceWarning;
94
+ | HighSlippageWarning;
108
95
 
109
96
  export type ConfirmSwapWarnings = {
110
97
  quote: QuoteWarning | null;
111
- quoteUpdate: QuoteUpdateWarning | null;
112
98
  balance: { messages: string[] } | null;
113
99
  };
114
100