@matchain/matchid-sdk-react 0.1.55-alpha.13 → 0.1.55-alpha.14

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