@rango-dev/widget-embedded 0.0.0-experimental-e5c14f42-20260614 → 0.0.0-experimental-e17e4765-20260615
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/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/CustomDestination/CustomDestination.d.ts.map +1 -1
- package/dist/components/CustomTokenModal/CustomTokenModal.d.ts.map +1 -1
- package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.d.ts.map +1 -1
- package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.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/Detached.types.d.ts +1 -1
- package/dist/components/WalletStatefulConnect/Detached.types.d.ts.map +1 -1
- package/dist/components/WalletStatefulConnect/NamespaceDetachedItem.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/wallets.d.ts +1 -2
- package/dist/constants/wallets.d.ts.map +1 -1
- package/dist/containers/Settings/Lists.d.ts.map +1 -1
- package/dist/containers/Wallets/useUpdates.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/useSwapInput.d.ts.map +1 -1
- package/dist/hooks/useSyncNotifications/useSyncNotifications.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/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
- package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
- package/dist/pages/SelectSwapItemPage/SelectSwapItemPage.helpers.d.ts +0 -1
- package/dist/pages/SelectSwapItemPage/SelectSwapItemPage.helpers.d.ts.map +1 -1
- package/dist/pages/SelectSwapItemPage/SelectSwapItemsPage.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.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 +2 -4
- package/dist/store/slices/wallets.d.ts.map +1 -1
- package/dist/store/utils/wallets.d.ts +2 -2
- 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/types/event.d.ts +6 -141
- package/dist/types/event.d.ts.map +1 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/events.d.ts +5 -16
- package/dist/utils/events.d.ts.map +1 -1
- package/dist/utils/meta.d.ts +4 -0
- package/dist/utils/meta.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/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 +11 -8
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +2 -53
- package/src/components/ConfirmWalletsModal/WalletList.tsx +16 -166
- package/src/components/CustomDestination/CustomDestination.tsx +0 -18
- package/src/components/CustomTokenModal/CustomTokenModal.tsx +7 -2
- package/src/components/Quote/QuoteCostDetails.tsx +0 -8
- package/src/components/Slippage/Slippage.tsx +0 -21
- package/src/components/StatefulConnectModal/StatefulConnectModal.tsx +1 -1
- package/src/components/SwapDetails/SwapDetails.tsx +0 -6
- 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/NamespaceDetachedItem.tsx +7 -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/wallets.ts +1 -3
- package/src/containers/Settings/Lists.tsx +1 -13
- package/src/containers/Wallets/useUpdates.ts +1 -9
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
- package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +45 -3316
- 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/useSwapInput.ts +1 -46
- package/src/hooks/useSyncNotifications/useSyncNotifications.ts +1 -26
- package/src/hooks/useWalletList.ts +6 -63
- package/src/hooks/useWalletProviders/useWalletProviders.helpers.ts +1 -1
- package/src/pages/ConfirmSwapPage.tsx +1 -12
- package/src/pages/Home.tsx +4 -33
- package/src/pages/LiquiditySourcePage.tsx +0 -24
- package/src/pages/SelectBlockchainPage.tsx +0 -10
- package/src/pages/SelectSwapItemPage/SelectSwapItemPage.helpers.ts +0 -13
- package/src/pages/SelectSwapItemPage/SelectSwapItemsPage.tsx +0 -27
- package/src/pages/SwapDetailsPage.tsx +0 -6
- package/src/store/slices/config.ts +1 -1
- package/src/store/slices/wallets.ts +4 -12
- package/src/store/utils/wallets.ts +2 -2
- package/src/test-utils/fixtures.ts +0 -39
- package/src/types/config.ts +1 -1
- package/src/types/event.ts +10 -182
- package/src/utils/common.ts +0 -1
- package/src/utils/events.ts +6 -51
- package/src/utils/meta.ts +13 -0
- package/src/utils/providers.ts +2 -2
- 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/dist/services/walletConnectionSource.d.ts +0 -10
- package/dist/services/walletConnectionSource.d.ts.map +0 -1
- package/dist/utils/eventPayloads.d.ts +0 -8
- package/dist/utils/eventPayloads.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
- package/src/services/walletConnectionSource.ts +0 -41
- package/src/utils/eventPayloads.ts +0 -37
|
@@ -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.
|
|
@@ -5,10 +5,8 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|
|
5
5
|
|
|
6
6
|
import { useAppStore } from '../store/AppStore';
|
|
7
7
|
import { useQuoteStore } from '../store/quote';
|
|
8
|
-
import { QuoteErrorType
|
|
8
|
+
import { QuoteErrorType } from '../types';
|
|
9
9
|
import { debounce } from '../utils/common';
|
|
10
|
-
import { buildSwapEstimatePayload } from '../utils/eventPayloads';
|
|
11
|
-
import { emitQuoteEvent } from '../utils/events';
|
|
12
10
|
import { isPositiveNumber } from '../utils/numbers';
|
|
13
11
|
import {
|
|
14
12
|
generateQuoteWarnings,
|
|
@@ -162,27 +160,6 @@ export function useSwapInput({
|
|
|
162
160
|
updateQuotePartialState('quotes', res);
|
|
163
161
|
setSelectedQuote(quote);
|
|
164
162
|
|
|
165
|
-
if (!res.results?.length || !quote) {
|
|
166
|
-
emitQuoteEvent({
|
|
167
|
-
type: QuoteEventTypes.ROUTE_NOT_FOUND,
|
|
168
|
-
payload: {
|
|
169
|
-
sourceChain: fromToken.blockchain,
|
|
170
|
-
destinationChain: toToken.blockchain,
|
|
171
|
-
sourceToken: fromToken.symbol,
|
|
172
|
-
destinationToken: toToken.symbol,
|
|
173
|
-
inputAmountUsd: inputUsdValue ? inputUsdValue.toNumber() : null,
|
|
174
|
-
},
|
|
175
|
-
});
|
|
176
|
-
} else {
|
|
177
|
-
emitQuoteEvent({
|
|
178
|
-
type: QuoteEventTypes.ROUTE_REQUESTED,
|
|
179
|
-
payload: {
|
|
180
|
-
...buildSwapEstimatePayload(quote),
|
|
181
|
-
routeCount: res.results.length,
|
|
182
|
-
},
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
|
|
186
163
|
throwErrorIfResponseIsNotValid({
|
|
187
164
|
diagnosisMessages: res.diagnosisMessages,
|
|
188
165
|
requestId: quote?.requestId || '',
|
|
@@ -199,28 +176,6 @@ export function useSwapInput({
|
|
|
199
176
|
})
|
|
200
177
|
.catch((error) => {
|
|
201
178
|
const quoteError = handleQuoteErrors(error);
|
|
202
|
-
if (quoteError.type === QuoteErrorType.NO_RESULT) {
|
|
203
|
-
emitQuoteEvent({
|
|
204
|
-
type: QuoteEventTypes.ROUTE_NOT_FOUND,
|
|
205
|
-
payload: {
|
|
206
|
-
sourceChain: fromToken.blockchain,
|
|
207
|
-
destinationChain: toToken.blockchain,
|
|
208
|
-
sourceToken: fromToken.symbol,
|
|
209
|
-
destinationToken: toToken.symbol,
|
|
210
|
-
inputAmountUsd: inputUsdValue ? inputUsdValue.toNumber() : null,
|
|
211
|
-
},
|
|
212
|
-
});
|
|
213
|
-
} else if (quoteError.type === QuoteErrorType.REQUEST_FAILED) {
|
|
214
|
-
emitQuoteEvent({
|
|
215
|
-
type: QuoteEventTypes.ROUTE_FETCH_FAILED,
|
|
216
|
-
payload: {
|
|
217
|
-
sourceChain: fromToken.blockchain,
|
|
218
|
-
destinationChain: toToken.blockchain,
|
|
219
|
-
|
|
220
|
-
errorCode: String(error?.response?.status ?? ''),
|
|
221
|
-
},
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
179
|
if (
|
|
225
180
|
quoteError.type === QuoteErrorType.NO_RESULT ||
|
|
226
181
|
quoteError.type === QuoteErrorType.REQUEST_FAILED
|
|
@@ -2,8 +2,6 @@ import { useManager } from '@rango-dev/queue-manager-react';
|
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
|
|
4
4
|
import { useNotificationStore } from '../../store/notification';
|
|
5
|
-
import { UiEventTypes } from '../../types';
|
|
6
|
-
import { emitUiEvent } from '../../utils/events';
|
|
7
5
|
import { getPendingSwaps } from '../../utils/queue';
|
|
8
6
|
|
|
9
7
|
export function useSyncNotifications() {
|
|
@@ -17,30 +15,7 @@ export function useSyncNotifications() {
|
|
|
17
15
|
!isSynced;
|
|
18
16
|
|
|
19
17
|
if (shouldSyncNotifications) {
|
|
20
|
-
|
|
21
|
-
syncNotifications(pendingSwaps);
|
|
22
|
-
|
|
23
|
-
pendingSwaps.forEach(({ swap }) => {
|
|
24
|
-
const isInProgressMultiStep =
|
|
25
|
-
swap.status === 'running' && swap.steps.length > 1;
|
|
26
|
-
if (!isInProgressMultiStep) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const currentStepIndex = swap.steps.findIndex(
|
|
30
|
-
(step) => step.status !== 'success'
|
|
31
|
-
);
|
|
32
|
-
emitUiEvent({
|
|
33
|
-
type: UiEventTypes.SWAP_RESUMED,
|
|
34
|
-
payload: {
|
|
35
|
-
routeId: swap.requestId,
|
|
36
|
-
stepCount: swap.steps.length,
|
|
37
|
-
stepNumber:
|
|
38
|
-
currentStepIndex === -1
|
|
39
|
-
? swap.steps.length
|
|
40
|
-
: currentStepIndex + 1,
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
});
|
|
18
|
+
syncNotifications(getPendingSwaps(manager));
|
|
44
19
|
}
|
|
45
20
|
}, [
|
|
46
21
|
useNotificationStore.persist.hasHydrated(),
|
|
@@ -1,35 +1,21 @@
|
|
|
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
|
-
import { emitWalletDetected } from '../utils/events';
|
|
16
10
|
import { configWalletsToWalletName } from '../utils/providers';
|
|
17
11
|
import {
|
|
18
12
|
hashWalletsState,
|
|
19
|
-
isExperimentalChain,
|
|
20
13
|
mapWalletTypesToWalletInfo,
|
|
21
14
|
sortWalletsBasedOnConnectionState,
|
|
22
15
|
} from '../utils/wallets';
|
|
23
16
|
|
|
24
17
|
import { useStatefulConnect } from './useStatefulConnect/useStatefulConnect';
|
|
25
18
|
|
|
26
|
-
/**
|
|
27
|
-
* Wallet types we've already reported as detected this session. Module-scoped so
|
|
28
|
-
* the `walletDetected` event fires at most once per provider regardless of how
|
|
29
|
-
* often the wallet list re-renders or remounts.
|
|
30
|
-
*/
|
|
31
|
-
const detectedWalletsReported = new Set<string>();
|
|
32
|
-
|
|
33
19
|
interface Params {
|
|
34
20
|
chain?: string;
|
|
35
21
|
}
|
|
@@ -48,9 +34,8 @@ interface API {
|
|
|
48
34
|
*/
|
|
49
35
|
export function useWalletList(params?: Params): API {
|
|
50
36
|
const { chain } = params || {};
|
|
51
|
-
const {
|
|
37
|
+
const { getAvailableProviders } = useAppStore();
|
|
52
38
|
const { state, getWalletInfo } = useWallets();
|
|
53
|
-
const blockchains = useAppStore().blockchains();
|
|
54
39
|
const { handleDisconnect } = useStatefulConnect();
|
|
55
40
|
|
|
56
41
|
/** It can be what has been set by widget config or as a fallback we use all the supported wallets by our library */
|
|
@@ -74,39 +59,6 @@ export function useWalletList(params?: Params): API {
|
|
|
74
59
|
|
|
75
60
|
const sortedWallets = sortWalletsBasedOnConnectionState(wallets);
|
|
76
61
|
|
|
77
|
-
useEffect(() => {
|
|
78
|
-
wallets.forEach((wallet) => {
|
|
79
|
-
const isDetected = wallet.state !== WalletState.NOT_INSTALLED;
|
|
80
|
-
if (isDetected && !detectedWalletsReported.has(wallet.type)) {
|
|
81
|
-
detectedWalletsReported.add(wallet.type);
|
|
82
|
-
emitWalletDetected({
|
|
83
|
-
walletType: wallet.type,
|
|
84
|
-
walletName: wallet.title,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}, [hashWalletsState(wallets)]);
|
|
89
|
-
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
wallets.forEach((wallet) => {
|
|
92
|
-
const isDetected = wallet.state !== WalletState.NOT_INSTALLED;
|
|
93
|
-
if (isDetected && !detectedWalletsReported.has(wallet.type)) {
|
|
94
|
-
detectedWalletsReported.add(wallet.type);
|
|
95
|
-
emitWalletDetected({
|
|
96
|
-
walletType: wallet.type,
|
|
97
|
-
walletName: wallet.title,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
}, [hashWalletsState(wallets)]);
|
|
102
|
-
|
|
103
|
-
const isExperimentalChainNotAdded = (walletType: string) =>
|
|
104
|
-
!connectedWallets.find(
|
|
105
|
-
(connectedWallet) =>
|
|
106
|
-
connectedWallet.walletType === walletType &&
|
|
107
|
-
connectedWallet.chain === chain
|
|
108
|
-
);
|
|
109
|
-
|
|
110
62
|
const terminateConnectingWallets = useCallback(() => {
|
|
111
63
|
const connectingWallets =
|
|
112
64
|
wallets?.filter((wallet) => wallet.state === WalletState.CONNECTING) ||
|
|
@@ -155,24 +107,15 @@ export function useWalletList(params?: Params): API {
|
|
|
155
107
|
return isEvmWalletInstalledExceptDefault.length == 0;
|
|
156
108
|
};
|
|
157
109
|
|
|
158
|
-
const shouldExcludeWallet = (
|
|
159
|
-
walletType: string,
|
|
160
|
-
chain: string,
|
|
161
|
-
blockchains: BlockchainMeta[]
|
|
162
|
-
) => {
|
|
110
|
+
const shouldExcludeWallet = (walletType: string) => {
|
|
163
111
|
return (
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
!KEPLR_COMPATIBLE_WALLETS.includes(walletType)) ||
|
|
167
|
-
(walletType == WalletTypes.DEFAULT &&
|
|
168
|
-
!shouldShowDefaultInjectedWallet(wallets))
|
|
112
|
+
walletType == WalletTypes.DEFAULT &&
|
|
113
|
+
!shouldShowDefaultInjectedWallet(wallets)
|
|
169
114
|
);
|
|
170
115
|
};
|
|
171
116
|
|
|
172
117
|
return {
|
|
173
|
-
list: sortedWallets.filter(
|
|
174
|
-
(wallet) => !shouldExcludeWallet(wallet.type, chain ?? '', blockchains)
|
|
175
|
-
),
|
|
118
|
+
list: sortedWallets.filter((wallet) => !shouldExcludeWallet(wallet.type)),
|
|
176
119
|
terminateConnectingWallets,
|
|
177
120
|
};
|
|
178
121
|
}
|
|
@@ -28,9 +28,7 @@ import { useConfirmSwap } from '../hooks/useConfirmSwap';
|
|
|
28
28
|
import { useAppStore } from '../store/AppStore';
|
|
29
29
|
import { useQuoteStore } from '../store/quote';
|
|
30
30
|
import { useUiStore } from '../store/ui';
|
|
31
|
-
import { QuoteErrorType, QuoteWarningType
|
|
32
|
-
import { buildSwapEstimatePayload } from '../utils/eventPayloads';
|
|
33
|
-
import { emitUiEvent } from '../utils/events';
|
|
31
|
+
import { QuoteErrorType, QuoteWarningType } from '../types';
|
|
34
32
|
import { isQuoteWarningConfirmationRequired } from '../utils/quote';
|
|
35
33
|
import { joinList } from '../utils/ui';
|
|
36
34
|
|
|
@@ -144,15 +142,6 @@ export function ConfirmSwapPage() {
|
|
|
144
142
|
if (shouldShowWarningModal) {
|
|
145
143
|
setShowQuoteWarningModal(true);
|
|
146
144
|
} else {
|
|
147
|
-
if (selectedQuote) {
|
|
148
|
-
emitUiEvent({
|
|
149
|
-
type: UiEventTypes.SWAP_STARTED,
|
|
150
|
-
payload: {
|
|
151
|
-
...buildSwapEstimatePayload(selectedQuote),
|
|
152
|
-
stepCount: selectedQuote.swaps.length,
|
|
153
|
-
},
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
145
|
await onConfirm();
|
|
157
146
|
}
|
|
158
147
|
};
|
package/src/pages/Home.tsx
CHANGED
|
@@ -23,15 +23,9 @@ import { useSwapMode } from '../hooks/useSwapMode';
|
|
|
23
23
|
import { useAppStore } from '../store/AppStore';
|
|
24
24
|
import { useQuoteStore } from '../store/quote';
|
|
25
25
|
import { useUiStore } from '../store/ui';
|
|
26
|
-
import {
|
|
26
|
+
import { UiEventTypes } from '../types';
|
|
27
27
|
import { isVariantExpandable } from '../utils/configs';
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
emitPreventableEvent,
|
|
31
|
-
emitQuoteEvent,
|
|
32
|
-
emitUiEvent,
|
|
33
|
-
emitWalletConnectInitiated,
|
|
34
|
-
} from '../utils/events';
|
|
28
|
+
import { emitPreventableEvent } from '../utils/events';
|
|
35
29
|
import { getSlippageValidation } from '../utils/settings';
|
|
36
30
|
import { getSwapButtonState, isTokensIdentical } from '../utils/swap';
|
|
37
31
|
|
|
@@ -139,18 +133,6 @@ export function Home() {
|
|
|
139
133
|
};
|
|
140
134
|
const onClickOnQuote = (quote: SelectedQuote) => {
|
|
141
135
|
if (selectedQuote?.requestId !== quote.requestId) {
|
|
142
|
-
if (selectedQuote) {
|
|
143
|
-
emitQuoteEvent({
|
|
144
|
-
type: QuoteEventTypes.ROUTE_CHANGED,
|
|
145
|
-
payload: {
|
|
146
|
-
sourceChain: quote.swaps[0]?.from.blockchain ?? '',
|
|
147
|
-
destinationChain:
|
|
148
|
-
quote.swaps[quote.swaps.length - 1]?.to.blockchain ?? '',
|
|
149
|
-
fromRouteId: selectedQuote.requestId,
|
|
150
|
-
toRouteId: quote.requestId,
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
136
|
setShowQuoteWarningModal(false);
|
|
155
137
|
setSelectedQuote(quote);
|
|
156
138
|
}
|
|
@@ -208,21 +190,11 @@ export function Home() {
|
|
|
208
190
|
if (swapButtonState.action === 'connect-wallet') {
|
|
209
191
|
emitPreventableEvent(
|
|
210
192
|
{ type: UiEventTypes.CLICK_CONNECT_WALLET },
|
|
211
|
-
() =>
|
|
212
|
-
emitWalletConnectInitiated('swap_button');
|
|
213
|
-
onHandleNavigation(navigationRoutes.wallets);
|
|
214
|
-
}
|
|
193
|
+
() => onHandleNavigation(navigationRoutes.wallets)
|
|
215
194
|
);
|
|
216
195
|
} else if (swapButtonState.action === 'confirm-warning') {
|
|
217
196
|
setShowQuoteWarningModal(true);
|
|
218
|
-
} else
|
|
219
|
-
emitUiEvent({
|
|
220
|
-
type: UiEventTypes.SWAP_INITIATED,
|
|
221
|
-
payload: {
|
|
222
|
-
...buildSwapEstimatePayload(selectedQuote),
|
|
223
|
-
walletConnected: connectedWallets.length > 0,
|
|
224
|
-
},
|
|
225
|
-
});
|
|
197
|
+
} else {
|
|
226
198
|
onHandleNavigation(navigationRoutes.confirmSwap);
|
|
227
199
|
}
|
|
228
200
|
}}>
|
|
@@ -231,7 +203,6 @@ export function Home() {
|
|
|
231
203
|
}
|
|
232
204
|
header={{
|
|
233
205
|
onWallet: () => {
|
|
234
|
-
emitWalletConnectInitiated('nav');
|
|
235
206
|
onHandleNavigation(navigationRoutes.wallets);
|
|
236
207
|
},
|
|
237
208
|
hasBackButton: false,
|