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