@matchain/matchid-sdk-react 0.1.53-alpha.1 → 0.1.53-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icon/index.d.mts +4 -2
- package/dist/assets/icon/index.d.ts +4 -2
- package/dist/assets/icon/index.js +19 -0
- package/dist/assets/icon/index.js.map +1 -1
- package/dist/assets/icon/index.mjs +3 -1
- package/dist/{chunk-LHNKZISB.mjs → chunk-3USZ4ZZY.mjs} +20 -2
- package/dist/chunk-3USZ4ZZY.mjs.map +1 -0
- package/dist/{chunk-2DVC6WCN.mjs → chunk-3YF3P77J.mjs} +270 -419
- package/dist/chunk-3YF3P77J.mjs.map +1 -0
- package/dist/{chunk-6QTW3KXN.mjs → chunk-4EVF2PXX.mjs} +2 -2
- package/dist/{chunk-HLUFAIFV.mjs → chunk-OCQ2AIM3.mjs} +7 -2
- package/dist/{chunk-HLUFAIFV.mjs.map → chunk-OCQ2AIM3.mjs.map} +1 -1
- package/dist/{chunk-FB5MHLWX.mjs → chunk-V2S54LGG.mjs} +2 -2
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +396 -511
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +5 -7
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +89 -133
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +5 -5
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +207 -264
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +5 -5
- package/dist/{index-DvM6x6e6.d.ts → index-BKHtf1Tu.d.ts} +1 -1
- package/dist/{index-BDoEk1EK.d.ts → index-BSUoL5Jo.d.mts} +4 -11
- package/dist/{index-XzSw1Bym.d.mts → index-BVO4Bt59.d.ts} +4 -11
- package/dist/{index-k2Uf0F94.d.ts → index-CcN5ls1U.d.ts} +1 -1
- package/dist/{index-BUj9mOrS.d.ts → index-Cul4qlZl.d.ts} +1 -1
- package/dist/{index-D5OzNRfu.d.mts → index-CvVl_Xw1.d.mts} +2 -2
- package/dist/{index-Bmir-Wor.d.mts → index-DXRsJY9h.d.mts} +1 -1
- package/dist/{index-X_fw5wX_.d.ts → index-DgwlV4ve.d.ts} +3 -3
- package/dist/{index-B_o9HBS1.d.mts → index-DrEKzXYX.d.mts} +1 -1
- package/dist/{index-B-QfwtE5.d.mts → index-EPwrSSOz.d.mts} +3 -3
- package/dist/{index-CDqIk5k2.d.mts → index-ba3VTkaV.d.mts} +1 -1
- package/dist/{index-DMUZQqNB.d.ts → index-lKJjj0w4.d.ts} +2 -2
- package/dist/index.d.mts +7 -8
- package/dist/index.d.ts +7 -8
- package/dist/index.js +509 -601
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -12
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/{types-Dd_ExpLx.d.mts → types-Bgd3Ac92.d.mts} +1 -2
- package/dist/{types-Dd_ExpLx.d.ts → types-Bgd3Ac92.d.ts} +1 -2
- package/dist/ui/index.d.mts +3 -3
- package/dist/ui/index.d.ts +3 -3
- package/dist/ui/index.js +62 -59
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +2 -2
- package/dist/utils/index.d.mts +2 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +3 -1
- package/example/dist/assets/ccip-nxE3Zma4.js +1 -0
- package/example/dist/assets/index-BFAv3rdU.css +1 -0
- package/example/dist/assets/index-DMWWRDPI.js +1658 -0
- package/example/dist/index.html +2 -2
- package/package.json +1 -5
- package/dist/chunk-2DVC6WCN.mjs.map +0 -1
- package/dist/chunk-LHNKZISB.mjs.map +0 -1
- package/example/dist/assets/TransportWebHID-BEu7tC0r.js +0 -1
- package/example/dist/assets/bignumber-iG7K-qxw.js +0 -10
- package/example/dist/assets/ccip-a6wQ1Vcb.js +0 -1
- package/example/dist/assets/draggabilly-CRYR_S0q.js +0 -14
- package/example/dist/assets/index--dp9m9Ep.js +0 -1
- package/example/dist/assets/index-BDTHolFv.js +0 -569
- package/example/dist/assets/index-BZl59qLb.js +0 -179
- package/example/dist/assets/index-BmMbYNHO.js +0 -303
- package/example/dist/assets/index-C7cxVRDF.js +0 -1677
- package/example/dist/assets/index-CJk171Yb.js +0 -1
- package/example/dist/assets/index-CQiBesAa.js +0 -3
- package/example/dist/assets/index-D62loNA9.js +0 -3
- package/example/dist/assets/index-DqyX3FG6.js +0 -1
- package/example/dist/assets/index-Gy3FXGhr.css +0 -1
- package/example/dist/assets/inherits_browser-BlmhoU4v.js +0 -1
- package/example/dist/assets/solanaEmbed.esm-Djn-u4Vn.js +0 -38
- /package/dist/{chunk-6QTW3KXN.mjs.map → chunk-4EVF2PXX.mjs.map} +0 -0
- /package/dist/{chunk-FB5MHLWX.mjs.map → chunk-V2S54LGG.mjs.map} +0 -0
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NumberFormatter,
|
|
3
|
-
encodeBase64,
|
|
4
|
-
formatAddress,
|
|
5
|
-
formatDate,
|
|
6
|
-
getAppClientId,
|
|
7
|
-
getVersion,
|
|
8
|
-
isInTgApp,
|
|
9
|
-
isValidEmail,
|
|
10
|
-
isValidUsername,
|
|
11
|
-
truncateAddress
|
|
12
|
-
} from "./chunk-HLUFAIFV.mjs";
|
|
13
1
|
import {
|
|
14
2
|
AlphaAvatar,
|
|
15
3
|
Button,
|
|
@@ -28,7 +16,21 @@ import {
|
|
|
28
16
|
useDownMd,
|
|
29
17
|
useHash,
|
|
30
18
|
useLayout_exports
|
|
31
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-V2S54LGG.mjs";
|
|
20
|
+
import {
|
|
21
|
+
NumberFormatter,
|
|
22
|
+
bytesToBase64,
|
|
23
|
+
decodeBase64,
|
|
24
|
+
encodeBase64,
|
|
25
|
+
formatAddress,
|
|
26
|
+
formatDate,
|
|
27
|
+
getAppClientId,
|
|
28
|
+
getVersion,
|
|
29
|
+
isInTgApp,
|
|
30
|
+
isValidEmail,
|
|
31
|
+
isValidUsername,
|
|
32
|
+
truncateAddress
|
|
33
|
+
} from "./chunk-OCQ2AIM3.mjs";
|
|
32
34
|
import {
|
|
33
35
|
ArrowDownIcon,
|
|
34
36
|
ArrowRightIcon,
|
|
@@ -56,6 +58,7 @@ import {
|
|
|
56
58
|
LoadingIcon_default,
|
|
57
59
|
LoginIcon_default,
|
|
58
60
|
OKXIcon,
|
|
61
|
+
PhantomIcon,
|
|
59
62
|
SOLDarkIcon,
|
|
60
63
|
SOLLightIcon,
|
|
61
64
|
TRXDarkIcon,
|
|
@@ -71,7 +74,7 @@ import {
|
|
|
71
74
|
XIcon,
|
|
72
75
|
XverseIcon,
|
|
73
76
|
YoutubeIcon
|
|
74
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-3USZ4ZZY.mjs";
|
|
75
78
|
import {
|
|
76
79
|
__export
|
|
77
80
|
} from "./chunk-J5LGTIGS.mjs";
|
|
@@ -92,7 +95,6 @@ __export(components_exports, {
|
|
|
92
95
|
ModalWithHeader: () => ModalWithHeader,
|
|
93
96
|
Overlay: () => Overlay,
|
|
94
97
|
Popover: () => Popover,
|
|
95
|
-
SOLModal: () => SOLModal,
|
|
96
98
|
TONModal: () => TONModal,
|
|
97
99
|
TRONModal: () => TRONModal,
|
|
98
100
|
TokenDetail: () => TokenDetail,
|
|
@@ -2294,12 +2296,6 @@ function useWalletConfig() {
|
|
|
2294
2296
|
}
|
|
2295
2297
|
|
|
2296
2298
|
// src/store/useModalStore.ts
|
|
2297
|
-
var useSOLModalStore = create5((set) => ({
|
|
2298
|
-
isOpen: false,
|
|
2299
|
-
type: "",
|
|
2300
|
-
open: (type) => set({ isOpen: true, type }),
|
|
2301
|
-
close: () => set({ isOpen: false })
|
|
2302
|
-
}));
|
|
2303
2299
|
var useTRONModalStore = create5((set) => ({
|
|
2304
2300
|
isOpen: false,
|
|
2305
2301
|
type: "",
|
|
@@ -2450,7 +2446,6 @@ import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
|
2450
2446
|
import { Fragment, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2451
2447
|
function BusinessProvider({ children }) {
|
|
2452
2448
|
const { overview, token } = useUserInfo();
|
|
2453
|
-
const { type: SOLType, isOpen: SOLIsOpen, close: SOLClose } = useSOLModalStore();
|
|
2454
2449
|
const { type: TONType, isOpen: TONIsOpen, close: TONClose } = useTONModalStore();
|
|
2455
2450
|
const { type: TRONType, isOpen: TRONIsOpen, close: TRONClose } = useTRONModalStore();
|
|
2456
2451
|
const { type: BTCType, isOpen: BTCIsOpen, close: BTCClose } = useBTCModalStore();
|
|
@@ -2471,7 +2466,7 @@ function BusinessProvider({ children }) {
|
|
|
2471
2466
|
if (isSuccess(res)) {
|
|
2472
2467
|
setTgAppAuthCode("");
|
|
2473
2468
|
await login({
|
|
2474
|
-
mid:
|
|
2469
|
+
// mid:'',
|
|
2475
2470
|
token: `${res.data.token_type} ${res.data.access_token}`
|
|
2476
2471
|
});
|
|
2477
2472
|
return true;
|
|
@@ -2482,16 +2477,6 @@ function BusinessProvider({ children }) {
|
|
|
2482
2477
|
refetchInterval: 1e3 * 5
|
|
2483
2478
|
});
|
|
2484
2479
|
return /* @__PURE__ */ jsxs8(Fragment, { children: [
|
|
2485
|
-
/* @__PURE__ */ jsx10(
|
|
2486
|
-
SOLModal,
|
|
2487
|
-
{
|
|
2488
|
-
isOpen: SOLIsOpen && (SOLType == "login" && !overview && !token || SOLType == "bind" && !!token && !!overview),
|
|
2489
|
-
onClose: SOLClose,
|
|
2490
|
-
type: SOLType,
|
|
2491
|
-
onSuccess: () => walletModalClose(SOLClose),
|
|
2492
|
-
zIndex: 199
|
|
2493
|
-
}
|
|
2494
|
-
),
|
|
2495
2480
|
/* @__PURE__ */ jsx10(
|
|
2496
2481
|
TRONModal,
|
|
2497
2482
|
{
|
|
@@ -2811,6 +2796,7 @@ function useInit({
|
|
|
2811
2796
|
const overviewLoadingRef = useRef3(false);
|
|
2812
2797
|
const searchParams = new URLSearchParams(window.location.search);
|
|
2813
2798
|
const matchToken = searchParams.get("matchToken");
|
|
2799
|
+
const matchidt = searchParams.get("matchidt");
|
|
2814
2800
|
const realEndpoints = endpoints || env_default.endpoints;
|
|
2815
2801
|
useEffect12(() => {
|
|
2816
2802
|
setTheme(theme);
|
|
@@ -2829,18 +2815,48 @@ function useInit({
|
|
|
2829
2815
|
const tokenData = JSON.parse(atob(matchToken));
|
|
2830
2816
|
if (tokenData && tokenData.mid && tokenData.token) {
|
|
2831
2817
|
login({
|
|
2832
|
-
mid: tokenData.mid,
|
|
2818
|
+
// mid: tokenData.mid,
|
|
2833
2819
|
token: "Bearer " + tokenData.token
|
|
2834
2820
|
});
|
|
2835
2821
|
}
|
|
2836
2822
|
}
|
|
2837
2823
|
}, [matchToken]);
|
|
2824
|
+
useEffect12(() => {
|
|
2825
|
+
if (matchidt) {
|
|
2826
|
+
const tokenData = decodeURIComponent(matchidt);
|
|
2827
|
+
const data = JSON.parse(decodeBase64(tokenData));
|
|
2828
|
+
if (data) {
|
|
2829
|
+
matchlog_default.log("matchidt", data);
|
|
2830
|
+
if (data.action == "login") {
|
|
2831
|
+
const newtoken = data.token || `${data.token_type} ${data.access_token}`;
|
|
2832
|
+
login({
|
|
2833
|
+
// mid: tokenData.mid,
|
|
2834
|
+
token: newtoken
|
|
2835
|
+
});
|
|
2836
|
+
} else if (data.action == "bind") {
|
|
2837
|
+
eventManager_default.emit("onBind", {
|
|
2838
|
+
type: data.type
|
|
2839
|
+
});
|
|
2840
|
+
if (events && events.onBind) {
|
|
2841
|
+
events.onBind({
|
|
2842
|
+
type: data.type
|
|
2843
|
+
});
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
const url = window.location.href;
|
|
2847
|
+
const urlObj = new URL(url);
|
|
2848
|
+
urlObj.searchParams.delete("matchidt");
|
|
2849
|
+
window.history.replaceState({}, "", urlObj.toString());
|
|
2850
|
+
return;
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
}, [matchidt]);
|
|
2838
2854
|
useEffect12(() => {
|
|
2839
2855
|
const onLoginMessage = (event) => {
|
|
2840
2856
|
const res = event.data;
|
|
2841
2857
|
if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
|
|
2842
2858
|
login({
|
|
2843
|
-
mid: res.data.mid,
|
|
2859
|
+
// mid: res.data.mid,
|
|
2844
2860
|
token: res.data.token || `${res.data.token_type} ${res.data.access_token}`
|
|
2845
2861
|
});
|
|
2846
2862
|
} else if (res.event == "bind") {
|
|
@@ -2877,18 +2893,17 @@ function useInit({
|
|
|
2877
2893
|
loadOverview();
|
|
2878
2894
|
}
|
|
2879
2895
|
}, [token]);
|
|
2880
|
-
const login = async ({
|
|
2881
|
-
setMid(mid);
|
|
2896
|
+
const login = async ({ token: token2 }) => {
|
|
2882
2897
|
setToken(token2);
|
|
2883
2898
|
const overview = await loadOverview();
|
|
2884
2899
|
eventManager_default.emit("onLogin", {
|
|
2885
|
-
mid,
|
|
2900
|
+
// mid,
|
|
2886
2901
|
token: token2,
|
|
2887
2902
|
did: overview?.did
|
|
2888
2903
|
});
|
|
2889
2904
|
if (events && events?.onLogin) {
|
|
2890
2905
|
events.onLogin({
|
|
2891
|
-
mid,
|
|
2906
|
+
// mid,
|
|
2892
2907
|
token: token2,
|
|
2893
2908
|
did: overview?.did
|
|
2894
2909
|
});
|
|
@@ -2964,7 +2979,7 @@ var en_default = {
|
|
|
2964
2979
|
amountPlaceholder: "Enter the Amount.",
|
|
2965
2980
|
balance: "Balance",
|
|
2966
2981
|
receiveTitle: "Received wallet address",
|
|
2967
|
-
receivePlaceholder: "Enter the
|
|
2982
|
+
receivePlaceholder: "Enter the Receiving wallet address.",
|
|
2968
2983
|
next: "Next",
|
|
2969
2984
|
copied: "Copied",
|
|
2970
2985
|
receiveQrcode: "Receive by scanning the QR code",
|
|
@@ -3710,13 +3725,16 @@ function useUserInfo() {
|
|
|
3710
3725
|
refreshOverview
|
|
3711
3726
|
} = useLocalStore_default();
|
|
3712
3727
|
const { setTgAppAuthCode, emailLoginKey, setEmailLoginKey } = useStore_default();
|
|
3728
|
+
const isDownMd = useDownMd();
|
|
3713
3729
|
const { events, login } = useMatch();
|
|
3714
|
-
const { open: SOLOpen } = useSOLModalStore();
|
|
3715
3730
|
const { open: TRONOpen } = useTRONModalStore();
|
|
3716
3731
|
const { open: TONOpen } = useTONModalStore();
|
|
3717
3732
|
const { open: BTCOpen } = useBTCModalStore();
|
|
3718
3733
|
const { open: CEXBindOpen } = useCEXBindModalStore();
|
|
3719
3734
|
const walletModalStore = useWalletModalStore();
|
|
3735
|
+
const getRedirectUri = () => {
|
|
3736
|
+
return encodeURIComponent(window.location.href);
|
|
3737
|
+
};
|
|
3720
3738
|
const isLogin = useMemo7(() => !!token && !!overview, [token, overview]);
|
|
3721
3739
|
const logout = async () => {
|
|
3722
3740
|
try {
|
|
@@ -3787,6 +3805,9 @@ function useUserInfo() {
|
|
|
3787
3805
|
case "evm":
|
|
3788
3806
|
return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`);
|
|
3789
3807
|
case "sol":
|
|
3808
|
+
if (isDownMd) {
|
|
3809
|
+
return window.location.href = `${endpoints.auth}login/sol?appid=${appid}&locale=${locale}&redirect_uri=${getRedirectUri()}`;
|
|
3810
|
+
}
|
|
3790
3811
|
return window.open(`${endpoints.auth}login/sol?appid=${appid}&locale=${locale}`);
|
|
3791
3812
|
case "tron":
|
|
3792
3813
|
return TRONOpen("login");
|
|
@@ -3829,7 +3850,7 @@ function useUserInfo() {
|
|
|
3829
3850
|
const res = await verifyEmailCodeApi(obj);
|
|
3830
3851
|
if (res && res.data && isSuccess(res)) {
|
|
3831
3852
|
await login({
|
|
3832
|
-
mid: res.data.mid,
|
|
3853
|
+
// mid: res.data.mid,
|
|
3833
3854
|
token: `${res.data.token_type} ${res.data.access_token}`
|
|
3834
3855
|
});
|
|
3835
3856
|
return true;
|
|
@@ -3876,7 +3897,10 @@ function useUserInfo() {
|
|
|
3876
3897
|
case "evm":
|
|
3877
3898
|
return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)));
|
|
3878
3899
|
case "sol":
|
|
3879
|
-
|
|
3900
|
+
if (isDownMd) {
|
|
3901
|
+
return window.location.href = `${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}&redirect_uri=${getRedirectUri()}`;
|
|
3902
|
+
}
|
|
3903
|
+
return window.open(`${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}`);
|
|
3880
3904
|
case "tron":
|
|
3881
3905
|
return TRONOpen("bind");
|
|
3882
3906
|
case "ton":
|
|
@@ -4674,58 +4698,8 @@ function UsernameModal({
|
|
|
4674
4698
|
] }) });
|
|
4675
4699
|
}
|
|
4676
4700
|
|
|
4677
|
-
// src/components/
|
|
4678
|
-
import React7, { useEffect as
|
|
4679
|
-
import { clusterApiUrl } from "@solana/web3.js";
|
|
4680
|
-
import { useWallet as useWallet2, WalletProvider, ConnectionProvider } from "@solana/wallet-adapter-react";
|
|
4681
|
-
import { WalletModalProvider, useWalletModal } from "@solana/wallet-adapter-react-ui";
|
|
4682
|
-
|
|
4683
|
-
// node_modules/@solana/wallet-adapter-base/lib/esm/types.js
|
|
4684
|
-
var WalletAdapterNetwork;
|
|
4685
|
-
(function(WalletAdapterNetwork2) {
|
|
4686
|
-
WalletAdapterNetwork2["Mainnet"] = "mainnet-beta";
|
|
4687
|
-
WalletAdapterNetwork2["Testnet"] = "testnet";
|
|
4688
|
-
WalletAdapterNetwork2["Devnet"] = "devnet";
|
|
4689
|
-
})(WalletAdapterNetwork || (WalletAdapterNetwork = {}));
|
|
4690
|
-
|
|
4691
|
-
// src/components/SOLModal/index.tsx
|
|
4692
|
-
import {
|
|
4693
|
-
PhantomWalletAdapter,
|
|
4694
|
-
SolflareWalletAdapter,
|
|
4695
|
-
WalletConnectWalletAdapter,
|
|
4696
|
-
AlphaWalletAdapter,
|
|
4697
|
-
AvanaWalletAdapter,
|
|
4698
|
-
BitgetWalletAdapter,
|
|
4699
|
-
BitpieWalletAdapter,
|
|
4700
|
-
CloverWalletAdapter,
|
|
4701
|
-
Coin98WalletAdapter,
|
|
4702
|
-
CoinbaseWalletAdapter,
|
|
4703
|
-
CoinhubWalletAdapter,
|
|
4704
|
-
FractalWalletAdapter,
|
|
4705
|
-
HuobiWalletAdapter,
|
|
4706
|
-
HyperPayWalletAdapter,
|
|
4707
|
-
KeystoneWalletAdapter,
|
|
4708
|
-
KrystalWalletAdapter,
|
|
4709
|
-
LedgerWalletAdapter,
|
|
4710
|
-
MathWalletAdapter,
|
|
4711
|
-
NekoWalletAdapter,
|
|
4712
|
-
NightlyWalletAdapter,
|
|
4713
|
-
NufiWalletAdapter,
|
|
4714
|
-
OntoWalletAdapter,
|
|
4715
|
-
ParticleAdapter,
|
|
4716
|
-
SafePalWalletAdapter,
|
|
4717
|
-
SaifuWalletAdapter,
|
|
4718
|
-
SalmonWalletAdapter,
|
|
4719
|
-
SkyWalletAdapter,
|
|
4720
|
-
SolongWalletAdapter,
|
|
4721
|
-
SpotWalletAdapter,
|
|
4722
|
-
TokenaryWalletAdapter,
|
|
4723
|
-
TokenPocketWalletAdapter,
|
|
4724
|
-
TorusWalletAdapter,
|
|
4725
|
-
TrustWalletAdapter,
|
|
4726
|
-
XDEFIWalletAdapter
|
|
4727
|
-
} from "@solana/wallet-adapter-wallets";
|
|
4728
|
-
import "@solana/wallet-adapter-react-ui/styles.css";
|
|
4701
|
+
// src/components/TRONModal/index.tsx
|
|
4702
|
+
import React7, { useEffect as useEffect18, useMemo as useMemo12, useState as useState20 } from "react";
|
|
4729
4703
|
import { useIntl as useIntl12 } from "react-intl";
|
|
4730
4704
|
|
|
4731
4705
|
// src/components/WalletModalContent/index.tsx
|
|
@@ -4828,164 +4802,6 @@ function WalletModalContent({
|
|
|
4828
4802
|
] }) });
|
|
4829
4803
|
}
|
|
4830
4804
|
|
|
4831
|
-
// src/components/SOLModal/index.tsx
|
|
4832
|
-
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
4833
|
-
function WalletContent({
|
|
4834
|
-
onSuccess,
|
|
4835
|
-
type
|
|
4836
|
-
}) {
|
|
4837
|
-
const { setVisible, visible } = useWalletModal();
|
|
4838
|
-
const wallet = useWallet2();
|
|
4839
|
-
const { events, login } = useMatch();
|
|
4840
|
-
const [status, setStatus] = useState19("");
|
|
4841
|
-
const statusRef = React7.useRef(status);
|
|
4842
|
-
const [error, setError] = useState19("");
|
|
4843
|
-
useEffect17(() => {
|
|
4844
|
-
const init = async () => {
|
|
4845
|
-
await wallet.disconnect();
|
|
4846
|
-
setVisible(true);
|
|
4847
|
-
};
|
|
4848
|
-
init();
|
|
4849
|
-
}, []);
|
|
4850
|
-
useEffect17(() => {
|
|
4851
|
-
if (wallet.connected) {
|
|
4852
|
-
console.log("wallet.connected", wallet.connected);
|
|
4853
|
-
toLoginInWallet();
|
|
4854
|
-
}
|
|
4855
|
-
}, [wallet.connected]);
|
|
4856
|
-
const toLoginInWallet = async () => {
|
|
4857
|
-
if (statusRef.current) return;
|
|
4858
|
-
const address = wallet.publicKey?.toBase58() || "";
|
|
4859
|
-
try {
|
|
4860
|
-
setStatus("nonce");
|
|
4861
|
-
statusRef.current = "nonce";
|
|
4862
|
-
const res = type == "bind" ? await getWalletInitApi({
|
|
4863
|
-
address,
|
|
4864
|
-
type: "SOL"
|
|
4865
|
-
}) : await getWalletNonceApi({ address, type: "SOL" });
|
|
4866
|
-
if (!isSuccess(res)) {
|
|
4867
|
-
throw new Error(res.message);
|
|
4868
|
-
}
|
|
4869
|
-
const nonce = res.code >= 0 ? res.data.nonce : null;
|
|
4870
|
-
if (nonce) {
|
|
4871
|
-
setStatus("signer");
|
|
4872
|
-
statusRef.current = "signer";
|
|
4873
|
-
const message = "By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.Nonce:" + res.data.nonce;
|
|
4874
|
-
const encodedMessage = new TextEncoder().encode(message);
|
|
4875
|
-
const signedMessage = await wallet.signMessage(encodedMessage);
|
|
4876
|
-
let obj = {
|
|
4877
|
-
type: "SOL",
|
|
4878
|
-
address,
|
|
4879
|
-
signature: Buffer.from(signedMessage).toString("base64"),
|
|
4880
|
-
message,
|
|
4881
|
-
connector_type: "SOL",
|
|
4882
|
-
wallet_client_type: wallet.wallet?.adapter.name || ""
|
|
4883
|
-
};
|
|
4884
|
-
const res1 = type == "bind" ? await toBindWalletApi(obj) : await loginByWalletApi(obj);
|
|
4885
|
-
if (res1) {
|
|
4886
|
-
if (!isSuccess(res1)) {
|
|
4887
|
-
throw new Error(res1.message);
|
|
4888
|
-
}
|
|
4889
|
-
matchlog_default.log(res1);
|
|
4890
|
-
setStatus("success");
|
|
4891
|
-
statusRef.current = "success";
|
|
4892
|
-
if (type == "bind") {
|
|
4893
|
-
events.onBind && events.onBind({
|
|
4894
|
-
type: "sol"
|
|
4895
|
-
});
|
|
4896
|
-
eventManager_default.emit("onBind", {
|
|
4897
|
-
type: "sol"
|
|
4898
|
-
});
|
|
4899
|
-
} else {
|
|
4900
|
-
await login({
|
|
4901
|
-
mid: res1.data.mid,
|
|
4902
|
-
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
4903
|
-
});
|
|
4904
|
-
}
|
|
4905
|
-
onSuccess && onSuccess();
|
|
4906
|
-
}
|
|
4907
|
-
}
|
|
4908
|
-
} catch (error2) {
|
|
4909
|
-
setStatus("error");
|
|
4910
|
-
setError(error2.message);
|
|
4911
|
-
statusRef.current = "";
|
|
4912
|
-
}
|
|
4913
|
-
};
|
|
4914
|
-
return /* @__PURE__ */ jsx23(
|
|
4915
|
-
WalletModalContent,
|
|
4916
|
-
{
|
|
4917
|
-
connected: wallet.connected,
|
|
4918
|
-
disconnect: wallet.disconnect,
|
|
4919
|
-
address: wallet.publicKey?.toBase58(),
|
|
4920
|
-
visible,
|
|
4921
|
-
setVisible,
|
|
4922
|
-
error,
|
|
4923
|
-
setError,
|
|
4924
|
-
status
|
|
4925
|
-
}
|
|
4926
|
-
);
|
|
4927
|
-
}
|
|
4928
|
-
var wallets = [
|
|
4929
|
-
new PhantomWalletAdapter(),
|
|
4930
|
-
new SolflareWalletAdapter(),
|
|
4931
|
-
new WalletConnectWalletAdapter({
|
|
4932
|
-
network: WalletAdapterNetwork.Mainnet,
|
|
4933
|
-
options: {
|
|
4934
|
-
relayUrl: "wss://relay.walletconnect.com"
|
|
4935
|
-
}
|
|
4936
|
-
}),
|
|
4937
|
-
new AlphaWalletAdapter(),
|
|
4938
|
-
new AvanaWalletAdapter(),
|
|
4939
|
-
new BitgetWalletAdapter(),
|
|
4940
|
-
new BitpieWalletAdapter(),
|
|
4941
|
-
new CloverWalletAdapter(),
|
|
4942
|
-
new Coin98WalletAdapter(),
|
|
4943
|
-
new CoinbaseWalletAdapter(),
|
|
4944
|
-
new CoinhubWalletAdapter(),
|
|
4945
|
-
new FractalWalletAdapter(),
|
|
4946
|
-
new HuobiWalletAdapter(),
|
|
4947
|
-
new HyperPayWalletAdapter(),
|
|
4948
|
-
new KeystoneWalletAdapter(),
|
|
4949
|
-
new KrystalWalletAdapter(),
|
|
4950
|
-
new LedgerWalletAdapter(),
|
|
4951
|
-
new MathWalletAdapter(),
|
|
4952
|
-
new NekoWalletAdapter(),
|
|
4953
|
-
new NightlyWalletAdapter(),
|
|
4954
|
-
new NufiWalletAdapter(),
|
|
4955
|
-
new OntoWalletAdapter(),
|
|
4956
|
-
new ParticleAdapter(),
|
|
4957
|
-
new SafePalWalletAdapter(),
|
|
4958
|
-
new SaifuWalletAdapter(),
|
|
4959
|
-
new SalmonWalletAdapter(),
|
|
4960
|
-
new SkyWalletAdapter(),
|
|
4961
|
-
new SolongWalletAdapter(),
|
|
4962
|
-
new SpotWalletAdapter(),
|
|
4963
|
-
new TokenaryWalletAdapter(),
|
|
4964
|
-
new TokenPocketWalletAdapter(),
|
|
4965
|
-
new TorusWalletAdapter(),
|
|
4966
|
-
new TrustWalletAdapter(),
|
|
4967
|
-
new XDEFIWalletAdapter()
|
|
4968
|
-
];
|
|
4969
|
-
function SOLConnectModal({
|
|
4970
|
-
type = "login",
|
|
4971
|
-
onSuccess,
|
|
4972
|
-
...props
|
|
4973
|
-
}) {
|
|
4974
|
-
const intl = useIntl12();
|
|
4975
|
-
return /* @__PURE__ */ jsx23(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
4976
|
-
id: type == "bind" ? "bindWith" : "loginWith"
|
|
4977
|
-
}, {
|
|
4978
|
-
name: "SOL"
|
|
4979
|
-
}), children: /* @__PURE__ */ jsx23(ConnectionProvider, { endpoint: clusterApiUrl("devnet"), children: /* @__PURE__ */ jsx23(WalletProvider, { wallets, autoConnect: true, children: /* @__PURE__ */ jsx23(WalletModalProvider, { children: /* @__PURE__ */ jsx23(WalletContent, { onSuccess, type }) }) }) }) });
|
|
4980
|
-
}
|
|
4981
|
-
function SOLModal(props) {
|
|
4982
|
-
return props.isOpen && /* @__PURE__ */ jsx23(SOLConnectModal, { ...props });
|
|
4983
|
-
}
|
|
4984
|
-
|
|
4985
|
-
// src/components/TRONModal/index.tsx
|
|
4986
|
-
import React8, { useEffect as useEffect19, useMemo as useMemo12, useState as useState21 } from "react";
|
|
4987
|
-
import { useIntl as useIntl13 } from "react-intl";
|
|
4988
|
-
|
|
4989
4805
|
// src/lib/tron/TronLinkAdapter.ts
|
|
4990
4806
|
var TronLinkAdapter = class {
|
|
4991
4807
|
constructor() {
|
|
@@ -5017,7 +4833,7 @@ var TronLinkAdapter = class {
|
|
|
5017
4833
|
};
|
|
5018
4834
|
|
|
5019
4835
|
// src/hooks/useTRONWallet.ts
|
|
5020
|
-
import { useEffect as
|
|
4836
|
+
import { useEffect as useEffect17, useState as useState19 } from "react";
|
|
5021
4837
|
|
|
5022
4838
|
// src/lib/tron/BitgetAdapter.ts
|
|
5023
4839
|
var BitgetAdapter = class {
|
|
@@ -5061,12 +4877,12 @@ var OKXAdapter = class {
|
|
|
5061
4877
|
|
|
5062
4878
|
// src/hooks/useTRONWallet.ts
|
|
5063
4879
|
var useTRONWallet = () => {
|
|
5064
|
-
const
|
|
5065
|
-
const [installedWallets, setInstalledWallets] =
|
|
5066
|
-
const [address, setAddress] =
|
|
5067
|
-
|
|
4880
|
+
const wallets = [new TronLinkAdapter(), new BitgetAdapter(), new OKXAdapter()];
|
|
4881
|
+
const [installedWallets, setInstalledWallets] = useState19([]);
|
|
4882
|
+
const [address, setAddress] = useState19(null);
|
|
4883
|
+
useEffect17(() => {
|
|
5068
4884
|
const getInstalled = async () => {
|
|
5069
|
-
const installed = await Promise.all(
|
|
4885
|
+
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
5070
4886
|
wallet: wallet2,
|
|
5071
4887
|
isInstalled
|
|
5072
4888
|
}))));
|
|
@@ -5074,18 +4890,18 @@ var useTRONWallet = () => {
|
|
|
5074
4890
|
};
|
|
5075
4891
|
getInstalled();
|
|
5076
4892
|
}, []);
|
|
5077
|
-
const [wallet, chooseWallet] =
|
|
4893
|
+
const [wallet, chooseWallet] = useState19(null);
|
|
5078
4894
|
const onConnect = async () => {
|
|
5079
4895
|
setAddress(await wallet.connect());
|
|
5080
4896
|
};
|
|
5081
|
-
|
|
4897
|
+
useEffect17(() => {
|
|
5082
4898
|
if (!wallet) {
|
|
5083
4899
|
setAddress(null);
|
|
5084
4900
|
}
|
|
5085
4901
|
}, [wallet]);
|
|
5086
4902
|
return {
|
|
5087
4903
|
installedWallets,
|
|
5088
|
-
wallets
|
|
4904
|
+
wallets,
|
|
5089
4905
|
chooseWallet,
|
|
5090
4906
|
wallet,
|
|
5091
4907
|
address,
|
|
@@ -5094,24 +4910,24 @@ var useTRONWallet = () => {
|
|
|
5094
4910
|
};
|
|
5095
4911
|
|
|
5096
4912
|
// src/components/TRONModal/index.tsx
|
|
5097
|
-
import { jsx as
|
|
4913
|
+
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5098
4914
|
function TRONConnectModal({
|
|
5099
4915
|
type = "login",
|
|
5100
4916
|
onSuccess,
|
|
5101
4917
|
...props
|
|
5102
4918
|
}) {
|
|
5103
4919
|
const isDownMd = useDownMd();
|
|
5104
|
-
const intl =
|
|
5105
|
-
const { wallets
|
|
4920
|
+
const intl = useIntl12();
|
|
4921
|
+
const { wallets, installedWallets, chooseWallet, wallet, address, onConnect } = useTRONWallet();
|
|
5106
4922
|
const iconMaps = {
|
|
5107
|
-
tronlink: /* @__PURE__ */
|
|
5108
|
-
bitget: /* @__PURE__ */
|
|
5109
|
-
okx: /* @__PURE__ */
|
|
4923
|
+
tronlink: /* @__PURE__ */ jsx23(TronLinkIcon, { size: isDownMd ? 36 : 40 }),
|
|
4924
|
+
bitget: /* @__PURE__ */ jsx23(BitgetIcon, { size: isDownMd ? 36 : 40 }),
|
|
4925
|
+
okx: /* @__PURE__ */ jsx23(OKXIcon, { size: isDownMd ? 36 : 40 })
|
|
5110
4926
|
};
|
|
5111
4927
|
const { events, login } = useMatch();
|
|
5112
|
-
const [status, setStatus] =
|
|
5113
|
-
const statusRef =
|
|
5114
|
-
const [error, setError] =
|
|
4928
|
+
const [status, setStatus] = useState20("");
|
|
4929
|
+
const statusRef = React7.useRef(status);
|
|
4930
|
+
const [error, setError] = useState20("");
|
|
5115
4931
|
const connected = useMemo12(() => {
|
|
5116
4932
|
return !!address;
|
|
5117
4933
|
}, [address]);
|
|
@@ -5167,7 +4983,7 @@ function TRONConnectModal({
|
|
|
5167
4983
|
});
|
|
5168
4984
|
} else {
|
|
5169
4985
|
await login({
|
|
5170
|
-
mid: res1.data.mid,
|
|
4986
|
+
// mid: res1.data.mid,
|
|
5171
4987
|
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
5172
4988
|
});
|
|
5173
4989
|
}
|
|
@@ -5180,7 +4996,7 @@ function TRONConnectModal({
|
|
|
5180
4996
|
statusRef.current = "";
|
|
5181
4997
|
}
|
|
5182
4998
|
};
|
|
5183
|
-
|
|
4999
|
+
useEffect18(() => {
|
|
5184
5000
|
if (wallet) {
|
|
5185
5001
|
console.log("onConnect");
|
|
5186
5002
|
onConnect();
|
|
@@ -5188,21 +5004,21 @@ function TRONConnectModal({
|
|
|
5188
5004
|
setStatus("");
|
|
5189
5005
|
}
|
|
5190
5006
|
}, [wallet]);
|
|
5191
|
-
|
|
5007
|
+
useEffect18(() => {
|
|
5192
5008
|
if (address) {
|
|
5193
5009
|
toLoginInWallet();
|
|
5194
5010
|
}
|
|
5195
5011
|
}, [address]);
|
|
5196
|
-
|
|
5012
|
+
useEffect18(() => {
|
|
5197
5013
|
if (!props.isOpen) {
|
|
5198
5014
|
disconnect();
|
|
5199
5015
|
}
|
|
5200
5016
|
}, [props.isOpen]);
|
|
5201
|
-
return /* @__PURE__ */
|
|
5017
|
+
return /* @__PURE__ */ jsx23(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5202
5018
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5203
5019
|
}, {
|
|
5204
5020
|
name: "TRON"
|
|
5205
|
-
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */
|
|
5021
|
+
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ jsx23(
|
|
5206
5022
|
WalletModalContent,
|
|
5207
5023
|
{
|
|
5208
5024
|
error,
|
|
@@ -5215,9 +5031,9 @@ function TRONConnectModal({
|
|
|
5215
5031
|
setVisible: () => {
|
|
5216
5032
|
}
|
|
5217
5033
|
}
|
|
5218
|
-
) : /* @__PURE__ */
|
|
5034
|
+
) : /* @__PURE__ */ jsx23("div", { className: "matchid-login-box", children: /* @__PURE__ */ jsxs17("div", { className: "matchid-login-recommend-list", children: [
|
|
5219
5035
|
installedWallets.map((wallet2) => {
|
|
5220
|
-
return /* @__PURE__ */
|
|
5036
|
+
return /* @__PURE__ */ jsx23(
|
|
5221
5037
|
RecommendItem,
|
|
5222
5038
|
{
|
|
5223
5039
|
icon: iconMaps[wallet2.walletKey],
|
|
@@ -5229,15 +5045,15 @@ function TRONConnectModal({
|
|
|
5229
5045
|
wallet2.walletKey
|
|
5230
5046
|
);
|
|
5231
5047
|
}),
|
|
5232
|
-
|
|
5233
|
-
return /* @__PURE__ */
|
|
5048
|
+
wallets.filter((wallet2) => !installedWallets.find((installedWallet) => installedWallet.walletKey == wallet2.walletKey)).map((wallet2) => {
|
|
5049
|
+
return /* @__PURE__ */ jsx23(
|
|
5234
5050
|
RecommendItem,
|
|
5235
5051
|
{
|
|
5236
5052
|
icon: iconMaps[wallet2.walletKey],
|
|
5237
5053
|
name: wallet2.name,
|
|
5238
5054
|
onClick: () => {
|
|
5239
5055
|
},
|
|
5240
|
-
footer: /* @__PURE__ */
|
|
5056
|
+
footer: /* @__PURE__ */ jsx23(Button, { size: "sm", onClick: () => {
|
|
5241
5057
|
window.open(wallet2.website);
|
|
5242
5058
|
}, children: "Install" })
|
|
5243
5059
|
},
|
|
@@ -5247,12 +5063,12 @@ function TRONConnectModal({
|
|
|
5247
5063
|
] }) }) });
|
|
5248
5064
|
}
|
|
5249
5065
|
function TRONModal(props) {
|
|
5250
|
-
return props.isOpen && /* @__PURE__ */
|
|
5066
|
+
return props.isOpen && /* @__PURE__ */ jsx23(TRONConnectModal, { ...props, type: props.type });
|
|
5251
5067
|
}
|
|
5252
5068
|
|
|
5253
5069
|
// src/components/TONModal/index.tsx
|
|
5254
|
-
import
|
|
5255
|
-
import { useIntl as
|
|
5070
|
+
import React8, { useEffect as useEffect19, useState as useState21 } from "react";
|
|
5071
|
+
import { useIntl as useIntl13 } from "react-intl";
|
|
5256
5072
|
import {
|
|
5257
5073
|
TonConnectUIProvider,
|
|
5258
5074
|
useTonAddress,
|
|
@@ -5260,21 +5076,21 @@ import {
|
|
|
5260
5076
|
useTonConnectUI,
|
|
5261
5077
|
useTonWallet
|
|
5262
5078
|
} from "@tonconnect/ui-react";
|
|
5263
|
-
import { jsx as
|
|
5264
|
-
function
|
|
5079
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
5080
|
+
function WalletContent({
|
|
5265
5081
|
onSuccess,
|
|
5266
5082
|
type
|
|
5267
5083
|
}) {
|
|
5268
5084
|
const { events, login } = useMatch();
|
|
5269
|
-
const [connected, setConnected] =
|
|
5085
|
+
const [connected, setConnected] = useState21(false);
|
|
5270
5086
|
const wallet = useTonWallet();
|
|
5271
5087
|
const userFriendlyAddress = useTonAddress();
|
|
5272
5088
|
const [tonConnectUI] = useTonConnectUI();
|
|
5273
5089
|
const { state, open, close } = useTonConnectModal();
|
|
5274
|
-
const [status, setStatus] =
|
|
5275
|
-
const statusRef =
|
|
5276
|
-
const [error, setError] =
|
|
5277
|
-
|
|
5090
|
+
const [status, setStatus] = useState21("");
|
|
5091
|
+
const statusRef = React8.useRef(status);
|
|
5092
|
+
const [error, setError] = useState21("");
|
|
5093
|
+
useEffect19(() => {
|
|
5278
5094
|
const init = async () => {
|
|
5279
5095
|
if (tonConnectUI.connected) {
|
|
5280
5096
|
await tonConnectUI.disconnect();
|
|
@@ -5331,7 +5147,7 @@ function WalletContent2({
|
|
|
5331
5147
|
});
|
|
5332
5148
|
} else {
|
|
5333
5149
|
await login({
|
|
5334
|
-
mid: res1.data.mid,
|
|
5150
|
+
// mid: res1.data.mid,
|
|
5335
5151
|
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
5336
5152
|
});
|
|
5337
5153
|
}
|
|
@@ -5347,7 +5163,7 @@ function WalletContent2({
|
|
|
5347
5163
|
}
|
|
5348
5164
|
});
|
|
5349
5165
|
}, []);
|
|
5350
|
-
|
|
5166
|
+
useEffect19(() => {
|
|
5351
5167
|
if (wallet) {
|
|
5352
5168
|
setConnected(true);
|
|
5353
5169
|
console.log("Wallet connected:", wallet);
|
|
@@ -5358,7 +5174,7 @@ function WalletContent2({
|
|
|
5358
5174
|
setStatus("");
|
|
5359
5175
|
}
|
|
5360
5176
|
}, [wallet]);
|
|
5361
|
-
|
|
5177
|
+
useEffect19(() => {
|
|
5362
5178
|
console.log({
|
|
5363
5179
|
state,
|
|
5364
5180
|
wallet
|
|
@@ -5387,7 +5203,7 @@ function WalletContent2({
|
|
|
5387
5203
|
}
|
|
5388
5204
|
}
|
|
5389
5205
|
}, [state]);
|
|
5390
|
-
return /* @__PURE__ */
|
|
5206
|
+
return /* @__PURE__ */ jsx24(
|
|
5391
5207
|
WalletModalContent,
|
|
5392
5208
|
{
|
|
5393
5209
|
connected,
|
|
@@ -5418,28 +5234,28 @@ function TONConnectModal({
|
|
|
5418
5234
|
onSuccess,
|
|
5419
5235
|
...props
|
|
5420
5236
|
}) {
|
|
5421
|
-
const intl =
|
|
5237
|
+
const intl = useIntl13();
|
|
5422
5238
|
const { endpoints, appid } = useLocalStore_default();
|
|
5423
5239
|
const manifestUrl = `${endpoints.back}api/v1/wallet/ton?appid=${appid}&url=` + encodeURIComponent(window.location.origin);
|
|
5424
|
-
return /* @__PURE__ */
|
|
5240
|
+
return /* @__PURE__ */ jsx24(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5425
5241
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5426
5242
|
}, {
|
|
5427
5243
|
name: "TON"
|
|
5428
|
-
}), children: /* @__PURE__ */
|
|
5244
|
+
}), children: /* @__PURE__ */ jsx24(
|
|
5429
5245
|
TonConnectUIProvider,
|
|
5430
5246
|
{
|
|
5431
5247
|
manifestUrl,
|
|
5432
|
-
children: /* @__PURE__ */
|
|
5248
|
+
children: /* @__PURE__ */ jsx24(WalletContent, { onSuccess, type })
|
|
5433
5249
|
}
|
|
5434
5250
|
) });
|
|
5435
5251
|
}
|
|
5436
5252
|
function TONModal(props) {
|
|
5437
|
-
return props.isOpen && /* @__PURE__ */
|
|
5253
|
+
return props.isOpen && /* @__PURE__ */ jsx24(TONConnectModal, { ...props });
|
|
5438
5254
|
}
|
|
5439
5255
|
|
|
5440
5256
|
// src/components/BTCModal/index.tsx
|
|
5441
|
-
import
|
|
5442
|
-
import { useIntl as
|
|
5257
|
+
import React9, { useEffect as useEffect21, useMemo as useMemo13, useState as useState23 } from "react";
|
|
5258
|
+
import { useIntl as useIntl14 } from "react-intl";
|
|
5443
5259
|
|
|
5444
5260
|
// src/lib/btc/UnisatAdapter.ts
|
|
5445
5261
|
var UnisatAdapter = class {
|
|
@@ -5585,7 +5401,7 @@ var LeatherAdapter = class {
|
|
|
5585
5401
|
return response.result.addresses[0].address;
|
|
5586
5402
|
}
|
|
5587
5403
|
async signMessage(message) {
|
|
5588
|
-
if (!await this.isInstalled()) throw new Error("
|
|
5404
|
+
if (!await this.isInstalled()) throw new Error("Leather Wallet is not installed");
|
|
5589
5405
|
const response = await window.LeatherProvider?.request("signMessage", { message });
|
|
5590
5406
|
matchlog_default.log("response", response);
|
|
5591
5407
|
return response.result.signature;
|
|
@@ -5593,14 +5409,49 @@ var LeatherAdapter = class {
|
|
|
5593
5409
|
};
|
|
5594
5410
|
|
|
5595
5411
|
// src/hooks/useBTCWallet.ts
|
|
5596
|
-
import { useEffect as
|
|
5412
|
+
import { useEffect as useEffect20, useState as useState22 } from "react";
|
|
5413
|
+
|
|
5414
|
+
// src/lib/btc/PhantomAdapter.ts
|
|
5415
|
+
var PhantomAdapter = class {
|
|
5416
|
+
constructor() {
|
|
5417
|
+
this.name = "Phantom Wallet";
|
|
5418
|
+
this.website = "https://www.phantom.com/";
|
|
5419
|
+
this.walletKey = "phantom";
|
|
5420
|
+
}
|
|
5421
|
+
async isInstalled() {
|
|
5422
|
+
return typeof window.phantom !== "undefined" && typeof window.phantom.bitcoin !== "undefined";
|
|
5423
|
+
}
|
|
5424
|
+
async connect() {
|
|
5425
|
+
if (!await this.isInstalled()) throw new Error("Phantom Wallet is not installed");
|
|
5426
|
+
const response = await window.phantom.bitcoin.requestAccounts();
|
|
5427
|
+
const ordinalAddress = response.find((n) => n.purpose == "ordinals");
|
|
5428
|
+
matchlog_default.log("Addresses:", ordinalAddress);
|
|
5429
|
+
if (!ordinalAddress) {
|
|
5430
|
+
throw new Error("No addresses found in Phantom Wallet");
|
|
5431
|
+
}
|
|
5432
|
+
return ordinalAddress.address;
|
|
5433
|
+
}
|
|
5434
|
+
async signMessage(message) {
|
|
5435
|
+
if (!await this.isInstalled()) throw new Error("Phantom Wallet is not installed");
|
|
5436
|
+
const address = await this.connect();
|
|
5437
|
+
try {
|
|
5438
|
+
const { signature } = await window.phantom.bitcoin.signMessage(address, new TextEncoder().encode(message));
|
|
5439
|
+
return bytesToBase64(signature);
|
|
5440
|
+
} catch (error) {
|
|
5441
|
+
console.error(error);
|
|
5442
|
+
throw error;
|
|
5443
|
+
}
|
|
5444
|
+
}
|
|
5445
|
+
};
|
|
5446
|
+
|
|
5447
|
+
// src/hooks/useBTCWallet.ts
|
|
5597
5448
|
var useBTCWallet = () => {
|
|
5598
|
-
const
|
|
5599
|
-
const [installedWallets, setInstalledWallets] =
|
|
5600
|
-
const [address, setAddress] =
|
|
5601
|
-
|
|
5449
|
+
const wallets = [new UnisatAdapter(), new XverseAdapter(), new LeatherAdapter(), new PhantomAdapter()];
|
|
5450
|
+
const [installedWallets, setInstalledWallets] = useState22([]);
|
|
5451
|
+
const [address, setAddress] = useState22(null);
|
|
5452
|
+
useEffect20(() => {
|
|
5602
5453
|
const getInstalled = async () => {
|
|
5603
|
-
const installed = await Promise.all(
|
|
5454
|
+
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
5604
5455
|
wallet: wallet2,
|
|
5605
5456
|
isInstalled
|
|
5606
5457
|
}))));
|
|
@@ -5608,18 +5459,18 @@ var useBTCWallet = () => {
|
|
|
5608
5459
|
};
|
|
5609
5460
|
getInstalled();
|
|
5610
5461
|
}, []);
|
|
5611
|
-
const [wallet, chooseWallet] =
|
|
5462
|
+
const [wallet, chooseWallet] = useState22(null);
|
|
5612
5463
|
const onConnect = async () => {
|
|
5613
5464
|
setAddress(await wallet.connect());
|
|
5614
5465
|
};
|
|
5615
|
-
|
|
5466
|
+
useEffect20(() => {
|
|
5616
5467
|
if (!wallet) {
|
|
5617
5468
|
setAddress(null);
|
|
5618
5469
|
}
|
|
5619
5470
|
}, [wallet]);
|
|
5620
5471
|
return {
|
|
5621
5472
|
installedWallets,
|
|
5622
|
-
wallets
|
|
5473
|
+
wallets,
|
|
5623
5474
|
chooseWallet,
|
|
5624
5475
|
wallet,
|
|
5625
5476
|
address,
|
|
@@ -5628,24 +5479,25 @@ var useBTCWallet = () => {
|
|
|
5628
5479
|
};
|
|
5629
5480
|
|
|
5630
5481
|
// src/components/BTCModal/index.tsx
|
|
5631
|
-
import { jsx as
|
|
5482
|
+
import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5632
5483
|
function BTCConnectModal({
|
|
5633
5484
|
type = "login",
|
|
5634
5485
|
onSuccess,
|
|
5635
5486
|
...props
|
|
5636
5487
|
}) {
|
|
5637
5488
|
const isDownMd = useDownMd();
|
|
5638
|
-
const intl =
|
|
5639
|
-
const { wallets
|
|
5489
|
+
const intl = useIntl14();
|
|
5490
|
+
const { wallets, installedWallets, chooseWallet, wallet, address, onConnect } = useBTCWallet();
|
|
5640
5491
|
const iconMaps = {
|
|
5641
|
-
leather: /* @__PURE__ */
|
|
5642
|
-
unisat: /* @__PURE__ */
|
|
5643
|
-
xverse: /* @__PURE__ */
|
|
5492
|
+
leather: /* @__PURE__ */ jsx25(LeatherIcon, { size: isDownMd ? 36 : 40 }),
|
|
5493
|
+
unisat: /* @__PURE__ */ jsx25(UnisatIcon, { size: isDownMd ? 36 : 40 }),
|
|
5494
|
+
xverse: /* @__PURE__ */ jsx25(XverseIcon, { size: isDownMd ? 36 : 40 }),
|
|
5495
|
+
phantom: /* @__PURE__ */ jsx25(PhantomIcon, { size: isDownMd ? 36 : 40 })
|
|
5644
5496
|
};
|
|
5645
5497
|
const { events, login } = useMatch();
|
|
5646
|
-
const [status, setStatus] =
|
|
5647
|
-
const statusRef =
|
|
5648
|
-
const [error, setError] =
|
|
5498
|
+
const [status, setStatus] = useState23("");
|
|
5499
|
+
const statusRef = React9.useRef(status);
|
|
5500
|
+
const [error, setError] = useState23("");
|
|
5649
5501
|
const connected = useMemo13(() => {
|
|
5650
5502
|
return !!address;
|
|
5651
5503
|
}, [address]);
|
|
@@ -5696,7 +5548,7 @@ function BTCConnectModal({
|
|
|
5696
5548
|
});
|
|
5697
5549
|
} else {
|
|
5698
5550
|
await login({
|
|
5699
|
-
mid: res1.data.mid,
|
|
5551
|
+
// mid: res1.data.mid,
|
|
5700
5552
|
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
5701
5553
|
});
|
|
5702
5554
|
}
|
|
@@ -5710,7 +5562,7 @@ function BTCConnectModal({
|
|
|
5710
5562
|
statusRef.current = "";
|
|
5711
5563
|
}
|
|
5712
5564
|
};
|
|
5713
|
-
|
|
5565
|
+
useEffect21(() => {
|
|
5714
5566
|
if (wallet) {
|
|
5715
5567
|
console.log("onConnect");
|
|
5716
5568
|
try {
|
|
@@ -5723,12 +5575,12 @@ function BTCConnectModal({
|
|
|
5723
5575
|
setStatus("");
|
|
5724
5576
|
}
|
|
5725
5577
|
}, [wallet]);
|
|
5726
|
-
|
|
5578
|
+
useEffect21(() => {
|
|
5727
5579
|
if (address) {
|
|
5728
5580
|
toLoginInWallet();
|
|
5729
5581
|
}
|
|
5730
5582
|
}, [address]);
|
|
5731
|
-
|
|
5583
|
+
useEffect21(() => {
|
|
5732
5584
|
if (!props.isOpen) {
|
|
5733
5585
|
disconnect();
|
|
5734
5586
|
}
|
|
@@ -5740,11 +5592,11 @@ function BTCConnectModal({
|
|
|
5740
5592
|
statusRef.current = "";
|
|
5741
5593
|
setError("");
|
|
5742
5594
|
};
|
|
5743
|
-
return /* @__PURE__ */
|
|
5595
|
+
return /* @__PURE__ */ jsx25(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5744
5596
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5745
5597
|
}, {
|
|
5746
5598
|
name: "BTC"
|
|
5747
|
-
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */
|
|
5599
|
+
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ jsx25(
|
|
5748
5600
|
WalletModalContent,
|
|
5749
5601
|
{
|
|
5750
5602
|
error,
|
|
@@ -5757,9 +5609,9 @@ function BTCConnectModal({
|
|
|
5757
5609
|
setVisible: () => {
|
|
5758
5610
|
}
|
|
5759
5611
|
}
|
|
5760
|
-
) : /* @__PURE__ */
|
|
5612
|
+
) : /* @__PURE__ */ jsx25("div", { className: "matchid-login-box", children: /* @__PURE__ */ jsxs18("div", { className: "matchid-login-recommend-list", children: [
|
|
5761
5613
|
installedWallets.map((wallet2) => {
|
|
5762
|
-
return /* @__PURE__ */
|
|
5614
|
+
return /* @__PURE__ */ jsx25(
|
|
5763
5615
|
RecommendItem,
|
|
5764
5616
|
{
|
|
5765
5617
|
icon: iconMaps[wallet2.walletKey],
|
|
@@ -5771,15 +5623,15 @@ function BTCConnectModal({
|
|
|
5771
5623
|
wallet2.walletKey
|
|
5772
5624
|
);
|
|
5773
5625
|
}),
|
|
5774
|
-
|
|
5775
|
-
return /* @__PURE__ */
|
|
5626
|
+
wallets.filter((wallet2) => !installedWallets.find((installedWallet) => installedWallet.walletKey == wallet2.walletKey)).map((wallet2) => {
|
|
5627
|
+
return /* @__PURE__ */ jsx25(
|
|
5776
5628
|
RecommendItem,
|
|
5777
5629
|
{
|
|
5778
5630
|
icon: iconMaps[wallet2.walletKey],
|
|
5779
5631
|
name: wallet2.name,
|
|
5780
5632
|
onClick: () => {
|
|
5781
5633
|
},
|
|
5782
|
-
footer: /* @__PURE__ */
|
|
5634
|
+
footer: /* @__PURE__ */ jsx25(Button, { size: "sm", onClick: () => {
|
|
5783
5635
|
window.open(wallet2.website);
|
|
5784
5636
|
}, children: "Install" })
|
|
5785
5637
|
},
|
|
@@ -5789,19 +5641,19 @@ function BTCConnectModal({
|
|
|
5789
5641
|
] }) }) });
|
|
5790
5642
|
}
|
|
5791
5643
|
function BTCModal(props) {
|
|
5792
|
-
return props.isOpen && /* @__PURE__ */
|
|
5644
|
+
return props.isOpen && /* @__PURE__ */ jsx25(BTCConnectModal, { ...props });
|
|
5793
5645
|
}
|
|
5794
5646
|
|
|
5795
5647
|
// src/components/WalletModal/index.tsx
|
|
5796
5648
|
import { useMemo as useMemo14 } from "react";
|
|
5797
|
-
import { useIntl as
|
|
5798
|
-
import { jsx as
|
|
5649
|
+
import { useIntl as useIntl15 } from "react-intl";
|
|
5650
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
5799
5651
|
function WalletConnectModal({
|
|
5800
5652
|
type,
|
|
5801
5653
|
methods: _methods,
|
|
5802
5654
|
...props
|
|
5803
5655
|
}) {
|
|
5804
|
-
const intl =
|
|
5656
|
+
const intl = useIntl15();
|
|
5805
5657
|
const { walletMap } = useWalletConfig();
|
|
5806
5658
|
const { bind, login } = useUserInfo();
|
|
5807
5659
|
const config = useAppConfig();
|
|
@@ -5813,13 +5665,13 @@ function WalletConnectModal({
|
|
|
5813
5665
|
const platform = config.platform.map((p) => p.toLowerCase());
|
|
5814
5666
|
return WALLET_METHODS.filter((m) => platform.includes(m));
|
|
5815
5667
|
}, [config.platform, _methods]);
|
|
5816
|
-
return /* @__PURE__ */
|
|
5668
|
+
return /* @__PURE__ */ jsx26(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5817
5669
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5818
5670
|
}, {
|
|
5819
5671
|
name: ""
|
|
5820
|
-
}), children: /* @__PURE__ */
|
|
5672
|
+
}), children: /* @__PURE__ */ jsx26("div", { className: "matchid-login-box", children: /* @__PURE__ */ jsx26("div", { className: "matchid-login-recommend-list", children: methods.map((method, index) => {
|
|
5821
5673
|
const m = walletMap[method];
|
|
5822
|
-
return /* @__PURE__ */
|
|
5674
|
+
return /* @__PURE__ */ jsx26(
|
|
5823
5675
|
RecommendItem,
|
|
5824
5676
|
{
|
|
5825
5677
|
icon: m?.icon,
|
|
@@ -5833,21 +5685,21 @@ function WalletConnectModal({
|
|
|
5833
5685
|
}) }) }) });
|
|
5834
5686
|
}
|
|
5835
5687
|
function WalletModal(props) {
|
|
5836
|
-
return props.isOpen && /* @__PURE__ */
|
|
5688
|
+
return props.isOpen && /* @__PURE__ */ jsx26(WalletConnectModal, { ...props });
|
|
5837
5689
|
}
|
|
5838
5690
|
|
|
5839
5691
|
// src/components/AlphaAvatar/index.tsx
|
|
5840
|
-
import { useEffect as
|
|
5841
|
-
import { jsx as
|
|
5692
|
+
import { useEffect as useEffect22, useState as useState24 } from "react";
|
|
5693
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
5842
5694
|
function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
5843
|
-
const [avatar, setAvatar] =
|
|
5844
|
-
|
|
5695
|
+
const [avatar, setAvatar] = useState24(void 0);
|
|
5696
|
+
useEffect22(() => {
|
|
5845
5697
|
if (name) {
|
|
5846
5698
|
const char = name[0].toUpperCase();
|
|
5847
5699
|
setAvatar(char);
|
|
5848
5700
|
}
|
|
5849
5701
|
}, [name]);
|
|
5850
|
-
return /* @__PURE__ */
|
|
5702
|
+
return /* @__PURE__ */ jsx27("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
5851
5703
|
width: size,
|
|
5852
5704
|
height: size,
|
|
5853
5705
|
fontSize: Math.ceil(size / 2)
|
|
@@ -5855,7 +5707,7 @@ function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
|
5855
5707
|
}
|
|
5856
5708
|
|
|
5857
5709
|
// src/components/WalletAsset/index.tsx
|
|
5858
|
-
import { jsx as
|
|
5710
|
+
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5859
5711
|
function WalletAsset({
|
|
5860
5712
|
onAssetClick,
|
|
5861
5713
|
matchWalletAssetsOptions
|
|
@@ -5865,7 +5717,7 @@ function WalletAsset({
|
|
|
5865
5717
|
list: walletAssets.mergedAssets
|
|
5866
5718
|
});
|
|
5867
5719
|
const { list } = useMatchChain();
|
|
5868
|
-
return /* @__PURE__ */
|
|
5720
|
+
return /* @__PURE__ */ jsx28("div", { className: "matchid-wallet-asset-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
5869
5721
|
const clickFunc = onAssetClick && onAssetClick(n);
|
|
5870
5722
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
5871
5723
|
const getFooterColor = () => {
|
|
@@ -5884,7 +5736,7 @@ function WalletAsset({
|
|
|
5884
5736
|
cursor: clickFunc ? "pointer" : "default"
|
|
5885
5737
|
}, children: [
|
|
5886
5738
|
/* @__PURE__ */ jsxs19("div", { className: "matchid-wallet-asset-logo", title: n.symbol || n.name || "", children: [
|
|
5887
|
-
n.icon ? /* @__PURE__ */
|
|
5739
|
+
n.icon ? /* @__PURE__ */ jsx28("img", { src: n.icon, alt: n.symbol, className: `matchid-wallet-asset-icon` }) : /* @__PURE__ */ jsx28(
|
|
5888
5740
|
AlphaAvatar2,
|
|
5889
5741
|
{
|
|
5890
5742
|
className: `matchid-wallet-asset-icon`,
|
|
@@ -5892,12 +5744,12 @@ function WalletAsset({
|
|
|
5892
5744
|
name: n.symbol || n.name || ""
|
|
5893
5745
|
}
|
|
5894
5746
|
),
|
|
5895
|
-
chain?.iconUrl && /* @__PURE__ */
|
|
5747
|
+
chain?.iconUrl && /* @__PURE__ */ jsx28("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-wallet-asset-chain` })
|
|
5896
5748
|
] }),
|
|
5897
5749
|
/* @__PURE__ */ jsxs19("div", { className: `matchid-wallet-asset-info`, children: [
|
|
5898
|
-
/* @__PURE__ */
|
|
5750
|
+
/* @__PURE__ */ jsx28("div", { className: `matchid-wallet-asset-name`, children: n.symbol }),
|
|
5899
5751
|
"price" in n && /* @__PURE__ */ jsxs19("div", { className: `matchid-wallet-asset-content`, children: [
|
|
5900
|
-
/* @__PURE__ */
|
|
5752
|
+
/* @__PURE__ */ jsx28("div", { className: "matchid-wallet-asset-price", children: /* @__PURE__ */ jsx28(
|
|
5901
5753
|
NumberFormatter,
|
|
5902
5754
|
{
|
|
5903
5755
|
value: n.price,
|
|
@@ -5905,7 +5757,7 @@ function WalletAsset({
|
|
|
5905
5757
|
tFixNum: 2
|
|
5906
5758
|
}
|
|
5907
5759
|
) }),
|
|
5908
|
-
/* @__PURE__ */
|
|
5760
|
+
/* @__PURE__ */ jsx28("div", { className: "matchid-wallet-asset-value", children: /* @__PURE__ */ jsx28(
|
|
5909
5761
|
NumberFormatter,
|
|
5910
5762
|
{
|
|
5911
5763
|
value: n.value,
|
|
@@ -5915,14 +5767,14 @@ function WalletAsset({
|
|
|
5915
5767
|
) })
|
|
5916
5768
|
] }),
|
|
5917
5769
|
/* @__PURE__ */ jsxs19("div", { className: `matchid-wallet-asset-footer`, children: [
|
|
5918
|
-
/* @__PURE__ */
|
|
5770
|
+
/* @__PURE__ */ jsx28("div", { className: `matchid-wallet-asset-balance`, children: /* @__PURE__ */ jsx28(
|
|
5919
5771
|
NumberFormatter,
|
|
5920
5772
|
{
|
|
5921
5773
|
value: n.balance,
|
|
5922
5774
|
tFixNum: 3
|
|
5923
5775
|
}
|
|
5924
5776
|
) }),
|
|
5925
|
-
"price_change_24h" in n && /* @__PURE__ */
|
|
5777
|
+
"price_change_24h" in n && /* @__PURE__ */ jsx28("div", { className: `matchid-wallet-asset-change ${getFooterColor()}`, children: /* @__PURE__ */ jsx28(
|
|
5926
5778
|
NumberFormatter,
|
|
5927
5779
|
{
|
|
5928
5780
|
prefix: `${(n?.price_change_24h || 0) < 0 ? "-" : "+"} `,
|
|
@@ -5938,10 +5790,10 @@ function WalletAsset({
|
|
|
5938
5790
|
}
|
|
5939
5791
|
|
|
5940
5792
|
// src/components/TokenSend/index.tsx
|
|
5941
|
-
import { useEffect as
|
|
5793
|
+
import { useEffect as useEffect23, useMemo as useMemo15, useState as useState25 } from "react";
|
|
5942
5794
|
import { defineChain as defineChain4, encodeFunctionData as encodeFunctionData2, erc20Abi as erc20Abi3, http as http6, parseUnits as parseUnits2 } from "viem";
|
|
5943
|
-
import { FormattedMessage as FormattedMessage12, useIntl as
|
|
5944
|
-
import { jsx as
|
|
5795
|
+
import { FormattedMessage as FormattedMessage12, useIntl as useIntl16 } from "react-intl";
|
|
5796
|
+
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5945
5797
|
function Input2({
|
|
5946
5798
|
onChange,
|
|
5947
5799
|
placeholder,
|
|
@@ -5952,7 +5804,7 @@ function Input2({
|
|
|
5952
5804
|
size = "df"
|
|
5953
5805
|
}) {
|
|
5954
5806
|
return /* @__PURE__ */ jsxs20("div", { className: `matchid-token-input-box ${"matchid-token-input-" + size}`, children: [
|
|
5955
|
-
/* @__PURE__ */
|
|
5807
|
+
/* @__PURE__ */ jsx29(
|
|
5956
5808
|
"input",
|
|
5957
5809
|
{
|
|
5958
5810
|
placeholder,
|
|
@@ -5963,7 +5815,7 @@ function Input2({
|
|
|
5963
5815
|
className: `matchid-token-input ${error ? "matchid-token-input-error" : ""}`
|
|
5964
5816
|
}
|
|
5965
5817
|
),
|
|
5966
|
-
error && /* @__PURE__ */
|
|
5818
|
+
error && /* @__PURE__ */ jsx29("div", { className: "matchid-token-input-error-text", children: error })
|
|
5967
5819
|
] });
|
|
5968
5820
|
}
|
|
5969
5821
|
function TokenSend({
|
|
@@ -5973,7 +5825,7 @@ function TokenSend({
|
|
|
5973
5825
|
onBack
|
|
5974
5826
|
}) {
|
|
5975
5827
|
const { list: chainList } = useMatchChain();
|
|
5976
|
-
const intl =
|
|
5828
|
+
const intl = useIntl16();
|
|
5977
5829
|
const { createWalletClient: createWalletClient2 } = useWallet();
|
|
5978
5830
|
const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
|
|
5979
5831
|
const chain = useMemo15(() => {
|
|
@@ -5986,11 +5838,11 @@ function TokenSend({
|
|
|
5986
5838
|
transport: http6()
|
|
5987
5839
|
});
|
|
5988
5840
|
}, [chain]);
|
|
5989
|
-
const [amount, setAmount] =
|
|
5990
|
-
const [address, setAddress] =
|
|
5991
|
-
const [loading, setLoading] =
|
|
5992
|
-
const [sending, setSending] =
|
|
5993
|
-
const [txError, setTxError] =
|
|
5841
|
+
const [amount, setAmount] = useState25("");
|
|
5842
|
+
const [address, setAddress] = useState25("");
|
|
5843
|
+
const [loading, setLoading] = useState25(false);
|
|
5844
|
+
const [sending, setSending] = useState25(false);
|
|
5845
|
+
const [txError, setTxError] = useState25("");
|
|
5994
5846
|
const transaction = useMemo15(() => {
|
|
5995
5847
|
const reg = /^0x[a-fA-F0-9]{40}$/;
|
|
5996
5848
|
if (!amount || !address || !reg.test(address)) {
|
|
@@ -6075,7 +5927,7 @@ function TokenSend({
|
|
|
6075
5927
|
}
|
|
6076
5928
|
onClose();
|
|
6077
5929
|
};
|
|
6078
|
-
|
|
5930
|
+
useEffect23(() => {
|
|
6079
5931
|
const receiveMessage = (event) => {
|
|
6080
5932
|
if (event.data) {
|
|
6081
5933
|
if (event.data.source == "match-wallet") {
|
|
@@ -6091,24 +5943,24 @@ function TokenSend({
|
|
|
6091
5943
|
window.removeEventListener("message", receiveMessage);
|
|
6092
5944
|
};
|
|
6093
5945
|
}, []);
|
|
6094
|
-
return /* @__PURE__ */
|
|
5946
|
+
return /* @__PURE__ */ jsx29(ModalDrawer, { isOpen: true, onClose, zIndex, title: /* @__PURE__ */ jsx29(FormattedMessage12, { id: "send" }), onBack, children: /* @__PURE__ */ jsxs20("div", { className: `matchid-token-send-box`, children: [
|
|
6095
5947
|
/* @__PURE__ */ jsxs20("div", { className: "matchid-token-send-content", children: [
|
|
6096
5948
|
/* @__PURE__ */ jsxs20("div", { className: `matchid-token-amount-content`, children: [
|
|
6097
5949
|
/* @__PURE__ */ jsxs20("div", { className: `matchid-token-amount-header`, children: [
|
|
6098
|
-
/* @__PURE__ */
|
|
5950
|
+
/* @__PURE__ */ jsx29("div", { className: `matchid-token-amount-title`, children: /* @__PURE__ */ jsx29(FormattedMessage12, { id: "amount" }) }),
|
|
6099
5951
|
/* @__PURE__ */ jsxs20("div", { className: `matchid-token-amount-chain`, children: [
|
|
6100
|
-
token.icon ? /* @__PURE__ */
|
|
5952
|
+
token.icon ? /* @__PURE__ */ jsx29(
|
|
6101
5953
|
"img",
|
|
6102
5954
|
{
|
|
6103
5955
|
src: token?.icon,
|
|
6104
5956
|
alt: token?.symbol,
|
|
6105
5957
|
className: `matchid-token-amount-chain-icon`
|
|
6106
5958
|
}
|
|
6107
|
-
) : /* @__PURE__ */
|
|
6108
|
-
/* @__PURE__ */
|
|
5959
|
+
) : /* @__PURE__ */ jsx29(AlphaAvatar, { name: token.symbol || token.name || "", size: 16 }),
|
|
5960
|
+
/* @__PURE__ */ jsx29("span", { children: token?.symbol })
|
|
6109
5961
|
] })
|
|
6110
5962
|
] }),
|
|
6111
|
-
/* @__PURE__ */
|
|
5963
|
+
/* @__PURE__ */ jsx29(
|
|
6112
5964
|
Input2,
|
|
6113
5965
|
{
|
|
6114
5966
|
type: "text",
|
|
@@ -6123,16 +5975,16 @@ function TokenSend({
|
|
|
6123
5975
|
),
|
|
6124
5976
|
/* @__PURE__ */ jsxs20("div", { className: `matchid-token-amount-footer`, children: [
|
|
6125
5977
|
/* @__PURE__ */ jsxs20("div", { className: `matchid-token-amount-title`, children: [
|
|
6126
|
-
/* @__PURE__ */
|
|
5978
|
+
/* @__PURE__ */ jsx29(FormattedMessage12, { id: "balance" }),
|
|
6127
5979
|
":"
|
|
6128
5980
|
] }),
|
|
6129
|
-
/* @__PURE__ */
|
|
5981
|
+
/* @__PURE__ */ jsx29("div", { className: `matchid-token-amount-value`, children: /* @__PURE__ */ jsx29(NumberFormatter, { value: token.balance, tFixNum: 10, suffix: " " + token.symbol }) })
|
|
6130
5982
|
] }),
|
|
6131
|
-
/* @__PURE__ */
|
|
5983
|
+
/* @__PURE__ */ jsx29(TransferIcon, { className: "matchid-token-amount-transfer" })
|
|
6132
5984
|
] }),
|
|
6133
5985
|
/* @__PURE__ */ jsxs20("div", { className: `matchid-token-address-content`, children: [
|
|
6134
|
-
/* @__PURE__ */
|
|
6135
|
-
/* @__PURE__ */
|
|
5986
|
+
/* @__PURE__ */ jsx29("div", { className: `matchid-token-address-header`, children: /* @__PURE__ */ jsx29("div", { className: `matchid-token-address-title`, children: /* @__PURE__ */ jsx29(FormattedMessage12, { id: "receiveTitle" }) }) }),
|
|
5987
|
+
/* @__PURE__ */ jsx29(
|
|
6136
5988
|
Input2,
|
|
6137
5989
|
{
|
|
6138
5990
|
type: "text",
|
|
@@ -6148,7 +6000,7 @@ function TokenSend({
|
|
|
6148
6000
|
)
|
|
6149
6001
|
] })
|
|
6150
6002
|
] }),
|
|
6151
|
-
/* @__PURE__ */
|
|
6003
|
+
/* @__PURE__ */ jsx29(
|
|
6152
6004
|
Button,
|
|
6153
6005
|
{
|
|
6154
6006
|
size: "lg",
|
|
@@ -6157,15 +6009,15 @@ function TokenSend({
|
|
|
6157
6009
|
disabled: !canSend || !!txError,
|
|
6158
6010
|
onClick: onNext,
|
|
6159
6011
|
loading: loading || sending,
|
|
6160
|
-
children: /* @__PURE__ */
|
|
6012
|
+
children: /* @__PURE__ */ jsx29(FormattedMessage12, { id: "next" })
|
|
6161
6013
|
}
|
|
6162
6014
|
)
|
|
6163
6015
|
] }) });
|
|
6164
6016
|
}
|
|
6165
6017
|
|
|
6166
6018
|
// src/components/TokenDetail/index.tsx
|
|
6167
|
-
import { FormattedMessage as FormattedMessage13, useIntl as
|
|
6168
|
-
import { jsx as
|
|
6019
|
+
import { FormattedMessage as FormattedMessage13, useIntl as useIntl17 } from "react-intl";
|
|
6020
|
+
import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6169
6021
|
function TokenDetail({
|
|
6170
6022
|
onClose,
|
|
6171
6023
|
token
|
|
@@ -6175,41 +6027,41 @@ function TokenDetail({
|
|
|
6175
6027
|
const chain = chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
6176
6028
|
const onSend = () => {
|
|
6177
6029
|
modal.show((props) => {
|
|
6178
|
-
return /* @__PURE__ */
|
|
6030
|
+
return /* @__PURE__ */ jsx30(TokenSend, { onClose: () => {
|
|
6179
6031
|
props.close();
|
|
6180
6032
|
onClose();
|
|
6181
6033
|
}, onBack: props.close, zIndex: props.zIndex, token });
|
|
6182
6034
|
});
|
|
6183
6035
|
};
|
|
6184
|
-
const intl =
|
|
6185
|
-
return /* @__PURE__ */
|
|
6036
|
+
const intl = useIntl17();
|
|
6037
|
+
return /* @__PURE__ */ jsx30(ModalDrawer, { isOpen: true, title: intl.formatMessage({
|
|
6186
6038
|
id: "tokenDetails"
|
|
6187
6039
|
}), onClose, children: /* @__PURE__ */ jsxs21("div", { className: `matchid-token-detail`, children: [
|
|
6188
6040
|
/* @__PURE__ */ jsxs21("div", { className: `matchid-token-main`, children: [
|
|
6189
6041
|
/* @__PURE__ */ jsxs21("div", { className: `matchid-token-info`, children: [
|
|
6190
6042
|
/* @__PURE__ */ jsxs21("div", { className: `matchid-token-logo`, children: [
|
|
6191
|
-
token.icon ? /* @__PURE__ */
|
|
6192
|
-
chain?.iconUrl && /* @__PURE__ */
|
|
6043
|
+
token.icon ? /* @__PURE__ */ jsx30("img", { src: token.icon, alt: token.symbol, className: `matchid-token-icon` }) : /* @__PURE__ */ jsx30(AlphaAvatar, { className: `matchid-token-icon`, size: 48, name: token.symbol || token.name || "" }),
|
|
6044
|
+
chain?.iconUrl && /* @__PURE__ */ jsx30("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-token-chain` })
|
|
6193
6045
|
] }),
|
|
6194
6046
|
/* @__PURE__ */ jsxs21("div", { className: `matchid-token-name`, children: [
|
|
6195
|
-
/* @__PURE__ */
|
|
6047
|
+
/* @__PURE__ */ jsx30(NumberFormatter, { value: token.balance, tFixNum: 10 }),
|
|
6196
6048
|
" ",
|
|
6197
6049
|
token.symbol
|
|
6198
6050
|
] })
|
|
6199
6051
|
] }),
|
|
6200
6052
|
token.address.toLowerCase() != NATIVE_TOKEN_ADDRESS && /* @__PURE__ */ jsxs21("div", { className: `matchid-token-contract`, children: [
|
|
6201
|
-
/* @__PURE__ */
|
|
6202
|
-
/* @__PURE__ */
|
|
6053
|
+
/* @__PURE__ */ jsx30("div", { className: "matchid-token-contract-title", children: "Contract address" }),
|
|
6054
|
+
/* @__PURE__ */ jsx30("div", { className: "matchid-token-contract-address", children: token.address })
|
|
6203
6055
|
] })
|
|
6204
6056
|
] }),
|
|
6205
|
-
/* @__PURE__ */
|
|
6057
|
+
/* @__PURE__ */ jsx30(Button, { size: "lg", block: true, highlight: true, onClick: onSend, children: /* @__PURE__ */ jsx30(FormattedMessage13, { id: "send" }) })
|
|
6206
6058
|
] }) });
|
|
6207
6059
|
}
|
|
6208
6060
|
|
|
6209
6061
|
// src/components/TokenSendList/index.tsx
|
|
6210
|
-
import { useState as
|
|
6062
|
+
import { useState as useState26 } from "react";
|
|
6211
6063
|
import { FormattedMessage as FormattedMessage14 } from "react-intl";
|
|
6212
|
-
import { jsx as
|
|
6064
|
+
import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6213
6065
|
function TokenSendList({ close }) {
|
|
6214
6066
|
const isDownMd = useDownMd();
|
|
6215
6067
|
const walletAssets = useMatchWalletAssets();
|
|
@@ -6217,18 +6069,18 @@ function TokenSendList({ close }) {
|
|
|
6217
6069
|
list: walletAssets.mergedAssets
|
|
6218
6070
|
});
|
|
6219
6071
|
const { list } = useMatchChain();
|
|
6220
|
-
const [checked, setChecked] =
|
|
6072
|
+
const [checked, setChecked] = useState26();
|
|
6221
6073
|
const modal = useModal();
|
|
6222
6074
|
const onNext = () => {
|
|
6223
6075
|
checked && modal.show((props) => {
|
|
6224
|
-
return /* @__PURE__ */
|
|
6076
|
+
return /* @__PURE__ */ jsx31(TokenSend, { onClose: () => {
|
|
6225
6077
|
props.close();
|
|
6226
6078
|
close();
|
|
6227
6079
|
}, onBack: props.close, zIndex: props.zIndex, token: checked });
|
|
6228
6080
|
});
|
|
6229
6081
|
};
|
|
6230
6082
|
return /* @__PURE__ */ jsxs22("div", { className: "matchid-token-send-list-box", children: [
|
|
6231
|
-
/* @__PURE__ */
|
|
6083
|
+
/* @__PURE__ */ jsx31("div", { className: "matchid-token-send-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
6232
6084
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
6233
6085
|
return /* @__PURE__ */ jsxs22(
|
|
6234
6086
|
"div",
|
|
@@ -6238,10 +6090,10 @@ function TokenSendList({ close }) {
|
|
|
6238
6090
|
setChecked(n);
|
|
6239
6091
|
},
|
|
6240
6092
|
children: [
|
|
6241
|
-
/* @__PURE__ */
|
|
6093
|
+
/* @__PURE__ */ jsx31(Radio, { checked: checked?.address == n.address, size: isDownMd ? 18 : 24 }),
|
|
6242
6094
|
/* @__PURE__ */ jsxs22("div", { className: "matchid-token-send-content", children: [
|
|
6243
6095
|
/* @__PURE__ */ jsxs22("div", { className: "matchid-token-send-logo", children: [
|
|
6244
|
-
n.icon ? /* @__PURE__ */
|
|
6096
|
+
n.icon ? /* @__PURE__ */ jsx31("img", { src: n.icon, alt: n.symbol, className: `matchid-token-send-icon` }) : /* @__PURE__ */ jsx31(
|
|
6245
6097
|
AlphaAvatar2,
|
|
6246
6098
|
{
|
|
6247
6099
|
className: `matchid-token-send-icon`,
|
|
@@ -6249,7 +6101,7 @@ function TokenSendList({ close }) {
|
|
|
6249
6101
|
name: n.symbol || n.name || ""
|
|
6250
6102
|
}
|
|
6251
6103
|
),
|
|
6252
|
-
chain?.iconUrl && /* @__PURE__ */
|
|
6104
|
+
chain?.iconUrl && /* @__PURE__ */ jsx31(
|
|
6253
6105
|
"img",
|
|
6254
6106
|
{
|
|
6255
6107
|
src: chain.iconUrl,
|
|
@@ -6259,8 +6111,8 @@ function TokenSendList({ close }) {
|
|
|
6259
6111
|
)
|
|
6260
6112
|
] }),
|
|
6261
6113
|
/* @__PURE__ */ jsxs22("div", { className: `matchid-token-send-info`, children: [
|
|
6262
|
-
/* @__PURE__ */
|
|
6263
|
-
/* @__PURE__ */
|
|
6114
|
+
/* @__PURE__ */ jsx31("div", { className: `matchid-token-send-name`, children: n.symbol }),
|
|
6115
|
+
/* @__PURE__ */ jsx31("div", { className: `matchid-token-send-balance`, children: /* @__PURE__ */ jsx31(NumberFormatter, { value: n.balance, tFixNum: 3 }) })
|
|
6264
6116
|
] })
|
|
6265
6117
|
] })
|
|
6266
6118
|
]
|
|
@@ -6268,23 +6120,23 @@ function TokenSendList({ close }) {
|
|
|
6268
6120
|
index
|
|
6269
6121
|
);
|
|
6270
6122
|
}) }),
|
|
6271
|
-
/* @__PURE__ */
|
|
6123
|
+
/* @__PURE__ */ jsx31(Button, { size: "lg", highlight: true, block: true, disabled: !checked, onClick: onNext, children: /* @__PURE__ */ jsx31(FormattedMessage14, { id: "next" }) })
|
|
6272
6124
|
] });
|
|
6273
6125
|
}
|
|
6274
6126
|
|
|
6275
6127
|
// src/components/TransactionList/index.tsx
|
|
6276
6128
|
import InfiniteScroll from "react-infinite-scroll-component";
|
|
6277
|
-
import { useEffect as
|
|
6129
|
+
import { useEffect as useEffect24, useMemo as useMemo16, useState as useState27 } from "react";
|
|
6278
6130
|
import { decodeFunctionData, defineChain as defineChain5, formatUnits as formatUnits3 } from "viem";
|
|
6279
6131
|
import { erc20Abi as erc20Abi4 } from "viem";
|
|
6280
6132
|
import { FormattedMessage as FormattedMessage15 } from "react-intl";
|
|
6281
|
-
import { jsx as
|
|
6133
|
+
import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6282
6134
|
var Item = ({ data }) => {
|
|
6283
6135
|
const { address } = useWallet();
|
|
6284
6136
|
const isOut = data.from.toLowerCase() == address.toLowerCase();
|
|
6285
6137
|
const { chain, chainId, explorerLink, formatUnits: chainFormatUnits } = useMatchChain();
|
|
6286
6138
|
const { contracts } = useContractStore_default();
|
|
6287
|
-
const [shouldRefetch, setShouldRefetch] =
|
|
6139
|
+
const [shouldRefetch, setShouldRefetch] = useState27(true);
|
|
6288
6140
|
const transferType = useMemo16(() => {
|
|
6289
6141
|
const methodId = data.input.substring(2, 10);
|
|
6290
6142
|
if (methodId == "095ea7b3") {
|
|
@@ -6353,7 +6205,7 @@ var Item = ({ data }) => {
|
|
|
6353
6205
|
}
|
|
6354
6206
|
return "loading";
|
|
6355
6207
|
}, [data.extra?.status, data.source, hashQuery.data]);
|
|
6356
|
-
|
|
6208
|
+
useEffect24(() => {
|
|
6357
6209
|
if (data.hash) {
|
|
6358
6210
|
setShouldRefetch(status == "loading");
|
|
6359
6211
|
}
|
|
@@ -6373,10 +6225,10 @@ var Item = ({ data }) => {
|
|
|
6373
6225
|
className: `matchid-transaction-item`,
|
|
6374
6226
|
children: [
|
|
6375
6227
|
/* @__PURE__ */ jsxs23("div", { className: `matchid-transacton-item-container`, children: [
|
|
6376
|
-
/* @__PURE__ */
|
|
6228
|
+
/* @__PURE__ */ jsx32("div", { className: "matchid-transaction-item-icon", children: /* @__PURE__ */ jsx32(ArrowSendIcon, { className: !isOut ? "rotate-180" : "" }) }),
|
|
6377
6229
|
/* @__PURE__ */ jsxs23("div", { className: `matchid-transaction-item-details`, children: [
|
|
6378
|
-
/* @__PURE__ */
|
|
6379
|
-
/* @__PURE__ */
|
|
6230
|
+
/* @__PURE__ */ jsx32("div", { className: `matchid-transaction-item-address`, children: formatAddress(to, 6, 4) }),
|
|
6231
|
+
/* @__PURE__ */ jsx32(
|
|
6380
6232
|
"div",
|
|
6381
6233
|
{
|
|
6382
6234
|
className: `matchid-transaction-item-timestamp`,
|
|
@@ -6386,10 +6238,10 @@ var Item = ({ data }) => {
|
|
|
6386
6238
|
] })
|
|
6387
6239
|
] }),
|
|
6388
6240
|
/* @__PURE__ */ jsxs23("div", { className: `matchid-transaction-item-amount ${"matchid-transaction-item-" + status}`, children: [
|
|
6389
|
-
/* @__PURE__ */
|
|
6390
|
-
status == "loading" && /* @__PURE__ */
|
|
6391
|
-
status == "success" && /* @__PURE__ */
|
|
6392
|
-
status == "error" && /* @__PURE__ */
|
|
6241
|
+
/* @__PURE__ */ jsx32(NumberFormatter, { value: amount, tFixNum: 6, prefix: isOut ? "-" : "+", suffix: " " + symbol }),
|
|
6242
|
+
status == "loading" && /* @__PURE__ */ jsx32(LoadingIcon_default, { color: "#000000", size: 16, rotate: true }),
|
|
6243
|
+
status == "success" && /* @__PURE__ */ jsx32(CheckRoundIcon, { size: 16 }),
|
|
6244
|
+
status == "error" && /* @__PURE__ */ jsx32(InfoRoundIcon, { size: 16 })
|
|
6393
6245
|
] })
|
|
6394
6246
|
]
|
|
6395
6247
|
}
|
|
@@ -6399,7 +6251,7 @@ function TransactionList({
|
|
|
6399
6251
|
scrollableTarget
|
|
6400
6252
|
}) {
|
|
6401
6253
|
const { fetchMoreData, hasMore, items } = useMatchWalletRecords();
|
|
6402
|
-
return /* @__PURE__ */
|
|
6254
|
+
return /* @__PURE__ */ jsx32(
|
|
6403
6255
|
InfiniteScroll,
|
|
6404
6256
|
{
|
|
6405
6257
|
scrollableTarget,
|
|
@@ -6407,11 +6259,11 @@ function TransactionList({
|
|
|
6407
6259
|
next: fetchMoreData,
|
|
6408
6260
|
hasMore,
|
|
6409
6261
|
loader: /* @__PURE__ */ jsxs23("div", { className: "matchid-list-nomore", children: [
|
|
6410
|
-
/* @__PURE__ */
|
|
6262
|
+
/* @__PURE__ */ jsx32(LoadingIcon_default, { rotate: true, size: 16, color: "black" }),
|
|
6411
6263
|
"Loading..."
|
|
6412
6264
|
] }),
|
|
6413
|
-
endMessage: items.length > 0 ? /* @__PURE__ */
|
|
6414
|
-
children: items.length == 0 && !hasMore ? /* @__PURE__ */
|
|
6265
|
+
endMessage: items.length > 0 ? /* @__PURE__ */ jsx32("div", { className: `matchid-list-nomore`, children: /* @__PURE__ */ jsx32(FormattedMessage15, { id: "noMoreRecords" }) }) : /* @__PURE__ */ jsx32("div", { className: `matchid-list-nomore`, children: /* @__PURE__ */ jsx32(FormattedMessage15, { id: "noRecords" }) }),
|
|
6266
|
+
children: items.length == 0 && !hasMore ? /* @__PURE__ */ jsx32("div", { className: "mt-[150px]" }) : /* @__PURE__ */ jsx32("div", { className: `matchid-transaction-list`, children: items.map((item, index) => /* @__PURE__ */ jsx32(Item, { data: item }, index)) })
|
|
6415
6267
|
}
|
|
6416
6268
|
);
|
|
6417
6269
|
}
|
|
@@ -6443,7 +6295,6 @@ export {
|
|
|
6443
6295
|
LoginModal,
|
|
6444
6296
|
LoginButton,
|
|
6445
6297
|
UsernameModal,
|
|
6446
|
-
SOLModal,
|
|
6447
6298
|
TRONModal,
|
|
6448
6299
|
TONModal,
|
|
6449
6300
|
BTCModal,
|
|
@@ -6464,4 +6315,4 @@ export {
|
|
|
6464
6315
|
MatchProvider,
|
|
6465
6316
|
useMatch
|
|
6466
6317
|
};
|
|
6467
|
-
//# sourceMappingURL=chunk-
|
|
6318
|
+
//# sourceMappingURL=chunk-3YF3P77J.mjs.map
|