@broxus/evm-connect 1.11.5 → 1.11.7

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.
@@ -58,7 +58,7 @@ exports.EvmConnector = (0, mobx_react_lite_1.observer)((props) => {
58
58
  const changeWallet = () => {
59
59
  drop.current?.close();
60
60
  };
61
- const disconnect = React.useCallback(async () => {
61
+ const disconnect = async () => {
62
62
  if (walletService.hasProvider) {
63
63
  drop.current?.close();
64
64
  await walletService.disconnect();
@@ -67,9 +67,10 @@ exports.EvmConnector = (0, mobx_react_lite_1.observer)((props) => {
67
67
  setRecentMeta({ ...recentMeta, disconnected: true });
68
68
  }
69
69
  }
70
- }, [setRecentMeta, walletService]);
70
+ };
71
+ const isDisconnected = !walletService.isConnected || walletService.address === undefined;
71
72
  let subTitle = intl.formatMessage(intl_1.default.EVM_CONNECT_NOT_CONNECTED_HINT);
72
- if (walletService.isUnsupportedNetwork && walletService.isConnected) {
73
+ if (walletService.isUnsupportedNetwork && !isDisconnected) {
73
74
  subTitle = (React.createElement(react_uikit_1.Text, { color: "danger" }, intl.formatMessage(intl_1.default.EVM_CONNECT_UNSUPPORTED_NETWORK_WARNING)));
74
75
  }
75
76
  else if (walletService.isSyncing) {
@@ -85,11 +86,17 @@ exports.EvmConnector = (0, mobx_react_lite_1.observer)((props) => {
85
86
  if (walletService.providerInfo?.icon) {
86
87
  providerIcon = React.createElement(react_components_1.TokenIcon, { iconUrl: walletService.providerInfo.icon, size: 16 });
87
88
  }
89
+ if (walletService.isUnsupportedNetwork && !isDisconnected) {
90
+ networkIcon = React.createElement(react_components_1.Icon, { icon: "danger", ratio: 1.6 });
91
+ }
92
+ const networkName = network?.shortName ?? walletService.network?.shortName;
88
93
  return (React.createElement(react_uikit_1.Flex, { alignItems: "stretch", className: (0, classnames_1.default)('evm-connect-connector', className, walletService.providerId), component: react_uikit_1.Grid },
89
94
  React.createElement("div", null,
90
- React.createElement(react_components_1.WalletAccount, { address: walletService.address?.toString(), icon: networkIcon, subIcon: walletService.isConnected && showSubIcon ? providerIcon : undefined, subTitle: subTitle, title: !walletService.isConnected ? (intl.formatMessage(intl_1.default.EVM_CONNECT_CONNECTOR_BLOCKCHAIN_NAME)) : (React.createElement(react_components_1.ExplorerAccountLink, { address: walletService.address.toString(), baseUrl: walletService.network?.explorer.baseUrl, copyable: true, subPath: walletService.network?.explorer.accountsSubPath, tooltip: intl.formatMessage(intl_1.default.EVM_CONNECT_CONNECTOR_EXPLORER_HINT, {
91
- explorerTitle: walletService.network?.explorer.title ?? '',
92
- }) })) })),
95
+ React.createElement(react_components_1.WalletAccount, { address: walletService.address?.toString(), icon: networkIcon, subIcon: !isDisconnected && showSubIcon ? providerIcon : undefined, subTitle: subTitle, title: isDisconnected
96
+ ? networkName ?? intl.formatMessage(intl_1.default.EVM_CONNECT_CONNECTOR_BLOCKCHAIN_NAME)
97
+ : (React.createElement(react_components_1.ExplorerAccountLink, { address: walletService.address?.toString(), baseUrl: walletService.network?.explorer.baseUrl, copyable: true, subPath: walletService.network?.explorer.accountsSubPath, tooltip: intl.formatMessage(intl_1.default.EVM_CONNECT_CONNECTOR_EXPLORER_HINT, {
98
+ explorerTitle: walletService.network?.explorer.title ?? '',
99
+ }) })) })),
93
100
  React.createElement(react_uikit_1.Flex, { alignItems: "center", className: "evm-connect-connector-suffix" },
94
101
  suffix,
95
102
  walletService.isConnected && showDropMenu && (React.createElement(react_uikit_1.Dropdown, { ref: drop, action: "click", overlayClassName: "evm-connect-dropdown", overlay: (React.createElement(react_uikit_1.List, { className: "uk-margin-remove", size: "large" },
@@ -19,7 +19,7 @@ export const EvmConnector = observer((props) => {
19
19
  const changeWallet = () => {
20
20
  drop.current?.close();
21
21
  };
22
- const disconnect = React.useCallback(async () => {
22
+ const disconnect = async () => {
23
23
  if (walletService.hasProvider) {
24
24
  drop.current?.close();
25
25
  await walletService.disconnect();
@@ -28,9 +28,10 @@ export const EvmConnector = observer((props) => {
28
28
  setRecentMeta({ ...recentMeta, disconnected: true });
29
29
  }
30
30
  }
31
- }, [setRecentMeta, walletService]);
31
+ };
32
+ const isDisconnected = !walletService.isConnected || walletService.address === undefined;
32
33
  let subTitle = intl.formatMessage(messages.EVM_CONNECT_NOT_CONNECTED_HINT);
33
- if (walletService.isUnsupportedNetwork && walletService.isConnected) {
34
+ if (walletService.isUnsupportedNetwork && !isDisconnected) {
34
35
  subTitle = (React.createElement(Text, { color: "danger" }, intl.formatMessage(messages.EVM_CONNECT_UNSUPPORTED_NETWORK_WARNING)));
35
36
  }
36
37
  else if (walletService.isSyncing) {
@@ -46,11 +47,17 @@ export const EvmConnector = observer((props) => {
46
47
  if (walletService.providerInfo?.icon) {
47
48
  providerIcon = React.createElement(TokenIcon, { iconUrl: walletService.providerInfo.icon, size: 16 });
48
49
  }
50
+ if (walletService.isUnsupportedNetwork && !isDisconnected) {
51
+ networkIcon = React.createElement(Icon, { icon: "danger", ratio: 1.6 });
52
+ }
53
+ const networkName = network?.shortName ?? walletService.network?.shortName;
49
54
  return (React.createElement(Flex, { alignItems: "stretch", className: classNames('evm-connect-connector', className, walletService.providerId), component: Grid },
50
55
  React.createElement("div", null,
51
- React.createElement(WalletAccount, { address: walletService.address?.toString(), icon: networkIcon, subIcon: walletService.isConnected && showSubIcon ? providerIcon : undefined, subTitle: subTitle, title: !walletService.isConnected ? (intl.formatMessage(messages.EVM_CONNECT_CONNECTOR_BLOCKCHAIN_NAME)) : (React.createElement(ExplorerAccountLink, { address: walletService.address.toString(), baseUrl: walletService.network?.explorer.baseUrl, copyable: true, subPath: walletService.network?.explorer.accountsSubPath, tooltip: intl.formatMessage(messages.EVM_CONNECT_CONNECTOR_EXPLORER_HINT, {
52
- explorerTitle: walletService.network?.explorer.title ?? '',
53
- }) })) })),
56
+ React.createElement(WalletAccount, { address: walletService.address?.toString(), icon: networkIcon, subIcon: !isDisconnected && showSubIcon ? providerIcon : undefined, subTitle: subTitle, title: isDisconnected
57
+ ? networkName ?? intl.formatMessage(messages.EVM_CONNECT_CONNECTOR_BLOCKCHAIN_NAME)
58
+ : (React.createElement(ExplorerAccountLink, { address: walletService.address?.toString(), baseUrl: walletService.network?.explorer.baseUrl, copyable: true, subPath: walletService.network?.explorer.accountsSubPath, tooltip: intl.formatMessage(messages.EVM_CONNECT_CONNECTOR_EXPLORER_HINT, {
59
+ explorerTitle: walletService.network?.explorer.title ?? '',
60
+ }) })) })),
54
61
  React.createElement(Flex, { alignItems: "center", className: "evm-connect-connector-suffix" },
55
62
  suffix,
56
63
  walletService.isConnected && showDropMenu && (React.createElement(Dropdown, { ref: drop, action: "click", overlayClassName: "evm-connect-dropdown", overlay: (React.createElement(List, { className: "uk-margin-remove", size: "large" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@broxus/evm-connect",
3
- "version": "1.11.5",
3
+ "version": "1.11.7",
4
4
  "description": "Ethereum wallets connector.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -75,9 +75,9 @@
75
75
  "prepare": "npx yarn cleanup && npx yarn build"
76
76
  },
77
77
  "dependencies": {
78
- "@broxus/js-core": "^0.29.0",
78
+ "@broxus/js-core": "^0.30.1",
79
79
  "@broxus/js-utils": "^1.3.13",
80
- "@broxus/react-components": "^0.21.5",
80
+ "@broxus/react-components": "^0.21.7",
81
81
  "@broxus/react-uikit": "^0.17.4",
82
82
  "@metamask/detect-provider": "^2.0.0",
83
83
  "@walletconnect/ethereum-provider": "^2.17.2",
@@ -95,5 +95,5 @@
95
95
  "web3-types": "^1.x",
96
96
  "web3-utils": "^4.x"
97
97
  },
98
- "gitHead": "7a470e81de601261eab5d19953e6e10e028af21f"
98
+ "gitHead": "aceb05eca7fe64a675b3b1150a1e4f8a7570746d"
99
99
  }