@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/index.js CHANGED
@@ -48,7 +48,7 @@ __export(src_exports, {
48
48
  module.exports = __toCommonJS(src_exports);
49
49
 
50
50
  // src/MatchContext.tsx
51
- var import_react42 = require("react");
51
+ var import_react43 = require("react");
52
52
 
53
53
  // src/hooks/index.tsx
54
54
  var hooks_exports = {};
@@ -2430,11 +2430,11 @@ var RecoveryType = /* @__PURE__ */ ((RecoveryType3) => {
2430
2430
  // src/hooks/useWallet.tsx
2431
2431
  var import_accounts = require("viem/accounts");
2432
2432
  var import_viem8 = require("viem");
2433
- var import_react31 = require("react");
2433
+ var import_react32 = require("react");
2434
2434
  var import_viem9 = require("viem");
2435
2435
 
2436
2436
  // src/context/ModalContext.tsx
2437
- var import_react30 = __toESM(require("react"));
2437
+ var import_react31 = __toESM(require("react"));
2438
2438
  var import_react_dom = require("react-dom");
2439
2439
 
2440
2440
  // src/ui/index.ts
@@ -2447,7 +2447,7 @@ __export(ui_exports, {
2447
2447
  Field: () => Field,
2448
2448
  HashPanel: () => HashPanel_default,
2449
2449
  Input: () => Input,
2450
- Lottie: () => Lottie,
2450
+ Lottie: () => Lottie_default,
2451
2451
  Modal: () => Modal,
2452
2452
  ModalDrawer: () => ModalDrawer,
2453
2453
  ModalWithHeader: () => ModalWithHeader,
@@ -3545,7 +3545,7 @@ function WalletModalContent({
3545
3545
  }, [visible, connected, status, error, address]);
3546
3546
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "matchid-wallet-container", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `matchid-wallet-box`, children: [
3547
3547
  /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `matchid-wallet-content`, children: [
3548
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Lottie, { animationData: pageData.statusImage, style: {
3548
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Lottie_default, { animationData: pageData.statusImage, style: {
3549
3549
  width: 128,
3550
3550
  height: 128
3551
3551
  } }),
@@ -3629,7 +3629,7 @@ function WalletModalContentV2(props) {
3629
3629
  }, [props, submitting]);
3630
3630
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "matchid-wallet-container", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `matchid-wallet-box`, children: [
3631
3631
  /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `matchid-wallet-content`, children: [
3632
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Lottie, { animationData: pageData.statusImage, style: {
3632
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Lottie_default, { animationData: pageData.statusImage, style: {
3633
3633
  width: 128,
3634
3634
  height: 128
3635
3635
  } }),
@@ -5836,7 +5836,7 @@ function HashPanel({
5836
5836
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: `matchid-hashpanel-status`, style: {
5837
5837
  color: statusValue.color
5838
5838
  }, children: statusValue.text }),
5839
- statusValue.lottie ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Lottie, { animationData: statusValue.lottie, style: {
5839
+ statusValue.lottie ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Lottie_default, { animationData: statusValue.lottie, style: {
5840
5840
  width: "96px",
5841
5841
  height: "96px"
5842
5842
  } }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("img", { src: statusValue.icon, alt: statusValue.text, className: `matchid-hashpanel-img` }),
@@ -5962,33 +5962,38 @@ function Tabs(props) {
5962
5962
  }
5963
5963
 
5964
5964
  // src/ui/Lottie/index.tsx
5965
- var import_lottie_react = __toESM(require("lottie-react"));
5965
+ var import_react30 = require("react");
5966
5966
  var import_jsx_runtime89 = require("react/jsx-runtime");
5967
- function Lottie(props) {
5968
- console.log("Lottie", props);
5969
- const result = /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lottie_react.default, { loop: true, autoplay: true, ...props });
5970
- console.log("result", result);
5971
- return result;
5972
- }
5967
+ var LazyLottie = (props) => {
5968
+ const [LottieReact, setLottieReact] = (0, import_react30.useState)(null);
5969
+ (0, import_react30.useEffect)(() => {
5970
+ import("lottie-react").then((mod) => {
5971
+ setLottieReact(mod.default || mod);
5972
+ });
5973
+ }, []);
5974
+ if (!LottieReact) return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { children: "Loading..." });
5975
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(LottieReact, { loop: true, autoplay: true, ...props });
5976
+ };
5977
+ var Lottie_default = LazyLottie;
5973
5978
 
5974
5979
  // src/context/ModalContext.tsx
5975
5980
  var import_jsx_runtime90 = require("react/jsx-runtime");
5976
- var ModalContext = (0, import_react30.createContext)(null);
5981
+ var ModalContext = (0, import_react31.createContext)(null);
5977
5982
  function ModalProvider({ children }) {
5978
- const [modalState, setModalState] = (0, import_react30.useState)({
5983
+ const [modalState, setModalState] = (0, import_react31.useState)({
5979
5984
  modals: [],
5980
5985
  highestZIndex: 100
5981
5986
  });
5982
- const getNextIndex = (0, import_react30.useCallback)(() => {
5987
+ const getNextIndex = (0, import_react31.useCallback)(() => {
5983
5988
  return Math.max(...modalState.modals.map((modal) => modal.index), 0) + 1 || 100;
5984
5989
  }, [modalState]);
5985
- const closeModal = (0, import_react30.useCallback)((index) => {
5990
+ const closeModal = (0, import_react31.useCallback)((index) => {
5986
5991
  setModalState((prevState) => ({
5987
5992
  modals: prevState.modals.filter((modal) => modal.index !== index),
5988
5993
  highestZIndex: prevState.highestZIndex
5989
5994
  }));
5990
5995
  }, []);
5991
- const show = (0, import_react30.useCallback)((content, index) => {
5996
+ const show = (0, import_react31.useCallback)((content, index) => {
5992
5997
  setModalState((prevState) => {
5993
5998
  const modalIndex = index !== void 0 ? index : getNextIndex();
5994
5999
  const newZIndex = prevState.highestZIndex + 1;
@@ -6004,7 +6009,7 @@ function ModalProvider({ children }) {
6004
6009
  };
6005
6010
  });
6006
6011
  }, [getNextIndex, closeModal]);
6007
- const open = (0, import_react30.useCallback)((props) => {
6012
+ const open = (0, import_react31.useCallback)((props) => {
6008
6013
  setModalState((prevState) => {
6009
6014
  const modalIndex = props.index !== void 0 ? props.index : getNextIndex();
6010
6015
  const newZIndex = prevState.highestZIndex + 1;
@@ -6022,7 +6027,7 @@ function ModalProvider({ children }) {
6022
6027
  }, [getNextIndex, closeModal]);
6023
6028
  const modalElements = modalState.modals.sort((a, b) => b.zIndex - a.zIndex).map(
6024
6029
  (modal) => modal.visible ? (0, import_react_dom.createPortal)(
6025
- import_react30.default.createElement(modal.content, { zIndex: modal.zIndex, close: modal.close }),
6030
+ import_react31.default.createElement(modal.content, { zIndex: modal.zIndex, close: modal.close }),
6026
6031
  document.body
6027
6032
  ) : null
6028
6033
  );
@@ -6032,7 +6037,7 @@ function ModalProvider({ children }) {
6032
6037
  ] });
6033
6038
  }
6034
6039
  function useModal() {
6035
- const context = (0, import_react30.useContext)(ModalContext);
6040
+ const context = (0, import_react31.useContext)(ModalContext);
6036
6041
  if (!context) {
6037
6042
  throw new Error("useModal must be used within a ModalProvider");
6038
6043
  }
@@ -6121,7 +6126,7 @@ function useWallet() {
6121
6126
  throw error;
6122
6127
  }
6123
6128
  };
6124
- const evmAccount = (0, import_react31.useMemo)(() => {
6129
+ const evmAccount = (0, import_react32.useMemo)(() => {
6125
6130
  try {
6126
6131
  return address ? (0, import_accounts.toAccount)({
6127
6132
  address,
@@ -6160,7 +6165,7 @@ function useWallet() {
6160
6165
  return void 0;
6161
6166
  }
6162
6167
  }, [address]);
6163
- (0, import_react31.useEffect)(() => {
6168
+ (0, import_react32.useEffect)(() => {
6164
6169
  matchlog_default.log("qwe-evmAccount", evmAccount);
6165
6170
  }, [evmAccount]);
6166
6171
  const realCreateWalletClient = (parameters) => {
@@ -6303,14 +6308,14 @@ function useWallet() {
6303
6308
 
6304
6309
  // src/hooks/useCopyClipboard.ts
6305
6310
  var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
6306
- var import_react32 = require("react");
6311
+ var import_react33 = require("react");
6307
6312
  function useCopyClipboard(timeout = 500) {
6308
- const [isCopied, setIsCopied] = (0, import_react32.useState)(false);
6309
- const staticCopy = (0, import_react32.useCallback)((text) => {
6313
+ const [isCopied, setIsCopied] = (0, import_react33.useState)(false);
6314
+ const staticCopy = (0, import_react33.useCallback)((text) => {
6310
6315
  const didCopy = (0, import_copy_to_clipboard.default)(text);
6311
6316
  setIsCopied(didCopy);
6312
6317
  }, []);
6313
- (0, import_react32.useEffect)(() => {
6318
+ (0, import_react33.useEffect)(() => {
6314
6319
  if (isCopied) {
6315
6320
  const hide = setTimeout(() => {
6316
6321
  setIsCopied(false);
@@ -6325,24 +6330,24 @@ function useCopyClipboard(timeout = 500) {
6325
6330
  }
6326
6331
 
6327
6332
  // src/context/ToastContext.tsx
6328
- var import_react33 = require("react");
6333
+ var import_react34 = require("react");
6329
6334
  var import_react_dom2 = require("react-dom");
6330
6335
  var import_jsx_runtime92 = require("react/jsx-runtime");
6331
- var ToastContext = (0, import_react33.createContext)(null);
6336
+ var ToastContext = (0, import_react34.createContext)(null);
6332
6337
  function ToastProvider({ children, zIndex = 299 }) {
6333
- const [toasts, setToasts] = (0, import_react33.useState)([]);
6334
- const removeToast = (0, import_react33.useCallback)((id) => {
6338
+ const [toasts, setToasts] = (0, import_react34.useState)([]);
6339
+ const removeToast = (0, import_react34.useCallback)((id) => {
6335
6340
  setToasts((prev) => prev.filter((toast) => toast.id !== id));
6336
6341
  }, []);
6337
- const show = (0, import_react33.useCallback)(({ icon, timeout = 3e3, text }) => {
6342
+ const show = (0, import_react34.useCallback)(({ icon, timeout = 3e3, text }) => {
6338
6343
  const id = Date.now() + Math.random();
6339
6344
  setToasts((prev) => [...prev, { id, icon, text }]);
6340
6345
  setTimeout(() => removeToast(id), timeout);
6341
6346
  }, [removeToast]);
6342
- const success = (0, import_react33.useCallback)((text, timeout) => {
6347
+ const success = (0, import_react34.useCallback)((text, timeout) => {
6343
6348
  show({ icon: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(CheckRoundIcon, { color: "#2FCC00", size: 24 }), text, timeout });
6344
6349
  }, [show]);
6345
- const error = (0, import_react33.useCallback)((text, timeout) => {
6350
+ const error = (0, import_react34.useCallback)((text, timeout) => {
6346
6351
  show({ icon: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ErrorRoundIcon, { size: 24 }), text, timeout });
6347
6352
  }, [show]);
6348
6353
  const ToastComponent = (0, import_react_dom2.createPortal)(
@@ -6367,7 +6372,7 @@ function ToastProvider({ children, zIndex = 299 }) {
6367
6372
  ] });
6368
6373
  }
6369
6374
  function useToast() {
6370
- const context = (0, import_react33.useContext)(ToastContext);
6375
+ const context = (0, import_react34.useContext)(ToastContext);
6371
6376
  if (!context) {
6372
6377
  throw new Error("useToast must be used within a ToastProvider");
6373
6378
  }
@@ -6503,7 +6508,7 @@ function useWalletAssetListQuery({
6503
6508
  }
6504
6509
 
6505
6510
  // src/hooks/useMatchChain.tsx
6506
- var import_react34 = require("react");
6511
+ var import_react35 = require("react");
6507
6512
  var import_viem10 = require("viem");
6508
6513
  var import_react_intl19 = require("react-intl");
6509
6514
  var import_jsx_runtime93 = require("react/jsx-runtime");
@@ -6512,7 +6517,7 @@ function useMatchChain() {
6512
6517
  const modal = useModal();
6513
6518
  const intl = (0, import_react_intl19.useIntl)();
6514
6519
  const { chainId: storeChainId, setChainId } = useLocalStore_default();
6515
- const chainId = (0, import_react34.useMemo)(() => {
6520
+ const chainId = (0, import_react35.useMemo)(() => {
6516
6521
  if (!chainListQuery.data || !chainListQuery.data.length) {
6517
6522
  return null;
6518
6523
  }
@@ -6521,7 +6526,7 @@ function useMatchChain() {
6521
6526
  }
6522
6527
  return chainListQuery.data[0].id;
6523
6528
  }, [storeChainId, chainListQuery.data]);
6524
- const chain = (0, import_react34.useMemo)(() => {
6529
+ const chain = (0, import_react35.useMemo)(() => {
6525
6530
  if (!chainListQuery.data || !chainListQuery.data.length) {
6526
6531
  return null;
6527
6532
  }
@@ -6535,7 +6540,7 @@ function useMatchChain() {
6535
6540
  close
6536
6541
  }) {
6537
6542
  const { chainId: storeChainId2, setChainId: setChainId2 } = useLocalStore_default();
6538
- const [selectedChainId, setSelectedChainId] = (0, import_react34.useState)(storeChainId2);
6543
+ const [selectedChainId, setSelectedChainId] = (0, import_react35.useState)(storeChainId2);
6539
6544
  const isDownMd = useDownMd();
6540
6545
  return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: `matchid-change-network-box`, children: [
6541
6546
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: `matchid-change-network-list`, children: chainListQuery.data?.map((item, index) => {
@@ -6567,7 +6572,7 @@ function useMatchChain() {
6567
6572
  content: ChangeNetwork
6568
6573
  });
6569
6574
  };
6570
- const publicClient = (0, import_react34.useMemo)(() => {
6575
+ const publicClient = (0, import_react35.useMemo)(() => {
6571
6576
  if (!chain) {
6572
6577
  return null;
6573
6578
  }
@@ -6595,13 +6600,13 @@ function useMatchChain() {
6595
6600
 
6596
6601
  // src/hooks/useMatchWallet.tsx
6597
6602
  var import_react_qrcode = require("react-qrcode");
6598
- var import_react36 = require("react");
6603
+ var import_react37 = require("react");
6599
6604
  var import_react_query6 = require("@tanstack/react-query");
6600
6605
  var import_viem13 = require("viem");
6601
6606
  var import_react_intl21 = require("react-intl");
6602
6607
 
6603
6608
  // src/components/ImportToken/index.tsx
6604
- var import_react35 = require("react");
6609
+ var import_react36 = require("react");
6605
6610
  var import_react_intl20 = require("react-intl");
6606
6611
  var import_react_query5 = require("@tanstack/react-query");
6607
6612
  var import_viem12 = require("viem");
@@ -6633,12 +6638,12 @@ function useIsContract({
6633
6638
  // src/components/ImportToken/index.tsx
6634
6639
  var import_jsx_runtime94 = require("react/jsx-runtime");
6635
6640
  function ImportToken({ close }) {
6636
- const [status, setStatus] = (0, import_react35.useState)("");
6641
+ const [status, setStatus] = (0, import_react36.useState)("");
6637
6642
  const { token } = useUserInfo();
6638
- const [address, setAddress] = (0, import_react35.useState)("");
6639
- const [symbol, setSymbol] = (0, import_react35.useState)("");
6640
- const [decimals, setDecimals] = (0, import_react35.useState)("");
6641
- const [error, setError] = (0, import_react35.useState)({});
6643
+ const [address, setAddress] = (0, import_react36.useState)("");
6644
+ const [symbol, setSymbol] = (0, import_react36.useState)("");
6645
+ const [decimals, setDecimals] = (0, import_react36.useState)("");
6646
+ const [error, setError] = (0, import_react36.useState)({});
6642
6647
  const { publicClient, chainId, chain } = useMatchChain();
6643
6648
  const getContractInfo = async () => {
6644
6649
  if (!publicClient) return;
@@ -6672,7 +6677,7 @@ function ImportToken({ close }) {
6672
6677
  }
6673
6678
  };
6674
6679
  const intl = (0, import_react_intl20.useIntl)();
6675
- (0, import_react35.useEffect)(() => {
6680
+ (0, import_react36.useEffect)(() => {
6676
6681
  if (address.length === 42) {
6677
6682
  const reg = /^0x[0-9a-fA-F]{40}$/;
6678
6683
  if (!reg.test(address)) {
@@ -6691,7 +6696,7 @@ function ImportToken({ close }) {
6691
6696
  }
6692
6697
  }
6693
6698
  }, [address, publicClient]);
6694
- const [loading, setLoading] = (0, import_react35.useState)(false);
6699
+ const [loading, setLoading] = (0, import_react36.useState)(false);
6695
6700
  const toast = useToast();
6696
6701
  const queryClient2 = (0, import_react_query5.useQueryClient)();
6697
6702
  const onImport = async () => {
@@ -6719,7 +6724,7 @@ function ImportToken({ close }) {
6719
6724
  setLoading(false);
6720
6725
  }
6721
6726
  };
6722
- const canImport = (0, import_react35.useMemo)(() => {
6727
+ const canImport = (0, import_react36.useMemo)(() => {
6723
6728
  if (!address) {
6724
6729
  return false;
6725
6730
  }
@@ -6744,7 +6749,7 @@ function ImportToken({ close }) {
6744
6749
  if (status == "success" || status == "fail") {
6745
6750
  return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: `matchid-import-token-result matchid-flex`, children: [
6746
6751
  /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: `matchid-import-token-result-box matchid-flex`, children: [
6747
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: `matchid-import-token-result-img`, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Lottie, { animationData: status == "success" ? success_default : fail_default, style: {
6752
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: `matchid-import-token-result-img`, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Lottie_default, { animationData: status == "success" ? success_default : fail_default, style: {
6748
6753
  width: "96px",
6749
6754
  height: "96px"
6750
6755
  } }) }),
@@ -6888,12 +6893,12 @@ function useMatchWallet() {
6888
6893
  };
6889
6894
  }
6890
6895
  function useMatchWalletRecords() {
6891
- const [hasMore, setHasMore] = (0, import_react36.useState)(true);
6892
- const [items, setItems] = (0, import_react36.useState)([]);
6896
+ const [hasMore, setHasMore] = (0, import_react37.useState)(true);
6897
+ const [items, setItems] = (0, import_react37.useState)([]);
6893
6898
  const { chainId, publicClient } = useMatchChain();
6894
6899
  const { address } = useWallet();
6895
- const hasMoreRef = (0, import_react36.useRef)(hasMore);
6896
- const nextPageParamsRef = (0, import_react36.useRef)(void 0);
6900
+ const hasMoreRef = (0, import_react37.useRef)(hasMore);
6901
+ const nextPageParamsRef = (0, import_react37.useRef)(void 0);
6897
6902
  const { contracts, setContracts } = useContractStore_default();
6898
6903
  const fetchMoreData = async () => {
6899
6904
  const chainIdStr = chainId ? chainId.toString() : "";
@@ -6920,7 +6925,7 @@ function useMatchWalletRecords() {
6920
6925
  hasMoreRef.current = true;
6921
6926
  fetchMoreData();
6922
6927
  };
6923
- (0, import_react36.useEffect)(() => {
6928
+ (0, import_react37.useEffect)(() => {
6924
6929
  if (chainId && address) {
6925
6930
  onInit();
6926
6931
  }
@@ -6976,7 +6981,7 @@ function useMatchWalletRecords() {
6976
6981
  setContracts(contractMap);
6977
6982
  }
6978
6983
  };
6979
- const list = (0, import_react36.useMemo)(() => {
6984
+ const list = (0, import_react37.useMemo)(() => {
6980
6985
  const localTransactions = transactions[`${chainId}-${address}`] || [];
6981
6986
  const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
6982
6987
  removeList.forEach((item) => {
@@ -7018,7 +7023,7 @@ function useMatchWalletAssets({
7018
7023
  chainId: chainId || 0,
7019
7024
  ...assetListOptions
7020
7025
  });
7021
- const mergedAssets = (0, import_react36.useMemo)(() => {
7026
+ const mergedAssets = (0, import_react37.useMemo)(() => {
7022
7027
  if (!assetListQuery.data && !importTokenQuery.data) return [];
7023
7028
  const assetList = (assetListQuery.data || []).map((asset) => ({
7024
7029
  ...asset,
@@ -7105,7 +7110,7 @@ function useMatchWalletAssetList({
7105
7110
  retry: 3
7106
7111
  // Retry up to 3 times if failed
7107
7112
  });
7108
- const erc20Tokens = (0, import_react36.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
7113
+ const erc20Tokens = (0, import_react37.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
7109
7114
  const erc20BalanceQuery = (0, import_react_query6.useQuery)({
7110
7115
  queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
7111
7116
  queryFn: async () => {
@@ -7133,7 +7138,7 @@ function useMatchWalletAssetList({
7133
7138
  // Refresh every 15 seconds
7134
7139
  retry: 3
7135
7140
  });
7136
- const enrichedAssets = (0, import_react36.useMemo)(() => {
7141
+ const enrichedAssets = (0, import_react37.useMemo)(() => {
7137
7142
  if (!list) return [];
7138
7143
  const erc20Balances = erc20BalanceQuery.data || [];
7139
7144
  return list.map((asset) => {
@@ -7155,7 +7160,7 @@ function useMatchWalletAssetList({
7155
7160
  return { ...asset, balance, value, balanceValue };
7156
7161
  });
7157
7162
  }, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
7158
- (0, import_react36.useEffect)(() => {
7163
+ (0, import_react37.useEffect)(() => {
7159
7164
  const list2 = enrichedAssets.sort((a, b) => {
7160
7165
  if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
7161
7166
  if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
@@ -7180,14 +7185,14 @@ function useMatchWalletAssetList({
7180
7185
  }
7181
7186
 
7182
7187
  // src/hooks/useReceipt.tsx
7183
- var import_react37 = require("react");
7188
+ var import_react38 = require("react");
7184
7189
  var import_react_query7 = require("@tanstack/react-query");
7185
7190
  var import_viem14 = require("viem");
7186
7191
  var CACHE_TTL = 86400 * 30 * 1e3;
7187
7192
  var MAX_CACHE_SIZE = 500;
7188
7193
  var STORAGE_KEY = "match_receipt_logs";
7189
7194
  function useReceiptCache() {
7190
- const [cache, setCache] = (0, import_react37.useState)(/* @__PURE__ */ new Map());
7195
+ const [cache, setCache] = (0, import_react38.useState)(/* @__PURE__ */ new Map());
7191
7196
  const isLocalStorageAvailable = (() => {
7192
7197
  try {
7193
7198
  const testKey = "__test__";
@@ -7198,7 +7203,7 @@ function useReceiptCache() {
7198
7203
  return false;
7199
7204
  }
7200
7205
  })();
7201
- (0, import_react37.useEffect)(() => {
7206
+ (0, import_react38.useEffect)(() => {
7202
7207
  if (isLocalStorageAvailable) {
7203
7208
  try {
7204
7209
  const storedData = localStorage.getItem(STORAGE_KEY);
@@ -7217,7 +7222,7 @@ function useReceiptCache() {
7217
7222
  }
7218
7223
  }
7219
7224
  }, []);
7220
- const updateLocalStorage = (0, import_react37.useCallback)((updatedCache) => {
7225
+ const updateLocalStorage = (0, import_react38.useCallback)((updatedCache) => {
7221
7226
  if (isLocalStorageAvailable) {
7222
7227
  try {
7223
7228
  const storedData = localStorage.getItem(STORAGE_KEY);
@@ -7234,7 +7239,7 @@ function useReceiptCache() {
7234
7239
  }
7235
7240
  }
7236
7241
  }, []);
7237
- const set = (0, import_react37.useCallback)((key, value) => {
7242
+ const set = (0, import_react38.useCallback)((key, value) => {
7238
7243
  const now = Date.now();
7239
7244
  const newCache = new Map(cache);
7240
7245
  newCache.forEach((entry, k) => {
@@ -7252,7 +7257,7 @@ function useReceiptCache() {
7252
7257
  setCache(newCache);
7253
7258
  updateLocalStorage(newCache);
7254
7259
  }, [cache, updateLocalStorage]);
7255
- const get = (0, import_react37.useCallback)((key) => {
7260
+ const get = (0, import_react38.useCallback)((key) => {
7256
7261
  const entry = cache.get(key);
7257
7262
  if (entry) {
7258
7263
  if (Date.now() - entry.timestamp > CACHE_TTL) {
@@ -7266,7 +7271,7 @@ function useReceiptCache() {
7266
7271
  }
7267
7272
  return void 0;
7268
7273
  }, [cache, updateLocalStorage]);
7269
- const del = (0, import_react37.useCallback)((key) => {
7274
+ const del = (0, import_react38.useCallback)((key) => {
7270
7275
  if (cache.has(key)) {
7271
7276
  const newCache = new Map(cache);
7272
7277
  newCache.delete(key);
@@ -7274,7 +7279,7 @@ function useReceiptCache() {
7274
7279
  updateLocalStorage(newCache);
7275
7280
  }
7276
7281
  }, [cache, updateLocalStorage]);
7277
- const clear = (0, import_react37.useCallback)(() => {
7282
+ const clear = (0, import_react38.useCallback)(() => {
7278
7283
  setCache(/* @__PURE__ */ new Map());
7279
7284
  if (isLocalStorageAvailable) {
7280
7285
  localStorage.removeItem(STORAGE_KEY);
@@ -7289,7 +7294,7 @@ function useReceipt2({
7289
7294
  const { list } = useMatchChain();
7290
7295
  const cache = useReceiptCache();
7291
7296
  const chain = list?.find((item) => item.id === chainId);
7292
- const [shouldRefetch, setShouldRefetch] = (0, import_react37.useState)(true);
7297
+ const [shouldRefetch, setShouldRefetch] = (0, import_react38.useState)(true);
7293
7298
  const query = (0, import_react_query7.useQuery)({
7294
7299
  queryKey: ["match-tx-receipt", hash, chain],
7295
7300
  queryFn: async () => {
@@ -7315,7 +7320,7 @@ function useReceipt2({
7315
7320
  },
7316
7321
  refetchInterval: shouldRefetch ? 1e4 : false
7317
7322
  });
7318
- (0, import_react37.useEffect)(() => {
7323
+ (0, import_react38.useEffect)(() => {
7319
7324
  if (query.data) {
7320
7325
  setShouldRefetch(false);
7321
7326
  }
@@ -7324,14 +7329,14 @@ function useReceipt2({
7324
7329
  }
7325
7330
 
7326
7331
  // src/hooks/useTransaction.tsx
7327
- var import_react38 = require("react");
7332
+ var import_react39 = require("react");
7328
7333
  var import_react_query8 = require("@tanstack/react-query");
7329
7334
  var import_viem15 = require("viem");
7330
7335
  var CACHE_TTL2 = 86400 * 30 * 1e3;
7331
7336
  var MAX_CACHE_SIZE2 = 500;
7332
7337
  var STORAGE_KEY2 = "match_transaction_logs";
7333
7338
  function useTransactionCache() {
7334
- const [cache, setCache] = (0, import_react38.useState)(/* @__PURE__ */ new Map());
7339
+ const [cache, setCache] = (0, import_react39.useState)(/* @__PURE__ */ new Map());
7335
7340
  const isLocalStorageAvailable = (() => {
7336
7341
  try {
7337
7342
  const testKey = "__test__";
@@ -7342,7 +7347,7 @@ function useTransactionCache() {
7342
7347
  return false;
7343
7348
  }
7344
7349
  })();
7345
- (0, import_react38.useEffect)(() => {
7350
+ (0, import_react39.useEffect)(() => {
7346
7351
  if (isLocalStorageAvailable) {
7347
7352
  try {
7348
7353
  const storedData = localStorage.getItem(STORAGE_KEY2);
@@ -7361,7 +7366,7 @@ function useTransactionCache() {
7361
7366
  }
7362
7367
  }
7363
7368
  }, []);
7364
- const updateLocalStorage = (0, import_react38.useCallback)((updatedCache) => {
7369
+ const updateLocalStorage = (0, import_react39.useCallback)((updatedCache) => {
7365
7370
  if (isLocalStorageAvailable) {
7366
7371
  try {
7367
7372
  const storedData = localStorage.getItem(STORAGE_KEY2);
@@ -7378,7 +7383,7 @@ function useTransactionCache() {
7378
7383
  }
7379
7384
  }
7380
7385
  }, []);
7381
- const set = (0, import_react38.useCallback)((key, value) => {
7386
+ const set = (0, import_react39.useCallback)((key, value) => {
7382
7387
  const now = Date.now();
7383
7388
  const newCache = new Map(cache);
7384
7389
  newCache.forEach((entry, k) => {
@@ -7396,7 +7401,7 @@ function useTransactionCache() {
7396
7401
  setCache(newCache);
7397
7402
  updateLocalStorage(newCache);
7398
7403
  }, [cache, updateLocalStorage]);
7399
- const get = (0, import_react38.useCallback)((key) => {
7404
+ const get = (0, import_react39.useCallback)((key) => {
7400
7405
  const entry = cache.get(key);
7401
7406
  if (entry) {
7402
7407
  if (Date.now() - entry.timestamp > CACHE_TTL2) {
@@ -7410,7 +7415,7 @@ function useTransactionCache() {
7410
7415
  }
7411
7416
  return void 0;
7412
7417
  }, [cache, updateLocalStorage]);
7413
- const del = (0, import_react38.useCallback)((key) => {
7418
+ const del = (0, import_react39.useCallback)((key) => {
7414
7419
  if (cache.has(key)) {
7415
7420
  const newCache = new Map(cache);
7416
7421
  newCache.delete(key);
@@ -7418,7 +7423,7 @@ function useTransactionCache() {
7418
7423
  updateLocalStorage(newCache);
7419
7424
  }
7420
7425
  }, [cache, updateLocalStorage]);
7421
- const clear = (0, import_react38.useCallback)(() => {
7426
+ const clear = (0, import_react39.useCallback)(() => {
7422
7427
  setCache(/* @__PURE__ */ new Map());
7423
7428
  if (isLocalStorageAvailable) {
7424
7429
  localStorage.removeItem(STORAGE_KEY2);
@@ -7433,7 +7438,7 @@ function useTransaction({
7433
7438
  const { list } = useMatchChain();
7434
7439
  const cache = useTransactionCache();
7435
7440
  const chain = list?.find((item) => item.id === chainId);
7436
- const [shouldRefetch, setShouldRefetch] = (0, import_react38.useState)(true);
7441
+ const [shouldRefetch, setShouldRefetch] = (0, import_react39.useState)(true);
7437
7442
  const query = (0, import_react_query8.useQuery)({
7438
7443
  queryKey: ["match-tx-transaction", hash, chain],
7439
7444
  queryFn: async () => {
@@ -7459,7 +7464,7 @@ function useTransaction({
7459
7464
  },
7460
7465
  refetchInterval: shouldRefetch ? 1e4 : false
7461
7466
  });
7462
- (0, import_react38.useEffect)(() => {
7467
+ (0, import_react39.useEffect)(() => {
7463
7468
  if (query.data) {
7464
7469
  setShouldRefetch(false);
7465
7470
  }
@@ -7468,7 +7473,7 @@ function useTransaction({
7468
7473
  }
7469
7474
 
7470
7475
  // src/components/CEXBindModal/index.tsx
7471
- var import_react39 = require("react");
7476
+ var import_react40 = require("react");
7472
7477
  var import_react_intl22 = require("react-intl");
7473
7478
  var import_jsx_runtime96 = require("react/jsx-runtime");
7474
7479
  function CEXBindModal({
@@ -7479,16 +7484,16 @@ function CEXBindModal({
7479
7484
  }) {
7480
7485
  const intl = (0, import_react_intl22.useIntl)();
7481
7486
  const { events } = useMatch();
7482
- const [APIPassphrase, setAPIPassphrase] = (0, import_react39.useState)("");
7487
+ const [APIPassphrase, setAPIPassphrase] = (0, import_react40.useState)("");
7483
7488
  const { refreshOverview } = useUserInfo();
7484
- const [loading, setLoading] = (0, import_react39.useState)(false);
7485
- const [key, setKey] = (0, import_react39.useState)("");
7486
- const [secret, setSecret] = (0, import_react39.useState)("");
7487
- const [error, setError] = (0, import_react39.useState)("");
7488
- const needPassphrase = (0, import_react39.useMemo)(() => {
7489
+ const [loading, setLoading] = (0, import_react40.useState)(false);
7490
+ const [key, setKey] = (0, import_react40.useState)("");
7491
+ const [secret, setSecret] = (0, import_react40.useState)("");
7492
+ const [error, setError] = (0, import_react40.useState)("");
7493
+ const needPassphrase = (0, import_react40.useMemo)(() => {
7489
7494
  return ["bitget", "okx"].includes(type.toLowerCase());
7490
7495
  }, [type]);
7491
- (0, import_react39.useEffect)(() => {
7496
+ (0, import_react40.useEffect)(() => {
7492
7497
  if (isOpen) {
7493
7498
  setSecret("");
7494
7499
  setKey("");
@@ -7688,7 +7693,7 @@ var Providers = ({ children }) => {
7688
7693
  var context_default = Providers;
7689
7694
 
7690
7695
  // src/hooks/useWalletInit.ts
7691
- var import_react40 = require("react");
7696
+ var import_react41 = require("react");
7692
7697
 
7693
7698
  // src/utils/wallet.ts
7694
7699
  var sendMessage = ({ method, data, resolve, reject, timeout }) => {
@@ -7721,11 +7726,11 @@ function useWalletInit({
7721
7726
  }) {
7722
7727
  const { endpoints, token, setWallet, appid, refreshOverview } = useLocalStore_default();
7723
7728
  const { setWalletReady, walletReady } = useStore_default();
7724
- const iframeReadyRef = (0, import_react40.useRef)(walletReady);
7725
- (0, import_react40.useEffect)(() => {
7729
+ const iframeReadyRef = (0, import_react41.useRef)(walletReady);
7730
+ (0, import_react41.useEffect)(() => {
7726
7731
  setWallet(config);
7727
7732
  }, [config]);
7728
- (0, import_react40.useEffect)(() => {
7733
+ (0, import_react41.useEffect)(() => {
7729
7734
  matchlog_default.log("sdk.mpc.status", walletReady, iframeReadyRef.current);
7730
7735
  iframeReadyRef.current = walletReady;
7731
7736
  if (iframeReadyRef.current) {
@@ -7742,7 +7747,7 @@ function useWalletInit({
7742
7747
  onReady();
7743
7748
  }
7744
7749
  }, [walletReady]);
7745
- (0, import_react40.useEffect)(() => {
7750
+ (0, import_react41.useEffect)(() => {
7746
7751
  if (!endpoints.auth || !appid || !token || !config) {
7747
7752
  const existingIframe = getWalletIframe();
7748
7753
  if (existingIframe) {
@@ -7842,7 +7847,7 @@ function useWalletInit({
7842
7847
  }
7843
7848
  }
7844
7849
  }, [endpoints.auth, appid, token, config]);
7845
- (0, import_react40.useEffect)(() => {
7850
+ (0, import_react41.useEffect)(() => {
7846
7851
  const messageHandle = async (e) => {
7847
7852
  if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
7848
7853
  return;
@@ -7923,7 +7928,7 @@ function useWalletInit({
7923
7928
  }
7924
7929
 
7925
7930
  // src/hooks/useInit.tsx
7926
- var import_react41 = require("react");
7931
+ var import_react42 = require("react");
7927
7932
  function useInit({
7928
7933
  theme,
7929
7934
  appid,
@@ -7943,24 +7948,24 @@ function useInit({
7943
7948
  locale: realLocale
7944
7949
  } = useLocalStore_default();
7945
7950
  const walletModalStore = useWalletModalStore();
7946
- const overviewLoadingRef = (0, import_react41.useRef)(false);
7951
+ const overviewLoadingRef = (0, import_react42.useRef)(false);
7947
7952
  const searchParams = new URLSearchParams(window.location.search);
7948
7953
  const matchToken = searchParams.get("matchToken");
7949
7954
  const matchidt = searchParams.get("matchidt");
7950
7955
  const realEndpoints = endpoints || env_default.endpoints;
7951
- (0, import_react41.useEffect)(() => {
7956
+ (0, import_react42.useEffect)(() => {
7952
7957
  setTheme(theme);
7953
7958
  }, [theme]);
7954
- (0, import_react41.useEffect)(() => {
7959
+ (0, import_react42.useEffect)(() => {
7955
7960
  setAppid(appid);
7956
7961
  }, [appid]);
7957
- (0, import_react41.useEffect)(() => {
7962
+ (0, import_react42.useEffect)(() => {
7958
7963
  setEndpoints(realEndpoints);
7959
7964
  }, [realEndpoints]);
7960
- (0, import_react41.useEffect)(() => {
7965
+ (0, import_react42.useEffect)(() => {
7961
7966
  setLocale(locale || "en");
7962
7967
  }, [locale]);
7963
- (0, import_react41.useEffect)(() => {
7968
+ (0, import_react42.useEffect)(() => {
7964
7969
  if (matchToken) {
7965
7970
  const tokenData = JSON.parse(atob(matchToken));
7966
7971
  if (tokenData && tokenData.mid && tokenData.token) {
@@ -7971,7 +7976,7 @@ function useInit({
7971
7976
  }
7972
7977
  }
7973
7978
  }, [matchToken]);
7974
- (0, import_react41.useEffect)(() => {
7979
+ (0, import_react42.useEffect)(() => {
7975
7980
  if (matchidt) {
7976
7981
  const tokenData = decodeURIComponent(matchidt);
7977
7982
  const data = JSON.parse(decodeBase64(tokenData));
@@ -8001,7 +8006,7 @@ function useInit({
8001
8006
  }
8002
8007
  }
8003
8008
  }, [matchidt]);
8004
- (0, import_react41.useEffect)(() => {
8009
+ (0, import_react42.useEffect)(() => {
8005
8010
  const onLoginMessage = (event) => {
8006
8011
  const res = event.data;
8007
8012
  if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
@@ -8038,7 +8043,7 @@ function useInit({
8038
8043
  overviewLoadingRef.current = false;
8039
8044
  }
8040
8045
  };
8041
- (0, import_react41.useEffect)(() => {
8046
+ (0, import_react42.useEffect)(() => {
8042
8047
  if (token) {
8043
8048
  loadOverview();
8044
8049
  }
@@ -8964,7 +8969,7 @@ var wagmiConfig = (0, import_rainbowkit2.getDefaultConfig)({
8964
8969
  ],
8965
8970
  chains: [import_chains.mainnet, import_chains.polygon, import_chains.optimism, import_chains.arbitrum, import_chains.base, matchMain, matchTest, import_chains.bsc]
8966
8971
  });
8967
- var MatchContext = (0, import_react42.createContext)(void 0);
8972
+ var MatchContext = (0, import_react43.createContext)(void 0);
8968
8973
  var MatchProvider = ({
8969
8974
  children,
8970
8975
  appid,
@@ -9000,7 +9005,7 @@ var MatchProvider = ({
9000
9005
  ) }) }) }) });
9001
9006
  };
9002
9007
  var useMatch = () => {
9003
- const context = (0, import_react42.useContext)(MatchContext);
9008
+ const context = (0, import_react43.useContext)(MatchContext);
9004
9009
  if (context === void 0) {
9005
9010
  throw new Error("useMatch must be used within a MatchProvider");
9006
9011
  }