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