@matchain/matchid-sdk-react 0.1.53-alpha.4 → 0.1.53-alpha.5

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.
@@ -1,3 +1,17 @@
1
+ import {
2
+ NumberFormatter,
3
+ bytesToBase64,
4
+ decodeBase64,
5
+ encodeBase64,
6
+ formatAddress,
7
+ formatDate,
8
+ getAppClientId,
9
+ getVersion,
10
+ isInTgApp,
11
+ isValidEmail,
12
+ isValidUsername,
13
+ truncateAddress
14
+ } from "./chunk-OCQ2AIM3.mjs";
1
15
  import {
2
16
  AlphaAvatar,
3
17
  Button,
@@ -61,20 +75,6 @@ import {
61
75
  XverseIcon,
62
76
  YoutubeIcon
63
77
  } from "./chunk-3USZ4ZZY.mjs";
64
- import {
65
- NumberFormatter,
66
- bytesToBase64,
67
- decodeBase64,
68
- encodeBase64,
69
- formatAddress,
70
- formatDate,
71
- getAppClientId,
72
- getVersion,
73
- isInTgApp,
74
- isValidEmail,
75
- isValidUsername,
76
- truncateAddress
77
- } from "./chunk-OCQ2AIM3.mjs";
78
78
  import {
79
79
  matchMain,
80
80
  matchTest
@@ -4724,7 +4724,7 @@ function UsernameModal({
4724
4724
  }
4725
4725
 
4726
4726
  // src/components/EVMModal/index.tsx
4727
- import { useCallback as useCallback6, useEffect as useEffect18 } from "react";
4727
+ import { useCallback as useCallback6, useEffect as useEffect18, useState as useState21 } from "react";
4728
4728
  import { useIntl as useIntl12 } from "react-intl";
4729
4729
 
4730
4730
  // src/components/WalletModalContent/index.tsx
@@ -5197,13 +5197,14 @@ function WalletContent({
5197
5197
  const { disconnectAsync } = useDisconnect({ config });
5198
5198
  const chainId = useChainId();
5199
5199
  const { events, login } = useMatch();
5200
+ const [inited, setInited] = useState21(false);
5200
5201
  const { status, setStatus, error, setError, statusRef, nonce, setNonce, init } = useWalletBox({
5201
5202
  onInit: async ({ setStatus: setStatus2 }) => {
5202
5203
  setStatus2("start");
5203
5204
  }
5204
5205
  });
5205
5206
  useEffect18(() => {
5206
- console.log(`status=${status}`, `connectModalOpen=${connectModalOpen}`, `address=${address}`, `isConnected=${isConnected}`);
5207
+ matchlog_default.log(`status=${status}`, `connectModalOpen=${connectModalOpen}`, `address=${address}`, `isConnected=${isConnected}`);
5207
5208
  }, [status, connectModalOpen, isConnected, address]);
5208
5209
  useEffect18(() => {
5209
5210
  if (connectModalOpen) {
@@ -5219,10 +5220,11 @@ function WalletContent({
5219
5220
  }
5220
5221
  }, [connectModalOpen, address]);
5221
5222
  useEffect18(() => {
5222
- if (openConnectModal && !address) {
5223
+ if (openConnectModal && !isConnected && !inited) {
5223
5224
  openConnectModal && openConnectModal();
5225
+ setInited(true);
5224
5226
  }
5225
- }, [openConnectModal]);
5227
+ }, [openConnectModal, inited]);
5226
5228
  const toLoginInWallet = async (address2) => {
5227
5229
  if (statusRef.current != "start" && statusRef.current != "connecting") return;
5228
5230
  try {
@@ -5319,13 +5321,25 @@ function WalletContent({
5319
5321
  openConnectModal?.();
5320
5322
  };
5321
5323
  const onConnect = async () => {
5322
- console.log("onConnect");
5324
+ if (isConnected) {
5325
+ try {
5326
+ await disconnectAsync();
5327
+ } catch (error2) {
5328
+ console.error("disconnectAsync", error2);
5329
+ }
5330
+ }
5323
5331
  setError("");
5324
5332
  setNonce(void 0);
5325
5333
  openConnectModal?.();
5326
5334
  };
5327
5335
  const onDisconnect = async () => {
5328
- await disconnectAsync();
5336
+ if (isConnected) {
5337
+ try {
5338
+ await disconnectAsync();
5339
+ } catch (error2) {
5340
+ console.error("disconnectAsync", error2);
5341
+ }
5342
+ }
5329
5343
  setError("");
5330
5344
  setNonce(void 0);
5331
5345
  setStatus("start");
@@ -6893,4 +6907,4 @@ export {
6893
6907
  MatchProvider,
6894
6908
  useMatch
6895
6909
  };
6896
- //# sourceMappingURL=chunk-XXZZYALJ.mjs.map
6910
+ //# sourceMappingURL=chunk-LEHYGXVJ.mjs.map