@rango-dev/widget-embedded 0.14.1-next.14 → 0.14.1-next.16

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 (57) hide show
  1. package/dist/Widget.d.ts.map +1 -1
  2. package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
  3. package/dist/constants/configs.d.ts +2 -0
  4. package/dist/constants/configs.d.ts.map +1 -0
  5. package/dist/constants/errors.d.ts +1 -1
  6. package/dist/constants/errors.d.ts.map +1 -1
  7. package/dist/constants/languages.d.ts +11 -0
  8. package/dist/constants/languages.d.ts.map +1 -0
  9. package/dist/constants/messages.d.ts +1 -1
  10. package/dist/constants/messages.d.ts.map +1 -1
  11. package/dist/hooks/useLanguage.d.ts +11 -0
  12. package/dist/hooks/useLanguage.d.ts.map +1 -0
  13. package/dist/hooks/usePrepareBlockchainList/index.d.ts +2 -0
  14. package/dist/hooks/usePrepareBlockchainList/index.d.ts.map +1 -0
  15. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts +2 -0
  16. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts.map +1 -0
  17. package/dist/hooks/{usePrepareBlockchainList.d.ts → usePrepareBlockchainList/usePrepareBlockchainList.d.ts} +1 -9
  18. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts.map +1 -0
  19. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +10 -0
  20. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts.map +1 -0
  21. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts +3 -0
  22. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -0
  23. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.d.ts +2 -0
  24. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.d.ts.map +1 -0
  25. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts +11 -0
  26. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts.map +1 -0
  27. package/dist/index.js +1 -1
  28. package/dist/index.js.map +4 -4
  29. package/dist/pages/LanguagePage.d.ts.map +1 -1
  30. package/dist/store/settings.d.ts +15 -6
  31. package/dist/store/settings.d.ts.map +1 -1
  32. package/package.json +2 -2
  33. package/src/Widget.tsx +10 -1
  34. package/src/components/BlockchainsSection/BlockchainsSection.tsx +21 -6
  35. package/src/components/NoRoutes/NoRoutes.helper.ts +4 -4
  36. package/src/components/NoRoutes/NoRoutes.tsx +1 -1
  37. package/src/components/RouteErrors/RouteErrors.tsx +2 -2
  38. package/src/components/RouteErrors/RouteErrorsModal.tsx +6 -6
  39. package/src/constants/configs.ts +1 -0
  40. package/src/constants/errors.ts +43 -41
  41. package/src/constants/languages.ts +19 -0
  42. package/src/constants/messages.ts +7 -5
  43. package/src/hooks/useConfirmSwap.ts +1 -1
  44. package/src/hooks/useLanguage.ts +27 -0
  45. package/src/hooks/usePrepareBlockchainList/index.ts +1 -0
  46. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -0
  47. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts +108 -0
  48. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +3101 -0
  49. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +273 -0
  50. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +38 -0
  51. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +12 -0
  52. package/src/pages/Home.tsx +2 -2
  53. package/src/pages/LanguagePage.tsx +16 -39
  54. package/src/store/settings.ts +46 -4
  55. package/src/utils/swap.ts +10 -10
  56. package/dist/hooks/usePrepareBlockchainList.d.ts.map +0 -1
  57. package/src/hooks/usePrepareBlockchainList.ts +0 -125
@@ -0,0 +1,273 @@
1
+ import type { BlockchainMeta } from 'rango-sdk';
2
+
3
+ import { beforeEach, describe, expect, it } from 'vitest';
4
+
5
+ import { MOST_USED_BLOCKChAINS } from './usePrepareBlockchainList.constants';
6
+ import {
7
+ generateSortByPreferredBlockchainsFor,
8
+ prepare,
9
+ sortByMostUsedBlockchains,
10
+ } from './usePrepareBlockchainList.helpers';
11
+ import { sampleBlockchains } from './usePrepareBlockchainList.mock';
12
+
13
+ describe('usePrepareBlockchainList', () => {
14
+ let sample: BlockchainMeta[] = [];
15
+
16
+ beforeEach(() => {
17
+ sample = JSON.parse(JSON.stringify(sampleBlockchains));
18
+ });
19
+
20
+ it('should sort blockchains by most used ones.', () => {
21
+ const sortedBlockchainsList = sample.sort(sortByMostUsedBlockchains);
22
+
23
+ const mostUsedCount = MOST_USED_BLOCKChAINS.length;
24
+ const expected = MOST_USED_BLOCKChAINS;
25
+ const received = sortedBlockchainsList
26
+ .map((blockchain) => blockchain.name)
27
+ .slice(0, mostUsedCount);
28
+
29
+ expect(expected).toEqual(received);
30
+ });
31
+
32
+ it('should sort blockchains by user preferences', () => {
33
+ const preferredBlockchains = ['UMEE', 'BANDCHAIN', 'LINEA'];
34
+ const sortedBlockchainsList = sample.sort(
35
+ generateSortByPreferredBlockchainsFor(preferredBlockchains)
36
+ );
37
+
38
+ const expected = [
39
+ 'UMEE',
40
+ 'BANDCHAIN',
41
+ 'LINEA',
42
+ 'ETH',
43
+ 'BSC',
44
+ 'ARBITRUM',
45
+ 'POLYGON',
46
+ 'ZKSYNC',
47
+ 'STARKNET',
48
+ 'OPTIMISM',
49
+ 'AVAX_CCHAIN',
50
+ 'POLYGONZK',
51
+ 'TRON',
52
+ 'BTC',
53
+ 'COSMOS',
54
+ 'OSMOSIS',
55
+ 'NEUTRON',
56
+ 'NOBLE',
57
+ 'SOLANA',
58
+ 'CRONOS',
59
+ 'BNB',
60
+ 'AURORA',
61
+ 'MAYA',
62
+ 'THOR',
63
+ 'BOBA',
64
+ 'MOONBEAM',
65
+ 'MOONRIVER',
66
+ 'OKC',
67
+ 'BOBA_AVALANCHE',
68
+ 'LTC',
69
+ 'BCH',
70
+ 'HECO',
71
+ 'STARGAZE',
72
+ 'CRYPTO_ORG',
73
+ 'CHIHUAHUA',
74
+ 'COMDEX',
75
+ 'REGEN',
76
+ 'IRIS',
77
+ 'EMONEY',
78
+ 'JUNO',
79
+ 'STRIDE',
80
+ 'MARS',
81
+ 'TERRA',
82
+ 'BITSONG',
83
+ 'AKASH',
84
+ 'KI',
85
+ 'PERSISTENCE',
86
+ 'MEDIBLOC',
87
+ 'KUJIRA',
88
+ 'SENTINEL',
89
+ 'INJECTIVE',
90
+ 'SECRET',
91
+ 'KONSTELLATION',
92
+ 'STARNAME',
93
+ 'BITCANNA',
94
+ 'DESMOS',
95
+ 'LUMNETWORK',
96
+ ];
97
+ const received = sortedBlockchainsList.map((blockchain) => blockchain.name);
98
+
99
+ expect(expected).toEqual(received);
100
+ });
101
+
102
+ it('should prepare the list by most used and user preferences', () => {
103
+ const listLimit = 10;
104
+ const preferredBlockchains = ['BTC', 'SOLANA', 'COSMOS', 'ETH'];
105
+ const expected = [
106
+ 'BTC',
107
+ 'SOLANA',
108
+ 'ETH',
109
+ 'COSMOS',
110
+ 'OSMOSIS',
111
+ 'BSC',
112
+ 'ARBITRUM',
113
+ 'POLYGON',
114
+ 'ZKSYNC',
115
+ 'STARKNET',
116
+ 'OPTIMISM',
117
+ 'AVAX_CCHAIN',
118
+ 'POLYGONZK',
119
+ 'LINEA',
120
+ 'TRON',
121
+ 'NEUTRON',
122
+ 'NOBLE',
123
+ 'CRONOS',
124
+ 'BNB',
125
+ 'AURORA',
126
+ 'MAYA',
127
+ 'THOR',
128
+ 'BOBA',
129
+ 'MOONBEAM',
130
+ 'MOONRIVER',
131
+ 'OKC',
132
+ 'BOBA_AVALANCHE',
133
+ 'LTC',
134
+ 'BCH',
135
+ 'HECO',
136
+ 'STARGAZE',
137
+ 'CRYPTO_ORG',
138
+ 'CHIHUAHUA',
139
+ 'BANDCHAIN',
140
+ 'COMDEX',
141
+ 'REGEN',
142
+ 'IRIS',
143
+ 'EMONEY',
144
+ 'JUNO',
145
+ 'STRIDE',
146
+ 'MARS',
147
+ 'TERRA',
148
+ 'BITSONG',
149
+ 'AKASH',
150
+ 'KI',
151
+ 'PERSISTENCE',
152
+ 'MEDIBLOC',
153
+ 'KUJIRA',
154
+ 'SENTINEL',
155
+ 'INJECTIVE',
156
+ 'SECRET',
157
+ 'KONSTELLATION',
158
+ 'STARNAME',
159
+ 'BITCANNA',
160
+ 'UMEE',
161
+ 'DESMOS',
162
+ 'LUMNETWORK',
163
+ ];
164
+ const received = prepare(sample, preferredBlockchains, {
165
+ limit: listLimit,
166
+ });
167
+
168
+ const receivedListNames = received.list.map(
169
+ (blockchain) => blockchain.name
170
+ );
171
+ const receivedMoreNames = received.more.map(
172
+ (blockchain) => blockchain.name
173
+ );
174
+
175
+ expect(received.list).toHaveLength(listLimit);
176
+ expect(received.more).toHaveLength(expected.length - listLimit);
177
+ expect(expected).toEqual([...receivedListNames, ...receivedMoreNames]);
178
+
179
+ // Check duplication
180
+ receivedListNames.forEach((listName) => {
181
+ expect(receivedMoreNames).not.toContain(listName);
182
+ });
183
+
184
+ // Check preferred blockchains to be on the main list
185
+ preferredBlockchains.forEach((blockchain) => {
186
+ expect(receivedListNames).toContain(blockchain);
187
+ });
188
+ });
189
+
190
+ it('should prepare the list correctly if user has a long list of preferences ', () => {
191
+ const listLimit = 10;
192
+ const preferredBlockchains = [
193
+ 'ETH',
194
+ 'BTC',
195
+ 'SOLANA',
196
+ 'CRYPTO_ORG',
197
+ 'TRON',
198
+ 'BOBA_AVALANCHE',
199
+ 'AKASH',
200
+ 'LUMNETWORK',
201
+ 'KONSTELLATION',
202
+ 'BANDCHAIN',
203
+ 'INJECTIVE',
204
+ ];
205
+ const expected = [
206
+ 'ETH',
207
+ 'BTC',
208
+ 'SOLANA',
209
+ 'CRYPTO_ORG',
210
+ 'TRON',
211
+ 'BOBA_AVALANCHE',
212
+ 'AKASH',
213
+ 'LUMNETWORK',
214
+ 'KONSTELLATION',
215
+ 'BANDCHAIN',
216
+ 'INJECTIVE',
217
+ 'COSMOS',
218
+ 'OSMOSIS',
219
+ 'BSC',
220
+ 'ARBITRUM',
221
+ 'POLYGON',
222
+ 'ZKSYNC',
223
+ 'STARKNET',
224
+ 'OPTIMISM',
225
+ 'AVAX_CCHAIN',
226
+ 'POLYGONZK',
227
+ 'LINEA',
228
+ 'NEUTRON',
229
+ 'NOBLE',
230
+ 'CRONOS',
231
+ 'BNB',
232
+ 'AURORA',
233
+ 'MAYA',
234
+ 'THOR',
235
+ 'BOBA',
236
+ 'MOONBEAM',
237
+ 'MOONRIVER',
238
+ 'OKC',
239
+ 'LTC',
240
+ 'BCH',
241
+ 'HECO',
242
+ 'STARGAZE',
243
+ 'CHIHUAHUA',
244
+ 'COMDEX',
245
+ 'REGEN',
246
+ 'IRIS',
247
+ 'EMONEY',
248
+ 'JUNO',
249
+ 'STRIDE',
250
+ 'MARS',
251
+ 'TERRA',
252
+ 'BITSONG',
253
+ 'KI',
254
+ 'PERSISTENCE',
255
+ 'MEDIBLOC',
256
+ 'KUJIRA',
257
+ 'SENTINEL',
258
+ 'SECRET',
259
+ 'STARNAME',
260
+ 'BITCANNA',
261
+ 'UMEE',
262
+ 'DESMOS',
263
+ ];
264
+ const received = prepare(sample, preferredBlockchains, {
265
+ limit: listLimit,
266
+ });
267
+
268
+ expect(expected).toEqual([
269
+ ...received.list.map((blockchain) => blockchain.name),
270
+ ...received.more.map((blockchain) => blockchain.name),
271
+ ]);
272
+ });
273
+ });
@@ -0,0 +1,38 @@
1
+ import type {
2
+ PrepareListOptions,
3
+ PrepareListOutput,
4
+ } from './usePrepareBlockchainList.types';
5
+ import type { BlockchainMeta } from 'rango-sdk';
6
+
7
+ import { useEffect } from 'react';
8
+
9
+ import { useSettingsStore } from '../../store/settings';
10
+
11
+ import { prepare } from './usePrepareBlockchainList.helpers';
12
+
13
+ /**
14
+ *
15
+ * UI needs some specific logics like limiting the list and sorting,
16
+ * this function is getting the raw blockchains list and return a list for showing in UI.
17
+ *
18
+ */
19
+ export function usePrepareBlockchainList(
20
+ blockchains: BlockchainMeta[],
21
+ options?: PrepareListOptions
22
+ ): PrepareListOutput {
23
+ const { preferredBlockchains, addPreferredBlockchain } = useSettingsStore();
24
+
25
+ useEffect(() => {
26
+ if (options?.selected) {
27
+ addPreferredBlockchain(options?.selected);
28
+ }
29
+ }, [options?.selected]);
30
+
31
+ const output = prepare(blockchains, preferredBlockchains, options);
32
+
33
+ return {
34
+ list: output.list,
35
+ more: output.more,
36
+ history: [],
37
+ };
38
+ }
@@ -0,0 +1,12 @@
1
+ import type { BlockchainMeta } from 'rango-sdk';
2
+
3
+ export interface PrepareListOptions {
4
+ limit?: number;
5
+ selected?: string;
6
+ }
7
+
8
+ export interface PrepareListOutput {
9
+ list: BlockchainMeta[];
10
+ more: BlockchainMeta[];
11
+ history: string[];
12
+ }
@@ -347,7 +347,7 @@ export function Home() {
347
347
  USD_VALUE_MAX_DECIMALS
348
348
  ),
349
349
  error: priceImpactInputCanNotBeComputed
350
- ? errorMessages.unknownPriceError.impactTitle
350
+ ? errorMessages().unknownPriceError.impactTitle
351
351
  : undefined,
352
352
  }}
353
353
  disabled={loadingMetaStatus === 'failed'}
@@ -398,7 +398,7 @@ export function Home() {
398
398
  USD_VALUE_MAX_DECIMALS
399
399
  ),
400
400
  error: priceImpactOutputCanNotBeComputed
401
- ? errorMessages.unknownPriceError.impactTitle
401
+ ? errorMessages().unknownPriceError.impactTitle
402
402
  : undefined,
403
403
  }}
404
404
  onClickToken={() => navigate('to-swap')}
@@ -6,57 +6,34 @@ import {
6
6
  RadioRoot,
7
7
  Typography,
8
8
  } from '@rango-dev/ui';
9
- import React, { useState } from 'react';
9
+ import React from 'react';
10
10
 
11
11
  import { Layout } from '../components/Layout';
12
12
  import { SettingsContainer } from '../components/SettingsContainer';
13
13
  import { navigationRoutes } from '../constants/navigationRoutes';
14
+ import { useLanguage } from '../hooks/useLanguage';
14
15
  import { useNavigateBack } from '../hooks/useNavigateBack';
15
16
 
16
- enum Languages {
17
- ENGLISH = 'english',
18
- FRENCH = 'french',
19
- SPANISH = 'spanish',
20
- }
21
17
  export function LanguagePage() {
22
18
  const { navigateBackFrom } = useNavigateBack();
23
- const [language, setLanguage] = useState(Languages.ENGLISH);
24
19
 
25
- const languageList = [
26
- {
27
- id: Languages.ENGLISH,
28
- value: Languages.ENGLISH,
29
- title: (
30
- <Typography variant="title" size="xmedium">
31
- {i18n.t('English')}
32
- </Typography>
33
- ),
34
- onClick: () => setLanguage(Languages.ENGLISH),
35
- end: <Radio value={Languages.ENGLISH} />,
36
- },
37
- {
38
- id: Languages.FRENCH,
39
- value: Languages.FRENCH,
40
- title: (
41
- <Typography variant="title" size="xmedium">
42
- {i18n.t('French')}
43
- </Typography>
44
- ),
45
- onClick: () => setLanguage(Languages.FRENCH),
46
- end: <Radio value={Languages.FRENCH} />,
47
- },
48
- {
49
- id: Languages.SPANISH,
50
- value: Languages.SPANISH,
20
+ const { activeLanguage, changeLanguage, languages } = useLanguage();
21
+
22
+ const languageList = languages.map((languageItem) => {
23
+ const { local, label, SVGFlag } = languageItem;
24
+ return {
25
+ id: local,
26
+ value: local,
51
27
  title: (
52
28
  <Typography variant="title" size="xmedium">
53
- {i18n.t('Spanish')}
29
+ {label}
54
30
  </Typography>
55
31
  ),
56
- onClick: () => setLanguage(Languages.SPANISH),
57
- end: <Radio value={Languages.SPANISH} />,
58
- },
59
- ];
32
+ onClick: () => changeLanguage(languageItem.local),
33
+ end: <Radio value={local} />,
34
+ start: <SVGFlag />,
35
+ };
36
+ });
60
37
 
61
38
  return (
62
39
  <Layout
@@ -65,7 +42,7 @@ export function LanguagePage() {
65
42
  title: i18n.t('Language'),
66
43
  }}>
67
44
  <SettingsContainer>
68
- <RadioRoot value={language}>
45
+ <RadioRoot value={activeLanguage}>
69
46
  <List
70
47
  type={
71
48
  <ListItemButton
@@ -1,40 +1,50 @@
1
+ import { type Language } from '@rango-dev/ui';
1
2
  import { create } from 'zustand';
2
3
  import { persist, subscribeWithSelector } from 'zustand/middleware';
3
4
 
5
+ import { BLOCKCHAIN_LIST_SIZE } from '../constants/configs';
6
+ import { DEFAULT_LANGUAGE } from '../constants/languages';
4
7
  import { DEFAULT_SLIPPAGE } from '../constants/swapSettings';
5
8
  import { removeDuplicateFrom } from '../utils/common';
6
9
 
7
10
  import { useMetaStore } from './meta';
8
11
  import createSelectors from './selectors';
9
12
 
10
- type Theme = 'auto' | 'dark' | 'light';
13
+ export type ThemeMode = 'auto' | 'dark' | 'light';
11
14
 
12
15
  export interface SettingsState {
16
+ /** Keeping a history of blockchains that user has selected (in Swap process) */
17
+ preferredBlockchains: string[];
13
18
  slippage: number;
14
19
  customSlippage: number | null;
15
20
  infiniteApprove: boolean;
16
21
  disabledLiquiditySources: string[];
17
- theme: Theme;
22
+ theme: ThemeMode;
23
+ language: Language;
18
24
  affiliateRef: string | null;
19
25
  affiliatePercent: number | null;
20
26
  affiliateWallets: { [key: string]: string } | null;
27
+
21
28
  setSlippage: (slippage: number) => void;
22
29
  setCustomSlippage: (customSlippage: number | null) => void;
23
30
  toggleInfiniteApprove: () => void;
24
31
  toggleLiquiditySource: (name: string) => void;
25
- setTheme: (theme: Theme) => void;
32
+ setTheme: (theme: ThemeMode) => void;
33
+ setLanguage: (language: Language) => void;
26
34
  toggleAllLiquiditySources: (shouldReset?: boolean) => void;
27
35
  setAffiliateRef: (affiliateRef: string | null) => void;
28
36
  setAffiliatePercent: (affiliatePercent: number | null) => void;
29
37
  setAffiliateWallets: (
30
38
  affiliateWallets: { [key: string]: string } | null
31
39
  ) => void;
40
+ addPreferredBlockchain: (blockchain: string) => void;
32
41
  }
33
42
 
34
43
  export const useSettingsStore = createSelectors(
35
44
  create<SettingsState>()(
36
45
  persist(
37
- subscribeWithSelector((set) => ({
46
+ subscribeWithSelector((set, get) => ({
47
+ preferredBlockchains: [],
38
48
  slippage: DEFAULT_SLIPPAGE,
39
49
  customSlippage: null,
40
50
  infiniteApprove: false,
@@ -43,6 +53,34 @@ export const useSettingsStore = createSelectors(
43
53
  affiliateWallets: null,
44
54
  disabledLiquiditySources: [],
45
55
  theme: 'auto',
56
+ language: DEFAULT_LANGUAGE,
57
+ addPreferredBlockchain: (blockchain) => {
58
+ const currentPreferredBlockchains = get().preferredBlockchains;
59
+
60
+ const noNeedToDoAnything = currentPreferredBlockchains.find(
61
+ (preferredBlockchain, index) => {
62
+ const isSameBlockchain = preferredBlockchain === blockchain;
63
+ const isInVisibleList = index <= BLOCKCHAIN_LIST_SIZE - 1;
64
+
65
+ return isSameBlockchain && isInVisibleList;
66
+ }
67
+ );
68
+
69
+ if (noNeedToDoAnything) {
70
+ return;
71
+ }
72
+
73
+ const nextPreferredBlockchains: string[] =
74
+ currentPreferredBlockchains.filter((preferredBlockchain) => {
75
+ const isSameBlockchain = preferredBlockchain === blockchain;
76
+
77
+ return !isSameBlockchain;
78
+ });
79
+
80
+ set(() => ({
81
+ preferredBlockchains: [blockchain, ...nextPreferredBlockchains],
82
+ }));
83
+ },
46
84
  setSlippage: (slippage) =>
47
85
  set(() => ({
48
86
  slippage: slippage,
@@ -106,6 +144,10 @@ export const useSettingsStore = createSelectors(
106
144
  set(() => ({
107
145
  theme,
108
146
  })),
147
+ setLanguage: (language) =>
148
+ set(() => ({
149
+ language,
150
+ })),
109
151
  })),
110
152
  {
111
153
  name: 'user-settings',
package/src/utils/swap.ts CHANGED
@@ -131,7 +131,7 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
131
131
  symbol: swap.from.symbol,
132
132
  },
133
133
  });
134
- recommendation = errorMessages.bridgeLimitErrors.increaseAmount;
134
+ recommendation = errorMessages().bridgeLimitErrors.increaseAmount;
135
135
  } else if (isExclusive && !!minimum && minimum.gte(swap.fromAmount)) {
136
136
  fromAmountRangeError = i18n.t({
137
137
  id: 'requiredMin',
@@ -145,7 +145,7 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
145
145
  symbol: swap.from.symbol,
146
146
  },
147
147
  });
148
- recommendation = errorMessages.bridgeLimitErrors.increaseAmount;
148
+ recommendation = errorMessages().bridgeLimitErrors.increaseAmount;
149
149
  }
150
150
 
151
151
  if (!isExclusive && !!maximum && maximum.lt(swap.fromAmount)) {
@@ -161,7 +161,7 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
161
161
  symbol: swap.from.symbol,
162
162
  },
163
163
  });
164
- recommendation = errorMessages.bridgeLimitErrors.decreaseAmount;
164
+ recommendation = errorMessages().bridgeLimitErrors.decreaseAmount;
165
165
  } else if (isExclusive && !!maximum && maximum.lte(swap.fromAmount)) {
166
166
  fromAmountRangeError = i18n.t({
167
167
  id: 'requiredMax',
@@ -175,7 +175,7 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
175
175
  symbol: swap.from.symbol,
176
176
  },
177
177
  });
178
- recommendation = errorMessages.bridgeLimitErrors.decreaseAmount;
178
+ recommendation = errorMessages().bridgeLimitErrors.decreaseAmount;
179
179
  }
180
180
 
181
181
  return { swap, fromAmountRangeError, recommendation };
@@ -194,14 +194,14 @@ export function getSwapButtonState(
194
194
  ): SwapButtonState {
195
195
  if (loadingMetaStatus !== 'success') {
196
196
  return {
197
- title: swapButtonTitles.connectWallet,
197
+ title: swapButtonTitles().connectWallet,
198
198
  state: ButtonState.WAITFORCONNECTING,
199
199
  disabled: true,
200
200
  };
201
201
  }
202
202
  if (connectedWallets.length == 0) {
203
203
  return {
204
- title: swapButtonTitles.connectWallet,
204
+ title: swapButtonTitles().connectWallet,
205
205
  state: ButtonState.WAITFORCONNECTING,
206
206
  disabled: false,
207
207
  };
@@ -215,27 +215,27 @@ export function getSwapButtonState(
215
215
  inputAmount === '0'
216
216
  ) {
217
217
  return {
218
- title: swapButtonTitles.swap,
218
+ title: swapButtonTitles().swap,
219
219
  disabled: true,
220
220
  state: ButtonState.SWAP,
221
221
  };
222
222
  } else if (highValueLoss || priceImpactCanNotBeComputed) {
223
223
  return {
224
- title: swapButtonTitles.swapAnyway,
224
+ title: swapButtonTitles().swapAnyway,
225
225
  disabled: false,
226
226
  hasWarning: true,
227
227
  state: ButtonState.NEEDTOCONFIRM,
228
228
  };
229
229
  } else if (needsToWarnEthOnPath) {
230
230
  return {
231
- title: swapButtonTitles.ethRouteWarning,
231
+ title: swapButtonTitles().ethRouteWarning,
232
232
  disabled: false,
233
233
  hasWarning: true,
234
234
  state: ButtonState.WARNING,
235
235
  };
236
236
  }
237
237
  return {
238
- title: swapButtonTitles.swap,
238
+ title: swapButtonTitles().swap,
239
239
  disabled: false,
240
240
  state: ButtonState.SWAP,
241
241
  };
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePrepareBlockchainList.d.ts","sourceRoot":"","sources":["../../src/hooks/usePrepareBlockchainList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIhD,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,iBAAiB;IACzB,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,IAAI,EAAE,cAAc,EAAE,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,cAAc,EAAE,EAC7B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,iBAAiB,CAgEnB"}