@rango-dev/widget-embedded 0.0.0-experimental-e022ed95-20260421 → 0.0.0-experimental-82bcc5d9-20260608
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 +34 -0
- package/dist/components/AppRoutes.d.ts +1 -2
- package/dist/components/AppRoutes.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/CustomDestination/CustomDestination.styles.d.ts +4 -4
- package/dist/components/CustomDestination/CustomDestination.styles.d.ts.map +1 -1
- package/dist/components/CustomTokenModal/CustomTokenModal.d.ts.map +1 -1
- package/dist/components/CustomTokenModal/CustomTokenModal.styles.d.ts +169 -169
- package/dist/components/CustomTokenModal/CustomTokenModal.styles.d.ts.map +1 -1
- package/dist/components/FilterSelector/FilterSelector.style.d.ts +1 -1
- package/dist/components/FilterSelector/FilterSelector.style.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +1 -1
- package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
- package/dist/components/NamespaceItem/NamespaceItem.styles.d.ts +1 -1
- package/dist/components/NamespaceItem/NamespaceItem.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.styles.d.ts +171 -171
- package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts +169 -169
- package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
- package/dist/components/RefreshModal/RefreshModal.styles.d.ts +168 -168
- package/dist/components/RefreshModal/RefreshModal.styles.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts +1 -1
- package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
- package/dist/components/SwapMetrics/SwapMetrics.styles.d.ts +1 -1
- package/dist/components/SwapMetrics/SwapMetrics.styles.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.styles.d.ts +2 -2
- package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/DerivationPath.helpers.d.ts +1 -1
- package/dist/components/WalletStatefulConnect/DerivationPath.helpers.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/DerivationPath.styles.d.ts +169 -169
- package/dist/components/WalletStatefulConnect/DerivationPath.styles.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/Detached.types.d.ts +1 -1
- package/dist/components/WalletStatefulConnect/Detached.types.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/Namespaces.styles.d.ts +168 -168
- package/dist/components/WalletStatefulConnect/Namespaces.styles.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/Namespaces.types.d.ts +2 -2
- package/dist/components/WalletStatefulConnect/Namespaces.types.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/index.d.ts +0 -1
- package/dist/components/WalletStatefulConnect/index.d.ts.map +1 -1
- package/dist/constants/index.d.ts +0 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/wallets.d.ts +1 -2
- package/dist/constants/wallets.d.ts.map +1 -1
- package/dist/containers/Inputs/Inputs.d.ts.map +1 -1
- package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts.map +1 -1
- package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.d.ts +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.d.ts.map +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.state.d.ts +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.state.d.ts.map +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.types.d.ts +1 -1
- package/dist/hooks/useStatefulConnect/useStatefulConnect.types.d.ts.map +1 -1
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/hooks/useWalletProviders/useWalletProviders.d.ts +1 -1
- package/dist/hooks/useWalletProviders/useWalletProviders.helpers.d.ts +1 -1
- package/dist/hooks/useWalletProviders/useWalletProviders.helpers.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/store/quote.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts +1 -1
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/slices/wallets.d.ts +1 -1
- package/dist/store/slices/wallets.d.ts.map +1 -1
- package/dist/store/utils/wallets.d.ts +3 -3
- package/dist/store/utils/wallets.d.ts.map +1 -1
- package/dist/test-utils/fixtures.d.ts.map +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/env.d.ts +12 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/meta.d.ts +4 -0
- package/dist/utils/meta.d.ts.map +1 -1
- package/dist/utils/numbers.d.ts.map +1 -1
- package/dist/utils/providers.d.ts +2 -1
- package/dist/utils/providers.d.ts.map +1 -1
- package/dist/utils/sanitizers.d.ts +15 -0
- package/dist/utils/sanitizers.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +0 -2
- package/dist/utils/wallets.d.ts.map +1 -1
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +22 -10
- package/src/components/ConfirmWalletsModal/WalletList.tsx +16 -166
- package/src/components/CustomTokenModal/CustomTokenModal.tsx +7 -2
- package/src/components/StatefulConnectModal/StatefulConnectModal.tsx +1 -1
- package/src/components/TokenList/TokenList.tsx +11 -8
- package/src/components/WalletStatefulConnect/DerivationPath.helpers.ts +1 -1
- package/src/components/WalletStatefulConnect/Detached.tsx +1 -1
- package/src/components/WalletStatefulConnect/Detached.types.ts +1 -1
- package/src/components/WalletStatefulConnect/Namespaces.tsx +1 -1
- package/src/components/WalletStatefulConnect/Namespaces.types.tsx +2 -2
- package/src/components/WalletStatefulConnect/index.ts +0 -1
- package/src/constants/index.ts +0 -1
- package/src/constants/wallets.ts +1 -3
- package/src/containers/Inputs/Inputs.tsx +2 -7
- package/src/containers/Wallets/Wallets.tsx +6 -0
- package/src/containers/WidgetProvider/WidgetProvider.tsx +3 -2
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +45 -3262
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +26 -228
- package/src/hooks/useStatefulConnect/useStatefulConnect.state.ts +1 -1
- package/src/hooks/useStatefulConnect/useStatefulConnect.ts +1 -1
- package/src/hooks/useStatefulConnect/useStatefulConnect.types.ts +1 -1
- package/src/hooks/useWalletList.ts +6 -29
- package/src/hooks/useWalletProviders/useWalletProviders.helpers.ts +1 -1
- package/src/store/quote.ts +2 -1
- package/src/store/slices/config.ts +2 -2
- package/src/store/slices/data.test.ts +1 -1
- package/src/store/slices/wallets.ts +25 -12
- package/src/store/utils/wallets.ts +5 -5
- package/src/test-utils/fixtures.ts +1 -39
- package/src/types/config.ts +1 -1
- package/src/utils/common.ts +0 -1
- package/src/utils/configs.ts +2 -3
- package/src/utils/env.ts +28 -0
- package/src/utils/meta.ts +13 -0
- package/src/utils/numbers.ts +4 -0
- package/src/utils/providers.ts +2 -2
- package/src/utils/sanitizers.test.ts +43 -0
- package/src/utils/sanitizers.ts +26 -0
- package/src/utils/wallets.ts +0 -32
- package/dist/components/CustomTokenModal/CustomTokenModal.helpers.d.ts +0 -3
- package/dist/components/CustomTokenModal/CustomTokenModal.helpers.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/ExperimentalChain.d.ts +0 -9
- package/dist/components/WalletStatefulConnect/ExperimentalChain.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.d.ts +0 -4
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.helpers.d.ts +0 -8
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.helpers.d.ts.map +0 -1
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.types.d.ts +0 -6
- package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.types.d.ts.map +0 -1
- package/src/components/CustomTokenModal/CustomTokenModal.helpers.ts +0 -19
- package/src/components/WalletStatefulConnect/ExperimentalChain.tsx +0 -39
- package/src/components/WalletStatefulConnect/ExperimentalChainStatus.helpers.ts +0 -53
- package/src/components/WalletStatefulConnect/ExperimentalChainStatus.tsx +0 -36
- package/src/components/WalletStatefulConnect/ExperimentalChainStatus.types.ts +0 -5
|
@@ -30,69 +30,20 @@ describe('usePrepareBlockchainList', () => {
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
it('should sort blockchains by user preferences', () => {
|
|
33
|
-
const preferredBlockchains = ['
|
|
33
|
+
const preferredBlockchains = ['LINEA', 'BASE'];
|
|
34
34
|
const sortedBlockchainsList = sample.sort(
|
|
35
35
|
generateSortByPreferredBlockchainsFor(preferredBlockchains)
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
const expected = [
|
|
39
|
-
'UMEE',
|
|
40
|
-
'BANDCHAIN',
|
|
41
39
|
'LINEA',
|
|
40
|
+
'BASE',
|
|
42
41
|
'ETH',
|
|
43
42
|
'BSC',
|
|
44
43
|
'ARBITRUM',
|
|
45
44
|
'POLYGON',
|
|
46
|
-
'ZKSYNC',
|
|
47
|
-
'STARKNET',
|
|
48
45
|
'OPTIMISM',
|
|
49
|
-
'
|
|
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',
|
|
46
|
+
'SCROLL',
|
|
96
47
|
];
|
|
97
48
|
const received = sortedBlockchainsList.map((blockchain) => blockchain.name);
|
|
98
49
|
|
|
@@ -100,66 +51,17 @@ describe('usePrepareBlockchainList', () => {
|
|
|
100
51
|
});
|
|
101
52
|
|
|
102
53
|
it('should prepare the list by most used and user preferences', () => {
|
|
103
|
-
const listLimit =
|
|
104
|
-
const preferredBlockchains = ['
|
|
54
|
+
const listLimit = 4;
|
|
55
|
+
const preferredBlockchains = ['LINEA', 'SCROLL'];
|
|
105
56
|
const expected = [
|
|
106
|
-
'
|
|
107
|
-
'
|
|
57
|
+
'LINEA',
|
|
58
|
+
'SCROLL',
|
|
108
59
|
'ETH',
|
|
109
|
-
'COSMOS',
|
|
110
|
-
'OSMOSIS',
|
|
111
60
|
'BSC',
|
|
112
61
|
'ARBITRUM',
|
|
113
62
|
'POLYGON',
|
|
114
|
-
'ZKSYNC',
|
|
115
|
-
'STARKNET',
|
|
116
63
|
'OPTIMISM',
|
|
117
|
-
'
|
|
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',
|
|
64
|
+
'BASE',
|
|
163
65
|
];
|
|
164
66
|
const received = prepare(sample, preferredBlockchains, {
|
|
165
67
|
limit: listLimit,
|
|
@@ -181,85 +83,30 @@ describe('usePrepareBlockchainList', () => {
|
|
|
181
83
|
expect(receivedMoreNames).not.toContain(listName);
|
|
182
84
|
});
|
|
183
85
|
|
|
184
|
-
// Check preferred blockchains
|
|
86
|
+
// Check preferred blockchains end up in the main list
|
|
185
87
|
preferredBlockchains.forEach((blockchain) => {
|
|
186
88
|
expect(receivedListNames).toContain(blockchain);
|
|
187
89
|
});
|
|
188
90
|
});
|
|
189
91
|
|
|
190
|
-
it('should prepare the list correctly if user has a long list of preferences
|
|
191
|
-
const listLimit =
|
|
92
|
+
it('should prepare the list correctly if user has a long list of preferences', () => {
|
|
93
|
+
const listLimit = 4;
|
|
192
94
|
const preferredBlockchains = [
|
|
193
|
-
'
|
|
194
|
-
'
|
|
195
|
-
'
|
|
196
|
-
'
|
|
197
|
-
'
|
|
198
|
-
'BOBA_AVALANCHE',
|
|
199
|
-
'AKASH',
|
|
200
|
-
'LUMNETWORK',
|
|
201
|
-
'KONSTELLATION',
|
|
202
|
-
'BANDCHAIN',
|
|
203
|
-
'INJECTIVE',
|
|
95
|
+
'LINEA',
|
|
96
|
+
'SCROLL',
|
|
97
|
+
'BASE',
|
|
98
|
+
'OPTIMISM',
|
|
99
|
+
'POLYGON',
|
|
204
100
|
];
|
|
205
101
|
const expected = [
|
|
102
|
+
'LINEA',
|
|
103
|
+
'SCROLL',
|
|
104
|
+
'BASE',
|
|
105
|
+
'OPTIMISM',
|
|
106
|
+
'POLYGON',
|
|
206
107
|
'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
108
|
'BSC',
|
|
220
109
|
'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
110
|
];
|
|
264
111
|
const received = prepare(sample, preferredBlockchains, {
|
|
265
112
|
limit: listLimit,
|
|
@@ -272,66 +119,17 @@ describe('usePrepareBlockchainList', () => {
|
|
|
272
119
|
});
|
|
273
120
|
|
|
274
121
|
it('Last item of the main list should be moved to front if it selected again.', () => {
|
|
275
|
-
const listLimit =
|
|
276
|
-
const preferredBlockchains = ['
|
|
122
|
+
const listLimit = 4;
|
|
123
|
+
const preferredBlockchains = ['POLYGON', 'BASE'];
|
|
277
124
|
const expected = [
|
|
278
|
-
'
|
|
279
|
-
'
|
|
125
|
+
'POLYGON',
|
|
126
|
+
'BASE',
|
|
280
127
|
'ETH',
|
|
281
|
-
'COSMOS',
|
|
282
|
-
'OSMOSIS',
|
|
283
128
|
'BSC',
|
|
284
129
|
'ARBITRUM',
|
|
285
|
-
'POLYGON',
|
|
286
|
-
'ZKSYNC',
|
|
287
|
-
'STARKNET',
|
|
288
130
|
'OPTIMISM',
|
|
289
|
-
'POLYGONZK',
|
|
290
131
|
'LINEA',
|
|
291
|
-
'
|
|
292
|
-
'NEUTRON',
|
|
293
|
-
'NOBLE',
|
|
294
|
-
'SOLANA',
|
|
295
|
-
'CRONOS',
|
|
296
|
-
'BNB',
|
|
297
|
-
'AURORA',
|
|
298
|
-
'MAYA',
|
|
299
|
-
'THOR',
|
|
300
|
-
'BOBA',
|
|
301
|
-
'MOONBEAM',
|
|
302
|
-
'MOONRIVER',
|
|
303
|
-
'OKC',
|
|
304
|
-
'BOBA_AVALANCHE',
|
|
305
|
-
'LTC',
|
|
306
|
-
'BCH',
|
|
307
|
-
'HECO',
|
|
308
|
-
'STARGAZE',
|
|
309
|
-
'CRYPTO_ORG',
|
|
310
|
-
'CHIHUAHUA',
|
|
311
|
-
'BANDCHAIN',
|
|
312
|
-
'COMDEX',
|
|
313
|
-
'REGEN',
|
|
314
|
-
'IRIS',
|
|
315
|
-
'EMONEY',
|
|
316
|
-
'JUNO',
|
|
317
|
-
'STRIDE',
|
|
318
|
-
'MARS',
|
|
319
|
-
'TERRA',
|
|
320
|
-
'BITSONG',
|
|
321
|
-
'AKASH',
|
|
322
|
-
'KI',
|
|
323
|
-
'PERSISTENCE',
|
|
324
|
-
'MEDIBLOC',
|
|
325
|
-
'KUJIRA',
|
|
326
|
-
'SENTINEL',
|
|
327
|
-
'INJECTIVE',
|
|
328
|
-
'SECRET',
|
|
329
|
-
'KONSTELLATION',
|
|
330
|
-
'STARNAME',
|
|
331
|
-
'BITCANNA',
|
|
332
|
-
'UMEE',
|
|
333
|
-
'DESMOS',
|
|
334
|
-
'LUMNETWORK',
|
|
132
|
+
'SCROLL',
|
|
335
133
|
];
|
|
336
134
|
|
|
337
135
|
const output = prepare(sample, preferredBlockchains, {
|
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
NeedsDerivationPathState,
|
|
4
4
|
NeedsNamespacesState,
|
|
5
5
|
} from './useStatefulConnect.types';
|
|
6
|
-
import type { Namespace } from '@
|
|
6
|
+
import type { Namespace } from '@hub3js/namespaces';
|
|
7
7
|
|
|
8
8
|
export interface State {
|
|
9
9
|
status: 'init' | 'namespace' | 'derivationPath' | 'detached';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HandleConnectOptions, Result } from './useStatefulConnect.types';
|
|
2
2
|
import type { WalletInfoWithExtra } from '../../types';
|
|
3
|
-
import type { Namespace } from '@
|
|
3
|
+
import type { Namespace } from '@hub3js/namespaces';
|
|
4
4
|
import type { NamespaceData } from '@rango-dev/wallets-shared';
|
|
5
5
|
|
|
6
6
|
import { WalletState } from '@rango-dev/ui';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtendedModalWalletInfo } from '../../utils/wallets';
|
|
2
|
-
import type { Namespace } from '@
|
|
2
|
+
import type { Namespace } from '@hub3js/namespaces';
|
|
3
3
|
|
|
4
4
|
export interface HandleConnectOptions {
|
|
5
5
|
// To have a switch between connect and disconnect when user is clicking on a button, this option can be helpful.
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import type { ExtendedModalWalletInfo } from '../utils/wallets';
|
|
2
2
|
import type { WalletInfo } from '@rango-dev/ui';
|
|
3
|
-
import type { BlockchainMeta } from 'rango-sdk';
|
|
4
3
|
|
|
5
4
|
import { WalletState } from '@rango-dev/ui';
|
|
6
5
|
import { useWallets } from '@rango-dev/wallets-react';
|
|
7
|
-
import {
|
|
8
|
-
detectMobileScreens,
|
|
9
|
-
KEPLR_COMPATIBLE_WALLETS,
|
|
10
|
-
WalletTypes,
|
|
11
|
-
} from '@rango-dev/wallets-shared';
|
|
6
|
+
import { detectMobileScreens, WalletTypes } from '@rango-dev/wallets-shared';
|
|
12
7
|
import { useCallback, useEffect } from 'react';
|
|
13
8
|
|
|
14
9
|
import { useAppStore } from '../store/AppStore';
|
|
15
10
|
import { configWalletsToWalletName } from '../utils/providers';
|
|
16
11
|
import {
|
|
17
12
|
hashWalletsState,
|
|
18
|
-
isExperimentalChain,
|
|
19
13
|
mapWalletTypesToWalletInfo,
|
|
20
14
|
sortWalletsBasedOnConnectionState,
|
|
21
15
|
} from '../utils/wallets';
|
|
@@ -40,9 +34,8 @@ interface API {
|
|
|
40
34
|
*/
|
|
41
35
|
export function useWalletList(params?: Params): API {
|
|
42
36
|
const { chain } = params || {};
|
|
43
|
-
const {
|
|
37
|
+
const { getAvailableProviders } = useAppStore();
|
|
44
38
|
const { state, getWalletInfo } = useWallets();
|
|
45
|
-
const blockchains = useAppStore().blockchains();
|
|
46
39
|
const { handleDisconnect } = useStatefulConnect();
|
|
47
40
|
|
|
48
41
|
/** It can be what has been set by widget config or as a fallback we use all the supported wallets by our library */
|
|
@@ -66,13 +59,6 @@ export function useWalletList(params?: Params): API {
|
|
|
66
59
|
|
|
67
60
|
const sortedWallets = sortWalletsBasedOnConnectionState(wallets);
|
|
68
61
|
|
|
69
|
-
const isExperimentalChainNotAdded = (walletType: string) =>
|
|
70
|
-
!connectedWallets.find(
|
|
71
|
-
(connectedWallet) =>
|
|
72
|
-
connectedWallet.walletType === walletType &&
|
|
73
|
-
connectedWallet.chain === chain
|
|
74
|
-
);
|
|
75
|
-
|
|
76
62
|
const terminateConnectingWallets = useCallback(() => {
|
|
77
63
|
const connectingWallets =
|
|
78
64
|
wallets?.filter((wallet) => wallet.state === WalletState.CONNECTING) ||
|
|
@@ -121,24 +107,15 @@ export function useWalletList(params?: Params): API {
|
|
|
121
107
|
return isEvmWalletInstalledExceptDefault.length == 0;
|
|
122
108
|
};
|
|
123
109
|
|
|
124
|
-
const shouldExcludeWallet = (
|
|
125
|
-
walletType: string,
|
|
126
|
-
chain: string,
|
|
127
|
-
blockchains: BlockchainMeta[]
|
|
128
|
-
) => {
|
|
110
|
+
const shouldExcludeWallet = (walletType: string) => {
|
|
129
111
|
return (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
!KEPLR_COMPATIBLE_WALLETS.includes(walletType)) ||
|
|
133
|
-
(walletType == WalletTypes.DEFAULT &&
|
|
134
|
-
!shouldShowDefaultInjectedWallet(wallets))
|
|
112
|
+
walletType == WalletTypes.DEFAULT &&
|
|
113
|
+
!shouldShowDefaultInjectedWallet(wallets)
|
|
135
114
|
);
|
|
136
115
|
};
|
|
137
116
|
|
|
138
117
|
return {
|
|
139
|
-
list: sortedWallets.filter(
|
|
140
|
-
(wallet) => !shouldExcludeWallet(wallet.type, chain ?? '', blockchains)
|
|
141
|
-
),
|
|
118
|
+
list: sortedWallets.filter((wallet) => !shouldExcludeWallet(wallet.type)),
|
|
142
119
|
terminateConnectingWallets,
|
|
143
120
|
};
|
|
144
121
|
}
|
package/src/store/quote.ts
CHANGED
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
import { isPositiveNumber, sanitizeInputAmount } from '../utils/numbers';
|
|
27
27
|
import {
|
|
28
28
|
ensureLeadingZeroForDecimal,
|
|
29
|
+
parseNumericValue,
|
|
29
30
|
removeLeadingZeros,
|
|
30
31
|
} from '../utils/sanitizers';
|
|
31
32
|
import { getUsdInputFrom, getUsdOutputFrom } from '../utils/swap';
|
|
@@ -249,7 +250,7 @@ const initializer: StateCreator<
|
|
|
249
250
|
}));
|
|
250
251
|
},
|
|
251
252
|
setInputAmount: (amount) => {
|
|
252
|
-
let sanitized = amount;
|
|
253
|
+
let sanitized = parseNumericValue(amount);
|
|
253
254
|
if (!isZeroValue(amount)) {
|
|
254
255
|
// sanitize once a meaningful digit is entered (e.g. "00001" → "1")
|
|
255
256
|
sanitized = removeLeadingZeros(sanitized);
|
|
@@ -2,9 +2,9 @@ import type { DataSlice } from './data';
|
|
|
2
2
|
import type { SettingsSlice } from './settings';
|
|
3
3
|
import type { WidgetConfig } from '../../types';
|
|
4
4
|
import type { StateCreatorWithInitialData } from '../app';
|
|
5
|
+
import type { VersionedProviders } from '@hub3js/core/utils';
|
|
5
6
|
|
|
6
7
|
import { allProviders as getAllProviders } from '@rango-dev/provider-all';
|
|
7
|
-
import { type VersionedProviders } from '@rango-dev/wallets-core';
|
|
8
8
|
|
|
9
9
|
import { cacheService } from '../../services/cacheService';
|
|
10
10
|
import {
|
|
@@ -40,7 +40,7 @@ export const DEFAULT_CONFIG: WidgetConfig = {
|
|
|
40
40
|
},
|
|
41
41
|
tonConnect: {
|
|
42
42
|
manifestUrl:
|
|
43
|
-
'https://raw.githubusercontent.com/rango-exchange/
|
|
43
|
+
'https://raw.githubusercontent.com/rango-exchange/assets/refs/heads/main/manifests/tonconnect/manifest.json',
|
|
44
44
|
},
|
|
45
45
|
};
|
|
46
46
|
|
|
@@ -32,7 +32,7 @@ const DEFAULT_CONFIG: WidgetConfig = {
|
|
|
32
32
|
},
|
|
33
33
|
tonConnect: {
|
|
34
34
|
manifestUrl:
|
|
35
|
-
'https://raw.githubusercontent.com/rango-exchange/
|
|
35
|
+
'https://raw.githubusercontent.com/rango-exchange/assets/refs/heads/main/manifests/tonconnect/manifest.json',
|
|
36
36
|
},
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AppStoreState } from './types';
|
|
2
|
-
import type { Namespace } from '@
|
|
2
|
+
import type { Namespace } from '@hub3js/namespaces';
|
|
3
3
|
import type { Asset, Token, WalletDetail } from 'rango-sdk';
|
|
4
4
|
|
|
5
5
|
import BigNumber from 'bignumber.js';
|
|
@@ -466,7 +466,7 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
|
|
|
466
466
|
const { _balances, _aggregatedBalances } =
|
|
467
467
|
computeNextStateAfterWalletBalanceRemoval(
|
|
468
468
|
partialCurrentState,
|
|
469
|
-
walletType,
|
|
469
|
+
[walletType],
|
|
470
470
|
options
|
|
471
471
|
);
|
|
472
472
|
|
|
@@ -611,8 +611,10 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
|
|
|
611
611
|
if (accounts.length === 0 || !accounts[0]) {
|
|
612
612
|
return;
|
|
613
613
|
}
|
|
614
|
-
|
|
615
|
-
const
|
|
614
|
+
|
|
615
|
+
const walletTypes = [
|
|
616
|
+
...new Set(accounts.map((account) => account.walletType)),
|
|
617
|
+
];
|
|
616
618
|
|
|
617
619
|
get().setConnectedWalletAsRefetching(accounts);
|
|
618
620
|
|
|
@@ -630,7 +632,6 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
|
|
|
630
632
|
return;
|
|
631
633
|
}
|
|
632
634
|
const walletsDetails = response.wallets;
|
|
633
|
-
|
|
634
635
|
if (walletsDetails) {
|
|
635
636
|
let nextBalances: BalanceState = get()._balances;
|
|
636
637
|
let nextAggregatedBalances: AggregatedBalanceState =
|
|
@@ -657,7 +658,7 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
|
|
|
657
658
|
const { _balances, _aggregatedBalances } =
|
|
658
659
|
computeNextStateAfterWalletBalanceRemoval(
|
|
659
660
|
partialCurrentState,
|
|
660
|
-
|
|
661
|
+
walletTypes,
|
|
661
662
|
{
|
|
662
663
|
chains: [wallet.blockChain],
|
|
663
664
|
}
|
|
@@ -672,7 +673,7 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
|
|
|
672
673
|
if (
|
|
673
674
|
!get().connectedWallets.find(
|
|
674
675
|
(connectedWallet) =>
|
|
675
|
-
connectedWallet.walletType
|
|
676
|
+
walletTypes.includes(connectedWallet.walletType) &&
|
|
676
677
|
connectedWallet.address === wallet.address &&
|
|
677
678
|
connectedWallet.chain === wallet.blockChain
|
|
678
679
|
)
|
|
@@ -715,11 +716,23 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
|
|
|
715
716
|
if (retryOnFailedBalances) {
|
|
716
717
|
const failedWallets: Wallet[] = walletsDetails
|
|
717
718
|
.filter((wallet) => wallet.failed)
|
|
718
|
-
.map((wallet) =>
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
719
|
+
.map((wallet) => {
|
|
720
|
+
const walletType = get().connectedWallets.find(
|
|
721
|
+
(connectedWallet) =>
|
|
722
|
+
connectedWallet.chain === wallet.blockChain &&
|
|
723
|
+
connectedWallet.address
|
|
724
|
+
)?.walletType;
|
|
725
|
+
// Return null if there is no related connected wallet.
|
|
726
|
+
if (!walletType) {
|
|
727
|
+
return null;
|
|
728
|
+
}
|
|
729
|
+
return {
|
|
730
|
+
chain: wallet.blockChain,
|
|
731
|
+
walletType: walletType,
|
|
732
|
+
address: wallet.address,
|
|
733
|
+
};
|
|
734
|
+
})
|
|
735
|
+
.filter((wallet) => !!wallet);
|
|
723
736
|
if (failedWallets.length > 0) {
|
|
724
737
|
await get().fetchMainTokensBalances(failedWallets, {
|
|
725
738
|
retryOnFailedBalances: false,
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
BalanceState,
|
|
9
9
|
ConnectedWallet,
|
|
10
10
|
} from '../slices/wallets';
|
|
11
|
-
import type { Namespace } from '@
|
|
11
|
+
import type { Namespace } from '@hub3js/namespaces';
|
|
12
12
|
import type { Asset, WalletDetail } from 'rango-types';
|
|
13
13
|
|
|
14
14
|
import BigNumber from 'bignumber.js';
|
|
@@ -17,7 +17,7 @@ import { ZERO } from '../../constants/numbers';
|
|
|
17
17
|
import { BALANCE_SEPARATOR } from '../../constants/wallets';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Note: We need to use `symbol` as well since native coins
|
|
20
|
+
* Note: We need to use `symbol` as well since native coins don't have `address`
|
|
21
21
|
* output format: BlockchainId${BALANCE_SEPARATOR}TokenAddress${BALANCE_SEPARATOR}TokenSymbol
|
|
22
22
|
*/
|
|
23
23
|
export function createAssetKey(asset: Asset): AssetKey {
|
|
@@ -164,14 +164,14 @@ export function computeNextStateAfterWalletBalanceRemoval(
|
|
|
164
164
|
_aggregatedBalances: AggregatedBalanceState;
|
|
165
165
|
connectedWallets: ConnectedWallet[];
|
|
166
166
|
},
|
|
167
|
-
|
|
167
|
+
walletTypes: string[],
|
|
168
168
|
options?: {
|
|
169
169
|
chains?: string[];
|
|
170
170
|
namespaces?: Namespace[];
|
|
171
171
|
}
|
|
172
172
|
) {
|
|
173
173
|
let walletsNeedsToBeRemoved = paritalCurrentState.connectedWallets.filter(
|
|
174
|
-
(connectedWallet) => connectedWallet.walletType
|
|
174
|
+
(connectedWallet) => walletTypes.includes(connectedWallet.walletType)
|
|
175
175
|
);
|
|
176
176
|
|
|
177
177
|
/*
|
|
@@ -181,7 +181,7 @@ export function computeNextStateAfterWalletBalanceRemoval(
|
|
|
181
181
|
* So we only delete balance when there is no connected wallet that has access to that specific chain and address.
|
|
182
182
|
*/
|
|
183
183
|
paritalCurrentState.connectedWallets.forEach((connectedWallet) => {
|
|
184
|
-
if (connectedWallet.walletType
|
|
184
|
+
if (!walletTypes.includes(connectedWallet.walletType)) {
|
|
185
185
|
walletsNeedsToBeRemoved = walletsNeedsToBeRemoved.filter((wallet) => {
|
|
186
186
|
const isAnotherWalletHasSameAddressAndChain =
|
|
187
187
|
wallet.chain === connectedWallet.chain &&
|
|
@@ -25,12 +25,7 @@ const listBlockchains = [
|
|
|
25
25
|
'TRON',
|
|
26
26
|
'BTC',
|
|
27
27
|
'SCROLL',
|
|
28
|
-
'COSMOS',
|
|
29
|
-
'OSMOSIS',
|
|
30
28
|
'METIS',
|
|
31
|
-
'NEUTRON',
|
|
32
|
-
'NOBLE',
|
|
33
|
-
'DYDX',
|
|
34
29
|
'SOLANA',
|
|
35
30
|
'CRONOS',
|
|
36
31
|
'BNB',
|
|
@@ -47,43 +42,12 @@ const listBlockchains = [
|
|
|
47
42
|
'LTC',
|
|
48
43
|
'BCH',
|
|
49
44
|
'HARMONY',
|
|
50
|
-
'EVMOS',
|
|
51
45
|
'HECO',
|
|
52
|
-
'SIF',
|
|
53
46
|
'BRISE',
|
|
54
|
-
'STARGAZE',
|
|
55
47
|
'FUSE',
|
|
56
|
-
'CRYPTO_ORG',
|
|
57
|
-
'CHIHUAHUA',
|
|
58
|
-
'BANDCHAIN',
|
|
59
|
-
'COMDEX',
|
|
60
|
-
'REGEN',
|
|
61
|
-
'IRIS',
|
|
62
|
-
'EMONEY',
|
|
63
48
|
'GNOSIS',
|
|
64
|
-
'JUNO',
|
|
65
|
-
'AXELAR',
|
|
66
|
-
'STRIDE',
|
|
67
49
|
'KCC',
|
|
68
|
-
'MARS',
|
|
69
|
-
'TERRA',
|
|
70
50
|
'TELOS',
|
|
71
|
-
'BITSONG',
|
|
72
|
-
'AKASH',
|
|
73
|
-
'KI',
|
|
74
|
-
'PERSISTENCE',
|
|
75
|
-
'MEDIBLOC',
|
|
76
|
-
'KUJIRA',
|
|
77
|
-
'SENTINEL',
|
|
78
|
-
'INJECTIVE',
|
|
79
|
-
'SECRET',
|
|
80
|
-
'KONSTELLATION',
|
|
81
|
-
'STARNAME',
|
|
82
|
-
'BITCANNA',
|
|
83
|
-
'UMEE',
|
|
84
|
-
'DESMOS',
|
|
85
|
-
'LUMNETWORK',
|
|
86
|
-
'TERRA_CLASSIC',
|
|
87
51
|
'DASH',
|
|
88
52
|
'DOGE',
|
|
89
53
|
];
|
|
@@ -105,13 +69,10 @@ const listTokens = [
|
|
|
105
69
|
'FIL',
|
|
106
70
|
'ETC',
|
|
107
71
|
'DAI',
|
|
108
|
-
'ATOM',
|
|
109
72
|
'IMX',
|
|
110
73
|
'OP',
|
|
111
74
|
'HBAR',
|
|
112
|
-
'INJ',
|
|
113
75
|
'XLM',
|
|
114
|
-
'CRO',
|
|
115
76
|
'RNDR',
|
|
116
77
|
'GRT',
|
|
117
78
|
'OKB',
|
|
@@ -216,6 +177,7 @@ export function createEvmBlockchain(): EvmBlockchainMeta {
|
|
|
216
177
|
addressUrl: faker.internet.url(),
|
|
217
178
|
transactionUrl: faker.internet.url(),
|
|
218
179
|
enableGasV2: faker.datatype.boolean(),
|
|
180
|
+
tokenUrl: faker.internet.url(),
|
|
219
181
|
},
|
|
220
182
|
};
|
|
221
183
|
}
|
package/src/types/config.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Provider } from '@hub3js/core';
|
|
1
2
|
import type { Language, theme } from '@rango-dev/ui';
|
|
2
|
-
import type { Provider } from '@rango-dev/wallets-core';
|
|
3
3
|
import type { LegacyProviderInterface } from '@rango-dev/wallets-core/legacy';
|
|
4
4
|
import type { WalletType } from '@rango-dev/wallets-shared';
|
|
5
5
|
import type { Asset } from 'rango-sdk';
|