@matchain/matchid-sdk-react 0.1.53-alpha.0 → 0.1.53-alpha.2
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 +1 -1
- package/dist/assets/icon/index.d.ts +1 -1
- package/dist/{chunk-YQHI5BIZ.mjs → chunk-4A2YPGO3.mjs} +2 -2
- package/dist/{chunk-HLUFAIFV.mjs → chunk-MX7N57AH.mjs} +1 -1
- package/dist/{chunk-HLUFAIFV.mjs.map → chunk-MX7N57AH.mjs.map} +1 -1
- package/dist/{chunk-LRJDS2OK.mjs → chunk-W5A6WY7Y.mjs} +229 -416
- package/dist/chunk-W5A6WY7Y.mjs.map +1 -0
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +223 -395
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -4
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +75 -122
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +3 -3
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +253 -313
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/{index-CO1j3Cxc.d.ts → index-B8cUP7cH.d.ts} +2 -2
- package/dist/{index-C29kl7io.d.mts → index-BCGJczpk.d.mts} +1 -1
- package/dist/{index-Bsfb3Ysq.d.mts → index-BS-NO8Y2.d.ts} +3 -3
- package/dist/{index-C7InzeOC.d.ts → index-Bil_db2f.d.mts} +3 -3
- package/dist/{index-BlYHNOxm.d.ts → index-BsL6zo6a.d.ts} +1 -1
- package/dist/{index-CteYYAoN.d.mts → index-CZqdmQu1.d.mts} +1 -1
- package/dist/{index-Ce5JlNJv.d.ts → index-DNJuiNdz.d.mts} +4 -11
- package/dist/{index-0EM3dXJ4.d.mts → index-Df-WlkXq.d.ts} +4 -11
- package/dist/{index-BNNgBoTN.d.ts → index-IwwXQ_QV.d.ts} +1 -1
- package/dist/{index-BoIDCH41.d.ts → index-K5vXmiRX.d.ts} +1 -1
- package/dist/{index-CGx_yc95.d.mts → index-iWHaT8HV.d.mts} +1 -1
- package/dist/{index-CqO8nMTh.d.mts → index-yy3VTdFU.d.mts} +2 -2
- package/dist/index.css +18 -6
- package/dist/index.d.mts +7 -8
- package/dist/index.d.ts +7 -8
- package/dist/index.js +389 -538
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -9
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/{types-Cv5UhCIP.d.mts → types-CZbR7ERa.d.mts} +1 -2
- package/dist/{types-Cv5UhCIP.d.ts → types-CZbR7ERa.d.ts} +1 -2
- package/dist/ui/index.d.mts +3 -3
- package/dist/ui/index.d.ts +3 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +1 -1
- package/example/dist/assets/{TransportWebHID-BwG9Tbw2.js → TransportWebHID-BEu7tC0r.js} +1 -1
- package/example/dist/assets/{bignumber-FiRdtNkj.js → bignumber-iG7K-qxw.js} +1 -1
- package/example/dist/assets/{ccip-CJyR03AW.js → ccip-a6wQ1Vcb.js} +1 -1
- package/example/dist/assets/{draggabilly-1Sl0icBA.js → draggabilly-CRYR_S0q.js} +1 -1
- package/example/dist/assets/{index-RIWy1Hg7.js → index--dp9m9Ep.js} +1 -1
- package/example/dist/assets/{index-DATAk5xI.js → index-BDTHolFv.js} +1 -1
- package/example/dist/assets/{index-CcgesoWE.js → index-BZl59qLb.js} +20 -20
- package/example/dist/assets/{index-DxxLiL3_.js → index-BmMbYNHO.js} +3 -3
- package/example/dist/assets/{index-D8N4Z5B5.js → index-C7cxVRDF.js} +71 -71
- package/example/dist/assets/{index-BAfSBdWW.js → index-CJk171Yb.js} +1 -1
- package/example/dist/assets/{index-DN1wW-Mo.js → index-CQiBesAa.js} +1 -1
- package/example/dist/assets/{index-D5RU9xxK.js → index-D62loNA9.js} +1 -1
- package/example/dist/assets/{index-CYk2C9XJ.js → index-DqyX3FG6.js} +1 -1
- package/example/dist/assets/{solanaEmbed.esm-CNS-QKE2.js → solanaEmbed.esm-Djn-u4Vn.js} +1 -1
- package/example/dist/index.html +1 -1
- package/example/package.json +2 -1
- package/example/src/App.tsx +18 -5
- package/example/src/store/useLocalStore.ts +9 -0
- package/package.json +1 -5
- package/dist/chunk-LRJDS2OK.mjs.map +0 -1
- /package/dist/{chunk-YQHI5BIZ.mjs.map → chunk-4A2YPGO3.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,
|
|
@@ -29,6 +17,19 @@ import {
|
|
|
29
17
|
useHash,
|
|
30
18
|
useLayout_exports
|
|
31
19
|
} from "./chunk-FB5MHLWX.mjs";
|
|
20
|
+
import {
|
|
21
|
+
NumberFormatter,
|
|
22
|
+
decodeBase64,
|
|
23
|
+
encodeBase64,
|
|
24
|
+
formatAddress,
|
|
25
|
+
formatDate,
|
|
26
|
+
getAppClientId,
|
|
27
|
+
getVersion,
|
|
28
|
+
isInTgApp,
|
|
29
|
+
isValidEmail,
|
|
30
|
+
isValidUsername,
|
|
31
|
+
truncateAddress
|
|
32
|
+
} from "./chunk-MX7N57AH.mjs";
|
|
32
33
|
import {
|
|
33
34
|
ArrowDownIcon,
|
|
34
35
|
ArrowRightIcon,
|
|
@@ -92,7 +93,6 @@ __export(components_exports, {
|
|
|
92
93
|
ModalWithHeader: () => ModalWithHeader,
|
|
93
94
|
Overlay: () => Overlay,
|
|
94
95
|
Popover: () => Popover,
|
|
95
|
-
SOLModal: () => SOLModal,
|
|
96
96
|
TONModal: () => TONModal,
|
|
97
97
|
TRONModal: () => TRONModal,
|
|
98
98
|
TokenDetail: () => TokenDetail,
|
|
@@ -2294,12 +2294,6 @@ function useWalletConfig() {
|
|
|
2294
2294
|
}
|
|
2295
2295
|
|
|
2296
2296
|
// 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
2297
|
var useTRONModalStore = create5((set) => ({
|
|
2304
2298
|
isOpen: false,
|
|
2305
2299
|
type: "",
|
|
@@ -2450,7 +2444,6 @@ import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
|
2450
2444
|
import { Fragment, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2451
2445
|
function BusinessProvider({ children }) {
|
|
2452
2446
|
const { overview, token } = useUserInfo();
|
|
2453
|
-
const { type: SOLType, isOpen: SOLIsOpen, close: SOLClose } = useSOLModalStore();
|
|
2454
2447
|
const { type: TONType, isOpen: TONIsOpen, close: TONClose } = useTONModalStore();
|
|
2455
2448
|
const { type: TRONType, isOpen: TRONIsOpen, close: TRONClose } = useTRONModalStore();
|
|
2456
2449
|
const { type: BTCType, isOpen: BTCIsOpen, close: BTCClose } = useBTCModalStore();
|
|
@@ -2471,7 +2464,7 @@ function BusinessProvider({ children }) {
|
|
|
2471
2464
|
if (isSuccess(res)) {
|
|
2472
2465
|
setTgAppAuthCode("");
|
|
2473
2466
|
await login({
|
|
2474
|
-
mid:
|
|
2467
|
+
// mid:'',
|
|
2475
2468
|
token: `${res.data.token_type} ${res.data.access_token}`
|
|
2476
2469
|
});
|
|
2477
2470
|
return true;
|
|
@@ -2482,16 +2475,6 @@ function BusinessProvider({ children }) {
|
|
|
2482
2475
|
refetchInterval: 1e3 * 5
|
|
2483
2476
|
});
|
|
2484
2477
|
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
2478
|
/* @__PURE__ */ jsx10(
|
|
2496
2479
|
TRONModal,
|
|
2497
2480
|
{
|
|
@@ -2811,6 +2794,7 @@ function useInit({
|
|
|
2811
2794
|
const overviewLoadingRef = useRef3(false);
|
|
2812
2795
|
const searchParams = new URLSearchParams(window.location.search);
|
|
2813
2796
|
const matchToken = searchParams.get("matchToken");
|
|
2797
|
+
const matchidt = searchParams.get("matchidt");
|
|
2814
2798
|
const realEndpoints = endpoints || env_default.endpoints;
|
|
2815
2799
|
useEffect12(() => {
|
|
2816
2800
|
setTheme(theme);
|
|
@@ -2829,18 +2813,48 @@ function useInit({
|
|
|
2829
2813
|
const tokenData = JSON.parse(atob(matchToken));
|
|
2830
2814
|
if (tokenData && tokenData.mid && tokenData.token) {
|
|
2831
2815
|
login({
|
|
2832
|
-
mid: tokenData.mid,
|
|
2816
|
+
// mid: tokenData.mid,
|
|
2833
2817
|
token: "Bearer " + tokenData.token
|
|
2834
2818
|
});
|
|
2835
2819
|
}
|
|
2836
2820
|
}
|
|
2837
2821
|
}, [matchToken]);
|
|
2822
|
+
useEffect12(() => {
|
|
2823
|
+
if (matchidt) {
|
|
2824
|
+
const tokenData = decodeURIComponent(matchidt);
|
|
2825
|
+
const data = JSON.parse(decodeBase64(tokenData));
|
|
2826
|
+
if (data) {
|
|
2827
|
+
matchlog_default.log("matchidt", data);
|
|
2828
|
+
if (data.action == "login") {
|
|
2829
|
+
const newtoken = data.token || `${data.token_type} ${data.access_token}`;
|
|
2830
|
+
login({
|
|
2831
|
+
// mid: tokenData.mid,
|
|
2832
|
+
token: newtoken
|
|
2833
|
+
});
|
|
2834
|
+
} else if (data.action == "bind") {
|
|
2835
|
+
eventManager_default.emit("onBind", {
|
|
2836
|
+
type: data.type
|
|
2837
|
+
});
|
|
2838
|
+
if (events && events.onBind) {
|
|
2839
|
+
events.onBind({
|
|
2840
|
+
type: data.type
|
|
2841
|
+
});
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
const url = window.location.href;
|
|
2845
|
+
const urlObj = new URL(url);
|
|
2846
|
+
urlObj.searchParams.delete("matchidt");
|
|
2847
|
+
window.history.replaceState({}, "", urlObj.toString());
|
|
2848
|
+
return;
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
}, [matchidt]);
|
|
2838
2852
|
useEffect12(() => {
|
|
2839
2853
|
const onLoginMessage = (event) => {
|
|
2840
2854
|
const res = event.data;
|
|
2841
2855
|
if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
|
|
2842
2856
|
login({
|
|
2843
|
-
mid: res.data.mid,
|
|
2857
|
+
// mid: res.data.mid,
|
|
2844
2858
|
token: res.data.token || `${res.data.token_type} ${res.data.access_token}`
|
|
2845
2859
|
});
|
|
2846
2860
|
} else if (res.event == "bind") {
|
|
@@ -2877,18 +2891,17 @@ function useInit({
|
|
|
2877
2891
|
loadOverview();
|
|
2878
2892
|
}
|
|
2879
2893
|
}, [token]);
|
|
2880
|
-
const login = async ({
|
|
2881
|
-
setMid(mid);
|
|
2894
|
+
const login = async ({ token: token2 }) => {
|
|
2882
2895
|
setToken(token2);
|
|
2883
2896
|
const overview = await loadOverview();
|
|
2884
2897
|
eventManager_default.emit("onLogin", {
|
|
2885
|
-
mid,
|
|
2898
|
+
// mid,
|
|
2886
2899
|
token: token2,
|
|
2887
2900
|
did: overview?.did
|
|
2888
2901
|
});
|
|
2889
2902
|
if (events && events?.onLogin) {
|
|
2890
2903
|
events.onLogin({
|
|
2891
|
-
mid,
|
|
2904
|
+
// mid,
|
|
2892
2905
|
token: token2,
|
|
2893
2906
|
did: overview?.did
|
|
2894
2907
|
});
|
|
@@ -3710,13 +3723,16 @@ function useUserInfo() {
|
|
|
3710
3723
|
refreshOverview
|
|
3711
3724
|
} = useLocalStore_default();
|
|
3712
3725
|
const { setTgAppAuthCode, emailLoginKey, setEmailLoginKey } = useStore_default();
|
|
3726
|
+
const isDownMd = useDownMd();
|
|
3713
3727
|
const { events, login } = useMatch();
|
|
3714
|
-
const { open: SOLOpen } = useSOLModalStore();
|
|
3715
3728
|
const { open: TRONOpen } = useTRONModalStore();
|
|
3716
3729
|
const { open: TONOpen } = useTONModalStore();
|
|
3717
3730
|
const { open: BTCOpen } = useBTCModalStore();
|
|
3718
3731
|
const { open: CEXBindOpen } = useCEXBindModalStore();
|
|
3719
3732
|
const walletModalStore = useWalletModalStore();
|
|
3733
|
+
const getRedirectUri = () => {
|
|
3734
|
+
return encodeURIComponent(window.location.href);
|
|
3735
|
+
};
|
|
3720
3736
|
const isLogin = useMemo7(() => !!token && !!overview, [token, overview]);
|
|
3721
3737
|
const logout = async () => {
|
|
3722
3738
|
try {
|
|
@@ -3787,7 +3803,10 @@ function useUserInfo() {
|
|
|
3787
3803
|
case "evm":
|
|
3788
3804
|
return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`);
|
|
3789
3805
|
case "sol":
|
|
3790
|
-
|
|
3806
|
+
if (isDownMd) {
|
|
3807
|
+
return window.location.href = `${endpoints.auth}login/sol?appid=${appid}&locale=${locale}&redirect_uri=${getRedirectUri()}`;
|
|
3808
|
+
}
|
|
3809
|
+
return window.open(`${endpoints.auth}login/sol?appid=${appid}&locale=${locale}`);
|
|
3791
3810
|
case "tron":
|
|
3792
3811
|
return TRONOpen("login");
|
|
3793
3812
|
case "ton":
|
|
@@ -3829,7 +3848,7 @@ function useUserInfo() {
|
|
|
3829
3848
|
const res = await verifyEmailCodeApi(obj);
|
|
3830
3849
|
if (res && res.data && isSuccess(res)) {
|
|
3831
3850
|
await login({
|
|
3832
|
-
mid: res.data.mid,
|
|
3851
|
+
// mid: res.data.mid,
|
|
3833
3852
|
token: `${res.data.token_type} ${res.data.access_token}`
|
|
3834
3853
|
});
|
|
3835
3854
|
return true;
|
|
@@ -3876,7 +3895,10 @@ function useUserInfo() {
|
|
|
3876
3895
|
case "evm":
|
|
3877
3896
|
return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)));
|
|
3878
3897
|
case "sol":
|
|
3879
|
-
|
|
3898
|
+
if (isDownMd) {
|
|
3899
|
+
return window.location.href = `${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}&redirect_uri=${getRedirectUri()}`;
|
|
3900
|
+
}
|
|
3901
|
+
return window.open(`${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}`);
|
|
3880
3902
|
case "tron":
|
|
3881
3903
|
return TRONOpen("bind");
|
|
3882
3904
|
case "ton":
|
|
@@ -4674,58 +4696,8 @@ function UsernameModal({
|
|
|
4674
4696
|
] }) });
|
|
4675
4697
|
}
|
|
4676
4698
|
|
|
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";
|
|
4699
|
+
// src/components/TRONModal/index.tsx
|
|
4700
|
+
import React7, { useEffect as useEffect18, useMemo as useMemo12, useState as useState20 } from "react";
|
|
4729
4701
|
import { useIntl as useIntl12 } from "react-intl";
|
|
4730
4702
|
|
|
4731
4703
|
// src/components/WalletModalContent/index.tsx
|
|
@@ -4828,164 +4800,6 @@ function WalletModalContent({
|
|
|
4828
4800
|
] }) });
|
|
4829
4801
|
}
|
|
4830
4802
|
|
|
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
4803
|
// src/lib/tron/TronLinkAdapter.ts
|
|
4990
4804
|
var TronLinkAdapter = class {
|
|
4991
4805
|
constructor() {
|
|
@@ -5017,7 +4831,7 @@ var TronLinkAdapter = class {
|
|
|
5017
4831
|
};
|
|
5018
4832
|
|
|
5019
4833
|
// src/hooks/useTRONWallet.ts
|
|
5020
|
-
import { useEffect as
|
|
4834
|
+
import { useEffect as useEffect17, useState as useState19 } from "react";
|
|
5021
4835
|
|
|
5022
4836
|
// src/lib/tron/BitgetAdapter.ts
|
|
5023
4837
|
var BitgetAdapter = class {
|
|
@@ -5061,12 +4875,12 @@ var OKXAdapter = class {
|
|
|
5061
4875
|
|
|
5062
4876
|
// src/hooks/useTRONWallet.ts
|
|
5063
4877
|
var useTRONWallet = () => {
|
|
5064
|
-
const
|
|
5065
|
-
const [installedWallets, setInstalledWallets] =
|
|
5066
|
-
const [address, setAddress] =
|
|
5067
|
-
|
|
4878
|
+
const wallets = [new TronLinkAdapter(), new BitgetAdapter(), new OKXAdapter()];
|
|
4879
|
+
const [installedWallets, setInstalledWallets] = useState19([]);
|
|
4880
|
+
const [address, setAddress] = useState19(null);
|
|
4881
|
+
useEffect17(() => {
|
|
5068
4882
|
const getInstalled = async () => {
|
|
5069
|
-
const installed = await Promise.all(
|
|
4883
|
+
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
5070
4884
|
wallet: wallet2,
|
|
5071
4885
|
isInstalled
|
|
5072
4886
|
}))));
|
|
@@ -5074,18 +4888,18 @@ var useTRONWallet = () => {
|
|
|
5074
4888
|
};
|
|
5075
4889
|
getInstalled();
|
|
5076
4890
|
}, []);
|
|
5077
|
-
const [wallet, chooseWallet] =
|
|
4891
|
+
const [wallet, chooseWallet] = useState19(null);
|
|
5078
4892
|
const onConnect = async () => {
|
|
5079
4893
|
setAddress(await wallet.connect());
|
|
5080
4894
|
};
|
|
5081
|
-
|
|
4895
|
+
useEffect17(() => {
|
|
5082
4896
|
if (!wallet) {
|
|
5083
4897
|
setAddress(null);
|
|
5084
4898
|
}
|
|
5085
4899
|
}, [wallet]);
|
|
5086
4900
|
return {
|
|
5087
4901
|
installedWallets,
|
|
5088
|
-
wallets
|
|
4902
|
+
wallets,
|
|
5089
4903
|
chooseWallet,
|
|
5090
4904
|
wallet,
|
|
5091
4905
|
address,
|
|
@@ -5094,24 +4908,24 @@ var useTRONWallet = () => {
|
|
|
5094
4908
|
};
|
|
5095
4909
|
|
|
5096
4910
|
// src/components/TRONModal/index.tsx
|
|
5097
|
-
import { jsx as
|
|
4911
|
+
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5098
4912
|
function TRONConnectModal({
|
|
5099
4913
|
type = "login",
|
|
5100
4914
|
onSuccess,
|
|
5101
4915
|
...props
|
|
5102
4916
|
}) {
|
|
5103
4917
|
const isDownMd = useDownMd();
|
|
5104
|
-
const intl =
|
|
5105
|
-
const { wallets
|
|
4918
|
+
const intl = useIntl12();
|
|
4919
|
+
const { wallets, installedWallets, chooseWallet, wallet, address, onConnect } = useTRONWallet();
|
|
5106
4920
|
const iconMaps = {
|
|
5107
|
-
tronlink: /* @__PURE__ */
|
|
5108
|
-
bitget: /* @__PURE__ */
|
|
5109
|
-
okx: /* @__PURE__ */
|
|
4921
|
+
tronlink: /* @__PURE__ */ jsx23(TronLinkIcon, { size: isDownMd ? 36 : 40 }),
|
|
4922
|
+
bitget: /* @__PURE__ */ jsx23(BitgetIcon, { size: isDownMd ? 36 : 40 }),
|
|
4923
|
+
okx: /* @__PURE__ */ jsx23(OKXIcon, { size: isDownMd ? 36 : 40 })
|
|
5110
4924
|
};
|
|
5111
4925
|
const { events, login } = useMatch();
|
|
5112
|
-
const [status, setStatus] =
|
|
5113
|
-
const statusRef =
|
|
5114
|
-
const [error, setError] =
|
|
4926
|
+
const [status, setStatus] = useState20("");
|
|
4927
|
+
const statusRef = React7.useRef(status);
|
|
4928
|
+
const [error, setError] = useState20("");
|
|
5115
4929
|
const connected = useMemo12(() => {
|
|
5116
4930
|
return !!address;
|
|
5117
4931
|
}, [address]);
|
|
@@ -5167,7 +4981,7 @@ function TRONConnectModal({
|
|
|
5167
4981
|
});
|
|
5168
4982
|
} else {
|
|
5169
4983
|
await login({
|
|
5170
|
-
mid: res1.data.mid,
|
|
4984
|
+
// mid: res1.data.mid,
|
|
5171
4985
|
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
5172
4986
|
});
|
|
5173
4987
|
}
|
|
@@ -5180,7 +4994,7 @@ function TRONConnectModal({
|
|
|
5180
4994
|
statusRef.current = "";
|
|
5181
4995
|
}
|
|
5182
4996
|
};
|
|
5183
|
-
|
|
4997
|
+
useEffect18(() => {
|
|
5184
4998
|
if (wallet) {
|
|
5185
4999
|
console.log("onConnect");
|
|
5186
5000
|
onConnect();
|
|
@@ -5188,21 +5002,21 @@ function TRONConnectModal({
|
|
|
5188
5002
|
setStatus("");
|
|
5189
5003
|
}
|
|
5190
5004
|
}, [wallet]);
|
|
5191
|
-
|
|
5005
|
+
useEffect18(() => {
|
|
5192
5006
|
if (address) {
|
|
5193
5007
|
toLoginInWallet();
|
|
5194
5008
|
}
|
|
5195
5009
|
}, [address]);
|
|
5196
|
-
|
|
5010
|
+
useEffect18(() => {
|
|
5197
5011
|
if (!props.isOpen) {
|
|
5198
5012
|
disconnect();
|
|
5199
5013
|
}
|
|
5200
5014
|
}, [props.isOpen]);
|
|
5201
|
-
return /* @__PURE__ */
|
|
5015
|
+
return /* @__PURE__ */ jsx23(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5202
5016
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5203
5017
|
}, {
|
|
5204
5018
|
name: "TRON"
|
|
5205
|
-
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */
|
|
5019
|
+
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ jsx23(
|
|
5206
5020
|
WalletModalContent,
|
|
5207
5021
|
{
|
|
5208
5022
|
error,
|
|
@@ -5215,9 +5029,9 @@ function TRONConnectModal({
|
|
|
5215
5029
|
setVisible: () => {
|
|
5216
5030
|
}
|
|
5217
5031
|
}
|
|
5218
|
-
) : /* @__PURE__ */
|
|
5032
|
+
) : /* @__PURE__ */ jsx23("div", { className: "matchid-login-box", children: /* @__PURE__ */ jsxs17("div", { className: "matchid-login-recommend-list", children: [
|
|
5219
5033
|
installedWallets.map((wallet2) => {
|
|
5220
|
-
return /* @__PURE__ */
|
|
5034
|
+
return /* @__PURE__ */ jsx23(
|
|
5221
5035
|
RecommendItem,
|
|
5222
5036
|
{
|
|
5223
5037
|
icon: iconMaps[wallet2.walletKey],
|
|
@@ -5229,15 +5043,15 @@ function TRONConnectModal({
|
|
|
5229
5043
|
wallet2.walletKey
|
|
5230
5044
|
);
|
|
5231
5045
|
}),
|
|
5232
|
-
|
|
5233
|
-
return /* @__PURE__ */
|
|
5046
|
+
wallets.filter((wallet2) => !installedWallets.find((installedWallet) => installedWallet.walletKey == wallet2.walletKey)).map((wallet2) => {
|
|
5047
|
+
return /* @__PURE__ */ jsx23(
|
|
5234
5048
|
RecommendItem,
|
|
5235
5049
|
{
|
|
5236
5050
|
icon: iconMaps[wallet2.walletKey],
|
|
5237
5051
|
name: wallet2.name,
|
|
5238
5052
|
onClick: () => {
|
|
5239
5053
|
},
|
|
5240
|
-
footer: /* @__PURE__ */
|
|
5054
|
+
footer: /* @__PURE__ */ jsx23(Button, { size: "sm", onClick: () => {
|
|
5241
5055
|
window.open(wallet2.website);
|
|
5242
5056
|
}, children: "Install" })
|
|
5243
5057
|
},
|
|
@@ -5247,12 +5061,12 @@ function TRONConnectModal({
|
|
|
5247
5061
|
] }) }) });
|
|
5248
5062
|
}
|
|
5249
5063
|
function TRONModal(props) {
|
|
5250
|
-
return props.isOpen && /* @__PURE__ */
|
|
5064
|
+
return props.isOpen && /* @__PURE__ */ jsx23(TRONConnectModal, { ...props, type: props.type });
|
|
5251
5065
|
}
|
|
5252
5066
|
|
|
5253
5067
|
// src/components/TONModal/index.tsx
|
|
5254
|
-
import
|
|
5255
|
-
import { useIntl as
|
|
5068
|
+
import React8, { useEffect as useEffect19, useState as useState21 } from "react";
|
|
5069
|
+
import { useIntl as useIntl13 } from "react-intl";
|
|
5256
5070
|
import {
|
|
5257
5071
|
TonConnectUIProvider,
|
|
5258
5072
|
useTonAddress,
|
|
@@ -5260,21 +5074,21 @@ import {
|
|
|
5260
5074
|
useTonConnectUI,
|
|
5261
5075
|
useTonWallet
|
|
5262
5076
|
} from "@tonconnect/ui-react";
|
|
5263
|
-
import { jsx as
|
|
5264
|
-
function
|
|
5077
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
5078
|
+
function WalletContent({
|
|
5265
5079
|
onSuccess,
|
|
5266
5080
|
type
|
|
5267
5081
|
}) {
|
|
5268
5082
|
const { events, login } = useMatch();
|
|
5269
|
-
const [connected, setConnected] =
|
|
5083
|
+
const [connected, setConnected] = useState21(false);
|
|
5270
5084
|
const wallet = useTonWallet();
|
|
5271
5085
|
const userFriendlyAddress = useTonAddress();
|
|
5272
5086
|
const [tonConnectUI] = useTonConnectUI();
|
|
5273
5087
|
const { state, open, close } = useTonConnectModal();
|
|
5274
|
-
const [status, setStatus] =
|
|
5275
|
-
const statusRef =
|
|
5276
|
-
const [error, setError] =
|
|
5277
|
-
|
|
5088
|
+
const [status, setStatus] = useState21("");
|
|
5089
|
+
const statusRef = React8.useRef(status);
|
|
5090
|
+
const [error, setError] = useState21("");
|
|
5091
|
+
useEffect19(() => {
|
|
5278
5092
|
const init = async () => {
|
|
5279
5093
|
if (tonConnectUI.connected) {
|
|
5280
5094
|
await tonConnectUI.disconnect();
|
|
@@ -5331,7 +5145,7 @@ function WalletContent2({
|
|
|
5331
5145
|
});
|
|
5332
5146
|
} else {
|
|
5333
5147
|
await login({
|
|
5334
|
-
mid: res1.data.mid,
|
|
5148
|
+
// mid: res1.data.mid,
|
|
5335
5149
|
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
5336
5150
|
});
|
|
5337
5151
|
}
|
|
@@ -5347,7 +5161,7 @@ function WalletContent2({
|
|
|
5347
5161
|
}
|
|
5348
5162
|
});
|
|
5349
5163
|
}, []);
|
|
5350
|
-
|
|
5164
|
+
useEffect19(() => {
|
|
5351
5165
|
if (wallet) {
|
|
5352
5166
|
setConnected(true);
|
|
5353
5167
|
console.log("Wallet connected:", wallet);
|
|
@@ -5358,7 +5172,7 @@ function WalletContent2({
|
|
|
5358
5172
|
setStatus("");
|
|
5359
5173
|
}
|
|
5360
5174
|
}, [wallet]);
|
|
5361
|
-
|
|
5175
|
+
useEffect19(() => {
|
|
5362
5176
|
console.log({
|
|
5363
5177
|
state,
|
|
5364
5178
|
wallet
|
|
@@ -5387,7 +5201,7 @@ function WalletContent2({
|
|
|
5387
5201
|
}
|
|
5388
5202
|
}
|
|
5389
5203
|
}, [state]);
|
|
5390
|
-
return /* @__PURE__ */
|
|
5204
|
+
return /* @__PURE__ */ jsx24(
|
|
5391
5205
|
WalletModalContent,
|
|
5392
5206
|
{
|
|
5393
5207
|
connected,
|
|
@@ -5418,28 +5232,28 @@ function TONConnectModal({
|
|
|
5418
5232
|
onSuccess,
|
|
5419
5233
|
...props
|
|
5420
5234
|
}) {
|
|
5421
|
-
const intl =
|
|
5235
|
+
const intl = useIntl13();
|
|
5422
5236
|
const { endpoints, appid } = useLocalStore_default();
|
|
5423
5237
|
const manifestUrl = `${endpoints.back}api/v1/wallet/ton?appid=${appid}&url=` + encodeURIComponent(window.location.origin);
|
|
5424
|
-
return /* @__PURE__ */
|
|
5238
|
+
return /* @__PURE__ */ jsx24(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5425
5239
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5426
5240
|
}, {
|
|
5427
5241
|
name: "TON"
|
|
5428
|
-
}), children: /* @__PURE__ */
|
|
5242
|
+
}), children: /* @__PURE__ */ jsx24(
|
|
5429
5243
|
TonConnectUIProvider,
|
|
5430
5244
|
{
|
|
5431
5245
|
manifestUrl,
|
|
5432
|
-
children: /* @__PURE__ */
|
|
5246
|
+
children: /* @__PURE__ */ jsx24(WalletContent, { onSuccess, type })
|
|
5433
5247
|
}
|
|
5434
5248
|
) });
|
|
5435
5249
|
}
|
|
5436
5250
|
function TONModal(props) {
|
|
5437
|
-
return props.isOpen && /* @__PURE__ */
|
|
5251
|
+
return props.isOpen && /* @__PURE__ */ jsx24(TONConnectModal, { ...props });
|
|
5438
5252
|
}
|
|
5439
5253
|
|
|
5440
5254
|
// src/components/BTCModal/index.tsx
|
|
5441
|
-
import
|
|
5442
|
-
import { useIntl as
|
|
5255
|
+
import React9, { useEffect as useEffect21, useMemo as useMemo13, useState as useState23 } from "react";
|
|
5256
|
+
import { useIntl as useIntl14 } from "react-intl";
|
|
5443
5257
|
|
|
5444
5258
|
// src/lib/btc/UnisatAdapter.ts
|
|
5445
5259
|
var UnisatAdapter = class {
|
|
@@ -5593,14 +5407,14 @@ var LeatherAdapter = class {
|
|
|
5593
5407
|
};
|
|
5594
5408
|
|
|
5595
5409
|
// src/hooks/useBTCWallet.ts
|
|
5596
|
-
import { useEffect as
|
|
5410
|
+
import { useEffect as useEffect20, useState as useState22 } from "react";
|
|
5597
5411
|
var useBTCWallet = () => {
|
|
5598
|
-
const
|
|
5599
|
-
const [installedWallets, setInstalledWallets] =
|
|
5600
|
-
const [address, setAddress] =
|
|
5601
|
-
|
|
5412
|
+
const wallets = [new UnisatAdapter(), new XverseAdapter(), new LeatherAdapter()];
|
|
5413
|
+
const [installedWallets, setInstalledWallets] = useState22([]);
|
|
5414
|
+
const [address, setAddress] = useState22(null);
|
|
5415
|
+
useEffect20(() => {
|
|
5602
5416
|
const getInstalled = async () => {
|
|
5603
|
-
const installed = await Promise.all(
|
|
5417
|
+
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
5604
5418
|
wallet: wallet2,
|
|
5605
5419
|
isInstalled
|
|
5606
5420
|
}))));
|
|
@@ -5608,18 +5422,18 @@ var useBTCWallet = () => {
|
|
|
5608
5422
|
};
|
|
5609
5423
|
getInstalled();
|
|
5610
5424
|
}, []);
|
|
5611
|
-
const [wallet, chooseWallet] =
|
|
5425
|
+
const [wallet, chooseWallet] = useState22(null);
|
|
5612
5426
|
const onConnect = async () => {
|
|
5613
5427
|
setAddress(await wallet.connect());
|
|
5614
5428
|
};
|
|
5615
|
-
|
|
5429
|
+
useEffect20(() => {
|
|
5616
5430
|
if (!wallet) {
|
|
5617
5431
|
setAddress(null);
|
|
5618
5432
|
}
|
|
5619
5433
|
}, [wallet]);
|
|
5620
5434
|
return {
|
|
5621
5435
|
installedWallets,
|
|
5622
|
-
wallets
|
|
5436
|
+
wallets,
|
|
5623
5437
|
chooseWallet,
|
|
5624
5438
|
wallet,
|
|
5625
5439
|
address,
|
|
@@ -5628,24 +5442,24 @@ var useBTCWallet = () => {
|
|
|
5628
5442
|
};
|
|
5629
5443
|
|
|
5630
5444
|
// src/components/BTCModal/index.tsx
|
|
5631
|
-
import { jsx as
|
|
5445
|
+
import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5632
5446
|
function BTCConnectModal({
|
|
5633
5447
|
type = "login",
|
|
5634
5448
|
onSuccess,
|
|
5635
5449
|
...props
|
|
5636
5450
|
}) {
|
|
5637
5451
|
const isDownMd = useDownMd();
|
|
5638
|
-
const intl =
|
|
5639
|
-
const { wallets
|
|
5452
|
+
const intl = useIntl14();
|
|
5453
|
+
const { wallets, installedWallets, chooseWallet, wallet, address, onConnect } = useBTCWallet();
|
|
5640
5454
|
const iconMaps = {
|
|
5641
|
-
leather: /* @__PURE__ */
|
|
5642
|
-
unisat: /* @__PURE__ */
|
|
5643
|
-
xverse: /* @__PURE__ */
|
|
5455
|
+
leather: /* @__PURE__ */ jsx25(LeatherIcon, { size: isDownMd ? 36 : 40 }),
|
|
5456
|
+
unisat: /* @__PURE__ */ jsx25(UnisatIcon, { size: isDownMd ? 36 : 40 }),
|
|
5457
|
+
xverse: /* @__PURE__ */ jsx25(XverseIcon, { size: isDownMd ? 36 : 40 })
|
|
5644
5458
|
};
|
|
5645
5459
|
const { events, login } = useMatch();
|
|
5646
|
-
const [status, setStatus] =
|
|
5647
|
-
const statusRef =
|
|
5648
|
-
const [error, setError] =
|
|
5460
|
+
const [status, setStatus] = useState23("");
|
|
5461
|
+
const statusRef = React9.useRef(status);
|
|
5462
|
+
const [error, setError] = useState23("");
|
|
5649
5463
|
const connected = useMemo13(() => {
|
|
5650
5464
|
return !!address;
|
|
5651
5465
|
}, [address]);
|
|
@@ -5696,7 +5510,7 @@ function BTCConnectModal({
|
|
|
5696
5510
|
});
|
|
5697
5511
|
} else {
|
|
5698
5512
|
await login({
|
|
5699
|
-
mid: res1.data.mid,
|
|
5513
|
+
// mid: res1.data.mid,
|
|
5700
5514
|
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
5701
5515
|
});
|
|
5702
5516
|
}
|
|
@@ -5710,7 +5524,7 @@ function BTCConnectModal({
|
|
|
5710
5524
|
statusRef.current = "";
|
|
5711
5525
|
}
|
|
5712
5526
|
};
|
|
5713
|
-
|
|
5527
|
+
useEffect21(() => {
|
|
5714
5528
|
if (wallet) {
|
|
5715
5529
|
console.log("onConnect");
|
|
5716
5530
|
try {
|
|
@@ -5723,12 +5537,12 @@ function BTCConnectModal({
|
|
|
5723
5537
|
setStatus("");
|
|
5724
5538
|
}
|
|
5725
5539
|
}, [wallet]);
|
|
5726
|
-
|
|
5540
|
+
useEffect21(() => {
|
|
5727
5541
|
if (address) {
|
|
5728
5542
|
toLoginInWallet();
|
|
5729
5543
|
}
|
|
5730
5544
|
}, [address]);
|
|
5731
|
-
|
|
5545
|
+
useEffect21(() => {
|
|
5732
5546
|
if (!props.isOpen) {
|
|
5733
5547
|
disconnect();
|
|
5734
5548
|
}
|
|
@@ -5740,11 +5554,11 @@ function BTCConnectModal({
|
|
|
5740
5554
|
statusRef.current = "";
|
|
5741
5555
|
setError("");
|
|
5742
5556
|
};
|
|
5743
|
-
return /* @__PURE__ */
|
|
5557
|
+
return /* @__PURE__ */ jsx25(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5744
5558
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5745
5559
|
}, {
|
|
5746
5560
|
name: "BTC"
|
|
5747
|
-
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */
|
|
5561
|
+
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ jsx25(
|
|
5748
5562
|
WalletModalContent,
|
|
5749
5563
|
{
|
|
5750
5564
|
error,
|
|
@@ -5757,9 +5571,9 @@ function BTCConnectModal({
|
|
|
5757
5571
|
setVisible: () => {
|
|
5758
5572
|
}
|
|
5759
5573
|
}
|
|
5760
|
-
) : /* @__PURE__ */
|
|
5574
|
+
) : /* @__PURE__ */ jsx25("div", { className: "matchid-login-box", children: /* @__PURE__ */ jsxs18("div", { className: "matchid-login-recommend-list", children: [
|
|
5761
5575
|
installedWallets.map((wallet2) => {
|
|
5762
|
-
return /* @__PURE__ */
|
|
5576
|
+
return /* @__PURE__ */ jsx25(
|
|
5763
5577
|
RecommendItem,
|
|
5764
5578
|
{
|
|
5765
5579
|
icon: iconMaps[wallet2.walletKey],
|
|
@@ -5771,15 +5585,15 @@ function BTCConnectModal({
|
|
|
5771
5585
|
wallet2.walletKey
|
|
5772
5586
|
);
|
|
5773
5587
|
}),
|
|
5774
|
-
|
|
5775
|
-
return /* @__PURE__ */
|
|
5588
|
+
wallets.filter((wallet2) => !installedWallets.find((installedWallet) => installedWallet.walletKey == wallet2.walletKey)).map((wallet2) => {
|
|
5589
|
+
return /* @__PURE__ */ jsx25(
|
|
5776
5590
|
RecommendItem,
|
|
5777
5591
|
{
|
|
5778
5592
|
icon: iconMaps[wallet2.walletKey],
|
|
5779
5593
|
name: wallet2.name,
|
|
5780
5594
|
onClick: () => {
|
|
5781
5595
|
},
|
|
5782
|
-
footer: /* @__PURE__ */
|
|
5596
|
+
footer: /* @__PURE__ */ jsx25(Button, { size: "sm", onClick: () => {
|
|
5783
5597
|
window.open(wallet2.website);
|
|
5784
5598
|
}, children: "Install" })
|
|
5785
5599
|
},
|
|
@@ -5789,19 +5603,19 @@ function BTCConnectModal({
|
|
|
5789
5603
|
] }) }) });
|
|
5790
5604
|
}
|
|
5791
5605
|
function BTCModal(props) {
|
|
5792
|
-
return props.isOpen && /* @__PURE__ */
|
|
5606
|
+
return props.isOpen && /* @__PURE__ */ jsx25(BTCConnectModal, { ...props });
|
|
5793
5607
|
}
|
|
5794
5608
|
|
|
5795
5609
|
// src/components/WalletModal/index.tsx
|
|
5796
5610
|
import { useMemo as useMemo14 } from "react";
|
|
5797
|
-
import { useIntl as
|
|
5798
|
-
import { jsx as
|
|
5611
|
+
import { useIntl as useIntl15 } from "react-intl";
|
|
5612
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
5799
5613
|
function WalletConnectModal({
|
|
5800
5614
|
type,
|
|
5801
5615
|
methods: _methods,
|
|
5802
5616
|
...props
|
|
5803
5617
|
}) {
|
|
5804
|
-
const intl =
|
|
5618
|
+
const intl = useIntl15();
|
|
5805
5619
|
const { walletMap } = useWalletConfig();
|
|
5806
5620
|
const { bind, login } = useUserInfo();
|
|
5807
5621
|
const config = useAppConfig();
|
|
@@ -5813,13 +5627,13 @@ function WalletConnectModal({
|
|
|
5813
5627
|
const platform = config.platform.map((p) => p.toLowerCase());
|
|
5814
5628
|
return WALLET_METHODS.filter((m) => platform.includes(m));
|
|
5815
5629
|
}, [config.platform, _methods]);
|
|
5816
|
-
return /* @__PURE__ */
|
|
5630
|
+
return /* @__PURE__ */ jsx26(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5817
5631
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5818
5632
|
}, {
|
|
5819
5633
|
name: ""
|
|
5820
|
-
}), children: /* @__PURE__ */
|
|
5634
|
+
}), children: /* @__PURE__ */ jsx26("div", { className: "matchid-login-box", children: /* @__PURE__ */ jsx26("div", { className: "matchid-login-recommend-list", children: methods.map((method, index) => {
|
|
5821
5635
|
const m = walletMap[method];
|
|
5822
|
-
return /* @__PURE__ */
|
|
5636
|
+
return /* @__PURE__ */ jsx26(
|
|
5823
5637
|
RecommendItem,
|
|
5824
5638
|
{
|
|
5825
5639
|
icon: m?.icon,
|
|
@@ -5833,21 +5647,21 @@ function WalletConnectModal({
|
|
|
5833
5647
|
}) }) }) });
|
|
5834
5648
|
}
|
|
5835
5649
|
function WalletModal(props) {
|
|
5836
|
-
return props.isOpen && /* @__PURE__ */
|
|
5650
|
+
return props.isOpen && /* @__PURE__ */ jsx26(WalletConnectModal, { ...props });
|
|
5837
5651
|
}
|
|
5838
5652
|
|
|
5839
5653
|
// src/components/AlphaAvatar/index.tsx
|
|
5840
|
-
import { useEffect as
|
|
5841
|
-
import { jsx as
|
|
5654
|
+
import { useEffect as useEffect22, useState as useState24 } from "react";
|
|
5655
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
5842
5656
|
function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
5843
|
-
const [avatar, setAvatar] =
|
|
5844
|
-
|
|
5657
|
+
const [avatar, setAvatar] = useState24(void 0);
|
|
5658
|
+
useEffect22(() => {
|
|
5845
5659
|
if (name) {
|
|
5846
5660
|
const char = name[0].toUpperCase();
|
|
5847
5661
|
setAvatar(char);
|
|
5848
5662
|
}
|
|
5849
5663
|
}, [name]);
|
|
5850
|
-
return /* @__PURE__ */
|
|
5664
|
+
return /* @__PURE__ */ jsx27("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
5851
5665
|
width: size,
|
|
5852
5666
|
height: size,
|
|
5853
5667
|
fontSize: Math.ceil(size / 2)
|
|
@@ -5855,7 +5669,7 @@ function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
|
5855
5669
|
}
|
|
5856
5670
|
|
|
5857
5671
|
// src/components/WalletAsset/index.tsx
|
|
5858
|
-
import { jsx as
|
|
5672
|
+
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5859
5673
|
function WalletAsset({
|
|
5860
5674
|
onAssetClick,
|
|
5861
5675
|
matchWalletAssetsOptions
|
|
@@ -5865,7 +5679,7 @@ function WalletAsset({
|
|
|
5865
5679
|
list: walletAssets.mergedAssets
|
|
5866
5680
|
});
|
|
5867
5681
|
const { list } = useMatchChain();
|
|
5868
|
-
return /* @__PURE__ */
|
|
5682
|
+
return /* @__PURE__ */ jsx28("div", { className: "matchid-wallet-asset-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
5869
5683
|
const clickFunc = onAssetClick && onAssetClick(n);
|
|
5870
5684
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
5871
5685
|
const getFooterColor = () => {
|
|
@@ -5884,7 +5698,7 @@ function WalletAsset({
|
|
|
5884
5698
|
cursor: clickFunc ? "pointer" : "default"
|
|
5885
5699
|
}, children: [
|
|
5886
5700
|
/* @__PURE__ */ jsxs19("div", { className: "matchid-wallet-asset-logo", title: n.symbol || n.name || "", children: [
|
|
5887
|
-
n.icon ? /* @__PURE__ */
|
|
5701
|
+
n.icon ? /* @__PURE__ */ jsx28("img", { src: n.icon, alt: n.symbol, className: `matchid-wallet-asset-icon` }) : /* @__PURE__ */ jsx28(
|
|
5888
5702
|
AlphaAvatar2,
|
|
5889
5703
|
{
|
|
5890
5704
|
className: `matchid-wallet-asset-icon`,
|
|
@@ -5892,12 +5706,12 @@ function WalletAsset({
|
|
|
5892
5706
|
name: n.symbol || n.name || ""
|
|
5893
5707
|
}
|
|
5894
5708
|
),
|
|
5895
|
-
chain?.iconUrl && /* @__PURE__ */
|
|
5709
|
+
chain?.iconUrl && /* @__PURE__ */ jsx28("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-wallet-asset-chain` })
|
|
5896
5710
|
] }),
|
|
5897
5711
|
/* @__PURE__ */ jsxs19("div", { className: `matchid-wallet-asset-info`, children: [
|
|
5898
|
-
/* @__PURE__ */
|
|
5712
|
+
/* @__PURE__ */ jsx28("div", { className: `matchid-wallet-asset-name`, children: n.symbol }),
|
|
5899
5713
|
"price" in n && /* @__PURE__ */ jsxs19("div", { className: `matchid-wallet-asset-content`, children: [
|
|
5900
|
-
/* @__PURE__ */
|
|
5714
|
+
/* @__PURE__ */ jsx28("div", { className: "matchid-wallet-asset-price", children: /* @__PURE__ */ jsx28(
|
|
5901
5715
|
NumberFormatter,
|
|
5902
5716
|
{
|
|
5903
5717
|
value: n.price,
|
|
@@ -5905,7 +5719,7 @@ function WalletAsset({
|
|
|
5905
5719
|
tFixNum: 2
|
|
5906
5720
|
}
|
|
5907
5721
|
) }),
|
|
5908
|
-
/* @__PURE__ */
|
|
5722
|
+
/* @__PURE__ */ jsx28("div", { className: "matchid-wallet-asset-value", children: /* @__PURE__ */ jsx28(
|
|
5909
5723
|
NumberFormatter,
|
|
5910
5724
|
{
|
|
5911
5725
|
value: n.value,
|
|
@@ -5915,14 +5729,14 @@ function WalletAsset({
|
|
|
5915
5729
|
) })
|
|
5916
5730
|
] }),
|
|
5917
5731
|
/* @__PURE__ */ jsxs19("div", { className: `matchid-wallet-asset-footer`, children: [
|
|
5918
|
-
/* @__PURE__ */
|
|
5732
|
+
/* @__PURE__ */ jsx28("div", { className: `matchid-wallet-asset-balance`, children: /* @__PURE__ */ jsx28(
|
|
5919
5733
|
NumberFormatter,
|
|
5920
5734
|
{
|
|
5921
5735
|
value: n.balance,
|
|
5922
5736
|
tFixNum: 3
|
|
5923
5737
|
}
|
|
5924
5738
|
) }),
|
|
5925
|
-
"price_change_24h" in n && /* @__PURE__ */
|
|
5739
|
+
"price_change_24h" in n && /* @__PURE__ */ jsx28("div", { className: `matchid-wallet-asset-change ${getFooterColor()}`, children: /* @__PURE__ */ jsx28(
|
|
5926
5740
|
NumberFormatter,
|
|
5927
5741
|
{
|
|
5928
5742
|
prefix: `${(n?.price_change_24h || 0) < 0 ? "-" : "+"} `,
|
|
@@ -5938,10 +5752,10 @@ function WalletAsset({
|
|
|
5938
5752
|
}
|
|
5939
5753
|
|
|
5940
5754
|
// src/components/TokenSend/index.tsx
|
|
5941
|
-
import { useEffect as
|
|
5755
|
+
import { useEffect as useEffect23, useMemo as useMemo15, useState as useState25 } from "react";
|
|
5942
5756
|
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
|
|
5757
|
+
import { FormattedMessage as FormattedMessage12, useIntl as useIntl16 } from "react-intl";
|
|
5758
|
+
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5945
5759
|
function Input2({
|
|
5946
5760
|
onChange,
|
|
5947
5761
|
placeholder,
|
|
@@ -5952,7 +5766,7 @@ function Input2({
|
|
|
5952
5766
|
size = "df"
|
|
5953
5767
|
}) {
|
|
5954
5768
|
return /* @__PURE__ */ jsxs20("div", { className: `matchid-token-input-box ${"matchid-token-input-" + size}`, children: [
|
|
5955
|
-
/* @__PURE__ */
|
|
5769
|
+
/* @__PURE__ */ jsx29(
|
|
5956
5770
|
"input",
|
|
5957
5771
|
{
|
|
5958
5772
|
placeholder,
|
|
@@ -5963,7 +5777,7 @@ function Input2({
|
|
|
5963
5777
|
className: `matchid-token-input ${error ? "matchid-token-input-error" : ""}`
|
|
5964
5778
|
}
|
|
5965
5779
|
),
|
|
5966
|
-
error && /* @__PURE__ */
|
|
5780
|
+
error && /* @__PURE__ */ jsx29("div", { className: "matchid-token-input-error-text", children: error })
|
|
5967
5781
|
] });
|
|
5968
5782
|
}
|
|
5969
5783
|
function TokenSend({
|
|
@@ -5973,7 +5787,7 @@ function TokenSend({
|
|
|
5973
5787
|
onBack
|
|
5974
5788
|
}) {
|
|
5975
5789
|
const { list: chainList } = useMatchChain();
|
|
5976
|
-
const intl =
|
|
5790
|
+
const intl = useIntl16();
|
|
5977
5791
|
const { createWalletClient: createWalletClient2 } = useWallet();
|
|
5978
5792
|
const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
|
|
5979
5793
|
const chain = useMemo15(() => {
|
|
@@ -5986,11 +5800,11 @@ function TokenSend({
|
|
|
5986
5800
|
transport: http6()
|
|
5987
5801
|
});
|
|
5988
5802
|
}, [chain]);
|
|
5989
|
-
const [amount, setAmount] =
|
|
5990
|
-
const [address, setAddress] =
|
|
5991
|
-
const [loading, setLoading] =
|
|
5992
|
-
const [sending, setSending] =
|
|
5993
|
-
const [txError, setTxError] =
|
|
5803
|
+
const [amount, setAmount] = useState25("");
|
|
5804
|
+
const [address, setAddress] = useState25("");
|
|
5805
|
+
const [loading, setLoading] = useState25(false);
|
|
5806
|
+
const [sending, setSending] = useState25(false);
|
|
5807
|
+
const [txError, setTxError] = useState25("");
|
|
5994
5808
|
const transaction = useMemo15(() => {
|
|
5995
5809
|
const reg = /^0x[a-fA-F0-9]{40}$/;
|
|
5996
5810
|
if (!amount || !address || !reg.test(address)) {
|
|
@@ -6075,7 +5889,7 @@ function TokenSend({
|
|
|
6075
5889
|
}
|
|
6076
5890
|
onClose();
|
|
6077
5891
|
};
|
|
6078
|
-
|
|
5892
|
+
useEffect23(() => {
|
|
6079
5893
|
const receiveMessage = (event) => {
|
|
6080
5894
|
if (event.data) {
|
|
6081
5895
|
if (event.data.source == "match-wallet") {
|
|
@@ -6091,24 +5905,24 @@ function TokenSend({
|
|
|
6091
5905
|
window.removeEventListener("message", receiveMessage);
|
|
6092
5906
|
};
|
|
6093
5907
|
}, []);
|
|
6094
|
-
return /* @__PURE__ */
|
|
5908
|
+
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
5909
|
/* @__PURE__ */ jsxs20("div", { className: "matchid-token-send-content", children: [
|
|
6096
5910
|
/* @__PURE__ */ jsxs20("div", { className: `matchid-token-amount-content`, children: [
|
|
6097
5911
|
/* @__PURE__ */ jsxs20("div", { className: `matchid-token-amount-header`, children: [
|
|
6098
|
-
/* @__PURE__ */
|
|
5912
|
+
/* @__PURE__ */ jsx29("div", { className: `matchid-token-amount-title`, children: /* @__PURE__ */ jsx29(FormattedMessage12, { id: "amount" }) }),
|
|
6099
5913
|
/* @__PURE__ */ jsxs20("div", { className: `matchid-token-amount-chain`, children: [
|
|
6100
|
-
token.icon ? /* @__PURE__ */
|
|
5914
|
+
token.icon ? /* @__PURE__ */ jsx29(
|
|
6101
5915
|
"img",
|
|
6102
5916
|
{
|
|
6103
5917
|
src: token?.icon,
|
|
6104
5918
|
alt: token?.symbol,
|
|
6105
5919
|
className: `matchid-token-amount-chain-icon`
|
|
6106
5920
|
}
|
|
6107
|
-
) : /* @__PURE__ */
|
|
6108
|
-
/* @__PURE__ */
|
|
5921
|
+
) : /* @__PURE__ */ jsx29(AlphaAvatar, { name: token.symbol || token.name || "", size: 16 }),
|
|
5922
|
+
/* @__PURE__ */ jsx29("span", { children: token?.symbol })
|
|
6109
5923
|
] })
|
|
6110
5924
|
] }),
|
|
6111
|
-
/* @__PURE__ */
|
|
5925
|
+
/* @__PURE__ */ jsx29(
|
|
6112
5926
|
Input2,
|
|
6113
5927
|
{
|
|
6114
5928
|
type: "text",
|
|
@@ -6123,16 +5937,16 @@ function TokenSend({
|
|
|
6123
5937
|
),
|
|
6124
5938
|
/* @__PURE__ */ jsxs20("div", { className: `matchid-token-amount-footer`, children: [
|
|
6125
5939
|
/* @__PURE__ */ jsxs20("div", { className: `matchid-token-amount-title`, children: [
|
|
6126
|
-
/* @__PURE__ */
|
|
5940
|
+
/* @__PURE__ */ jsx29(FormattedMessage12, { id: "balance" }),
|
|
6127
5941
|
":"
|
|
6128
5942
|
] }),
|
|
6129
|
-
/* @__PURE__ */
|
|
5943
|
+
/* @__PURE__ */ jsx29("div", { className: `matchid-token-amount-value`, children: /* @__PURE__ */ jsx29(NumberFormatter, { value: token.balance, tFixNum: 10, suffix: " " + token.symbol }) })
|
|
6130
5944
|
] }),
|
|
6131
|
-
/* @__PURE__ */
|
|
5945
|
+
/* @__PURE__ */ jsx29(TransferIcon, { className: "matchid-token-amount-transfer" })
|
|
6132
5946
|
] }),
|
|
6133
5947
|
/* @__PURE__ */ jsxs20("div", { className: `matchid-token-address-content`, children: [
|
|
6134
|
-
/* @__PURE__ */
|
|
6135
|
-
/* @__PURE__ */
|
|
5948
|
+
/* @__PURE__ */ jsx29("div", { className: `matchid-token-address-header`, children: /* @__PURE__ */ jsx29("div", { className: `matchid-token-address-title`, children: /* @__PURE__ */ jsx29(FormattedMessage12, { id: "receiveTitle" }) }) }),
|
|
5949
|
+
/* @__PURE__ */ jsx29(
|
|
6136
5950
|
Input2,
|
|
6137
5951
|
{
|
|
6138
5952
|
type: "text",
|
|
@@ -6148,7 +5962,7 @@ function TokenSend({
|
|
|
6148
5962
|
)
|
|
6149
5963
|
] })
|
|
6150
5964
|
] }),
|
|
6151
|
-
/* @__PURE__ */
|
|
5965
|
+
/* @__PURE__ */ jsx29(
|
|
6152
5966
|
Button,
|
|
6153
5967
|
{
|
|
6154
5968
|
size: "lg",
|
|
@@ -6157,15 +5971,15 @@ function TokenSend({
|
|
|
6157
5971
|
disabled: !canSend || !!txError,
|
|
6158
5972
|
onClick: onNext,
|
|
6159
5973
|
loading: loading || sending,
|
|
6160
|
-
children: /* @__PURE__ */
|
|
5974
|
+
children: /* @__PURE__ */ jsx29(FormattedMessage12, { id: "next" })
|
|
6161
5975
|
}
|
|
6162
5976
|
)
|
|
6163
5977
|
] }) });
|
|
6164
5978
|
}
|
|
6165
5979
|
|
|
6166
5980
|
// src/components/TokenDetail/index.tsx
|
|
6167
|
-
import { FormattedMessage as FormattedMessage13, useIntl as
|
|
6168
|
-
import { jsx as
|
|
5981
|
+
import { FormattedMessage as FormattedMessage13, useIntl as useIntl17 } from "react-intl";
|
|
5982
|
+
import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6169
5983
|
function TokenDetail({
|
|
6170
5984
|
onClose,
|
|
6171
5985
|
token
|
|
@@ -6175,41 +5989,41 @@ function TokenDetail({
|
|
|
6175
5989
|
const chain = chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
6176
5990
|
const onSend = () => {
|
|
6177
5991
|
modal.show((props) => {
|
|
6178
|
-
return /* @__PURE__ */
|
|
5992
|
+
return /* @__PURE__ */ jsx30(TokenSend, { onClose: () => {
|
|
6179
5993
|
props.close();
|
|
6180
5994
|
onClose();
|
|
6181
5995
|
}, onBack: props.close, zIndex: props.zIndex, token });
|
|
6182
5996
|
});
|
|
6183
5997
|
};
|
|
6184
|
-
const intl =
|
|
6185
|
-
return /* @__PURE__ */
|
|
5998
|
+
const intl = useIntl17();
|
|
5999
|
+
return /* @__PURE__ */ jsx30(ModalDrawer, { isOpen: true, title: intl.formatMessage({
|
|
6186
6000
|
id: "tokenDetails"
|
|
6187
6001
|
}), onClose, children: /* @__PURE__ */ jsxs21("div", { className: `matchid-token-detail`, children: [
|
|
6188
6002
|
/* @__PURE__ */ jsxs21("div", { className: `matchid-token-main`, children: [
|
|
6189
6003
|
/* @__PURE__ */ jsxs21("div", { className: `matchid-token-info`, children: [
|
|
6190
6004
|
/* @__PURE__ */ jsxs21("div", { className: `matchid-token-logo`, children: [
|
|
6191
|
-
token.icon ? /* @__PURE__ */
|
|
6192
|
-
chain?.iconUrl && /* @__PURE__ */
|
|
6005
|
+
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 || "" }),
|
|
6006
|
+
chain?.iconUrl && /* @__PURE__ */ jsx30("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-token-chain` })
|
|
6193
6007
|
] }),
|
|
6194
6008
|
/* @__PURE__ */ jsxs21("div", { className: `matchid-token-name`, children: [
|
|
6195
|
-
/* @__PURE__ */
|
|
6009
|
+
/* @__PURE__ */ jsx30(NumberFormatter, { value: token.balance, tFixNum: 10 }),
|
|
6196
6010
|
" ",
|
|
6197
6011
|
token.symbol
|
|
6198
6012
|
] })
|
|
6199
6013
|
] }),
|
|
6200
6014
|
token.address.toLowerCase() != NATIVE_TOKEN_ADDRESS && /* @__PURE__ */ jsxs21("div", { className: `matchid-token-contract`, children: [
|
|
6201
|
-
/* @__PURE__ */
|
|
6202
|
-
/* @__PURE__ */
|
|
6015
|
+
/* @__PURE__ */ jsx30("div", { className: "matchid-token-contract-title", children: "Contract address" }),
|
|
6016
|
+
/* @__PURE__ */ jsx30("div", { className: "matchid-token-contract-address", children: token.address })
|
|
6203
6017
|
] })
|
|
6204
6018
|
] }),
|
|
6205
|
-
/* @__PURE__ */
|
|
6019
|
+
/* @__PURE__ */ jsx30(Button, { size: "lg", block: true, highlight: true, onClick: onSend, children: /* @__PURE__ */ jsx30(FormattedMessage13, { id: "send" }) })
|
|
6206
6020
|
] }) });
|
|
6207
6021
|
}
|
|
6208
6022
|
|
|
6209
6023
|
// src/components/TokenSendList/index.tsx
|
|
6210
|
-
import { useState as
|
|
6024
|
+
import { useState as useState26 } from "react";
|
|
6211
6025
|
import { FormattedMessage as FormattedMessage14 } from "react-intl";
|
|
6212
|
-
import { jsx as
|
|
6026
|
+
import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6213
6027
|
function TokenSendList({ close }) {
|
|
6214
6028
|
const isDownMd = useDownMd();
|
|
6215
6029
|
const walletAssets = useMatchWalletAssets();
|
|
@@ -6217,18 +6031,18 @@ function TokenSendList({ close }) {
|
|
|
6217
6031
|
list: walletAssets.mergedAssets
|
|
6218
6032
|
});
|
|
6219
6033
|
const { list } = useMatchChain();
|
|
6220
|
-
const [checked, setChecked] =
|
|
6034
|
+
const [checked, setChecked] = useState26();
|
|
6221
6035
|
const modal = useModal();
|
|
6222
6036
|
const onNext = () => {
|
|
6223
6037
|
checked && modal.show((props) => {
|
|
6224
|
-
return /* @__PURE__ */
|
|
6038
|
+
return /* @__PURE__ */ jsx31(TokenSend, { onClose: () => {
|
|
6225
6039
|
props.close();
|
|
6226
6040
|
close();
|
|
6227
6041
|
}, onBack: props.close, zIndex: props.zIndex, token: checked });
|
|
6228
6042
|
});
|
|
6229
6043
|
};
|
|
6230
6044
|
return /* @__PURE__ */ jsxs22("div", { className: "matchid-token-send-list-box", children: [
|
|
6231
|
-
/* @__PURE__ */
|
|
6045
|
+
/* @__PURE__ */ jsx31("div", { className: "matchid-token-send-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
6232
6046
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
6233
6047
|
return /* @__PURE__ */ jsxs22(
|
|
6234
6048
|
"div",
|
|
@@ -6238,10 +6052,10 @@ function TokenSendList({ close }) {
|
|
|
6238
6052
|
setChecked(n);
|
|
6239
6053
|
},
|
|
6240
6054
|
children: [
|
|
6241
|
-
/* @__PURE__ */
|
|
6055
|
+
/* @__PURE__ */ jsx31(Radio, { checked: checked?.address == n.address, size: isDownMd ? 18 : 24 }),
|
|
6242
6056
|
/* @__PURE__ */ jsxs22("div", { className: "matchid-token-send-content", children: [
|
|
6243
6057
|
/* @__PURE__ */ jsxs22("div", { className: "matchid-token-send-logo", children: [
|
|
6244
|
-
n.icon ? /* @__PURE__ */
|
|
6058
|
+
n.icon ? /* @__PURE__ */ jsx31("img", { src: n.icon, alt: n.symbol, className: `matchid-token-send-icon` }) : /* @__PURE__ */ jsx31(
|
|
6245
6059
|
AlphaAvatar2,
|
|
6246
6060
|
{
|
|
6247
6061
|
className: `matchid-token-send-icon`,
|
|
@@ -6249,7 +6063,7 @@ function TokenSendList({ close }) {
|
|
|
6249
6063
|
name: n.symbol || n.name || ""
|
|
6250
6064
|
}
|
|
6251
6065
|
),
|
|
6252
|
-
chain?.iconUrl && /* @__PURE__ */
|
|
6066
|
+
chain?.iconUrl && /* @__PURE__ */ jsx31(
|
|
6253
6067
|
"img",
|
|
6254
6068
|
{
|
|
6255
6069
|
src: chain.iconUrl,
|
|
@@ -6259,8 +6073,8 @@ function TokenSendList({ close }) {
|
|
|
6259
6073
|
)
|
|
6260
6074
|
] }),
|
|
6261
6075
|
/* @__PURE__ */ jsxs22("div", { className: `matchid-token-send-info`, children: [
|
|
6262
|
-
/* @__PURE__ */
|
|
6263
|
-
/* @__PURE__ */
|
|
6076
|
+
/* @__PURE__ */ jsx31("div", { className: `matchid-token-send-name`, children: n.symbol }),
|
|
6077
|
+
/* @__PURE__ */ jsx31("div", { className: `matchid-token-send-balance`, children: /* @__PURE__ */ jsx31(NumberFormatter, { value: n.balance, tFixNum: 3 }) })
|
|
6264
6078
|
] })
|
|
6265
6079
|
] })
|
|
6266
6080
|
]
|
|
@@ -6268,23 +6082,23 @@ function TokenSendList({ close }) {
|
|
|
6268
6082
|
index
|
|
6269
6083
|
);
|
|
6270
6084
|
}) }),
|
|
6271
|
-
/* @__PURE__ */
|
|
6085
|
+
/* @__PURE__ */ jsx31(Button, { size: "lg", highlight: true, block: true, disabled: !checked, onClick: onNext, children: /* @__PURE__ */ jsx31(FormattedMessage14, { id: "next" }) })
|
|
6272
6086
|
] });
|
|
6273
6087
|
}
|
|
6274
6088
|
|
|
6275
6089
|
// src/components/TransactionList/index.tsx
|
|
6276
6090
|
import InfiniteScroll from "react-infinite-scroll-component";
|
|
6277
|
-
import { useEffect as
|
|
6091
|
+
import { useEffect as useEffect24, useMemo as useMemo16, useState as useState27 } from "react";
|
|
6278
6092
|
import { decodeFunctionData, defineChain as defineChain5, formatUnits as formatUnits3 } from "viem";
|
|
6279
6093
|
import { erc20Abi as erc20Abi4 } from "viem";
|
|
6280
6094
|
import { FormattedMessage as FormattedMessage15 } from "react-intl";
|
|
6281
|
-
import { jsx as
|
|
6095
|
+
import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6282
6096
|
var Item = ({ data }) => {
|
|
6283
6097
|
const { address } = useWallet();
|
|
6284
6098
|
const isOut = data.from.toLowerCase() == address.toLowerCase();
|
|
6285
6099
|
const { chain, chainId, explorerLink, formatUnits: chainFormatUnits } = useMatchChain();
|
|
6286
6100
|
const { contracts } = useContractStore_default();
|
|
6287
|
-
const [shouldRefetch, setShouldRefetch] =
|
|
6101
|
+
const [shouldRefetch, setShouldRefetch] = useState27(true);
|
|
6288
6102
|
const transferType = useMemo16(() => {
|
|
6289
6103
|
const methodId = data.input.substring(2, 10);
|
|
6290
6104
|
if (methodId == "095ea7b3") {
|
|
@@ -6353,7 +6167,7 @@ var Item = ({ data }) => {
|
|
|
6353
6167
|
}
|
|
6354
6168
|
return "loading";
|
|
6355
6169
|
}, [data.extra?.status, data.source, hashQuery.data]);
|
|
6356
|
-
|
|
6170
|
+
useEffect24(() => {
|
|
6357
6171
|
if (data.hash) {
|
|
6358
6172
|
setShouldRefetch(status == "loading");
|
|
6359
6173
|
}
|
|
@@ -6373,10 +6187,10 @@ var Item = ({ data }) => {
|
|
|
6373
6187
|
className: `matchid-transaction-item`,
|
|
6374
6188
|
children: [
|
|
6375
6189
|
/* @__PURE__ */ jsxs23("div", { className: `matchid-transacton-item-container`, children: [
|
|
6376
|
-
/* @__PURE__ */
|
|
6190
|
+
/* @__PURE__ */ jsx32("div", { className: "matchid-transaction-item-icon", children: /* @__PURE__ */ jsx32(ArrowSendIcon, { className: !isOut ? "rotate-180" : "" }) }),
|
|
6377
6191
|
/* @__PURE__ */ jsxs23("div", { className: `matchid-transaction-item-details`, children: [
|
|
6378
|
-
/* @__PURE__ */
|
|
6379
|
-
/* @__PURE__ */
|
|
6192
|
+
/* @__PURE__ */ jsx32("div", { className: `matchid-transaction-item-address`, children: formatAddress(to, 6, 4) }),
|
|
6193
|
+
/* @__PURE__ */ jsx32(
|
|
6380
6194
|
"div",
|
|
6381
6195
|
{
|
|
6382
6196
|
className: `matchid-transaction-item-timestamp`,
|
|
@@ -6386,10 +6200,10 @@ var Item = ({ data }) => {
|
|
|
6386
6200
|
] })
|
|
6387
6201
|
] }),
|
|
6388
6202
|
/* @__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__ */
|
|
6203
|
+
/* @__PURE__ */ jsx32(NumberFormatter, { value: amount, tFixNum: 6, prefix: isOut ? "-" : "+", suffix: " " + symbol }),
|
|
6204
|
+
status == "loading" && /* @__PURE__ */ jsx32(LoadingIcon_default, { color: "#000000", size: 16, rotate: true }),
|
|
6205
|
+
status == "success" && /* @__PURE__ */ jsx32(CheckRoundIcon, { size: 16 }),
|
|
6206
|
+
status == "error" && /* @__PURE__ */ jsx32(InfoRoundIcon, { size: 16 })
|
|
6393
6207
|
] })
|
|
6394
6208
|
]
|
|
6395
6209
|
}
|
|
@@ -6399,7 +6213,7 @@ function TransactionList({
|
|
|
6399
6213
|
scrollableTarget
|
|
6400
6214
|
}) {
|
|
6401
6215
|
const { fetchMoreData, hasMore, items } = useMatchWalletRecords();
|
|
6402
|
-
return /* @__PURE__ */
|
|
6216
|
+
return /* @__PURE__ */ jsx32(
|
|
6403
6217
|
InfiniteScroll,
|
|
6404
6218
|
{
|
|
6405
6219
|
scrollableTarget,
|
|
@@ -6407,11 +6221,11 @@ function TransactionList({
|
|
|
6407
6221
|
next: fetchMoreData,
|
|
6408
6222
|
hasMore,
|
|
6409
6223
|
loader: /* @__PURE__ */ jsxs23("div", { className: "matchid-list-nomore", children: [
|
|
6410
|
-
/* @__PURE__ */
|
|
6224
|
+
/* @__PURE__ */ jsx32(LoadingIcon_default, { rotate: true, size: 16, color: "black" }),
|
|
6411
6225
|
"Loading..."
|
|
6412
6226
|
] }),
|
|
6413
|
-
endMessage: items.length > 0 ? /* @__PURE__ */
|
|
6414
|
-
children: items.length == 0 && !hasMore ? /* @__PURE__ */
|
|
6227
|
+
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" }) }),
|
|
6228
|
+
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
6229
|
}
|
|
6416
6230
|
);
|
|
6417
6231
|
}
|
|
@@ -6443,7 +6257,6 @@ export {
|
|
|
6443
6257
|
LoginModal,
|
|
6444
6258
|
LoginButton,
|
|
6445
6259
|
UsernameModal,
|
|
6446
|
-
SOLModal,
|
|
6447
6260
|
TRONModal,
|
|
6448
6261
|
TONModal,
|
|
6449
6262
|
BTCModal,
|
|
@@ -6464,4 +6277,4 @@ export {
|
|
|
6464
6277
|
MatchProvider,
|
|
6465
6278
|
useMatch
|
|
6466
6279
|
};
|
|
6467
|
-
//# sourceMappingURL=chunk-
|
|
6280
|
+
//# sourceMappingURL=chunk-W5A6WY7Y.mjs.map
|