@rango-dev/widget-embedded 0.51.1-next.8 → 0.52.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/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/components/WalletStatefulConnect/Detached.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/Namespaces.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/components/WalletStatefulConnect/Detached.tsx +16 -4
- package/src/components/WalletStatefulConnect/Namespaces.tsx +16 -4
- 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.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.
|
|
28
|
+
"@rango-dev/provider-all": "^0.54.0",
|
|
29
|
+
"@rango-dev/queue-manager-core": "^0.33.0",
|
|
30
|
+
"@rango-dev/queue-manager-rango-preset": "^0.54.0",
|
|
31
|
+
"@rango-dev/queue-manager-react": "^0.33.0",
|
|
32
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.
|
|
33
|
+
"@rango-dev/ui": "^0.55.0",
|
|
34
|
+
"@rango-dev/wallets-core": "^0.51.0",
|
|
35
|
+
"@rango-dev/wallets-react": "^0.38.0",
|
|
36
|
+
"@rango-dev/wallets-shared": "^0.52.0",
|
|
37
37
|
"bignumber.js": "^9.1.1",
|
|
38
38
|
"copy-to-clipboard": "^3.3.3",
|
|
39
39
|
"dayjs": "^1.11.7",
|
|
@@ -54,4 +54,4 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
}
|
|
57
|
-
}
|
|
57
|
+
}
|
|
@@ -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') {
|
|
@@ -75,7 +75,10 @@ export function Detached(props: PropTypes) {
|
|
|
75
75
|
if (!!singleSelection) {
|
|
76
76
|
return (
|
|
77
77
|
<>
|
|
78
|
-
<Divider
|
|
78
|
+
<Divider
|
|
79
|
+
size={20}
|
|
80
|
+
className="_detached_namespace_list_header_alert_top_divider"
|
|
81
|
+
/>
|
|
79
82
|
<Alert
|
|
80
83
|
id="widget-wallet-stateful-connect-alert"
|
|
81
84
|
variant="alarm"
|
|
@@ -84,13 +87,19 @@ export function Detached(props: PropTypes) {
|
|
|
84
87
|
'This wallet can only connect to one chain at a time.'
|
|
85
88
|
)}
|
|
86
89
|
/>
|
|
87
|
-
<Divider
|
|
90
|
+
<Divider
|
|
91
|
+
size={30}
|
|
92
|
+
className="_detached_namespace_list_header_alert_bottom_divider"
|
|
93
|
+
/>
|
|
88
94
|
</>
|
|
89
95
|
);
|
|
90
96
|
}
|
|
91
97
|
return (
|
|
92
98
|
<>
|
|
93
|
-
<Divider
|
|
99
|
+
<Divider
|
|
100
|
+
size={30}
|
|
101
|
+
className="_detached_namespace_list_header_button_top_divider"
|
|
102
|
+
/>
|
|
94
103
|
<NamespacesHeader>
|
|
95
104
|
<Button
|
|
96
105
|
id="widget-detached-disconnect-wallet-btn"
|
|
@@ -102,7 +111,10 @@ export function Detached(props: PropTypes) {
|
|
|
102
111
|
{i18n.t('Disconnect wallet')}
|
|
103
112
|
</Button>
|
|
104
113
|
</NamespacesHeader>
|
|
105
|
-
<Divider
|
|
114
|
+
<Divider
|
|
115
|
+
size={16}
|
|
116
|
+
className="_detached_namespace_list_header_button_bottom_divider"
|
|
117
|
+
/>
|
|
106
118
|
</>
|
|
107
119
|
);
|
|
108
120
|
};
|
|
@@ -120,7 +120,10 @@ export function Namespaces(props: PropTypes) {
|
|
|
120
120
|
/>
|
|
121
121
|
{singleNamespace ? (
|
|
122
122
|
<>
|
|
123
|
-
<Divider
|
|
123
|
+
<Divider
|
|
124
|
+
size={20}
|
|
125
|
+
className="_initial_namespace_list_header_alert_top_divider"
|
|
126
|
+
/>
|
|
124
127
|
<Alert
|
|
125
128
|
id="widget-wallet-stateful-connect-alert"
|
|
126
129
|
variant="alarm"
|
|
@@ -129,11 +132,17 @@ export function Namespaces(props: PropTypes) {
|
|
|
129
132
|
'This wallet can only connect to one chain at a time. '
|
|
130
133
|
)}
|
|
131
134
|
/>
|
|
132
|
-
<Divider
|
|
135
|
+
<Divider
|
|
136
|
+
size={30}
|
|
137
|
+
className="_initial_namespace_list_header_alert_bottom_divider"
|
|
138
|
+
/>
|
|
133
139
|
</>
|
|
134
140
|
) : (
|
|
135
141
|
<>
|
|
136
|
-
<Divider
|
|
142
|
+
<Divider
|
|
143
|
+
size={30}
|
|
144
|
+
className="_initial_namespace_list_header_button_top_divider"
|
|
145
|
+
/>
|
|
137
146
|
<Button
|
|
138
147
|
style={{ marginLeft: 'auto' }}
|
|
139
148
|
id="widget-name-space-select-all-btn"
|
|
@@ -145,7 +154,10 @@ export function Namespaces(props: PropTypes) {
|
|
|
145
154
|
? i18n.t('Deselect all')
|
|
146
155
|
: i18n.t('Select all')}
|
|
147
156
|
</Button>
|
|
148
|
-
<Divider
|
|
157
|
+
<Divider
|
|
158
|
+
size={10}
|
|
159
|
+
className="_initial_namespace_list_header_button_bottom_divider"
|
|
160
|
+
/>
|
|
149
161
|
</>
|
|
150
162
|
)}
|
|
151
163
|
<NamespaceList>
|
|
@@ -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
|
+
}
|