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