@matchain/matchid-sdk-react 0.1.55-alpha.13 → 0.1.55-alpha.14
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 +20 -20
- package/dist/api.js.map +1 -1
- package/dist/api.mjs +2 -2
- package/dist/{chunk-25VAJMUX.mjs → chunk-327CPPF5.mjs} +2 -2
- package/dist/{chunk-BB4OTBUS.mjs → chunk-VIJ3M2NZ.mjs} +150 -157
- package/dist/chunk-VIJ3M2NZ.mjs.map +1 -0
- package/dist/components.js +157 -164
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +1 -1
- package/dist/hooks.js +102 -109
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/{index-Dx4OFZhG.d.mts → index-B4lczvhL.d.mts} +4 -3
- package/dist/{index-hiCo96Vc.d.ts → index-UJfUO0uH.d.ts} +4 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +106 -113
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/ui.d.mts +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +7 -14
- package/dist/ui.js.map +1 -1
- package/dist/ui.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-BB4OTBUS.mjs.map +0 -1
- /package/dist/{chunk-25VAJMUX.mjs.map → chunk-327CPPF5.mjs.map} +0 -0
package/dist/components.js
CHANGED
|
@@ -58,7 +58,7 @@ __export(components_exports, {
|
|
|
58
58
|
module.exports = __toCommonJS(components_exports);
|
|
59
59
|
|
|
60
60
|
// src/components/EmailModal/index.tsx
|
|
61
|
-
var
|
|
61
|
+
var import_react25 = require("react");
|
|
62
62
|
|
|
63
63
|
// src/ui/Modal/index.tsx
|
|
64
64
|
var import_react3 = require("react");
|
|
@@ -1896,10 +1896,10 @@ var localStore = useLocalStore;
|
|
|
1896
1896
|
var useLocalStore_default = useLocalStore;
|
|
1897
1897
|
|
|
1898
1898
|
// src/hooks/useUserInfo.tsx
|
|
1899
|
-
var
|
|
1899
|
+
var import_react23 = require("react");
|
|
1900
1900
|
|
|
1901
1901
|
// src/MatchContext.tsx
|
|
1902
|
-
var
|
|
1902
|
+
var import_react22 = require("react");
|
|
1903
1903
|
|
|
1904
1904
|
// src/hooks/useMatchEvents.ts
|
|
1905
1905
|
var import_react6 = require("react");
|
|
@@ -1950,11 +1950,11 @@ var useStore_default = useStore;
|
|
|
1950
1950
|
// src/hooks/useWallet.tsx
|
|
1951
1951
|
var import_accounts = require("viem/accounts");
|
|
1952
1952
|
var import_viem3 = require("viem");
|
|
1953
|
-
var
|
|
1953
|
+
var import_react11 = require("react");
|
|
1954
1954
|
var import_viem4 = require("viem");
|
|
1955
1955
|
|
|
1956
1956
|
// src/context/ModalContext.tsx
|
|
1957
|
-
var
|
|
1957
|
+
var import_react10 = __toESM(require("react"));
|
|
1958
1958
|
var import_react_dom = require("react-dom");
|
|
1959
1959
|
|
|
1960
1960
|
// src/ui/Drawer/index.tsx
|
|
@@ -2147,7 +2147,7 @@ function HashPanel({
|
|
|
2147
2147
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: `matchid-hashpanel-status`, style: {
|
|
2148
2148
|
color: statusValue.color
|
|
2149
2149
|
}, children: statusValue.text }),
|
|
2150
|
-
statusValue.lottie ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
2150
|
+
statusValue.lottie ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Lottie, { animationData: statusValue.lottie, style: {
|
|
2151
2151
|
width: "96px",
|
|
2152
2152
|
height: "96px"
|
|
2153
2153
|
} }) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("img", { src: statusValue.icon, alt: statusValue.text, className: `matchid-hashpanel-img` }),
|
|
@@ -2256,25 +2256,18 @@ var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
|
2256
2256
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
2257
2257
|
|
|
2258
2258
|
// src/ui/Lottie/index.tsx
|
|
2259
|
-
var
|
|
2259
|
+
var LottieReact = __toESM(require("lottie-react"));
|
|
2260
2260
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
2261
|
-
var
|
|
2262
|
-
|
|
2263
|
-
(0,
|
|
2264
|
-
|
|
2265
|
-
setLottieReact(mod.default || mod);
|
|
2266
|
-
});
|
|
2267
|
-
}, []);
|
|
2268
|
-
if (!LottieReact) return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { children: "Loading..." });
|
|
2269
|
-
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(LottieReact, { loop: true, autoplay: true, ...props });
|
|
2270
|
-
};
|
|
2271
|
-
var Lottie_default = LazyLottie;
|
|
2261
|
+
var FixedLottie = LottieReact.default || LottieReact;
|
|
2262
|
+
function Lottie(props) {
|
|
2263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(FixedLottie, { loop: true, autoplay: true, ...props });
|
|
2264
|
+
}
|
|
2272
2265
|
|
|
2273
2266
|
// src/context/ModalContext.tsx
|
|
2274
2267
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
2275
|
-
var ModalContext = (0,
|
|
2268
|
+
var ModalContext = (0, import_react10.createContext)(null);
|
|
2276
2269
|
function useModal() {
|
|
2277
|
-
const context = (0,
|
|
2270
|
+
const context = (0, import_react10.useContext)(ModalContext);
|
|
2278
2271
|
if (!context) {
|
|
2279
2272
|
throw new Error("useModal must be used within a ModalProvider");
|
|
2280
2273
|
}
|
|
@@ -2363,7 +2356,7 @@ function useWallet() {
|
|
|
2363
2356
|
throw error;
|
|
2364
2357
|
}
|
|
2365
2358
|
};
|
|
2366
|
-
const evmAccount = (0,
|
|
2359
|
+
const evmAccount = (0, import_react11.useMemo)(() => {
|
|
2367
2360
|
try {
|
|
2368
2361
|
return address ? (0, import_accounts.toAccount)({
|
|
2369
2362
|
address,
|
|
@@ -2402,7 +2395,7 @@ function useWallet() {
|
|
|
2402
2395
|
return void 0;
|
|
2403
2396
|
}
|
|
2404
2397
|
}, [address]);
|
|
2405
|
-
(0,
|
|
2398
|
+
(0, import_react11.useEffect)(() => {
|
|
2406
2399
|
matchlog_default.log("qwe-evmAccount", evmAccount);
|
|
2407
2400
|
}, [evmAccount]);
|
|
2408
2401
|
const realCreateWalletClient = (parameters) => {
|
|
@@ -2545,14 +2538,14 @@ function useWallet() {
|
|
|
2545
2538
|
|
|
2546
2539
|
// src/hooks/useCopyClipboard.ts
|
|
2547
2540
|
var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
|
|
2548
|
-
var
|
|
2541
|
+
var import_react12 = require("react");
|
|
2549
2542
|
function useCopyClipboard(timeout = 500) {
|
|
2550
|
-
const [isCopied, setIsCopied] = (0,
|
|
2551
|
-
const staticCopy = (0,
|
|
2543
|
+
const [isCopied, setIsCopied] = (0, import_react12.useState)(false);
|
|
2544
|
+
const staticCopy = (0, import_react12.useCallback)((text) => {
|
|
2552
2545
|
const didCopy = (0, import_copy_to_clipboard.default)(text);
|
|
2553
2546
|
setIsCopied(didCopy);
|
|
2554
2547
|
}, []);
|
|
2555
|
-
(0,
|
|
2548
|
+
(0, import_react12.useEffect)(() => {
|
|
2556
2549
|
if (isCopied) {
|
|
2557
2550
|
const hide = setTimeout(() => {
|
|
2558
2551
|
setIsCopied(false);
|
|
@@ -2567,10 +2560,10 @@ function useCopyClipboard(timeout = 500) {
|
|
|
2567
2560
|
}
|
|
2568
2561
|
|
|
2569
2562
|
// src/context/ToastContext.tsx
|
|
2570
|
-
var
|
|
2563
|
+
var import_react13 = require("react");
|
|
2571
2564
|
var import_react_dom2 = require("react-dom");
|
|
2572
2565
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
2573
|
-
var ToastContext = (0,
|
|
2566
|
+
var ToastContext = (0, import_react13.createContext)(null);
|
|
2574
2567
|
|
|
2575
2568
|
// src/hooks/api/wallet.ts
|
|
2576
2569
|
var import_react_query2 = require("@tanstack/react-query");
|
|
@@ -2628,7 +2621,7 @@ function useImportTokenListQuery({
|
|
|
2628
2621
|
}
|
|
2629
2622
|
|
|
2630
2623
|
// src/hooks/useMatchChain.tsx
|
|
2631
|
-
var
|
|
2624
|
+
var import_react14 = require("react");
|
|
2632
2625
|
var import_viem5 = require("viem");
|
|
2633
2626
|
var import_react_intl3 = require("react-intl");
|
|
2634
2627
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
@@ -2637,7 +2630,7 @@ function useMatchChain() {
|
|
|
2637
2630
|
const modal = useModal();
|
|
2638
2631
|
const intl = (0, import_react_intl3.useIntl)();
|
|
2639
2632
|
const { chainId: storeChainId, setChainId } = useLocalStore_default();
|
|
2640
|
-
const chainId = (0,
|
|
2633
|
+
const chainId = (0, import_react14.useMemo)(() => {
|
|
2641
2634
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
2642
2635
|
return null;
|
|
2643
2636
|
}
|
|
@@ -2646,7 +2639,7 @@ function useMatchChain() {
|
|
|
2646
2639
|
}
|
|
2647
2640
|
return chainListQuery.data[0].id;
|
|
2648
2641
|
}, [storeChainId, chainListQuery.data]);
|
|
2649
|
-
const chain = (0,
|
|
2642
|
+
const chain = (0, import_react14.useMemo)(() => {
|
|
2650
2643
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
2651
2644
|
return null;
|
|
2652
2645
|
}
|
|
@@ -2660,7 +2653,7 @@ function useMatchChain() {
|
|
|
2660
2653
|
close
|
|
2661
2654
|
}) {
|
|
2662
2655
|
const { chainId: storeChainId2, setChainId: setChainId2 } = useLocalStore_default();
|
|
2663
|
-
const [selectedChainId, setSelectedChainId] = (0,
|
|
2656
|
+
const [selectedChainId, setSelectedChainId] = (0, import_react14.useState)(storeChainId2);
|
|
2664
2657
|
const isDownMd = useDownMd();
|
|
2665
2658
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: `matchid-change-network-box`, children: [
|
|
2666
2659
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: `matchid-change-network-list`, children: chainListQuery.data?.map((item, index) => {
|
|
@@ -2692,7 +2685,7 @@ function useMatchChain() {
|
|
|
2692
2685
|
content: ChangeNetwork
|
|
2693
2686
|
});
|
|
2694
2687
|
};
|
|
2695
|
-
const publicClient = (0,
|
|
2688
|
+
const publicClient = (0, import_react14.useMemo)(() => {
|
|
2696
2689
|
if (!chain) {
|
|
2697
2690
|
return null;
|
|
2698
2691
|
}
|
|
@@ -2720,7 +2713,7 @@ function useMatchChain() {
|
|
|
2720
2713
|
|
|
2721
2714
|
// src/hooks/useMatchWallet.tsx
|
|
2722
2715
|
var import_react_qrcode = require("react-qrcode");
|
|
2723
|
-
var
|
|
2716
|
+
var import_react16 = require("react");
|
|
2724
2717
|
var import_react_query5 = require("@tanstack/react-query");
|
|
2725
2718
|
|
|
2726
2719
|
// src/config/index.tsx
|
|
@@ -2791,7 +2784,7 @@ var useContractStore_default = useContractStore;
|
|
|
2791
2784
|
var import_react_intl5 = require("react-intl");
|
|
2792
2785
|
|
|
2793
2786
|
// src/components/ImportToken/index.tsx
|
|
2794
|
-
var
|
|
2787
|
+
var import_react15 = require("react");
|
|
2795
2788
|
var import_react_intl4 = require("react-intl");
|
|
2796
2789
|
var import_react_query4 = require("@tanstack/react-query");
|
|
2797
2790
|
var import_viem7 = require("viem");
|
|
@@ -2806,12 +2799,12 @@ var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
|
2806
2799
|
// src/hooks/useMatchWallet.tsx
|
|
2807
2800
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
2808
2801
|
function useMatchWalletRecords() {
|
|
2809
|
-
const [hasMore, setHasMore] = (0,
|
|
2810
|
-
const [items, setItems] = (0,
|
|
2802
|
+
const [hasMore, setHasMore] = (0, import_react16.useState)(true);
|
|
2803
|
+
const [items, setItems] = (0, import_react16.useState)([]);
|
|
2811
2804
|
const { chainId, publicClient } = useMatchChain();
|
|
2812
2805
|
const { address } = useWallet();
|
|
2813
|
-
const hasMoreRef = (0,
|
|
2814
|
-
const nextPageParamsRef = (0,
|
|
2806
|
+
const hasMoreRef = (0, import_react16.useRef)(hasMore);
|
|
2807
|
+
const nextPageParamsRef = (0, import_react16.useRef)(void 0);
|
|
2815
2808
|
const { contracts, setContracts } = useContractStore_default();
|
|
2816
2809
|
const fetchMoreData = async () => {
|
|
2817
2810
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
@@ -2838,7 +2831,7 @@ function useMatchWalletRecords() {
|
|
|
2838
2831
|
hasMoreRef.current = true;
|
|
2839
2832
|
fetchMoreData();
|
|
2840
2833
|
};
|
|
2841
|
-
(0,
|
|
2834
|
+
(0, import_react16.useEffect)(() => {
|
|
2842
2835
|
if (chainId && address) {
|
|
2843
2836
|
onInit();
|
|
2844
2837
|
}
|
|
@@ -2894,7 +2887,7 @@ function useMatchWalletRecords() {
|
|
|
2894
2887
|
setContracts(contractMap);
|
|
2895
2888
|
}
|
|
2896
2889
|
};
|
|
2897
|
-
const list = (0,
|
|
2890
|
+
const list = (0, import_react16.useMemo)(() => {
|
|
2898
2891
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
2899
2892
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
2900
2893
|
removeList.forEach((item) => {
|
|
@@ -2936,7 +2929,7 @@ function useMatchWalletAssets({
|
|
|
2936
2929
|
chainId: chainId || 0,
|
|
2937
2930
|
...assetListOptions
|
|
2938
2931
|
});
|
|
2939
|
-
const mergedAssets = (0,
|
|
2932
|
+
const mergedAssets = (0, import_react16.useMemo)(() => {
|
|
2940
2933
|
if (!assetListQuery.data && !importTokenQuery.data) return [];
|
|
2941
2934
|
const assetList = (assetListQuery.data || []).map((asset) => ({
|
|
2942
2935
|
...asset,
|
|
@@ -3023,7 +3016,7 @@ function useMatchWalletAssetList({
|
|
|
3023
3016
|
retry: 3
|
|
3024
3017
|
// Retry up to 3 times if failed
|
|
3025
3018
|
});
|
|
3026
|
-
const erc20Tokens = (0,
|
|
3019
|
+
const erc20Tokens = (0, import_react16.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
|
|
3027
3020
|
const erc20BalanceQuery = (0, import_react_query5.useQuery)({
|
|
3028
3021
|
queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
|
|
3029
3022
|
queryFn: async () => {
|
|
@@ -3051,7 +3044,7 @@ function useMatchWalletAssetList({
|
|
|
3051
3044
|
// Refresh every 15 seconds
|
|
3052
3045
|
retry: 3
|
|
3053
3046
|
});
|
|
3054
|
-
const enrichedAssets = (0,
|
|
3047
|
+
const enrichedAssets = (0, import_react16.useMemo)(() => {
|
|
3055
3048
|
if (!list) return [];
|
|
3056
3049
|
const erc20Balances = erc20BalanceQuery.data || [];
|
|
3057
3050
|
return list.map((asset) => {
|
|
@@ -3073,7 +3066,7 @@ function useMatchWalletAssetList({
|
|
|
3073
3066
|
return { ...asset, balance, value, balanceValue };
|
|
3074
3067
|
});
|
|
3075
3068
|
}, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
|
|
3076
|
-
(0,
|
|
3069
|
+
(0, import_react16.useEffect)(() => {
|
|
3077
3070
|
const list2 = enrichedAssets.sort((a, b) => {
|
|
3078
3071
|
if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
|
|
3079
3072
|
if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
|
|
@@ -3098,13 +3091,13 @@ function useMatchWalletAssetList({
|
|
|
3098
3091
|
}
|
|
3099
3092
|
|
|
3100
3093
|
// src/hooks/useReceipt.tsx
|
|
3101
|
-
var
|
|
3094
|
+
var import_react17 = require("react");
|
|
3102
3095
|
var import_react_query6 = require("@tanstack/react-query");
|
|
3103
3096
|
var import_viem9 = require("viem");
|
|
3104
3097
|
var CACHE_TTL = 86400 * 30 * 1e3;
|
|
3105
3098
|
|
|
3106
3099
|
// src/hooks/useTransaction.tsx
|
|
3107
|
-
var
|
|
3100
|
+
var import_react18 = require("react");
|
|
3108
3101
|
var import_react_query7 = require("@tanstack/react-query");
|
|
3109
3102
|
var import_viem10 = require("viem");
|
|
3110
3103
|
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
@@ -3195,7 +3188,7 @@ var useWalletModalStore = (0, import_zustand5.create)((set) => ({
|
|
|
3195
3188
|
}));
|
|
3196
3189
|
|
|
3197
3190
|
// src/components/CEXBindModal/index.tsx
|
|
3198
|
-
var
|
|
3191
|
+
var import_react19 = require("react");
|
|
3199
3192
|
var import_react_intl6 = require("react-intl");
|
|
3200
3193
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
3201
3194
|
|
|
@@ -3207,11 +3200,11 @@ var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
|
3207
3200
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
3208
3201
|
|
|
3209
3202
|
// src/hooks/useWalletInit.ts
|
|
3210
|
-
var
|
|
3203
|
+
var import_react20 = require("react");
|
|
3211
3204
|
var AppClientId2 = getAppClientId();
|
|
3212
3205
|
|
|
3213
3206
|
// src/hooks/useInit.tsx
|
|
3214
|
-
var
|
|
3207
|
+
var import_react21 = require("react");
|
|
3215
3208
|
|
|
3216
3209
|
// src/MatchContext.tsx
|
|
3217
3210
|
var import_react_query9 = require("@tanstack/react-query");
|
|
@@ -3303,9 +3296,9 @@ var wagmiConfig = (0, import_rainbowkit.getDefaultConfig)({
|
|
|
3303
3296
|
],
|
|
3304
3297
|
chains: [import_chains.mainnet, import_chains.polygon, import_chains.optimism, import_chains.arbitrum, import_chains.base, matchMain, matchTest, import_chains.bsc]
|
|
3305
3298
|
});
|
|
3306
|
-
var MatchContext = (0,
|
|
3299
|
+
var MatchContext = (0, import_react22.createContext)(void 0);
|
|
3307
3300
|
var useMatch = () => {
|
|
3308
|
-
const context = (0,
|
|
3301
|
+
const context = (0, import_react22.useContext)(MatchContext);
|
|
3309
3302
|
if (context === void 0) {
|
|
3310
3303
|
throw new Error("useMatch must be used within a MatchProvider");
|
|
3311
3304
|
}
|
|
@@ -3339,7 +3332,7 @@ function useUserInfo() {
|
|
|
3339
3332
|
const getRedirectUri = () => {
|
|
3340
3333
|
return encodeURIComponent(window.location.href);
|
|
3341
3334
|
};
|
|
3342
|
-
const isLogin = (0,
|
|
3335
|
+
const isLogin = (0, import_react23.useMemo)(() => !!token && !!overview, [token, overview]);
|
|
3343
3336
|
const logout = async () => {
|
|
3344
3337
|
try {
|
|
3345
3338
|
await toLogoutApi();
|
|
@@ -3610,23 +3603,23 @@ function useUserInfo() {
|
|
|
3610
3603
|
}
|
|
3611
3604
|
|
|
3612
3605
|
// src/components/EmailModal/StepVerify.tsx
|
|
3613
|
-
var
|
|
3606
|
+
var import_react24 = require("react");
|
|
3614
3607
|
var import_react_intl8 = require("react-intl");
|
|
3615
3608
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
3616
3609
|
function StepVerify(props) {
|
|
3617
3610
|
const intl = (0, import_react_intl8.useIntl)();
|
|
3618
3611
|
const { getLoginEmailCode, loginByEmail } = useUserInfo();
|
|
3619
|
-
const [error, setError] = (0,
|
|
3620
|
-
const [code, setCode] = (0,
|
|
3621
|
-
const [sending, setSending] = (0,
|
|
3622
|
-
const [submitting, setSubmitting] = (0,
|
|
3623
|
-
const sendTimeRef = (0,
|
|
3624
|
-
const [sendBtnText, setSendBtnText] = (0,
|
|
3612
|
+
const [error, setError] = (0, import_react24.useState)("");
|
|
3613
|
+
const [code, setCode] = (0, import_react24.useState)("");
|
|
3614
|
+
const [sending, setSending] = (0, import_react24.useState)(false);
|
|
3615
|
+
const [submitting, setSubmitting] = (0, import_react24.useState)(false);
|
|
3616
|
+
const sendTimeRef = (0, import_react24.useRef)(0);
|
|
3617
|
+
const [sendBtnText, setSendBtnText] = (0, import_react24.useState)(intl.formatMessage({
|
|
3625
3618
|
id: "send"
|
|
3626
3619
|
}));
|
|
3627
3620
|
const intervalTime = EMAIL_INTERVAL;
|
|
3628
3621
|
const codeLength = EMAIL_CODE_LENGTH;
|
|
3629
|
-
const intervalRef = (0,
|
|
3622
|
+
const intervalRef = (0, import_react24.useRef)(null);
|
|
3630
3623
|
const isDownMd = useDownMd();
|
|
3631
3624
|
const onSend = async () => {
|
|
3632
3625
|
if (sendTimeRef.current > 0) {
|
|
@@ -3657,7 +3650,7 @@ function StepVerify(props) {
|
|
|
3657
3650
|
setSending(false);
|
|
3658
3651
|
}
|
|
3659
3652
|
};
|
|
3660
|
-
(0,
|
|
3653
|
+
(0, import_react24.useEffect)(() => {
|
|
3661
3654
|
onSend();
|
|
3662
3655
|
return () => {
|
|
3663
3656
|
if (intervalRef.current) {
|
|
@@ -3665,7 +3658,7 @@ function StepVerify(props) {
|
|
|
3665
3658
|
}
|
|
3666
3659
|
};
|
|
3667
3660
|
}, []);
|
|
3668
|
-
const canContinue = (0,
|
|
3661
|
+
const canContinue = (0, import_react24.useMemo)(() => {
|
|
3669
3662
|
return code.length === codeLength;
|
|
3670
3663
|
}, [code]);
|
|
3671
3664
|
const onContinue = async () => {
|
|
@@ -3742,10 +3735,10 @@ function EmailModal({
|
|
|
3742
3735
|
onBack,
|
|
3743
3736
|
onLogin
|
|
3744
3737
|
}) {
|
|
3745
|
-
const [step, setStep] = (0,
|
|
3746
|
-
const [emailVal, setEmailVal] = (0,
|
|
3738
|
+
const [step, setStep] = (0, import_react25.useState)("input");
|
|
3739
|
+
const [emailVal, setEmailVal] = (0, import_react25.useState)("");
|
|
3747
3740
|
const intl = (0, import_react_intl9.useIntl)();
|
|
3748
|
-
(0,
|
|
3741
|
+
(0, import_react25.useEffect)(() => {
|
|
3749
3742
|
if (!isOpen) {
|
|
3750
3743
|
setStep("input");
|
|
3751
3744
|
setEmailVal("");
|
|
@@ -3770,7 +3763,7 @@ function EmailModal({
|
|
|
3770
3763
|
}
|
|
3771
3764
|
|
|
3772
3765
|
// src/components/LoginBox/index.tsx
|
|
3773
|
-
var
|
|
3766
|
+
var import_react26 = require("react");
|
|
3774
3767
|
var import_react_intl10 = require("react-intl");
|
|
3775
3768
|
|
|
3776
3769
|
// src/hooks/useAppConfig.ts
|
|
@@ -3841,7 +3834,7 @@ function LoginBox({
|
|
|
3841
3834
|
inModal = false
|
|
3842
3835
|
}) {
|
|
3843
3836
|
const config = useAppConfig();
|
|
3844
|
-
const methodConfig = (0,
|
|
3837
|
+
const methodConfig = (0, import_react26.useMemo)(() => {
|
|
3845
3838
|
if (recommendMethods || methods || walletMethods) {
|
|
3846
3839
|
return {
|
|
3847
3840
|
recommendMethods: recommendMethods ? recommendMethods : walletMethods ? ["wallet"] : [],
|
|
@@ -3883,9 +3876,9 @@ function LoginBox({
|
|
|
3883
3876
|
walletMethods: walletMethodList
|
|
3884
3877
|
};
|
|
3885
3878
|
}, [config.platform, recommendMethods, methods, walletMethods]);
|
|
3886
|
-
const [emailOpen, setEmailOpen] = (0,
|
|
3879
|
+
const [emailOpen, setEmailOpen] = (0, import_react26.useState)(false);
|
|
3887
3880
|
const { login } = useUserInfo();
|
|
3888
|
-
const [showWallet, setShowWallet] = (0,
|
|
3881
|
+
const [showWallet, setShowWallet] = (0, import_react26.useState)(false);
|
|
3889
3882
|
const intl = (0, import_react_intl10.useIntl)();
|
|
3890
3883
|
const isDownMd = useDownMd();
|
|
3891
3884
|
const methodMap = {
|
|
@@ -4033,7 +4026,7 @@ function LoginBox({
|
|
|
4033
4026
|
}
|
|
4034
4027
|
|
|
4035
4028
|
// src/components/LoginButton/index.tsx
|
|
4036
|
-
var
|
|
4029
|
+
var import_react28 = require("react");
|
|
4037
4030
|
|
|
4038
4031
|
// src/components/LoginPanel/index.tsx
|
|
4039
4032
|
var import_react_intl11 = require("react-intl");
|
|
@@ -4076,7 +4069,7 @@ function LoginModal({
|
|
|
4076
4069
|
}
|
|
4077
4070
|
|
|
4078
4071
|
// src/components/UserPopover/index.tsx
|
|
4079
|
-
var
|
|
4072
|
+
var import_react27 = require("react");
|
|
4080
4073
|
|
|
4081
4074
|
// src/assets/icon/ProfileIcon.tsx
|
|
4082
4075
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
@@ -4108,7 +4101,7 @@ var import_react_intl12 = require("react-intl");
|
|
|
4108
4101
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
4109
4102
|
function UserContent() {
|
|
4110
4103
|
const { logout, address, username } = useUserInfo();
|
|
4111
|
-
const [logouting, setLogouting] = (0,
|
|
4104
|
+
const [logouting, setLogouting] = (0, import_react27.useState)(false);
|
|
4112
4105
|
const onLogout = async () => {
|
|
4113
4106
|
if (logouting) return;
|
|
4114
4107
|
try {
|
|
@@ -4137,7 +4130,7 @@ function UserContent() {
|
|
|
4137
4130
|
const UserDivider = () => {
|
|
4138
4131
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: `matchid-user-popover-divider` });
|
|
4139
4132
|
};
|
|
4140
|
-
const [usernameOpen, setUsernameOpen] = (0,
|
|
4133
|
+
const [usernameOpen, setUsernameOpen] = (0, import_react27.useState)(false);
|
|
4141
4134
|
const [copied, setCopied] = useCopyClipboard();
|
|
4142
4135
|
const intl = (0, import_react_intl12.useIntl)();
|
|
4143
4136
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "matchid-user-popover-content", children: [
|
|
@@ -4183,7 +4176,7 @@ function LoginButton({
|
|
|
4183
4176
|
}) {
|
|
4184
4177
|
const intl = (0, import_react_intl13.useIntl)();
|
|
4185
4178
|
const { isLogin, username } = useUserInfo();
|
|
4186
|
-
const [loginOpen, setLoginOpen] = (0,
|
|
4179
|
+
const [loginOpen, setLoginOpen] = (0, import_react28.useState)(false);
|
|
4187
4180
|
if (!isLogin) {
|
|
4188
4181
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
|
|
4189
4182
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
@@ -4211,7 +4204,7 @@ function LoginButton({
|
|
|
4211
4204
|
}
|
|
4212
4205
|
|
|
4213
4206
|
// src/components/UsernameModal/index.tsx
|
|
4214
|
-
var
|
|
4207
|
+
var import_react29 = require("react");
|
|
4215
4208
|
var import_react_intl14 = require("react-intl");
|
|
4216
4209
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
4217
4210
|
var ValidItem = ({
|
|
@@ -4232,23 +4225,23 @@ function UsernameModal({
|
|
|
4232
4225
|
}) {
|
|
4233
4226
|
const { username, refreshOverview } = useUserInfo();
|
|
4234
4227
|
const { isLogin } = useUserInfo();
|
|
4235
|
-
const [val, setVal] = (0,
|
|
4236
|
-
const [error, setError] = (0,
|
|
4228
|
+
const [val, setVal] = (0, import_react29.useState)(username);
|
|
4229
|
+
const [error, setError] = (0, import_react29.useState)("");
|
|
4237
4230
|
const isDownMd = useDownMd();
|
|
4238
|
-
(0,
|
|
4231
|
+
(0, import_react29.useEffect)(() => {
|
|
4239
4232
|
if (isOpen) {
|
|
4240
4233
|
setVal(username);
|
|
4241
4234
|
setError("");
|
|
4242
4235
|
}
|
|
4243
4236
|
}, [isOpen]);
|
|
4244
|
-
const isValid = (0,
|
|
4237
|
+
const isValid = (0, import_react29.useMemo)(() => {
|
|
4245
4238
|
return isValidUsername(val);
|
|
4246
4239
|
}, [val]);
|
|
4247
|
-
const isLength = (0,
|
|
4240
|
+
const isLength = (0, import_react29.useMemo)(() => {
|
|
4248
4241
|
return val.length >= 2 && val.length <= 32;
|
|
4249
4242
|
}, [val]);
|
|
4250
4243
|
const isSafe = isValid && isLength;
|
|
4251
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
4244
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react29.useState)(false);
|
|
4252
4245
|
const onSubmit = async () => {
|
|
4253
4246
|
if (isSubmitting) return;
|
|
4254
4247
|
try {
|
|
@@ -4311,11 +4304,11 @@ function UsernameModal({
|
|
|
4311
4304
|
}
|
|
4312
4305
|
|
|
4313
4306
|
// src/components/EVMModal/index.tsx
|
|
4314
|
-
var
|
|
4307
|
+
var import_react32 = require("react");
|
|
4315
4308
|
var import_react_intl15 = require("react-intl");
|
|
4316
4309
|
|
|
4317
4310
|
// src/components/WalletModalContent/index.tsx
|
|
4318
|
-
var
|
|
4311
|
+
var import_react30 = require("react");
|
|
4319
4312
|
|
|
4320
4313
|
// src/assets/wallet.ts
|
|
4321
4314
|
var walletErrorImage = error_default;
|
|
@@ -4336,7 +4329,7 @@ function WalletModalContent({
|
|
|
4336
4329
|
address,
|
|
4337
4330
|
connected
|
|
4338
4331
|
}) {
|
|
4339
|
-
const pageData = (0,
|
|
4332
|
+
const pageData = (0, import_react30.useMemo)(() => {
|
|
4340
4333
|
if (status == "success") {
|
|
4341
4334
|
return {
|
|
4342
4335
|
btnText: "Disconnect Wallet",
|
|
@@ -4397,7 +4390,7 @@ function WalletModalContent({
|
|
|
4397
4390
|
}, [visible, connected, status, error, address]);
|
|
4398
4391
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "matchid-wallet-container", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: `matchid-wallet-box`, children: [
|
|
4399
4392
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: `matchid-wallet-content`, children: [
|
|
4400
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
4393
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Lottie, { animationData: pageData.statusImage, style: {
|
|
4401
4394
|
width: 128,
|
|
4402
4395
|
height: 128
|
|
4403
4396
|
} }),
|
|
@@ -4417,8 +4410,8 @@ function WalletModalContent({
|
|
|
4417
4410
|
] }) });
|
|
4418
4411
|
}
|
|
4419
4412
|
function WalletModalContentV2(props) {
|
|
4420
|
-
const [submitting, setSubmitting] = (0,
|
|
4421
|
-
const pageData = (0,
|
|
4413
|
+
const [submitting, setSubmitting] = (0, import_react30.useState)(false);
|
|
4414
|
+
const pageData = (0, import_react30.useMemo)(() => {
|
|
4422
4415
|
const { status } = props;
|
|
4423
4416
|
if (status == "success") {
|
|
4424
4417
|
return {
|
|
@@ -4481,7 +4474,7 @@ function WalletModalContentV2(props) {
|
|
|
4481
4474
|
}, [props, submitting]);
|
|
4482
4475
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "matchid-wallet-container", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: `matchid-wallet-box`, children: [
|
|
4483
4476
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: `matchid-wallet-content`, children: [
|
|
4484
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
4477
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Lottie, { animationData: pageData.statusImage, style: {
|
|
4485
4478
|
width: 128,
|
|
4486
4479
|
height: 128
|
|
4487
4480
|
} }),
|
|
@@ -4506,14 +4499,14 @@ var import_rainbowkit2 = require("@rainbow-me/rainbowkit");
|
|
|
4506
4499
|
var import_wagmi3 = require("wagmi");
|
|
4507
4500
|
|
|
4508
4501
|
// src/hooks/useWalletBox.ts
|
|
4509
|
-
var
|
|
4502
|
+
var import_react31 = require("react");
|
|
4510
4503
|
function useWalletBox({
|
|
4511
4504
|
onInit
|
|
4512
4505
|
}) {
|
|
4513
|
-
const [status, setStateStatus] = (0,
|
|
4514
|
-
const [error, setError] = (0,
|
|
4515
|
-
const statusRef = (0,
|
|
4516
|
-
const [nonce, setNonce] = (0,
|
|
4506
|
+
const [status, setStateStatus] = (0, import_react31.useState)("start");
|
|
4507
|
+
const [error, setError] = (0, import_react31.useState)("");
|
|
4508
|
+
const statusRef = (0, import_react31.useRef)(status);
|
|
4509
|
+
const [nonce, setNonce] = (0, import_react31.useState)();
|
|
4517
4510
|
const setStatus = (status2) => {
|
|
4518
4511
|
statusRef.current = status2;
|
|
4519
4512
|
setStateStatus(status2);
|
|
@@ -4522,7 +4515,7 @@ function useWalletBox({
|
|
|
4522
4515
|
setError("");
|
|
4523
4516
|
setNonce(null);
|
|
4524
4517
|
};
|
|
4525
|
-
(0,
|
|
4518
|
+
(0, import_react31.useEffect)(() => {
|
|
4526
4519
|
init();
|
|
4527
4520
|
onInit({
|
|
4528
4521
|
setStatus
|
|
@@ -4780,16 +4773,16 @@ function WalletContent({
|
|
|
4780
4773
|
const { disconnectAsync } = (0, import_wagmi3.useDisconnect)({ config });
|
|
4781
4774
|
const chainId = (0, import_wagmi3.useChainId)();
|
|
4782
4775
|
const { events, login } = useMatch();
|
|
4783
|
-
const [inited, setInited] = (0,
|
|
4776
|
+
const [inited, setInited] = (0, import_react32.useState)(false);
|
|
4784
4777
|
const { status, setStatus, error, setError, statusRef, nonce, setNonce, init } = useWalletBox({
|
|
4785
4778
|
onInit: async ({ setStatus: setStatus2 }) => {
|
|
4786
4779
|
setStatus2("start");
|
|
4787
4780
|
}
|
|
4788
4781
|
});
|
|
4789
|
-
(0,
|
|
4782
|
+
(0, import_react32.useEffect)(() => {
|
|
4790
4783
|
matchlog_default.log(`status=${status}`, `connectModalOpen=${connectModalOpen}`, `address=${address}`, `isConnected=${isConnected}`);
|
|
4791
4784
|
}, [status, connectModalOpen, isConnected, address]);
|
|
4792
|
-
(0,
|
|
4785
|
+
(0, import_react32.useEffect)(() => {
|
|
4793
4786
|
if (connectModalOpen) {
|
|
4794
4787
|
setStatus("connecting");
|
|
4795
4788
|
return;
|
|
@@ -4802,7 +4795,7 @@ function WalletContent({
|
|
|
4802
4795
|
setStatus("start");
|
|
4803
4796
|
}
|
|
4804
4797
|
}, [connectModalOpen, address]);
|
|
4805
|
-
(0,
|
|
4798
|
+
(0, import_react32.useEffect)(() => {
|
|
4806
4799
|
if (openConnectModal && !isConnected && !inited) {
|
|
4807
4800
|
openConnectModal && openConnectModal();
|
|
4808
4801
|
setInited(true);
|
|
@@ -4829,7 +4822,7 @@ function WalletContent({
|
|
|
4829
4822
|
setError(error2.message);
|
|
4830
4823
|
}
|
|
4831
4824
|
};
|
|
4832
|
-
const signature = (0,
|
|
4825
|
+
const signature = (0, import_react32.useCallback)(async () => {
|
|
4833
4826
|
if (!nonce || status != "nonce") {
|
|
4834
4827
|
return;
|
|
4835
4828
|
}
|
|
@@ -4885,7 +4878,7 @@ function WalletContent({
|
|
|
4885
4878
|
setError(error2.reason || error2.message);
|
|
4886
4879
|
}
|
|
4887
4880
|
}, [nonce, status, address]);
|
|
4888
|
-
(0,
|
|
4881
|
+
(0, import_react32.useEffect)(() => {
|
|
4889
4882
|
if (signature) {
|
|
4890
4883
|
signature();
|
|
4891
4884
|
}
|
|
@@ -4956,7 +4949,7 @@ function EVMModal(props) {
|
|
|
4956
4949
|
}
|
|
4957
4950
|
|
|
4958
4951
|
// src/components/TRONModal/index.tsx
|
|
4959
|
-
var
|
|
4952
|
+
var import_react34 = __toESM(require("react"));
|
|
4960
4953
|
var import_react_intl16 = require("react-intl");
|
|
4961
4954
|
|
|
4962
4955
|
// src/lib/tron/TronLinkAdapter.ts
|
|
@@ -4990,7 +4983,7 @@ var TronLinkAdapter = class {
|
|
|
4990
4983
|
};
|
|
4991
4984
|
|
|
4992
4985
|
// src/hooks/useTRONWallet.ts
|
|
4993
|
-
var
|
|
4986
|
+
var import_react33 = require("react");
|
|
4994
4987
|
|
|
4995
4988
|
// src/lib/tron/BitgetAdapter.ts
|
|
4996
4989
|
var BitgetAdapter = class {
|
|
@@ -5035,9 +5028,9 @@ var OKXAdapter = class {
|
|
|
5035
5028
|
// src/hooks/useTRONWallet.ts
|
|
5036
5029
|
var useTRONWallet = () => {
|
|
5037
5030
|
const wallets = [new TronLinkAdapter(), new BitgetAdapter(), new OKXAdapter()];
|
|
5038
|
-
const [installedWallets, setInstalledWallets] = (0,
|
|
5039
|
-
const [address, setAddress] = (0,
|
|
5040
|
-
(0,
|
|
5031
|
+
const [installedWallets, setInstalledWallets] = (0, import_react33.useState)([]);
|
|
5032
|
+
const [address, setAddress] = (0, import_react33.useState)(null);
|
|
5033
|
+
(0, import_react33.useEffect)(() => {
|
|
5041
5034
|
const getInstalled = async () => {
|
|
5042
5035
|
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
5043
5036
|
wallet: wallet2,
|
|
@@ -5047,11 +5040,11 @@ var useTRONWallet = () => {
|
|
|
5047
5040
|
};
|
|
5048
5041
|
getInstalled();
|
|
5049
5042
|
}, []);
|
|
5050
|
-
const [wallet, chooseWallet] = (0,
|
|
5043
|
+
const [wallet, chooseWallet] = (0, import_react33.useState)(null);
|
|
5051
5044
|
const onConnect = async () => {
|
|
5052
5045
|
setAddress(await wallet.connect());
|
|
5053
5046
|
};
|
|
5054
|
-
(0,
|
|
5047
|
+
(0, import_react33.useEffect)(() => {
|
|
5055
5048
|
if (!wallet) {
|
|
5056
5049
|
setAddress(null);
|
|
5057
5050
|
}
|
|
@@ -5082,10 +5075,10 @@ function TRONConnectModal({
|
|
|
5082
5075
|
okx: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(OKXIcon, { size: isDownMd ? 36 : 40 })
|
|
5083
5076
|
};
|
|
5084
5077
|
const { events, login } = useMatch();
|
|
5085
|
-
const [status, setStatus] = (0,
|
|
5086
|
-
const statusRef =
|
|
5087
|
-
const [error, setError] = (0,
|
|
5088
|
-
const connected = (0,
|
|
5078
|
+
const [status, setStatus] = (0, import_react34.useState)("");
|
|
5079
|
+
const statusRef = import_react34.default.useRef(status);
|
|
5080
|
+
const [error, setError] = (0, import_react34.useState)("");
|
|
5081
|
+
const connected = (0, import_react34.useMemo)(() => {
|
|
5089
5082
|
return !!address;
|
|
5090
5083
|
}, [address]);
|
|
5091
5084
|
const disconnect = async () => {
|
|
@@ -5153,7 +5146,7 @@ function TRONConnectModal({
|
|
|
5153
5146
|
statusRef.current = "";
|
|
5154
5147
|
}
|
|
5155
5148
|
};
|
|
5156
|
-
(0,
|
|
5149
|
+
(0, import_react34.useEffect)(() => {
|
|
5157
5150
|
if (wallet) {
|
|
5158
5151
|
console.log("onConnect");
|
|
5159
5152
|
onConnect();
|
|
@@ -5161,12 +5154,12 @@ function TRONConnectModal({
|
|
|
5161
5154
|
setStatus("");
|
|
5162
5155
|
}
|
|
5163
5156
|
}, [wallet]);
|
|
5164
|
-
(0,
|
|
5157
|
+
(0, import_react34.useEffect)(() => {
|
|
5165
5158
|
if (address) {
|
|
5166
5159
|
toLoginInWallet();
|
|
5167
5160
|
}
|
|
5168
5161
|
}, [address]);
|
|
5169
|
-
(0,
|
|
5162
|
+
(0, import_react34.useEffect)(() => {
|
|
5170
5163
|
if (!props.isOpen) {
|
|
5171
5164
|
disconnect();
|
|
5172
5165
|
}
|
|
@@ -5224,7 +5217,7 @@ function TRONModal(props) {
|
|
|
5224
5217
|
}
|
|
5225
5218
|
|
|
5226
5219
|
// src/components/TONModal/index.tsx
|
|
5227
|
-
var
|
|
5220
|
+
var import_react35 = __toESM(require("react"));
|
|
5228
5221
|
var import_react_intl17 = require("react-intl");
|
|
5229
5222
|
var import_ui_react = require("@tonconnect/ui-react");
|
|
5230
5223
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
@@ -5233,15 +5226,15 @@ function WalletContent2({
|
|
|
5233
5226
|
type
|
|
5234
5227
|
}) {
|
|
5235
5228
|
const { events, login } = useMatch();
|
|
5236
|
-
const [connected, setConnected] = (0,
|
|
5229
|
+
const [connected, setConnected] = (0, import_react35.useState)(false);
|
|
5237
5230
|
const wallet = (0, import_ui_react.useTonWallet)();
|
|
5238
5231
|
const userFriendlyAddress = (0, import_ui_react.useTonAddress)();
|
|
5239
5232
|
const [tonConnectUI] = (0, import_ui_react.useTonConnectUI)();
|
|
5240
5233
|
const { state, open, close } = (0, import_ui_react.useTonConnectModal)();
|
|
5241
|
-
const [status, setStatus] = (0,
|
|
5242
|
-
const statusRef =
|
|
5243
|
-
const [error, setError] = (0,
|
|
5244
|
-
(0,
|
|
5234
|
+
const [status, setStatus] = (0, import_react35.useState)("");
|
|
5235
|
+
const statusRef = import_react35.default.useRef(status);
|
|
5236
|
+
const [error, setError] = (0, import_react35.useState)("");
|
|
5237
|
+
(0, import_react35.useEffect)(() => {
|
|
5245
5238
|
const init = async () => {
|
|
5246
5239
|
if (tonConnectUI.connected) {
|
|
5247
5240
|
await tonConnectUI.disconnect();
|
|
@@ -5314,7 +5307,7 @@ function WalletContent2({
|
|
|
5314
5307
|
}
|
|
5315
5308
|
});
|
|
5316
5309
|
}, []);
|
|
5317
|
-
(0,
|
|
5310
|
+
(0, import_react35.useEffect)(() => {
|
|
5318
5311
|
if (wallet) {
|
|
5319
5312
|
setConnected(true);
|
|
5320
5313
|
console.log("Wallet connected:", wallet);
|
|
@@ -5325,7 +5318,7 @@ function WalletContent2({
|
|
|
5325
5318
|
setStatus("");
|
|
5326
5319
|
}
|
|
5327
5320
|
}, [wallet]);
|
|
5328
|
-
(0,
|
|
5321
|
+
(0, import_react35.useEffect)(() => {
|
|
5329
5322
|
console.log({
|
|
5330
5323
|
state,
|
|
5331
5324
|
wallet
|
|
@@ -5405,7 +5398,7 @@ function TONModal(props) {
|
|
|
5405
5398
|
}
|
|
5406
5399
|
|
|
5407
5400
|
// src/components/BTCModal/index.tsx
|
|
5408
|
-
var
|
|
5401
|
+
var import_react37 = __toESM(require("react"));
|
|
5409
5402
|
var import_react_intl18 = require("react-intl");
|
|
5410
5403
|
|
|
5411
5404
|
// src/lib/btc/UnisatAdapter.ts
|
|
@@ -5554,7 +5547,7 @@ var LeatherAdapter = class {
|
|
|
5554
5547
|
};
|
|
5555
5548
|
|
|
5556
5549
|
// src/hooks/useBTCWallet.ts
|
|
5557
|
-
var
|
|
5550
|
+
var import_react36 = require("react");
|
|
5558
5551
|
|
|
5559
5552
|
// src/lib/btc/PhantomAdapter.ts
|
|
5560
5553
|
var PhantomAdapter = class {
|
|
@@ -5592,9 +5585,9 @@ var PhantomAdapter = class {
|
|
|
5592
5585
|
// src/hooks/useBTCWallet.ts
|
|
5593
5586
|
var useBTCWallet = () => {
|
|
5594
5587
|
const wallets = [new UnisatAdapter(), new XverseAdapter(), new LeatherAdapter(), new PhantomAdapter()];
|
|
5595
|
-
const [installedWallets, setInstalledWallets] = (0,
|
|
5596
|
-
const [address, setAddress] = (0,
|
|
5597
|
-
(0,
|
|
5588
|
+
const [installedWallets, setInstalledWallets] = (0, import_react36.useState)([]);
|
|
5589
|
+
const [address, setAddress] = (0, import_react36.useState)(null);
|
|
5590
|
+
(0, import_react36.useEffect)(() => {
|
|
5598
5591
|
const getInstalled = async () => {
|
|
5599
5592
|
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
5600
5593
|
wallet: wallet2,
|
|
@@ -5604,11 +5597,11 @@ var useBTCWallet = () => {
|
|
|
5604
5597
|
};
|
|
5605
5598
|
getInstalled();
|
|
5606
5599
|
}, []);
|
|
5607
|
-
const [wallet, chooseWallet] = (0,
|
|
5600
|
+
const [wallet, chooseWallet] = (0, import_react36.useState)(null);
|
|
5608
5601
|
const onConnect = async () => {
|
|
5609
5602
|
setAddress(await wallet.connect());
|
|
5610
5603
|
};
|
|
5611
|
-
(0,
|
|
5604
|
+
(0, import_react36.useEffect)(() => {
|
|
5612
5605
|
if (!wallet) {
|
|
5613
5606
|
setAddress(null);
|
|
5614
5607
|
}
|
|
@@ -5640,10 +5633,10 @@ function BTCConnectModal({
|
|
|
5640
5633
|
phantom: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(PhantomIcon, { size: isDownMd ? 36 : 40 })
|
|
5641
5634
|
};
|
|
5642
5635
|
const { events, login } = useMatch();
|
|
5643
|
-
const [status, setStatus] = (0,
|
|
5644
|
-
const statusRef =
|
|
5645
|
-
const [error, setError] = (0,
|
|
5646
|
-
const connected = (0,
|
|
5636
|
+
const [status, setStatus] = (0, import_react37.useState)("");
|
|
5637
|
+
const statusRef = import_react37.default.useRef(status);
|
|
5638
|
+
const [error, setError] = (0, import_react37.useState)("");
|
|
5639
|
+
const connected = (0, import_react37.useMemo)(() => {
|
|
5647
5640
|
return !!address;
|
|
5648
5641
|
}, [address]);
|
|
5649
5642
|
const disconnect = async () => {
|
|
@@ -5707,7 +5700,7 @@ function BTCConnectModal({
|
|
|
5707
5700
|
statusRef.current = "";
|
|
5708
5701
|
}
|
|
5709
5702
|
};
|
|
5710
|
-
(0,
|
|
5703
|
+
(0, import_react37.useEffect)(() => {
|
|
5711
5704
|
if (wallet) {
|
|
5712
5705
|
console.log("onConnect");
|
|
5713
5706
|
try {
|
|
@@ -5720,12 +5713,12 @@ function BTCConnectModal({
|
|
|
5720
5713
|
setStatus("");
|
|
5721
5714
|
}
|
|
5722
5715
|
}, [wallet]);
|
|
5723
|
-
(0,
|
|
5716
|
+
(0, import_react37.useEffect)(() => {
|
|
5724
5717
|
if (address) {
|
|
5725
5718
|
toLoginInWallet();
|
|
5726
5719
|
}
|
|
5727
5720
|
}, [address]);
|
|
5728
|
-
(0,
|
|
5721
|
+
(0, import_react37.useEffect)(() => {
|
|
5729
5722
|
if (!props.isOpen) {
|
|
5730
5723
|
disconnect();
|
|
5731
5724
|
}
|
|
@@ -5790,7 +5783,7 @@ function BTCModal(props) {
|
|
|
5790
5783
|
}
|
|
5791
5784
|
|
|
5792
5785
|
// src/components/WalletModal/index.tsx
|
|
5793
|
-
var
|
|
5786
|
+
var import_react38 = require("react");
|
|
5794
5787
|
var import_react_intl19 = require("react-intl");
|
|
5795
5788
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
5796
5789
|
function WalletConnectModal({
|
|
@@ -5802,7 +5795,7 @@ function WalletConnectModal({
|
|
|
5802
5795
|
const { walletMap } = useWalletConfig();
|
|
5803
5796
|
const { bind, login } = useUserInfo();
|
|
5804
5797
|
const config = useAppConfig();
|
|
5805
|
-
const methods = (0,
|
|
5798
|
+
const methods = (0, import_react38.useMemo)(() => {
|
|
5806
5799
|
if (_methods) return _methods;
|
|
5807
5800
|
if (!config.platform) {
|
|
5808
5801
|
return [];
|
|
@@ -5834,11 +5827,11 @@ function WalletModal(props) {
|
|
|
5834
5827
|
}
|
|
5835
5828
|
|
|
5836
5829
|
// src/components/AlphaAvatar/index.tsx
|
|
5837
|
-
var
|
|
5830
|
+
var import_react39 = require("react");
|
|
5838
5831
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
5839
5832
|
function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
5840
|
-
const [avatar, setAvatar] = (0,
|
|
5841
|
-
(0,
|
|
5833
|
+
const [avatar, setAvatar] = (0, import_react39.useState)(void 0);
|
|
5834
|
+
(0, import_react39.useEffect)(() => {
|
|
5842
5835
|
if (name) {
|
|
5843
5836
|
const char = name[0].toUpperCase();
|
|
5844
5837
|
setAvatar(char);
|
|
@@ -5935,7 +5928,7 @@ function WalletAsset({
|
|
|
5935
5928
|
}
|
|
5936
5929
|
|
|
5937
5930
|
// src/components/TokenSend/index.tsx
|
|
5938
|
-
var
|
|
5931
|
+
var import_react40 = require("react");
|
|
5939
5932
|
var import_viem15 = require("viem");
|
|
5940
5933
|
var import_react_intl20 = require("react-intl");
|
|
5941
5934
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
@@ -5973,22 +5966,22 @@ function TokenSend({
|
|
|
5973
5966
|
const intl = (0, import_react_intl20.useIntl)();
|
|
5974
5967
|
const { createWalletClient: createWalletClient2 } = useWallet();
|
|
5975
5968
|
const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
|
|
5976
|
-
const chain = (0,
|
|
5969
|
+
const chain = (0, import_react40.useMemo)(() => {
|
|
5977
5970
|
return chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
5978
5971
|
}, [chainList, token.chain_id]);
|
|
5979
|
-
const walletClient = (0,
|
|
5972
|
+
const walletClient = (0, import_react40.useMemo)(() => {
|
|
5980
5973
|
return createWalletClient2({
|
|
5981
5974
|
// @ts-ignore
|
|
5982
5975
|
chain: (0, import_viem15.defineChain)(chain),
|
|
5983
5976
|
transport: (0, import_viem15.http)()
|
|
5984
5977
|
});
|
|
5985
5978
|
}, [chain]);
|
|
5986
|
-
const [amount, setAmount] = (0,
|
|
5987
|
-
const [address, setAddress] = (0,
|
|
5988
|
-
const [loading, setLoading] = (0,
|
|
5989
|
-
const [sending, setSending] = (0,
|
|
5990
|
-
const [txError, setTxError] = (0,
|
|
5991
|
-
const transaction = (0,
|
|
5979
|
+
const [amount, setAmount] = (0, import_react40.useState)("");
|
|
5980
|
+
const [address, setAddress] = (0, import_react40.useState)("");
|
|
5981
|
+
const [loading, setLoading] = (0, import_react40.useState)(false);
|
|
5982
|
+
const [sending, setSending] = (0, import_react40.useState)(false);
|
|
5983
|
+
const [txError, setTxError] = (0, import_react40.useState)("");
|
|
5984
|
+
const transaction = (0, import_react40.useMemo)(() => {
|
|
5992
5985
|
const reg = /^0x[a-fA-F0-9]{40}$/;
|
|
5993
5986
|
if (!amount || !address || !reg.test(address)) {
|
|
5994
5987
|
return;
|
|
@@ -6019,7 +6012,7 @@ function TokenSend({
|
|
|
6019
6012
|
setLoading(false);
|
|
6020
6013
|
}
|
|
6021
6014
|
};
|
|
6022
|
-
const error = (0,
|
|
6015
|
+
const error = (0, import_react40.useMemo)(() => {
|
|
6023
6016
|
setTxError("");
|
|
6024
6017
|
let amountError = "";
|
|
6025
6018
|
let addressError = "";
|
|
@@ -6062,7 +6055,7 @@ function TokenSend({
|
|
|
6062
6055
|
setAmount(value);
|
|
6063
6056
|
}
|
|
6064
6057
|
};
|
|
6065
|
-
const canSend = (0,
|
|
6058
|
+
const canSend = (0, import_react40.useMemo)(() => {
|
|
6066
6059
|
return !error.amount && !error.address && amount && address;
|
|
6067
6060
|
}, [error]);
|
|
6068
6061
|
const onNext = async () => {
|
|
@@ -6072,7 +6065,7 @@ function TokenSend({
|
|
|
6072
6065
|
}
|
|
6073
6066
|
onClose();
|
|
6074
6067
|
};
|
|
6075
|
-
(0,
|
|
6068
|
+
(0, import_react40.useEffect)(() => {
|
|
6076
6069
|
const receiveMessage = (event) => {
|
|
6077
6070
|
if (event.data) {
|
|
6078
6071
|
if (event.data.source == "match-wallet") {
|
|
@@ -6204,7 +6197,7 @@ function TokenDetail({
|
|
|
6204
6197
|
}
|
|
6205
6198
|
|
|
6206
6199
|
// src/components/TokenSendList/index.tsx
|
|
6207
|
-
var
|
|
6200
|
+
var import_react41 = require("react");
|
|
6208
6201
|
var import_react_intl22 = require("react-intl");
|
|
6209
6202
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
6210
6203
|
function TokenSendList({ close }) {
|
|
@@ -6214,7 +6207,7 @@ function TokenSendList({ close }) {
|
|
|
6214
6207
|
list: walletAssets.mergedAssets
|
|
6215
6208
|
});
|
|
6216
6209
|
const { list } = useMatchChain();
|
|
6217
|
-
const [checked, setChecked] = (0,
|
|
6210
|
+
const [checked, setChecked] = (0, import_react41.useState)();
|
|
6218
6211
|
const modal = useModal();
|
|
6219
6212
|
const onNext = () => {
|
|
6220
6213
|
checked && modal.show((props) => {
|
|
@@ -6271,7 +6264,7 @@ function TokenSendList({ close }) {
|
|
|
6271
6264
|
|
|
6272
6265
|
// src/components/TransactionList/index.tsx
|
|
6273
6266
|
var import_react_infinite_scroll_component = __toESM(require("react-infinite-scroll-component"));
|
|
6274
|
-
var
|
|
6267
|
+
var import_react42 = require("react");
|
|
6275
6268
|
var import_viem16 = require("viem");
|
|
6276
6269
|
var import_viem17 = require("viem");
|
|
6277
6270
|
var import_react_intl23 = require("react-intl");
|
|
@@ -6281,8 +6274,8 @@ var Item = ({ data }) => {
|
|
|
6281
6274
|
const isOut = data.from.toLowerCase() == address.toLowerCase();
|
|
6282
6275
|
const { chain, chainId, explorerLink, formatUnits: chainFormatUnits } = useMatchChain();
|
|
6283
6276
|
const { contracts } = useContractStore_default();
|
|
6284
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
6285
|
-
const transferType = (0,
|
|
6277
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react42.useState)(true);
|
|
6278
|
+
const transferType = (0, import_react42.useMemo)(() => {
|
|
6286
6279
|
const methodId = data.input.substring(2, 10);
|
|
6287
6280
|
if (methodId == "095ea7b3") {
|
|
6288
6281
|
return "erc20_approve";
|
|
@@ -6292,7 +6285,7 @@ var Item = ({ data }) => {
|
|
|
6292
6285
|
}
|
|
6293
6286
|
return "unknown";
|
|
6294
6287
|
}, [data.input]);
|
|
6295
|
-
const to = (0,
|
|
6288
|
+
const to = (0, import_react42.useMemo)(() => {
|
|
6296
6289
|
if (!isOut) {
|
|
6297
6290
|
return data.from;
|
|
6298
6291
|
}
|
|
@@ -6305,7 +6298,7 @@ var Item = ({ data }) => {
|
|
|
6305
6298
|
}
|
|
6306
6299
|
return data.to;
|
|
6307
6300
|
}, [data.input, transferType, data.to, isOut]);
|
|
6308
|
-
const amount = (0,
|
|
6301
|
+
const amount = (0, import_react42.useMemo)(() => {
|
|
6309
6302
|
if (transferType == "erc20_transfer") {
|
|
6310
6303
|
const decodeData = (0, import_viem16.decodeFunctionData)({
|
|
6311
6304
|
abi: import_viem17.erc20Abi,
|
|
@@ -6323,7 +6316,7 @@ var Item = ({ data }) => {
|
|
|
6323
6316
|
refetchInterval: shouldRefetch ? 3e3 : false,
|
|
6324
6317
|
enabled: shouldRefetch && data.source == "local"
|
|
6325
6318
|
});
|
|
6326
|
-
const status = (0,
|
|
6319
|
+
const status = (0, import_react42.useMemo)(() => {
|
|
6327
6320
|
if (data.source == "matchain") {
|
|
6328
6321
|
switch (data.extra.status) {
|
|
6329
6322
|
case "ok":
|
|
@@ -6350,12 +6343,12 @@ var Item = ({ data }) => {
|
|
|
6350
6343
|
}
|
|
6351
6344
|
return "loading";
|
|
6352
6345
|
}, [data.extra?.status, data.source, hashQuery.data]);
|
|
6353
|
-
(0,
|
|
6346
|
+
(0, import_react42.useEffect)(() => {
|
|
6354
6347
|
if (data.hash) {
|
|
6355
6348
|
setShouldRefetch(status == "loading");
|
|
6356
6349
|
}
|
|
6357
6350
|
}, [status, data.hash]);
|
|
6358
|
-
const symbol = (0,
|
|
6351
|
+
const symbol = (0, import_react42.useMemo)(() => {
|
|
6359
6352
|
if (transferType == "erc20_transfer") {
|
|
6360
6353
|
const contract = contracts[`${chainId}-${data.to.toLowerCase()}`];
|
|
6361
6354
|
return contract?.symbol || contract?.name || "unknown";
|