@rango-dev/widget-embedded 0.51.1-next.9 → 0.52.1-next.0
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/CHANGELOG.md +22 -0
- package/dist/components/HistoryGroupedList/HistoryGroupedList.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/pages/HistoryPage.d.ts.map +1 -1
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
- package/dist/store/slices/data.d.ts.map +1 -1
- package/dist/utils/common.d.ts +2 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +10 -10
- package/src/components/HistoryGroupedList/HistoryGroupedList.tsx +5 -0
- package/src/components/TokenList/TokenList.styles.ts +4 -0
- package/src/components/TokenList/TokenList.tsx +5 -0
- package/src/pages/HistoryPage.tsx +3 -0
- package/src/pages/SelectBlockchainPage.tsx +14 -5
- package/src/store/slices/data.ts +2 -13
- package/src/utils/common.ts +16 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.1-next.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"@lingui/core": "4.2.1",
|
|
26
26
|
"@lingui/react": "4.2.1",
|
|
27
27
|
"@rango-dev/logging-core": "^0.11.0",
|
|
28
|
-
"@rango-dev/provider-all": "^0.
|
|
29
|
-
"@rango-dev/queue-manager-core": "^0.
|
|
30
|
-
"@rango-dev/queue-manager-rango-preset": "^0.
|
|
31
|
-
"@rango-dev/queue-manager-react": "^0.
|
|
32
|
-
"@rango-dev/signer-solana": "^0.44.0",
|
|
33
|
-
"@rango-dev/ui": "^0.
|
|
34
|
-
"@rango-dev/wallets-core": "^0.
|
|
35
|
-
"@rango-dev/wallets-react": "^0.
|
|
36
|
-
"@rango-dev/wallets-shared": "^0.
|
|
28
|
+
"@rango-dev/provider-all": "^0.54.1-next.0",
|
|
29
|
+
"@rango-dev/queue-manager-core": "^0.33.0",
|
|
30
|
+
"@rango-dev/queue-manager-rango-preset": "^0.54.1-next.0",
|
|
31
|
+
"@rango-dev/queue-manager-react": "^0.33.0",
|
|
32
|
+
"@rango-dev/signer-solana": "^0.44.1-next.0",
|
|
33
|
+
"@rango-dev/ui": "^0.55.1-next.0",
|
|
34
|
+
"@rango-dev/wallets-core": "^0.51.1-next.0",
|
|
35
|
+
"@rango-dev/wallets-react": "^0.38.1-next.0",
|
|
36
|
+
"@rango-dev/wallets-shared": "^0.52.1-next.0",
|
|
37
37
|
"bignumber.js": "^9.1.1",
|
|
38
38
|
"copy-to-clipboard": "^3.3.3",
|
|
39
39
|
"dayjs": "^1.11.7",
|
|
@@ -81,6 +81,11 @@ export function HistoryGroupedList(props: PropTypes) {
|
|
|
81
81
|
|
|
82
82
|
return (
|
|
83
83
|
<GroupedVirtualizedList
|
|
84
|
+
style={{
|
|
85
|
+
// See note on https://github.com/rango-exchange/rango-client/pull/1284
|
|
86
|
+
flexGrow: 1,
|
|
87
|
+
minHeight: 0,
|
|
88
|
+
}}
|
|
84
89
|
endReached={() => {
|
|
85
90
|
if (loadedItems.current < list.length) {
|
|
86
91
|
loadMore();
|
|
@@ -69,8 +69,12 @@ export const Title = styled('div', {
|
|
|
69
69
|
});
|
|
70
70
|
export const List = styled('ul', {
|
|
71
71
|
flexGrow: 1,
|
|
72
|
+
height: '100%',
|
|
72
73
|
padding: 0,
|
|
73
74
|
margin: 0,
|
|
75
|
+
// See note on https://github.com/rango-exchange/rango-client/pull/1284
|
|
76
|
+
display: 'flex',
|
|
77
|
+
flexDirection: 'column',
|
|
74
78
|
listStyle: 'none',
|
|
75
79
|
|
|
76
80
|
'& li': {
|
|
@@ -195,6 +195,11 @@ export function TokenList(props: PropTypes) {
|
|
|
195
195
|
const renderList = () => {
|
|
196
196
|
return (
|
|
197
197
|
<VirtualizedList
|
|
198
|
+
style={{
|
|
199
|
+
// See note on https://github.com/rango-exchange/rango-client/pull/1284
|
|
200
|
+
flexGrow: 1,
|
|
201
|
+
minHeight: 0,
|
|
202
|
+
}}
|
|
198
203
|
itemContent={(index) => {
|
|
199
204
|
const token = tokens[index];
|
|
200
205
|
if (token === 'skeleton') {
|
|
@@ -40,6 +40,9 @@ const HistoryGroupedListContainer = styled('div', {
|
|
|
40
40
|
flexDirection: 'column',
|
|
41
41
|
gap: 15,
|
|
42
42
|
height: '100%',
|
|
43
|
+
// See note on https://github.com/rango-exchange/rango-client/pull/1284
|
|
44
|
+
minHeight: 0,
|
|
45
|
+
flexGrow: 1,
|
|
43
46
|
});
|
|
44
47
|
|
|
45
48
|
const SearchAndFilterBar = styled('div', {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getCategoriesCount,
|
|
7
7
|
SelectableCategoryList,
|
|
8
8
|
} from '@rango-dev/ui';
|
|
9
|
-
import React, { useState } from 'react';
|
|
9
|
+
import React, { useMemo, useState } from 'react';
|
|
10
10
|
import { useNavigate } from 'react-router-dom';
|
|
11
11
|
|
|
12
12
|
import { BlockchainList } from '../components/BlockchainList';
|
|
@@ -16,6 +16,7 @@ import { useNavigateBack } from '../hooks/useNavigateBack';
|
|
|
16
16
|
import { useSwapMode } from '../hooks/useSwapMode';
|
|
17
17
|
import { useAppStore } from '../store/AppStore';
|
|
18
18
|
import { useQuoteStore } from '../store/quote';
|
|
19
|
+
import { filterBlockchainsWithAtLeastOneToken } from '../utils/common';
|
|
19
20
|
|
|
20
21
|
interface PropTypes {
|
|
21
22
|
type: 'source' | 'destination' | 'custom-token';
|
|
@@ -37,7 +38,12 @@ export function SelectBlockchainPage(props: PropTypes) {
|
|
|
37
38
|
const blockchains = useAppStore().blockchains({
|
|
38
39
|
type,
|
|
39
40
|
});
|
|
40
|
-
const
|
|
41
|
+
const tokens = useAppStore().tokens();
|
|
42
|
+
const filteredBlockchains = useMemo(
|
|
43
|
+
() => filterBlockchainsWithAtLeastOneToken(blockchains, tokens),
|
|
44
|
+
[blockchains.length, tokens.length]
|
|
45
|
+
);
|
|
46
|
+
const activeCategoriesCount = getCategoriesCount(filteredBlockchains);
|
|
41
47
|
|
|
42
48
|
const showCategory = !props.hideCategory && activeCategoriesCount !== 1;
|
|
43
49
|
|
|
@@ -53,7 +59,10 @@ export function SelectBlockchainPage(props: PropTypes) {
|
|
|
53
59
|
} else {
|
|
54
60
|
const blockchainNativeToken = findNativeToken(blockchain);
|
|
55
61
|
if (blockchainNativeToken) {
|
|
56
|
-
setToToken({
|
|
62
|
+
setToToken({
|
|
63
|
+
token: blockchainNativeToken,
|
|
64
|
+
meta: { blockchains },
|
|
65
|
+
});
|
|
57
66
|
}
|
|
58
67
|
}
|
|
59
68
|
}
|
|
@@ -72,7 +81,7 @@ export function SelectBlockchainPage(props: PropTypes) {
|
|
|
72
81
|
<SelectableCategoryList
|
|
73
82
|
setCategory={setBlockchainCategory}
|
|
74
83
|
category={blockchainCategory}
|
|
75
|
-
blockchains={
|
|
84
|
+
blockchains={filteredBlockchains}
|
|
76
85
|
isLoading={fetchStatus === 'loading'}
|
|
77
86
|
/>
|
|
78
87
|
<Divider size={24} />
|
|
@@ -93,7 +102,7 @@ export function SelectBlockchainPage(props: PropTypes) {
|
|
|
93
102
|
<Divider size={16} />
|
|
94
103
|
|
|
95
104
|
<BlockchainList
|
|
96
|
-
list={
|
|
105
|
+
list={filteredBlockchains}
|
|
97
106
|
showTitle={type !== 'custom-token'}
|
|
98
107
|
searchedFor={searchedFor}
|
|
99
108
|
blockchainCategory={blockchainCategory}
|
package/src/store/slices/data.ts
CHANGED
|
@@ -355,33 +355,22 @@ export const createDataSlice: StateCreator<
|
|
|
355
355
|
>();
|
|
356
356
|
const tokensMapByBlockchainName: DataSlice['_tokensMapByBlockchainName'] =
|
|
357
357
|
{};
|
|
358
|
-
const tokens: Token[] = [];
|
|
359
358
|
const popularTokens: Token[] = response.popularTokens;
|
|
360
359
|
const swappers: SwapperMeta[] = response.swappers.filter(
|
|
361
360
|
(swapper) => swapper.enabled
|
|
362
361
|
);
|
|
363
|
-
const blockchainsWithAtLeastOneToken = new Set();
|
|
364
|
-
|
|
365
|
-
response.tokens.forEach((token) => {
|
|
366
|
-
blockchainsWithAtLeastOneToken.add(token.blockchain);
|
|
367
|
-
|
|
368
|
-
tokens.push(token);
|
|
369
|
-
});
|
|
370
362
|
|
|
371
363
|
const sortedBlockchain = response.blockchains.sort(
|
|
372
364
|
(a, b) => a.sort - b.sort
|
|
373
365
|
);
|
|
374
366
|
|
|
375
367
|
sortedBlockchain.forEach((blockchain) => {
|
|
376
|
-
if (
|
|
377
|
-
blockchain.enabled &&
|
|
378
|
-
blockchainsWithAtLeastOneToken.has(blockchain.name)
|
|
379
|
-
) {
|
|
368
|
+
if (blockchain.enabled) {
|
|
380
369
|
blockchainsMapByName.set(blockchain.name, blockchain);
|
|
381
370
|
}
|
|
382
371
|
});
|
|
383
372
|
|
|
384
|
-
tokens.forEach((token) => {
|
|
373
|
+
response.tokens.forEach((token) => {
|
|
385
374
|
const tokenHash = createTokenHash(token);
|
|
386
375
|
if (!tokensMapByBlockchainName[token.blockchain]) {
|
|
387
376
|
tokensMapByBlockchainName[token.blockchain] = [];
|
package/src/utils/common.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { WalletInfoWithExtra } from '../types';
|
|
2
|
-
import type { Token } from 'rango-sdk';
|
|
2
|
+
import type { BlockchainMeta, Token } from 'rango-sdk';
|
|
3
3
|
|
|
4
4
|
import { BlockchainCategories, WalletState } from '@rango-dev/ui';
|
|
5
5
|
import { TransactionType } from 'rango-sdk';
|
|
@@ -280,3 +280,18 @@ export function memoizedResult(): <R>(fn: () => R, key: number | string) => R {
|
|
|
280
280
|
return result;
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
|
+
|
|
284
|
+
export function filterBlockchainsWithAtLeastOneToken(
|
|
285
|
+
blockchains: BlockchainMeta[],
|
|
286
|
+
tokens: Token[]
|
|
287
|
+
) {
|
|
288
|
+
const blockchainsWithAtLeastOneToken = new Set<string>();
|
|
289
|
+
|
|
290
|
+
tokens.forEach((token) => {
|
|
291
|
+
blockchainsWithAtLeastOneToken.add(token.blockchain);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
return blockchains.filter((blockchain) =>
|
|
295
|
+
blockchainsWithAtLeastOneToken.has(blockchain.name)
|
|
296
|
+
);
|
|
297
|
+
}
|