@matchain/matchid-sdk-react 0.1.56-alpha.2 → 0.1.56-alpha.3
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/api.js +1 -1
- package/dist/api.js.map +1 -1
- package/dist/api.mjs +2 -2
- package/dist/{chunk-NIGHV7RT.mjs → chunk-KDVKIXOS.mjs} +89 -83
- package/dist/chunk-KDVKIXOS.mjs.map +1 -0
- package/dist/{chunk-SPVA3A6Z.mjs → chunk-M5LCJX2T.mjs} +2 -2
- package/dist/components.js +1 -1
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +1 -1
- package/dist/hooks.js +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/ui.js +1 -1
- package/dist/ui.js.map +1 -1
- package/dist/ui.mjs +1 -1
- package/example/src/pages/UI/components/Modal.tsx +38 -0
- package/example/src/pages/UI/index.tsx +2 -0
- package/package.json +1 -1
- package/dist/chunk-NIGHV7RT.mjs.map +0 -1
- /package/dist/{chunk-SPVA3A6Z.mjs.map → chunk-M5LCJX2T.mjs.map} +0 -0
package/dist/api.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
bind_exports,
|
|
3
3
|
poh_exports,
|
|
4
4
|
user_exports
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-M5LCJX2T.mjs";
|
|
6
6
|
import {
|
|
7
7
|
isSuccess,
|
|
8
8
|
wallet_exports
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KDVKIXOS.mjs";
|
|
10
10
|
import "./chunk-JX73EY6V.mjs";
|
|
11
11
|
import "./chunk-UA6XHZHX.mjs";
|
|
12
12
|
import "./chunk-IZOOVZAD.mjs";
|
|
@@ -107,7 +107,7 @@ __export(components_exports, {
|
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
// src/components/EmailModal/index.tsx
|
|
110
|
-
import { useEffect as
|
|
110
|
+
import { useEffect as useEffect20, useState as useState19 } from "react";
|
|
111
111
|
|
|
112
112
|
// src/ui/Modal/index.tsx
|
|
113
113
|
import { useEffect as useEffect3, useState as useState2 } from "react";
|
|
@@ -944,11 +944,11 @@ var useStore_default = useStore;
|
|
|
944
944
|
// src/hooks/useWallet.tsx
|
|
945
945
|
import { toAccount } from "viem/accounts";
|
|
946
946
|
import { createWalletClient } from "viem";
|
|
947
|
-
import { useEffect as
|
|
947
|
+
import { useEffect as useEffect8, useMemo as useMemo3 } from "react";
|
|
948
948
|
import { encodeDeployData } from "viem";
|
|
949
949
|
|
|
950
950
|
// src/context/ModalContext.tsx
|
|
951
|
-
import
|
|
951
|
+
import { useState as useState7, useCallback, createContext, useContext, useEffect as useEffect7, useRef } from "react";
|
|
952
952
|
import { createPortal } from "react-dom";
|
|
953
953
|
|
|
954
954
|
// src/ui/index.ts
|
|
@@ -1316,18 +1316,24 @@ function ModalProvider({ children }) {
|
|
|
1316
1316
|
modals: [],
|
|
1317
1317
|
highestZIndex: 100
|
|
1318
1318
|
});
|
|
1319
|
+
const highestIndexRef = useRef(100);
|
|
1319
1320
|
const getNextIndex = useCallback(() => {
|
|
1320
|
-
|
|
1321
|
-
|
|
1321
|
+
highestIndexRef.current += 1;
|
|
1322
|
+
return highestIndexRef.current;
|
|
1323
|
+
}, []);
|
|
1322
1324
|
const closeModal = useCallback((index) => {
|
|
1325
|
+
console.log("closeModal", index);
|
|
1323
1326
|
setModalState((prevState) => ({
|
|
1324
1327
|
modals: prevState.modals.filter((modal) => modal.index !== index),
|
|
1325
1328
|
highestZIndex: prevState.highestZIndex
|
|
1326
1329
|
}));
|
|
1327
1330
|
}, []);
|
|
1331
|
+
useEffect7(() => {
|
|
1332
|
+
console.log("modalState", modalState);
|
|
1333
|
+
}, [modalState]);
|
|
1328
1334
|
const show = useCallback((content, index) => {
|
|
1329
1335
|
setModalState((prevState) => {
|
|
1330
|
-
const modalIndex = index
|
|
1336
|
+
const modalIndex = index ?? getNextIndex();
|
|
1331
1337
|
const newZIndex = prevState.highestZIndex + 1;
|
|
1332
1338
|
return {
|
|
1333
1339
|
modals: [...prevState.modals, {
|
|
@@ -1343,7 +1349,7 @@ function ModalProvider({ children }) {
|
|
|
1343
1349
|
}, [getNextIndex, closeModal]);
|
|
1344
1350
|
const open = useCallback((props) => {
|
|
1345
1351
|
setModalState((prevState) => {
|
|
1346
|
-
const modalIndex = props.index
|
|
1352
|
+
const modalIndex = props.index ?? getNextIndex();
|
|
1347
1353
|
const newZIndex = prevState.highestZIndex + 1;
|
|
1348
1354
|
return {
|
|
1349
1355
|
modals: [...prevState.modals, {
|
|
@@ -1357,9 +1363,9 @@ function ModalProvider({ children }) {
|
|
|
1357
1363
|
};
|
|
1358
1364
|
});
|
|
1359
1365
|
}, [getNextIndex, closeModal]);
|
|
1360
|
-
const modalElements = modalState.modals.
|
|
1366
|
+
const modalElements = modalState.modals.map(
|
|
1361
1367
|
(modal) => modal.visible ? createPortal(
|
|
1362
|
-
|
|
1368
|
+
/* @__PURE__ */ jsx16(modal.content, { zIndex: modal.zIndex, close: modal.close }, modal.index),
|
|
1363
1369
|
document.body
|
|
1364
1370
|
) : null
|
|
1365
1371
|
);
|
|
@@ -1497,7 +1503,7 @@ function useWallet() {
|
|
|
1497
1503
|
return void 0;
|
|
1498
1504
|
}
|
|
1499
1505
|
}, [address]);
|
|
1500
|
-
|
|
1506
|
+
useEffect8(() => {
|
|
1501
1507
|
matchlog_default.log("qwe-evmAccount", evmAccount);
|
|
1502
1508
|
}, [evmAccount]);
|
|
1503
1509
|
const realCreateWalletClient = (parameters) => {
|
|
@@ -1640,14 +1646,14 @@ function useWallet() {
|
|
|
1640
1646
|
|
|
1641
1647
|
// src/hooks/useCopyClipboard.ts
|
|
1642
1648
|
import copy from "copy-to-clipboard";
|
|
1643
|
-
import { useCallback as useCallback2, useEffect as
|
|
1649
|
+
import { useCallback as useCallback2, useEffect as useEffect9, useState as useState9 } from "react";
|
|
1644
1650
|
function useCopyClipboard(timeout = 500) {
|
|
1645
1651
|
const [isCopied, setIsCopied] = useState9(false);
|
|
1646
1652
|
const staticCopy = useCallback2((text) => {
|
|
1647
1653
|
const didCopy = copy(text);
|
|
1648
1654
|
setIsCopied(didCopy);
|
|
1649
1655
|
}, []);
|
|
1650
|
-
|
|
1656
|
+
useEffect9(() => {
|
|
1651
1657
|
if (isCopied) {
|
|
1652
1658
|
const hide = setTimeout(() => {
|
|
1653
1659
|
setIsCopied(false);
|
|
@@ -1932,7 +1938,7 @@ function useMatchChain() {
|
|
|
1932
1938
|
|
|
1933
1939
|
// src/hooks/useMatchWallet.tsx
|
|
1934
1940
|
import { QRCode } from "react-qrcode";
|
|
1935
|
-
import { useEffect as
|
|
1941
|
+
import { useEffect as useEffect12, useMemo as useMemo6, useRef as useRef2, useState as useState13 } from "react";
|
|
1936
1942
|
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
1937
1943
|
|
|
1938
1944
|
// src/config/index.tsx
|
|
@@ -2003,7 +2009,7 @@ var useContractStore_default = useContractStore;
|
|
|
2003
2009
|
import { FormattedMessage as FormattedMessage4, useIntl as useIntl5 } from "react-intl";
|
|
2004
2010
|
|
|
2005
2011
|
// src/components/ImportToken/index.tsx
|
|
2006
|
-
import { useEffect as
|
|
2012
|
+
import { useEffect as useEffect11, useMemo as useMemo5, useState as useState12 } from "react";
|
|
2007
2013
|
import { FormattedMessage as FormattedMessage3, useIntl as useIntl4 } from "react-intl";
|
|
2008
2014
|
import { useQueryClient } from "@tanstack/react-query";
|
|
2009
2015
|
import { defineChain, erc20Abi } from "viem";
|
|
@@ -2074,7 +2080,7 @@ function ImportToken({ close }) {
|
|
|
2074
2080
|
}
|
|
2075
2081
|
};
|
|
2076
2082
|
const intl = useIntl4();
|
|
2077
|
-
|
|
2083
|
+
useEffect11(() => {
|
|
2078
2084
|
if (address.length === 42) {
|
|
2079
2085
|
const reg = /^0x[0-9a-fA-F]{40}$/;
|
|
2080
2086
|
if (!reg.test(address)) {
|
|
@@ -2294,8 +2300,8 @@ function useMatchWalletRecords() {
|
|
|
2294
2300
|
const [items, setItems] = useState13([]);
|
|
2295
2301
|
const { chainId, publicClient } = useMatchChain();
|
|
2296
2302
|
const { address } = useWallet();
|
|
2297
|
-
const hasMoreRef =
|
|
2298
|
-
const nextPageParamsRef =
|
|
2303
|
+
const hasMoreRef = useRef2(hasMore);
|
|
2304
|
+
const nextPageParamsRef = useRef2(void 0);
|
|
2299
2305
|
const { contracts, setContracts } = useContractStore_default();
|
|
2300
2306
|
const fetchMoreData = async () => {
|
|
2301
2307
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
@@ -2322,7 +2328,7 @@ function useMatchWalletRecords() {
|
|
|
2322
2328
|
hasMoreRef.current = true;
|
|
2323
2329
|
fetchMoreData();
|
|
2324
2330
|
};
|
|
2325
|
-
|
|
2331
|
+
useEffect12(() => {
|
|
2326
2332
|
if (chainId && address) {
|
|
2327
2333
|
onInit();
|
|
2328
2334
|
}
|
|
@@ -2557,7 +2563,7 @@ function useMatchWalletAssetList({
|
|
|
2557
2563
|
return { ...asset, balance, value, balanceValue };
|
|
2558
2564
|
});
|
|
2559
2565
|
}, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
|
|
2560
|
-
|
|
2566
|
+
useEffect12(() => {
|
|
2561
2567
|
const list2 = enrichedAssets.sort((a, b) => {
|
|
2562
2568
|
if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
|
|
2563
2569
|
if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
|
|
@@ -2582,7 +2588,7 @@ function useMatchWalletAssetList({
|
|
|
2582
2588
|
}
|
|
2583
2589
|
|
|
2584
2590
|
// src/hooks/useReceipt.tsx
|
|
2585
|
-
import { useState as useState14, useCallback as useCallback4, useEffect as
|
|
2591
|
+
import { useState as useState14, useCallback as useCallback4, useEffect as useEffect13 } from "react";
|
|
2586
2592
|
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
2587
2593
|
import { createPublicClient as createPublicClient5, defineChain as defineChain2, http as http5 } from "viem";
|
|
2588
2594
|
var CACHE_TTL = 86400 * 30 * 1e3;
|
|
@@ -2600,7 +2606,7 @@ function useReceiptCache() {
|
|
|
2600
2606
|
return false;
|
|
2601
2607
|
}
|
|
2602
2608
|
})();
|
|
2603
|
-
|
|
2609
|
+
useEffect13(() => {
|
|
2604
2610
|
if (isLocalStorageAvailable) {
|
|
2605
2611
|
try {
|
|
2606
2612
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -2717,7 +2723,7 @@ function useReceipt({
|
|
|
2717
2723
|
},
|
|
2718
2724
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
2719
2725
|
});
|
|
2720
|
-
|
|
2726
|
+
useEffect13(() => {
|
|
2721
2727
|
if (query.data) {
|
|
2722
2728
|
setShouldRefetch(false);
|
|
2723
2729
|
}
|
|
@@ -2726,7 +2732,7 @@ function useReceipt({
|
|
|
2726
2732
|
}
|
|
2727
2733
|
|
|
2728
2734
|
// src/hooks/useTransaction.tsx
|
|
2729
|
-
import { useState as useState15, useCallback as useCallback5, useEffect as
|
|
2735
|
+
import { useState as useState15, useCallback as useCallback5, useEffect as useEffect14 } from "react";
|
|
2730
2736
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
2731
2737
|
import { createPublicClient as createPublicClient6, defineChain as defineChain3, http as http6 } from "viem";
|
|
2732
2738
|
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
@@ -2744,7 +2750,7 @@ function useTransactionCache() {
|
|
|
2744
2750
|
return false;
|
|
2745
2751
|
}
|
|
2746
2752
|
})();
|
|
2747
|
-
|
|
2753
|
+
useEffect14(() => {
|
|
2748
2754
|
if (isLocalStorageAvailable) {
|
|
2749
2755
|
try {
|
|
2750
2756
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -2861,7 +2867,7 @@ function useTransaction({
|
|
|
2861
2867
|
},
|
|
2862
2868
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
2863
2869
|
});
|
|
2864
|
-
|
|
2870
|
+
useEffect14(() => {
|
|
2865
2871
|
if (query.data) {
|
|
2866
2872
|
setShouldRefetch(false);
|
|
2867
2873
|
}
|
|
@@ -2955,7 +2961,7 @@ var useWalletModalStore = create5((set) => ({
|
|
|
2955
2961
|
}));
|
|
2956
2962
|
|
|
2957
2963
|
// src/components/CEXBindModal/index.tsx
|
|
2958
|
-
import { useEffect as
|
|
2964
|
+
import { useEffect as useEffect15, useMemo as useMemo7, useState as useState16 } from "react";
|
|
2959
2965
|
import { FormattedMessage as FormattedMessage5, useIntl as useIntl6 } from "react-intl";
|
|
2960
2966
|
import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2961
2967
|
function CEXBindModal({
|
|
@@ -2975,7 +2981,7 @@ function CEXBindModal({
|
|
|
2975
2981
|
const needPassphrase = useMemo7(() => {
|
|
2976
2982
|
return ["bitget", "okx"].includes(type.toLowerCase());
|
|
2977
2983
|
}, [type]);
|
|
2978
|
-
|
|
2984
|
+
useEffect15(() => {
|
|
2979
2985
|
if (isOpen) {
|
|
2980
2986
|
setSecret("");
|
|
2981
2987
|
setKey("");
|
|
@@ -3175,7 +3181,7 @@ var Providers = ({ children }) => {
|
|
|
3175
3181
|
var context_default = Providers;
|
|
3176
3182
|
|
|
3177
3183
|
// src/hooks/useWalletInit.ts
|
|
3178
|
-
import { useEffect as
|
|
3184
|
+
import { useEffect as useEffect16, useRef as useRef3 } from "react";
|
|
3179
3185
|
|
|
3180
3186
|
// src/utils/wallet.ts
|
|
3181
3187
|
var sendMessage = ({ method, data, resolve, reject, timeout }) => {
|
|
@@ -3208,11 +3214,11 @@ function useWalletInit({
|
|
|
3208
3214
|
}) {
|
|
3209
3215
|
const { endpoints, token, setWallet, appid, refreshOverview } = useLocalStore_default();
|
|
3210
3216
|
const { setWalletReady, walletReady } = useStore_default();
|
|
3211
|
-
const iframeReadyRef =
|
|
3212
|
-
|
|
3217
|
+
const iframeReadyRef = useRef3(walletReady);
|
|
3218
|
+
useEffect16(() => {
|
|
3213
3219
|
setWallet(config);
|
|
3214
3220
|
}, [config]);
|
|
3215
|
-
|
|
3221
|
+
useEffect16(() => {
|
|
3216
3222
|
matchlog_default.log("sdk.mpc.status", walletReady, iframeReadyRef.current);
|
|
3217
3223
|
iframeReadyRef.current = walletReady;
|
|
3218
3224
|
if (iframeReadyRef.current) {
|
|
@@ -3229,7 +3235,7 @@ function useWalletInit({
|
|
|
3229
3235
|
onReady();
|
|
3230
3236
|
}
|
|
3231
3237
|
}, [walletReady]);
|
|
3232
|
-
|
|
3238
|
+
useEffect16(() => {
|
|
3233
3239
|
if (!endpoints.auth || !appid || !token || !config) {
|
|
3234
3240
|
const existingIframe = getWalletIframe();
|
|
3235
3241
|
if (existingIframe) {
|
|
@@ -3329,7 +3335,7 @@ function useWalletInit({
|
|
|
3329
3335
|
}
|
|
3330
3336
|
}
|
|
3331
3337
|
}, [endpoints.auth, appid, token, config]);
|
|
3332
|
-
|
|
3338
|
+
useEffect16(() => {
|
|
3333
3339
|
const messageHandle = async (e) => {
|
|
3334
3340
|
if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
|
|
3335
3341
|
return;
|
|
@@ -3410,7 +3416,7 @@ function useWalletInit({
|
|
|
3410
3416
|
}
|
|
3411
3417
|
|
|
3412
3418
|
// src/hooks/useInit.tsx
|
|
3413
|
-
import { useEffect as
|
|
3419
|
+
import { useEffect as useEffect17, useRef as useRef4 } from "react";
|
|
3414
3420
|
function useInit({
|
|
3415
3421
|
theme,
|
|
3416
3422
|
appid,
|
|
@@ -3430,24 +3436,24 @@ function useInit({
|
|
|
3430
3436
|
locale: realLocale
|
|
3431
3437
|
} = useLocalStore_default();
|
|
3432
3438
|
const walletModalStore = useWalletModalStore();
|
|
3433
|
-
const overviewLoadingRef =
|
|
3439
|
+
const overviewLoadingRef = useRef4(false);
|
|
3434
3440
|
const searchParams = new URLSearchParams(window.location.search);
|
|
3435
3441
|
const matchToken = searchParams.get("matchToken");
|
|
3436
3442
|
const matchidt = searchParams.get("matchidt");
|
|
3437
3443
|
const realEndpoints = endpoints || env_default.endpoints;
|
|
3438
|
-
|
|
3444
|
+
useEffect17(() => {
|
|
3439
3445
|
setTheme(theme);
|
|
3440
3446
|
}, [theme]);
|
|
3441
|
-
|
|
3447
|
+
useEffect17(() => {
|
|
3442
3448
|
setAppid(appid);
|
|
3443
3449
|
}, [appid]);
|
|
3444
|
-
|
|
3450
|
+
useEffect17(() => {
|
|
3445
3451
|
setEndpoints(realEndpoints);
|
|
3446
3452
|
}, [realEndpoints]);
|
|
3447
|
-
|
|
3453
|
+
useEffect17(() => {
|
|
3448
3454
|
setLocale(locale || "en");
|
|
3449
3455
|
}, [locale]);
|
|
3450
|
-
|
|
3456
|
+
useEffect17(() => {
|
|
3451
3457
|
if (matchToken) {
|
|
3452
3458
|
const tokenData = JSON.parse(atob(matchToken));
|
|
3453
3459
|
if (tokenData && tokenData.mid && tokenData.token) {
|
|
@@ -3458,7 +3464,7 @@ function useInit({
|
|
|
3458
3464
|
}
|
|
3459
3465
|
}
|
|
3460
3466
|
}, [matchToken]);
|
|
3461
|
-
|
|
3467
|
+
useEffect17(() => {
|
|
3462
3468
|
if (matchidt) {
|
|
3463
3469
|
const tokenData = decodeURIComponent(matchidt);
|
|
3464
3470
|
const data = JSON.parse(decodeBase64(tokenData));
|
|
@@ -3488,7 +3494,7 @@ function useInit({
|
|
|
3488
3494
|
}
|
|
3489
3495
|
}
|
|
3490
3496
|
}, [matchidt]);
|
|
3491
|
-
|
|
3497
|
+
useEffect17(() => {
|
|
3492
3498
|
const onLoginMessage = (event) => {
|
|
3493
3499
|
const res = event.data;
|
|
3494
3500
|
if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
|
|
@@ -3525,7 +3531,7 @@ function useInit({
|
|
|
3525
3531
|
overviewLoadingRef.current = false;
|
|
3526
3532
|
}
|
|
3527
3533
|
};
|
|
3528
|
-
|
|
3534
|
+
useEffect17(() => {
|
|
3529
3535
|
if (token) {
|
|
3530
3536
|
loadOverview();
|
|
3531
3537
|
}
|
|
@@ -4734,7 +4740,7 @@ function useUserInfo() {
|
|
|
4734
4740
|
}
|
|
4735
4741
|
|
|
4736
4742
|
// src/components/EmailModal/StepVerify.tsx
|
|
4737
|
-
import { useEffect as
|
|
4743
|
+
import { useEffect as useEffect19, useMemo as useMemo9, useRef as useRef5, useState as useState18 } from "react";
|
|
4738
4744
|
import { FormattedMessage as FormattedMessage6, useIntl as useIntl7 } from "react-intl";
|
|
4739
4745
|
import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4740
4746
|
function StepVerify(props) {
|
|
@@ -4744,13 +4750,13 @@ function StepVerify(props) {
|
|
|
4744
4750
|
const [code, setCode] = useState18("");
|
|
4745
4751
|
const [sending, setSending] = useState18(false);
|
|
4746
4752
|
const [submitting, setSubmitting] = useState18(false);
|
|
4747
|
-
const sendTimeRef =
|
|
4753
|
+
const sendTimeRef = useRef5(0);
|
|
4748
4754
|
const [sendBtnText, setSendBtnText] = useState18(intl.formatMessage({
|
|
4749
4755
|
id: "send"
|
|
4750
4756
|
}));
|
|
4751
4757
|
const intervalTime = EMAIL_INTERVAL;
|
|
4752
4758
|
const codeLength = EMAIL_CODE_LENGTH;
|
|
4753
|
-
const intervalRef =
|
|
4759
|
+
const intervalRef = useRef5(null);
|
|
4754
4760
|
const isDownMd = useDownMd();
|
|
4755
4761
|
const onSend = async () => {
|
|
4756
4762
|
if (sendTimeRef.current > 0) {
|
|
@@ -4781,7 +4787,7 @@ function StepVerify(props) {
|
|
|
4781
4787
|
setSending(false);
|
|
4782
4788
|
}
|
|
4783
4789
|
};
|
|
4784
|
-
|
|
4790
|
+
useEffect19(() => {
|
|
4785
4791
|
onSend();
|
|
4786
4792
|
return () => {
|
|
4787
4793
|
if (intervalRef.current) {
|
|
@@ -4869,7 +4875,7 @@ function EmailModal({
|
|
|
4869
4875
|
const [step, setStep] = useState19("input");
|
|
4870
4876
|
const [emailVal, setEmailVal] = useState19("");
|
|
4871
4877
|
const intl = useIntl8();
|
|
4872
|
-
|
|
4878
|
+
useEffect20(() => {
|
|
4873
4879
|
if (!isOpen) {
|
|
4874
4880
|
setStep("input");
|
|
4875
4881
|
setEmailVal("");
|
|
@@ -5335,7 +5341,7 @@ function LoginButton({
|
|
|
5335
5341
|
}
|
|
5336
5342
|
|
|
5337
5343
|
// src/components/UsernameModal/index.tsx
|
|
5338
|
-
import { useEffect as
|
|
5344
|
+
import { useEffect as useEffect21, useMemo as useMemo11, useState as useState23 } from "react";
|
|
5339
5345
|
import { FormattedMessage as FormattedMessage11, useIntl as useIntl12 } from "react-intl";
|
|
5340
5346
|
import { jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5341
5347
|
var ValidItem = ({
|
|
@@ -5359,7 +5365,7 @@ function UsernameModal({
|
|
|
5359
5365
|
const [val, setVal] = useState23(username);
|
|
5360
5366
|
const [error, setError] = useState23("");
|
|
5361
5367
|
const isDownMd = useDownMd();
|
|
5362
|
-
|
|
5368
|
+
useEffect21(() => {
|
|
5363
5369
|
if (isOpen) {
|
|
5364
5370
|
setVal(username);
|
|
5365
5371
|
setError("");
|
|
@@ -5435,7 +5441,7 @@ function UsernameModal({
|
|
|
5435
5441
|
}
|
|
5436
5442
|
|
|
5437
5443
|
// src/components/EVMModal/index.tsx
|
|
5438
|
-
import { useCallback as useCallback6, useEffect as
|
|
5444
|
+
import { useCallback as useCallback6, useEffect as useEffect23, useState as useState26 } from "react";
|
|
5439
5445
|
import { useIntl as useIntl13 } from "react-intl";
|
|
5440
5446
|
|
|
5441
5447
|
// src/components/WalletModalContent/index.tsx
|
|
@@ -5630,13 +5636,13 @@ import { RainbowKitProvider as RainbowKitProvider2, useConnectModal } from "@rai
|
|
|
5630
5636
|
import { useAccount, useChainId, useConfig, useDisconnect } from "wagmi";
|
|
5631
5637
|
|
|
5632
5638
|
// src/hooks/useWalletBox.ts
|
|
5633
|
-
import { useEffect as
|
|
5639
|
+
import { useEffect as useEffect22, useRef as useRef6, useState as useState25 } from "react";
|
|
5634
5640
|
function useWalletBox({
|
|
5635
5641
|
onInit
|
|
5636
5642
|
}) {
|
|
5637
5643
|
const [status, setStateStatus] = useState25("start");
|
|
5638
5644
|
const [error, setError] = useState25("");
|
|
5639
|
-
const statusRef =
|
|
5645
|
+
const statusRef = useRef6(status);
|
|
5640
5646
|
const [nonce, setNonce] = useState25();
|
|
5641
5647
|
const setStatus = (status2) => {
|
|
5642
5648
|
statusRef.current = status2;
|
|
@@ -5646,7 +5652,7 @@ function useWalletBox({
|
|
|
5646
5652
|
setError("");
|
|
5647
5653
|
setNonce(null);
|
|
5648
5654
|
};
|
|
5649
|
-
|
|
5655
|
+
useEffect22(() => {
|
|
5650
5656
|
init();
|
|
5651
5657
|
onInit({
|
|
5652
5658
|
setStatus
|
|
@@ -5910,10 +5916,10 @@ function WalletContent({
|
|
|
5910
5916
|
setStatus2("start");
|
|
5911
5917
|
}
|
|
5912
5918
|
});
|
|
5913
|
-
|
|
5919
|
+
useEffect23(() => {
|
|
5914
5920
|
matchlog_default.log(`status=${status}`, `connectModalOpen=${connectModalOpen}`, `address=${address}`, `isConnected=${isConnected}`);
|
|
5915
5921
|
}, [status, connectModalOpen, isConnected, address]);
|
|
5916
|
-
|
|
5922
|
+
useEffect23(() => {
|
|
5917
5923
|
if (connectModalOpen) {
|
|
5918
5924
|
setStatus("connecting");
|
|
5919
5925
|
return;
|
|
@@ -5926,7 +5932,7 @@ function WalletContent({
|
|
|
5926
5932
|
setStatus("start");
|
|
5927
5933
|
}
|
|
5928
5934
|
}, [connectModalOpen, address]);
|
|
5929
|
-
|
|
5935
|
+
useEffect23(() => {
|
|
5930
5936
|
if (openConnectModal && !isConnected && !inited) {
|
|
5931
5937
|
openConnectModal && openConnectModal();
|
|
5932
5938
|
setInited(true);
|
|
@@ -6009,7 +6015,7 @@ function WalletContent({
|
|
|
6009
6015
|
setError(error2.reason || error2.message);
|
|
6010
6016
|
}
|
|
6011
6017
|
}, [nonce, status, address]);
|
|
6012
|
-
|
|
6018
|
+
useEffect23(() => {
|
|
6013
6019
|
if (signature) {
|
|
6014
6020
|
signature();
|
|
6015
6021
|
}
|
|
@@ -6080,7 +6086,7 @@ function EVMModal(props) {
|
|
|
6080
6086
|
}
|
|
6081
6087
|
|
|
6082
6088
|
// src/components/TRONModal/index.tsx
|
|
6083
|
-
import React11, { useEffect as
|
|
6089
|
+
import React11, { useEffect as useEffect25, useMemo as useMemo14, useState as useState28 } from "react";
|
|
6084
6090
|
import { useIntl as useIntl14 } from "react-intl";
|
|
6085
6091
|
|
|
6086
6092
|
// src/lib/tron/TronLinkAdapter.ts
|
|
@@ -6114,7 +6120,7 @@ var TronLinkAdapter = class {
|
|
|
6114
6120
|
};
|
|
6115
6121
|
|
|
6116
6122
|
// src/hooks/useTRONWallet.ts
|
|
6117
|
-
import { useEffect as
|
|
6123
|
+
import { useEffect as useEffect24, useState as useState27 } from "react";
|
|
6118
6124
|
|
|
6119
6125
|
// src/lib/tron/BitgetAdapter.ts
|
|
6120
6126
|
var BitgetAdapter = class {
|
|
@@ -6161,7 +6167,7 @@ var useTRONWallet = () => {
|
|
|
6161
6167
|
const wallets = [new TronLinkAdapter(), new BitgetAdapter(), new OKXAdapter()];
|
|
6162
6168
|
const [installedWallets, setInstalledWallets] = useState27([]);
|
|
6163
6169
|
const [address, setAddress] = useState27(null);
|
|
6164
|
-
|
|
6170
|
+
useEffect24(() => {
|
|
6165
6171
|
const getInstalled = async () => {
|
|
6166
6172
|
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
6167
6173
|
wallet: wallet2,
|
|
@@ -6175,7 +6181,7 @@ var useTRONWallet = () => {
|
|
|
6175
6181
|
const onConnect = async () => {
|
|
6176
6182
|
setAddress(await wallet.connect());
|
|
6177
6183
|
};
|
|
6178
|
-
|
|
6184
|
+
useEffect24(() => {
|
|
6179
6185
|
if (!wallet) {
|
|
6180
6186
|
setAddress(null);
|
|
6181
6187
|
}
|
|
@@ -6277,7 +6283,7 @@ function TRONConnectModal({
|
|
|
6277
6283
|
statusRef.current = "";
|
|
6278
6284
|
}
|
|
6279
6285
|
};
|
|
6280
|
-
|
|
6286
|
+
useEffect25(() => {
|
|
6281
6287
|
if (wallet) {
|
|
6282
6288
|
console.log("onConnect");
|
|
6283
6289
|
onConnect();
|
|
@@ -6285,12 +6291,12 @@ function TRONConnectModal({
|
|
|
6285
6291
|
setStatus("");
|
|
6286
6292
|
}
|
|
6287
6293
|
}, [wallet]);
|
|
6288
|
-
|
|
6294
|
+
useEffect25(() => {
|
|
6289
6295
|
if (address) {
|
|
6290
6296
|
toLoginInWallet();
|
|
6291
6297
|
}
|
|
6292
6298
|
}, [address]);
|
|
6293
|
-
|
|
6299
|
+
useEffect25(() => {
|
|
6294
6300
|
if (!props.isOpen) {
|
|
6295
6301
|
disconnect();
|
|
6296
6302
|
}
|
|
@@ -6348,7 +6354,7 @@ function TRONModal(props) {
|
|
|
6348
6354
|
}
|
|
6349
6355
|
|
|
6350
6356
|
// src/components/TONModal/index.tsx
|
|
6351
|
-
import React12, { useEffect as
|
|
6357
|
+
import React12, { useEffect as useEffect26, useState as useState29 } from "react";
|
|
6352
6358
|
import { useIntl as useIntl15 } from "react-intl";
|
|
6353
6359
|
import {
|
|
6354
6360
|
TonConnectUIProvider,
|
|
@@ -6371,7 +6377,7 @@ function WalletContent2({
|
|
|
6371
6377
|
const [status, setStatus] = useState29("");
|
|
6372
6378
|
const statusRef = React12.useRef(status);
|
|
6373
6379
|
const [error, setError] = useState29("");
|
|
6374
|
-
|
|
6380
|
+
useEffect26(() => {
|
|
6375
6381
|
const init = async () => {
|
|
6376
6382
|
if (tonConnectUI.connected) {
|
|
6377
6383
|
await tonConnectUI.disconnect();
|
|
@@ -6444,7 +6450,7 @@ function WalletContent2({
|
|
|
6444
6450
|
}
|
|
6445
6451
|
});
|
|
6446
6452
|
}, []);
|
|
6447
|
-
|
|
6453
|
+
useEffect26(() => {
|
|
6448
6454
|
if (wallet) {
|
|
6449
6455
|
setConnected(true);
|
|
6450
6456
|
console.log("Wallet connected:", wallet);
|
|
@@ -6455,7 +6461,7 @@ function WalletContent2({
|
|
|
6455
6461
|
setStatus("");
|
|
6456
6462
|
}
|
|
6457
6463
|
}, [wallet]);
|
|
6458
|
-
|
|
6464
|
+
useEffect26(() => {
|
|
6459
6465
|
console.log({
|
|
6460
6466
|
state,
|
|
6461
6467
|
wallet
|
|
@@ -6535,7 +6541,7 @@ function TONModal(props) {
|
|
|
6535
6541
|
}
|
|
6536
6542
|
|
|
6537
6543
|
// src/components/BTCModal/index.tsx
|
|
6538
|
-
import React13, { useEffect as
|
|
6544
|
+
import React13, { useEffect as useEffect28, useMemo as useMemo15, useState as useState31 } from "react";
|
|
6539
6545
|
import { useIntl as useIntl16 } from "react-intl";
|
|
6540
6546
|
|
|
6541
6547
|
// src/lib/btc/UnisatAdapter.ts
|
|
@@ -6690,7 +6696,7 @@ var LeatherAdapter = class {
|
|
|
6690
6696
|
};
|
|
6691
6697
|
|
|
6692
6698
|
// src/hooks/useBTCWallet.ts
|
|
6693
|
-
import { useEffect as
|
|
6699
|
+
import { useEffect as useEffect27, useState as useState30 } from "react";
|
|
6694
6700
|
|
|
6695
6701
|
// src/lib/btc/PhantomAdapter.ts
|
|
6696
6702
|
var PhantomAdapter = class {
|
|
@@ -6730,7 +6736,7 @@ var useBTCWallet = () => {
|
|
|
6730
6736
|
const wallets = [new UnisatAdapter(), new XverseAdapter(), new LeatherAdapter(), new PhantomAdapter()];
|
|
6731
6737
|
const [installedWallets, setInstalledWallets] = useState30([]);
|
|
6732
6738
|
const [address, setAddress] = useState30(null);
|
|
6733
|
-
|
|
6739
|
+
useEffect27(() => {
|
|
6734
6740
|
const getInstalled = async () => {
|
|
6735
6741
|
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
6736
6742
|
wallet: wallet2,
|
|
@@ -6744,7 +6750,7 @@ var useBTCWallet = () => {
|
|
|
6744
6750
|
const onConnect = async () => {
|
|
6745
6751
|
setAddress(await wallet.connect());
|
|
6746
6752
|
};
|
|
6747
|
-
|
|
6753
|
+
useEffect27(() => {
|
|
6748
6754
|
if (!wallet) {
|
|
6749
6755
|
setAddress(null);
|
|
6750
6756
|
}
|
|
@@ -6843,7 +6849,7 @@ function BTCConnectModal({
|
|
|
6843
6849
|
statusRef.current = "";
|
|
6844
6850
|
}
|
|
6845
6851
|
};
|
|
6846
|
-
|
|
6852
|
+
useEffect28(() => {
|
|
6847
6853
|
if (wallet) {
|
|
6848
6854
|
console.log("onConnect");
|
|
6849
6855
|
try {
|
|
@@ -6856,12 +6862,12 @@ function BTCConnectModal({
|
|
|
6856
6862
|
setStatus("");
|
|
6857
6863
|
}
|
|
6858
6864
|
}, [wallet]);
|
|
6859
|
-
|
|
6865
|
+
useEffect28(() => {
|
|
6860
6866
|
if (address) {
|
|
6861
6867
|
toLoginInWallet();
|
|
6862
6868
|
}
|
|
6863
6869
|
}, [address]);
|
|
6864
|
-
|
|
6870
|
+
useEffect28(() => {
|
|
6865
6871
|
if (!props.isOpen) {
|
|
6866
6872
|
disconnect();
|
|
6867
6873
|
}
|
|
@@ -6970,11 +6976,11 @@ function WalletModal(props) {
|
|
|
6970
6976
|
}
|
|
6971
6977
|
|
|
6972
6978
|
// src/components/AlphaAvatar/index.tsx
|
|
6973
|
-
import { useEffect as
|
|
6979
|
+
import { useEffect as useEffect29, useState as useState32 } from "react";
|
|
6974
6980
|
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
6975
6981
|
function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
6976
6982
|
const [avatar, setAvatar] = useState32(void 0);
|
|
6977
|
-
|
|
6983
|
+
useEffect29(() => {
|
|
6978
6984
|
if (name) {
|
|
6979
6985
|
const char = name[0].toUpperCase();
|
|
6980
6986
|
setAvatar(char);
|
|
@@ -7071,7 +7077,7 @@ function WalletAsset({
|
|
|
7071
7077
|
}
|
|
7072
7078
|
|
|
7073
7079
|
// src/components/TokenSend/index.tsx
|
|
7074
|
-
import { useEffect as
|
|
7080
|
+
import { useEffect as useEffect30, useMemo as useMemo17, useState as useState33 } from "react";
|
|
7075
7081
|
import { defineChain as defineChain4, encodeFunctionData as encodeFunctionData2, erc20Abi as erc20Abi3, http as http8, parseUnits as parseUnits2 } from "viem";
|
|
7076
7082
|
import { FormattedMessage as FormattedMessage12, useIntl as useIntl18 } from "react-intl";
|
|
7077
7083
|
import { jsx as jsx44, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
@@ -7208,7 +7214,7 @@ function TokenSend({
|
|
|
7208
7214
|
}
|
|
7209
7215
|
onClose();
|
|
7210
7216
|
};
|
|
7211
|
-
|
|
7217
|
+
useEffect30(() => {
|
|
7212
7218
|
const receiveMessage = (event) => {
|
|
7213
7219
|
if (event.data) {
|
|
7214
7220
|
if (event.data.source == "match-wallet") {
|
|
@@ -7407,7 +7413,7 @@ function TokenSendList({ close }) {
|
|
|
7407
7413
|
|
|
7408
7414
|
// src/components/TransactionList/index.tsx
|
|
7409
7415
|
import InfiniteScroll from "react-infinite-scroll-component";
|
|
7410
|
-
import { useEffect as
|
|
7416
|
+
import { useEffect as useEffect31, useMemo as useMemo18, useState as useState35 } from "react";
|
|
7411
7417
|
import { decodeFunctionData, defineChain as defineChain5, formatUnits as formatUnits3 } from "viem";
|
|
7412
7418
|
import { erc20Abi as erc20Abi4 } from "viem";
|
|
7413
7419
|
import { FormattedMessage as FormattedMessage15 } from "react-intl";
|
|
@@ -7486,7 +7492,7 @@ var Item = ({ data }) => {
|
|
|
7486
7492
|
}
|
|
7487
7493
|
return "loading";
|
|
7488
7494
|
}, [data.extra?.status, data.source, hashQuery.data]);
|
|
7489
|
-
|
|
7495
|
+
useEffect31(() => {
|
|
7490
7496
|
if (data.hash) {
|
|
7491
7497
|
setShouldRefetch(status == "loading");
|
|
7492
7498
|
}
|
|
@@ -7618,4 +7624,4 @@ export {
|
|
|
7618
7624
|
MatchProvider,
|
|
7619
7625
|
useMatch
|
|
7620
7626
|
};
|
|
7621
|
-
//# sourceMappingURL=chunk-
|
|
7627
|
+
//# sourceMappingURL=chunk-KDVKIXOS.mjs.map
|