@rango-dev/widget-embedded 0.60.1-next.0 → 0.60.2-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.
Files changed (45) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  3. package/dist/components/CustomTokenModal/CustomTokenModal.helpers.d.ts.map +1 -1
  4. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  5. package/dist/components/WalletStatefulConnect/index.d.ts +0 -1
  6. package/dist/components/WalletStatefulConnect/index.d.ts.map +1 -1
  7. package/dist/constants/wallets.d.ts +1 -2
  8. package/dist/constants/wallets.d.ts.map +1 -1
  9. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts.map +1 -1
  10. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
  11. package/dist/hooks/useWalletList.d.ts.map +1 -1
  12. package/dist/index.js +2 -2
  13. package/dist/index.js.map +4 -4
  14. package/dist/store/utils/wallets.d.ts +1 -1
  15. package/dist/test-utils/fixtures.d.ts.map +1 -1
  16. package/dist/utils/common.d.ts.map +1 -1
  17. package/dist/utils/wallets.d.ts +0 -2
  18. package/dist/utils/wallets.d.ts.map +1 -1
  19. package/dist/widget-embedded.build.json +1 -1
  20. package/package.json +7 -7
  21. package/src/components/ConfirmWalletsModal/WalletList.tsx +16 -166
  22. package/src/components/CustomTokenModal/CustomTokenModal.helpers.ts +0 -5
  23. package/src/components/TokenList/TokenList.tsx +12 -12
  24. package/src/components/WalletStatefulConnect/index.ts +0 -1
  25. package/src/constants/wallets.ts +1 -3
  26. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
  27. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +45 -3316
  28. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +26 -228
  29. package/src/hooks/useWalletList.ts +6 -29
  30. package/src/store/utils/wallets.ts +1 -1
  31. package/src/test-utils/fixtures.ts +0 -39
  32. package/src/utils/common.ts +0 -1
  33. package/src/utils/wallets.ts +0 -32
  34. package/dist/components/WalletStatefulConnect/ExperimentalChain.d.ts +0 -9
  35. package/dist/components/WalletStatefulConnect/ExperimentalChain.d.ts.map +0 -1
  36. package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.d.ts +0 -4
  37. package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.d.ts.map +0 -1
  38. package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.helpers.d.ts +0 -8
  39. package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.helpers.d.ts.map +0 -1
  40. package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.types.d.ts +0 -6
  41. package/dist/components/WalletStatefulConnect/ExperimentalChainStatus.types.d.ts.map +0 -1
  42. package/src/components/WalletStatefulConnect/ExperimentalChain.tsx +0 -39
  43. package/src/components/WalletStatefulConnect/ExperimentalChainStatus.helpers.ts +0 -53
  44. package/src/components/WalletStatefulConnect/ExperimentalChainStatus.tsx +0 -36
  45. 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 = ['UMEE', 'BANDCHAIN', 'LINEA'];
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
- 'AVAX_CCHAIN',
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 = 10;
104
- const preferredBlockchains = ['BTC', 'SOLANA', 'COSMOS', 'ETH'];
54
+ const listLimit = 4;
55
+ const preferredBlockchains = ['LINEA', 'SCROLL'];
105
56
  const expected = [
106
- 'BTC',
107
- 'SOLANA',
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
- 'AVAX_CCHAIN',
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 to be on the main list
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 = 10;
92
+ it('should prepare the list correctly if user has a long list of preferences', () => {
93
+ const listLimit = 4;
192
94
  const preferredBlockchains = [
193
- 'ETH',
194
- 'BTC',
195
- 'SOLANA',
196
- 'CRYPTO_ORG',
197
- 'TRON',
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 = 10;
276
- const preferredBlockchains = ['AVAX_CCHAIN', 'BTC'];
122
+ const listLimit = 4;
123
+ const preferredBlockchains = ['POLYGON', 'BASE'];
277
124
  const expected = [
278
- 'AVAX_CCHAIN',
279
- 'BTC',
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
- 'TRON',
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, {
@@ -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 { connectedWallets, getAvailableProviders } = useAppStore();
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
- (isExperimentalChain(blockchains, chain) &&
131
- isExperimentalChainNotAdded(walletType) &&
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
  }
@@ -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 and cosmos blockchains don't have `address`
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 {
@@ -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',
@@ -237,7 +237,6 @@ export const isBlockchainTypeInCategory = (
237
237
  case BlockchainCategories.OTHER:
238
238
  return (
239
239
  blockchainType !== TransactionType.TRANSFER &&
240
- blockchainType !== TransactionType.COSMOS &&
241
240
  blockchainType !== TransactionType.EVM
242
241
  );
243
242
  default:
@@ -23,13 +23,10 @@ import {
23
23
  import { legacyReadAccountAddress as readAccountAddress } from '@rango-dev/wallets-core/legacy';
24
24
  import {
25
25
  detectInstallLink,
26
- getCosmosExperimentalChainInfo,
27
26
  isEvmAddress,
28
- KEPLR_COMPATIBLE_WALLETS,
29
27
  Networks,
30
28
  } from '@rango-dev/wallets-shared';
31
29
  import BigNumber from 'bignumber.js';
32
- import { isCosmosBlockchain } from 'rango-types';
33
30
 
34
31
  import { ZERO } from '../constants/numbers';
35
32
  import {
@@ -314,35 +311,6 @@ function numberWithThousandSeparator(number: string | number): string {
314
311
  return parts.join('.');
315
312
  }
316
313
 
317
- export const isExperimentalChain = (
318
- blockchains: BlockchainMeta[],
319
- wallet: string
320
- ): boolean => {
321
- const cosmosExperimentalChainInfo = getCosmosExperimentalChainInfo(
322
- Object.entries(blockchains)
323
- .map(([, blockchainMeta]) => blockchainMeta)
324
- .filter(isCosmosBlockchain)
325
- );
326
- return (
327
- cosmosExperimentalChainInfo &&
328
- !!cosmosExperimentalChainInfo[wallet]?.experimental
329
- );
330
- };
331
-
332
- export const getKeplrCompatibleConnectedWallets = (
333
- selectableWallets: Wallet[]
334
- ): WalletType[] => {
335
- const connectedWalletTypes = new Set(
336
- selectableWallets.map((wallet) => {
337
- return wallet.walletType;
338
- })
339
- );
340
-
341
- return KEPLR_COMPATIBLE_WALLETS.filter((compatibleWallet) =>
342
- connectedWalletTypes.has(compatibleWallet)
343
- );
344
- };
345
-
346
314
  function representAmountInNumber(amount: string, decimals: number): string {
347
315
  return new BigNumber(amount).shiftedBy(-decimals).toFixed();
348
316
  }
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- interface PropTypes {
3
- displayName?: string;
4
- onConfirm: () => void;
5
- id: string;
6
- }
7
- export declare function ExperimentalChain(props: PropTypes): React.JSX.Element;
8
- export {};
9
- //# sourceMappingURL=ExperimentalChain.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExperimentalChain.d.ts","sourceRoot":"","sources":["../../../src/components/WalletStatefulConnect/ExperimentalChain.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,SAAS;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,qBA4BjD"}
@@ -1,4 +0,0 @@
1
- import type { PropTypes } from './ExperimentalChainStatus.types';
2
- import React from 'react';
3
- export declare function ExperimentalChainStatus(props: PropTypes): React.JSX.Element;
4
- //# sourceMappingURL=ExperimentalChainStatus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExperimentalChainStatus.d.ts","sourceRoot":"","sources":["../../../src/components/WalletStatefulConnect/ExperimentalChainStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAGjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,SAAS,qBAsBvD"}
@@ -1,8 +0,0 @@
1
- import type { PropTypes } from './ExperimentalChainStatus.types';
2
- import type { MessageType } from '@rango-dev/ui';
3
- export declare function generateMessageByStatus(status: PropTypes['status'], blockchainDisplayName: string | undefined): {
4
- type: MessageType;
5
- title: string;
6
- description: string;
7
- };
8
- //# sourceMappingURL=ExperimentalChainStatus.helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExperimentalChainStatus.helpers.d.ts","sourceRoot":"","sources":["../../../src/components/WalletStatefulConnect/ExperimentalChainStatus.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjD,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAC3B,qBAAqB,EAAE,MAAM,GAAG,SAAS,GACxC;IACD,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAwCA"}
@@ -1,6 +0,0 @@
1
- export interface PropTypes {
2
- displayName?: string;
3
- status: 'in-progress' | 'completed' | 'rejected';
4
- image: string;
5
- }
6
- //# sourceMappingURL=ExperimentalChainStatus.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExperimentalChainStatus.types.d.ts","sourceRoot":"","sources":["../../../src/components/WalletStatefulConnect/ExperimentalChainStatus.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -1,39 +0,0 @@
1
- import { i18n } from '@lingui/core';
2
- import { Button, Divider, MessageBox } from '@rango-dev/ui';
3
- import React from 'react';
4
-
5
- interface PropTypes {
6
- displayName?: string;
7
- onConfirm: () => void;
8
- id: string;
9
- }
10
-
11
- export function ExperimentalChain(props: PropTypes) {
12
- const { displayName, onConfirm, id } = props;
13
-
14
- return (
15
- <MessageBox
16
- id={id}
17
- title={i18n.t({
18
- id: 'Add {blockchainDisplayName} Chain',
19
- values: { blockchainDisplayName: displayName },
20
- })}
21
- type="warning"
22
- description={i18n.t({
23
- id: 'Would you like to add the {blockchainDisplayName} experimental chain to your wallet?',
24
- values: { blockchainDisplayName: displayName },
25
- })}>
26
- <Divider size={18} />
27
- <Divider size={32} />
28
- <Button
29
- id="widget-experimental-chain-confirm-btn"
30
- onClick={onConfirm}
31
- variant="outlined"
32
- type="primary"
33
- fullWidth
34
- size="large">
35
- {i18n.t('Confirm')}
36
- </Button>
37
- </MessageBox>
38
- );
39
- }
@@ -1,53 +0,0 @@
1
- import type { PropTypes } from './ExperimentalChainStatus.types';
2
- import type { MessageType } from '@rango-dev/ui';
3
-
4
- import { i18n } from '@lingui/core';
5
-
6
- export function generateMessageByStatus(
7
- status: PropTypes['status'],
8
- blockchainDisplayName: string | undefined
9
- ): {
10
- type: MessageType;
11
- title: string;
12
- description: string;
13
- } {
14
- switch (status) {
15
- case 'in-progress':
16
- return {
17
- type: 'loading',
18
- title: i18n.t({
19
- id: 'Add {blockchainDisplayName} Chain',
20
- values: { blockchainDisplayName },
21
- }),
22
- description: i18n.t({
23
- id: 'Please approve the experimental chain pop-up in your wallet.',
24
- values: { blockchainDisplayName },
25
- }),
26
- };
27
- case 'completed':
28
- return {
29
- type: 'success',
30
- title: i18n.t({
31
- id: '{blockchainDisplayName} Chain Added',
32
- values: { blockchainDisplayName },
33
- }),
34
- description: i18n.t({
35
- id: 'The {blockchainDisplayName} chain has been successfully added to your wallet.',
36
- values: { blockchainDisplayName },
37
- }),
38
- };
39
- case 'rejected':
40
- return {
41
- type: 'error',
42
- title: i18n.t('Request Rejected'),
43
- description: i18n.t({
44
- id: "You've rejected adding {blockchainDisplayName} chain to your wallet.",
45
- values: { blockchainDisplayName },
46
- }),
47
- };
48
- default:
49
- throw new Error(
50
- `Showing information about an experimentation chain status needs to be defined first. status: ${status}`
51
- );
52
- }
53
- }