@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/hooks.js CHANGED
@@ -357,10 +357,10 @@ var localStore = useLocalStore;
357
357
  var useLocalStore_default = useLocalStore;
358
358
 
359
359
  // src/hooks/useUserInfo.tsx
360
- var import_react34 = require("react");
360
+ var import_react35 = require("react");
361
361
 
362
362
  // src/MatchContext.tsx
363
- var import_react33 = require("react");
363
+ var import_react34 = require("react");
364
364
 
365
365
  // src/store/useModalStore.ts
366
366
  var import_zustand2 = require("zustand");
@@ -1188,7 +1188,7 @@ function HashPanel({
1188
1188
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: `matchid-hashpanel-status`, style: {
1189
1189
  color: statusValue.color
1190
1190
  }, children: statusValue.text }),
1191
- statusValue.lottie ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Lottie, { animationData: statusValue.lottie, style: {
1191
+ statusValue.lottie ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Lottie_default, { animationData: statusValue.lottie, style: {
1192
1192
  width: "96px",
1193
1193
  height: "96px"
1194
1194
  } }) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("img", { src: statusValue.icon, alt: statusValue.text, className: `matchid-hashpanel-img` }),
@@ -1266,17 +1266,22 @@ var import_jsx_runtime75 = require("react/jsx-runtime");
1266
1266
  var import_jsx_runtime76 = require("react/jsx-runtime");
1267
1267
 
1268
1268
  // src/ui/Lottie/index.tsx
1269
- var import_lottie_react = __toESM(require("lottie-react"));
1269
+ var import_react15 = require("react");
1270
1270
  var import_jsx_runtime77 = require("react/jsx-runtime");
1271
- function Lottie(props) {
1272
- console.log("Lottie", props);
1273
- const result = /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lottie_react.default, { loop: true, autoplay: true, ...props });
1274
- console.log("result", result);
1275
- return result;
1276
- }
1271
+ var LazyLottie = (props) => {
1272
+ const [LottieReact, setLottieReact] = (0, import_react15.useState)(null);
1273
+ (0, import_react15.useEffect)(() => {
1274
+ import("lottie-react").then((mod) => {
1275
+ setLottieReact(mod.default || mod);
1276
+ });
1277
+ }, []);
1278
+ if (!LottieReact) return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { children: "Loading..." });
1279
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(LottieReact, { loop: true, autoplay: true, ...props });
1280
+ };
1281
+ var Lottie_default = LazyLottie;
1277
1282
 
1278
1283
  // src/components/EVMModal/index.tsx
1279
- var import_react17 = require("react");
1284
+ var import_react18 = require("react");
1280
1285
 
1281
1286
  // src/hooks/eventManager.ts
1282
1287
  var EventManager = class {
@@ -1310,7 +1315,7 @@ var eventManager_default = eventManager;
1310
1315
  var import_react_intl10 = require("react-intl");
1311
1316
 
1312
1317
  // src/components/WalletModalContent/index.tsx
1313
- var import_react15 = require("react");
1318
+ var import_react16 = require("react");
1314
1319
  var import_jsx_runtime78 = require("react/jsx-runtime");
1315
1320
 
1316
1321
  // src/components/EVMModal/index.tsx
@@ -1318,7 +1323,7 @@ var import_rainbowkit = require("@rainbow-me/rainbowkit");
1318
1323
  var import_wagmi2 = require("wagmi");
1319
1324
 
1320
1325
  // src/hooks/useWalletBox.ts
1321
- var import_react16 = require("react");
1326
+ var import_react17 = require("react");
1322
1327
 
1323
1328
  // src/hooks/useEthersSigner.ts
1324
1329
  var React5 = __toESM(require("react"));
@@ -1331,45 +1336,45 @@ var import_styles = require("@rainbow-me/rainbowkit/styles.css");
1331
1336
  var import_jsx_runtime79 = require("react/jsx-runtime");
1332
1337
 
1333
1338
  // src/components/TRONModal/index.tsx
1334
- var import_react19 = __toESM(require("react"));
1339
+ var import_react20 = __toESM(require("react"));
1335
1340
  var import_react_intl11 = require("react-intl");
1336
1341
 
1337
1342
  // src/hooks/useTRONWallet.ts
1338
- var import_react18 = require("react");
1343
+ var import_react19 = require("react");
1339
1344
 
1340
1345
  // src/components/TRONModal/index.tsx
1341
1346
  var import_jsx_runtime80 = require("react/jsx-runtime");
1342
1347
 
1343
1348
  // src/components/TONModal/index.tsx
1344
- var import_react20 = __toESM(require("react"));
1349
+ var import_react21 = __toESM(require("react"));
1345
1350
  var import_react_intl12 = require("react-intl");
1346
1351
  var import_ui_react = require("@tonconnect/ui-react");
1347
1352
  var import_jsx_runtime81 = require("react/jsx-runtime");
1348
1353
 
1349
1354
  // src/components/BTCModal/index.tsx
1350
- var import_react22 = __toESM(require("react"));
1355
+ var import_react23 = __toESM(require("react"));
1351
1356
  var import_react_intl13 = require("react-intl");
1352
1357
 
1353
1358
  // src/lib/btc/XverseAdapter.ts
1354
1359
  var import_sats_connect = require("sats-connect");
1355
1360
 
1356
1361
  // src/hooks/useBTCWallet.ts
1357
- var import_react21 = require("react");
1362
+ var import_react22 = require("react");
1358
1363
 
1359
1364
  // src/components/BTCModal/index.tsx
1360
1365
  var import_jsx_runtime82 = require("react/jsx-runtime");
1361
1366
 
1362
1367
  // src/components/WalletModal/index.tsx
1363
- var import_react23 = require("react");
1368
+ var import_react24 = require("react");
1364
1369
  var import_react_intl14 = require("react-intl");
1365
1370
  var import_jsx_runtime83 = require("react/jsx-runtime");
1366
1371
 
1367
1372
  // src/components/AlphaAvatar/index.tsx
1368
- var import_react24 = require("react");
1373
+ var import_react25 = require("react");
1369
1374
  var import_jsx_runtime84 = require("react/jsx-runtime");
1370
1375
  function AlphaAvatar2({ name, size = 40, className = "" }) {
1371
- const [avatar, setAvatar] = (0, import_react24.useState)(void 0);
1372
- (0, import_react24.useEffect)(() => {
1376
+ const [avatar, setAvatar] = (0, import_react25.useState)(void 0);
1377
+ (0, import_react25.useEffect)(() => {
1373
1378
  if (name) {
1374
1379
  const char = name[0].toUpperCase();
1375
1380
  setAvatar(char);
@@ -1386,7 +1391,7 @@ function AlphaAvatar2({ name, size = 40, className = "" }) {
1386
1391
  var import_jsx_runtime85 = require("react/jsx-runtime");
1387
1392
 
1388
1393
  // src/components/TokenSend/index.tsx
1389
- var import_react25 = require("react");
1394
+ var import_react26 = require("react");
1390
1395
  var import_viem2 = require("viem");
1391
1396
  var import_react_intl15 = require("react-intl");
1392
1397
  var import_jsx_runtime86 = require("react/jsx-runtime");
@@ -1424,22 +1429,22 @@ function TokenSend({
1424
1429
  const intl = (0, import_react_intl15.useIntl)();
1425
1430
  const { createWalletClient: createWalletClient2 } = useWallet();
1426
1431
  const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
1427
- const chain = (0, import_react25.useMemo)(() => {
1432
+ const chain = (0, import_react26.useMemo)(() => {
1428
1433
  return chainList?.find((m) => m.id.toString() === token.chain_id);
1429
1434
  }, [chainList, token.chain_id]);
1430
- const walletClient = (0, import_react25.useMemo)(() => {
1435
+ const walletClient = (0, import_react26.useMemo)(() => {
1431
1436
  return createWalletClient2({
1432
1437
  // @ts-ignore
1433
1438
  chain: (0, import_viem2.defineChain)(chain),
1434
1439
  transport: (0, import_viem2.http)()
1435
1440
  });
1436
1441
  }, [chain]);
1437
- const [amount, setAmount] = (0, import_react25.useState)("");
1438
- const [address, setAddress] = (0, import_react25.useState)("");
1439
- const [loading, setLoading] = (0, import_react25.useState)(false);
1440
- const [sending, setSending] = (0, import_react25.useState)(false);
1441
- const [txError, setTxError] = (0, import_react25.useState)("");
1442
- const transaction = (0, import_react25.useMemo)(() => {
1442
+ const [amount, setAmount] = (0, import_react26.useState)("");
1443
+ const [address, setAddress] = (0, import_react26.useState)("");
1444
+ const [loading, setLoading] = (0, import_react26.useState)(false);
1445
+ const [sending, setSending] = (0, import_react26.useState)(false);
1446
+ const [txError, setTxError] = (0, import_react26.useState)("");
1447
+ const transaction = (0, import_react26.useMemo)(() => {
1443
1448
  const reg = /^0x[a-fA-F0-9]{40}$/;
1444
1449
  if (!amount || !address || !reg.test(address)) {
1445
1450
  return;
@@ -1470,7 +1475,7 @@ function TokenSend({
1470
1475
  setLoading(false);
1471
1476
  }
1472
1477
  };
1473
- const error = (0, import_react25.useMemo)(() => {
1478
+ const error = (0, import_react26.useMemo)(() => {
1474
1479
  setTxError("");
1475
1480
  let amountError = "";
1476
1481
  let addressError = "";
@@ -1513,7 +1518,7 @@ function TokenSend({
1513
1518
  setAmount(value);
1514
1519
  }
1515
1520
  };
1516
- const canSend = (0, import_react25.useMemo)(() => {
1521
+ const canSend = (0, import_react26.useMemo)(() => {
1517
1522
  return !error.amount && !error.address && amount && address;
1518
1523
  }, [error]);
1519
1524
  const onNext = async () => {
@@ -1523,7 +1528,7 @@ function TokenSend({
1523
1528
  }
1524
1529
  onClose();
1525
1530
  };
1526
- (0, import_react25.useEffect)(() => {
1531
+ (0, import_react26.useEffect)(() => {
1527
1532
  const receiveMessage = (event) => {
1528
1533
  if (event.data) {
1529
1534
  if (event.data.source == "match-wallet") {
@@ -1616,7 +1621,7 @@ var import_react_intl16 = require("react-intl");
1616
1621
  var import_jsx_runtime87 = require("react/jsx-runtime");
1617
1622
 
1618
1623
  // src/components/TokenSendList/index.tsx
1619
- var import_react26 = require("react");
1624
+ var import_react27 = require("react");
1620
1625
  var import_react_intl17 = require("react-intl");
1621
1626
  var import_jsx_runtime88 = require("react/jsx-runtime");
1622
1627
  function TokenSendList({ close }) {
@@ -1626,7 +1631,7 @@ function TokenSendList({ close }) {
1626
1631
  list: walletAssets.mergedAssets
1627
1632
  });
1628
1633
  const { list } = useMatchChain();
1629
- const [checked, setChecked] = (0, import_react26.useState)();
1634
+ const [checked, setChecked] = (0, import_react27.useState)();
1630
1635
  const modal = useModal();
1631
1636
  const onNext = () => {
1632
1637
  checked && modal.show((props) => {
@@ -1683,7 +1688,7 @@ function TokenSendList({ close }) {
1683
1688
 
1684
1689
  // src/components/TransactionList/index.tsx
1685
1690
  var import_react_infinite_scroll_component = __toESM(require("react-infinite-scroll-component"));
1686
- var import_react27 = require("react");
1691
+ var import_react28 = require("react");
1687
1692
  var import_viem3 = require("viem");
1688
1693
  var import_viem4 = require("viem");
1689
1694
 
@@ -1748,7 +1753,7 @@ var import_react_intl18 = require("react-intl");
1748
1753
  var import_jsx_runtime89 = require("react/jsx-runtime");
1749
1754
 
1750
1755
  // src/components/CEXBindModal/index.tsx
1751
- var import_react28 = require("react");
1756
+ var import_react29 = require("react");
1752
1757
  var import_react_intl19 = require("react-intl");
1753
1758
  var import_jsx_runtime90 = require("react/jsx-runtime");
1754
1759
 
@@ -1771,12 +1776,12 @@ var useStore_default = useStore;
1771
1776
  var import_jsx_runtime91 = require("react/jsx-runtime");
1772
1777
 
1773
1778
  // src/context/ModalContext.tsx
1774
- var import_react29 = __toESM(require("react"));
1779
+ var import_react30 = __toESM(require("react"));
1775
1780
  var import_react_dom = require("react-dom");
1776
1781
  var import_jsx_runtime92 = require("react/jsx-runtime");
1777
- var ModalContext = (0, import_react29.createContext)(null);
1782
+ var ModalContext = (0, import_react30.createContext)(null);
1778
1783
  function useModal() {
1779
- const context = (0, import_react29.useContext)(ModalContext);
1784
+ const context = (0, import_react30.useContext)(ModalContext);
1780
1785
  if (!context) {
1781
1786
  throw new Error("useModal must be used within a ModalProvider");
1782
1787
  }
@@ -1784,12 +1789,12 @@ function useModal() {
1784
1789
  }
1785
1790
 
1786
1791
  // src/context/ToastContext.tsx
1787
- var import_react30 = require("react");
1792
+ var import_react31 = require("react");
1788
1793
  var import_react_dom2 = require("react-dom");
1789
1794
  var import_jsx_runtime93 = require("react/jsx-runtime");
1790
- var ToastContext = (0, import_react30.createContext)(null);
1795
+ var ToastContext = (0, import_react31.createContext)(null);
1791
1796
  function useToast() {
1792
- const context = (0, import_react30.useContext)(ToastContext);
1797
+ const context = (0, import_react31.useContext)(ToastContext);
1793
1798
  if (!context) {
1794
1799
  throw new Error("useToast must be used within a ToastProvider");
1795
1800
  }
@@ -1800,11 +1805,11 @@ function useToast() {
1800
1805
  var import_jsx_runtime94 = require("react/jsx-runtime");
1801
1806
 
1802
1807
  // src/hooks/useWalletInit.ts
1803
- var import_react31 = require("react");
1808
+ var import_react32 = require("react");
1804
1809
  var AppClientId = getAppClientId();
1805
1810
 
1806
1811
  // src/hooks/useInit.tsx
1807
- var import_react32 = require("react");
1812
+ var import_react33 = require("react");
1808
1813
 
1809
1814
  // src/MatchContext.tsx
1810
1815
  var import_react_query4 = require("@tanstack/react-query");
@@ -1896,9 +1901,9 @@ var wagmiConfig = (0, import_rainbowkit2.getDefaultConfig)({
1896
1901
  ],
1897
1902
  chains: [import_chains.mainnet, import_chains.polygon, import_chains.optimism, import_chains.arbitrum, import_chains.base, matchMain, matchTest, import_chains.bsc]
1898
1903
  });
1899
- var MatchContext = (0, import_react33.createContext)(void 0);
1904
+ var MatchContext = (0, import_react34.createContext)(void 0);
1900
1905
  var useMatch = () => {
1901
- const context = (0, import_react33.useContext)(MatchContext);
1906
+ const context = (0, import_react34.useContext)(MatchContext);
1902
1907
  if (context === void 0) {
1903
1908
  throw new Error("useMatch must be used within a MatchProvider");
1904
1909
  }
@@ -1932,7 +1937,7 @@ function useUserInfo() {
1932
1937
  const getRedirectUri = () => {
1933
1938
  return encodeURIComponent(window.location.href);
1934
1939
  };
1935
- const isLogin = (0, import_react34.useMemo)(() => !!token && !!overview, [token, overview]);
1940
+ const isLogin = (0, import_react35.useMemo)(() => !!token && !!overview, [token, overview]);
1936
1941
  const logout = async () => {
1937
1942
  try {
1938
1943
  await toLogoutApi();
@@ -2203,9 +2208,9 @@ function useUserInfo() {
2203
2208
  }
2204
2209
 
2205
2210
  // src/hooks/useMatchEvents.ts
2206
- var import_react35 = require("react");
2211
+ var import_react36 = require("react");
2207
2212
  function useMatchEvents(handlers) {
2208
- (0, import_react35.useEffect)(() => {
2213
+ (0, import_react36.useEffect)(() => {
2209
2214
  Object.entries(handlers).forEach(([event, handler2]) => {
2210
2215
  if (handler2) {
2211
2216
  eventManager_default.on(event, handler2);
@@ -2225,7 +2230,7 @@ function useMatchEvents(handlers) {
2225
2230
  var import_viem7 = require("viem");
2226
2231
  var import_accounts = require("viem/accounts");
2227
2232
  var import_viem8 = require("viem");
2228
- var import_react36 = require("react");
2233
+ var import_react37 = require("react");
2229
2234
  var import_viem9 = require("viem");
2230
2235
 
2231
2236
  // src/store/useTransactionStore.ts
@@ -2310,7 +2315,7 @@ function useWallet() {
2310
2315
  throw error;
2311
2316
  }
2312
2317
  };
2313
- const evmAccount = (0, import_react36.useMemo)(() => {
2318
+ const evmAccount = (0, import_react37.useMemo)(() => {
2314
2319
  try {
2315
2320
  return address ? (0, import_accounts.toAccount)({
2316
2321
  address,
@@ -2349,7 +2354,7 @@ function useWallet() {
2349
2354
  return void 0;
2350
2355
  }
2351
2356
  }, [address]);
2352
- (0, import_react36.useEffect)(() => {
2357
+ (0, import_react37.useEffect)(() => {
2353
2358
  matchlog_default.log("qwe-evmAccount", evmAccount);
2354
2359
  }, [evmAccount]);
2355
2360
  const realCreateWalletClient = (parameters) => {
@@ -2492,14 +2497,14 @@ function useWallet() {
2492
2497
 
2493
2498
  // src/hooks/useCopyClipboard.ts
2494
2499
  var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
2495
- var import_react37 = require("react");
2500
+ var import_react38 = require("react");
2496
2501
  function useCopyClipboard(timeout = 500) {
2497
- const [isCopied, setIsCopied] = (0, import_react37.useState)(false);
2498
- const staticCopy = (0, import_react37.useCallback)((text) => {
2502
+ const [isCopied, setIsCopied] = (0, import_react38.useState)(false);
2503
+ const staticCopy = (0, import_react38.useCallback)((text) => {
2499
2504
  const didCopy = (0, import_copy_to_clipboard.default)(text);
2500
2505
  setIsCopied(didCopy);
2501
2506
  }, []);
2502
- (0, import_react37.useEffect)(() => {
2507
+ (0, import_react38.useEffect)(() => {
2503
2508
  if (isCopied) {
2504
2509
  const hide = setTimeout(() => {
2505
2510
  setIsCopied(false);
@@ -2569,7 +2574,7 @@ function useImportTokenListQuery({
2569
2574
  }
2570
2575
 
2571
2576
  // src/hooks/useMatchChain.tsx
2572
- var import_react38 = require("react");
2577
+ var import_react39 = require("react");
2573
2578
  var import_viem10 = require("viem");
2574
2579
  var import_react_intl21 = require("react-intl");
2575
2580
  var import_jsx_runtime97 = require("react/jsx-runtime");
@@ -2578,7 +2583,7 @@ function useMatchChain() {
2578
2583
  const modal = useModal();
2579
2584
  const intl = (0, import_react_intl21.useIntl)();
2580
2585
  const { chainId: storeChainId, setChainId } = useLocalStore_default();
2581
- const chainId = (0, import_react38.useMemo)(() => {
2586
+ const chainId = (0, import_react39.useMemo)(() => {
2582
2587
  if (!chainListQuery.data || !chainListQuery.data.length) {
2583
2588
  return null;
2584
2589
  }
@@ -2587,7 +2592,7 @@ function useMatchChain() {
2587
2592
  }
2588
2593
  return chainListQuery.data[0].id;
2589
2594
  }, [storeChainId, chainListQuery.data]);
2590
- const chain = (0, import_react38.useMemo)(() => {
2595
+ const chain = (0, import_react39.useMemo)(() => {
2591
2596
  if (!chainListQuery.data || !chainListQuery.data.length) {
2592
2597
  return null;
2593
2598
  }
@@ -2601,7 +2606,7 @@ function useMatchChain() {
2601
2606
  close
2602
2607
  }) {
2603
2608
  const { chainId: storeChainId2, setChainId: setChainId2 } = useLocalStore_default();
2604
- const [selectedChainId, setSelectedChainId] = (0, import_react38.useState)(storeChainId2);
2609
+ const [selectedChainId, setSelectedChainId] = (0, import_react39.useState)(storeChainId2);
2605
2610
  const isDownMd = useDownMd();
2606
2611
  return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: `matchid-change-network-box`, children: [
2607
2612
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: `matchid-change-network-list`, children: chainListQuery.data?.map((item, index) => {
@@ -2633,7 +2638,7 @@ function useMatchChain() {
2633
2638
  content: ChangeNetwork
2634
2639
  });
2635
2640
  };
2636
- const publicClient = (0, import_react38.useMemo)(() => {
2641
+ const publicClient = (0, import_react39.useMemo)(() => {
2637
2642
  if (!chain) {
2638
2643
  return null;
2639
2644
  }
@@ -2661,13 +2666,13 @@ function useMatchChain() {
2661
2666
 
2662
2667
  // src/hooks/useMatchWallet.tsx
2663
2668
  var import_react_qrcode = require("react-qrcode");
2664
- var import_react40 = require("react");
2669
+ var import_react41 = require("react");
2665
2670
  var import_react_query8 = require("@tanstack/react-query");
2666
2671
  var import_viem13 = require("viem");
2667
2672
  var import_react_intl23 = require("react-intl");
2668
2673
 
2669
2674
  // src/components/ImportToken/index.tsx
2670
- var import_react39 = require("react");
2675
+ var import_react40 = require("react");
2671
2676
  var import_react_intl22 = require("react-intl");
2672
2677
  var import_react_query7 = require("@tanstack/react-query");
2673
2678
  var import_viem12 = require("viem");
@@ -2699,12 +2704,12 @@ function useIsContract({
2699
2704
  // src/components/ImportToken/index.tsx
2700
2705
  var import_jsx_runtime98 = require("react/jsx-runtime");
2701
2706
  function ImportToken({ close }) {
2702
- const [status, setStatus] = (0, import_react39.useState)("");
2707
+ const [status, setStatus] = (0, import_react40.useState)("");
2703
2708
  const { token } = useUserInfo();
2704
- const [address, setAddress] = (0, import_react39.useState)("");
2705
- const [symbol, setSymbol] = (0, import_react39.useState)("");
2706
- const [decimals, setDecimals] = (0, import_react39.useState)("");
2707
- const [error, setError] = (0, import_react39.useState)({});
2709
+ const [address, setAddress] = (0, import_react40.useState)("");
2710
+ const [symbol, setSymbol] = (0, import_react40.useState)("");
2711
+ const [decimals, setDecimals] = (0, import_react40.useState)("");
2712
+ const [error, setError] = (0, import_react40.useState)({});
2708
2713
  const { publicClient, chainId, chain } = useMatchChain();
2709
2714
  const getContractInfo = async () => {
2710
2715
  if (!publicClient) return;
@@ -2738,7 +2743,7 @@ function ImportToken({ close }) {
2738
2743
  }
2739
2744
  };
2740
2745
  const intl = (0, import_react_intl22.useIntl)();
2741
- (0, import_react39.useEffect)(() => {
2746
+ (0, import_react40.useEffect)(() => {
2742
2747
  if (address.length === 42) {
2743
2748
  const reg = /^0x[0-9a-fA-F]{40}$/;
2744
2749
  if (!reg.test(address)) {
@@ -2757,7 +2762,7 @@ function ImportToken({ close }) {
2757
2762
  }
2758
2763
  }
2759
2764
  }, [address, publicClient]);
2760
- const [loading, setLoading] = (0, import_react39.useState)(false);
2765
+ const [loading, setLoading] = (0, import_react40.useState)(false);
2761
2766
  const toast = useToast();
2762
2767
  const queryClient2 = (0, import_react_query7.useQueryClient)();
2763
2768
  const onImport = async () => {
@@ -2785,7 +2790,7 @@ function ImportToken({ close }) {
2785
2790
  setLoading(false);
2786
2791
  }
2787
2792
  };
2788
- const canImport = (0, import_react39.useMemo)(() => {
2793
+ const canImport = (0, import_react40.useMemo)(() => {
2789
2794
  if (!address) {
2790
2795
  return false;
2791
2796
  }
@@ -2810,7 +2815,7 @@ function ImportToken({ close }) {
2810
2815
  if (status == "success" || status == "fail") {
2811
2816
  return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: `matchid-import-token-result matchid-flex`, children: [
2812
2817
  /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: `matchid-import-token-result-box matchid-flex`, children: [
2813
- /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: `matchid-import-token-result-img`, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Lottie, { animationData: status == "success" ? success_default : fail_default, style: {
2818
+ /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: `matchid-import-token-result-img`, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Lottie_default, { animationData: status == "success" ? success_default : fail_default, style: {
2814
2819
  width: "96px",
2815
2820
  height: "96px"
2816
2821
  } }) }),
@@ -2954,12 +2959,12 @@ function useMatchWallet() {
2954
2959
  };
2955
2960
  }
2956
2961
  function useMatchWalletRecords() {
2957
- const [hasMore, setHasMore] = (0, import_react40.useState)(true);
2958
- const [items, setItems] = (0, import_react40.useState)([]);
2962
+ const [hasMore, setHasMore] = (0, import_react41.useState)(true);
2963
+ const [items, setItems] = (0, import_react41.useState)([]);
2959
2964
  const { chainId, publicClient } = useMatchChain();
2960
2965
  const { address } = useWallet();
2961
- const hasMoreRef = (0, import_react40.useRef)(hasMore);
2962
- const nextPageParamsRef = (0, import_react40.useRef)(void 0);
2966
+ const hasMoreRef = (0, import_react41.useRef)(hasMore);
2967
+ const nextPageParamsRef = (0, import_react41.useRef)(void 0);
2963
2968
  const { contracts, setContracts } = useContractStore_default();
2964
2969
  const fetchMoreData = async () => {
2965
2970
  const chainIdStr = chainId ? chainId.toString() : "";
@@ -2986,7 +2991,7 @@ function useMatchWalletRecords() {
2986
2991
  hasMoreRef.current = true;
2987
2992
  fetchMoreData();
2988
2993
  };
2989
- (0, import_react40.useEffect)(() => {
2994
+ (0, import_react41.useEffect)(() => {
2990
2995
  if (chainId && address) {
2991
2996
  onInit();
2992
2997
  }
@@ -3042,7 +3047,7 @@ function useMatchWalletRecords() {
3042
3047
  setContracts(contractMap);
3043
3048
  }
3044
3049
  };
3045
- const list = (0, import_react40.useMemo)(() => {
3050
+ const list = (0, import_react41.useMemo)(() => {
3046
3051
  const localTransactions = transactions[`${chainId}-${address}`] || [];
3047
3052
  const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
3048
3053
  removeList.forEach((item) => {
@@ -3084,7 +3089,7 @@ function useMatchWalletAssets({
3084
3089
  chainId: chainId || 0,
3085
3090
  ...assetListOptions
3086
3091
  });
3087
- const mergedAssets = (0, import_react40.useMemo)(() => {
3092
+ const mergedAssets = (0, import_react41.useMemo)(() => {
3088
3093
  if (!assetListQuery.data && !importTokenQuery.data) return [];
3089
3094
  const assetList = (assetListQuery.data || []).map((asset) => ({
3090
3095
  ...asset,
@@ -3171,7 +3176,7 @@ function useMatchWalletAssetList({
3171
3176
  retry: 3
3172
3177
  // Retry up to 3 times if failed
3173
3178
  });
3174
- const erc20Tokens = (0, import_react40.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
3179
+ const erc20Tokens = (0, import_react41.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
3175
3180
  const erc20BalanceQuery = (0, import_react_query8.useQuery)({
3176
3181
  queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
3177
3182
  queryFn: async () => {
@@ -3199,7 +3204,7 @@ function useMatchWalletAssetList({
3199
3204
  // Refresh every 15 seconds
3200
3205
  retry: 3
3201
3206
  });
3202
- const enrichedAssets = (0, import_react40.useMemo)(() => {
3207
+ const enrichedAssets = (0, import_react41.useMemo)(() => {
3203
3208
  if (!list) return [];
3204
3209
  const erc20Balances = erc20BalanceQuery.data || [];
3205
3210
  return list.map((asset) => {
@@ -3221,7 +3226,7 @@ function useMatchWalletAssetList({
3221
3226
  return { ...asset, balance, value, balanceValue };
3222
3227
  });
3223
3228
  }, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
3224
- (0, import_react40.useEffect)(() => {
3229
+ (0, import_react41.useEffect)(() => {
3225
3230
  const list2 = enrichedAssets.sort((a, b) => {
3226
3231
  if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
3227
3232
  if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
@@ -3246,14 +3251,14 @@ function useMatchWalletAssetList({
3246
3251
  }
3247
3252
 
3248
3253
  // src/hooks/useReceipt.tsx
3249
- var import_react41 = require("react");
3254
+ var import_react42 = require("react");
3250
3255
  var import_react_query9 = require("@tanstack/react-query");
3251
3256
  var import_viem14 = require("viem");
3252
3257
  var CACHE_TTL = 86400 * 30 * 1e3;
3253
3258
  var MAX_CACHE_SIZE = 500;
3254
3259
  var STORAGE_KEY = "match_receipt_logs";
3255
3260
  function useReceiptCache() {
3256
- const [cache, setCache] = (0, import_react41.useState)(/* @__PURE__ */ new Map());
3261
+ const [cache, setCache] = (0, import_react42.useState)(/* @__PURE__ */ new Map());
3257
3262
  const isLocalStorageAvailable = (() => {
3258
3263
  try {
3259
3264
  const testKey = "__test__";
@@ -3264,7 +3269,7 @@ function useReceiptCache() {
3264
3269
  return false;
3265
3270
  }
3266
3271
  })();
3267
- (0, import_react41.useEffect)(() => {
3272
+ (0, import_react42.useEffect)(() => {
3268
3273
  if (isLocalStorageAvailable) {
3269
3274
  try {
3270
3275
  const storedData = localStorage.getItem(STORAGE_KEY);
@@ -3283,7 +3288,7 @@ function useReceiptCache() {
3283
3288
  }
3284
3289
  }
3285
3290
  }, []);
3286
- const updateLocalStorage = (0, import_react41.useCallback)((updatedCache) => {
3291
+ const updateLocalStorage = (0, import_react42.useCallback)((updatedCache) => {
3287
3292
  if (isLocalStorageAvailable) {
3288
3293
  try {
3289
3294
  const storedData = localStorage.getItem(STORAGE_KEY);
@@ -3300,7 +3305,7 @@ function useReceiptCache() {
3300
3305
  }
3301
3306
  }
3302
3307
  }, []);
3303
- const set = (0, import_react41.useCallback)((key, value) => {
3308
+ const set = (0, import_react42.useCallback)((key, value) => {
3304
3309
  const now = Date.now();
3305
3310
  const newCache = new Map(cache);
3306
3311
  newCache.forEach((entry, k) => {
@@ -3318,7 +3323,7 @@ function useReceiptCache() {
3318
3323
  setCache(newCache);
3319
3324
  updateLocalStorage(newCache);
3320
3325
  }, [cache, updateLocalStorage]);
3321
- const get = (0, import_react41.useCallback)((key) => {
3326
+ const get = (0, import_react42.useCallback)((key) => {
3322
3327
  const entry = cache.get(key);
3323
3328
  if (entry) {
3324
3329
  if (Date.now() - entry.timestamp > CACHE_TTL) {
@@ -3332,7 +3337,7 @@ function useReceiptCache() {
3332
3337
  }
3333
3338
  return void 0;
3334
3339
  }, [cache, updateLocalStorage]);
3335
- const del = (0, import_react41.useCallback)((key) => {
3340
+ const del = (0, import_react42.useCallback)((key) => {
3336
3341
  if (cache.has(key)) {
3337
3342
  const newCache = new Map(cache);
3338
3343
  newCache.delete(key);
@@ -3340,7 +3345,7 @@ function useReceiptCache() {
3340
3345
  updateLocalStorage(newCache);
3341
3346
  }
3342
3347
  }, [cache, updateLocalStorage]);
3343
- const clear = (0, import_react41.useCallback)(() => {
3348
+ const clear = (0, import_react42.useCallback)(() => {
3344
3349
  setCache(/* @__PURE__ */ new Map());
3345
3350
  if (isLocalStorageAvailable) {
3346
3351
  localStorage.removeItem(STORAGE_KEY);
@@ -3355,7 +3360,7 @@ function useReceipt2({
3355
3360
  const { list } = useMatchChain();
3356
3361
  const cache = useReceiptCache();
3357
3362
  const chain = list?.find((item) => item.id === chainId);
3358
- const [shouldRefetch, setShouldRefetch] = (0, import_react41.useState)(true);
3363
+ const [shouldRefetch, setShouldRefetch] = (0, import_react42.useState)(true);
3359
3364
  const query = (0, import_react_query9.useQuery)({
3360
3365
  queryKey: ["match-tx-receipt", hash, chain],
3361
3366
  queryFn: async () => {
@@ -3381,7 +3386,7 @@ function useReceipt2({
3381
3386
  },
3382
3387
  refetchInterval: shouldRefetch ? 1e4 : false
3383
3388
  });
3384
- (0, import_react41.useEffect)(() => {
3389
+ (0, import_react42.useEffect)(() => {
3385
3390
  if (query.data) {
3386
3391
  setShouldRefetch(false);
3387
3392
  }
@@ -3390,14 +3395,14 @@ function useReceipt2({
3390
3395
  }
3391
3396
 
3392
3397
  // src/hooks/useTransaction.tsx
3393
- var import_react42 = require("react");
3398
+ var import_react43 = require("react");
3394
3399
  var import_react_query10 = require("@tanstack/react-query");
3395
3400
  var import_viem15 = require("viem");
3396
3401
  var CACHE_TTL2 = 86400 * 30 * 1e3;
3397
3402
  var MAX_CACHE_SIZE2 = 500;
3398
3403
  var STORAGE_KEY2 = "match_transaction_logs";
3399
3404
  function useTransactionCache() {
3400
- const [cache, setCache] = (0, import_react42.useState)(/* @__PURE__ */ new Map());
3405
+ const [cache, setCache] = (0, import_react43.useState)(/* @__PURE__ */ new Map());
3401
3406
  const isLocalStorageAvailable = (() => {
3402
3407
  try {
3403
3408
  const testKey = "__test__";
@@ -3408,7 +3413,7 @@ function useTransactionCache() {
3408
3413
  return false;
3409
3414
  }
3410
3415
  })();
3411
- (0, import_react42.useEffect)(() => {
3416
+ (0, import_react43.useEffect)(() => {
3412
3417
  if (isLocalStorageAvailable) {
3413
3418
  try {
3414
3419
  const storedData = localStorage.getItem(STORAGE_KEY2);
@@ -3427,7 +3432,7 @@ function useTransactionCache() {
3427
3432
  }
3428
3433
  }
3429
3434
  }, []);
3430
- const updateLocalStorage = (0, import_react42.useCallback)((updatedCache) => {
3435
+ const updateLocalStorage = (0, import_react43.useCallback)((updatedCache) => {
3431
3436
  if (isLocalStorageAvailable) {
3432
3437
  try {
3433
3438
  const storedData = localStorage.getItem(STORAGE_KEY2);
@@ -3444,7 +3449,7 @@ function useTransactionCache() {
3444
3449
  }
3445
3450
  }
3446
3451
  }, []);
3447
- const set = (0, import_react42.useCallback)((key, value) => {
3452
+ const set = (0, import_react43.useCallback)((key, value) => {
3448
3453
  const now = Date.now();
3449
3454
  const newCache = new Map(cache);
3450
3455
  newCache.forEach((entry, k) => {
@@ -3462,7 +3467,7 @@ function useTransactionCache() {
3462
3467
  setCache(newCache);
3463
3468
  updateLocalStorage(newCache);
3464
3469
  }, [cache, updateLocalStorage]);
3465
- const get = (0, import_react42.useCallback)((key) => {
3470
+ const get = (0, import_react43.useCallback)((key) => {
3466
3471
  const entry = cache.get(key);
3467
3472
  if (entry) {
3468
3473
  if (Date.now() - entry.timestamp > CACHE_TTL2) {
@@ -3476,7 +3481,7 @@ function useTransactionCache() {
3476
3481
  }
3477
3482
  return void 0;
3478
3483
  }, [cache, updateLocalStorage]);
3479
- const del = (0, import_react42.useCallback)((key) => {
3484
+ const del = (0, import_react43.useCallback)((key) => {
3480
3485
  if (cache.has(key)) {
3481
3486
  const newCache = new Map(cache);
3482
3487
  newCache.delete(key);
@@ -3484,7 +3489,7 @@ function useTransactionCache() {
3484
3489
  updateLocalStorage(newCache);
3485
3490
  }
3486
3491
  }, [cache, updateLocalStorage]);
3487
- const clear = (0, import_react42.useCallback)(() => {
3492
+ const clear = (0, import_react43.useCallback)(() => {
3488
3493
  setCache(/* @__PURE__ */ new Map());
3489
3494
  if (isLocalStorageAvailable) {
3490
3495
  localStorage.removeItem(STORAGE_KEY2);
@@ -3499,7 +3504,7 @@ function useTransaction({
3499
3504
  const { list } = useMatchChain();
3500
3505
  const cache = useTransactionCache();
3501
3506
  const chain = list?.find((item) => item.id === chainId);
3502
- const [shouldRefetch, setShouldRefetch] = (0, import_react42.useState)(true);
3507
+ const [shouldRefetch, setShouldRefetch] = (0, import_react43.useState)(true);
3503
3508
  const query = (0, import_react_query10.useQuery)({
3504
3509
  queryKey: ["match-tx-transaction", hash, chain],
3505
3510
  queryFn: async () => {
@@ -3525,7 +3530,7 @@ function useTransaction({
3525
3530
  },
3526
3531
  refetchInterval: shouldRefetch ? 1e4 : false
3527
3532
  });
3528
- (0, import_react42.useEffect)(() => {
3533
+ (0, import_react43.useEffect)(() => {
3529
3534
  if (query.data) {
3530
3535
  setShouldRefetch(false);
3531
3536
  }