@matchain/matchid-sdk-react 0.1.48-alpha.6 → 0.1.48-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/assets/icon/index.d.mts +5 -3
  2. package/dist/assets/icon/index.d.ts +5 -3
  3. package/dist/assets/icon/index.js +18 -2
  4. package/dist/assets/icon/index.js.map +1 -1
  5. package/dist/assets/icon/index.mjs +3 -1
  6. package/dist/{chunk-YFJI4I5M.mjs → chunk-7UTR37EJ.mjs} +18 -3
  7. package/dist/chunk-7UTR37EJ.mjs.map +1 -0
  8. package/dist/{chunk-BPAPYY5P.mjs → chunk-EY6NPX4M.mjs} +477 -128
  9. package/dist/chunk-EY6NPX4M.mjs.map +1 -0
  10. package/dist/{chunk-55KYW35I.mjs → chunk-J5U7AXYA.mjs} +2 -2
  11. package/dist/{chunk-UHBVYFSP.mjs → chunk-USKUYOYJ.mjs} +2 -2
  12. package/dist/components/index.d.mts +3 -3
  13. package/dist/components/index.d.ts +3 -3
  14. package/dist/components/index.js +314 -304
  15. package/dist/components/index.js.map +1 -1
  16. package/dist/components/index.mjs +3 -3
  17. package/dist/hooks/api/index.d.mts +2 -2
  18. package/dist/hooks/api/index.d.ts +2 -2
  19. package/dist/hooks/api/index.js +94 -54
  20. package/dist/hooks/api/index.js.map +1 -1
  21. package/dist/hooks/api/index.mjs +4 -4
  22. package/dist/hooks/index.d.mts +3 -2
  23. package/dist/hooks/index.d.ts +3 -2
  24. package/dist/hooks/index.js +498 -87
  25. package/dist/hooks/index.js.map +1 -1
  26. package/dist/hooks/index.mjs +5 -3
  27. package/dist/{index-DCeOyAw8.d.ts → index-Bbn2Stvu.d.ts} +2 -2
  28. package/dist/index-Bz53bbI_.d.ts +3268 -0
  29. package/dist/{index-B8DYrhSW.d.mts → index-C-YCr0xJ.d.mts} +12 -4
  30. package/dist/{index-DbG5IjhP.d.mts → index-CB4j_ONH.d.mts} +1 -1
  31. package/dist/{index-B-s1k4Da.d.mts → index-CKyWWkzU.d.mts} +3 -2
  32. package/dist/{index-BZrddrq-.d.mts → index-C_S7k6z2.d.mts} +2 -2
  33. package/dist/{index-BHvCA7F9.d.ts → index-D-uNr-JV.d.ts} +2 -2
  34. package/dist/index-DDV4F9ka.d.mts +3268 -0
  35. package/dist/{index-DG_gyw1q.d.ts → index-DV_mRu4y.d.ts} +3 -2
  36. package/dist/{index-Bzcc-y8m.d.ts → index-DcxdJ0m2.d.ts} +1 -1
  37. package/dist/{index-BvLpvebq.d.mts → index-Dzvj-uGt.d.mts} +2 -2
  38. package/dist/{index-Cwx2p8th.d.ts → index-zRpvDpIK.d.ts} +12 -4
  39. package/dist/index.css +11 -0
  40. package/dist/index.d.mts +8 -7
  41. package/dist/index.d.ts +8 -7
  42. package/dist/index.js +704 -353
  43. package/dist/index.js.map +1 -1
  44. package/dist/index.mjs +4 -4
  45. package/dist/types/index.d.mts +1 -1
  46. package/dist/types/index.d.ts +1 -1
  47. package/dist/{types-CHkU0WHZ.d.mts → types-B4BYNw8B.d.mts} +13 -2
  48. package/dist/{types-CHkU0WHZ.d.ts → types-B4BYNw8B.d.ts} +13 -2
  49. package/dist/ui/index.d.mts +3 -3
  50. package/dist/ui/index.d.ts +3 -3
  51. package/dist/ui/index.js +62 -59
  52. package/dist/ui/index.js.map +1 -1
  53. package/dist/ui/index.mjs +2 -2
  54. package/example/src/pages/Wallet/components/MatchWallet.tsx +2 -1
  55. package/package.json +1 -1
  56. package/dist/chunk-BPAPYY5P.mjs.map +0 -1
  57. package/dist/chunk-YFJI4I5M.mjs.map +0 -1
  58. package/dist/index-DKyt0for.d.mts +0 -181
  59. package/dist/index-TkB89QxX.d.ts +0 -181
  60. /package/dist/{chunk-55KYW35I.mjs.map → chunk-J5U7AXYA.mjs.map} +0 -0
  61. /package/dist/{chunk-UHBVYFSP.mjs.map → chunk-USKUYOYJ.mjs.map} +0 -0
@@ -12,7 +12,7 @@ import {
12
12
  matchlog_default,
13
13
  useDownMd,
14
14
  useLayout_exports
15
- } from "./chunk-UHBVYFSP.mjs";
15
+ } from "./chunk-USKUYOYJ.mjs";
16
16
  import {
17
17
  ArrowDownIcon,
18
18
  ArrowRightIcon,
@@ -32,7 +32,7 @@ import {
32
32
  FacebookIcon,
33
33
  GithubIcon,
34
34
  GoogleIcon,
35
- InfoRoundIcon,
35
+ InfoLineIcon,
36
36
  LeatherIcon,
37
37
  LinkedinIcon,
38
38
  LoginIcon_default,
@@ -51,7 +51,7 @@ import {
51
51
  XIcon,
52
52
  XverseIcon,
53
53
  YoutubeIcon
54
- } from "./chunk-YFJI4I5M.mjs";
54
+ } from "./chunk-7UTR37EJ.mjs";
55
55
  import {
56
56
  __export
57
57
  } from "./chunk-J5LGTIGS.mjs";
@@ -80,7 +80,7 @@ __export(components_exports, {
80
80
  });
81
81
 
82
82
  // src/components/EmailModal/index.tsx
83
- import { useEffect as useEffect13, useState as useState12 } from "react";
83
+ import { useEffect as useEffect14, useState as useState13 } from "react";
84
84
 
85
85
  // src/components/EmailModal/StepEmail.tsx
86
86
  import { useEffect, useMemo, useState } from "react";
@@ -526,6 +526,13 @@ var getWalletChainListApi = () => {
526
526
  method: "POST"
527
527
  });
528
528
  };
529
+ var getWalletNftListApi = (data) => {
530
+ return request_default({
531
+ url: `/api/v1/wallet/nfts`,
532
+ method: "POST",
533
+ data
534
+ });
535
+ };
529
536
 
530
537
  // src/store/useLocalStore.ts
531
538
  var persistedState = persist(
@@ -597,6 +604,7 @@ __export(hooks_exports, {
597
604
  useModal: () => useModal,
598
605
  useReceipt: () => useReceipt,
599
606
  useToast: () => useToast,
607
+ useTransaction: () => useTransaction,
600
608
  useUserInfo: () => useUserInfo,
601
609
  useWallet: () => useWallet
602
610
  });
@@ -1096,6 +1104,7 @@ __export(wallet_exports, {
1096
1104
  useChainListQuery: () => useChainListQuery,
1097
1105
  useImportTokenListQuery: () => useImportTokenListQuery,
1098
1106
  useWalletChainListQuery: () => useWalletChainListQuery,
1107
+ useWalletNftListQuery: () => useWalletNftListQuery,
1099
1108
  userImportTokenApi: () => userImportTokenApi
1100
1109
  });
1101
1110
  import { useQuery } from "@tanstack/react-query";
@@ -1165,9 +1174,32 @@ function useWalletChainListQuery(options) {
1165
1174
  ...options
1166
1175
  });
1167
1176
  }
1177
+ function useWalletNftListQuery({
1178
+ chainId,
1179
+ address: address2,
1180
+ ...options
1181
+ }) {
1182
+ const { isLogin, token } = useUserInfo();
1183
+ return useQuery({
1184
+ queryKey: ["match-wallet-nft-list", token, chainId, address2],
1185
+ queryFn: async () => {
1186
+ const res = await getWalletNftListApi({
1187
+ chain_id: chainId.toString(),
1188
+ address: address2
1189
+ });
1190
+ if (!isSuccess(res)) {
1191
+ return [];
1192
+ }
1193
+ return res.data;
1194
+ },
1195
+ enabled: isLogin,
1196
+ ...options
1197
+ });
1198
+ }
1168
1199
 
1169
1200
  // src/hooks/useMatchChain.tsx
1170
1201
  import { useMemo as useMemo3, useState as useState6 } from "react";
1202
+ import { createPublicClient, http } from "viem";
1171
1203
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
1172
1204
  function useMatchChain() {
1173
1205
  const chainListQuery = useChainListQuery();
@@ -1227,69 +1259,239 @@ function useMatchChain() {
1227
1259
  content: ChangeNetwork
1228
1260
  });
1229
1261
  };
1262
+ const publicClient = useMemo3(() => {
1263
+ if (!chain) {
1264
+ return null;
1265
+ }
1266
+ return createPublicClient({
1267
+ chain,
1268
+ transport: http()
1269
+ });
1270
+ }, [chain]);
1230
1271
  return {
1231
1272
  list: chainListQuery.data,
1232
1273
  chainId,
1233
1274
  setChainId,
1234
1275
  chain,
1235
1276
  explorerLink,
1236
- showChangeNetwork
1277
+ showChangeNetwork,
1278
+ publicClient
1237
1279
  };
1238
1280
  }
1239
1281
 
1240
1282
  // src/hooks/useMatchWallet.tsx
1241
1283
  import { QRCode } from "react-qrcode";
1242
- import { useEffect as useEffect6, useState as useState7 } from "react";
1284
+ import { useEffect as useEffect6, useMemo as useMemo4, useRef, useState as useState7 } from "react";
1243
1285
 
1244
1286
  // example/src/config/contract.ts
1245
1287
  var address = "0x4143e29770fd63e24bb1f32d50bf8a590e34de4b";
1246
1288
 
1247
1289
  // src/hooks/useMatchWallet.tsx
1248
1290
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
1249
- function useMatchWallet() {
1250
- const modal = useModal();
1251
- const { address: address2 } = useWallet();
1291
+ var ReceiveModal = () => {
1252
1292
  const chain = useMatchChain();
1293
+ const { address: address2 } = useWallet();
1253
1294
  const [copied, setCopied] = useCopyClipboard();
1254
1295
  const toast = useToast();
1255
1296
  const onCopy = () => {
1256
1297
  setCopied(address2);
1257
1298
  toast.success("Copied!");
1258
1299
  };
1300
+ const chainLink = chain.explorerLink("address/" + address2);
1301
+ return /* @__PURE__ */ jsxs5("div", { className: `matchid-receive-modal`, children: [
1302
+ /* @__PURE__ */ jsxs5("div", { className: "matchid-receive-container", children: [
1303
+ /* @__PURE__ */ jsx6("div", { className: `matchid-receive-text`, children: "Receive by scanning the QR code" }),
1304
+ /* @__PURE__ */ jsx6("div", { className: `matchid-qr-container`, children: /* @__PURE__ */ jsx6(
1305
+ QRCode,
1306
+ {
1307
+ margin: "0",
1308
+ className: `matchid-qr-code`,
1309
+ value: address2
1310
+ }
1311
+ ) }),
1312
+ /* @__PURE__ */ jsx6(
1313
+ "a",
1314
+ {
1315
+ href: chainLink,
1316
+ target: "_blank",
1317
+ className: `matchid-receive-link`,
1318
+ children: address2
1319
+ }
1320
+ )
1321
+ ] }),
1322
+ /* @__PURE__ */ jsx6(Button, { size: "lg", onClick: onCopy, block: true, highlight: true, disabled: copied, children: "Copy Address" })
1323
+ ] });
1324
+ };
1325
+ var ImportTokenModal = ({ close }) => {
1326
+ const [address2, setAddress] = useState7("");
1327
+ const [symbol, setSymbol] = useState7("");
1328
+ const [decimals, setDecimals] = useState7("");
1329
+ const [error, setError] = useState7({});
1330
+ const { publicClient, chainId } = useMatchChain();
1331
+ const getContractInfo = async () => {
1332
+ if (!publicClient) return;
1333
+ const erc20Abi = [
1334
+ {
1335
+ name: "decimals",
1336
+ type: "function",
1337
+ stateMutability: "view",
1338
+ inputs: [],
1339
+ outputs: [{ name: "decimals", type: "uint8" }]
1340
+ },
1341
+ {
1342
+ name: "symbol",
1343
+ type: "function",
1344
+ stateMutability: "view",
1345
+ inputs: [],
1346
+ outputs: [{ name: "symbol", type: "string" }]
1347
+ }
1348
+ ];
1349
+ const calls = [
1350
+ {
1351
+ address: address2,
1352
+ abi: erc20Abi,
1353
+ functionName: "symbol",
1354
+ args: []
1355
+ },
1356
+ {
1357
+ address: address2,
1358
+ abi: erc20Abi,
1359
+ functionName: "decimals",
1360
+ args: []
1361
+ }
1362
+ ];
1363
+ try {
1364
+ const results = await publicClient.multicall({ contracts: calls });
1365
+ console.log("results", results);
1366
+ if (!symbol && results[0]?.status == "success") {
1367
+ setSymbol(results[0]?.result);
1368
+ }
1369
+ if (!decimals && results[1]?.status == "success") {
1370
+ setDecimals((results[1]?.result).toString());
1371
+ }
1372
+ } catch (error2) {
1373
+ setError({
1374
+ address: error2.message
1375
+ });
1376
+ }
1377
+ };
1378
+ useEffect6(() => {
1379
+ if (address2.length === 42) {
1380
+ const reg = /^0x[0-9a-fA-F]{40}$/;
1381
+ if (!reg.test(address2)) {
1382
+ setError({
1383
+ ...error,
1384
+ address: "Invalid address"
1385
+ });
1386
+ } else {
1387
+ setError({
1388
+ ...error,
1389
+ address: ""
1390
+ });
1391
+ publicClient && getContractInfo();
1392
+ }
1393
+ }
1394
+ }, [address2, publicClient]);
1395
+ const [loading, setLoading] = useState7(false);
1396
+ const toast = useToast();
1397
+ const onImport = async () => {
1398
+ setLoading(true);
1399
+ try {
1400
+ const res = await userImportTokenApi({
1401
+ chain_id: chainId?.toString() || "",
1402
+ symbol,
1403
+ address: address2,
1404
+ decimals
1405
+ });
1406
+ if (isSuccess(res)) {
1407
+ toast.success("Imported successfully");
1408
+ close();
1409
+ } else {
1410
+ toast.error(res.message);
1411
+ }
1412
+ } catch (error2) {
1413
+ toast.error(error2.message);
1414
+ } finally {
1415
+ setLoading(false);
1416
+ }
1417
+ };
1418
+ const canImport = useMemo4(() => {
1419
+ if (!address2) {
1420
+ return false;
1421
+ }
1422
+ if (!symbol) {
1423
+ return false;
1424
+ }
1425
+ if (decimals.length === 0) {
1426
+ return false;
1427
+ }
1428
+ const reg = /^0x[0-9a-fA-F]{40}$/;
1429
+ if (!reg.test(address2)) {
1430
+ return false;
1431
+ }
1432
+ return true;
1433
+ }, [error, address2, symbol, decimals]);
1434
+ return /* @__PURE__ */ jsxs5("div", { className: `matchid-import-token`, children: [
1435
+ /* @__PURE__ */ jsxs5("div", { className: "matchid-import-token-form", children: [
1436
+ /* @__PURE__ */ jsx6(Field, { label: "Token Smart Contract", error: error.address, children: /* @__PURE__ */ jsx6(
1437
+ Input,
1438
+ {
1439
+ placeholder: "Enter the Token Smart Contract",
1440
+ value: address2,
1441
+ onChange: (e) => setAddress(e.target.value),
1442
+ maxLength: 42
1443
+ }
1444
+ ) }),
1445
+ /* @__PURE__ */ jsx6(Field, { label: "Token Symbol", error: error.symbol, children: /* @__PURE__ */ jsx6(
1446
+ Input,
1447
+ {
1448
+ placeholder: "Enter the Token Symbol",
1449
+ value: symbol,
1450
+ onChange: (e) => setSymbol(e.target.value),
1451
+ maxLength: 16
1452
+ }
1453
+ ) }),
1454
+ /* @__PURE__ */ jsx6(Field, { label: "Decimals", error: error.decimals, children: /* @__PURE__ */ jsx6(
1455
+ Input,
1456
+ {
1457
+ placeholder: "Enter the Decimals",
1458
+ type: "number",
1459
+ value: decimals,
1460
+ onChange: (e) => setDecimals(e.target.value)
1461
+ }
1462
+ ) })
1463
+ ] }),
1464
+ /* @__PURE__ */ jsx6(
1465
+ Button,
1466
+ {
1467
+ size: "lg",
1468
+ onClick: onImport,
1469
+ block: true,
1470
+ loading,
1471
+ disabled: !canImport,
1472
+ highlight: true,
1473
+ children: "Import"
1474
+ }
1475
+ )
1476
+ ] });
1477
+ };
1478
+ function useMatchWallet() {
1479
+ const modal = useModal();
1259
1480
  const showReceiveModal = () => {
1260
- const chainLink = chain.explorerLink("address/" + address2);
1261
- const ReceiveModal = () => {
1262
- return /* @__PURE__ */ jsxs5("div", { className: `matchid-receive-modal`, children: [
1263
- /* @__PURE__ */ jsxs5("div", { className: "matchid-receive-container", children: [
1264
- /* @__PURE__ */ jsx6("div", { className: `matchid-receive-text`, children: "Receive by scanning the QR code" }),
1265
- /* @__PURE__ */ jsx6("div", { className: `matchid-qr-container`, children: /* @__PURE__ */ jsx6(
1266
- QRCode,
1267
- {
1268
- margin: "0",
1269
- className: `matchid-qr-code`,
1270
- value: address2
1271
- }
1272
- ) }),
1273
- /* @__PURE__ */ jsx6(
1274
- "a",
1275
- {
1276
- href: chainLink,
1277
- target: "_blank",
1278
- className: `matchid-receive-link`,
1279
- children: address2
1280
- }
1281
- )
1282
- ] }),
1283
- /* @__PURE__ */ jsx6(Button, { size: "lg", onClick: onCopy, block: true, highlight: true, disabled: copied, children: "Copy Address" })
1284
- ] });
1285
- };
1286
1481
  modal.open({
1287
1482
  title: "Receive",
1288
1483
  content: ReceiveModal
1289
1484
  });
1290
1485
  };
1486
+ const showImportTokenModal = () => {
1487
+ modal.open({
1488
+ title: "Customized Token",
1489
+ content: ImportTokenModal
1490
+ });
1491
+ };
1291
1492
  return {
1292
- showReceiveModal
1493
+ showReceiveModal,
1494
+ showImportTokenModal
1293
1495
  };
1294
1496
  }
1295
1497
  function useMatchWalletRecords({
@@ -1298,8 +1500,9 @@ function useMatchWalletRecords({
1298
1500
  const [hasMore, setHasMore] = useState7(true);
1299
1501
  const [items, setItems] = useState7([]);
1300
1502
  const { chainId } = useMatchChain();
1503
+ const hasMoreRef = useRef(hasMore);
1301
1504
  const fetchMoreData = async () => {
1302
- if (!hasMore) {
1505
+ if (!hasMoreRef.current) {
1303
1506
  return;
1304
1507
  }
1305
1508
  const chainIdStr = chainId ? chainId.toString() : "";
@@ -1312,12 +1515,14 @@ function useMatchWalletRecords({
1312
1515
  if (res.data && res.data.transactions.length > 0) {
1313
1516
  setItems(items.concat(res.data.transactions));
1314
1517
  }
1518
+ hasMoreRef.current = res.data && res.data.transactions.length >= pageSize;
1315
1519
  setHasMore(res.data && res.data.transactions.length >= pageSize);
1316
1520
  }
1317
1521
  };
1318
1522
  const onInit = async () => {
1319
1523
  setItems([]);
1320
1524
  setHasMore(true);
1525
+ hasMoreRef.current = true;
1321
1526
  fetchMoreData();
1322
1527
  };
1323
1528
  useEffect6(() => {
@@ -1335,7 +1540,7 @@ function useMatchWalletRecords({
1335
1540
  // src/hooks/useReceipt.tsx
1336
1541
  import { useState as useState8, useCallback as useCallback4, useEffect as useEffect7 } from "react";
1337
1542
  import { useQuery as useQuery2 } from "@tanstack/react-query";
1338
- import { createPublicClient, defineChain, http } from "viem";
1543
+ import { createPublicClient as createPublicClient2, defineChain, http as http2 } from "viem";
1339
1544
  var CACHE_TTL = 86400 * 30 * 1e3;
1340
1545
  var MAX_CACHE_SIZE = 500;
1341
1546
  var STORAGE_KEY = "match_receipt_logs";
@@ -1452,10 +1657,9 @@ function useReceipt({
1452
1657
  return cache.get(cacheKey);
1453
1658
  }
1454
1659
  try {
1455
- const publicClient = createPublicClient({
1456
- //@ts-ignore
1660
+ const publicClient = createPublicClient2({
1457
1661
  chain: defineChain(chain),
1458
- transport: http()
1662
+ transport: http2()
1459
1663
  });
1460
1664
  const receipt = await publicClient.getTransactionReceipt({ hash });
1461
1665
  if (!receipt) {
@@ -1477,8 +1681,152 @@ function useReceipt({
1477
1681
  return query;
1478
1682
  }
1479
1683
 
1684
+ // src/hooks/useTransaction.tsx
1685
+ import { useState as useState9, useCallback as useCallback5, useEffect as useEffect8 } from "react";
1686
+ import { useQuery as useQuery3 } from "@tanstack/react-query";
1687
+ import { createPublicClient as createPublicClient3, defineChain as defineChain2, http as http3 } from "viem";
1688
+ var CACHE_TTL2 = 86400 * 30 * 1e3;
1689
+ var MAX_CACHE_SIZE2 = 500;
1690
+ var STORAGE_KEY2 = "match_transaction_logs";
1691
+ function useTransactionCache() {
1692
+ const [cache, setCache] = useState9(/* @__PURE__ */ new Map());
1693
+ const isLocalStorageAvailable = (() => {
1694
+ try {
1695
+ const testKey = "__test__";
1696
+ localStorage.setItem(testKey, "1");
1697
+ localStorage.removeItem(testKey);
1698
+ return true;
1699
+ } catch (e) {
1700
+ return false;
1701
+ }
1702
+ })();
1703
+ useEffect8(() => {
1704
+ if (isLocalStorageAvailable) {
1705
+ try {
1706
+ const storedData = localStorage.getItem(STORAGE_KEY2);
1707
+ if (storedData) {
1708
+ try {
1709
+ const parsed = JSON.parse(storedData);
1710
+ const now = Date.now();
1711
+ const validEntries = Object.entries(parsed).filter(([_, entry]) => typeof entry === "object" && entry !== null && "timestamp" in entry && now - entry.timestamp <= CACHE_TTL2).map(([key, entry]) => [key, entry]);
1712
+ setCache(new Map(validEntries));
1713
+ } catch (e) {
1714
+ console.error("Failed to parse cache from localStorage:", e);
1715
+ }
1716
+ }
1717
+ } catch (e) {
1718
+ console.error("Failed to load cache from localStorage:", e);
1719
+ }
1720
+ }
1721
+ }, []);
1722
+ const updateLocalStorage = useCallback5((updatedCache) => {
1723
+ if (isLocalStorageAvailable) {
1724
+ try {
1725
+ const storedData = localStorage.getItem(STORAGE_KEY2);
1726
+ let parsed = {};
1727
+ if (storedData) {
1728
+ parsed = JSON.parse(storedData);
1729
+ }
1730
+ updatedCache.forEach((entry, key) => {
1731
+ parsed[key] = entry;
1732
+ });
1733
+ localStorage.setItem(STORAGE_KEY2, JSON.stringify(parsed));
1734
+ } catch (e) {
1735
+ console.error("Failed to update localStorage:", e);
1736
+ }
1737
+ }
1738
+ }, []);
1739
+ const set = useCallback5((key, value) => {
1740
+ const now = Date.now();
1741
+ const newCache = new Map(cache);
1742
+ newCache.forEach((entry, k) => {
1743
+ if (now - entry.timestamp > CACHE_TTL2) {
1744
+ newCache.delete(k);
1745
+ }
1746
+ });
1747
+ if (newCache.size >= MAX_CACHE_SIZE2) {
1748
+ const firstKey = newCache.keys().next().value;
1749
+ if (firstKey !== void 0) {
1750
+ newCache.delete(firstKey);
1751
+ }
1752
+ }
1753
+ newCache.set(key, { value, timestamp: now });
1754
+ setCache(newCache);
1755
+ updateLocalStorage(newCache);
1756
+ }, [cache, updateLocalStorage]);
1757
+ const get = useCallback5((key) => {
1758
+ const entry = cache.get(key);
1759
+ if (entry) {
1760
+ if (Date.now() - entry.timestamp > CACHE_TTL2) {
1761
+ const newCache = new Map(cache);
1762
+ newCache.delete(key);
1763
+ setCache(newCache);
1764
+ updateLocalStorage(newCache);
1765
+ return void 0;
1766
+ }
1767
+ return entry.value;
1768
+ }
1769
+ return void 0;
1770
+ }, [cache, updateLocalStorage]);
1771
+ const del = useCallback5((key) => {
1772
+ if (cache.has(key)) {
1773
+ const newCache = new Map(cache);
1774
+ newCache.delete(key);
1775
+ setCache(newCache);
1776
+ updateLocalStorage(newCache);
1777
+ }
1778
+ }, [cache, updateLocalStorage]);
1779
+ const clear = useCallback5(() => {
1780
+ setCache(/* @__PURE__ */ new Map());
1781
+ if (isLocalStorageAvailable) {
1782
+ localStorage.removeItem(STORAGE_KEY2);
1783
+ }
1784
+ }, [isLocalStorageAvailable]);
1785
+ return { set, get, del, clear };
1786
+ }
1787
+ function useTransaction({
1788
+ chainId,
1789
+ hash
1790
+ }) {
1791
+ const { list } = useMatchChain();
1792
+ const cache = useTransactionCache();
1793
+ const chain = list?.find((item) => item.id === chainId);
1794
+ const [shouldRefetch, setShouldRefetch] = useState9(true);
1795
+ const query = useQuery3({
1796
+ queryKey: ["match-tx-transaction", hash, chain],
1797
+ queryFn: async () => {
1798
+ if (!chain || !hash) return false;
1799
+ const cacheKey = `${chain.id}-${hash}`;
1800
+ if (cache.get(cacheKey)) {
1801
+ return cache.get(cacheKey);
1802
+ }
1803
+ try {
1804
+ const publicClient = createPublicClient3({
1805
+ chain: defineChain2(chain),
1806
+ transport: http3()
1807
+ });
1808
+ const transaction = await publicClient.getTransaction({ hash });
1809
+ if (!transaction) {
1810
+ return false;
1811
+ }
1812
+ cache.set(cacheKey, transaction);
1813
+ return transaction;
1814
+ } catch (e) {
1815
+ return false;
1816
+ }
1817
+ },
1818
+ refetchInterval: shouldRefetch ? 1e4 : false
1819
+ });
1820
+ useEffect8(() => {
1821
+ if (query.data) {
1822
+ setShouldRefetch(false);
1823
+ }
1824
+ }, [query.data]);
1825
+ return query;
1826
+ }
1827
+
1480
1828
  // src/components/CEXBindModal/index.tsx
1481
- import { useEffect as useEffect8, useMemo as useMemo5, useState as useState9 } from "react";
1829
+ import { useEffect as useEffect9, useMemo as useMemo5, useState as useState10 } from "react";
1482
1830
  import { FormattedMessage as FormattedMessage2, useIntl as useIntl2 } from "react-intl";
1483
1831
  import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1484
1832
  function CEXBindModal({
@@ -1489,16 +1837,16 @@ function CEXBindModal({
1489
1837
  }) {
1490
1838
  const intl = useIntl2();
1491
1839
  const { events } = useMatch();
1492
- const [APIPassphrase, setAPIPassphrase] = useState9("");
1840
+ const [APIPassphrase, setAPIPassphrase] = useState10("");
1493
1841
  const { refreshOverview } = useUserInfo();
1494
- const [loading, setLoading] = useState9(false);
1495
- const [key, setKey] = useState9("");
1496
- const [secret, setSecret] = useState9("");
1497
- const [error, setError] = useState9("");
1842
+ const [loading, setLoading] = useState10(false);
1843
+ const [key, setKey] = useState10("");
1844
+ const [secret, setSecret] = useState10("");
1845
+ const [error, setError] = useState10("");
1498
1846
  const needPassphrase = useMemo5(() => {
1499
1847
  return ["bitget", "okx"].includes(type.toLowerCase());
1500
1848
  }, [type]);
1501
- useEffect8(() => {
1849
+ useEffect9(() => {
1502
1850
  if (isOpen) {
1503
1851
  setSecret("");
1504
1852
  setKey("");
@@ -1678,7 +2026,7 @@ var Providers = ({ children }) => {
1678
2026
  var context_default = Providers;
1679
2027
 
1680
2028
  // src/hooks/useWalletInit.ts
1681
- import { useEffect as useEffect9, useRef } from "react";
2029
+ import { useEffect as useEffect10, useRef as useRef2 } from "react";
1682
2030
 
1683
2031
  // src/utils/wallet.ts
1684
2032
  var sendMessage = ({ method, data, resolve, reject, timeout }) => {
@@ -1711,11 +2059,11 @@ function useWalletInit({
1711
2059
  }) {
1712
2060
  const { endpoints, token, overview, setWallet, wallet, appid, locale, refreshOverview } = useLocalStore_default();
1713
2061
  const { setWalletReady, walletReady } = useStore_default();
1714
- const iframeReadyRef = useRef(walletReady);
1715
- useEffect9(() => {
2062
+ const iframeReadyRef = useRef2(walletReady);
2063
+ useEffect10(() => {
1716
2064
  setWallet(config);
1717
2065
  }, [config]);
1718
- useEffect9(() => {
2066
+ useEffect10(() => {
1719
2067
  matchlog_default.log("sdk.mpc.status", walletReady, iframeReadyRef.current);
1720
2068
  iframeReadyRef.current = walletReady;
1721
2069
  if (iframeReadyRef.current) {
@@ -1732,7 +2080,7 @@ function useWalletInit({
1732
2080
  onReady();
1733
2081
  }
1734
2082
  }, [walletReady]);
1735
- useEffect9(() => {
2083
+ useEffect10(() => {
1736
2084
  if (!endpoints.auth || !appid || !token || !config) {
1737
2085
  const existingIframe = getWalletIframe();
1738
2086
  if (existingIframe) {
@@ -1832,7 +2180,7 @@ function useWalletInit({
1832
2180
  }
1833
2181
  }
1834
2182
  }, [endpoints.auth, appid, token, config]);
1835
- useEffect9(() => {
2183
+ useEffect10(() => {
1836
2184
  const messageHandle = async (e) => {
1837
2185
  if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
1838
2186
  return;
@@ -1913,7 +2261,7 @@ function useWalletInit({
1913
2261
  }
1914
2262
 
1915
2263
  // src/hooks/useInit.tsx
1916
- import { useEffect as useEffect10, useRef as useRef2 } from "react";
2264
+ import { useEffect as useEffect11, useRef as useRef3 } from "react";
1917
2265
  function useInit({
1918
2266
  theme,
1919
2267
  appid,
@@ -1933,23 +2281,23 @@ function useInit({
1933
2281
  locale: realLocale
1934
2282
  } = useLocalStore_default();
1935
2283
  const walletModalStore = useWalletModalStore();
1936
- const overviewLoadingRef = useRef2(false);
2284
+ const overviewLoadingRef = useRef3(false);
1937
2285
  const searchParams = new URLSearchParams(window.location.search);
1938
2286
  const matchToken = searchParams.get("matchToken");
1939
2287
  const realEndpoints = endpoints || env_default.endpoints;
1940
- useEffect10(() => {
2288
+ useEffect11(() => {
1941
2289
  setTheme(theme);
1942
2290
  }, [theme]);
1943
- useEffect10(() => {
2291
+ useEffect11(() => {
1944
2292
  setAppid(appid);
1945
2293
  }, [appid]);
1946
- useEffect10(() => {
2294
+ useEffect11(() => {
1947
2295
  setEndpoints(realEndpoints);
1948
2296
  }, [realEndpoints]);
1949
- useEffect10(() => {
2297
+ useEffect11(() => {
1950
2298
  setLocale(locale || "en");
1951
2299
  }, [locale]);
1952
- useEffect10(() => {
2300
+ useEffect11(() => {
1953
2301
  if (matchToken) {
1954
2302
  const tokenData = JSON.parse(atob(matchToken));
1955
2303
  if (tokenData && tokenData.mid && tokenData.token) {
@@ -1960,7 +2308,7 @@ function useInit({
1960
2308
  }
1961
2309
  }
1962
2310
  }, [matchToken]);
1963
- useEffect10(() => {
2311
+ useEffect11(() => {
1964
2312
  const onLoginMessage = (event) => {
1965
2313
  const res = event.data;
1966
2314
  if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
@@ -1997,7 +2345,7 @@ function useInit({
1997
2345
  overviewLoadingRef.current = false;
1998
2346
  }
1999
2347
  };
2000
- useEffect10(() => {
2348
+ useEffect11(() => {
2001
2349
  if (token) {
2002
2350
  loadOverview();
2003
2351
  }
@@ -2812,7 +3160,7 @@ function useUserInfo() {
2812
3160
  }
2813
3161
 
2814
3162
  // src/components/EmailModal/StepVerify.tsx
2815
- import { useEffect as useEffect12, useMemo as useMemo7, useRef as useRef3, useState as useState11 } from "react";
3163
+ import { useEffect as useEffect13, useMemo as useMemo7, useRef as useRef4, useState as useState12 } from "react";
2816
3164
 
2817
3165
  // src/config/index.tsx
2818
3166
  var EMAIL_INTERVAL = 60;
@@ -2824,17 +3172,17 @@ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
2824
3172
  function StepVerify(props) {
2825
3173
  const intl = useIntl3();
2826
3174
  const { getLoginEmailCode, loginByEmail } = useUserInfo();
2827
- const [error, setError] = useState11("");
2828
- const [code, setCode] = useState11("");
2829
- const [sending, setSending] = useState11(false);
2830
- const [submitting, setSubmitting] = useState11(false);
2831
- const sendTimeRef = useRef3(0);
2832
- const [sendBtnText, setSendBtnText] = useState11(intl.formatMessage({
3175
+ const [error, setError] = useState12("");
3176
+ const [code, setCode] = useState12("");
3177
+ const [sending, setSending] = useState12(false);
3178
+ const [submitting, setSubmitting] = useState12(false);
3179
+ const sendTimeRef = useRef4(0);
3180
+ const [sendBtnText, setSendBtnText] = useState12(intl.formatMessage({
2833
3181
  id: "send"
2834
3182
  }));
2835
3183
  const intervalTime = EMAIL_INTERVAL;
2836
3184
  const codeLength = EMAIL_CODE_LENGTH;
2837
- const intervalRef = useRef3(null);
3185
+ const intervalRef = useRef4(null);
2838
3186
  const isDownMd = useDownMd();
2839
3187
  const onSend = async () => {
2840
3188
  if (sendTimeRef.current > 0) {
@@ -2865,7 +3213,7 @@ function StepVerify(props) {
2865
3213
  setSending(false);
2866
3214
  }
2867
3215
  };
2868
- useEffect12(() => {
3216
+ useEffect13(() => {
2869
3217
  onSend();
2870
3218
  return () => {
2871
3219
  if (intervalRef.current) {
@@ -2950,10 +3298,10 @@ function EmailModal({
2950
3298
  onBack,
2951
3299
  onLogin
2952
3300
  }) {
2953
- const [step, setStep] = useState12("input");
2954
- const [emailVal, setEmailVal] = useState12("");
3301
+ const [step, setStep] = useState13("input");
3302
+ const [emailVal, setEmailVal] = useState13("");
2955
3303
  const intl = useIntl4();
2956
- useEffect13(() => {
3304
+ useEffect14(() => {
2957
3305
  if (!isOpen) {
2958
3306
  setStep("input");
2959
3307
  setEmailVal("");
@@ -2978,13 +3326,13 @@ function EmailModal({
2978
3326
  }
2979
3327
 
2980
3328
  // src/components/LoginBox/index.tsx
2981
- import { useMemo as useMemo8, useState as useState13 } from "react";
3329
+ import { useMemo as useMemo8, useState as useState14 } from "react";
2982
3330
  import { FormattedMessage as FormattedMessage4, useIntl as useIntl5 } from "react-intl";
2983
3331
 
2984
3332
  // src/hooks/useAppConfig.ts
2985
- import { useQuery as useQuery3 } from "@tanstack/react-query";
3333
+ import { useQuery as useQuery4 } from "@tanstack/react-query";
2986
3334
  function useAppConfig() {
2987
- const query = useQuery3({
3335
+ const query = useQuery4({
2988
3336
  queryKey: ["appConfig"],
2989
3337
  queryFn: async () => {
2990
3338
  const res = await getAppConfigApi();
@@ -3091,9 +3439,9 @@ function LoginBox({
3091
3439
  walletMethods: walletMethodList
3092
3440
  };
3093
3441
  }, [config.platform, recommendMethods, methods, walletMethods]);
3094
- const [emailOpen, setEmailOpen] = useState13(false);
3442
+ const [emailOpen, setEmailOpen] = useState14(false);
3095
3443
  const { login } = useUserInfo();
3096
- const [showWallet, setShowWallet] = useState13(false);
3444
+ const [showWallet, setShowWallet] = useState14(false);
3097
3445
  const intl = useIntl5();
3098
3446
  const isDownMd = useDownMd();
3099
3447
  const methodMap = {
@@ -3241,7 +3589,7 @@ function LoginBox({
3241
3589
  }
3242
3590
 
3243
3591
  // src/components/LoginButton/index.tsx
3244
- import { useState as useState15 } from "react";
3592
+ import { useState as useState16 } from "react";
3245
3593
 
3246
3594
  // src/components/LoginPanel/index.tsx
3247
3595
  import { FormattedMessage as FormattedMessage5 } from "react-intl";
@@ -3284,7 +3632,7 @@ function LoginModal({
3284
3632
  }
3285
3633
 
3286
3634
  // src/components/UserPopover/index.tsx
3287
- import { useState as useState14 } from "react";
3635
+ import { useState as useState15 } from "react";
3288
3636
 
3289
3637
  // src/assets/icon/ProfileIcon.tsx
3290
3638
  import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
@@ -3316,7 +3664,7 @@ import { FormattedMessage as FormattedMessage6, useIntl as useIntl6 } from "reac
3316
3664
  import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
3317
3665
  function UserContent() {
3318
3666
  const { logout, address: address2, username } = useUserInfo();
3319
- const [logouting, setLogouting] = useState14(false);
3667
+ const [logouting, setLogouting] = useState15(false);
3320
3668
  const onLogout = async () => {
3321
3669
  if (logouting) return;
3322
3670
  try {
@@ -3345,7 +3693,7 @@ function UserContent() {
3345
3693
  const UserDivider = () => {
3346
3694
  return /* @__PURE__ */ jsx17("div", { className: `matchid-user-popover-divider` });
3347
3695
  };
3348
- const [usernameOpen, setUsernameOpen] = useState14(false);
3696
+ const [usernameOpen, setUsernameOpen] = useState15(false);
3349
3697
  const [copied, setCopied] = useCopyClipboard();
3350
3698
  const intl = useIntl6();
3351
3699
  return /* @__PURE__ */ jsxs12("div", { className: "matchid-user-popover-content", children: [
@@ -3391,7 +3739,7 @@ function LoginButton({
3391
3739
  }) {
3392
3740
  const intl = useIntl7();
3393
3741
  const { isLogin, username } = useUserInfo();
3394
- const [loginOpen, setLoginOpen] = useState15(false);
3742
+ const [loginOpen, setLoginOpen] = useState16(false);
3395
3743
  if (!isLogin) {
3396
3744
  return /* @__PURE__ */ jsxs13(Fragment3, { children: [
3397
3745
  /* @__PURE__ */ jsx18(
@@ -3419,7 +3767,7 @@ function LoginButton({
3419
3767
  }
3420
3768
 
3421
3769
  // src/components/UsernameModal/index.tsx
3422
- import { useEffect as useEffect14, useMemo as useMemo9, useState as useState16 } from "react";
3770
+ import { useEffect as useEffect15, useMemo as useMemo9, useState as useState17 } from "react";
3423
3771
  import { FormattedMessage as FormattedMessage8, useIntl as useIntl8 } from "react-intl";
3424
3772
  import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
3425
3773
  var ValidItem = ({
@@ -3428,7 +3776,7 @@ var ValidItem = ({
3428
3776
  }) => {
3429
3777
  const isDownMd = useDownMd();
3430
3778
  return /* @__PURE__ */ jsxs14("div", { className: `matchid-valid-status-item matchid-valid-status-${success ? "success" : "error"}`, children: [
3431
- success ? /* @__PURE__ */ jsx19(CheckRoundIcon, { size: isDownMd ? 12 : 16 }) : /* @__PURE__ */ jsx19(InfoRoundIcon, { size: isDownMd ? 12 : 16 }),
3779
+ success ? /* @__PURE__ */ jsx19(CheckRoundIcon, { size: isDownMd ? 12 : 16 }) : /* @__PURE__ */ jsx19(InfoLineIcon, { size: isDownMd ? 12 : 16 }),
3432
3780
  /* @__PURE__ */ jsx19("span", { children: text })
3433
3781
  ] });
3434
3782
  };
@@ -3440,10 +3788,10 @@ function UsernameModal({
3440
3788
  }) {
3441
3789
  const { username, refreshOverview } = useUserInfo();
3442
3790
  const { isLogin } = useUserInfo();
3443
- const [val, setVal] = useState16(username);
3444
- const [error, setError] = useState16("");
3791
+ const [val, setVal] = useState17(username);
3792
+ const [error, setError] = useState17("");
3445
3793
  const isDownMd = useDownMd();
3446
- useEffect14(() => {
3794
+ useEffect15(() => {
3447
3795
  if (isOpen) {
3448
3796
  setVal(username);
3449
3797
  setError("");
@@ -3456,7 +3804,7 @@ function UsernameModal({
3456
3804
  return val.length >= 2 && val.length <= 32;
3457
3805
  }, [val]);
3458
3806
  const isSafe = isValid && isLength;
3459
- const [isSubmitting, setIsSubmitting] = useState16(false);
3807
+ const [isSubmitting, setIsSubmitting] = useState17(false);
3460
3808
  const onSubmit = async () => {
3461
3809
  if (isSubmitting) return;
3462
3810
  try {
@@ -3519,7 +3867,7 @@ function UsernameModal({
3519
3867
  }
3520
3868
 
3521
3869
  // src/components/SOLModal/index.tsx
3522
- import React7, { useEffect as useEffect15, useState as useState17 } from "react";
3870
+ import React7, { useEffect as useEffect16, useState as useState18 } from "react";
3523
3871
  import { clusterApiUrl } from "@solana/web3.js";
3524
3872
  import { useWallet as useWallet2, WalletProvider, ConnectionProvider } from "@solana/wallet-adapter-react";
3525
3873
  import { WalletModalProvider, useWalletModal } from "@solana/wallet-adapter-react-ui";
@@ -3681,17 +4029,17 @@ function WalletContent({
3681
4029
  const { setVisible, visible } = useWalletModal();
3682
4030
  const wallet = useWallet2();
3683
4031
  const { events, login } = useMatch();
3684
- const [status, setStatus] = useState17("");
4032
+ const [status, setStatus] = useState18("");
3685
4033
  const statusRef = React7.useRef(status);
3686
- const [error, setError] = useState17("");
3687
- useEffect15(() => {
4034
+ const [error, setError] = useState18("");
4035
+ useEffect16(() => {
3688
4036
  const init = async () => {
3689
4037
  await wallet.disconnect();
3690
4038
  setVisible(true);
3691
4039
  };
3692
4040
  init();
3693
4041
  }, []);
3694
- useEffect15(() => {
4042
+ useEffect16(() => {
3695
4043
  if (wallet.connected) {
3696
4044
  console.log("wallet.connected", wallet.connected);
3697
4045
  toLoginInWallet();
@@ -3827,7 +4175,7 @@ function SOLModal(props) {
3827
4175
  }
3828
4176
 
3829
4177
  // src/components/TRONModal/index.tsx
3830
- import React8, { useEffect as useEffect17, useMemo as useMemo11, useState as useState19 } from "react";
4178
+ import React8, { useEffect as useEffect18, useMemo as useMemo11, useState as useState20 } from "react";
3831
4179
  import { useIntl as useIntl10 } from "react-intl";
3832
4180
 
3833
4181
  // src/lib/tron/TronLinkAdapter.ts
@@ -3861,7 +4209,7 @@ var TronLinkAdapter = class {
3861
4209
  };
3862
4210
 
3863
4211
  // src/hooks/useTRONWallet.ts
3864
- import { useEffect as useEffect16, useState as useState18 } from "react";
4212
+ import { useEffect as useEffect17, useState as useState19 } from "react";
3865
4213
 
3866
4214
  // src/lib/tron/BitgetAdapter.ts
3867
4215
  var BitgetAdapter = class {
@@ -3906,9 +4254,9 @@ var OKXAdapter = class {
3906
4254
  // src/hooks/useTRONWallet.ts
3907
4255
  var useTRONWallet = () => {
3908
4256
  const wallets2 = [new TronLinkAdapter(), new BitgetAdapter(), new OKXAdapter()];
3909
- const [installedWallets, setInstalledWallets] = useState18([]);
3910
- const [address2, setAddress] = useState18(null);
3911
- useEffect16(() => {
4257
+ const [installedWallets, setInstalledWallets] = useState19([]);
4258
+ const [address2, setAddress] = useState19(null);
4259
+ useEffect17(() => {
3912
4260
  const getInstalled = async () => {
3913
4261
  const installed = await Promise.all(wallets2.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
3914
4262
  wallet: wallet2,
@@ -3918,11 +4266,11 @@ var useTRONWallet = () => {
3918
4266
  };
3919
4267
  getInstalled();
3920
4268
  }, []);
3921
- const [wallet, chooseWallet] = useState18(null);
4269
+ const [wallet, chooseWallet] = useState19(null);
3922
4270
  const onConnect = async () => {
3923
4271
  setAddress(await wallet.connect());
3924
4272
  };
3925
- useEffect16(() => {
4273
+ useEffect17(() => {
3926
4274
  if (!wallet) {
3927
4275
  setAddress(null);
3928
4276
  }
@@ -3953,9 +4301,9 @@ function TRONConnectModal({
3953
4301
  okx: /* @__PURE__ */ jsx22(OKXIcon, { size: isDownMd ? 36 : 40 })
3954
4302
  };
3955
4303
  const { events, login } = useMatch();
3956
- const [status, setStatus] = useState19("");
4304
+ const [status, setStatus] = useState20("");
3957
4305
  const statusRef = React8.useRef(status);
3958
- const [error, setError] = useState19("");
4306
+ const [error, setError] = useState20("");
3959
4307
  const connected = useMemo11(() => {
3960
4308
  return !!address2;
3961
4309
  }, [address2]);
@@ -4024,7 +4372,7 @@ function TRONConnectModal({
4024
4372
  statusRef.current = "";
4025
4373
  }
4026
4374
  };
4027
- useEffect17(() => {
4375
+ useEffect18(() => {
4028
4376
  if (wallet) {
4029
4377
  console.log("onConnect");
4030
4378
  onConnect();
@@ -4032,12 +4380,12 @@ function TRONConnectModal({
4032
4380
  setStatus("");
4033
4381
  }
4034
4382
  }, [wallet]);
4035
- useEffect17(() => {
4383
+ useEffect18(() => {
4036
4384
  if (address2) {
4037
4385
  toLoginInWallet();
4038
4386
  }
4039
4387
  }, [address2]);
4040
- useEffect17(() => {
4388
+ useEffect18(() => {
4041
4389
  if (!props.isOpen) {
4042
4390
  disconnect();
4043
4391
  }
@@ -4095,7 +4443,7 @@ function TRONModal(props) {
4095
4443
  }
4096
4444
 
4097
4445
  // src/components/TONModal/index.tsx
4098
- import React9, { useEffect as useEffect18, useState as useState20 } from "react";
4446
+ import React9, { useEffect as useEffect19, useState as useState21 } from "react";
4099
4447
  import { useIntl as useIntl11 } from "react-intl";
4100
4448
  import {
4101
4449
  TonConnectUIProvider,
@@ -4110,15 +4458,15 @@ function WalletContent2({
4110
4458
  type
4111
4459
  }) {
4112
4460
  const { events, login } = useMatch();
4113
- const [connected, setConnected] = useState20(false);
4461
+ const [connected, setConnected] = useState21(false);
4114
4462
  const wallet = useTonWallet();
4115
4463
  const userFriendlyAddress = useTonAddress();
4116
4464
  const [tonConnectUI] = useTonConnectUI();
4117
4465
  const { state, open, close } = useTonConnectModal();
4118
- const [status, setStatus] = useState20("");
4466
+ const [status, setStatus] = useState21("");
4119
4467
  const statusRef = React9.useRef(status);
4120
- const [error, setError] = useState20("");
4121
- useEffect18(() => {
4468
+ const [error, setError] = useState21("");
4469
+ useEffect19(() => {
4122
4470
  const init = async () => {
4123
4471
  if (wallet) {
4124
4472
  await tonConnectUI.disconnect();
@@ -4191,7 +4539,7 @@ function WalletContent2({
4191
4539
  }
4192
4540
  });
4193
4541
  }, []);
4194
- useEffect18(() => {
4542
+ useEffect19(() => {
4195
4543
  if (wallet) {
4196
4544
  setConnected(true);
4197
4545
  console.log("Wallet connected:", wallet);
@@ -4202,7 +4550,7 @@ function WalletContent2({
4202
4550
  setStatus("");
4203
4551
  }
4204
4552
  }, [wallet]);
4205
- useEffect18(() => {
4553
+ useEffect19(() => {
4206
4554
  console.log({
4207
4555
  state,
4208
4556
  wallet
@@ -4282,7 +4630,7 @@ function TONModal(props) {
4282
4630
  }
4283
4631
 
4284
4632
  // src/components/BTCModal/index.tsx
4285
- import React10, { useEffect as useEffect20, useMemo as useMemo12, useState as useState22 } from "react";
4633
+ import React10, { useEffect as useEffect21, useMemo as useMemo12, useState as useState23 } from "react";
4286
4634
  import { useIntl as useIntl12 } from "react-intl";
4287
4635
 
4288
4636
  // src/lib/btc/UnisatAdapter.ts
@@ -4437,12 +4785,12 @@ var LeatherAdapter = class {
4437
4785
  };
4438
4786
 
4439
4787
  // src/hooks/useBTCWallet.ts
4440
- import { useEffect as useEffect19, useState as useState21 } from "react";
4788
+ import { useEffect as useEffect20, useState as useState22 } from "react";
4441
4789
  var useBTCWallet = () => {
4442
4790
  const wallets2 = [new UnisatAdapter(), new XverseAdapter(), new LeatherAdapter()];
4443
- const [installedWallets, setInstalledWallets] = useState21([]);
4444
- const [address2, setAddress] = useState21(null);
4445
- useEffect19(() => {
4791
+ const [installedWallets, setInstalledWallets] = useState22([]);
4792
+ const [address2, setAddress] = useState22(null);
4793
+ useEffect20(() => {
4446
4794
  const getInstalled = async () => {
4447
4795
  const installed = await Promise.all(wallets2.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
4448
4796
  wallet: wallet2,
@@ -4452,11 +4800,11 @@ var useBTCWallet = () => {
4452
4800
  };
4453
4801
  getInstalled();
4454
4802
  }, []);
4455
- const [wallet, chooseWallet] = useState21(null);
4803
+ const [wallet, chooseWallet] = useState22(null);
4456
4804
  const onConnect = async () => {
4457
4805
  setAddress(await wallet.connect());
4458
4806
  };
4459
- useEffect19(() => {
4807
+ useEffect20(() => {
4460
4808
  if (!wallet) {
4461
4809
  setAddress(null);
4462
4810
  }
@@ -4487,9 +4835,9 @@ function BTCConnectModal({
4487
4835
  xverse: /* @__PURE__ */ jsx24(XverseIcon, { size: isDownMd ? 36 : 40 })
4488
4836
  };
4489
4837
  const { events, login } = useMatch();
4490
- const [status, setStatus] = useState22("");
4838
+ const [status, setStatus] = useState23("");
4491
4839
  const statusRef = React10.useRef(status);
4492
- const [error, setError] = useState22("");
4840
+ const [error, setError] = useState23("");
4493
4841
  const connected = useMemo12(() => {
4494
4842
  return !!address2;
4495
4843
  }, [address2]);
@@ -4554,7 +4902,7 @@ function BTCConnectModal({
4554
4902
  statusRef.current = "";
4555
4903
  }
4556
4904
  };
4557
- useEffect20(() => {
4905
+ useEffect21(() => {
4558
4906
  if (wallet) {
4559
4907
  console.log("onConnect");
4560
4908
  try {
@@ -4567,12 +4915,12 @@ function BTCConnectModal({
4567
4915
  setStatus("");
4568
4916
  }
4569
4917
  }, [wallet]);
4570
- useEffect20(() => {
4918
+ useEffect21(() => {
4571
4919
  if (address2) {
4572
4920
  toLoginInWallet();
4573
4921
  }
4574
4922
  }, [address2]);
4575
- useEffect20(() => {
4923
+ useEffect21(() => {
4576
4924
  if (!props.isOpen) {
4577
4925
  disconnect();
4578
4926
  }
@@ -4714,8 +5062,9 @@ export {
4714
5062
  useMatchWallet,
4715
5063
  useMatchWalletRecords,
4716
5064
  useReceipt,
5065
+ useTransaction,
4717
5066
  hooks_exports,
4718
5067
  MatchProvider,
4719
5068
  useMatch
4720
5069
  };
4721
- //# sourceMappingURL=chunk-BPAPYY5P.mjs.map
5070
+ //# sourceMappingURL=chunk-EY6NPX4M.mjs.map