@matchain/matchid-sdk-react 0.1.55-alpha.11 → 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.
Files changed (59) hide show
  1. package/dist/api.d.mts +2 -2
  2. package/dist/api.d.ts +2 -2
  3. package/dist/api.js +20 -20
  4. package/dist/api.js.map +1 -1
  5. package/dist/api.mjs +2 -2
  6. package/dist/assets/lottie.d.mts +1 -1
  7. package/dist/assets/lottie.d.ts +1 -1
  8. package/dist/chains.d.mts +1 -1
  9. package/dist/chains.d.ts +1 -1
  10. package/dist/{chunk-JTNCYI5F.mjs → chunk-25VAJMUX.mjs} +2 -2
  11. package/dist/{chunk-5WFY6MWJ.mjs → chunk-BB4OTBUS.mjs} +165 -155
  12. package/dist/chunk-BB4OTBUS.mjs.map +1 -0
  13. package/dist/components.d.mts +3 -3
  14. package/dist/components.d.ts +3 -3
  15. package/dist/components.js +172 -162
  16. package/dist/components.js.map +1 -1
  17. package/dist/components.mjs +1 -1
  18. package/dist/hooks.d.mts +4 -2
  19. package/dist/hooks.d.ts +4 -2
  20. package/dist/hooks.js +109 -104
  21. package/dist/hooks.js.map +1 -1
  22. package/dist/hooks.mjs +1 -1
  23. package/dist/icon.d.mts +2 -2
  24. package/dist/icon.d.ts +2 -2
  25. package/dist/{index-De5vVOFw.d.mts → index--EI6w9pi.d.mts} +1008 -1002
  26. package/dist/{index-Bx7ztInz.d.ts → index-4dZbgWG2.d.ts} +1 -1
  27. package/dist/{index-DXRGMAbv.d.mts → index-B50DU_xT.d.mts} +4 -4
  28. package/dist/{index-DXRGMAbv.d.ts → index-B50DU_xT.d.ts} +4 -4
  29. package/dist/{index-BTO2pJRz.d.ts → index-B80rDuha.d.ts} +1 -1
  30. package/dist/{index-DY5CjOq2.d.ts → index-BBghnVDr.d.ts} +1 -1
  31. package/dist/{index-DL0LMDQ0.d.mts → index-C14uKUDG.d.mts} +2 -2
  32. package/dist/{index-DysgDUCb.d.mts → index-CDTTHSh0.d.mts} +14 -14
  33. package/dist/{index-DysgDUCb.d.ts → index-CDTTHSh0.d.ts} +14 -14
  34. package/dist/{index-HYPgwvkU.d.mts → index-CHtFnnZk.d.mts} +1 -1
  35. package/dist/{index-ChUeWRxV.d.ts → index-Cl0JpAc1.d.ts} +1008 -1002
  36. package/dist/{index-CopoHLm5.d.ts → index-CwHXzvvB.d.ts} +1 -1
  37. package/dist/{index-8h2kA48e.d.ts → index-DGbpUvkd.d.ts} +2 -2
  38. package/dist/{index-B-u8_Lcy.d.ts → index-Dx4OFZhG.d.mts} +5 -6
  39. package/dist/{index-BW1GRpQ3.d.mts → index-FKxw4Vaa.d.mts} +1 -1
  40. package/dist/{index-D6wTVWuu.d.mts → index-QPdWAVPk.d.mts} +1 -1
  41. package/dist/{index-D2hhRO2j.d.mts → index-TjbO7d74.d.mts} +1 -1
  42. package/dist/{index-Ba8t2zs6.d.mts → index-hiCo96Vc.d.ts} +5 -6
  43. package/dist/index.d.mts +18 -17
  44. package/dist/index.d.ts +18 -17
  45. package/dist/index.js +121 -111
  46. package/dist/index.js.map +1 -1
  47. package/dist/index.mjs +2 -2
  48. package/dist/{types-Ch54HuTY.d.mts → types-DEsY_CPH.d.mts} +1 -1
  49. package/dist/{types-Ch54HuTY.d.ts → types-DEsY_CPH.d.ts} +1 -1
  50. package/dist/types.d.mts +1 -1
  51. package/dist/types.d.ts +1 -1
  52. package/dist/ui.d.mts +3 -3
  53. package/dist/ui.d.ts +3 -3
  54. package/dist/ui.js +14 -9
  55. package/dist/ui.js.map +1 -1
  56. package/dist/ui.mjs +3 -3
  57. package/package.json +1 -1
  58. package/dist/chunk-5WFY6MWJ.mjs.map +0 -1
  59. /package/dist/{chunk-JTNCYI5F.mjs.map → chunk-25VAJMUX.mjs.map} +0 -0
@@ -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 import_react25 = require("react");
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 import_react23 = require("react");
1899
+ var import_react24 = require("react");
1900
1900
 
1901
1901
  // src/MatchContext.tsx
1902
- var import_react22 = require("react");
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 import_react11 = require("react");
1953
+ var import_react12 = require("react");
1954
1954
  var import_viem4 = require("viem");
1955
1955
 
1956
1956
  // src/context/ModalContext.tsx
1957
- var import_react10 = __toESM(require("react"));
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)(Lottie, { animationData: statusValue.lottie, style: {
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 import_lottie_react = __toESM(require("lottie-react"));
2259
+ var import_react10 = require("react");
2260
2260
  var import_jsx_runtime67 = require("react/jsx-runtime");
2261
- function Lottie(props) {
2262
- console.log("Lottie", props);
2263
- const result = /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_lottie_react.default, { loop: true, autoplay: true, ...props });
2264
- console.log("result", result);
2265
- return result;
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, import_react10.createContext)(null);
2275
+ var ModalContext = (0, import_react11.createContext)(null);
2271
2276
  function useModal() {
2272
- const context = (0, import_react10.useContext)(ModalContext);
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, import_react11.useMemo)(() => {
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, import_react11.useEffect)(() => {
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 import_react12 = require("react");
2548
+ var import_react13 = require("react");
2544
2549
  function useCopyClipboard(timeout = 500) {
2545
- const [isCopied, setIsCopied] = (0, import_react12.useState)(false);
2546
- const staticCopy = (0, import_react12.useCallback)((text) => {
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, import_react12.useEffect)(() => {
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 import_react13 = require("react");
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, import_react13.createContext)(null);
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 import_react14 = require("react");
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, import_react14.useMemo)(() => {
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, import_react14.useMemo)(() => {
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, import_react14.useState)(storeChainId2);
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, import_react14.useMemo)(() => {
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 import_react16 = require("react");
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 import_react15 = require("react");
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, import_react16.useState)(true);
2805
- const [items, setItems] = (0, import_react16.useState)([]);
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, import_react16.useRef)(hasMore);
2809
- const nextPageParamsRef = (0, import_react16.useRef)(void 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, import_react16.useEffect)(() => {
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, import_react16.useMemo)(() => {
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, import_react16.useMemo)(() => {
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, import_react16.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
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, import_react16.useMemo)(() => {
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, import_react16.useEffect)(() => {
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 import_react17 = require("react");
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 import_react18 = require("react");
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 import_react19 = require("react");
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 import_react20 = require("react");
3210
+ var import_react21 = require("react");
3206
3211
  var AppClientId2 = getAppClientId();
3207
3212
 
3208
3213
  // src/hooks/useInit.tsx
3209
- var import_react21 = require("react");
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, import_react22.createContext)(void 0);
3306
+ var MatchContext = (0, import_react23.createContext)(void 0);
3302
3307
  var useMatch = () => {
3303
- const context = (0, import_react22.useContext)(MatchContext);
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, import_react23.useMemo)(() => !!token && !!overview, [token, overview]);
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 import_react24 = require("react");
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, import_react24.useState)("");
3615
- const [code, setCode] = (0, import_react24.useState)("");
3616
- const [sending, setSending] = (0, import_react24.useState)(false);
3617
- const [submitting, setSubmitting] = (0, import_react24.useState)(false);
3618
- const sendTimeRef = (0, import_react24.useRef)(0);
3619
- const [sendBtnText, setSendBtnText] = (0, import_react24.useState)(intl.formatMessage({
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, import_react24.useRef)(null);
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, import_react24.useEffect)(() => {
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, import_react24.useMemo)(() => {
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, import_react25.useState)("input");
3741
- const [emailVal, setEmailVal] = (0, import_react25.useState)("");
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, import_react25.useEffect)(() => {
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 import_react26 = require("react");
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, import_react26.useMemo)(() => {
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, import_react26.useState)(false);
3886
+ const [emailOpen, setEmailOpen] = (0, import_react27.useState)(false);
3882
3887
  const { login } = useUserInfo();
3883
- const [showWallet, setShowWallet] = (0, import_react26.useState)(false);
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 import_react28 = require("react");
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 import_react27 = require("react");
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, import_react27.useState)(false);
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, import_react27.useState)(false);
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, import_react28.useState)(false);
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 import_react29 = require("react");
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, import_react29.useState)(username);
4231
- const [error, setError] = (0, import_react29.useState)("");
4235
+ const [val, setVal] = (0, import_react30.useState)(username);
4236
+ const [error, setError] = (0, import_react30.useState)("");
4232
4237
  const isDownMd = useDownMd();
4233
- (0, import_react29.useEffect)(() => {
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, import_react29.useMemo)(() => {
4244
+ const isValid = (0, import_react30.useMemo)(() => {
4240
4245
  return isValidUsername(val);
4241
4246
  }, [val]);
4242
- const isLength = (0, import_react29.useMemo)(() => {
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, import_react29.useState)(false);
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 import_react32 = require("react");
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 import_react30 = require("react");
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, import_react30.useMemo)(() => {
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)(Lottie, { animationData: pageData.statusImage, style: {
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, import_react30.useState)(false);
4416
- const pageData = (0, import_react30.useMemo)(() => {
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)(Lottie, { animationData: pageData.statusImage, style: {
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 import_react31 = require("react");
4509
+ var import_react32 = require("react");
4505
4510
  function useWalletBox({
4506
4511
  onInit
4507
4512
  }) {
4508
- const [status, setStateStatus] = (0, import_react31.useState)("start");
4509
- const [error, setError] = (0, import_react31.useState)("");
4510
- const statusRef = (0, import_react31.useRef)(status);
4511
- const [nonce, setNonce] = (0, import_react31.useState)();
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, import_react31.useEffect)(() => {
4525
+ (0, import_react32.useEffect)(() => {
4521
4526
  init();
4522
4527
  onInit({
4523
4528
  setStatus
@@ -4546,7 +4551,7 @@ var import_wagmi2 = require("wagmi");
4546
4551
  var import_ethers = require("ethers");
4547
4552
 
4548
4553
  // node_modules/@wagmi/core/dist/esm/version.js
4549
- var version = "2.16.3";
4554
+ var version = "2.16.5";
4550
4555
 
4551
4556
  // node_modules/@wagmi/core/dist/esm/utils/getVersion.js
4552
4557
  var getVersion2 = () => `@wagmi/core@${version}`;
@@ -4697,7 +4702,11 @@ async function getConnectorClient(config, parameters = {}) {
4697
4702
  if (config.state.status === "reconnecting" && !connector2.getAccounts && !connector2.getChainId)
4698
4703
  throw new ConnectorUnavailableReconnectingError({ connector: connector2 });
4699
4704
  const [accounts, chainId2] = await Promise.all([
4700
- connector2.getAccounts(),
4705
+ connector2.getAccounts().catch((e) => {
4706
+ if (parameters.account === null)
4707
+ return [];
4708
+ throw e;
4709
+ }),
4701
4710
  connector2.getChainId()
4702
4711
  ]);
4703
4712
  connection = {
@@ -4720,7 +4729,8 @@ async function getConnectorClient(config, parameters = {}) {
4720
4729
  if (connector.getClient)
4721
4730
  return connector.getClient({ chainId });
4722
4731
  const account = (0, import_utils9.parseAccount)(parameters.account ?? connection.accounts[0]);
4723
- account.address = (0, import_utils9.getAddress)(account.address);
4732
+ if (account)
4733
+ account.address = (0, import_utils9.getAddress)(account.address);
4724
4734
  if (parameters.account && !connection.accounts.some((x) => x.toLowerCase() === account.address.toLowerCase()))
4725
4735
  throw new ConnectorAccountNotFoundError({
4726
4736
  address: account.address,
@@ -4770,16 +4780,16 @@ function WalletContent({
4770
4780
  const { disconnectAsync } = (0, import_wagmi3.useDisconnect)({ config });
4771
4781
  const chainId = (0, import_wagmi3.useChainId)();
4772
4782
  const { events, login } = useMatch();
4773
- const [inited, setInited] = (0, import_react32.useState)(false);
4783
+ const [inited, setInited] = (0, import_react33.useState)(false);
4774
4784
  const { status, setStatus, error, setError, statusRef, nonce, setNonce, init } = useWalletBox({
4775
4785
  onInit: async ({ setStatus: setStatus2 }) => {
4776
4786
  setStatus2("start");
4777
4787
  }
4778
4788
  });
4779
- (0, import_react32.useEffect)(() => {
4789
+ (0, import_react33.useEffect)(() => {
4780
4790
  matchlog_default.log(`status=${status}`, `connectModalOpen=${connectModalOpen}`, `address=${address}`, `isConnected=${isConnected}`);
4781
4791
  }, [status, connectModalOpen, isConnected, address]);
4782
- (0, import_react32.useEffect)(() => {
4792
+ (0, import_react33.useEffect)(() => {
4783
4793
  if (connectModalOpen) {
4784
4794
  setStatus("connecting");
4785
4795
  return;
@@ -4792,7 +4802,7 @@ function WalletContent({
4792
4802
  setStatus("start");
4793
4803
  }
4794
4804
  }, [connectModalOpen, address]);
4795
- (0, import_react32.useEffect)(() => {
4805
+ (0, import_react33.useEffect)(() => {
4796
4806
  if (openConnectModal && !isConnected && !inited) {
4797
4807
  openConnectModal && openConnectModal();
4798
4808
  setInited(true);
@@ -4819,7 +4829,7 @@ function WalletContent({
4819
4829
  setError(error2.message);
4820
4830
  }
4821
4831
  };
4822
- const signature = (0, import_react32.useCallback)(async () => {
4832
+ const signature = (0, import_react33.useCallback)(async () => {
4823
4833
  if (!nonce || status != "nonce") {
4824
4834
  return;
4825
4835
  }
@@ -4875,7 +4885,7 @@ function WalletContent({
4875
4885
  setError(error2.reason || error2.message);
4876
4886
  }
4877
4887
  }, [nonce, status, address]);
4878
- (0, import_react32.useEffect)(() => {
4888
+ (0, import_react33.useEffect)(() => {
4879
4889
  if (signature) {
4880
4890
  signature();
4881
4891
  }
@@ -4946,7 +4956,7 @@ function EVMModal(props) {
4946
4956
  }
4947
4957
 
4948
4958
  // src/components/TRONModal/index.tsx
4949
- var import_react34 = __toESM(require("react"));
4959
+ var import_react35 = __toESM(require("react"));
4950
4960
  var import_react_intl16 = require("react-intl");
4951
4961
 
4952
4962
  // src/lib/tron/TronLinkAdapter.ts
@@ -4980,7 +4990,7 @@ var TronLinkAdapter = class {
4980
4990
  };
4981
4991
 
4982
4992
  // src/hooks/useTRONWallet.ts
4983
- var import_react33 = require("react");
4993
+ var import_react34 = require("react");
4984
4994
 
4985
4995
  // src/lib/tron/BitgetAdapter.ts
4986
4996
  var BitgetAdapter = class {
@@ -5025,9 +5035,9 @@ var OKXAdapter = class {
5025
5035
  // src/hooks/useTRONWallet.ts
5026
5036
  var useTRONWallet = () => {
5027
5037
  const wallets = [new TronLinkAdapter(), new BitgetAdapter(), new OKXAdapter()];
5028
- const [installedWallets, setInstalledWallets] = (0, import_react33.useState)([]);
5029
- const [address, setAddress] = (0, import_react33.useState)(null);
5030
- (0, import_react33.useEffect)(() => {
5038
+ const [installedWallets, setInstalledWallets] = (0, import_react34.useState)([]);
5039
+ const [address, setAddress] = (0, import_react34.useState)(null);
5040
+ (0, import_react34.useEffect)(() => {
5031
5041
  const getInstalled = async () => {
5032
5042
  const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
5033
5043
  wallet: wallet2,
@@ -5037,11 +5047,11 @@ var useTRONWallet = () => {
5037
5047
  };
5038
5048
  getInstalled();
5039
5049
  }, []);
5040
- const [wallet, chooseWallet] = (0, import_react33.useState)(null);
5050
+ const [wallet, chooseWallet] = (0, import_react34.useState)(null);
5041
5051
  const onConnect = async () => {
5042
5052
  setAddress(await wallet.connect());
5043
5053
  };
5044
- (0, import_react33.useEffect)(() => {
5054
+ (0, import_react34.useEffect)(() => {
5045
5055
  if (!wallet) {
5046
5056
  setAddress(null);
5047
5057
  }
@@ -5072,10 +5082,10 @@ function TRONConnectModal({
5072
5082
  okx: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(OKXIcon, { size: isDownMd ? 36 : 40 })
5073
5083
  };
5074
5084
  const { events, login } = useMatch();
5075
- const [status, setStatus] = (0, import_react34.useState)("");
5076
- const statusRef = import_react34.default.useRef(status);
5077
- const [error, setError] = (0, import_react34.useState)("");
5078
- const connected = (0, import_react34.useMemo)(() => {
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)(() => {
5079
5089
  return !!address;
5080
5090
  }, [address]);
5081
5091
  const disconnect = async () => {
@@ -5143,7 +5153,7 @@ function TRONConnectModal({
5143
5153
  statusRef.current = "";
5144
5154
  }
5145
5155
  };
5146
- (0, import_react34.useEffect)(() => {
5156
+ (0, import_react35.useEffect)(() => {
5147
5157
  if (wallet) {
5148
5158
  console.log("onConnect");
5149
5159
  onConnect();
@@ -5151,12 +5161,12 @@ function TRONConnectModal({
5151
5161
  setStatus("");
5152
5162
  }
5153
5163
  }, [wallet]);
5154
- (0, import_react34.useEffect)(() => {
5164
+ (0, import_react35.useEffect)(() => {
5155
5165
  if (address) {
5156
5166
  toLoginInWallet();
5157
5167
  }
5158
5168
  }, [address]);
5159
- (0, import_react34.useEffect)(() => {
5169
+ (0, import_react35.useEffect)(() => {
5160
5170
  if (!props.isOpen) {
5161
5171
  disconnect();
5162
5172
  }
@@ -5214,7 +5224,7 @@ function TRONModal(props) {
5214
5224
  }
5215
5225
 
5216
5226
  // src/components/TONModal/index.tsx
5217
- var import_react35 = __toESM(require("react"));
5227
+ var import_react36 = __toESM(require("react"));
5218
5228
  var import_react_intl17 = require("react-intl");
5219
5229
  var import_ui_react = require("@tonconnect/ui-react");
5220
5230
  var import_jsx_runtime91 = require("react/jsx-runtime");
@@ -5223,15 +5233,15 @@ function WalletContent2({
5223
5233
  type
5224
5234
  }) {
5225
5235
  const { events, login } = useMatch();
5226
- const [connected, setConnected] = (0, import_react35.useState)(false);
5236
+ const [connected, setConnected] = (0, import_react36.useState)(false);
5227
5237
  const wallet = (0, import_ui_react.useTonWallet)();
5228
5238
  const userFriendlyAddress = (0, import_ui_react.useTonAddress)();
5229
5239
  const [tonConnectUI] = (0, import_ui_react.useTonConnectUI)();
5230
5240
  const { state, open, close } = (0, import_ui_react.useTonConnectModal)();
5231
- const [status, setStatus] = (0, import_react35.useState)("");
5232
- const statusRef = import_react35.default.useRef(status);
5233
- const [error, setError] = (0, import_react35.useState)("");
5234
- (0, import_react35.useEffect)(() => {
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)(() => {
5235
5245
  const init = async () => {
5236
5246
  if (tonConnectUI.connected) {
5237
5247
  await tonConnectUI.disconnect();
@@ -5304,7 +5314,7 @@ function WalletContent2({
5304
5314
  }
5305
5315
  });
5306
5316
  }, []);
5307
- (0, import_react35.useEffect)(() => {
5317
+ (0, import_react36.useEffect)(() => {
5308
5318
  if (wallet) {
5309
5319
  setConnected(true);
5310
5320
  console.log("Wallet connected:", wallet);
@@ -5315,7 +5325,7 @@ function WalletContent2({
5315
5325
  setStatus("");
5316
5326
  }
5317
5327
  }, [wallet]);
5318
- (0, import_react35.useEffect)(() => {
5328
+ (0, import_react36.useEffect)(() => {
5319
5329
  console.log({
5320
5330
  state,
5321
5331
  wallet
@@ -5395,7 +5405,7 @@ function TONModal(props) {
5395
5405
  }
5396
5406
 
5397
5407
  // src/components/BTCModal/index.tsx
5398
- var import_react37 = __toESM(require("react"));
5408
+ var import_react38 = __toESM(require("react"));
5399
5409
  var import_react_intl18 = require("react-intl");
5400
5410
 
5401
5411
  // src/lib/btc/UnisatAdapter.ts
@@ -5544,7 +5554,7 @@ var LeatherAdapter = class {
5544
5554
  };
5545
5555
 
5546
5556
  // src/hooks/useBTCWallet.ts
5547
- var import_react36 = require("react");
5557
+ var import_react37 = require("react");
5548
5558
 
5549
5559
  // src/lib/btc/PhantomAdapter.ts
5550
5560
  var PhantomAdapter = class {
@@ -5582,9 +5592,9 @@ var PhantomAdapter = class {
5582
5592
  // src/hooks/useBTCWallet.ts
5583
5593
  var useBTCWallet = () => {
5584
5594
  const wallets = [new UnisatAdapter(), new XverseAdapter(), new LeatherAdapter(), new PhantomAdapter()];
5585
- const [installedWallets, setInstalledWallets] = (0, import_react36.useState)([]);
5586
- const [address, setAddress] = (0, import_react36.useState)(null);
5587
- (0, import_react36.useEffect)(() => {
5595
+ const [installedWallets, setInstalledWallets] = (0, import_react37.useState)([]);
5596
+ const [address, setAddress] = (0, import_react37.useState)(null);
5597
+ (0, import_react37.useEffect)(() => {
5588
5598
  const getInstalled = async () => {
5589
5599
  const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
5590
5600
  wallet: wallet2,
@@ -5594,11 +5604,11 @@ var useBTCWallet = () => {
5594
5604
  };
5595
5605
  getInstalled();
5596
5606
  }, []);
5597
- const [wallet, chooseWallet] = (0, import_react36.useState)(null);
5607
+ const [wallet, chooseWallet] = (0, import_react37.useState)(null);
5598
5608
  const onConnect = async () => {
5599
5609
  setAddress(await wallet.connect());
5600
5610
  };
5601
- (0, import_react36.useEffect)(() => {
5611
+ (0, import_react37.useEffect)(() => {
5602
5612
  if (!wallet) {
5603
5613
  setAddress(null);
5604
5614
  }
@@ -5630,10 +5640,10 @@ function BTCConnectModal({
5630
5640
  phantom: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(PhantomIcon, { size: isDownMd ? 36 : 40 })
5631
5641
  };
5632
5642
  const { events, login } = useMatch();
5633
- const [status, setStatus] = (0, import_react37.useState)("");
5634
- const statusRef = import_react37.default.useRef(status);
5635
- const [error, setError] = (0, import_react37.useState)("");
5636
- const connected = (0, import_react37.useMemo)(() => {
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)(() => {
5637
5647
  return !!address;
5638
5648
  }, [address]);
5639
5649
  const disconnect = async () => {
@@ -5697,7 +5707,7 @@ function BTCConnectModal({
5697
5707
  statusRef.current = "";
5698
5708
  }
5699
5709
  };
5700
- (0, import_react37.useEffect)(() => {
5710
+ (0, import_react38.useEffect)(() => {
5701
5711
  if (wallet) {
5702
5712
  console.log("onConnect");
5703
5713
  try {
@@ -5710,12 +5720,12 @@ function BTCConnectModal({
5710
5720
  setStatus("");
5711
5721
  }
5712
5722
  }, [wallet]);
5713
- (0, import_react37.useEffect)(() => {
5723
+ (0, import_react38.useEffect)(() => {
5714
5724
  if (address) {
5715
5725
  toLoginInWallet();
5716
5726
  }
5717
5727
  }, [address]);
5718
- (0, import_react37.useEffect)(() => {
5728
+ (0, import_react38.useEffect)(() => {
5719
5729
  if (!props.isOpen) {
5720
5730
  disconnect();
5721
5731
  }
@@ -5780,7 +5790,7 @@ function BTCModal(props) {
5780
5790
  }
5781
5791
 
5782
5792
  // src/components/WalletModal/index.tsx
5783
- var import_react38 = require("react");
5793
+ var import_react39 = require("react");
5784
5794
  var import_react_intl19 = require("react-intl");
5785
5795
  var import_jsx_runtime93 = require("react/jsx-runtime");
5786
5796
  function WalletConnectModal({
@@ -5792,7 +5802,7 @@ function WalletConnectModal({
5792
5802
  const { walletMap } = useWalletConfig();
5793
5803
  const { bind, login } = useUserInfo();
5794
5804
  const config = useAppConfig();
5795
- const methods = (0, import_react38.useMemo)(() => {
5805
+ const methods = (0, import_react39.useMemo)(() => {
5796
5806
  if (_methods) return _methods;
5797
5807
  if (!config.platform) {
5798
5808
  return [];
@@ -5824,11 +5834,11 @@ function WalletModal(props) {
5824
5834
  }
5825
5835
 
5826
5836
  // src/components/AlphaAvatar/index.tsx
5827
- var import_react39 = require("react");
5837
+ var import_react40 = require("react");
5828
5838
  var import_jsx_runtime94 = require("react/jsx-runtime");
5829
5839
  function AlphaAvatar2({ name, size = 40, className = "" }) {
5830
- const [avatar, setAvatar] = (0, import_react39.useState)(void 0);
5831
- (0, import_react39.useEffect)(() => {
5840
+ const [avatar, setAvatar] = (0, import_react40.useState)(void 0);
5841
+ (0, import_react40.useEffect)(() => {
5832
5842
  if (name) {
5833
5843
  const char = name[0].toUpperCase();
5834
5844
  setAvatar(char);
@@ -5925,7 +5935,7 @@ function WalletAsset({
5925
5935
  }
5926
5936
 
5927
5937
  // src/components/TokenSend/index.tsx
5928
- var import_react40 = require("react");
5938
+ var import_react41 = require("react");
5929
5939
  var import_viem15 = require("viem");
5930
5940
  var import_react_intl20 = require("react-intl");
5931
5941
  var import_jsx_runtime96 = require("react/jsx-runtime");
@@ -5963,22 +5973,22 @@ function TokenSend({
5963
5973
  const intl = (0, import_react_intl20.useIntl)();
5964
5974
  const { createWalletClient: createWalletClient2 } = useWallet();
5965
5975
  const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
5966
- const chain = (0, import_react40.useMemo)(() => {
5976
+ const chain = (0, import_react41.useMemo)(() => {
5967
5977
  return chainList?.find((m) => m.id.toString() === token.chain_id);
5968
5978
  }, [chainList, token.chain_id]);
5969
- const walletClient = (0, import_react40.useMemo)(() => {
5979
+ const walletClient = (0, import_react41.useMemo)(() => {
5970
5980
  return createWalletClient2({
5971
5981
  // @ts-ignore
5972
5982
  chain: (0, import_viem15.defineChain)(chain),
5973
5983
  transport: (0, import_viem15.http)()
5974
5984
  });
5975
5985
  }, [chain]);
5976
- const [amount, setAmount] = (0, import_react40.useState)("");
5977
- const [address, setAddress] = (0, import_react40.useState)("");
5978
- const [loading, setLoading] = (0, import_react40.useState)(false);
5979
- const [sending, setSending] = (0, import_react40.useState)(false);
5980
- const [txError, setTxError] = (0, import_react40.useState)("");
5981
- const transaction = (0, import_react40.useMemo)(() => {
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)(() => {
5982
5992
  const reg = /^0x[a-fA-F0-9]{40}$/;
5983
5993
  if (!amount || !address || !reg.test(address)) {
5984
5994
  return;
@@ -6009,7 +6019,7 @@ function TokenSend({
6009
6019
  setLoading(false);
6010
6020
  }
6011
6021
  };
6012
- const error = (0, import_react40.useMemo)(() => {
6022
+ const error = (0, import_react41.useMemo)(() => {
6013
6023
  setTxError("");
6014
6024
  let amountError = "";
6015
6025
  let addressError = "";
@@ -6052,7 +6062,7 @@ function TokenSend({
6052
6062
  setAmount(value);
6053
6063
  }
6054
6064
  };
6055
- const canSend = (0, import_react40.useMemo)(() => {
6065
+ const canSend = (0, import_react41.useMemo)(() => {
6056
6066
  return !error.amount && !error.address && amount && address;
6057
6067
  }, [error]);
6058
6068
  const onNext = async () => {
@@ -6062,7 +6072,7 @@ function TokenSend({
6062
6072
  }
6063
6073
  onClose();
6064
6074
  };
6065
- (0, import_react40.useEffect)(() => {
6075
+ (0, import_react41.useEffect)(() => {
6066
6076
  const receiveMessage = (event) => {
6067
6077
  if (event.data) {
6068
6078
  if (event.data.source == "match-wallet") {
@@ -6194,7 +6204,7 @@ function TokenDetail({
6194
6204
  }
6195
6205
 
6196
6206
  // src/components/TokenSendList/index.tsx
6197
- var import_react41 = require("react");
6207
+ var import_react42 = require("react");
6198
6208
  var import_react_intl22 = require("react-intl");
6199
6209
  var import_jsx_runtime98 = require("react/jsx-runtime");
6200
6210
  function TokenSendList({ close }) {
@@ -6204,7 +6214,7 @@ function TokenSendList({ close }) {
6204
6214
  list: walletAssets.mergedAssets
6205
6215
  });
6206
6216
  const { list } = useMatchChain();
6207
- const [checked, setChecked] = (0, import_react41.useState)();
6217
+ const [checked, setChecked] = (0, import_react42.useState)();
6208
6218
  const modal = useModal();
6209
6219
  const onNext = () => {
6210
6220
  checked && modal.show((props) => {
@@ -6261,7 +6271,7 @@ function TokenSendList({ close }) {
6261
6271
 
6262
6272
  // src/components/TransactionList/index.tsx
6263
6273
  var import_react_infinite_scroll_component = __toESM(require("react-infinite-scroll-component"));
6264
- var import_react42 = require("react");
6274
+ var import_react43 = require("react");
6265
6275
  var import_viem16 = require("viem");
6266
6276
  var import_viem17 = require("viem");
6267
6277
  var import_react_intl23 = require("react-intl");
@@ -6271,8 +6281,8 @@ var Item = ({ data }) => {
6271
6281
  const isOut = data.from.toLowerCase() == address.toLowerCase();
6272
6282
  const { chain, chainId, explorerLink, formatUnits: chainFormatUnits } = useMatchChain();
6273
6283
  const { contracts } = useContractStore_default();
6274
- const [shouldRefetch, setShouldRefetch] = (0, import_react42.useState)(true);
6275
- const transferType = (0, import_react42.useMemo)(() => {
6284
+ const [shouldRefetch, setShouldRefetch] = (0, import_react43.useState)(true);
6285
+ const transferType = (0, import_react43.useMemo)(() => {
6276
6286
  const methodId = data.input.substring(2, 10);
6277
6287
  if (methodId == "095ea7b3") {
6278
6288
  return "erc20_approve";
@@ -6282,7 +6292,7 @@ var Item = ({ data }) => {
6282
6292
  }
6283
6293
  return "unknown";
6284
6294
  }, [data.input]);
6285
- const to = (0, import_react42.useMemo)(() => {
6295
+ const to = (0, import_react43.useMemo)(() => {
6286
6296
  if (!isOut) {
6287
6297
  return data.from;
6288
6298
  }
@@ -6295,7 +6305,7 @@ var Item = ({ data }) => {
6295
6305
  }
6296
6306
  return data.to;
6297
6307
  }, [data.input, transferType, data.to, isOut]);
6298
- const amount = (0, import_react42.useMemo)(() => {
6308
+ const amount = (0, import_react43.useMemo)(() => {
6299
6309
  if (transferType == "erc20_transfer") {
6300
6310
  const decodeData = (0, import_viem16.decodeFunctionData)({
6301
6311
  abi: import_viem17.erc20Abi,
@@ -6313,7 +6323,7 @@ var Item = ({ data }) => {
6313
6323
  refetchInterval: shouldRefetch ? 3e3 : false,
6314
6324
  enabled: shouldRefetch && data.source == "local"
6315
6325
  });
6316
- const status = (0, import_react42.useMemo)(() => {
6326
+ const status = (0, import_react43.useMemo)(() => {
6317
6327
  if (data.source == "matchain") {
6318
6328
  switch (data.extra.status) {
6319
6329
  case "ok":
@@ -6340,12 +6350,12 @@ var Item = ({ data }) => {
6340
6350
  }
6341
6351
  return "loading";
6342
6352
  }, [data.extra?.status, data.source, hashQuery.data]);
6343
- (0, import_react42.useEffect)(() => {
6353
+ (0, import_react43.useEffect)(() => {
6344
6354
  if (data.hash) {
6345
6355
  setShouldRefetch(status == "loading");
6346
6356
  }
6347
6357
  }, [status, data.hash]);
6348
- const symbol = (0, import_react42.useMemo)(() => {
6358
+ const symbol = (0, import_react43.useMemo)(() => {
6349
6359
  if (transferType == "erc20_transfer") {
6350
6360
  const contract = contracts[`${chainId}-${data.to.toLowerCase()}`];
6351
6361
  return contract?.symbol || contract?.name || "unknown";