@matchain/matchid-sdk-react 0.1.53-alpha.19 → 0.1.53-alpha.20
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/{chunk-Z7L7RRWB.mjs → chunk-CLMSEFOV.mjs} +692 -184
- package/dist/chunk-CLMSEFOV.mjs.map +1 -0
- package/dist/components/index.js +629 -121
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/hooks/api/index.js +52 -36
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +1 -1
- package/dist/hooks/index.js +120 -104
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/index.js +725 -217
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-Z7L7RRWB.mjs.map +0 -1
package/dist/hooks/index.js
CHANGED
|
@@ -356,10 +356,10 @@ var localStore = useLocalStore;
|
|
|
356
356
|
var useLocalStore_default = useLocalStore;
|
|
357
357
|
|
|
358
358
|
// src/hooks/useUserInfo.tsx
|
|
359
|
-
var
|
|
359
|
+
var import_react35 = require("react");
|
|
360
360
|
|
|
361
361
|
// src/MatchContext.tsx
|
|
362
|
-
var
|
|
362
|
+
var import_react34 = require("react");
|
|
363
363
|
|
|
364
364
|
// src/store/useModalStore.ts
|
|
365
365
|
var import_zustand2 = require("zustand");
|
|
@@ -1254,12 +1254,7 @@ var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
|
1254
1254
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
1255
1255
|
|
|
1256
1256
|
// src/components/EVMModal/index.tsx
|
|
1257
|
-
var
|
|
1258
|
-
var import_styles = require("@rainbow-me/rainbowkit/styles.css");
|
|
1259
|
-
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
1260
|
-
|
|
1261
|
-
// src/components/TRONModal/index.tsx
|
|
1262
|
-
var import_react16 = __toESM(require("react"));
|
|
1257
|
+
var import_react16 = require("react");
|
|
1263
1258
|
|
|
1264
1259
|
// src/hooks/eventManager.ts
|
|
1265
1260
|
var EventManager = class {
|
|
@@ -1289,49 +1284,70 @@ var EventManager = class {
|
|
|
1289
1284
|
var eventManager = new EventManager();
|
|
1290
1285
|
var eventManager_default = eventManager;
|
|
1291
1286
|
|
|
1292
|
-
// src/components/
|
|
1293
|
-
var
|
|
1287
|
+
// src/components/EVMModal/index.tsx
|
|
1288
|
+
var import_react_intl9 = require("react-intl");
|
|
1294
1289
|
|
|
1295
1290
|
// src/components/WalletModalContent/index.tsx
|
|
1296
1291
|
var import_react14 = require("react");
|
|
1292
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
1293
|
+
|
|
1294
|
+
// src/components/EVMModal/index.tsx
|
|
1295
|
+
var import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
1296
|
+
var import_wagmi2 = require("wagmi");
|
|
1297
|
+
|
|
1298
|
+
// src/hooks/useWalletBox.ts
|
|
1299
|
+
var import_react15 = require("react");
|
|
1300
|
+
|
|
1301
|
+
// src/hooks/useEthersSigner.ts
|
|
1302
|
+
var React4 = __toESM(require("react"));
|
|
1303
|
+
var import_wagmi = require("wagmi");
|
|
1304
|
+
var import_ethers = require("ethers");
|
|
1305
|
+
|
|
1306
|
+
// src/components/EVMModal/index.tsx
|
|
1307
|
+
var import_siwe = require("siwe");
|
|
1308
|
+
var import_styles = require("@rainbow-me/rainbowkit/styles.css");
|
|
1297
1309
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
1298
1310
|
|
|
1311
|
+
// src/components/TRONModal/index.tsx
|
|
1312
|
+
var import_react18 = __toESM(require("react"));
|
|
1313
|
+
var import_react_intl10 = require("react-intl");
|
|
1314
|
+
|
|
1299
1315
|
// src/hooks/useTRONWallet.ts
|
|
1300
|
-
var
|
|
1316
|
+
var import_react17 = require("react");
|
|
1301
1317
|
|
|
1302
1318
|
// src/components/TRONModal/index.tsx
|
|
1303
1319
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
1304
1320
|
|
|
1305
1321
|
// src/components/TONModal/index.tsx
|
|
1306
|
-
var
|
|
1322
|
+
var import_react19 = __toESM(require("react"));
|
|
1307
1323
|
var import_react_intl11 = require("react-intl");
|
|
1308
1324
|
var import_ui_react = require("@tonconnect/ui-react");
|
|
1309
1325
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
1310
1326
|
|
|
1311
1327
|
// src/components/BTCModal/index.tsx
|
|
1312
|
-
var
|
|
1328
|
+
var import_react21 = __toESM(require("react"));
|
|
1313
1329
|
var import_react_intl12 = require("react-intl");
|
|
1314
1330
|
|
|
1315
1331
|
// src/lib/btc/XverseAdapter.ts
|
|
1316
1332
|
var import_sats_connect = require("sats-connect");
|
|
1317
1333
|
|
|
1318
1334
|
// src/hooks/useBTCWallet.ts
|
|
1319
|
-
var
|
|
1335
|
+
var import_react20 = require("react");
|
|
1320
1336
|
|
|
1321
1337
|
// src/components/BTCModal/index.tsx
|
|
1322
1338
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
1323
1339
|
|
|
1324
1340
|
// src/components/WalletModal/index.tsx
|
|
1325
|
-
var
|
|
1341
|
+
var import_react22 = require("react");
|
|
1326
1342
|
var import_react_intl13 = require("react-intl");
|
|
1327
1343
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
1328
1344
|
|
|
1329
1345
|
// src/components/AlphaAvatar/index.tsx
|
|
1330
|
-
var
|
|
1346
|
+
var import_react23 = require("react");
|
|
1331
1347
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
1332
1348
|
function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
1333
|
-
const [avatar, setAvatar] = (0,
|
|
1334
|
-
(0,
|
|
1349
|
+
const [avatar, setAvatar] = (0, import_react23.useState)(void 0);
|
|
1350
|
+
(0, import_react23.useEffect)(() => {
|
|
1335
1351
|
if (name) {
|
|
1336
1352
|
const char = name[0].toUpperCase();
|
|
1337
1353
|
setAvatar(char);
|
|
@@ -1348,7 +1364,7 @@ function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
|
1348
1364
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
1349
1365
|
|
|
1350
1366
|
// src/components/TokenSend/index.tsx
|
|
1351
|
-
var
|
|
1367
|
+
var import_react24 = require("react");
|
|
1352
1368
|
var import_viem2 = require("viem");
|
|
1353
1369
|
var import_react_intl14 = require("react-intl");
|
|
1354
1370
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
@@ -1386,22 +1402,22 @@ function TokenSend({
|
|
|
1386
1402
|
const intl = (0, import_react_intl14.useIntl)();
|
|
1387
1403
|
const { createWalletClient: createWalletClient2 } = useWallet();
|
|
1388
1404
|
const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
|
|
1389
|
-
const chain = (0,
|
|
1405
|
+
const chain = (0, import_react24.useMemo)(() => {
|
|
1390
1406
|
return chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
1391
1407
|
}, [chainList, token.chain_id]);
|
|
1392
|
-
const walletClient = (0,
|
|
1408
|
+
const walletClient = (0, import_react24.useMemo)(() => {
|
|
1393
1409
|
return createWalletClient2({
|
|
1394
1410
|
// @ts-ignore
|
|
1395
1411
|
chain: (0, import_viem2.defineChain)(chain),
|
|
1396
1412
|
transport: (0, import_viem2.http)()
|
|
1397
1413
|
});
|
|
1398
1414
|
}, [chain]);
|
|
1399
|
-
const [amount, setAmount] = (0,
|
|
1400
|
-
const [address, setAddress] = (0,
|
|
1401
|
-
const [loading, setLoading] = (0,
|
|
1402
|
-
const [sending, setSending] = (0,
|
|
1403
|
-
const [txError, setTxError] = (0,
|
|
1404
|
-
const transaction = (0,
|
|
1415
|
+
const [amount, setAmount] = (0, import_react24.useState)("");
|
|
1416
|
+
const [address, setAddress] = (0, import_react24.useState)("");
|
|
1417
|
+
const [loading, setLoading] = (0, import_react24.useState)(false);
|
|
1418
|
+
const [sending, setSending] = (0, import_react24.useState)(false);
|
|
1419
|
+
const [txError, setTxError] = (0, import_react24.useState)("");
|
|
1420
|
+
const transaction = (0, import_react24.useMemo)(() => {
|
|
1405
1421
|
const reg = /^0x[a-fA-F0-9]{40}$/;
|
|
1406
1422
|
if (!amount || !address || !reg.test(address)) {
|
|
1407
1423
|
return;
|
|
@@ -1432,7 +1448,7 @@ function TokenSend({
|
|
|
1432
1448
|
setLoading(false);
|
|
1433
1449
|
}
|
|
1434
1450
|
};
|
|
1435
|
-
const error = (0,
|
|
1451
|
+
const error = (0, import_react24.useMemo)(() => {
|
|
1436
1452
|
setTxError("");
|
|
1437
1453
|
let amountError = "";
|
|
1438
1454
|
let addressError = "";
|
|
@@ -1475,7 +1491,7 @@ function TokenSend({
|
|
|
1475
1491
|
setAmount(value);
|
|
1476
1492
|
}
|
|
1477
1493
|
};
|
|
1478
|
-
const canSend = (0,
|
|
1494
|
+
const canSend = (0, import_react24.useMemo)(() => {
|
|
1479
1495
|
return !error.amount && !error.address && amount && address;
|
|
1480
1496
|
}, [error]);
|
|
1481
1497
|
const onNext = async () => {
|
|
@@ -1485,7 +1501,7 @@ function TokenSend({
|
|
|
1485
1501
|
}
|
|
1486
1502
|
onClose();
|
|
1487
1503
|
};
|
|
1488
|
-
(0,
|
|
1504
|
+
(0, import_react24.useEffect)(() => {
|
|
1489
1505
|
const receiveMessage = (event) => {
|
|
1490
1506
|
if (event.data) {
|
|
1491
1507
|
if (event.data.source == "match-wallet") {
|
|
@@ -1578,7 +1594,7 @@ var import_react_intl15 = require("react-intl");
|
|
|
1578
1594
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
1579
1595
|
|
|
1580
1596
|
// src/components/TokenSendList/index.tsx
|
|
1581
|
-
var
|
|
1597
|
+
var import_react25 = require("react");
|
|
1582
1598
|
var import_react_intl16 = require("react-intl");
|
|
1583
1599
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
1584
1600
|
function TokenSendList({ close }) {
|
|
@@ -1588,7 +1604,7 @@ function TokenSendList({ close }) {
|
|
|
1588
1604
|
list: walletAssets.mergedAssets
|
|
1589
1605
|
});
|
|
1590
1606
|
const { list } = useMatchChain();
|
|
1591
|
-
const [checked, setChecked] = (0,
|
|
1607
|
+
const [checked, setChecked] = (0, import_react25.useState)();
|
|
1592
1608
|
const modal = useModal();
|
|
1593
1609
|
const onNext = () => {
|
|
1594
1610
|
checked && modal.show((props) => {
|
|
@@ -1645,7 +1661,7 @@ function TokenSendList({ close }) {
|
|
|
1645
1661
|
|
|
1646
1662
|
// src/components/TransactionList/index.tsx
|
|
1647
1663
|
var import_react_infinite_scroll_component = __toESM(require("react-infinite-scroll-component"));
|
|
1648
|
-
var
|
|
1664
|
+
var import_react26 = require("react");
|
|
1649
1665
|
var import_viem3 = require("viem");
|
|
1650
1666
|
var import_viem4 = require("viem");
|
|
1651
1667
|
|
|
@@ -1773,16 +1789,16 @@ function useImportTokenListQuery({
|
|
|
1773
1789
|
// src/hooks/api/contact.ts
|
|
1774
1790
|
var import_react_query6 = require("@tanstack/react-query");
|
|
1775
1791
|
var import_last = __toESM(require("lodash/last"));
|
|
1776
|
-
var
|
|
1792
|
+
var import_react27 = require("react");
|
|
1777
1793
|
|
|
1778
1794
|
// src/components/ContactList/index.tsx
|
|
1779
1795
|
var import_react_virtuoso = require("react-virtuoso");
|
|
1780
|
-
var
|
|
1796
|
+
var import_react28 = require("react");
|
|
1781
1797
|
var import_react_intl18 = require("react-intl");
|
|
1782
1798
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
1783
1799
|
|
|
1784
1800
|
// src/components/CEXBindModal/index.tsx
|
|
1785
|
-
var
|
|
1801
|
+
var import_react29 = require("react");
|
|
1786
1802
|
var import_react_intl19 = require("react-intl");
|
|
1787
1803
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
1788
1804
|
|
|
@@ -1805,12 +1821,12 @@ var useStore_default = useStore;
|
|
|
1805
1821
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
1806
1822
|
|
|
1807
1823
|
// src/context/ModalContext.tsx
|
|
1808
|
-
var
|
|
1824
|
+
var import_react30 = __toESM(require("react"));
|
|
1809
1825
|
var import_react_dom = require("react-dom");
|
|
1810
1826
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
1811
|
-
var ModalContext = (0,
|
|
1827
|
+
var ModalContext = (0, import_react30.createContext)(null);
|
|
1812
1828
|
function useModal() {
|
|
1813
|
-
const context = (0,
|
|
1829
|
+
const context = (0, import_react30.useContext)(ModalContext);
|
|
1814
1830
|
if (!context) {
|
|
1815
1831
|
throw new Error("useModal must be used within a ModalProvider");
|
|
1816
1832
|
}
|
|
@@ -1818,12 +1834,12 @@ function useModal() {
|
|
|
1818
1834
|
}
|
|
1819
1835
|
|
|
1820
1836
|
// src/context/ToastContext.tsx
|
|
1821
|
-
var
|
|
1837
|
+
var import_react31 = require("react");
|
|
1822
1838
|
var import_react_dom2 = require("react-dom");
|
|
1823
1839
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
1824
|
-
var ToastContext = (0,
|
|
1840
|
+
var ToastContext = (0, import_react31.createContext)(null);
|
|
1825
1841
|
function useToast() {
|
|
1826
|
-
const context = (0,
|
|
1842
|
+
const context = (0, import_react31.useContext)(ToastContext);
|
|
1827
1843
|
if (!context) {
|
|
1828
1844
|
throw new Error("useToast must be used within a ToastProvider");
|
|
1829
1845
|
}
|
|
@@ -1834,16 +1850,16 @@ function useToast() {
|
|
|
1834
1850
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
1835
1851
|
|
|
1836
1852
|
// src/hooks/useWalletInit.ts
|
|
1837
|
-
var
|
|
1853
|
+
var import_react32 = require("react");
|
|
1838
1854
|
var AppClientId = getAppClientId();
|
|
1839
1855
|
|
|
1840
1856
|
// src/hooks/useInit.tsx
|
|
1841
|
-
var
|
|
1857
|
+
var import_react33 = require("react");
|
|
1842
1858
|
|
|
1843
1859
|
// src/MatchContext.tsx
|
|
1844
1860
|
var import_react_query8 = require("@tanstack/react-query");
|
|
1845
1861
|
var import_react_intl20 = require("react-intl");
|
|
1846
|
-
var
|
|
1862
|
+
var import_rainbowkit2 = require("@rainbow-me/rainbowkit");
|
|
1847
1863
|
var import_wallets = require("@rainbow-me/rainbowkit/wallets");
|
|
1848
1864
|
var import_chains = require("wagmi/chains");
|
|
1849
1865
|
|
|
@@ -1910,10 +1926,10 @@ var matchTest = /* @__PURE__ */ (0, import_viem6.defineChain)({
|
|
|
1910
1926
|
});
|
|
1911
1927
|
|
|
1912
1928
|
// src/MatchContext.tsx
|
|
1913
|
-
var
|
|
1929
|
+
var import_wagmi3 = require("wagmi");
|
|
1914
1930
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
1915
1931
|
var queryClient = new import_react_query8.QueryClient();
|
|
1916
|
-
var wagmiConfig = (0,
|
|
1932
|
+
var wagmiConfig = (0, import_rainbowkit2.getDefaultConfig)({
|
|
1917
1933
|
appName: "MatchID",
|
|
1918
1934
|
projectId: "9ac6ea7e07860f04616fb311b447dee9",
|
|
1919
1935
|
wallets: [
|
|
@@ -1930,9 +1946,9 @@ var wagmiConfig = (0, import_rainbowkit.getDefaultConfig)({
|
|
|
1930
1946
|
],
|
|
1931
1947
|
chains: [import_chains.mainnet, import_chains.polygon, import_chains.optimism, import_chains.arbitrum, import_chains.base, matchMain, matchTest, import_chains.bsc]
|
|
1932
1948
|
});
|
|
1933
|
-
var MatchContext = (0,
|
|
1949
|
+
var MatchContext = (0, import_react34.createContext)(void 0);
|
|
1934
1950
|
var useMatch = () => {
|
|
1935
|
-
const context = (0,
|
|
1951
|
+
const context = (0, import_react34.useContext)(MatchContext);
|
|
1936
1952
|
if (context === void 0) {
|
|
1937
1953
|
throw new Error("useMatch must be used within a MatchProvider");
|
|
1938
1954
|
}
|
|
@@ -1966,7 +1982,7 @@ function useUserInfo() {
|
|
|
1966
1982
|
const getRedirectUri = () => {
|
|
1967
1983
|
return encodeURIComponent(window.location.href);
|
|
1968
1984
|
};
|
|
1969
|
-
const isLogin = (0,
|
|
1985
|
+
const isLogin = (0, import_react35.useMemo)(() => !!token && !!overview, [token, overview]);
|
|
1970
1986
|
const logout = async () => {
|
|
1971
1987
|
try {
|
|
1972
1988
|
await toLogoutApi();
|
|
@@ -2237,9 +2253,9 @@ function useUserInfo() {
|
|
|
2237
2253
|
}
|
|
2238
2254
|
|
|
2239
2255
|
// src/hooks/useMatchEvents.ts
|
|
2240
|
-
var
|
|
2256
|
+
var import_react36 = require("react");
|
|
2241
2257
|
function useMatchEvents(handlers) {
|
|
2242
|
-
(0,
|
|
2258
|
+
(0, import_react36.useEffect)(() => {
|
|
2243
2259
|
Object.entries(handlers).forEach(([event, handler2]) => {
|
|
2244
2260
|
if (handler2) {
|
|
2245
2261
|
eventManager_default.on(event, handler2);
|
|
@@ -2259,7 +2275,7 @@ function useMatchEvents(handlers) {
|
|
|
2259
2275
|
var import_viem7 = require("viem");
|
|
2260
2276
|
var import_accounts = require("viem/accounts");
|
|
2261
2277
|
var import_viem8 = require("viem");
|
|
2262
|
-
var
|
|
2278
|
+
var import_react37 = require("react");
|
|
2263
2279
|
var import_viem9 = require("viem");
|
|
2264
2280
|
|
|
2265
2281
|
// src/store/useTransactionStore.ts
|
|
@@ -2344,7 +2360,7 @@ function useWallet() {
|
|
|
2344
2360
|
throw error;
|
|
2345
2361
|
}
|
|
2346
2362
|
};
|
|
2347
|
-
const evmAccount = (0,
|
|
2363
|
+
const evmAccount = (0, import_react37.useMemo)(() => {
|
|
2348
2364
|
try {
|
|
2349
2365
|
return address ? (0, import_accounts.toAccount)({
|
|
2350
2366
|
address,
|
|
@@ -2383,7 +2399,7 @@ function useWallet() {
|
|
|
2383
2399
|
return void 0;
|
|
2384
2400
|
}
|
|
2385
2401
|
}, [address]);
|
|
2386
|
-
(0,
|
|
2402
|
+
(0, import_react37.useEffect)(() => {
|
|
2387
2403
|
matchlog_default.log("qwe-evmAccount", evmAccount);
|
|
2388
2404
|
}, [evmAccount]);
|
|
2389
2405
|
const realCreateWalletClient = (parameters) => {
|
|
@@ -2519,14 +2535,14 @@ function useWallet() {
|
|
|
2519
2535
|
|
|
2520
2536
|
// src/hooks/useCopyClipboard.ts
|
|
2521
2537
|
var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
|
|
2522
|
-
var
|
|
2538
|
+
var import_react38 = require("react");
|
|
2523
2539
|
function useCopyClipboard(timeout = 500) {
|
|
2524
|
-
const [isCopied, setIsCopied] = (0,
|
|
2525
|
-
const staticCopy = (0,
|
|
2540
|
+
const [isCopied, setIsCopied] = (0, import_react38.useState)(false);
|
|
2541
|
+
const staticCopy = (0, import_react38.useCallback)((text) => {
|
|
2526
2542
|
const didCopy = (0, import_copy_to_clipboard.default)(text);
|
|
2527
2543
|
setIsCopied(didCopy);
|
|
2528
2544
|
}, []);
|
|
2529
|
-
(0,
|
|
2545
|
+
(0, import_react38.useEffect)(() => {
|
|
2530
2546
|
if (isCopied) {
|
|
2531
2547
|
const hide = setTimeout(() => {
|
|
2532
2548
|
setIsCopied(false);
|
|
@@ -2541,7 +2557,7 @@ function useCopyClipboard(timeout = 500) {
|
|
|
2541
2557
|
}
|
|
2542
2558
|
|
|
2543
2559
|
// src/hooks/useMatchChain.tsx
|
|
2544
|
-
var
|
|
2560
|
+
var import_react39 = require("react");
|
|
2545
2561
|
var import_viem10 = require("viem");
|
|
2546
2562
|
var import_react_intl21 = require("react-intl");
|
|
2547
2563
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
@@ -2550,7 +2566,7 @@ function useMatchChain() {
|
|
|
2550
2566
|
const modal = useModal();
|
|
2551
2567
|
const intl = (0, import_react_intl21.useIntl)();
|
|
2552
2568
|
const { chainId: storeChainId, setChainId } = useLocalStore_default();
|
|
2553
|
-
const chainId = (0,
|
|
2569
|
+
const chainId = (0, import_react39.useMemo)(() => {
|
|
2554
2570
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
2555
2571
|
return null;
|
|
2556
2572
|
}
|
|
@@ -2559,7 +2575,7 @@ function useMatchChain() {
|
|
|
2559
2575
|
}
|
|
2560
2576
|
return chainListQuery.data[0].id;
|
|
2561
2577
|
}, [storeChainId, chainListQuery.data]);
|
|
2562
|
-
const chain = (0,
|
|
2578
|
+
const chain = (0, import_react39.useMemo)(() => {
|
|
2563
2579
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
2564
2580
|
return null;
|
|
2565
2581
|
}
|
|
@@ -2573,7 +2589,7 @@ function useMatchChain() {
|
|
|
2573
2589
|
close
|
|
2574
2590
|
}) {
|
|
2575
2591
|
const { chainId: storeChainId2, setChainId: setChainId2 } = useLocalStore_default();
|
|
2576
|
-
const [selectedChainId, setSelectedChainId] = (0,
|
|
2592
|
+
const [selectedChainId, setSelectedChainId] = (0, import_react39.useState)(storeChainId2);
|
|
2577
2593
|
const isDownMd = useDownMd();
|
|
2578
2594
|
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: `matchid-change-network-box`, children: [
|
|
2579
2595
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: `matchid-change-network-list`, children: chainListQuery.data?.map((item, index) => {
|
|
@@ -2605,7 +2621,7 @@ function useMatchChain() {
|
|
|
2605
2621
|
content: ChangeNetwork
|
|
2606
2622
|
});
|
|
2607
2623
|
};
|
|
2608
|
-
const publicClient = (0,
|
|
2624
|
+
const publicClient = (0, import_react39.useMemo)(() => {
|
|
2609
2625
|
if (!chain) {
|
|
2610
2626
|
return null;
|
|
2611
2627
|
}
|
|
@@ -2633,13 +2649,13 @@ function useMatchChain() {
|
|
|
2633
2649
|
|
|
2634
2650
|
// src/hooks/useMatchWallet.tsx
|
|
2635
2651
|
var import_react_qrcode = require("react-qrcode");
|
|
2636
|
-
var
|
|
2652
|
+
var import_react41 = require("react");
|
|
2637
2653
|
var import_react_query11 = require("@tanstack/react-query");
|
|
2638
2654
|
var import_viem13 = require("viem");
|
|
2639
2655
|
var import_react_intl23 = require("react-intl");
|
|
2640
2656
|
|
|
2641
2657
|
// src/components/ImportToken/index.tsx
|
|
2642
|
-
var
|
|
2658
|
+
var import_react40 = require("react");
|
|
2643
2659
|
var import_react_intl22 = require("react-intl");
|
|
2644
2660
|
var import_react_query10 = require("@tanstack/react-query");
|
|
2645
2661
|
var import_viem12 = require("viem");
|
|
@@ -2671,12 +2687,12 @@ function useIsContract({
|
|
|
2671
2687
|
// src/components/ImportToken/index.tsx
|
|
2672
2688
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
2673
2689
|
function ImportToken({ close }) {
|
|
2674
|
-
const [status, setStatus] = (0,
|
|
2690
|
+
const [status, setStatus] = (0, import_react40.useState)("");
|
|
2675
2691
|
const { token } = useUserInfo();
|
|
2676
|
-
const [address, setAddress] = (0,
|
|
2677
|
-
const [symbol, setSymbol] = (0,
|
|
2678
|
-
const [decimals, setDecimals] = (0,
|
|
2679
|
-
const [error, setError] = (0,
|
|
2692
|
+
const [address, setAddress] = (0, import_react40.useState)("");
|
|
2693
|
+
const [symbol, setSymbol] = (0, import_react40.useState)("");
|
|
2694
|
+
const [decimals, setDecimals] = (0, import_react40.useState)("");
|
|
2695
|
+
const [error, setError] = (0, import_react40.useState)({});
|
|
2680
2696
|
const { publicClient, chainId, chain } = useMatchChain();
|
|
2681
2697
|
const getContractInfo = async () => {
|
|
2682
2698
|
if (!publicClient) return;
|
|
@@ -2710,7 +2726,7 @@ function ImportToken({ close }) {
|
|
|
2710
2726
|
}
|
|
2711
2727
|
};
|
|
2712
2728
|
const intl = (0, import_react_intl22.useIntl)();
|
|
2713
|
-
(0,
|
|
2729
|
+
(0, import_react40.useEffect)(() => {
|
|
2714
2730
|
if (address.length === 42) {
|
|
2715
2731
|
const reg = /^0x[0-9a-fA-F]{40}$/;
|
|
2716
2732
|
if (!reg.test(address)) {
|
|
@@ -2729,7 +2745,7 @@ function ImportToken({ close }) {
|
|
|
2729
2745
|
}
|
|
2730
2746
|
}
|
|
2731
2747
|
}, [address, publicClient]);
|
|
2732
|
-
const [loading, setLoading] = (0,
|
|
2748
|
+
const [loading, setLoading] = (0, import_react40.useState)(false);
|
|
2733
2749
|
const toast = useToast();
|
|
2734
2750
|
const queryClient2 = (0, import_react_query10.useQueryClient)();
|
|
2735
2751
|
const onImport = async () => {
|
|
@@ -2757,7 +2773,7 @@ function ImportToken({ close }) {
|
|
|
2757
2773
|
setLoading(false);
|
|
2758
2774
|
}
|
|
2759
2775
|
};
|
|
2760
|
-
const canImport = (0,
|
|
2776
|
+
const canImport = (0, import_react40.useMemo)(() => {
|
|
2761
2777
|
if (!address) {
|
|
2762
2778
|
return false;
|
|
2763
2779
|
}
|
|
@@ -2923,12 +2939,12 @@ function useMatchWallet() {
|
|
|
2923
2939
|
};
|
|
2924
2940
|
}
|
|
2925
2941
|
function useMatchWalletRecords() {
|
|
2926
|
-
const [hasMore, setHasMore] = (0,
|
|
2927
|
-
const [items, setItems] = (0,
|
|
2942
|
+
const [hasMore, setHasMore] = (0, import_react41.useState)(true);
|
|
2943
|
+
const [items, setItems] = (0, import_react41.useState)([]);
|
|
2928
2944
|
const { chainId, publicClient } = useMatchChain();
|
|
2929
2945
|
const { address } = useWallet();
|
|
2930
|
-
const hasMoreRef = (0,
|
|
2931
|
-
const nextPageParamsRef = (0,
|
|
2946
|
+
const hasMoreRef = (0, import_react41.useRef)(hasMore);
|
|
2947
|
+
const nextPageParamsRef = (0, import_react41.useRef)(void 0);
|
|
2932
2948
|
const { contracts, setContracts } = useContractStore_default();
|
|
2933
2949
|
const fetchMoreData = async () => {
|
|
2934
2950
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
@@ -2955,7 +2971,7 @@ function useMatchWalletRecords() {
|
|
|
2955
2971
|
hasMoreRef.current = true;
|
|
2956
2972
|
fetchMoreData();
|
|
2957
2973
|
};
|
|
2958
|
-
(0,
|
|
2974
|
+
(0, import_react41.useEffect)(() => {
|
|
2959
2975
|
if (chainId && address) {
|
|
2960
2976
|
onInit();
|
|
2961
2977
|
}
|
|
@@ -3011,7 +3027,7 @@ function useMatchWalletRecords() {
|
|
|
3011
3027
|
setContracts(contractMap);
|
|
3012
3028
|
}
|
|
3013
3029
|
};
|
|
3014
|
-
const list = (0,
|
|
3030
|
+
const list = (0, import_react41.useMemo)(() => {
|
|
3015
3031
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
3016
3032
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
3017
3033
|
removeList.forEach((item) => {
|
|
@@ -3053,7 +3069,7 @@ function useMatchWalletAssets({
|
|
|
3053
3069
|
chainId: chainId || 0,
|
|
3054
3070
|
...assetListOptions
|
|
3055
3071
|
});
|
|
3056
|
-
const mergedAssets = (0,
|
|
3072
|
+
const mergedAssets = (0, import_react41.useMemo)(() => {
|
|
3057
3073
|
if (!assetListQuery.data && !importTokenQuery.data) return [];
|
|
3058
3074
|
const assetList = (assetListQuery.data || []).map((asset) => ({
|
|
3059
3075
|
...asset,
|
|
@@ -3140,7 +3156,7 @@ function useMatchWalletAssetList({
|
|
|
3140
3156
|
retry: 3
|
|
3141
3157
|
// Retry up to 3 times if failed
|
|
3142
3158
|
});
|
|
3143
|
-
const erc20Tokens = (0,
|
|
3159
|
+
const erc20Tokens = (0, import_react41.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
|
|
3144
3160
|
const erc20BalanceQuery = (0, import_react_query11.useQuery)({
|
|
3145
3161
|
queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
|
|
3146
3162
|
queryFn: async () => {
|
|
@@ -3168,7 +3184,7 @@ function useMatchWalletAssetList({
|
|
|
3168
3184
|
// Refresh every 15 seconds
|
|
3169
3185
|
retry: 3
|
|
3170
3186
|
});
|
|
3171
|
-
const enrichedAssets = (0,
|
|
3187
|
+
const enrichedAssets = (0, import_react41.useMemo)(() => {
|
|
3172
3188
|
if (!list) return [];
|
|
3173
3189
|
const erc20Balances = erc20BalanceQuery.data || [];
|
|
3174
3190
|
return list.map((asset) => {
|
|
@@ -3190,7 +3206,7 @@ function useMatchWalletAssetList({
|
|
|
3190
3206
|
return { ...asset, balance, value, balanceValue };
|
|
3191
3207
|
});
|
|
3192
3208
|
}, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
|
|
3193
|
-
(0,
|
|
3209
|
+
(0, import_react41.useEffect)(() => {
|
|
3194
3210
|
const list2 = enrichedAssets.sort((a, b) => {
|
|
3195
3211
|
if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
|
|
3196
3212
|
if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
|
|
@@ -3215,14 +3231,14 @@ function useMatchWalletAssetList({
|
|
|
3215
3231
|
}
|
|
3216
3232
|
|
|
3217
3233
|
// src/hooks/useReceipt.tsx
|
|
3218
|
-
var
|
|
3234
|
+
var import_react42 = require("react");
|
|
3219
3235
|
var import_react_query12 = require("@tanstack/react-query");
|
|
3220
3236
|
var import_viem14 = require("viem");
|
|
3221
3237
|
var CACHE_TTL = 86400 * 30 * 1e3;
|
|
3222
3238
|
var MAX_CACHE_SIZE = 500;
|
|
3223
3239
|
var STORAGE_KEY = "match_receipt_logs";
|
|
3224
3240
|
function useReceiptCache() {
|
|
3225
|
-
const [cache, setCache] = (0,
|
|
3241
|
+
const [cache, setCache] = (0, import_react42.useState)(/* @__PURE__ */ new Map());
|
|
3226
3242
|
const isLocalStorageAvailable = (() => {
|
|
3227
3243
|
try {
|
|
3228
3244
|
const testKey = "__test__";
|
|
@@ -3233,7 +3249,7 @@ function useReceiptCache() {
|
|
|
3233
3249
|
return false;
|
|
3234
3250
|
}
|
|
3235
3251
|
})();
|
|
3236
|
-
(0,
|
|
3252
|
+
(0, import_react42.useEffect)(() => {
|
|
3237
3253
|
if (isLocalStorageAvailable) {
|
|
3238
3254
|
try {
|
|
3239
3255
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -3252,7 +3268,7 @@ function useReceiptCache() {
|
|
|
3252
3268
|
}
|
|
3253
3269
|
}
|
|
3254
3270
|
}, []);
|
|
3255
|
-
const updateLocalStorage = (0,
|
|
3271
|
+
const updateLocalStorage = (0, import_react42.useCallback)((updatedCache) => {
|
|
3256
3272
|
if (isLocalStorageAvailable) {
|
|
3257
3273
|
try {
|
|
3258
3274
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -3269,7 +3285,7 @@ function useReceiptCache() {
|
|
|
3269
3285
|
}
|
|
3270
3286
|
}
|
|
3271
3287
|
}, []);
|
|
3272
|
-
const set = (0,
|
|
3288
|
+
const set = (0, import_react42.useCallback)((key, value) => {
|
|
3273
3289
|
const now = Date.now();
|
|
3274
3290
|
const newCache = new Map(cache);
|
|
3275
3291
|
newCache.forEach((entry, k) => {
|
|
@@ -3287,7 +3303,7 @@ function useReceiptCache() {
|
|
|
3287
3303
|
setCache(newCache);
|
|
3288
3304
|
updateLocalStorage(newCache);
|
|
3289
3305
|
}, [cache, updateLocalStorage]);
|
|
3290
|
-
const get = (0,
|
|
3306
|
+
const get = (0, import_react42.useCallback)((key) => {
|
|
3291
3307
|
const entry = cache.get(key);
|
|
3292
3308
|
if (entry) {
|
|
3293
3309
|
if (Date.now() - entry.timestamp > CACHE_TTL) {
|
|
@@ -3301,7 +3317,7 @@ function useReceiptCache() {
|
|
|
3301
3317
|
}
|
|
3302
3318
|
return void 0;
|
|
3303
3319
|
}, [cache, updateLocalStorage]);
|
|
3304
|
-
const del = (0,
|
|
3320
|
+
const del = (0, import_react42.useCallback)((key) => {
|
|
3305
3321
|
if (cache.has(key)) {
|
|
3306
3322
|
const newCache = new Map(cache);
|
|
3307
3323
|
newCache.delete(key);
|
|
@@ -3309,7 +3325,7 @@ function useReceiptCache() {
|
|
|
3309
3325
|
updateLocalStorage(newCache);
|
|
3310
3326
|
}
|
|
3311
3327
|
}, [cache, updateLocalStorage]);
|
|
3312
|
-
const clear = (0,
|
|
3328
|
+
const clear = (0, import_react42.useCallback)(() => {
|
|
3313
3329
|
setCache(/* @__PURE__ */ new Map());
|
|
3314
3330
|
if (isLocalStorageAvailable) {
|
|
3315
3331
|
localStorage.removeItem(STORAGE_KEY);
|
|
@@ -3324,7 +3340,7 @@ function useReceipt2({
|
|
|
3324
3340
|
const { list } = useMatchChain();
|
|
3325
3341
|
const cache = useReceiptCache();
|
|
3326
3342
|
const chain = list?.find((item) => item.id === chainId);
|
|
3327
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
3343
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react42.useState)(true);
|
|
3328
3344
|
const query = (0, import_react_query12.useQuery)({
|
|
3329
3345
|
queryKey: ["match-tx-receipt", hash, chain],
|
|
3330
3346
|
queryFn: async () => {
|
|
@@ -3350,7 +3366,7 @@ function useReceipt2({
|
|
|
3350
3366
|
},
|
|
3351
3367
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
3352
3368
|
});
|
|
3353
|
-
(0,
|
|
3369
|
+
(0, import_react42.useEffect)(() => {
|
|
3354
3370
|
if (query.data) {
|
|
3355
3371
|
setShouldRefetch(false);
|
|
3356
3372
|
}
|
|
@@ -3359,14 +3375,14 @@ function useReceipt2({
|
|
|
3359
3375
|
}
|
|
3360
3376
|
|
|
3361
3377
|
// src/hooks/useTransaction.tsx
|
|
3362
|
-
var
|
|
3378
|
+
var import_react43 = require("react");
|
|
3363
3379
|
var import_react_query13 = require("@tanstack/react-query");
|
|
3364
3380
|
var import_viem15 = require("viem");
|
|
3365
3381
|
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
3366
3382
|
var MAX_CACHE_SIZE2 = 500;
|
|
3367
3383
|
var STORAGE_KEY2 = "match_transaction_logs";
|
|
3368
3384
|
function useTransactionCache() {
|
|
3369
|
-
const [cache, setCache] = (0,
|
|
3385
|
+
const [cache, setCache] = (0, import_react43.useState)(/* @__PURE__ */ new Map());
|
|
3370
3386
|
const isLocalStorageAvailable = (() => {
|
|
3371
3387
|
try {
|
|
3372
3388
|
const testKey = "__test__";
|
|
@@ -3377,7 +3393,7 @@ function useTransactionCache() {
|
|
|
3377
3393
|
return false;
|
|
3378
3394
|
}
|
|
3379
3395
|
})();
|
|
3380
|
-
(0,
|
|
3396
|
+
(0, import_react43.useEffect)(() => {
|
|
3381
3397
|
if (isLocalStorageAvailable) {
|
|
3382
3398
|
try {
|
|
3383
3399
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -3396,7 +3412,7 @@ function useTransactionCache() {
|
|
|
3396
3412
|
}
|
|
3397
3413
|
}
|
|
3398
3414
|
}, []);
|
|
3399
|
-
const updateLocalStorage = (0,
|
|
3415
|
+
const updateLocalStorage = (0, import_react43.useCallback)((updatedCache) => {
|
|
3400
3416
|
if (isLocalStorageAvailable) {
|
|
3401
3417
|
try {
|
|
3402
3418
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -3413,7 +3429,7 @@ function useTransactionCache() {
|
|
|
3413
3429
|
}
|
|
3414
3430
|
}
|
|
3415
3431
|
}, []);
|
|
3416
|
-
const set = (0,
|
|
3432
|
+
const set = (0, import_react43.useCallback)((key, value) => {
|
|
3417
3433
|
const now = Date.now();
|
|
3418
3434
|
const newCache = new Map(cache);
|
|
3419
3435
|
newCache.forEach((entry, k) => {
|
|
@@ -3431,7 +3447,7 @@ function useTransactionCache() {
|
|
|
3431
3447
|
setCache(newCache);
|
|
3432
3448
|
updateLocalStorage(newCache);
|
|
3433
3449
|
}, [cache, updateLocalStorage]);
|
|
3434
|
-
const get = (0,
|
|
3450
|
+
const get = (0, import_react43.useCallback)((key) => {
|
|
3435
3451
|
const entry = cache.get(key);
|
|
3436
3452
|
if (entry) {
|
|
3437
3453
|
if (Date.now() - entry.timestamp > CACHE_TTL2) {
|
|
@@ -3445,7 +3461,7 @@ function useTransactionCache() {
|
|
|
3445
3461
|
}
|
|
3446
3462
|
return void 0;
|
|
3447
3463
|
}, [cache, updateLocalStorage]);
|
|
3448
|
-
const del = (0,
|
|
3464
|
+
const del = (0, import_react43.useCallback)((key) => {
|
|
3449
3465
|
if (cache.has(key)) {
|
|
3450
3466
|
const newCache = new Map(cache);
|
|
3451
3467
|
newCache.delete(key);
|
|
@@ -3453,7 +3469,7 @@ function useTransactionCache() {
|
|
|
3453
3469
|
updateLocalStorage(newCache);
|
|
3454
3470
|
}
|
|
3455
3471
|
}, [cache, updateLocalStorage]);
|
|
3456
|
-
const clear = (0,
|
|
3472
|
+
const clear = (0, import_react43.useCallback)(() => {
|
|
3457
3473
|
setCache(/* @__PURE__ */ new Map());
|
|
3458
3474
|
if (isLocalStorageAvailable) {
|
|
3459
3475
|
localStorage.removeItem(STORAGE_KEY2);
|
|
@@ -3468,7 +3484,7 @@ function useTransaction({
|
|
|
3468
3484
|
const { list } = useMatchChain();
|
|
3469
3485
|
const cache = useTransactionCache();
|
|
3470
3486
|
const chain = list?.find((item) => item.id === chainId);
|
|
3471
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
3487
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react43.useState)(true);
|
|
3472
3488
|
const query = (0, import_react_query13.useQuery)({
|
|
3473
3489
|
queryKey: ["match-tx-transaction", hash, chain],
|
|
3474
3490
|
queryFn: async () => {
|
|
@@ -3494,7 +3510,7 @@ function useTransaction({
|
|
|
3494
3510
|
},
|
|
3495
3511
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
3496
3512
|
});
|
|
3497
|
-
(0,
|
|
3513
|
+
(0, import_react43.useEffect)(() => {
|
|
3498
3514
|
if (query.data) {
|
|
3499
3515
|
setShouldRefetch(false);
|
|
3500
3516
|
}
|