@rango-dev/widget-embedded 0.27.4-next.3 → 0.27.4-next.4

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 (30) hide show
  1. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  2. package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
  3. package/dist/components/WalletNamespacesModal/WalletNamespacesModal.d.ts +6 -0
  4. package/dist/components/WalletNamespacesModal/WalletNamespacesModal.d.ts.map +1 -0
  5. package/dist/components/WalletNamespacesModal/WalletNamespacesModal.styles.d.ts +163 -0
  6. package/dist/components/WalletNamespacesModal/WalletNamespacesModal.styles.d.ts.map +1 -0
  7. package/dist/components/WalletNamespacesModal/WalletNamespacesModal.types.d.ts +10 -0
  8. package/dist/components/WalletNamespacesModal/WalletNamespacesModal.types.d.ts.map +1 -0
  9. package/dist/components/WalletNamespacesModal/index.d.ts +2 -0
  10. package/dist/components/WalletNamespacesModal/index.d.ts.map +1 -0
  11. package/dist/hooks/useWalletList.d.ts +4 -4
  12. package/dist/hooks/useWalletList.d.ts.map +1 -1
  13. package/dist/index.js +2 -2
  14. package/dist/index.js.map +4 -4
  15. package/dist/pages/WalletsPage.d.ts.map +1 -1
  16. package/dist/types/wallets.d.ts +6 -1
  17. package/dist/types/wallets.d.ts.map +1 -1
  18. package/dist/utils/wallets.d.ts +3 -3
  19. package/dist/utils/wallets.d.ts.map +1 -1
  20. package/package.json +7 -7
  21. package/src/components/ConfirmWalletsModal/WalletList.tsx +68 -23
  22. package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +40 -4
  23. package/src/components/WalletNamespacesModal/WalletNamespacesModal.styles.ts +7 -0
  24. package/src/components/WalletNamespacesModal/WalletNamespacesModal.tsx +142 -0
  25. package/src/components/WalletNamespacesModal/WalletNamespacesModal.types.tsx +10 -0
  26. package/src/components/WalletNamespacesModal/index.ts +1 -0
  27. package/src/hooks/useWalletList.ts +11 -3
  28. package/src/pages/WalletsPage.tsx +38 -2
  29. package/src/types/wallets.ts +7 -1
  30. package/src/utils/wallets.ts +8 -3
@@ -1 +1 @@
1
- {"version":3,"file":"WalletsPage.d.ts","sourceRoot":"","sources":["../../src/pages/WalletsPage.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAsBxC,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AACzC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,wBAAgB,WAAW,sBAyE1B"}
1
+ {"version":3,"file":"WalletsPage.d.ts","sourceRoot":"","sources":["../../src/pages/WalletsPage.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AA8BxC,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AACzC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,wBAAgB,WAAW,sBAqG1B"}
@@ -1,4 +1,5 @@
1
- import type { WalletType } from '@rango-dev/wallets-shared';
1
+ import type { WalletInfo } from '@rango-dev/ui';
2
+ import type { Namespace, WalletType } from '@rango-dev/wallets-shared';
2
3
  export interface Wallet {
3
4
  chain: string;
4
5
  address: string;
@@ -17,5 +18,9 @@ export type TokenHash = `${Blockchain}-${TokenSymbol}-${Address}`;
17
18
  export type TokensBalance = {
18
19
  [key: TokenHash]: Balance;
19
20
  };
21
+ export type WalletInfoWithNamespaces = WalletInfo & {
22
+ namespaces?: Namespace[];
23
+ singleNamespace?: boolean;
24
+ };
20
25
  export {};
21
26
  //# sourceMappingURL=wallets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../src/types/wallets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,UAA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G;IAClD,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import type { ConnectedWallet, TokenBalance } from '../store/wallets';
2
- import type { Balance, SelectedQuote, TokenHash, TokensBalance, Wallet } from '../types';
2
+ import type { Balance, SelectedQuote, TokenHash, TokensBalance, Wallet, WalletInfoWithNamespaces } from '../types';
3
3
  import type { WalletInfo as ModalWalletInfo } from '@rango-dev/ui';
4
4
  import type { Asset, Network, WalletInfo, WalletState, WalletType } from '@rango-dev/wallets-shared';
5
5
  import type { BlockchainMeta, Token, WalletDetail } from 'rango-sdk';
6
6
  import { WalletState as WalletStatus } from '@rango-dev/ui';
7
7
  export declare function mapStatusToWalletState(state: WalletState): WalletStatus;
8
- export declare function mapWalletTypesToWalletInfo(getState: (type: WalletType) => WalletState, getWalletInfo: (type: WalletType) => WalletInfo, list: WalletType[], chain?: string): ModalWalletInfo[];
8
+ export declare function mapWalletTypesToWalletInfo(getState: (type: WalletType) => WalletState, getWalletInfo: (type: WalletType) => WalletInfo, list: WalletType[], chain?: string): WalletInfoWithNamespaces[];
9
9
  export declare function walletAndSupportedChainsNames(supportedBlockchains: BlockchainMeta[]): Network[] | null;
10
10
  export declare function prepareAccountsForWalletStore(wallet: WalletType, accounts: string[], evmBasedChains: string[], supportedChainNames: Network[] | null, isContractWallet: boolean): Wallet[];
11
11
  export declare function getQuoteWallets(params: {
@@ -22,7 +22,7 @@ export declare const getKeplrCompatibleConnectedWallets: (selectableWallets: Wal
22
22
  export declare function formatBalance(balance: Balance | null): Balance | null;
23
23
  export declare function compareTokenBalance(token1Balance: Balance | null, token2Balance: Balance | null): number;
24
24
  export declare function areTokensEqual(tokenA: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null, tokenB: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null): boolean;
25
- export declare function sortWalletsBasedOnConnectionState(wallets: ModalWalletInfo[]): ModalWalletInfo[];
25
+ export declare function sortWalletsBasedOnConnectionState(wallets: WalletInfoWithNamespaces[]): WalletInfoWithNamespaces[];
26
26
  export declare function getConciseAddress(address: string, maxChars?: number, ellipsisLength?: number): string;
27
27
  export declare function getAddress({ chain, connectedWallets, walletType, }: {
28
28
  connectedWallets: ConnectedWallet[];
@@ -1 +1 @@
1
- {"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../src/utils/wallets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EACV,OAAO,EACP,aAAa,EACb,SAAS,EACT,aAAa,EACb,MAAM,EACP,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EACV,KAAK,EACL,OAAO,EACP,UAAU,EACV,WAAW,EACX,UAAU,EAEX,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAErE,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,eAAe,CAAC;AAuB5D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAWvE;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,WAAW,EAC3C,aAAa,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,UAAU,EAC/C,IAAI,EAAE,UAAU,EAAE,EAClB,KAAK,CAAC,EAAE,MAAM,GACb,eAAe,EAAE,CAmCnB;AAED,wBAAgB,6BAA6B,CAC3C,oBAAoB,EAAE,cAAc,EAAE,GACrC,OAAO,EAAE,GAAG,IAAI,CAUlB;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,MAAM,EAAE,EAClB,cAAc,EAAE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version": "0.27.4-next.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -25,13 +25,13 @@
25
25
  "@lingui/core": "4.2.1",
26
26
  "@lingui/react": "4.2.1",
27
27
  "@rango-dev/logging-core": "^0.2.1-next.1",
28
- "@rango-dev/provider-all": "^0.32.2-next.3",
28
+ "@rango-dev/provider-all": "^0.32.2-next.4",
29
29
  "@rango-dev/queue-manager-core": "^0.26.0",
30
- "@rango-dev/queue-manager-rango-preset": "^0.32.1-next.0",
30
+ "@rango-dev/queue-manager-rango-preset": "^0.32.1-next.1",
31
31
  "@rango-dev/queue-manager-react": "^0.26.0",
32
- "@rango-dev/ui": "^0.33.1-next.4",
33
- "@rango-dev/wallets-react": "^0.18.1-next.0",
34
- "@rango-dev/wallets-shared": "^0.32.1-next.0",
32
+ "@rango-dev/ui": "^0.33.1-next.5",
33
+ "@rango-dev/wallets-react": "^0.18.1-next.1",
34
+ "@rango-dev/wallets-shared": "^0.32.1-next.2",
35
35
  "bignumber.js": "^9.1.1",
36
36
  "copy-to-clipboard": "^3.3.3",
37
37
  "dayjs": "^1.11.7",
@@ -52,4 +52,4 @@
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  }
55
- }
55
+ }
@@ -1,7 +1,6 @@
1
1
  import type { PropTypes } from './WalletList.type';
2
- import type { Wallet } from '../../types';
3
- import type { WalletInfo } from '@rango-dev/ui';
4
- import type { WalletType } from '@rango-dev/wallets-shared';
2
+ import type { Wallet, WalletInfoWithNamespaces } from '../../types';
3
+ import type { Namespace, WalletType } from '@rango-dev/wallets-shared';
5
4
 
6
5
  import { i18n } from '@lingui/core';
7
6
  import {
@@ -33,6 +32,7 @@ import {
33
32
  } from '../../utils/wallets';
34
33
  import { WatermarkedModal } from '../common/WatermarkedModal';
35
34
  import { WalletModal } from '../WalletModal';
35
+ import { WalletNamespacesModal } from '../WalletNamespacesModal';
36
36
 
37
37
  import { ShowMoreWallets } from './ConfirmWallets.styles';
38
38
  import {
@@ -41,6 +41,13 @@ import {
41
41
  WalletImageContainer,
42
42
  } from './WalletList.styles';
43
43
 
44
+ interface WalletNamespacesModalState {
45
+ providerType: string;
46
+ providerImage: string;
47
+ availableNamespaces?: Namespace[];
48
+ singleNamespace?: boolean;
49
+ }
50
+
44
51
  const ACCOUNT_ADDRESS_MAX_CHARACTERS = 7;
45
52
  export function WalletList(props: PropTypes) {
46
53
  const { chain, isSelected, selectWallet, limit, onShowMore } = props;
@@ -56,26 +63,34 @@ export function WalletList(props: PropTypes) {
56
63
  useState(false);
57
64
  const [addingExperimentalChainStatus, setAddingExperimentalChainStatus] =
58
65
  useState<'in-progress' | 'completed' | 'rejected' | null>(null);
66
+ const [namespacesModalState, setNamespacesModalState] =
67
+ useState<WalletNamespacesModalState | null>(null);
59
68
  const { suggestAndConnect } = useWallets();
60
69
  let modalTimerId: ReturnType<typeof setTimeout> | null = null;
61
- const { list, error, handleClick, disconnectConnectingWallets } =
62
- useWalletList({
63
- chain,
64
- onBeforeConnect: (type) => {
65
- modalTimerId = setTimeout(() => {
66
- setOpenWalletStateModal(type);
67
- }, TIME_TO_IGNORE_MODAL);
68
- },
69
- onConnect: () => {
70
- if (modalTimerId) {
71
- clearTimeout(modalTimerId);
72
- }
73
- setTimeout(() => {
74
- setOpenWalletStateModal('');
75
- }, TIME_TO_CLOSE_MODAL);
76
- },
77
- });
78
- const [sortedList, setSortedList] = useState<WalletInfo[]>(list);
70
+ const {
71
+ list,
72
+ error,
73
+ handleClick,
74
+ disconnectWallet,
75
+ disconnectConnectingWallets,
76
+ } = useWalletList({
77
+ chain,
78
+ onBeforeConnect: (type) => {
79
+ modalTimerId = setTimeout(() => {
80
+ setOpenWalletStateModal(type);
81
+ }, TIME_TO_IGNORE_MODAL);
82
+ },
83
+ onConnect: () => {
84
+ if (modalTimerId) {
85
+ clearTimeout(modalTimerId);
86
+ }
87
+ setTimeout(() => {
88
+ setOpenWalletStateModal('');
89
+ }, TIME_TO_CLOSE_MODAL);
90
+ },
91
+ });
92
+ const [sortedList, setSortedList] =
93
+ useState<WalletInfoWithNamespaces[]>(list);
79
94
  const numberOfSupportedWallets = list.length;
80
95
  const shouldShowMoreWallets = limit && numberOfSupportedWallets - limit > 0;
81
96
 
@@ -90,6 +105,15 @@ export function WalletList(props: PropTypes) {
90
105
  }
91
106
  };
92
107
 
108
+ const handleOpenNamespacesModal = (wallet: WalletInfoWithNamespaces) => {
109
+ setNamespacesModalState({
110
+ providerType: wallet.type,
111
+ providerImage: wallet.image,
112
+ availableNamespaces: wallet.namespaces,
113
+ singleNamespace: wallet.singleNamespace,
114
+ });
115
+ };
116
+
93
117
  useEffect(() => {
94
118
  setSortedList((sortedList) => {
95
119
  const selectedWalletIndex = list.findIndex((wallet) =>
@@ -169,9 +193,16 @@ export function WalletList(props: PropTypes) {
169
193
  })
170
194
  : conciseAddress;
171
195
 
172
- const onClick = () => {
196
+ const onClick = async () => {
173
197
  if (wallet.state === WalletState.DISCONNECTED) {
174
- void handleClick(wallet.type);
198
+ if (!!wallet.namespaces) {
199
+ handleOpenNamespacesModal(wallet);
200
+ } else {
201
+ void handleClick(wallet.type);
202
+ }
203
+ } else if (!!wallet.namespaces && !conciseAddress) {
204
+ await disconnectWallet(wallet.type);
205
+ handleOpenNamespacesModal(wallet);
175
206
  } else if (couldAddExperimentalChain) {
176
207
  setExperimentalChainWallet({
177
208
  walletType: wallet.type,
@@ -204,6 +235,20 @@ export function WalletList(props: PropTypes) {
204
235
  state={wallet.state}
205
236
  error={error}
206
237
  />
238
+ <WalletNamespacesModal
239
+ open={!!namespacesModalState}
240
+ onClose={() => setNamespacesModalState(null)}
241
+ onConfirm={(namespaces) => {
242
+ void handleClick(
243
+ namespacesModalState?.providerType as string,
244
+ namespaces
245
+ );
246
+ setNamespacesModalState(null);
247
+ }}
248
+ image={namespacesModalState?.providerImage}
249
+ namespaces={namespacesModalState?.availableNamespaces}
250
+ singleNamespace={namespacesModalState?.singleNamespace}
251
+ />
207
252
  {!!experimentalChainWallet && (
208
253
  <WatermarkedModal
209
254
  open={!!experimentalChainWallet && showExperimentalChainModal}
@@ -1,15 +1,24 @@
1
1
  import type { WalletStateContentProps } from './SwapDetailsModal.types';
2
+ import type { Namespace } from '@rango-dev/wallets-shared';
2
3
 
3
4
  import { debug } from '@rango-dev/logging-core';
4
5
  import { MessageBox, Wallet } from '@rango-dev/ui';
5
6
  import { useWallets } from '@rango-dev/wallets-react';
6
- import React from 'react';
7
+ import React, { useState } from 'react';
7
8
 
8
9
  import { getContainer } from '../../utils/common';
9
10
  import { mapStatusToWalletState } from '../../utils/wallets';
11
+ import { WalletNamespacesModal } from '../WalletNamespacesModal';
10
12
 
11
13
  import { WalletContainer } from './SwapDetailsModal.styles';
12
14
 
15
+ interface NamespacesModalState {
16
+ providerType: string;
17
+ providerImage: string;
18
+ availableNamespaces?: Namespace[];
19
+ singleNamespace?: boolean;
20
+ }
21
+
13
22
  export const WalletStateContent = (props: WalletStateContentProps) => {
14
23
  const {
15
24
  type,
@@ -20,6 +29,8 @@ export const WalletStateContent = (props: WalletStateContentProps) => {
20
29
  walletButtonDisabled,
21
30
  } = props;
22
31
  const { connect, getWalletInfo, state } = useWallets();
32
+ const [namespacesModalState, setNamespacesModalState] =
33
+ useState<NamespacesModalState | null>(null);
23
34
  const walletType = currentStepWallet?.walletType;
24
35
  const walletState = walletType
25
36
  ? mapStatusToWalletState(state(walletType))
@@ -27,6 +38,7 @@ export const WalletStateContent = (props: WalletStateContentProps) => {
27
38
  const walletInfo = walletType ? getWalletInfo(walletType) : null;
28
39
  const shouldShowWallet =
29
40
  showWalletButton && !!walletType && !!walletState && !!walletInfo;
41
+
30
42
  return (
31
43
  <>
32
44
  <MessageBox type={type} title={title} description={message} />
@@ -41,12 +53,36 @@ export const WalletStateContent = (props: WalletStateContentProps) => {
41
53
  link={walletInfo.installLink}
42
54
  disabled={walletButtonDisabled}
43
55
  // TODO we need to show an error modal when user reject the connection
44
- onClick={async () =>
45
- connect(walletType).catch((error) => debug(error))
46
- }
56
+ onClick={async () => {
57
+ if (walletInfo.namespaces) {
58
+ setNamespacesModalState({
59
+ providerType: walletType,
60
+ providerImage: walletInfo.img,
61
+ availableNamespaces: walletInfo.namespaces,
62
+ singleNamespace: walletInfo.singleNamespace,
63
+ });
64
+ } else {
65
+ connect(walletType).catch((error) => debug(error));
66
+ }
67
+ }}
47
68
  />
48
69
  </WalletContainer>
49
70
  )}
71
+ <WalletNamespacesModal
72
+ open={!!namespacesModalState}
73
+ onClose={() => setNamespacesModalState(null)}
74
+ onConfirm={(namespaces) => {
75
+ connect(
76
+ namespacesModalState?.providerType as string,
77
+ undefined,
78
+ namespaces
79
+ ).catch((error) => debug(error));
80
+ setNamespacesModalState(null);
81
+ }}
82
+ image={namespacesModalState?.providerImage}
83
+ namespaces={namespacesModalState?.availableNamespaces}
84
+ singleNamespace={namespacesModalState?.singleNamespace}
85
+ />
50
86
  </>
51
87
  );
52
88
  };
@@ -0,0 +1,7 @@
1
+ import { styled } from '@rango-dev/ui';
2
+
3
+ export const NamespaceList = styled('ul', {
4
+ padding: 0,
5
+ paddingTop: '$4',
6
+ paddingBottom: '$4',
7
+ });
@@ -0,0 +1,142 @@
1
+ import type { PropTypes } from './WalletNamespacesModal.types';
2
+ import type { BlockchainMeta } from 'rango-sdk';
3
+
4
+ import { i18n } from '@lingui/core';
5
+ import {
6
+ Button,
7
+ Checkbox,
8
+ Image,
9
+ ListItemButton,
10
+ MessageBox,
11
+ Radio,
12
+ RadioRoot,
13
+ } from '@rango-dev/ui';
14
+ import { Namespace } from '@rango-dev/wallets-shared';
15
+ import React, { useMemo, useState } from 'react';
16
+
17
+ import { WIDGET_UI_ID } from '../../constants';
18
+ import { useAppStore } from '../../store/AppStore';
19
+ import { WatermarkedModal } from '../common/WatermarkedModal';
20
+ import { WalletImageContainer } from '../HeaderButtons/HeaderButtons.styles';
21
+ import {
22
+ LogoContainer,
23
+ Spinner,
24
+ } from '../WalletModal/WalletModalContent.styles';
25
+
26
+ import { NamespaceList } from './WalletNamespacesModal.styles';
27
+
28
+ export const namespaceMainBlockchain: Record<Namespace, string> = {
29
+ [Namespace.Evm]: 'ETH',
30
+ [Namespace.Solana]: 'SOLANA',
31
+ [Namespace.Cosmos]: 'COSMOS',
32
+ [Namespace.Utxo]: 'BTC',
33
+ [Namespace.Starknet]: 'STARKNET',
34
+ [Namespace.Tron]: 'TRON',
35
+ };
36
+
37
+ const getBlockchainLogo = (
38
+ blockchains: BlockchainMeta[],
39
+ blockchainName: string
40
+ ) => {
41
+ return blockchains.find((blockchain) => blockchain.name === blockchainName)
42
+ ?.logo;
43
+ };
44
+
45
+ export function WalletNamespacesModal(props: PropTypes) {
46
+ const { singleNamespace, namespaces } = props;
47
+
48
+ const [selectedNamespaces, setSelectedNamespaces] = useState<Namespace[]>([]);
49
+
50
+ const blockchains = useAppStore().blockchains();
51
+
52
+ const namespacesInfo = useMemo(
53
+ () =>
54
+ namespaces?.map((namespace) => ({
55
+ name: namespace,
56
+ logo: getBlockchainLogo(
57
+ blockchains,
58
+ namespaceMainBlockchain[namespace]
59
+ ),
60
+ })),
61
+ [namespaces]
62
+ );
63
+
64
+ const onSelect = (namespace: Namespace) => {
65
+ if (singleNamespace) {
66
+ setSelectedNamespaces([namespace]);
67
+ } else {
68
+ setSelectedNamespaces((selectedNamespaces) =>
69
+ selectedNamespaces.includes(namespace)
70
+ ? selectedNamespaces.filter((item) => item !== namespace)
71
+ : selectedNamespaces.concat(namespace)
72
+ );
73
+ }
74
+ };
75
+
76
+ const wrapRadioRoot = (children: React.ReactNode) => {
77
+ if (singleNamespace) {
78
+ return <RadioRoot value={selectedNamespaces?.[0]}>{children}</RadioRoot>;
79
+ }
80
+
81
+ return <>{children}</>;
82
+ };
83
+
84
+ return (
85
+ <WatermarkedModal
86
+ open={props.open}
87
+ onClose={props.onClose}
88
+ container={
89
+ document.getElementById(WIDGET_UI_ID.SWAP_BOX_ID) || document.body
90
+ }>
91
+ <MessageBox
92
+ type="info"
93
+ title={i18n.t('Select chain types')}
94
+ description={i18n.t(
95
+ `This wallet supports multiple chains. Select which chain you'd like to connect to.`
96
+ )}
97
+ icon={
98
+ <LogoContainer>
99
+ <WalletImageContainer>
100
+ <Image src={props.image} size={45} />
101
+ </WalletImageContainer>
102
+ <Spinner />
103
+ </LogoContainer>
104
+ }
105
+ />
106
+ <NamespaceList>
107
+ {wrapRadioRoot(
108
+ <>
109
+ {namespacesInfo?.map((namespaceInfoItem) => (
110
+ <ListItemButton
111
+ key={namespaceInfoItem.name}
112
+ id={namespaceInfoItem.name}
113
+ title={namespaceInfoItem.name}
114
+ hasDivider
115
+ style={{ height: 60 }}
116
+ onClick={() => onSelect(namespaceInfoItem.name)}
117
+ start={<Image src={namespaceInfoItem.logo} size={22} />}
118
+ end={
119
+ singleNamespace ? (
120
+ <Radio value={namespaceInfoItem.name} />
121
+ ) : (
122
+ <Checkbox
123
+ checked={selectedNamespaces.includes(
124
+ namespaceInfoItem.name
125
+ )}
126
+ />
127
+ )
128
+ }
129
+ />
130
+ ))}
131
+ </>
132
+ )}
133
+ </NamespaceList>
134
+ <Button
135
+ type="primary"
136
+ disabled={!selectedNamespaces.length}
137
+ onClick={() => props.onConfirm(selectedNamespaces)}>
138
+ {i18n.t('Confirm')}
139
+ </Button>
140
+ </WatermarkedModal>
141
+ );
142
+ }
@@ -0,0 +1,10 @@
1
+ import type { Namespace } from '@rango-dev/wallets-shared';
2
+
3
+ export interface PropTypes {
4
+ open: boolean;
5
+ image?: string;
6
+ onClose: () => void;
7
+ onConfirm: (namespaces: Namespace[]) => void;
8
+ namespaces?: Namespace[];
9
+ singleNamespace?: boolean;
10
+ }
@@ -0,0 +1 @@
1
+ export { WalletNamespacesModal } from './WalletNamespacesModal';
@@ -1,4 +1,5 @@
1
1
  import type { WalletInfo } from '@rango-dev/ui';
2
+ import type { Namespace, WalletType } from '@rango-dev/wallets-shared';
2
3
  import type { BlockchainMeta } from 'rango-sdk';
3
4
 
4
5
  import { WalletState } from '@rango-dev/ui';
@@ -6,7 +7,6 @@ import { useWallets } from '@rango-dev/wallets-react';
6
7
  import {
7
8
  detectMobileScreens,
8
9
  KEPLR_COMPATIBLE_WALLETS,
9
- type WalletType,
10
10
  WalletTypes,
11
11
  } from '@rango-dev/wallets-shared';
12
12
  import { useCallback, useEffect, useState } from 'react';
@@ -70,7 +70,7 @@ export function useWalletList(params: Params) {
70
70
  connectedWallet.chain === chain
71
71
  );
72
72
 
73
- const handleClick = async (type: WalletType) => {
73
+ const handleClick = async (type: WalletType, namespaces?: Namespace[]) => {
74
74
  const wallet = state(type);
75
75
  try {
76
76
  if (error) {
@@ -86,7 +86,7 @@ export function useWalletList(params: Params) {
86
86
  return;
87
87
  }
88
88
  onBeforeConnect?.(type);
89
- await connect(type);
89
+ await connect(type, undefined, namespaces);
90
90
  onConnect?.(type);
91
91
  }
92
92
  } catch (e) {
@@ -103,6 +103,13 @@ export function useWalletList(params: Params) {
103
103
  }
104
104
  }, [hashWalletsState(wallets)]);
105
105
 
106
+ const disconnectWallet = async (type: WalletType) => {
107
+ const wallet = state(type);
108
+ if (wallet.connected) {
109
+ await disconnect(type);
110
+ }
111
+ };
112
+
106
113
  useEffect(() => {
107
114
  return () => {
108
115
  disconnectConnectingWallets();
@@ -161,5 +168,6 @@ export function useWalletList(params: Params) {
161
168
  error,
162
169
  handleClick,
163
170
  disconnectConnectingWallets,
171
+ disconnectWallet,
164
172
  };
165
173
  }
@@ -1,4 +1,4 @@
1
- import type { WalletType } from '@rango-dev/wallets-shared';
1
+ import type { Namespace, WalletType } from '@rango-dev/wallets-shared';
2
2
 
3
3
  import { i18n } from '@lingui/core';
4
4
  import { styled, Typography, Wallet, WalletState } from '@rango-dev/ui';
@@ -6,11 +6,19 @@ import React, { useState } from 'react';
6
6
 
7
7
  import { Layout, PageContainer } from '../components/Layout';
8
8
  import { WalletModal } from '../components/WalletModal';
9
+ import { WalletNamespacesModal } from '../components/WalletNamespacesModal';
9
10
  import { useWalletList } from '../hooks/useWalletList';
10
11
  import { useAppStore } from '../store/AppStore';
11
12
  import { useUiStore } from '../store/ui';
12
13
  import { getContainer } from '../utils/common';
13
14
 
15
+ interface NamespacesModalState {
16
+ providerType: string;
17
+ providerImage: string;
18
+ availableNamespaces?: Namespace[];
19
+ singleNamespace?: boolean;
20
+ }
21
+
14
22
  const ListContainer = styled('div', {
15
23
  display: 'flex',
16
24
  justifyContent: 'center',
@@ -30,6 +38,8 @@ export const TIME_TO_IGNORE_MODAL = 300;
30
38
  export function WalletsPage() {
31
39
  const { fetchStatus: fetchMetaStatus } = useAppStore();
32
40
  const [openModal, setOpenModal] = useState(false);
41
+ const [namespacesModalState, setNamespacesModalState] =
42
+ useState<NamespacesModalState | null>(null);
33
43
  const [selectedWalletType, setSelectedWalletType] = useState<WalletType>('');
34
44
  let modalTimerId: ReturnType<typeof setTimeout> | null = null;
35
45
  const isActiveTab = useUiStore.use.isActiveTab();
@@ -82,7 +92,19 @@ export function WalletsPage() {
82
92
  {...wallet}
83
93
  container={getContainer()}
84
94
  onClick={(type) => {
85
- void handleClick(type);
95
+ if (
96
+ !!wallet.namespaces &&
97
+ wallet.state === WalletState.DISCONNECTED
98
+ ) {
99
+ setNamespacesModalState({
100
+ providerType: type,
101
+ providerImage: wallet.image,
102
+ availableNamespaces: wallet.namespaces,
103
+ singleNamespace: wallet.singleNamespace,
104
+ });
105
+ } else {
106
+ void handleClick(type);
107
+ }
86
108
  }}
87
109
  isLoading={fetchMetaStatus === 'loading'}
88
110
  disabled={!isActiveTab}
@@ -96,6 +118,20 @@ export function WalletsPage() {
96
118
  state={selectedWalletState}
97
119
  error={error}
98
120
  />
121
+ <WalletNamespacesModal
122
+ open={!!namespacesModalState}
123
+ onClose={() => setNamespacesModalState(null)}
124
+ onConfirm={(namespaces) => {
125
+ void handleClick(
126
+ namespacesModalState?.providerType as string,
127
+ namespaces
128
+ );
129
+ setNamespacesModalState(null);
130
+ }}
131
+ image={namespacesModalState?.providerImage}
132
+ namespaces={namespacesModalState?.availableNamespaces}
133
+ singleNamespace={namespacesModalState?.singleNamespace}
134
+ />
99
135
  </ListContainer>
100
136
  </Container>
101
137
  </Layout>
@@ -1,4 +1,5 @@
1
- import type { WalletType } from '@rango-dev/wallets-shared';
1
+ import type { WalletInfo } from '@rango-dev/ui';
2
+ import type { Namespace, WalletType } from '@rango-dev/wallets-shared';
2
3
 
3
4
  export interface Wallet {
4
5
  chain: string;
@@ -22,3 +23,8 @@ export type TokenHash = `${Blockchain}-${TokenSymbol}-${Address}`;
22
23
  export type TokensBalance = {
23
24
  [key: TokenHash]: Balance;
24
25
  };
26
+
27
+ export type WalletInfoWithNamespaces = WalletInfo & {
28
+ namespaces?: Namespace[];
29
+ singleNamespace?: boolean;
30
+ };