@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
|
@@ -107,7 +107,7 @@ __export(components_exports, {
|
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
// src/components/EmailModal/index.tsx
|
|
110
|
-
import { useEffect as
|
|
110
|
+
import { useEffect as useEffect19, useState as useState19 } from "react";
|
|
111
111
|
|
|
112
112
|
// src/ui/Modal/index.tsx
|
|
113
113
|
import { useEffect as useEffect3, useState as useState2 } from "react";
|
|
@@ -943,11 +943,11 @@ var useStore_default = useStore;
|
|
|
943
943
|
// src/hooks/useWallet.tsx
|
|
944
944
|
import { toAccount } from "viem/accounts";
|
|
945
945
|
import { createWalletClient } from "viem";
|
|
946
|
-
import { useEffect as
|
|
946
|
+
import { useEffect as useEffect7, useMemo as useMemo3 } from "react";
|
|
947
947
|
import { encodeDeployData } from "viem";
|
|
948
948
|
|
|
949
949
|
// src/context/ModalContext.tsx
|
|
950
|
-
import React3, { useState as
|
|
950
|
+
import React3, { useState as useState7, useCallback, createContext, useContext } from "react";
|
|
951
951
|
import { createPortal } from "react-dom";
|
|
952
952
|
|
|
953
953
|
// src/ui/index.ts
|
|
@@ -960,7 +960,7 @@ __export(ui_exports, {
|
|
|
960
960
|
Field: () => Field,
|
|
961
961
|
HashPanel: () => HashPanel_default,
|
|
962
962
|
Input: () => Input,
|
|
963
|
-
Lottie: () =>
|
|
963
|
+
Lottie: () => Lottie,
|
|
964
964
|
Modal: () => Modal,
|
|
965
965
|
ModalDrawer: () => ModalDrawer,
|
|
966
966
|
ModalWithHeader: () => ModalWithHeader,
|
|
@@ -1141,7 +1141,7 @@ function HashPanel({
|
|
|
1141
1141
|
/* @__PURE__ */ jsx9("div", { className: `matchid-hashpanel-status`, style: {
|
|
1142
1142
|
color: statusValue.color
|
|
1143
1143
|
}, children: statusValue.text }),
|
|
1144
|
-
statusValue.lottie ? /* @__PURE__ */ jsx9(
|
|
1144
|
+
statusValue.lottie ? /* @__PURE__ */ jsx9(Lottie, { animationData: statusValue.lottie, style: {
|
|
1145
1145
|
width: "96px",
|
|
1146
1146
|
height: "96px"
|
|
1147
1147
|
} }) : /* @__PURE__ */ jsx9("img", { src: statusValue.icon, alt: statusValue.text, className: `matchid-hashpanel-img` }),
|
|
@@ -1298,25 +1298,18 @@ function Tabs(props) {
|
|
|
1298
1298
|
}
|
|
1299
1299
|
|
|
1300
1300
|
// src/ui/Lottie/index.tsx
|
|
1301
|
-
import
|
|
1301
|
+
import * as LottieReact from "lottie-react";
|
|
1302
1302
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1303
|
-
var
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
setLottieReact(mod.default || mod);
|
|
1308
|
-
});
|
|
1309
|
-
}, []);
|
|
1310
|
-
if (!LottieReact) return /* @__PURE__ */ jsx16("div", { children: "Loading..." });
|
|
1311
|
-
return /* @__PURE__ */ jsx16(LottieReact, { loop: true, autoplay: true, ...props });
|
|
1312
|
-
};
|
|
1313
|
-
var Lottie_default = LazyLottie;
|
|
1303
|
+
var FixedLottie = LottieReact.default || LottieReact;
|
|
1304
|
+
function Lottie(props) {
|
|
1305
|
+
return /* @__PURE__ */ jsx16(FixedLottie, { loop: true, autoplay: true, ...props });
|
|
1306
|
+
}
|
|
1314
1307
|
|
|
1315
1308
|
// src/context/ModalContext.tsx
|
|
1316
1309
|
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1317
1310
|
var ModalContext = createContext(null);
|
|
1318
1311
|
function ModalProvider({ children }) {
|
|
1319
|
-
const [modalState, setModalState] =
|
|
1312
|
+
const [modalState, setModalState] = useState7({
|
|
1320
1313
|
modals: [],
|
|
1321
1314
|
highestZIndex: 100
|
|
1322
1315
|
});
|
|
@@ -1501,7 +1494,7 @@ function useWallet() {
|
|
|
1501
1494
|
return void 0;
|
|
1502
1495
|
}
|
|
1503
1496
|
}, [address]);
|
|
1504
|
-
|
|
1497
|
+
useEffect7(() => {
|
|
1505
1498
|
matchlog_default.log("qwe-evmAccount", evmAccount);
|
|
1506
1499
|
}, [evmAccount]);
|
|
1507
1500
|
const realCreateWalletClient = (parameters) => {
|
|
@@ -1644,14 +1637,14 @@ function useWallet() {
|
|
|
1644
1637
|
|
|
1645
1638
|
// src/hooks/useCopyClipboard.ts
|
|
1646
1639
|
import copy from "copy-to-clipboard";
|
|
1647
|
-
import { useCallback as useCallback2, useEffect as
|
|
1640
|
+
import { useCallback as useCallback2, useEffect as useEffect8, useState as useState9 } from "react";
|
|
1648
1641
|
function useCopyClipboard(timeout = 500) {
|
|
1649
|
-
const [isCopied, setIsCopied] =
|
|
1642
|
+
const [isCopied, setIsCopied] = useState9(false);
|
|
1650
1643
|
const staticCopy = useCallback2((text) => {
|
|
1651
1644
|
const didCopy = copy(text);
|
|
1652
1645
|
setIsCopied(didCopy);
|
|
1653
1646
|
}, []);
|
|
1654
|
-
|
|
1647
|
+
useEffect8(() => {
|
|
1655
1648
|
if (isCopied) {
|
|
1656
1649
|
const hide = setTimeout(() => {
|
|
1657
1650
|
setIsCopied(false);
|
|
@@ -1666,12 +1659,12 @@ function useCopyClipboard(timeout = 500) {
|
|
|
1666
1659
|
}
|
|
1667
1660
|
|
|
1668
1661
|
// src/context/ToastContext.tsx
|
|
1669
|
-
import { useState as
|
|
1662
|
+
import { useState as useState10, useCallback as useCallback3, createContext as createContext2, useContext as useContext2 } from "react";
|
|
1670
1663
|
import { createPortal as createPortal2 } from "react-dom";
|
|
1671
1664
|
import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1672
1665
|
var ToastContext = createContext2(null);
|
|
1673
1666
|
function ToastProvider({ children, zIndex = 299 }) {
|
|
1674
|
-
const [toasts, setToasts] =
|
|
1667
|
+
const [toasts, setToasts] = useState10([]);
|
|
1675
1668
|
const removeToast = useCallback3((id) => {
|
|
1676
1669
|
setToasts((prev) => prev.filter((toast) => toast.id !== id));
|
|
1677
1670
|
}, []);
|
|
@@ -1844,7 +1837,7 @@ function useWalletAssetListQuery({
|
|
|
1844
1837
|
}
|
|
1845
1838
|
|
|
1846
1839
|
// src/hooks/useMatchChain.tsx
|
|
1847
|
-
import { useMemo as useMemo4, useState as
|
|
1840
|
+
import { useMemo as useMemo4, useState as useState11 } from "react";
|
|
1848
1841
|
import { createPublicClient as createPublicClient3, formatUnits, http as http3, parseUnits } from "viem";
|
|
1849
1842
|
import { FormattedMessage as FormattedMessage2, useIntl as useIntl3 } from "react-intl";
|
|
1850
1843
|
import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
@@ -1876,7 +1869,7 @@ function useMatchChain() {
|
|
|
1876
1869
|
close
|
|
1877
1870
|
}) {
|
|
1878
1871
|
const { chainId: storeChainId2, setChainId: setChainId2 } = useLocalStore_default();
|
|
1879
|
-
const [selectedChainId, setSelectedChainId] =
|
|
1872
|
+
const [selectedChainId, setSelectedChainId] = useState11(storeChainId2);
|
|
1880
1873
|
const isDownMd = useDownMd();
|
|
1881
1874
|
return /* @__PURE__ */ jsxs10("div", { className: `matchid-change-network-box`, children: [
|
|
1882
1875
|
/* @__PURE__ */ jsx20("div", { className: `matchid-change-network-list`, children: chainListQuery.data?.map((item, index) => {
|
|
@@ -1936,7 +1929,7 @@ function useMatchChain() {
|
|
|
1936
1929
|
|
|
1937
1930
|
// src/hooks/useMatchWallet.tsx
|
|
1938
1931
|
import { QRCode } from "react-qrcode";
|
|
1939
|
-
import { useEffect as
|
|
1932
|
+
import { useEffect as useEffect11, useMemo as useMemo6, useRef, useState as useState13 } from "react";
|
|
1940
1933
|
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
1941
1934
|
|
|
1942
1935
|
// src/config/index.tsx
|
|
@@ -2007,7 +2000,7 @@ var useContractStore_default = useContractStore;
|
|
|
2007
2000
|
import { FormattedMessage as FormattedMessage4, useIntl as useIntl5 } from "react-intl";
|
|
2008
2001
|
|
|
2009
2002
|
// src/components/ImportToken/index.tsx
|
|
2010
|
-
import { useEffect as
|
|
2003
|
+
import { useEffect as useEffect10, useMemo as useMemo5, useState as useState12 } from "react";
|
|
2011
2004
|
import { FormattedMessage as FormattedMessage3, useIntl as useIntl4 } from "react-intl";
|
|
2012
2005
|
import { useQueryClient } from "@tanstack/react-query";
|
|
2013
2006
|
import { defineChain, erc20Abi } from "viem";
|
|
@@ -2039,12 +2032,12 @@ function useIsContract({
|
|
|
2039
2032
|
// src/components/ImportToken/index.tsx
|
|
2040
2033
|
import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2041
2034
|
function ImportToken({ close }) {
|
|
2042
|
-
const [status, setStatus] =
|
|
2035
|
+
const [status, setStatus] = useState12("");
|
|
2043
2036
|
const { token } = useUserInfo();
|
|
2044
|
-
const [address, setAddress] =
|
|
2045
|
-
const [symbol, setSymbol] =
|
|
2046
|
-
const [decimals, setDecimals] =
|
|
2047
|
-
const [error, setError] =
|
|
2037
|
+
const [address, setAddress] = useState12("");
|
|
2038
|
+
const [symbol, setSymbol] = useState12("");
|
|
2039
|
+
const [decimals, setDecimals] = useState12("");
|
|
2040
|
+
const [error, setError] = useState12({});
|
|
2048
2041
|
const { publicClient, chainId, chain } = useMatchChain();
|
|
2049
2042
|
const getContractInfo = async () => {
|
|
2050
2043
|
if (!publicClient) return;
|
|
@@ -2078,7 +2071,7 @@ function ImportToken({ close }) {
|
|
|
2078
2071
|
}
|
|
2079
2072
|
};
|
|
2080
2073
|
const intl = useIntl4();
|
|
2081
|
-
|
|
2074
|
+
useEffect10(() => {
|
|
2082
2075
|
if (address.length === 42) {
|
|
2083
2076
|
const reg = /^0x[0-9a-fA-F]{40}$/;
|
|
2084
2077
|
if (!reg.test(address)) {
|
|
@@ -2097,7 +2090,7 @@ function ImportToken({ close }) {
|
|
|
2097
2090
|
}
|
|
2098
2091
|
}
|
|
2099
2092
|
}, [address, publicClient]);
|
|
2100
|
-
const [loading, setLoading] =
|
|
2093
|
+
const [loading, setLoading] = useState12(false);
|
|
2101
2094
|
const toast = useToast();
|
|
2102
2095
|
const queryClient2 = useQueryClient();
|
|
2103
2096
|
const onImport = async () => {
|
|
@@ -2150,7 +2143,7 @@ function ImportToken({ close }) {
|
|
|
2150
2143
|
if (status == "success" || status == "fail") {
|
|
2151
2144
|
return /* @__PURE__ */ jsxs11("div", { className: `matchid-import-token-result matchid-flex`, children: [
|
|
2152
2145
|
/* @__PURE__ */ jsxs11("div", { className: `matchid-import-token-result-box matchid-flex`, children: [
|
|
2153
|
-
/* @__PURE__ */ jsx21("div", { className: `matchid-import-token-result-img`, children: /* @__PURE__ */ jsx21(
|
|
2146
|
+
/* @__PURE__ */ jsx21("div", { className: `matchid-import-token-result-img`, children: /* @__PURE__ */ jsx21(Lottie, { animationData: status == "success" ? success_default : fail_default, style: {
|
|
2154
2147
|
width: "96px",
|
|
2155
2148
|
height: "96px"
|
|
2156
2149
|
} }) }),
|
|
@@ -2294,8 +2287,8 @@ function useMatchWallet() {
|
|
|
2294
2287
|
};
|
|
2295
2288
|
}
|
|
2296
2289
|
function useMatchWalletRecords() {
|
|
2297
|
-
const [hasMore, setHasMore] =
|
|
2298
|
-
const [items, setItems] =
|
|
2290
|
+
const [hasMore, setHasMore] = useState13(true);
|
|
2291
|
+
const [items, setItems] = useState13([]);
|
|
2299
2292
|
const { chainId, publicClient } = useMatchChain();
|
|
2300
2293
|
const { address } = useWallet();
|
|
2301
2294
|
const hasMoreRef = useRef(hasMore);
|
|
@@ -2326,7 +2319,7 @@ function useMatchWalletRecords() {
|
|
|
2326
2319
|
hasMoreRef.current = true;
|
|
2327
2320
|
fetchMoreData();
|
|
2328
2321
|
};
|
|
2329
|
-
|
|
2322
|
+
useEffect11(() => {
|
|
2330
2323
|
if (chainId && address) {
|
|
2331
2324
|
onInit();
|
|
2332
2325
|
}
|
|
@@ -2561,7 +2554,7 @@ function useMatchWalletAssetList({
|
|
|
2561
2554
|
return { ...asset, balance, value, balanceValue };
|
|
2562
2555
|
});
|
|
2563
2556
|
}, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
|
|
2564
|
-
|
|
2557
|
+
useEffect11(() => {
|
|
2565
2558
|
const list2 = enrichedAssets.sort((a, b) => {
|
|
2566
2559
|
if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
|
|
2567
2560
|
if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
|
|
@@ -2586,14 +2579,14 @@ function useMatchWalletAssetList({
|
|
|
2586
2579
|
}
|
|
2587
2580
|
|
|
2588
2581
|
// src/hooks/useReceipt.tsx
|
|
2589
|
-
import { useState as
|
|
2582
|
+
import { useState as useState14, useCallback as useCallback4, useEffect as useEffect12 } from "react";
|
|
2590
2583
|
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
2591
2584
|
import { createPublicClient as createPublicClient5, defineChain as defineChain2, http as http5 } from "viem";
|
|
2592
2585
|
var CACHE_TTL = 86400 * 30 * 1e3;
|
|
2593
2586
|
var MAX_CACHE_SIZE = 500;
|
|
2594
2587
|
var STORAGE_KEY = "match_receipt_logs";
|
|
2595
2588
|
function useReceiptCache() {
|
|
2596
|
-
const [cache, setCache] =
|
|
2589
|
+
const [cache, setCache] = useState14(/* @__PURE__ */ new Map());
|
|
2597
2590
|
const isLocalStorageAvailable = (() => {
|
|
2598
2591
|
try {
|
|
2599
2592
|
const testKey = "__test__";
|
|
@@ -2604,7 +2597,7 @@ function useReceiptCache() {
|
|
|
2604
2597
|
return false;
|
|
2605
2598
|
}
|
|
2606
2599
|
})();
|
|
2607
|
-
|
|
2600
|
+
useEffect12(() => {
|
|
2608
2601
|
if (isLocalStorageAvailable) {
|
|
2609
2602
|
try {
|
|
2610
2603
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -2695,7 +2688,7 @@ function useReceipt({
|
|
|
2695
2688
|
const { list } = useMatchChain();
|
|
2696
2689
|
const cache = useReceiptCache();
|
|
2697
2690
|
const chain = list?.find((item) => item.id === chainId);
|
|
2698
|
-
const [shouldRefetch, setShouldRefetch] =
|
|
2691
|
+
const [shouldRefetch, setShouldRefetch] = useState14(true);
|
|
2699
2692
|
const query = useQuery5({
|
|
2700
2693
|
queryKey: ["match-tx-receipt", hash, chain],
|
|
2701
2694
|
queryFn: async () => {
|
|
@@ -2721,7 +2714,7 @@ function useReceipt({
|
|
|
2721
2714
|
},
|
|
2722
2715
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
2723
2716
|
});
|
|
2724
|
-
|
|
2717
|
+
useEffect12(() => {
|
|
2725
2718
|
if (query.data) {
|
|
2726
2719
|
setShouldRefetch(false);
|
|
2727
2720
|
}
|
|
@@ -2730,14 +2723,14 @@ function useReceipt({
|
|
|
2730
2723
|
}
|
|
2731
2724
|
|
|
2732
2725
|
// src/hooks/useTransaction.tsx
|
|
2733
|
-
import { useState as
|
|
2726
|
+
import { useState as useState15, useCallback as useCallback5, useEffect as useEffect13 } from "react";
|
|
2734
2727
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
2735
2728
|
import { createPublicClient as createPublicClient6, defineChain as defineChain3, http as http6 } from "viem";
|
|
2736
2729
|
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
2737
2730
|
var MAX_CACHE_SIZE2 = 500;
|
|
2738
2731
|
var STORAGE_KEY2 = "match_transaction_logs";
|
|
2739
2732
|
function useTransactionCache() {
|
|
2740
|
-
const [cache, setCache] =
|
|
2733
|
+
const [cache, setCache] = useState15(/* @__PURE__ */ new Map());
|
|
2741
2734
|
const isLocalStorageAvailable = (() => {
|
|
2742
2735
|
try {
|
|
2743
2736
|
const testKey = "__test__";
|
|
@@ -2748,7 +2741,7 @@ function useTransactionCache() {
|
|
|
2748
2741
|
return false;
|
|
2749
2742
|
}
|
|
2750
2743
|
})();
|
|
2751
|
-
|
|
2744
|
+
useEffect13(() => {
|
|
2752
2745
|
if (isLocalStorageAvailable) {
|
|
2753
2746
|
try {
|
|
2754
2747
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -2839,7 +2832,7 @@ function useTransaction({
|
|
|
2839
2832
|
const { list } = useMatchChain();
|
|
2840
2833
|
const cache = useTransactionCache();
|
|
2841
2834
|
const chain = list?.find((item) => item.id === chainId);
|
|
2842
|
-
const [shouldRefetch, setShouldRefetch] =
|
|
2835
|
+
const [shouldRefetch, setShouldRefetch] = useState15(true);
|
|
2843
2836
|
const query = useQuery6({
|
|
2844
2837
|
queryKey: ["match-tx-transaction", hash, chain],
|
|
2845
2838
|
queryFn: async () => {
|
|
@@ -2865,7 +2858,7 @@ function useTransaction({
|
|
|
2865
2858
|
},
|
|
2866
2859
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
2867
2860
|
});
|
|
2868
|
-
|
|
2861
|
+
useEffect13(() => {
|
|
2869
2862
|
if (query.data) {
|
|
2870
2863
|
setShouldRefetch(false);
|
|
2871
2864
|
}
|
|
@@ -2959,7 +2952,7 @@ var useWalletModalStore = create5((set) => ({
|
|
|
2959
2952
|
}));
|
|
2960
2953
|
|
|
2961
2954
|
// src/components/CEXBindModal/index.tsx
|
|
2962
|
-
import { useEffect as
|
|
2955
|
+
import { useEffect as useEffect14, useMemo as useMemo7, useState as useState16 } from "react";
|
|
2963
2956
|
import { FormattedMessage as FormattedMessage5, useIntl as useIntl6 } from "react-intl";
|
|
2964
2957
|
import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2965
2958
|
function CEXBindModal({
|
|
@@ -2970,16 +2963,16 @@ function CEXBindModal({
|
|
|
2970
2963
|
}) {
|
|
2971
2964
|
const intl = useIntl6();
|
|
2972
2965
|
const { events } = useMatch();
|
|
2973
|
-
const [APIPassphrase, setAPIPassphrase] =
|
|
2966
|
+
const [APIPassphrase, setAPIPassphrase] = useState16("");
|
|
2974
2967
|
const { refreshOverview } = useUserInfo();
|
|
2975
|
-
const [loading, setLoading] =
|
|
2976
|
-
const [key, setKey] =
|
|
2977
|
-
const [secret, setSecret] =
|
|
2978
|
-
const [error, setError] =
|
|
2968
|
+
const [loading, setLoading] = useState16(false);
|
|
2969
|
+
const [key, setKey] = useState16("");
|
|
2970
|
+
const [secret, setSecret] = useState16("");
|
|
2971
|
+
const [error, setError] = useState16("");
|
|
2979
2972
|
const needPassphrase = useMemo7(() => {
|
|
2980
2973
|
return ["bitget", "okx"].includes(type.toLowerCase());
|
|
2981
2974
|
}, [type]);
|
|
2982
|
-
|
|
2975
|
+
useEffect14(() => {
|
|
2983
2976
|
if (isOpen) {
|
|
2984
2977
|
setSecret("");
|
|
2985
2978
|
setKey("");
|
|
@@ -3179,7 +3172,7 @@ var Providers = ({ children }) => {
|
|
|
3179
3172
|
var context_default = Providers;
|
|
3180
3173
|
|
|
3181
3174
|
// src/hooks/useWalletInit.ts
|
|
3182
|
-
import { useEffect as
|
|
3175
|
+
import { useEffect as useEffect15, useRef as useRef2 } from "react";
|
|
3183
3176
|
|
|
3184
3177
|
// src/utils/wallet.ts
|
|
3185
3178
|
var sendMessage = ({ method, data, resolve, reject, timeout }) => {
|
|
@@ -3213,10 +3206,10 @@ function useWalletInit({
|
|
|
3213
3206
|
const { endpoints, token, setWallet, appid, refreshOverview } = useLocalStore_default();
|
|
3214
3207
|
const { setWalletReady, walletReady } = useStore_default();
|
|
3215
3208
|
const iframeReadyRef = useRef2(walletReady);
|
|
3216
|
-
|
|
3209
|
+
useEffect15(() => {
|
|
3217
3210
|
setWallet(config);
|
|
3218
3211
|
}, [config]);
|
|
3219
|
-
|
|
3212
|
+
useEffect15(() => {
|
|
3220
3213
|
matchlog_default.log("sdk.mpc.status", walletReady, iframeReadyRef.current);
|
|
3221
3214
|
iframeReadyRef.current = walletReady;
|
|
3222
3215
|
if (iframeReadyRef.current) {
|
|
@@ -3233,7 +3226,7 @@ function useWalletInit({
|
|
|
3233
3226
|
onReady();
|
|
3234
3227
|
}
|
|
3235
3228
|
}, [walletReady]);
|
|
3236
|
-
|
|
3229
|
+
useEffect15(() => {
|
|
3237
3230
|
if (!endpoints.auth || !appid || !token || !config) {
|
|
3238
3231
|
const existingIframe = getWalletIframe();
|
|
3239
3232
|
if (existingIframe) {
|
|
@@ -3333,7 +3326,7 @@ function useWalletInit({
|
|
|
3333
3326
|
}
|
|
3334
3327
|
}
|
|
3335
3328
|
}, [endpoints.auth, appid, token, config]);
|
|
3336
|
-
|
|
3329
|
+
useEffect15(() => {
|
|
3337
3330
|
const messageHandle = async (e) => {
|
|
3338
3331
|
if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
|
|
3339
3332
|
return;
|
|
@@ -3414,7 +3407,7 @@ function useWalletInit({
|
|
|
3414
3407
|
}
|
|
3415
3408
|
|
|
3416
3409
|
// src/hooks/useInit.tsx
|
|
3417
|
-
import { useEffect as
|
|
3410
|
+
import { useEffect as useEffect16, useRef as useRef3 } from "react";
|
|
3418
3411
|
function useInit({
|
|
3419
3412
|
theme,
|
|
3420
3413
|
appid,
|
|
@@ -3439,19 +3432,19 @@ function useInit({
|
|
|
3439
3432
|
const matchToken = searchParams.get("matchToken");
|
|
3440
3433
|
const matchidt = searchParams.get("matchidt");
|
|
3441
3434
|
const realEndpoints = endpoints || env_default.endpoints;
|
|
3442
|
-
|
|
3435
|
+
useEffect16(() => {
|
|
3443
3436
|
setTheme(theme);
|
|
3444
3437
|
}, [theme]);
|
|
3445
|
-
|
|
3438
|
+
useEffect16(() => {
|
|
3446
3439
|
setAppid(appid);
|
|
3447
3440
|
}, [appid]);
|
|
3448
|
-
|
|
3441
|
+
useEffect16(() => {
|
|
3449
3442
|
setEndpoints(realEndpoints);
|
|
3450
3443
|
}, [realEndpoints]);
|
|
3451
|
-
|
|
3444
|
+
useEffect16(() => {
|
|
3452
3445
|
setLocale(locale || "en");
|
|
3453
3446
|
}, [locale]);
|
|
3454
|
-
|
|
3447
|
+
useEffect16(() => {
|
|
3455
3448
|
if (matchToken) {
|
|
3456
3449
|
const tokenData = JSON.parse(atob(matchToken));
|
|
3457
3450
|
if (tokenData && tokenData.mid && tokenData.token) {
|
|
@@ -3462,7 +3455,7 @@ function useInit({
|
|
|
3462
3455
|
}
|
|
3463
3456
|
}
|
|
3464
3457
|
}, [matchToken]);
|
|
3465
|
-
|
|
3458
|
+
useEffect16(() => {
|
|
3466
3459
|
if (matchidt) {
|
|
3467
3460
|
const tokenData = decodeURIComponent(matchidt);
|
|
3468
3461
|
const data = JSON.parse(decodeBase64(tokenData));
|
|
@@ -3492,7 +3485,7 @@ function useInit({
|
|
|
3492
3485
|
}
|
|
3493
3486
|
}
|
|
3494
3487
|
}, [matchidt]);
|
|
3495
|
-
|
|
3488
|
+
useEffect16(() => {
|
|
3496
3489
|
const onLoginMessage = (event) => {
|
|
3497
3490
|
const res = event.data;
|
|
3498
3491
|
if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
|
|
@@ -3529,7 +3522,7 @@ function useInit({
|
|
|
3529
3522
|
overviewLoadingRef.current = false;
|
|
3530
3523
|
}
|
|
3531
3524
|
};
|
|
3532
|
-
|
|
3525
|
+
useEffect16(() => {
|
|
3533
3526
|
if (token) {
|
|
3534
3527
|
loadOverview();
|
|
3535
3528
|
}
|
|
@@ -4738,18 +4731,18 @@ function useUserInfo() {
|
|
|
4738
4731
|
}
|
|
4739
4732
|
|
|
4740
4733
|
// src/components/EmailModal/StepVerify.tsx
|
|
4741
|
-
import { useEffect as
|
|
4734
|
+
import { useEffect as useEffect18, useMemo as useMemo9, useRef as useRef4, useState as useState18 } from "react";
|
|
4742
4735
|
import { FormattedMessage as FormattedMessage6, useIntl as useIntl7 } from "react-intl";
|
|
4743
4736
|
import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4744
4737
|
function StepVerify(props) {
|
|
4745
4738
|
const intl = useIntl7();
|
|
4746
4739
|
const { getLoginEmailCode, loginByEmail } = useUserInfo();
|
|
4747
|
-
const [error, setError] =
|
|
4748
|
-
const [code, setCode] =
|
|
4749
|
-
const [sending, setSending] =
|
|
4750
|
-
const [submitting, setSubmitting] =
|
|
4740
|
+
const [error, setError] = useState18("");
|
|
4741
|
+
const [code, setCode] = useState18("");
|
|
4742
|
+
const [sending, setSending] = useState18(false);
|
|
4743
|
+
const [submitting, setSubmitting] = useState18(false);
|
|
4751
4744
|
const sendTimeRef = useRef4(0);
|
|
4752
|
-
const [sendBtnText, setSendBtnText] =
|
|
4745
|
+
const [sendBtnText, setSendBtnText] = useState18(intl.formatMessage({
|
|
4753
4746
|
id: "send"
|
|
4754
4747
|
}));
|
|
4755
4748
|
const intervalTime = EMAIL_INTERVAL;
|
|
@@ -4785,7 +4778,7 @@ function StepVerify(props) {
|
|
|
4785
4778
|
setSending(false);
|
|
4786
4779
|
}
|
|
4787
4780
|
};
|
|
4788
|
-
|
|
4781
|
+
useEffect18(() => {
|
|
4789
4782
|
onSend();
|
|
4790
4783
|
return () => {
|
|
4791
4784
|
if (intervalRef.current) {
|
|
@@ -4870,10 +4863,10 @@ function EmailModal({
|
|
|
4870
4863
|
onBack,
|
|
4871
4864
|
onLogin
|
|
4872
4865
|
}) {
|
|
4873
|
-
const [step, setStep] =
|
|
4874
|
-
const [emailVal, setEmailVal] =
|
|
4866
|
+
const [step, setStep] = useState19("input");
|
|
4867
|
+
const [emailVal, setEmailVal] = useState19("");
|
|
4875
4868
|
const intl = useIntl8();
|
|
4876
|
-
|
|
4869
|
+
useEffect19(() => {
|
|
4877
4870
|
if (!isOpen) {
|
|
4878
4871
|
setStep("input");
|
|
4879
4872
|
setEmailVal("");
|
|
@@ -4898,7 +4891,7 @@ function EmailModal({
|
|
|
4898
4891
|
}
|
|
4899
4892
|
|
|
4900
4893
|
// src/components/LoginBox/index.tsx
|
|
4901
|
-
import { useMemo as useMemo10, useState as
|
|
4894
|
+
import { useMemo as useMemo10, useState as useState20 } from "react";
|
|
4902
4895
|
import { FormattedMessage as FormattedMessage7, useIntl as useIntl9 } from "react-intl";
|
|
4903
4896
|
|
|
4904
4897
|
// src/hooks/useAppConfig.ts
|
|
@@ -5011,9 +5004,9 @@ function LoginBox({
|
|
|
5011
5004
|
walletMethods: walletMethodList
|
|
5012
5005
|
};
|
|
5013
5006
|
}, [config.platform, recommendMethods, methods, walletMethods]);
|
|
5014
|
-
const [emailOpen, setEmailOpen] =
|
|
5007
|
+
const [emailOpen, setEmailOpen] = useState20(false);
|
|
5015
5008
|
const { login } = useUserInfo();
|
|
5016
|
-
const [showWallet, setShowWallet] =
|
|
5009
|
+
const [showWallet, setShowWallet] = useState20(false);
|
|
5017
5010
|
const intl = useIntl9();
|
|
5018
5011
|
const isDownMd = useDownMd();
|
|
5019
5012
|
const methodMap = {
|
|
@@ -5161,7 +5154,7 @@ function LoginBox({
|
|
|
5161
5154
|
}
|
|
5162
5155
|
|
|
5163
5156
|
// src/components/LoginButton/index.tsx
|
|
5164
|
-
import { useState as
|
|
5157
|
+
import { useState as useState22 } from "react";
|
|
5165
5158
|
|
|
5166
5159
|
// src/components/LoginPanel/index.tsx
|
|
5167
5160
|
import { FormattedMessage as FormattedMessage8 } from "react-intl";
|
|
@@ -5204,7 +5197,7 @@ function LoginModal({
|
|
|
5204
5197
|
}
|
|
5205
5198
|
|
|
5206
5199
|
// src/components/UserPopover/index.tsx
|
|
5207
|
-
import { useState as
|
|
5200
|
+
import { useState as useState21 } from "react";
|
|
5208
5201
|
|
|
5209
5202
|
// src/assets/icon/ProfileIcon.tsx
|
|
5210
5203
|
import { jsx as jsx33, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
@@ -5236,7 +5229,7 @@ import { FormattedMessage as FormattedMessage9, useIntl as useIntl10 } from "rea
|
|
|
5236
5229
|
import { jsx as jsx34, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5237
5230
|
function UserContent() {
|
|
5238
5231
|
const { logout, address, username } = useUserInfo();
|
|
5239
|
-
const [logouting, setLogouting] =
|
|
5232
|
+
const [logouting, setLogouting] = useState21(false);
|
|
5240
5233
|
const onLogout = async () => {
|
|
5241
5234
|
if (logouting) return;
|
|
5242
5235
|
try {
|
|
@@ -5265,7 +5258,7 @@ function UserContent() {
|
|
|
5265
5258
|
const UserDivider = () => {
|
|
5266
5259
|
return /* @__PURE__ */ jsx34("div", { className: `matchid-user-popover-divider` });
|
|
5267
5260
|
};
|
|
5268
|
-
const [usernameOpen, setUsernameOpen] =
|
|
5261
|
+
const [usernameOpen, setUsernameOpen] = useState21(false);
|
|
5269
5262
|
const [copied, setCopied] = useCopyClipboard();
|
|
5270
5263
|
const intl = useIntl10();
|
|
5271
5264
|
return /* @__PURE__ */ jsxs19("div", { className: "matchid-user-popover-content", children: [
|
|
@@ -5311,7 +5304,7 @@ function LoginButton({
|
|
|
5311
5304
|
}) {
|
|
5312
5305
|
const intl = useIntl11();
|
|
5313
5306
|
const { isLogin, username } = useUserInfo();
|
|
5314
|
-
const [loginOpen, setLoginOpen] =
|
|
5307
|
+
const [loginOpen, setLoginOpen] = useState22(false);
|
|
5315
5308
|
if (!isLogin) {
|
|
5316
5309
|
return /* @__PURE__ */ jsxs20(Fragment6, { children: [
|
|
5317
5310
|
/* @__PURE__ */ jsx35(
|
|
@@ -5339,7 +5332,7 @@ function LoginButton({
|
|
|
5339
5332
|
}
|
|
5340
5333
|
|
|
5341
5334
|
// src/components/UsernameModal/index.tsx
|
|
5342
|
-
import { useEffect as
|
|
5335
|
+
import { useEffect as useEffect20, useMemo as useMemo11, useState as useState23 } from "react";
|
|
5343
5336
|
import { FormattedMessage as FormattedMessage11, useIntl as useIntl12 } from "react-intl";
|
|
5344
5337
|
import { jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5345
5338
|
var ValidItem = ({
|
|
@@ -5360,10 +5353,10 @@ function UsernameModal({
|
|
|
5360
5353
|
}) {
|
|
5361
5354
|
const { username, refreshOverview } = useUserInfo();
|
|
5362
5355
|
const { isLogin } = useUserInfo();
|
|
5363
|
-
const [val, setVal] =
|
|
5364
|
-
const [error, setError] =
|
|
5356
|
+
const [val, setVal] = useState23(username);
|
|
5357
|
+
const [error, setError] = useState23("");
|
|
5365
5358
|
const isDownMd = useDownMd();
|
|
5366
|
-
|
|
5359
|
+
useEffect20(() => {
|
|
5367
5360
|
if (isOpen) {
|
|
5368
5361
|
setVal(username);
|
|
5369
5362
|
setError("");
|
|
@@ -5376,7 +5369,7 @@ function UsernameModal({
|
|
|
5376
5369
|
return val.length >= 2 && val.length <= 32;
|
|
5377
5370
|
}, [val]);
|
|
5378
5371
|
const isSafe = isValid && isLength;
|
|
5379
|
-
const [isSubmitting, setIsSubmitting] =
|
|
5372
|
+
const [isSubmitting, setIsSubmitting] = useState23(false);
|
|
5380
5373
|
const onSubmit = async () => {
|
|
5381
5374
|
if (isSubmitting) return;
|
|
5382
5375
|
try {
|
|
@@ -5439,11 +5432,11 @@ function UsernameModal({
|
|
|
5439
5432
|
}
|
|
5440
5433
|
|
|
5441
5434
|
// src/components/EVMModal/index.tsx
|
|
5442
|
-
import { useCallback as useCallback6, useEffect as
|
|
5435
|
+
import { useCallback as useCallback6, useEffect as useEffect22, useState as useState26 } from "react";
|
|
5443
5436
|
import { useIntl as useIntl13 } from "react-intl";
|
|
5444
5437
|
|
|
5445
5438
|
// src/components/WalletModalContent/index.tsx
|
|
5446
|
-
import { useMemo as useMemo12, useState as
|
|
5439
|
+
import { useMemo as useMemo12, useState as useState24 } from "react";
|
|
5447
5440
|
|
|
5448
5441
|
// src/assets/wallet.ts
|
|
5449
5442
|
var walletErrorImage = error_default;
|
|
@@ -5525,7 +5518,7 @@ function WalletModalContent({
|
|
|
5525
5518
|
}, [visible, connected, status, error, address]);
|
|
5526
5519
|
return /* @__PURE__ */ jsx37("div", { className: "matchid-wallet-container", children: /* @__PURE__ */ jsxs22("div", { className: `matchid-wallet-box`, children: [
|
|
5527
5520
|
/* @__PURE__ */ jsxs22("div", { className: `matchid-wallet-content`, children: [
|
|
5528
|
-
/* @__PURE__ */ jsx37(
|
|
5521
|
+
/* @__PURE__ */ jsx37(Lottie, { animationData: pageData.statusImage, style: {
|
|
5529
5522
|
width: 128,
|
|
5530
5523
|
height: 128
|
|
5531
5524
|
} }),
|
|
@@ -5545,7 +5538,7 @@ function WalletModalContent({
|
|
|
5545
5538
|
] }) });
|
|
5546
5539
|
}
|
|
5547
5540
|
function WalletModalContentV2(props) {
|
|
5548
|
-
const [submitting, setSubmitting] =
|
|
5541
|
+
const [submitting, setSubmitting] = useState24(false);
|
|
5549
5542
|
const pageData = useMemo12(() => {
|
|
5550
5543
|
const { status } = props;
|
|
5551
5544
|
if (status == "success") {
|
|
@@ -5609,7 +5602,7 @@ function WalletModalContentV2(props) {
|
|
|
5609
5602
|
}, [props, submitting]);
|
|
5610
5603
|
return /* @__PURE__ */ jsx37("div", { className: "matchid-wallet-container", children: /* @__PURE__ */ jsxs22("div", { className: `matchid-wallet-box`, children: [
|
|
5611
5604
|
/* @__PURE__ */ jsxs22("div", { className: `matchid-wallet-content`, children: [
|
|
5612
|
-
/* @__PURE__ */ jsx37(
|
|
5605
|
+
/* @__PURE__ */ jsx37(Lottie, { animationData: pageData.statusImage, style: {
|
|
5613
5606
|
width: 128,
|
|
5614
5607
|
height: 128
|
|
5615
5608
|
} }),
|
|
@@ -5634,14 +5627,14 @@ import { useConnectModal } from "@rainbow-me/rainbowkit";
|
|
|
5634
5627
|
import { useAccount, useChainId, useConfig, useDisconnect } from "wagmi";
|
|
5635
5628
|
|
|
5636
5629
|
// src/hooks/useWalletBox.ts
|
|
5637
|
-
import { useEffect as
|
|
5630
|
+
import { useEffect as useEffect21, useRef as useRef5, useState as useState25 } from "react";
|
|
5638
5631
|
function useWalletBox({
|
|
5639
5632
|
onInit
|
|
5640
5633
|
}) {
|
|
5641
|
-
const [status, setStateStatus] =
|
|
5642
|
-
const [error, setError] =
|
|
5634
|
+
const [status, setStateStatus] = useState25("start");
|
|
5635
|
+
const [error, setError] = useState25("");
|
|
5643
5636
|
const statusRef = useRef5(status);
|
|
5644
|
-
const [nonce, setNonce] =
|
|
5637
|
+
const [nonce, setNonce] = useState25();
|
|
5645
5638
|
const setStatus = (status2) => {
|
|
5646
5639
|
statusRef.current = status2;
|
|
5647
5640
|
setStateStatus(status2);
|
|
@@ -5650,7 +5643,7 @@ function useWalletBox({
|
|
|
5650
5643
|
setError("");
|
|
5651
5644
|
setNonce(null);
|
|
5652
5645
|
};
|
|
5653
|
-
|
|
5646
|
+
useEffect21(() => {
|
|
5654
5647
|
init();
|
|
5655
5648
|
onInit({
|
|
5656
5649
|
setStatus
|
|
@@ -5908,16 +5901,16 @@ function WalletContent({
|
|
|
5908
5901
|
const { disconnectAsync } = useDisconnect({ config });
|
|
5909
5902
|
const chainId = useChainId();
|
|
5910
5903
|
const { events, login } = useMatch();
|
|
5911
|
-
const [inited, setInited] =
|
|
5904
|
+
const [inited, setInited] = useState26(false);
|
|
5912
5905
|
const { status, setStatus, error, setError, statusRef, nonce, setNonce, init } = useWalletBox({
|
|
5913
5906
|
onInit: async ({ setStatus: setStatus2 }) => {
|
|
5914
5907
|
setStatus2("start");
|
|
5915
5908
|
}
|
|
5916
5909
|
});
|
|
5917
|
-
|
|
5910
|
+
useEffect22(() => {
|
|
5918
5911
|
matchlog_default.log(`status=${status}`, `connectModalOpen=${connectModalOpen}`, `address=${address}`, `isConnected=${isConnected}`);
|
|
5919
5912
|
}, [status, connectModalOpen, isConnected, address]);
|
|
5920
|
-
|
|
5913
|
+
useEffect22(() => {
|
|
5921
5914
|
if (connectModalOpen) {
|
|
5922
5915
|
setStatus("connecting");
|
|
5923
5916
|
return;
|
|
@@ -5930,7 +5923,7 @@ function WalletContent({
|
|
|
5930
5923
|
setStatus("start");
|
|
5931
5924
|
}
|
|
5932
5925
|
}, [connectModalOpen, address]);
|
|
5933
|
-
|
|
5926
|
+
useEffect22(() => {
|
|
5934
5927
|
if (openConnectModal && !isConnected && !inited) {
|
|
5935
5928
|
openConnectModal && openConnectModal();
|
|
5936
5929
|
setInited(true);
|
|
@@ -6013,7 +6006,7 @@ function WalletContent({
|
|
|
6013
6006
|
setError(error2.reason || error2.message);
|
|
6014
6007
|
}
|
|
6015
6008
|
}, [nonce, status, address]);
|
|
6016
|
-
|
|
6009
|
+
useEffect22(() => {
|
|
6017
6010
|
if (signature) {
|
|
6018
6011
|
signature();
|
|
6019
6012
|
}
|
|
@@ -6084,7 +6077,7 @@ function EVMModal(props) {
|
|
|
6084
6077
|
}
|
|
6085
6078
|
|
|
6086
6079
|
// src/components/TRONModal/index.tsx
|
|
6087
|
-
import React11, { useEffect as
|
|
6080
|
+
import React11, { useEffect as useEffect24, useMemo as useMemo14, useState as useState28 } from "react";
|
|
6088
6081
|
import { useIntl as useIntl14 } from "react-intl";
|
|
6089
6082
|
|
|
6090
6083
|
// src/lib/tron/TronLinkAdapter.ts
|
|
@@ -6118,7 +6111,7 @@ var TronLinkAdapter = class {
|
|
|
6118
6111
|
};
|
|
6119
6112
|
|
|
6120
6113
|
// src/hooks/useTRONWallet.ts
|
|
6121
|
-
import { useEffect as
|
|
6114
|
+
import { useEffect as useEffect23, useState as useState27 } from "react";
|
|
6122
6115
|
|
|
6123
6116
|
// src/lib/tron/BitgetAdapter.ts
|
|
6124
6117
|
var BitgetAdapter = class {
|
|
@@ -6163,9 +6156,9 @@ var OKXAdapter = class {
|
|
|
6163
6156
|
// src/hooks/useTRONWallet.ts
|
|
6164
6157
|
var useTRONWallet = () => {
|
|
6165
6158
|
const wallets = [new TronLinkAdapter(), new BitgetAdapter(), new OKXAdapter()];
|
|
6166
|
-
const [installedWallets, setInstalledWallets] =
|
|
6167
|
-
const [address, setAddress] =
|
|
6168
|
-
|
|
6159
|
+
const [installedWallets, setInstalledWallets] = useState27([]);
|
|
6160
|
+
const [address, setAddress] = useState27(null);
|
|
6161
|
+
useEffect23(() => {
|
|
6169
6162
|
const getInstalled = async () => {
|
|
6170
6163
|
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
6171
6164
|
wallet: wallet2,
|
|
@@ -6175,11 +6168,11 @@ var useTRONWallet = () => {
|
|
|
6175
6168
|
};
|
|
6176
6169
|
getInstalled();
|
|
6177
6170
|
}, []);
|
|
6178
|
-
const [wallet, chooseWallet] =
|
|
6171
|
+
const [wallet, chooseWallet] = useState27(null);
|
|
6179
6172
|
const onConnect = async () => {
|
|
6180
6173
|
setAddress(await wallet.connect());
|
|
6181
6174
|
};
|
|
6182
|
-
|
|
6175
|
+
useEffect23(() => {
|
|
6183
6176
|
if (!wallet) {
|
|
6184
6177
|
setAddress(null);
|
|
6185
6178
|
}
|
|
@@ -6210,9 +6203,9 @@ function TRONConnectModal({
|
|
|
6210
6203
|
okx: /* @__PURE__ */ jsx39(OKXIcon, { size: isDownMd ? 36 : 40 })
|
|
6211
6204
|
};
|
|
6212
6205
|
const { events, login } = useMatch();
|
|
6213
|
-
const [status, setStatus] =
|
|
6206
|
+
const [status, setStatus] = useState28("");
|
|
6214
6207
|
const statusRef = React11.useRef(status);
|
|
6215
|
-
const [error, setError] =
|
|
6208
|
+
const [error, setError] = useState28("");
|
|
6216
6209
|
const connected = useMemo14(() => {
|
|
6217
6210
|
return !!address;
|
|
6218
6211
|
}, [address]);
|
|
@@ -6281,7 +6274,7 @@ function TRONConnectModal({
|
|
|
6281
6274
|
statusRef.current = "";
|
|
6282
6275
|
}
|
|
6283
6276
|
};
|
|
6284
|
-
|
|
6277
|
+
useEffect24(() => {
|
|
6285
6278
|
if (wallet) {
|
|
6286
6279
|
console.log("onConnect");
|
|
6287
6280
|
onConnect();
|
|
@@ -6289,12 +6282,12 @@ function TRONConnectModal({
|
|
|
6289
6282
|
setStatus("");
|
|
6290
6283
|
}
|
|
6291
6284
|
}, [wallet]);
|
|
6292
|
-
|
|
6285
|
+
useEffect24(() => {
|
|
6293
6286
|
if (address) {
|
|
6294
6287
|
toLoginInWallet();
|
|
6295
6288
|
}
|
|
6296
6289
|
}, [address]);
|
|
6297
|
-
|
|
6290
|
+
useEffect24(() => {
|
|
6298
6291
|
if (!props.isOpen) {
|
|
6299
6292
|
disconnect();
|
|
6300
6293
|
}
|
|
@@ -6352,7 +6345,7 @@ function TRONModal(props) {
|
|
|
6352
6345
|
}
|
|
6353
6346
|
|
|
6354
6347
|
// src/components/TONModal/index.tsx
|
|
6355
|
-
import React12, { useEffect as
|
|
6348
|
+
import React12, { useEffect as useEffect25, useState as useState29 } from "react";
|
|
6356
6349
|
import { useIntl as useIntl15 } from "react-intl";
|
|
6357
6350
|
import {
|
|
6358
6351
|
TonConnectUIProvider,
|
|
@@ -6367,15 +6360,15 @@ function WalletContent2({
|
|
|
6367
6360
|
type
|
|
6368
6361
|
}) {
|
|
6369
6362
|
const { events, login } = useMatch();
|
|
6370
|
-
const [connected, setConnected] =
|
|
6363
|
+
const [connected, setConnected] = useState29(false);
|
|
6371
6364
|
const wallet = useTonWallet();
|
|
6372
6365
|
const userFriendlyAddress = useTonAddress();
|
|
6373
6366
|
const [tonConnectUI] = useTonConnectUI();
|
|
6374
6367
|
const { state, open, close } = useTonConnectModal();
|
|
6375
|
-
const [status, setStatus] =
|
|
6368
|
+
const [status, setStatus] = useState29("");
|
|
6376
6369
|
const statusRef = React12.useRef(status);
|
|
6377
|
-
const [error, setError] =
|
|
6378
|
-
|
|
6370
|
+
const [error, setError] = useState29("");
|
|
6371
|
+
useEffect25(() => {
|
|
6379
6372
|
const init = async () => {
|
|
6380
6373
|
if (tonConnectUI.connected) {
|
|
6381
6374
|
await tonConnectUI.disconnect();
|
|
@@ -6448,7 +6441,7 @@ function WalletContent2({
|
|
|
6448
6441
|
}
|
|
6449
6442
|
});
|
|
6450
6443
|
}, []);
|
|
6451
|
-
|
|
6444
|
+
useEffect25(() => {
|
|
6452
6445
|
if (wallet) {
|
|
6453
6446
|
setConnected(true);
|
|
6454
6447
|
console.log("Wallet connected:", wallet);
|
|
@@ -6459,7 +6452,7 @@ function WalletContent2({
|
|
|
6459
6452
|
setStatus("");
|
|
6460
6453
|
}
|
|
6461
6454
|
}, [wallet]);
|
|
6462
|
-
|
|
6455
|
+
useEffect25(() => {
|
|
6463
6456
|
console.log({
|
|
6464
6457
|
state,
|
|
6465
6458
|
wallet
|
|
@@ -6539,7 +6532,7 @@ function TONModal(props) {
|
|
|
6539
6532
|
}
|
|
6540
6533
|
|
|
6541
6534
|
// src/components/BTCModal/index.tsx
|
|
6542
|
-
import React13, { useEffect as
|
|
6535
|
+
import React13, { useEffect as useEffect27, useMemo as useMemo15, useState as useState31 } from "react";
|
|
6543
6536
|
import { useIntl as useIntl16 } from "react-intl";
|
|
6544
6537
|
|
|
6545
6538
|
// src/lib/btc/UnisatAdapter.ts
|
|
@@ -6694,7 +6687,7 @@ var LeatherAdapter = class {
|
|
|
6694
6687
|
};
|
|
6695
6688
|
|
|
6696
6689
|
// src/hooks/useBTCWallet.ts
|
|
6697
|
-
import { useEffect as
|
|
6690
|
+
import { useEffect as useEffect26, useState as useState30 } from "react";
|
|
6698
6691
|
|
|
6699
6692
|
// src/lib/btc/PhantomAdapter.ts
|
|
6700
6693
|
var PhantomAdapter = class {
|
|
@@ -6732,9 +6725,9 @@ var PhantomAdapter = class {
|
|
|
6732
6725
|
// src/hooks/useBTCWallet.ts
|
|
6733
6726
|
var useBTCWallet = () => {
|
|
6734
6727
|
const wallets = [new UnisatAdapter(), new XverseAdapter(), new LeatherAdapter(), new PhantomAdapter()];
|
|
6735
|
-
const [installedWallets, setInstalledWallets] =
|
|
6736
|
-
const [address, setAddress] =
|
|
6737
|
-
|
|
6728
|
+
const [installedWallets, setInstalledWallets] = useState30([]);
|
|
6729
|
+
const [address, setAddress] = useState30(null);
|
|
6730
|
+
useEffect26(() => {
|
|
6738
6731
|
const getInstalled = async () => {
|
|
6739
6732
|
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
6740
6733
|
wallet: wallet2,
|
|
@@ -6744,11 +6737,11 @@ var useBTCWallet = () => {
|
|
|
6744
6737
|
};
|
|
6745
6738
|
getInstalled();
|
|
6746
6739
|
}, []);
|
|
6747
|
-
const [wallet, chooseWallet] =
|
|
6740
|
+
const [wallet, chooseWallet] = useState30(null);
|
|
6748
6741
|
const onConnect = async () => {
|
|
6749
6742
|
setAddress(await wallet.connect());
|
|
6750
6743
|
};
|
|
6751
|
-
|
|
6744
|
+
useEffect26(() => {
|
|
6752
6745
|
if (!wallet) {
|
|
6753
6746
|
setAddress(null);
|
|
6754
6747
|
}
|
|
@@ -6780,9 +6773,9 @@ function BTCConnectModal({
|
|
|
6780
6773
|
phantom: /* @__PURE__ */ jsx41(PhantomIcon, { size: isDownMd ? 36 : 40 })
|
|
6781
6774
|
};
|
|
6782
6775
|
const { events, login } = useMatch();
|
|
6783
|
-
const [status, setStatus] =
|
|
6776
|
+
const [status, setStatus] = useState31("");
|
|
6784
6777
|
const statusRef = React13.useRef(status);
|
|
6785
|
-
const [error, setError] =
|
|
6778
|
+
const [error, setError] = useState31("");
|
|
6786
6779
|
const connected = useMemo15(() => {
|
|
6787
6780
|
return !!address;
|
|
6788
6781
|
}, [address]);
|
|
@@ -6847,7 +6840,7 @@ function BTCConnectModal({
|
|
|
6847
6840
|
statusRef.current = "";
|
|
6848
6841
|
}
|
|
6849
6842
|
};
|
|
6850
|
-
|
|
6843
|
+
useEffect27(() => {
|
|
6851
6844
|
if (wallet) {
|
|
6852
6845
|
console.log("onConnect");
|
|
6853
6846
|
try {
|
|
@@ -6860,12 +6853,12 @@ function BTCConnectModal({
|
|
|
6860
6853
|
setStatus("");
|
|
6861
6854
|
}
|
|
6862
6855
|
}, [wallet]);
|
|
6863
|
-
|
|
6856
|
+
useEffect27(() => {
|
|
6864
6857
|
if (address) {
|
|
6865
6858
|
toLoginInWallet();
|
|
6866
6859
|
}
|
|
6867
6860
|
}, [address]);
|
|
6868
|
-
|
|
6861
|
+
useEffect27(() => {
|
|
6869
6862
|
if (!props.isOpen) {
|
|
6870
6863
|
disconnect();
|
|
6871
6864
|
}
|
|
@@ -6974,11 +6967,11 @@ function WalletModal(props) {
|
|
|
6974
6967
|
}
|
|
6975
6968
|
|
|
6976
6969
|
// src/components/AlphaAvatar/index.tsx
|
|
6977
|
-
import { useEffect as
|
|
6970
|
+
import { useEffect as useEffect28, useState as useState32 } from "react";
|
|
6978
6971
|
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
6979
6972
|
function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
6980
|
-
const [avatar, setAvatar] =
|
|
6981
|
-
|
|
6973
|
+
const [avatar, setAvatar] = useState32(void 0);
|
|
6974
|
+
useEffect28(() => {
|
|
6982
6975
|
if (name) {
|
|
6983
6976
|
const char = name[0].toUpperCase();
|
|
6984
6977
|
setAvatar(char);
|
|
@@ -7075,7 +7068,7 @@ function WalletAsset({
|
|
|
7075
7068
|
}
|
|
7076
7069
|
|
|
7077
7070
|
// src/components/TokenSend/index.tsx
|
|
7078
|
-
import { useEffect as
|
|
7071
|
+
import { useEffect as useEffect29, useMemo as useMemo17, useState as useState33 } from "react";
|
|
7079
7072
|
import { defineChain as defineChain4, encodeFunctionData as encodeFunctionData2, erc20Abi as erc20Abi3, http as http8, parseUnits as parseUnits2 } from "viem";
|
|
7080
7073
|
import { FormattedMessage as FormattedMessage12, useIntl as useIntl18 } from "react-intl";
|
|
7081
7074
|
import { jsx as jsx45, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
@@ -7123,11 +7116,11 @@ function TokenSend({
|
|
|
7123
7116
|
transport: http8()
|
|
7124
7117
|
});
|
|
7125
7118
|
}, [chain]);
|
|
7126
|
-
const [amount, setAmount] =
|
|
7127
|
-
const [address, setAddress] =
|
|
7128
|
-
const [loading, setLoading] =
|
|
7129
|
-
const [sending, setSending] =
|
|
7130
|
-
const [txError, setTxError] =
|
|
7119
|
+
const [amount, setAmount] = useState33("");
|
|
7120
|
+
const [address, setAddress] = useState33("");
|
|
7121
|
+
const [loading, setLoading] = useState33(false);
|
|
7122
|
+
const [sending, setSending] = useState33(false);
|
|
7123
|
+
const [txError, setTxError] = useState33("");
|
|
7131
7124
|
const transaction = useMemo17(() => {
|
|
7132
7125
|
const reg = /^0x[a-fA-F0-9]{40}$/;
|
|
7133
7126
|
if (!amount || !address || !reg.test(address)) {
|
|
@@ -7212,7 +7205,7 @@ function TokenSend({
|
|
|
7212
7205
|
}
|
|
7213
7206
|
onClose();
|
|
7214
7207
|
};
|
|
7215
|
-
|
|
7208
|
+
useEffect29(() => {
|
|
7216
7209
|
const receiveMessage = (event) => {
|
|
7217
7210
|
if (event.data) {
|
|
7218
7211
|
if (event.data.source == "match-wallet") {
|
|
@@ -7344,7 +7337,7 @@ function TokenDetail({
|
|
|
7344
7337
|
}
|
|
7345
7338
|
|
|
7346
7339
|
// src/components/TokenSendList/index.tsx
|
|
7347
|
-
import { useState as
|
|
7340
|
+
import { useState as useState34 } from "react";
|
|
7348
7341
|
import { FormattedMessage as FormattedMessage14 } from "react-intl";
|
|
7349
7342
|
import { jsx as jsx47, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7350
7343
|
function TokenSendList({ close }) {
|
|
@@ -7354,7 +7347,7 @@ function TokenSendList({ close }) {
|
|
|
7354
7347
|
list: walletAssets.mergedAssets
|
|
7355
7348
|
});
|
|
7356
7349
|
const { list } = useMatchChain();
|
|
7357
|
-
const [checked, setChecked] =
|
|
7350
|
+
const [checked, setChecked] = useState34();
|
|
7358
7351
|
const modal = useModal();
|
|
7359
7352
|
const onNext = () => {
|
|
7360
7353
|
checked && modal.show((props) => {
|
|
@@ -7411,7 +7404,7 @@ function TokenSendList({ close }) {
|
|
|
7411
7404
|
|
|
7412
7405
|
// src/components/TransactionList/index.tsx
|
|
7413
7406
|
import InfiniteScroll from "react-infinite-scroll-component";
|
|
7414
|
-
import { useEffect as
|
|
7407
|
+
import { useEffect as useEffect30, useMemo as useMemo18, useState as useState35 } from "react";
|
|
7415
7408
|
import { decodeFunctionData, defineChain as defineChain5, formatUnits as formatUnits3 } from "viem";
|
|
7416
7409
|
import { erc20Abi as erc20Abi4 } from "viem";
|
|
7417
7410
|
import { FormattedMessage as FormattedMessage15 } from "react-intl";
|
|
@@ -7421,7 +7414,7 @@ var Item = ({ data }) => {
|
|
|
7421
7414
|
const isOut = data.from.toLowerCase() == address.toLowerCase();
|
|
7422
7415
|
const { chain, chainId, explorerLink, formatUnits: chainFormatUnits } = useMatchChain();
|
|
7423
7416
|
const { contracts } = useContractStore_default();
|
|
7424
|
-
const [shouldRefetch, setShouldRefetch] =
|
|
7417
|
+
const [shouldRefetch, setShouldRefetch] = useState35(true);
|
|
7425
7418
|
const transferType = useMemo18(() => {
|
|
7426
7419
|
const methodId = data.input.substring(2, 10);
|
|
7427
7420
|
if (methodId == "095ea7b3") {
|
|
@@ -7490,7 +7483,7 @@ var Item = ({ data }) => {
|
|
|
7490
7483
|
}
|
|
7491
7484
|
return "loading";
|
|
7492
7485
|
}, [data.extra?.status, data.source, hashQuery.data]);
|
|
7493
|
-
|
|
7486
|
+
useEffect30(() => {
|
|
7494
7487
|
if (data.hash) {
|
|
7495
7488
|
setShouldRefetch(status == "loading");
|
|
7496
7489
|
}
|
|
@@ -7600,7 +7593,7 @@ export {
|
|
|
7600
7593
|
Radio,
|
|
7601
7594
|
Skeleton_default,
|
|
7602
7595
|
Tabs,
|
|
7603
|
-
|
|
7596
|
+
Lottie,
|
|
7604
7597
|
ui_exports,
|
|
7605
7598
|
ModalProvider,
|
|
7606
7599
|
useModal,
|
|
@@ -7621,4 +7614,4 @@ export {
|
|
|
7621
7614
|
MatchProvider,
|
|
7622
7615
|
useMatch
|
|
7623
7616
|
};
|
|
7624
|
-
//# sourceMappingURL=chunk-
|
|
7617
|
+
//# sourceMappingURL=chunk-VIJ3M2NZ.mjs.map
|