@matchain/matchid-sdk-react 0.1.48-alpha.6 → 0.1.48-alpha.7
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/assets/icon/index.d.mts +4 -2
- package/dist/assets/icon/index.d.ts +4 -2
- package/dist/assets/icon/index.js +18 -2
- package/dist/assets/icon/index.js.map +1 -1
- package/dist/assets/icon/index.mjs +3 -1
- package/dist/{chunk-BPAPYY5P.mjs → chunk-2CK7JQWH.mjs} +243 -93
- package/dist/chunk-2CK7JQWH.mjs.map +1 -0
- package/dist/{chunk-YFJI4I5M.mjs → chunk-7UTR37EJ.mjs} +18 -3
- package/dist/chunk-7UTR37EJ.mjs.map +1 -0
- package/dist/{chunk-UHBVYFSP.mjs → chunk-USKUYOYJ.mjs} +2 -2
- package/dist/{chunk-55KYW35I.mjs → chunk-YXPWZXPT.mjs} +2 -2
- package/dist/components/index.js +312 -303
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +3 -3
- package/dist/hooks/api/index.js +62 -53
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +4 -4
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +210 -57
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +5 -3
- package/dist/{index-TkB89QxX.d.ts → index-DaEFoDv_.d.ts} +8 -2
- package/dist/{index-DKyt0for.d.mts → index-DktvxNJc.d.mts} +8 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +475 -323
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/ui/index.js +62 -59
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-BPAPYY5P.mjs.map +0 -1
- package/dist/chunk-YFJI4I5M.mjs.map +0 -1
- /package/dist/{chunk-UHBVYFSP.mjs.map → chunk-USKUYOYJ.mjs.map} +0 -0
- /package/dist/{chunk-55KYW35I.mjs.map → chunk-YXPWZXPT.mjs.map} +0 -0
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
matchlog_default,
|
|
13
13
|
useDownMd,
|
|
14
14
|
useLayout_exports
|
|
15
|
-
} from "./chunk-
|
|
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
|
-
|
|
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-
|
|
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
|
|
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";
|
|
@@ -597,6 +597,7 @@ __export(hooks_exports, {
|
|
|
597
597
|
useModal: () => useModal,
|
|
598
598
|
useReceipt: () => useReceipt,
|
|
599
599
|
useToast: () => useToast,
|
|
600
|
+
useTransaction: () => useTransaction,
|
|
600
601
|
useUserInfo: () => useUserInfo,
|
|
601
602
|
useWallet: () => useWallet
|
|
602
603
|
});
|
|
@@ -1239,7 +1240,7 @@ function useMatchChain() {
|
|
|
1239
1240
|
|
|
1240
1241
|
// src/hooks/useMatchWallet.tsx
|
|
1241
1242
|
import { QRCode } from "react-qrcode";
|
|
1242
|
-
import { useEffect as useEffect6, useState as useState7 } from "react";
|
|
1243
|
+
import { useEffect as useEffect6, useRef, useState as useState7 } from "react";
|
|
1243
1244
|
|
|
1244
1245
|
// example/src/config/contract.ts
|
|
1245
1246
|
var address = "0x4143e29770fd63e24bb1f32d50bf8a590e34de4b";
|
|
@@ -1298,8 +1299,9 @@ function useMatchWalletRecords({
|
|
|
1298
1299
|
const [hasMore, setHasMore] = useState7(true);
|
|
1299
1300
|
const [items, setItems] = useState7([]);
|
|
1300
1301
|
const { chainId } = useMatchChain();
|
|
1302
|
+
const hasMoreRef = useRef(hasMore);
|
|
1301
1303
|
const fetchMoreData = async () => {
|
|
1302
|
-
if (!
|
|
1304
|
+
if (!hasMoreRef.current) {
|
|
1303
1305
|
return;
|
|
1304
1306
|
}
|
|
1305
1307
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
@@ -1312,12 +1314,14 @@ function useMatchWalletRecords({
|
|
|
1312
1314
|
if (res.data && res.data.transactions.length > 0) {
|
|
1313
1315
|
setItems(items.concat(res.data.transactions));
|
|
1314
1316
|
}
|
|
1317
|
+
hasMoreRef.current = res.data && res.data.transactions.length >= pageSize;
|
|
1315
1318
|
setHasMore(res.data && res.data.transactions.length >= pageSize);
|
|
1316
1319
|
}
|
|
1317
1320
|
};
|
|
1318
1321
|
const onInit = async () => {
|
|
1319
1322
|
setItems([]);
|
|
1320
1323
|
setHasMore(true);
|
|
1324
|
+
hasMoreRef.current = true;
|
|
1321
1325
|
fetchMoreData();
|
|
1322
1326
|
};
|
|
1323
1327
|
useEffect6(() => {
|
|
@@ -1477,8 +1481,153 @@ function useReceipt({
|
|
|
1477
1481
|
return query;
|
|
1478
1482
|
}
|
|
1479
1483
|
|
|
1484
|
+
// src/hooks/useTransaction.tsx
|
|
1485
|
+
import { useState as useState9, useCallback as useCallback5, useEffect as useEffect8 } from "react";
|
|
1486
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
1487
|
+
import { createPublicClient as createPublicClient2, defineChain as defineChain2, http as http2 } from "viem";
|
|
1488
|
+
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
1489
|
+
var MAX_CACHE_SIZE2 = 500;
|
|
1490
|
+
var STORAGE_KEY2 = "match_transaction_logs";
|
|
1491
|
+
function useTransactionCache() {
|
|
1492
|
+
const [cache, setCache] = useState9(/* @__PURE__ */ new Map());
|
|
1493
|
+
const isLocalStorageAvailable = (() => {
|
|
1494
|
+
try {
|
|
1495
|
+
const testKey = "__test__";
|
|
1496
|
+
localStorage.setItem(testKey, "1");
|
|
1497
|
+
localStorage.removeItem(testKey);
|
|
1498
|
+
return true;
|
|
1499
|
+
} catch (e) {
|
|
1500
|
+
return false;
|
|
1501
|
+
}
|
|
1502
|
+
})();
|
|
1503
|
+
useEffect8(() => {
|
|
1504
|
+
if (isLocalStorageAvailable) {
|
|
1505
|
+
try {
|
|
1506
|
+
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
1507
|
+
if (storedData) {
|
|
1508
|
+
try {
|
|
1509
|
+
const parsed = JSON.parse(storedData);
|
|
1510
|
+
const now = Date.now();
|
|
1511
|
+
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]);
|
|
1512
|
+
setCache(new Map(validEntries));
|
|
1513
|
+
} catch (e) {
|
|
1514
|
+
console.error("Failed to parse cache from localStorage:", e);
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
} catch (e) {
|
|
1518
|
+
console.error("Failed to load cache from localStorage:", e);
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
}, []);
|
|
1522
|
+
const updateLocalStorage = useCallback5((updatedCache) => {
|
|
1523
|
+
if (isLocalStorageAvailable) {
|
|
1524
|
+
try {
|
|
1525
|
+
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
1526
|
+
let parsed = {};
|
|
1527
|
+
if (storedData) {
|
|
1528
|
+
parsed = JSON.parse(storedData);
|
|
1529
|
+
}
|
|
1530
|
+
updatedCache.forEach((entry, key) => {
|
|
1531
|
+
parsed[key] = entry;
|
|
1532
|
+
});
|
|
1533
|
+
localStorage.setItem(STORAGE_KEY2, JSON.stringify(parsed));
|
|
1534
|
+
} catch (e) {
|
|
1535
|
+
console.error("Failed to update localStorage:", e);
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
}, []);
|
|
1539
|
+
const set = useCallback5((key, value) => {
|
|
1540
|
+
const now = Date.now();
|
|
1541
|
+
const newCache = new Map(cache);
|
|
1542
|
+
newCache.forEach((entry, k) => {
|
|
1543
|
+
if (now - entry.timestamp > CACHE_TTL2) {
|
|
1544
|
+
newCache.delete(k);
|
|
1545
|
+
}
|
|
1546
|
+
});
|
|
1547
|
+
if (newCache.size >= MAX_CACHE_SIZE2) {
|
|
1548
|
+
const firstKey = newCache.keys().next().value;
|
|
1549
|
+
if (firstKey !== void 0) {
|
|
1550
|
+
newCache.delete(firstKey);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
newCache.set(key, { value, timestamp: now });
|
|
1554
|
+
setCache(newCache);
|
|
1555
|
+
updateLocalStorage(newCache);
|
|
1556
|
+
}, [cache, updateLocalStorage]);
|
|
1557
|
+
const get = useCallback5((key) => {
|
|
1558
|
+
const entry = cache.get(key);
|
|
1559
|
+
if (entry) {
|
|
1560
|
+
if (Date.now() - entry.timestamp > CACHE_TTL2) {
|
|
1561
|
+
const newCache = new Map(cache);
|
|
1562
|
+
newCache.delete(key);
|
|
1563
|
+
setCache(newCache);
|
|
1564
|
+
updateLocalStorage(newCache);
|
|
1565
|
+
return void 0;
|
|
1566
|
+
}
|
|
1567
|
+
return entry.value;
|
|
1568
|
+
}
|
|
1569
|
+
return void 0;
|
|
1570
|
+
}, [cache, updateLocalStorage]);
|
|
1571
|
+
const del = useCallback5((key) => {
|
|
1572
|
+
if (cache.has(key)) {
|
|
1573
|
+
const newCache = new Map(cache);
|
|
1574
|
+
newCache.delete(key);
|
|
1575
|
+
setCache(newCache);
|
|
1576
|
+
updateLocalStorage(newCache);
|
|
1577
|
+
}
|
|
1578
|
+
}, [cache, updateLocalStorage]);
|
|
1579
|
+
const clear = useCallback5(() => {
|
|
1580
|
+
setCache(/* @__PURE__ */ new Map());
|
|
1581
|
+
if (isLocalStorageAvailable) {
|
|
1582
|
+
localStorage.removeItem(STORAGE_KEY2);
|
|
1583
|
+
}
|
|
1584
|
+
}, [isLocalStorageAvailable]);
|
|
1585
|
+
return { set, get, del, clear };
|
|
1586
|
+
}
|
|
1587
|
+
function useTransaction({
|
|
1588
|
+
chainId,
|
|
1589
|
+
hash
|
|
1590
|
+
}) {
|
|
1591
|
+
const { list } = useMatchChain();
|
|
1592
|
+
const cache = useTransactionCache();
|
|
1593
|
+
const chain = list?.find((item) => item.id === chainId);
|
|
1594
|
+
const [shouldRefetch, setShouldRefetch] = useState9(true);
|
|
1595
|
+
const query = useQuery3({
|
|
1596
|
+
queryKey: ["match-tx-transaction", hash, chain],
|
|
1597
|
+
queryFn: async () => {
|
|
1598
|
+
if (!chain || !hash) return false;
|
|
1599
|
+
const cacheKey = `${chain.id}-${hash}`;
|
|
1600
|
+
if (cache.get(cacheKey)) {
|
|
1601
|
+
return cache.get(cacheKey);
|
|
1602
|
+
}
|
|
1603
|
+
try {
|
|
1604
|
+
const publicClient = createPublicClient2({
|
|
1605
|
+
//@ts-ignore
|
|
1606
|
+
chain: defineChain2(chain),
|
|
1607
|
+
transport: http2()
|
|
1608
|
+
});
|
|
1609
|
+
const transaction = await publicClient.getTransaction({ hash });
|
|
1610
|
+
if (!transaction) {
|
|
1611
|
+
return false;
|
|
1612
|
+
}
|
|
1613
|
+
cache.set(cacheKey, transaction);
|
|
1614
|
+
return transaction;
|
|
1615
|
+
} catch (e) {
|
|
1616
|
+
return false;
|
|
1617
|
+
}
|
|
1618
|
+
},
|
|
1619
|
+
refetchInterval: shouldRefetch ? 1e4 : false
|
|
1620
|
+
});
|
|
1621
|
+
useEffect8(() => {
|
|
1622
|
+
if (query.data) {
|
|
1623
|
+
setShouldRefetch(false);
|
|
1624
|
+
}
|
|
1625
|
+
}, [query.data]);
|
|
1626
|
+
return query;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1480
1629
|
// src/components/CEXBindModal/index.tsx
|
|
1481
|
-
import { useEffect as
|
|
1630
|
+
import { useEffect as useEffect9, useMemo as useMemo5, useState as useState10 } from "react";
|
|
1482
1631
|
import { FormattedMessage as FormattedMessage2, useIntl as useIntl2 } from "react-intl";
|
|
1483
1632
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1484
1633
|
function CEXBindModal({
|
|
@@ -1489,16 +1638,16 @@ function CEXBindModal({
|
|
|
1489
1638
|
}) {
|
|
1490
1639
|
const intl = useIntl2();
|
|
1491
1640
|
const { events } = useMatch();
|
|
1492
|
-
const [APIPassphrase, setAPIPassphrase] =
|
|
1641
|
+
const [APIPassphrase, setAPIPassphrase] = useState10("");
|
|
1493
1642
|
const { refreshOverview } = useUserInfo();
|
|
1494
|
-
const [loading, setLoading] =
|
|
1495
|
-
const [key, setKey] =
|
|
1496
|
-
const [secret, setSecret] =
|
|
1497
|
-
const [error, setError] =
|
|
1643
|
+
const [loading, setLoading] = useState10(false);
|
|
1644
|
+
const [key, setKey] = useState10("");
|
|
1645
|
+
const [secret, setSecret] = useState10("");
|
|
1646
|
+
const [error, setError] = useState10("");
|
|
1498
1647
|
const needPassphrase = useMemo5(() => {
|
|
1499
1648
|
return ["bitget", "okx"].includes(type.toLowerCase());
|
|
1500
1649
|
}, [type]);
|
|
1501
|
-
|
|
1650
|
+
useEffect9(() => {
|
|
1502
1651
|
if (isOpen) {
|
|
1503
1652
|
setSecret("");
|
|
1504
1653
|
setKey("");
|
|
@@ -1678,7 +1827,7 @@ var Providers = ({ children }) => {
|
|
|
1678
1827
|
var context_default = Providers;
|
|
1679
1828
|
|
|
1680
1829
|
// src/hooks/useWalletInit.ts
|
|
1681
|
-
import { useEffect as
|
|
1830
|
+
import { useEffect as useEffect10, useRef as useRef2 } from "react";
|
|
1682
1831
|
|
|
1683
1832
|
// src/utils/wallet.ts
|
|
1684
1833
|
var sendMessage = ({ method, data, resolve, reject, timeout }) => {
|
|
@@ -1711,11 +1860,11 @@ function useWalletInit({
|
|
|
1711
1860
|
}) {
|
|
1712
1861
|
const { endpoints, token, overview, setWallet, wallet, appid, locale, refreshOverview } = useLocalStore_default();
|
|
1713
1862
|
const { setWalletReady, walletReady } = useStore_default();
|
|
1714
|
-
const iframeReadyRef =
|
|
1715
|
-
|
|
1863
|
+
const iframeReadyRef = useRef2(walletReady);
|
|
1864
|
+
useEffect10(() => {
|
|
1716
1865
|
setWallet(config);
|
|
1717
1866
|
}, [config]);
|
|
1718
|
-
|
|
1867
|
+
useEffect10(() => {
|
|
1719
1868
|
matchlog_default.log("sdk.mpc.status", walletReady, iframeReadyRef.current);
|
|
1720
1869
|
iframeReadyRef.current = walletReady;
|
|
1721
1870
|
if (iframeReadyRef.current) {
|
|
@@ -1732,7 +1881,7 @@ function useWalletInit({
|
|
|
1732
1881
|
onReady();
|
|
1733
1882
|
}
|
|
1734
1883
|
}, [walletReady]);
|
|
1735
|
-
|
|
1884
|
+
useEffect10(() => {
|
|
1736
1885
|
if (!endpoints.auth || !appid || !token || !config) {
|
|
1737
1886
|
const existingIframe = getWalletIframe();
|
|
1738
1887
|
if (existingIframe) {
|
|
@@ -1832,7 +1981,7 @@ function useWalletInit({
|
|
|
1832
1981
|
}
|
|
1833
1982
|
}
|
|
1834
1983
|
}, [endpoints.auth, appid, token, config]);
|
|
1835
|
-
|
|
1984
|
+
useEffect10(() => {
|
|
1836
1985
|
const messageHandle = async (e) => {
|
|
1837
1986
|
if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
|
|
1838
1987
|
return;
|
|
@@ -1913,7 +2062,7 @@ function useWalletInit({
|
|
|
1913
2062
|
}
|
|
1914
2063
|
|
|
1915
2064
|
// src/hooks/useInit.tsx
|
|
1916
|
-
import { useEffect as
|
|
2065
|
+
import { useEffect as useEffect11, useRef as useRef3 } from "react";
|
|
1917
2066
|
function useInit({
|
|
1918
2067
|
theme,
|
|
1919
2068
|
appid,
|
|
@@ -1933,23 +2082,23 @@ function useInit({
|
|
|
1933
2082
|
locale: realLocale
|
|
1934
2083
|
} = useLocalStore_default();
|
|
1935
2084
|
const walletModalStore = useWalletModalStore();
|
|
1936
|
-
const overviewLoadingRef =
|
|
2085
|
+
const overviewLoadingRef = useRef3(false);
|
|
1937
2086
|
const searchParams = new URLSearchParams(window.location.search);
|
|
1938
2087
|
const matchToken = searchParams.get("matchToken");
|
|
1939
2088
|
const realEndpoints = endpoints || env_default.endpoints;
|
|
1940
|
-
|
|
2089
|
+
useEffect11(() => {
|
|
1941
2090
|
setTheme(theme);
|
|
1942
2091
|
}, [theme]);
|
|
1943
|
-
|
|
2092
|
+
useEffect11(() => {
|
|
1944
2093
|
setAppid(appid);
|
|
1945
2094
|
}, [appid]);
|
|
1946
|
-
|
|
2095
|
+
useEffect11(() => {
|
|
1947
2096
|
setEndpoints(realEndpoints);
|
|
1948
2097
|
}, [realEndpoints]);
|
|
1949
|
-
|
|
2098
|
+
useEffect11(() => {
|
|
1950
2099
|
setLocale(locale || "en");
|
|
1951
2100
|
}, [locale]);
|
|
1952
|
-
|
|
2101
|
+
useEffect11(() => {
|
|
1953
2102
|
if (matchToken) {
|
|
1954
2103
|
const tokenData = JSON.parse(atob(matchToken));
|
|
1955
2104
|
if (tokenData && tokenData.mid && tokenData.token) {
|
|
@@ -1960,7 +2109,7 @@ function useInit({
|
|
|
1960
2109
|
}
|
|
1961
2110
|
}
|
|
1962
2111
|
}, [matchToken]);
|
|
1963
|
-
|
|
2112
|
+
useEffect11(() => {
|
|
1964
2113
|
const onLoginMessage = (event) => {
|
|
1965
2114
|
const res = event.data;
|
|
1966
2115
|
if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
|
|
@@ -1997,7 +2146,7 @@ function useInit({
|
|
|
1997
2146
|
overviewLoadingRef.current = false;
|
|
1998
2147
|
}
|
|
1999
2148
|
};
|
|
2000
|
-
|
|
2149
|
+
useEffect11(() => {
|
|
2001
2150
|
if (token) {
|
|
2002
2151
|
loadOverview();
|
|
2003
2152
|
}
|
|
@@ -2812,7 +2961,7 @@ function useUserInfo() {
|
|
|
2812
2961
|
}
|
|
2813
2962
|
|
|
2814
2963
|
// src/components/EmailModal/StepVerify.tsx
|
|
2815
|
-
import { useEffect as
|
|
2964
|
+
import { useEffect as useEffect13, useMemo as useMemo7, useRef as useRef4, useState as useState12 } from "react";
|
|
2816
2965
|
|
|
2817
2966
|
// src/config/index.tsx
|
|
2818
2967
|
var EMAIL_INTERVAL = 60;
|
|
@@ -2824,17 +2973,17 @@ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
|
2824
2973
|
function StepVerify(props) {
|
|
2825
2974
|
const intl = useIntl3();
|
|
2826
2975
|
const { getLoginEmailCode, loginByEmail } = useUserInfo();
|
|
2827
|
-
const [error, setError] =
|
|
2828
|
-
const [code, setCode] =
|
|
2829
|
-
const [sending, setSending] =
|
|
2830
|
-
const [submitting, setSubmitting] =
|
|
2831
|
-
const sendTimeRef =
|
|
2832
|
-
const [sendBtnText, setSendBtnText] =
|
|
2976
|
+
const [error, setError] = useState12("");
|
|
2977
|
+
const [code, setCode] = useState12("");
|
|
2978
|
+
const [sending, setSending] = useState12(false);
|
|
2979
|
+
const [submitting, setSubmitting] = useState12(false);
|
|
2980
|
+
const sendTimeRef = useRef4(0);
|
|
2981
|
+
const [sendBtnText, setSendBtnText] = useState12(intl.formatMessage({
|
|
2833
2982
|
id: "send"
|
|
2834
2983
|
}));
|
|
2835
2984
|
const intervalTime = EMAIL_INTERVAL;
|
|
2836
2985
|
const codeLength = EMAIL_CODE_LENGTH;
|
|
2837
|
-
const intervalRef =
|
|
2986
|
+
const intervalRef = useRef4(null);
|
|
2838
2987
|
const isDownMd = useDownMd();
|
|
2839
2988
|
const onSend = async () => {
|
|
2840
2989
|
if (sendTimeRef.current > 0) {
|
|
@@ -2865,7 +3014,7 @@ function StepVerify(props) {
|
|
|
2865
3014
|
setSending(false);
|
|
2866
3015
|
}
|
|
2867
3016
|
};
|
|
2868
|
-
|
|
3017
|
+
useEffect13(() => {
|
|
2869
3018
|
onSend();
|
|
2870
3019
|
return () => {
|
|
2871
3020
|
if (intervalRef.current) {
|
|
@@ -2950,10 +3099,10 @@ function EmailModal({
|
|
|
2950
3099
|
onBack,
|
|
2951
3100
|
onLogin
|
|
2952
3101
|
}) {
|
|
2953
|
-
const [step, setStep] =
|
|
2954
|
-
const [emailVal, setEmailVal] =
|
|
3102
|
+
const [step, setStep] = useState13("input");
|
|
3103
|
+
const [emailVal, setEmailVal] = useState13("");
|
|
2955
3104
|
const intl = useIntl4();
|
|
2956
|
-
|
|
3105
|
+
useEffect14(() => {
|
|
2957
3106
|
if (!isOpen) {
|
|
2958
3107
|
setStep("input");
|
|
2959
3108
|
setEmailVal("");
|
|
@@ -2978,13 +3127,13 @@ function EmailModal({
|
|
|
2978
3127
|
}
|
|
2979
3128
|
|
|
2980
3129
|
// src/components/LoginBox/index.tsx
|
|
2981
|
-
import { useMemo as useMemo8, useState as
|
|
3130
|
+
import { useMemo as useMemo8, useState as useState14 } from "react";
|
|
2982
3131
|
import { FormattedMessage as FormattedMessage4, useIntl as useIntl5 } from "react-intl";
|
|
2983
3132
|
|
|
2984
3133
|
// src/hooks/useAppConfig.ts
|
|
2985
|
-
import { useQuery as
|
|
3134
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
2986
3135
|
function useAppConfig() {
|
|
2987
|
-
const query =
|
|
3136
|
+
const query = useQuery4({
|
|
2988
3137
|
queryKey: ["appConfig"],
|
|
2989
3138
|
queryFn: async () => {
|
|
2990
3139
|
const res = await getAppConfigApi();
|
|
@@ -3091,9 +3240,9 @@ function LoginBox({
|
|
|
3091
3240
|
walletMethods: walletMethodList
|
|
3092
3241
|
};
|
|
3093
3242
|
}, [config.platform, recommendMethods, methods, walletMethods]);
|
|
3094
|
-
const [emailOpen, setEmailOpen] =
|
|
3243
|
+
const [emailOpen, setEmailOpen] = useState14(false);
|
|
3095
3244
|
const { login } = useUserInfo();
|
|
3096
|
-
const [showWallet, setShowWallet] =
|
|
3245
|
+
const [showWallet, setShowWallet] = useState14(false);
|
|
3097
3246
|
const intl = useIntl5();
|
|
3098
3247
|
const isDownMd = useDownMd();
|
|
3099
3248
|
const methodMap = {
|
|
@@ -3241,7 +3390,7 @@ function LoginBox({
|
|
|
3241
3390
|
}
|
|
3242
3391
|
|
|
3243
3392
|
// src/components/LoginButton/index.tsx
|
|
3244
|
-
import { useState as
|
|
3393
|
+
import { useState as useState16 } from "react";
|
|
3245
3394
|
|
|
3246
3395
|
// src/components/LoginPanel/index.tsx
|
|
3247
3396
|
import { FormattedMessage as FormattedMessage5 } from "react-intl";
|
|
@@ -3284,7 +3433,7 @@ function LoginModal({
|
|
|
3284
3433
|
}
|
|
3285
3434
|
|
|
3286
3435
|
// src/components/UserPopover/index.tsx
|
|
3287
|
-
import { useState as
|
|
3436
|
+
import { useState as useState15 } from "react";
|
|
3288
3437
|
|
|
3289
3438
|
// src/assets/icon/ProfileIcon.tsx
|
|
3290
3439
|
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
@@ -3316,7 +3465,7 @@ import { FormattedMessage as FormattedMessage6, useIntl as useIntl6 } from "reac
|
|
|
3316
3465
|
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3317
3466
|
function UserContent() {
|
|
3318
3467
|
const { logout, address: address2, username } = useUserInfo();
|
|
3319
|
-
const [logouting, setLogouting] =
|
|
3468
|
+
const [logouting, setLogouting] = useState15(false);
|
|
3320
3469
|
const onLogout = async () => {
|
|
3321
3470
|
if (logouting) return;
|
|
3322
3471
|
try {
|
|
@@ -3345,7 +3494,7 @@ function UserContent() {
|
|
|
3345
3494
|
const UserDivider = () => {
|
|
3346
3495
|
return /* @__PURE__ */ jsx17("div", { className: `matchid-user-popover-divider` });
|
|
3347
3496
|
};
|
|
3348
|
-
const [usernameOpen, setUsernameOpen] =
|
|
3497
|
+
const [usernameOpen, setUsernameOpen] = useState15(false);
|
|
3349
3498
|
const [copied, setCopied] = useCopyClipboard();
|
|
3350
3499
|
const intl = useIntl6();
|
|
3351
3500
|
return /* @__PURE__ */ jsxs12("div", { className: "matchid-user-popover-content", children: [
|
|
@@ -3391,7 +3540,7 @@ function LoginButton({
|
|
|
3391
3540
|
}) {
|
|
3392
3541
|
const intl = useIntl7();
|
|
3393
3542
|
const { isLogin, username } = useUserInfo();
|
|
3394
|
-
const [loginOpen, setLoginOpen] =
|
|
3543
|
+
const [loginOpen, setLoginOpen] = useState16(false);
|
|
3395
3544
|
if (!isLogin) {
|
|
3396
3545
|
return /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
3397
3546
|
/* @__PURE__ */ jsx18(
|
|
@@ -3419,7 +3568,7 @@ function LoginButton({
|
|
|
3419
3568
|
}
|
|
3420
3569
|
|
|
3421
3570
|
// src/components/UsernameModal/index.tsx
|
|
3422
|
-
import { useEffect as
|
|
3571
|
+
import { useEffect as useEffect15, useMemo as useMemo9, useState as useState17 } from "react";
|
|
3423
3572
|
import { FormattedMessage as FormattedMessage8, useIntl as useIntl8 } from "react-intl";
|
|
3424
3573
|
import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3425
3574
|
var ValidItem = ({
|
|
@@ -3428,7 +3577,7 @@ var ValidItem = ({
|
|
|
3428
3577
|
}) => {
|
|
3429
3578
|
const isDownMd = useDownMd();
|
|
3430
3579
|
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(
|
|
3580
|
+
success ? /* @__PURE__ */ jsx19(CheckRoundIcon, { size: isDownMd ? 12 : 16 }) : /* @__PURE__ */ jsx19(InfoLineIcon, { size: isDownMd ? 12 : 16 }),
|
|
3432
3581
|
/* @__PURE__ */ jsx19("span", { children: text })
|
|
3433
3582
|
] });
|
|
3434
3583
|
};
|
|
@@ -3440,10 +3589,10 @@ function UsernameModal({
|
|
|
3440
3589
|
}) {
|
|
3441
3590
|
const { username, refreshOverview } = useUserInfo();
|
|
3442
3591
|
const { isLogin } = useUserInfo();
|
|
3443
|
-
const [val, setVal] =
|
|
3444
|
-
const [error, setError] =
|
|
3592
|
+
const [val, setVal] = useState17(username);
|
|
3593
|
+
const [error, setError] = useState17("");
|
|
3445
3594
|
const isDownMd = useDownMd();
|
|
3446
|
-
|
|
3595
|
+
useEffect15(() => {
|
|
3447
3596
|
if (isOpen) {
|
|
3448
3597
|
setVal(username);
|
|
3449
3598
|
setError("");
|
|
@@ -3456,7 +3605,7 @@ function UsernameModal({
|
|
|
3456
3605
|
return val.length >= 2 && val.length <= 32;
|
|
3457
3606
|
}, [val]);
|
|
3458
3607
|
const isSafe = isValid && isLength;
|
|
3459
|
-
const [isSubmitting, setIsSubmitting] =
|
|
3608
|
+
const [isSubmitting, setIsSubmitting] = useState17(false);
|
|
3460
3609
|
const onSubmit = async () => {
|
|
3461
3610
|
if (isSubmitting) return;
|
|
3462
3611
|
try {
|
|
@@ -3519,7 +3668,7 @@ function UsernameModal({
|
|
|
3519
3668
|
}
|
|
3520
3669
|
|
|
3521
3670
|
// src/components/SOLModal/index.tsx
|
|
3522
|
-
import React7, { useEffect as
|
|
3671
|
+
import React7, { useEffect as useEffect16, useState as useState18 } from "react";
|
|
3523
3672
|
import { clusterApiUrl } from "@solana/web3.js";
|
|
3524
3673
|
import { useWallet as useWallet2, WalletProvider, ConnectionProvider } from "@solana/wallet-adapter-react";
|
|
3525
3674
|
import { WalletModalProvider, useWalletModal } from "@solana/wallet-adapter-react-ui";
|
|
@@ -3681,17 +3830,17 @@ function WalletContent({
|
|
|
3681
3830
|
const { setVisible, visible } = useWalletModal();
|
|
3682
3831
|
const wallet = useWallet2();
|
|
3683
3832
|
const { events, login } = useMatch();
|
|
3684
|
-
const [status, setStatus] =
|
|
3833
|
+
const [status, setStatus] = useState18("");
|
|
3685
3834
|
const statusRef = React7.useRef(status);
|
|
3686
|
-
const [error, setError] =
|
|
3687
|
-
|
|
3835
|
+
const [error, setError] = useState18("");
|
|
3836
|
+
useEffect16(() => {
|
|
3688
3837
|
const init = async () => {
|
|
3689
3838
|
await wallet.disconnect();
|
|
3690
3839
|
setVisible(true);
|
|
3691
3840
|
};
|
|
3692
3841
|
init();
|
|
3693
3842
|
}, []);
|
|
3694
|
-
|
|
3843
|
+
useEffect16(() => {
|
|
3695
3844
|
if (wallet.connected) {
|
|
3696
3845
|
console.log("wallet.connected", wallet.connected);
|
|
3697
3846
|
toLoginInWallet();
|
|
@@ -3827,7 +3976,7 @@ function SOLModal(props) {
|
|
|
3827
3976
|
}
|
|
3828
3977
|
|
|
3829
3978
|
// src/components/TRONModal/index.tsx
|
|
3830
|
-
import React8, { useEffect as
|
|
3979
|
+
import React8, { useEffect as useEffect18, useMemo as useMemo11, useState as useState20 } from "react";
|
|
3831
3980
|
import { useIntl as useIntl10 } from "react-intl";
|
|
3832
3981
|
|
|
3833
3982
|
// src/lib/tron/TronLinkAdapter.ts
|
|
@@ -3861,7 +4010,7 @@ var TronLinkAdapter = class {
|
|
|
3861
4010
|
};
|
|
3862
4011
|
|
|
3863
4012
|
// src/hooks/useTRONWallet.ts
|
|
3864
|
-
import { useEffect as
|
|
4013
|
+
import { useEffect as useEffect17, useState as useState19 } from "react";
|
|
3865
4014
|
|
|
3866
4015
|
// src/lib/tron/BitgetAdapter.ts
|
|
3867
4016
|
var BitgetAdapter = class {
|
|
@@ -3906,9 +4055,9 @@ var OKXAdapter = class {
|
|
|
3906
4055
|
// src/hooks/useTRONWallet.ts
|
|
3907
4056
|
var useTRONWallet = () => {
|
|
3908
4057
|
const wallets2 = [new TronLinkAdapter(), new BitgetAdapter(), new OKXAdapter()];
|
|
3909
|
-
const [installedWallets, setInstalledWallets] =
|
|
3910
|
-
const [address2, setAddress] =
|
|
3911
|
-
|
|
4058
|
+
const [installedWallets, setInstalledWallets] = useState19([]);
|
|
4059
|
+
const [address2, setAddress] = useState19(null);
|
|
4060
|
+
useEffect17(() => {
|
|
3912
4061
|
const getInstalled = async () => {
|
|
3913
4062
|
const installed = await Promise.all(wallets2.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
3914
4063
|
wallet: wallet2,
|
|
@@ -3918,11 +4067,11 @@ var useTRONWallet = () => {
|
|
|
3918
4067
|
};
|
|
3919
4068
|
getInstalled();
|
|
3920
4069
|
}, []);
|
|
3921
|
-
const [wallet, chooseWallet] =
|
|
4070
|
+
const [wallet, chooseWallet] = useState19(null);
|
|
3922
4071
|
const onConnect = async () => {
|
|
3923
4072
|
setAddress(await wallet.connect());
|
|
3924
4073
|
};
|
|
3925
|
-
|
|
4074
|
+
useEffect17(() => {
|
|
3926
4075
|
if (!wallet) {
|
|
3927
4076
|
setAddress(null);
|
|
3928
4077
|
}
|
|
@@ -3953,9 +4102,9 @@ function TRONConnectModal({
|
|
|
3953
4102
|
okx: /* @__PURE__ */ jsx22(OKXIcon, { size: isDownMd ? 36 : 40 })
|
|
3954
4103
|
};
|
|
3955
4104
|
const { events, login } = useMatch();
|
|
3956
|
-
const [status, setStatus] =
|
|
4105
|
+
const [status, setStatus] = useState20("");
|
|
3957
4106
|
const statusRef = React8.useRef(status);
|
|
3958
|
-
const [error, setError] =
|
|
4107
|
+
const [error, setError] = useState20("");
|
|
3959
4108
|
const connected = useMemo11(() => {
|
|
3960
4109
|
return !!address2;
|
|
3961
4110
|
}, [address2]);
|
|
@@ -4024,7 +4173,7 @@ function TRONConnectModal({
|
|
|
4024
4173
|
statusRef.current = "";
|
|
4025
4174
|
}
|
|
4026
4175
|
};
|
|
4027
|
-
|
|
4176
|
+
useEffect18(() => {
|
|
4028
4177
|
if (wallet) {
|
|
4029
4178
|
console.log("onConnect");
|
|
4030
4179
|
onConnect();
|
|
@@ -4032,12 +4181,12 @@ function TRONConnectModal({
|
|
|
4032
4181
|
setStatus("");
|
|
4033
4182
|
}
|
|
4034
4183
|
}, [wallet]);
|
|
4035
|
-
|
|
4184
|
+
useEffect18(() => {
|
|
4036
4185
|
if (address2) {
|
|
4037
4186
|
toLoginInWallet();
|
|
4038
4187
|
}
|
|
4039
4188
|
}, [address2]);
|
|
4040
|
-
|
|
4189
|
+
useEffect18(() => {
|
|
4041
4190
|
if (!props.isOpen) {
|
|
4042
4191
|
disconnect();
|
|
4043
4192
|
}
|
|
@@ -4095,7 +4244,7 @@ function TRONModal(props) {
|
|
|
4095
4244
|
}
|
|
4096
4245
|
|
|
4097
4246
|
// src/components/TONModal/index.tsx
|
|
4098
|
-
import React9, { useEffect as
|
|
4247
|
+
import React9, { useEffect as useEffect19, useState as useState21 } from "react";
|
|
4099
4248
|
import { useIntl as useIntl11 } from "react-intl";
|
|
4100
4249
|
import {
|
|
4101
4250
|
TonConnectUIProvider,
|
|
@@ -4110,15 +4259,15 @@ function WalletContent2({
|
|
|
4110
4259
|
type
|
|
4111
4260
|
}) {
|
|
4112
4261
|
const { events, login } = useMatch();
|
|
4113
|
-
const [connected, setConnected] =
|
|
4262
|
+
const [connected, setConnected] = useState21(false);
|
|
4114
4263
|
const wallet = useTonWallet();
|
|
4115
4264
|
const userFriendlyAddress = useTonAddress();
|
|
4116
4265
|
const [tonConnectUI] = useTonConnectUI();
|
|
4117
4266
|
const { state, open, close } = useTonConnectModal();
|
|
4118
|
-
const [status, setStatus] =
|
|
4267
|
+
const [status, setStatus] = useState21("");
|
|
4119
4268
|
const statusRef = React9.useRef(status);
|
|
4120
|
-
const [error, setError] =
|
|
4121
|
-
|
|
4269
|
+
const [error, setError] = useState21("");
|
|
4270
|
+
useEffect19(() => {
|
|
4122
4271
|
const init = async () => {
|
|
4123
4272
|
if (wallet) {
|
|
4124
4273
|
await tonConnectUI.disconnect();
|
|
@@ -4191,7 +4340,7 @@ function WalletContent2({
|
|
|
4191
4340
|
}
|
|
4192
4341
|
});
|
|
4193
4342
|
}, []);
|
|
4194
|
-
|
|
4343
|
+
useEffect19(() => {
|
|
4195
4344
|
if (wallet) {
|
|
4196
4345
|
setConnected(true);
|
|
4197
4346
|
console.log("Wallet connected:", wallet);
|
|
@@ -4202,7 +4351,7 @@ function WalletContent2({
|
|
|
4202
4351
|
setStatus("");
|
|
4203
4352
|
}
|
|
4204
4353
|
}, [wallet]);
|
|
4205
|
-
|
|
4354
|
+
useEffect19(() => {
|
|
4206
4355
|
console.log({
|
|
4207
4356
|
state,
|
|
4208
4357
|
wallet
|
|
@@ -4282,7 +4431,7 @@ function TONModal(props) {
|
|
|
4282
4431
|
}
|
|
4283
4432
|
|
|
4284
4433
|
// src/components/BTCModal/index.tsx
|
|
4285
|
-
import React10, { useEffect as
|
|
4434
|
+
import React10, { useEffect as useEffect21, useMemo as useMemo12, useState as useState23 } from "react";
|
|
4286
4435
|
import { useIntl as useIntl12 } from "react-intl";
|
|
4287
4436
|
|
|
4288
4437
|
// src/lib/btc/UnisatAdapter.ts
|
|
@@ -4437,12 +4586,12 @@ var LeatherAdapter = class {
|
|
|
4437
4586
|
};
|
|
4438
4587
|
|
|
4439
4588
|
// src/hooks/useBTCWallet.ts
|
|
4440
|
-
import { useEffect as
|
|
4589
|
+
import { useEffect as useEffect20, useState as useState22 } from "react";
|
|
4441
4590
|
var useBTCWallet = () => {
|
|
4442
4591
|
const wallets2 = [new UnisatAdapter(), new XverseAdapter(), new LeatherAdapter()];
|
|
4443
|
-
const [installedWallets, setInstalledWallets] =
|
|
4444
|
-
const [address2, setAddress] =
|
|
4445
|
-
|
|
4592
|
+
const [installedWallets, setInstalledWallets] = useState22([]);
|
|
4593
|
+
const [address2, setAddress] = useState22(null);
|
|
4594
|
+
useEffect20(() => {
|
|
4446
4595
|
const getInstalled = async () => {
|
|
4447
4596
|
const installed = await Promise.all(wallets2.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
4448
4597
|
wallet: wallet2,
|
|
@@ -4452,11 +4601,11 @@ var useBTCWallet = () => {
|
|
|
4452
4601
|
};
|
|
4453
4602
|
getInstalled();
|
|
4454
4603
|
}, []);
|
|
4455
|
-
const [wallet, chooseWallet] =
|
|
4604
|
+
const [wallet, chooseWallet] = useState22(null);
|
|
4456
4605
|
const onConnect = async () => {
|
|
4457
4606
|
setAddress(await wallet.connect());
|
|
4458
4607
|
};
|
|
4459
|
-
|
|
4608
|
+
useEffect20(() => {
|
|
4460
4609
|
if (!wallet) {
|
|
4461
4610
|
setAddress(null);
|
|
4462
4611
|
}
|
|
@@ -4487,9 +4636,9 @@ function BTCConnectModal({
|
|
|
4487
4636
|
xverse: /* @__PURE__ */ jsx24(XverseIcon, { size: isDownMd ? 36 : 40 })
|
|
4488
4637
|
};
|
|
4489
4638
|
const { events, login } = useMatch();
|
|
4490
|
-
const [status, setStatus] =
|
|
4639
|
+
const [status, setStatus] = useState23("");
|
|
4491
4640
|
const statusRef = React10.useRef(status);
|
|
4492
|
-
const [error, setError] =
|
|
4641
|
+
const [error, setError] = useState23("");
|
|
4493
4642
|
const connected = useMemo12(() => {
|
|
4494
4643
|
return !!address2;
|
|
4495
4644
|
}, [address2]);
|
|
@@ -4554,7 +4703,7 @@ function BTCConnectModal({
|
|
|
4554
4703
|
statusRef.current = "";
|
|
4555
4704
|
}
|
|
4556
4705
|
};
|
|
4557
|
-
|
|
4706
|
+
useEffect21(() => {
|
|
4558
4707
|
if (wallet) {
|
|
4559
4708
|
console.log("onConnect");
|
|
4560
4709
|
try {
|
|
@@ -4567,12 +4716,12 @@ function BTCConnectModal({
|
|
|
4567
4716
|
setStatus("");
|
|
4568
4717
|
}
|
|
4569
4718
|
}, [wallet]);
|
|
4570
|
-
|
|
4719
|
+
useEffect21(() => {
|
|
4571
4720
|
if (address2) {
|
|
4572
4721
|
toLoginInWallet();
|
|
4573
4722
|
}
|
|
4574
4723
|
}, [address2]);
|
|
4575
|
-
|
|
4724
|
+
useEffect21(() => {
|
|
4576
4725
|
if (!props.isOpen) {
|
|
4577
4726
|
disconnect();
|
|
4578
4727
|
}
|
|
@@ -4714,8 +4863,9 @@ export {
|
|
|
4714
4863
|
useMatchWallet,
|
|
4715
4864
|
useMatchWalletRecords,
|
|
4716
4865
|
useReceipt,
|
|
4866
|
+
useTransaction,
|
|
4717
4867
|
hooks_exports,
|
|
4718
4868
|
MatchProvider,
|
|
4719
4869
|
useMatch
|
|
4720
4870
|
};
|
|
4721
|
-
//# sourceMappingURL=chunk-
|
|
4871
|
+
//# sourceMappingURL=chunk-2CK7JQWH.mjs.map
|