@rango-dev/widget-embedded 0.12.1-next.32 → 0.12.1-next.33
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/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
- package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +1 -1
- package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +2 -1
- package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +1 -0
- package/dist/utils/meta.d.ts.map +1 -1
- package/dist/utils/settings.d.ts +1 -0
- package/dist/utils/settings.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/BlockchainsSection/BlockchainsSection.tsx +6 -2
- package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +7 -3
- package/src/components/SettingsContainer/SettingsContainer.style.ts +2 -1
- package/src/components/SwapDetails/SwapDetails.helpers.tsx +10 -7
- package/src/components/SwapDetails/SwapDetails.tsx +2 -1
- package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +5 -4
- package/src/pages/ConfirmSwapPage.tsx +2 -2
- package/src/pages/Home.tsx +6 -3
- package/src/pages/LiquiditySourcePage.tsx +21 -16
- package/src/pages/SettingsPage.tsx +17 -11
- package/src/utils/meta.ts +7 -0
- package/src/utils/settings.ts +15 -0
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":"AAcA,OAAO,KAAsC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAsC,MAAM,OAAO,CAAC;AA+E3D,wBAAgB,IAAI,sBA2YnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquiditySourcePage.d.ts","sourceRoot":"","sources":["../../src/pages/LiquiditySourcePage.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LiquiditySourcePage.d.ts","sourceRoot":"","sources":["../../src/pages/LiquiditySourcePage.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAqBxC,UAAU,SAAS;IACjB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,UAAU,EAAE,WAAW,GAAG,SAAS,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,EAClC,iBAAiB,EACjB,UAAU,GACX,EAAE,SAAS,qBAwHX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,UAAU,SAAS;IACjB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAE,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,UAAU,SAAS;IACjB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAE,EAAE,SAAS,qBAgKzE"}
|
package/dist/utils/meta.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { BlockchainMeta } from 'rango-sdk';
|
|
2
2
|
export declare function getBlockchainDisplayNameFor(blockchainName: string, blockchains: BlockchainMeta[]): string | undefined;
|
|
3
|
+
export declare function getBlockchainShortNameFor(blockchainName: string, blockchains: BlockchainMeta[]): string | undefined;
|
|
3
4
|
//# 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,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,wBAAgB,2BAA2B,CACzC,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,cAAc,EAAE,GAC5B,MAAM,GAAG,SAAS,CAGpB"}
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/utils/meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,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"}
|
package/dist/utils/settings.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export type UniqueSwappersGroupType = {
|
|
|
7
7
|
selected: boolean;
|
|
8
8
|
};
|
|
9
9
|
export declare function getUniqueSwappersGroups(supportedSwappers?: string[]): UniqueSwappersGroupType[];
|
|
10
|
+
export declare function sortLiquiditySourcesByGroupTitle(a: UniqueSwappersGroupType, b: UniqueSwappersGroupType): 0 | 1 | -1;
|
|
10
11
|
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/utils/settings.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,YAAY,GAAG,KAAK,CAAC;AAElE,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAC3B,uBAAuB,EAAE,CAuC3B"}
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/utils/settings.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,YAAY,GAAG,KAAK,CAAC;AAElE,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAC3B,uBAAuB,EAAE,CAuC3B;AAED,wBAAgB,gCAAgC,CAC9C,CAAC,EAAE,uBAAuB,EAC1B,CAAC,EAAE,uBAAuB,cAW3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.12.1-next.
|
|
3
|
+
"version": "0.12.1-next.33",
|
|
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.15.1-next.2",
|
|
24
24
|
"@rango-dev/queue-manager-rango-preset": "^0.15.1-next.6",
|
|
25
25
|
"@rango-dev/queue-manager-react": "^0.15.1-next.4",
|
|
26
|
-
"@rango-dev/ui": "^0.15.1-next.
|
|
26
|
+
"@rango-dev/ui": "^0.15.1-next.23",
|
|
27
27
|
"@rango-dev/wallets-react": "^0.1.1-next.6",
|
|
28
28
|
"@rango-dev/wallets-shared": "^0.15.1-next.4",
|
|
29
29
|
"bignumber.js": "^9.1.1",
|
|
@@ -18,18 +18,22 @@ import { useMetaStore } from '../../store/meta';
|
|
|
18
18
|
import { Container } from './BlockchainsSection.styles';
|
|
19
19
|
|
|
20
20
|
const LIST_SIZE = 10;
|
|
21
|
+
const MAX_ITEMS = LIST_SIZE + 1;
|
|
21
22
|
const NUMBER_OF_LOADING = 12;
|
|
22
23
|
|
|
23
24
|
export function BlockchainsSection(props: PropTypes) {
|
|
24
25
|
const { blockchains, type, blockchain, onChange, onMoreClick } = props;
|
|
25
26
|
const blockchainsList = usePrepareBlockchainList(blockchains, {
|
|
26
|
-
limit: LIST_SIZE,
|
|
27
|
+
limit: blockchains.length === MAX_ITEMS ? MAX_ITEMS : LIST_SIZE,
|
|
27
28
|
selected: blockchain?.name,
|
|
28
29
|
});
|
|
29
30
|
|
|
30
31
|
const loadingStatus = useMetaStore.use.loadingStatus();
|
|
31
32
|
const resetToBlockchain = useBestRouteStore.use.resetToBlockchain();
|
|
32
33
|
const resetFromBlockchain = useBestRouteStore.use.resetFromBlockchain();
|
|
34
|
+
const showMoreButton =
|
|
35
|
+
blockchains.length !== MAX_ITEMS && blockchainsList.more.length;
|
|
36
|
+
|
|
33
37
|
return (
|
|
34
38
|
<div>
|
|
35
39
|
<Divider size={12} />
|
|
@@ -66,7 +70,7 @@ export function BlockchainsSection(props: PropTypes) {
|
|
|
66
70
|
</BlockchainsChip>
|
|
67
71
|
))}
|
|
68
72
|
|
|
69
|
-
{
|
|
73
|
+
{showMoreButton ? (
|
|
70
74
|
<BlockchainsChip onClick={onMoreClick}>
|
|
71
75
|
<Typography variant="body" size="xsmall" color="secondary500">
|
|
72
76
|
{i18n._('More +{count}', {
|
|
@@ -8,10 +8,12 @@ import {
|
|
|
8
8
|
USD_VALUE_MAX_DECIMALS,
|
|
9
9
|
USD_VALUE_MIN_DECIMALS,
|
|
10
10
|
} from '../../constants/routing';
|
|
11
|
+
import { getBlockchainShortNameFor } from '../../utils/meta';
|
|
11
12
|
import { numberToString } from '../../utils/numbers';
|
|
12
13
|
|
|
13
14
|
export function formatBestRoute(
|
|
14
|
-
bestRoute: BestRouteResponse
|
|
15
|
+
bestRoute: BestRouteResponse,
|
|
16
|
+
blockchains: BlockchainMeta[]
|
|
15
17
|
): Step[] | undefined {
|
|
16
18
|
return bestRoute.result?.swaps.map((swap) => {
|
|
17
19
|
return {
|
|
@@ -19,7 +21,8 @@ export function formatBestRoute(
|
|
|
19
21
|
from: {
|
|
20
22
|
token: { displayName: swap.from.symbol, image: swap.from.logo },
|
|
21
23
|
chain: {
|
|
22
|
-
displayName:
|
|
24
|
+
displayName:
|
|
25
|
+
getBlockchainShortNameFor(swap.from.blockchain, blockchains) ?? '',
|
|
23
26
|
image: swap.from.blockchainLogo,
|
|
24
27
|
},
|
|
25
28
|
price: {
|
|
@@ -38,7 +41,8 @@ export function formatBestRoute(
|
|
|
38
41
|
to: {
|
|
39
42
|
token: { displayName: swap.to.symbol, image: swap.to.logo },
|
|
40
43
|
chain: {
|
|
41
|
-
displayName:
|
|
44
|
+
displayName:
|
|
45
|
+
getBlockchainShortNameFor(swap.to.blockchain, blockchains) ?? '',
|
|
42
46
|
image: swap.to.blockchainLogo,
|
|
43
47
|
},
|
|
44
48
|
price: {
|
|
@@ -2,6 +2,7 @@ import { styled } from '@rango-dev/ui';
|
|
|
2
2
|
|
|
3
3
|
export const SettingsContainer = styled('div', {
|
|
4
4
|
height: '100%',
|
|
5
|
+
overflow: 'hidden',
|
|
5
6
|
});
|
|
6
7
|
|
|
7
8
|
export const LiquiditySourceList = styled('ul', {
|
|
@@ -9,7 +10,7 @@ export const LiquiditySourceList = styled('ul', {
|
|
|
9
10
|
margin: 0,
|
|
10
11
|
listStyle: 'none',
|
|
11
12
|
height: '100%',
|
|
12
|
-
overflowY: '
|
|
13
|
+
overflowY: 'auto',
|
|
13
14
|
});
|
|
14
15
|
|
|
15
16
|
export const LiquiditySourceSuffix = styled('div', {
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
TOKEN_AMOUNT_MAX_DECIMALS,
|
|
9
9
|
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
10
10
|
} from '../../constants/routing';
|
|
11
|
+
import { getBlockchainShortNameFor } from '../../utils/meta';
|
|
11
12
|
import { numberToString } from '../../utils/numbers';
|
|
12
13
|
import { isNetworkStatusInWarningState } from '../../utils/swap';
|
|
13
14
|
import { SwapDetailsAlerts } from '../SwapDetailsAlerts';
|
|
@@ -15,17 +16,18 @@ import { SwapDetailsAlerts } from '../SwapDetailsAlerts';
|
|
|
15
16
|
export const RESET_INTERVAL = 2_000;
|
|
16
17
|
export const SECONDS = 60;
|
|
17
18
|
|
|
18
|
-
export const getSteps = ({ swap, ...args }: GetStep): Step[] => {
|
|
19
|
+
export const getSteps = ({ swap, blockchains, ...args }: GetStep): Step[] => {
|
|
19
20
|
const hasAlreadyProceededToSign = swap.hasAlreadyProceededToSign !== false;
|
|
20
21
|
return swap.steps.map((step, index) => {
|
|
21
22
|
const amountToConvert =
|
|
22
23
|
index === 0 ? swap.inputAmount : swap.steps[index - 1].outputAmount;
|
|
23
24
|
return {
|
|
24
25
|
from: {
|
|
25
|
-
token: { displayName: step.fromSymbol, image: step.fromLogo
|
|
26
|
+
token: { displayName: step.fromSymbol, image: step.fromLogo ?? '' },
|
|
26
27
|
chain: {
|
|
27
|
-
displayName:
|
|
28
|
-
|
|
28
|
+
displayName:
|
|
29
|
+
getBlockchainShortNameFor(step.fromBlockchain, blockchains) ?? '',
|
|
30
|
+
image: step.fromBlockchainLogo ?? '',
|
|
29
31
|
},
|
|
30
32
|
price: {
|
|
31
33
|
value: numberToString(
|
|
@@ -38,8 +40,9 @@ export const getSteps = ({ swap, ...args }: GetStep): Step[] => {
|
|
|
38
40
|
to: {
|
|
39
41
|
token: { displayName: step.toSymbol, image: step.toLogo },
|
|
40
42
|
chain: {
|
|
41
|
-
displayName:
|
|
42
|
-
|
|
43
|
+
displayName:
|
|
44
|
+
getBlockchainShortNameFor(step.toBlockchain, blockchains) ?? '',
|
|
45
|
+
image: step.toBlockchainLogo ?? '',
|
|
43
46
|
},
|
|
44
47
|
price: {
|
|
45
48
|
value: numberToString(
|
|
@@ -49,7 +52,7 @@ export const getSteps = ({ swap, ...args }: GetStep): Step[] => {
|
|
|
49
52
|
),
|
|
50
53
|
},
|
|
51
54
|
},
|
|
52
|
-
swapper: { displayName: step.swapperId, image: step.swapperLogo
|
|
55
|
+
swapper: { displayName: step.swapperId, image: step.swapperLogo ?? '' },
|
|
53
56
|
alerts: (
|
|
54
57
|
<SwapDetailsAlerts
|
|
55
58
|
step={step}
|
|
@@ -75,7 +75,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
75
75
|
'success' | 'failed' | null
|
|
76
76
|
>(null);
|
|
77
77
|
const {
|
|
78
|
-
meta: { tokens },
|
|
78
|
+
meta: { tokens, blockchains },
|
|
79
79
|
} = useMetaStore();
|
|
80
80
|
|
|
81
81
|
const onCancel = () => {
|
|
@@ -151,6 +151,7 @@ export function SwapDetails(props: SwapDetailsProps) {
|
|
|
151
151
|
showNetworkModal: currentStepNetworkStatus,
|
|
152
152
|
setNetworkModal: setModalState,
|
|
153
153
|
message: stepMessage,
|
|
154
|
+
blockchains,
|
|
154
155
|
});
|
|
155
156
|
const numberOfSteps = steps.length;
|
|
156
157
|
const [firstStep, lastStep] = [swap.steps[0], swap.steps[numberOfSteps - 1]];
|
|
@@ -2,6 +2,7 @@ import type { getSwapMessages } from '../../utils/swap';
|
|
|
2
2
|
import type { ModalState } from '../SwapDetailsModal';
|
|
3
3
|
import type { ConnectResult } from '@rango-dev/wallets-react';
|
|
4
4
|
import type {
|
|
5
|
+
BlockchainMeta,
|
|
5
6
|
PendingSwap,
|
|
6
7
|
PendingSwapNetworkStatus,
|
|
7
8
|
PendingSwapStep,
|
|
@@ -22,7 +23,7 @@ export interface FailedAlertsProps {
|
|
|
22
23
|
message: ReturnType<typeof getSwapMessages>;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
export type GetStep = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
>;
|
|
26
|
+
export type GetStep = {
|
|
27
|
+
swap: PendingSwap;
|
|
28
|
+
blockchains: BlockchainMeta[];
|
|
29
|
+
} & Omit<SwapAlertsProps, 'step' | 'hasAlreadyProceededToSign'>;
|
|
@@ -128,7 +128,7 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
128
128
|
const [showWallets, setShowWallets] = useState(false);
|
|
129
129
|
const setSelectedSwap = useUiStore.use.setSelectedSwap();
|
|
130
130
|
const {
|
|
131
|
-
meta: { tokens },
|
|
131
|
+
meta: { tokens, blockchains },
|
|
132
132
|
loadingStatus: loadingMetaStatus,
|
|
133
133
|
} = useMetaStore();
|
|
134
134
|
const slippage = useSettingsStore.use.slippage();
|
|
@@ -463,7 +463,7 @@ export function ConfirmSwapPage(props: PropTypes) {
|
|
|
463
463
|
<BestRoute
|
|
464
464
|
expanded={true}
|
|
465
465
|
tooltipContainer={getContainer()}
|
|
466
|
-
steps={formatBestRoute(bestRoute) ?? []}
|
|
466
|
+
steps={formatBestRoute(bestRoute, blockchains) ?? []}
|
|
467
467
|
input={{
|
|
468
468
|
value: numberToString(
|
|
469
469
|
inputAmount,
|
package/src/pages/Home.tsx
CHANGED
|
@@ -41,6 +41,7 @@ import { useUiStore } from '../store/ui';
|
|
|
41
41
|
import { useWalletsStore } from '../store/wallets';
|
|
42
42
|
import { ButtonState } from '../types';
|
|
43
43
|
import { getContainer } from '../utils/common';
|
|
44
|
+
import { getBlockchainShortNameFor } from '../utils/meta';
|
|
44
45
|
import {
|
|
45
46
|
numberToString,
|
|
46
47
|
secondsToString,
|
|
@@ -112,7 +113,7 @@ export function Home() {
|
|
|
112
113
|
} = useBestRouteStore();
|
|
113
114
|
|
|
114
115
|
const {
|
|
115
|
-
meta: { tokens },
|
|
116
|
+
meta: { tokens, blockchains },
|
|
116
117
|
loadingStatus: loadingMetaStatus,
|
|
117
118
|
} = useMetaStore();
|
|
118
119
|
|
|
@@ -210,7 +211,8 @@ export function Home() {
|
|
|
210
211
|
from: {
|
|
211
212
|
token: { displayName: swap.from.symbol, image: swap.from.logo },
|
|
212
213
|
chain: {
|
|
213
|
-
displayName:
|
|
214
|
+
displayName:
|
|
215
|
+
getBlockchainShortNameFor(swap.from.blockchain, blockchains) ?? '',
|
|
214
216
|
image: swap.from.blockchainLogo,
|
|
215
217
|
},
|
|
216
218
|
price: {
|
|
@@ -227,7 +229,8 @@ export function Home() {
|
|
|
227
229
|
to: {
|
|
228
230
|
token: { displayName: swap.to.symbol, image: swap.to.logo },
|
|
229
231
|
chain: {
|
|
230
|
-
displayName:
|
|
232
|
+
displayName:
|
|
233
|
+
getBlockchainShortNameFor(swap.to.blockchain, blockchains) ?? '',
|
|
231
234
|
image: swap.to.blockchainLogo,
|
|
232
235
|
},
|
|
233
236
|
price: {
|
|
@@ -28,7 +28,10 @@ import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
|
28
28
|
import { useMetaStore } from '../store/meta';
|
|
29
29
|
import { useSettingsStore } from '../store/settings';
|
|
30
30
|
import { containsText } from '../utils/numbers';
|
|
31
|
-
import {
|
|
31
|
+
import {
|
|
32
|
+
getUniqueSwappersGroups,
|
|
33
|
+
sortLiquiditySourcesByGroupTitle,
|
|
34
|
+
} from '../utils/settings';
|
|
32
35
|
|
|
33
36
|
interface PropTypes {
|
|
34
37
|
supportedSwappers?: string[];
|
|
@@ -76,20 +79,22 @@ export function LiquiditySourcePage({
|
|
|
76
79
|
});
|
|
77
80
|
};
|
|
78
81
|
|
|
79
|
-
const list = liquiditySources
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
<
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
const list = liquiditySources
|
|
83
|
+
.sort(sortLiquiditySourcesByGroupTitle)
|
|
84
|
+
.map((sourceItem) => {
|
|
85
|
+
const { selected, groupTitle, logo } = sourceItem;
|
|
86
|
+
return {
|
|
87
|
+
start: <Image src={logo} size={22} type="circular" />,
|
|
88
|
+
onClick: () => toggleLiquiditySource(groupTitle),
|
|
89
|
+
end: <Checkbox checked={selected} />,
|
|
90
|
+
title: (
|
|
91
|
+
<Typography variant="title" size="xmedium">
|
|
92
|
+
{i18n.t(groupTitle)}
|
|
93
|
+
</Typography>
|
|
94
|
+
),
|
|
95
|
+
...sourceItem,
|
|
96
|
+
};
|
|
97
|
+
});
|
|
93
98
|
|
|
94
99
|
const searchHandler = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
95
100
|
const value = event.target.value;
|
|
@@ -123,7 +128,7 @@ export function LiquiditySourcePage({
|
|
|
123
128
|
fullWidth
|
|
124
129
|
color="light"
|
|
125
130
|
variant="contained"
|
|
126
|
-
placeholder={i18n.t('
|
|
131
|
+
placeholder={i18n.t('Search {sourceType}', { sourceType })}
|
|
127
132
|
onChange={searchHandler}
|
|
128
133
|
/>
|
|
129
134
|
{loadingMetaStatus === 'loading' && <LoadingLiquiditySourceList />}
|
|
@@ -110,16 +110,18 @@ export function SettingsPage({ supportedSwappers, singleTheme }: PropTypes) {
|
|
|
110
110
|
onClick: () => navigate(navigationRoutes.exchanges),
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
113
|
+
/*
|
|
114
|
+
* const languageItem = {
|
|
115
|
+
* id: 'language-item',
|
|
116
|
+
* title: (
|
|
117
|
+
* <Typography variant="title" size="xmedium">
|
|
118
|
+
* {i18n.t('Language')}
|
|
119
|
+
* </Typography>
|
|
120
|
+
* ),
|
|
121
|
+
* end: <ChevronRightIcon color="gray" />,
|
|
122
|
+
* onClick: () => navigate(navigationRoutes.languages),
|
|
123
|
+
* };
|
|
124
|
+
*/
|
|
123
125
|
|
|
124
126
|
const themeItem = {
|
|
125
127
|
id: 'theme-item',
|
|
@@ -160,7 +162,11 @@ export function SettingsPage({ supportedSwappers, singleTheme }: PropTypes) {
|
|
|
160
162
|
onClick: toggleInfiniteApprove,
|
|
161
163
|
};
|
|
162
164
|
|
|
163
|
-
const settingItems = [
|
|
165
|
+
const settingItems = [
|
|
166
|
+
bridgeItem,
|
|
167
|
+
exchangeItem,
|
|
168
|
+
// languageItem
|
|
169
|
+
];
|
|
164
170
|
if (!singleTheme) {
|
|
165
171
|
settingItems.push(themeItem);
|
|
166
172
|
}
|
package/src/utils/meta.ts
CHANGED
|
@@ -7,3 +7,10 @@ export function getBlockchainDisplayNameFor(
|
|
|
7
7
|
return blockchains.find((blockchain) => blockchain.name === blockchainName)
|
|
8
8
|
?.displayName;
|
|
9
9
|
}
|
|
10
|
+
export function getBlockchainShortNameFor(
|
|
11
|
+
blockchainName: string,
|
|
12
|
+
blockchains: BlockchainMeta[]
|
|
13
|
+
): string | undefined {
|
|
14
|
+
return blockchains.find((blockchain) => blockchain.name === blockchainName)
|
|
15
|
+
?.shortName;
|
|
16
|
+
}
|
package/src/utils/settings.ts
CHANGED
|
@@ -55,3 +55,18 @@ export function getUniqueSwappersGroups(
|
|
|
55
55
|
|
|
56
56
|
return uniqueSupportedSwappersGroups;
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
export function sortLiquiditySourcesByGroupTitle(
|
|
60
|
+
a: UniqueSwappersGroupType,
|
|
61
|
+
b: UniqueSwappersGroupType
|
|
62
|
+
) {
|
|
63
|
+
if (a.groupTitle < b.groupTitle) {
|
|
64
|
+
return -1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (a.groupTitle > b.groupTitle) {
|
|
68
|
+
return 1;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return 0;
|
|
72
|
+
}
|