@matchain/matchid-sdk-react 0.1.40-alpha.1 → 0.1.40-alpha.10
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 +6 -2
- package/dist/assets/icon/index.d.ts +6 -2
- package/dist/assets/icon/index.js +56 -0
- package/dist/assets/icon/index.js.map +1 -1
- package/dist/assets/icon/index.mjs +5 -1
- package/dist/{chunk-OG7AO57N.mjs → chunk-B2HVAJPQ.mjs} +2 -2
- package/dist/{chunk-6PWH7WZI.mjs → chunk-DPXMCLYK.mjs} +56 -2
- package/dist/chunk-DPXMCLYK.mjs.map +1 -0
- package/dist/{chunk-R3JJJMNQ.mjs → chunk-RYZFW6P6.mjs} +330 -100
- package/dist/chunk-RYZFW6P6.mjs.map +1 -0
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +496 -228
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +4 -2
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +64 -41
- 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 +68 -45
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/{index-mEK7Lcps.d.mts → index-C3KZYrtu.d.mts} +3 -2
- package/dist/{index-CvCSpU8m.d.ts → index-COlsBC-b.d.mts} +9 -3
- package/dist/{index-BPveUnst.d.ts → index-DoF5jRoi.d.ts} +1 -1
- package/dist/{index-DlrDrTMk.d.ts → index-Dq9Swg8r.d.ts} +3 -2
- package/dist/{index-ClQl2MMF.d.mts → index-fS75Swm8.d.ts} +9 -3
- package/dist/{index-Dm5o2w2J.d.mts → index-fl6SNIZC.d.mts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +572 -299
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/{types.d-IS3DBl3p.d.mts → types.d-CLO_WLka.d.mts} +1 -1
- package/dist/{types.d-IS3DBl3p.d.ts → types.d-CLO_WLka.d.ts} +1 -1
- package/example/src/components/Login/index.tsx +2 -2
- package/example/src/config/index.ts +6 -1
- package/example/src/pages/User.tsx +4 -4
- package/package.json +2 -2
- package/dist/chunk-6PWH7WZI.mjs.map +0 -1
- package/dist/chunk-R3JJJMNQ.mjs.map +0 -1
- /package/dist/{chunk-OG7AO57N.mjs.map → chunk-B2HVAJPQ.mjs.map} +0 -0
|
@@ -31,6 +31,8 @@ import {
|
|
|
31
31
|
TRXDarkIcon,
|
|
32
32
|
TRXLightIcon,
|
|
33
33
|
TelegramIcon,
|
|
34
|
+
TonLightIcon,
|
|
35
|
+
TonLightIcon2,
|
|
34
36
|
TronLinkIcon,
|
|
35
37
|
UnLoginIcon_default,
|
|
36
38
|
UnisatIcon,
|
|
@@ -38,7 +40,7 @@ import {
|
|
|
38
40
|
XIcon,
|
|
39
41
|
XverseIcon,
|
|
40
42
|
YoutubeIcon
|
|
41
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-DPXMCLYK.mjs";
|
|
42
44
|
import {
|
|
43
45
|
__export
|
|
44
46
|
} from "./chunk-J5LGTIGS.mjs";
|
|
@@ -270,11 +272,11 @@ var getBindInfoApi = () => {
|
|
|
270
272
|
method: "GET"
|
|
271
273
|
});
|
|
272
274
|
};
|
|
273
|
-
var bindCexApi = (
|
|
275
|
+
var bindCexApi = (data) => {
|
|
274
276
|
return request_default({
|
|
275
277
|
url: `/api/v1/cex/subscribe`,
|
|
276
278
|
method: "POST",
|
|
277
|
-
data
|
|
279
|
+
data
|
|
278
280
|
});
|
|
279
281
|
};
|
|
280
282
|
var unBindApi = ({ type }) => {
|
|
@@ -337,28 +339,42 @@ var getAuthInfoApi = () => {
|
|
|
337
339
|
method: "GET"
|
|
338
340
|
});
|
|
339
341
|
};
|
|
340
|
-
var getWalletNonceApi = (
|
|
342
|
+
var getWalletNonceApi = (data) => {
|
|
341
343
|
return request_default({
|
|
342
344
|
url: `/api/v1/login/wallet/init`,
|
|
343
345
|
method: "POST",
|
|
344
|
-
data
|
|
346
|
+
data
|
|
345
347
|
});
|
|
346
348
|
};
|
|
347
|
-
var loginByWalletApi = ({
|
|
349
|
+
var loginByWalletApi = ({
|
|
350
|
+
type,
|
|
351
|
+
address,
|
|
352
|
+
signature,
|
|
353
|
+
message,
|
|
354
|
+
connector_type,
|
|
355
|
+
wallet_client_type
|
|
356
|
+
}) => {
|
|
348
357
|
return request_default({
|
|
349
358
|
url: `/api/v1/login/wallet`,
|
|
350
359
|
method: "POST",
|
|
351
360
|
data: { type, address, signature, message, connector_type, wallet_client_type }
|
|
352
361
|
});
|
|
353
362
|
};
|
|
354
|
-
var getWalletInitApi = (
|
|
363
|
+
var getWalletInitApi = (data) => {
|
|
355
364
|
return request_default({
|
|
356
365
|
url: `/api/v1/wallet/init`,
|
|
357
366
|
method: "POST",
|
|
358
|
-
data
|
|
367
|
+
data
|
|
359
368
|
});
|
|
360
369
|
};
|
|
361
|
-
var toBindWalletApi = ({
|
|
370
|
+
var toBindWalletApi = ({
|
|
371
|
+
type,
|
|
372
|
+
address,
|
|
373
|
+
signature,
|
|
374
|
+
message,
|
|
375
|
+
connector_type,
|
|
376
|
+
wallet_client_type
|
|
377
|
+
}) => {
|
|
362
378
|
return request_default({
|
|
363
379
|
url: `/api/v1/wallet/bind`,
|
|
364
380
|
method: "POST",
|
|
@@ -752,6 +768,12 @@ var useTRONModalStore = create3((set) => ({
|
|
|
752
768
|
open: (type) => set({ isOpen: true, type }),
|
|
753
769
|
close: () => set({ isOpen: false })
|
|
754
770
|
}));
|
|
771
|
+
var useTONModalStore = create3((set) => ({
|
|
772
|
+
isOpen: false,
|
|
773
|
+
type: "",
|
|
774
|
+
open: (type) => set({ isOpen: true, type }),
|
|
775
|
+
close: () => set({ isOpen: false })
|
|
776
|
+
}));
|
|
755
777
|
var useBTCModalStore = create3((set) => ({
|
|
756
778
|
isOpen: false,
|
|
757
779
|
type: "",
|
|
@@ -782,6 +804,7 @@ __export(components_exports, {
|
|
|
782
804
|
PasswordModal: () => PasswordModal,
|
|
783
805
|
Popover: () => Popover,
|
|
784
806
|
SOLModal: () => SOLModal,
|
|
807
|
+
TONModal: () => TONModal,
|
|
785
808
|
TRONModal: () => TRONModal,
|
|
786
809
|
UsernameModal: () => UsernameModal
|
|
787
810
|
});
|
|
@@ -1193,6 +1216,12 @@ function LoginBox({
|
|
|
1193
1216
|
activeIcon: /* @__PURE__ */ jsx11(TRXLightIcon, { size: isDownMd ? 36 : 40 }),
|
|
1194
1217
|
name: "TRON",
|
|
1195
1218
|
onClick: () => login("tron")
|
|
1219
|
+
},
|
|
1220
|
+
ton: {
|
|
1221
|
+
icon: /* @__PURE__ */ jsx11(TonLightIcon, { size: isDownMd ? 36 : 40 }),
|
|
1222
|
+
activeIcon: /* @__PURE__ */ jsx11(TonLightIcon2, { size: isDownMd ? 36 : 40 }),
|
|
1223
|
+
name: "TON",
|
|
1224
|
+
onClick: () => login("ton")
|
|
1196
1225
|
}
|
|
1197
1226
|
};
|
|
1198
1227
|
return /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
@@ -1704,8 +1733,13 @@ function WalletModalContent({
|
|
|
1704
1733
|
text: error,
|
|
1705
1734
|
btnText: "Reconnect Wallet",
|
|
1706
1735
|
btnClick: async () => {
|
|
1736
|
+
console.log("click error");
|
|
1707
1737
|
setError("");
|
|
1708
|
-
|
|
1738
|
+
try {
|
|
1739
|
+
await disconnect();
|
|
1740
|
+
} catch (error2) {
|
|
1741
|
+
console.error(error2);
|
|
1742
|
+
}
|
|
1709
1743
|
setVisible(true);
|
|
1710
1744
|
},
|
|
1711
1745
|
statusImage: walletErrorImage,
|
|
@@ -1792,7 +1826,7 @@ function WalletContent({
|
|
|
1792
1826
|
try {
|
|
1793
1827
|
setStatus("nonce");
|
|
1794
1828
|
statusRef.current = "nonce";
|
|
1795
|
-
const res = type == "bind" ? await getWalletInitApi({ address }) : await getWalletNonceApi({ address });
|
|
1829
|
+
const res = type == "bind" ? await getWalletInitApi({ address, type: "SOL" }) : await getWalletNonceApi({ address, type: "SOL" });
|
|
1796
1830
|
if (!isSuccess(res)) {
|
|
1797
1831
|
throw new Error(res.message);
|
|
1798
1832
|
}
|
|
@@ -2059,7 +2093,7 @@ function TRONModal({
|
|
|
2059
2093
|
try {
|
|
2060
2094
|
setStatus("nonce");
|
|
2061
2095
|
statusRef.current = "nonce";
|
|
2062
|
-
const res = type == "bind" ? await getWalletInitApi({ address }) : await getWalletNonceApi({ address });
|
|
2096
|
+
const res = type == "bind" ? await getWalletInitApi({ address, type: "TRON" }) : await getWalletNonceApi({ address, type: "TRON" });
|
|
2063
2097
|
if (!isSuccess(res)) {
|
|
2064
2098
|
throw new Error(res.message);
|
|
2065
2099
|
}
|
|
@@ -2174,9 +2208,193 @@ function TRONModal({
|
|
|
2174
2208
|
] }) }) });
|
|
2175
2209
|
}
|
|
2176
2210
|
|
|
2177
|
-
// src/components/
|
|
2178
|
-
import React5, { useEffect as
|
|
2211
|
+
// src/components/TONModal/index.tsx
|
|
2212
|
+
import React5, { useEffect as useEffect11, useState as useState16 } from "react";
|
|
2179
2213
|
import { useIntl as useIntl12 } from "react-intl";
|
|
2214
|
+
import {
|
|
2215
|
+
TonConnectUIProvider,
|
|
2216
|
+
useTonAddress,
|
|
2217
|
+
useTonConnectModal,
|
|
2218
|
+
useTonConnectUI,
|
|
2219
|
+
useTonWallet
|
|
2220
|
+
} from "@tonconnect/ui-react";
|
|
2221
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2222
|
+
function WalletContent2({
|
|
2223
|
+
onSuccess,
|
|
2224
|
+
type
|
|
2225
|
+
}) {
|
|
2226
|
+
const { events, login } = useMatch();
|
|
2227
|
+
const [connected, setConnected] = useState16(false);
|
|
2228
|
+
const wallet = useTonWallet();
|
|
2229
|
+
const userFriendlyAddress = useTonAddress();
|
|
2230
|
+
const [tonConnectUI] = useTonConnectUI();
|
|
2231
|
+
const { state, open, close } = useTonConnectModal();
|
|
2232
|
+
const [status, setStatus] = useState16("");
|
|
2233
|
+
const statusRef = React5.useRef(status);
|
|
2234
|
+
const [error, setError] = useState16("");
|
|
2235
|
+
useEffect11(() => {
|
|
2236
|
+
const init = async () => {
|
|
2237
|
+
if (wallet) {
|
|
2238
|
+
await tonConnectUI.disconnect();
|
|
2239
|
+
}
|
|
2240
|
+
open();
|
|
2241
|
+
};
|
|
2242
|
+
init();
|
|
2243
|
+
tonConnectUI.onStatusChange((wallet2) => {
|
|
2244
|
+
matchlog_default.log("onStatusChange:", wallet2, wallet2?.connectItems?.tonProof, JSON.stringify(wallet2?.connectItems?.tonProof));
|
|
2245
|
+
if (wallet2?.connectItems?.tonProof && "proof" in wallet2.connectItems.tonProof) {
|
|
2246
|
+
matchlog_default.log(wallet2?.connectItems.tonProof.proof, wallet2?.account);
|
|
2247
|
+
const toLoginInWallet = async () => {
|
|
2248
|
+
if (statusRef.current || !wallet2) return;
|
|
2249
|
+
setStatus("signer");
|
|
2250
|
+
statusRef.current = "signer";
|
|
2251
|
+
try {
|
|
2252
|
+
const signature = {
|
|
2253
|
+
"address": wallet2?.account?.address,
|
|
2254
|
+
"network": wallet2?.account?.chain,
|
|
2255
|
+
"public_key": wallet2?.account?.publicKey,
|
|
2256
|
+
"proof": {
|
|
2257
|
+
//@ts-ignore
|
|
2258
|
+
...wallet2?.connectItems?.tonProof?.proof,
|
|
2259
|
+
"state_init": wallet2?.account?.walletStateInit
|
|
2260
|
+
}
|
|
2261
|
+
};
|
|
2262
|
+
let obj = {
|
|
2263
|
+
type: "TON",
|
|
2264
|
+
address: wallet2?.account?.publicKey,
|
|
2265
|
+
signature: JSON.stringify(signature),
|
|
2266
|
+
//@ts-ignore
|
|
2267
|
+
message: wallet2?.connectItems?.tonProof?.proof.payload,
|
|
2268
|
+
connector_type: "TON",
|
|
2269
|
+
wallet_client_type: wallet2?.name
|
|
2270
|
+
};
|
|
2271
|
+
console.log("signature", {
|
|
2272
|
+
signature,
|
|
2273
|
+
obj
|
|
2274
|
+
});
|
|
2275
|
+
const res1 = type == "bind" ? await toBindWalletApi(obj) : await loginByWalletApi(obj);
|
|
2276
|
+
if (res1) {
|
|
2277
|
+
if (!isSuccess(res1)) {
|
|
2278
|
+
throw new Error(res1.message);
|
|
2279
|
+
}
|
|
2280
|
+
matchlog_default.log(res1);
|
|
2281
|
+
setStatus("success");
|
|
2282
|
+
statusRef.current = "success";
|
|
2283
|
+
if (type == "bind") {
|
|
2284
|
+
events.onBind && events.onBind({
|
|
2285
|
+
type: "ton"
|
|
2286
|
+
});
|
|
2287
|
+
eventManager_default.emit("onBind", {
|
|
2288
|
+
type: "ton"
|
|
2289
|
+
});
|
|
2290
|
+
} else {
|
|
2291
|
+
await login({
|
|
2292
|
+
mid: res1.data.mid,
|
|
2293
|
+
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
2294
|
+
});
|
|
2295
|
+
}
|
|
2296
|
+
onSuccess && onSuccess();
|
|
2297
|
+
}
|
|
2298
|
+
} catch (error2) {
|
|
2299
|
+
setStatus("error");
|
|
2300
|
+
setError(error2.message);
|
|
2301
|
+
statusRef.current = "";
|
|
2302
|
+
}
|
|
2303
|
+
};
|
|
2304
|
+
toLoginInWallet();
|
|
2305
|
+
}
|
|
2306
|
+
});
|
|
2307
|
+
}, []);
|
|
2308
|
+
useEffect11(() => {
|
|
2309
|
+
if (wallet) {
|
|
2310
|
+
setConnected(true);
|
|
2311
|
+
console.log("Wallet connected:", wallet);
|
|
2312
|
+
} else {
|
|
2313
|
+
setConnected(false);
|
|
2314
|
+
open();
|
|
2315
|
+
statusRef.current = "";
|
|
2316
|
+
setStatus("");
|
|
2317
|
+
}
|
|
2318
|
+
}, [wallet]);
|
|
2319
|
+
useEffect11(() => {
|
|
2320
|
+
console.log({
|
|
2321
|
+
state,
|
|
2322
|
+
wallet
|
|
2323
|
+
});
|
|
2324
|
+
if (state.status == "opened") {
|
|
2325
|
+
const init = async () => {
|
|
2326
|
+
tonConnectUI.setConnectRequestParameters({ state: "loading" });
|
|
2327
|
+
const res = type == "bind" ? await getWalletInitApi({
|
|
2328
|
+
address: "tonconnect",
|
|
2329
|
+
type: "TON"
|
|
2330
|
+
}) : await getWalletNonceApi({ address: "tonconnect", type: "TON" });
|
|
2331
|
+
if (!isSuccess(res)) {
|
|
2332
|
+
tonConnectUI.setConnectRequestParameters(null);
|
|
2333
|
+
throw new Error(res.message);
|
|
2334
|
+
}
|
|
2335
|
+
tonConnectUI.setConnectRequestParameters({
|
|
2336
|
+
state: "ready",
|
|
2337
|
+
value: { tonProof: res.data.nonce }
|
|
2338
|
+
});
|
|
2339
|
+
};
|
|
2340
|
+
init();
|
|
2341
|
+
} else {
|
|
2342
|
+
if (!wallet) {
|
|
2343
|
+
setStatus("");
|
|
2344
|
+
statusRef.current = "";
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
}, [state]);
|
|
2348
|
+
return /* @__PURE__ */ jsx22(
|
|
2349
|
+
WalletModalContent,
|
|
2350
|
+
{
|
|
2351
|
+
connected,
|
|
2352
|
+
disconnect: tonConnectUI.disconnect,
|
|
2353
|
+
address: userFriendlyAddress,
|
|
2354
|
+
visible: state.status == "opened",
|
|
2355
|
+
setVisible: async (v) => {
|
|
2356
|
+
console.log("setVisible", v);
|
|
2357
|
+
if (v) {
|
|
2358
|
+
if (wallet) {
|
|
2359
|
+
await tonConnectUI.disconnect();
|
|
2360
|
+
}
|
|
2361
|
+
setStatus("");
|
|
2362
|
+
statusRef.current = "";
|
|
2363
|
+
open();
|
|
2364
|
+
} else {
|
|
2365
|
+
close();
|
|
2366
|
+
}
|
|
2367
|
+
},
|
|
2368
|
+
error,
|
|
2369
|
+
setError,
|
|
2370
|
+
status
|
|
2371
|
+
}
|
|
2372
|
+
);
|
|
2373
|
+
}
|
|
2374
|
+
function TONModal({
|
|
2375
|
+
type = "login",
|
|
2376
|
+
onSuccess,
|
|
2377
|
+
...props
|
|
2378
|
+
}) {
|
|
2379
|
+
const intl = useIntl12();
|
|
2380
|
+
const { endpoints, appid } = useLocalStore_default();
|
|
2381
|
+
const manifestUrl = `${endpoints.back}api/v1/wallet/ton?appid=${appid}&url=` + encodeURIComponent(window.location.origin);
|
|
2382
|
+
return /* @__PURE__ */ jsx22(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
2383
|
+
id: type == "bind" ? "bindWith" : "loginWith"
|
|
2384
|
+
}, {
|
|
2385
|
+
name: "TON"
|
|
2386
|
+
}), children: /* @__PURE__ */ jsx22(
|
|
2387
|
+
TonConnectUIProvider,
|
|
2388
|
+
{
|
|
2389
|
+
manifestUrl,
|
|
2390
|
+
children: /* @__PURE__ */ jsx22(WalletContent2, { onSuccess, type })
|
|
2391
|
+
}
|
|
2392
|
+
) });
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
// src/components/BTCModal/index.tsx
|
|
2396
|
+
import React6, { useEffect as useEffect13, useMemo as useMemo8, useState as useState18 } from "react";
|
|
2397
|
+
import { useIntl as useIntl13 } from "react-intl";
|
|
2180
2398
|
|
|
2181
2399
|
// src/lib/btc/UnisatAdapter.ts
|
|
2182
2400
|
var UnisatAdapter = class {
|
|
@@ -2330,12 +2548,12 @@ var LeatherAdapter = class {
|
|
|
2330
2548
|
};
|
|
2331
2549
|
|
|
2332
2550
|
// src/hooks/useBTCWallet.ts
|
|
2333
|
-
import { useEffect as
|
|
2551
|
+
import { useEffect as useEffect12, useState as useState17 } from "react";
|
|
2334
2552
|
var useBTCWallet = () => {
|
|
2335
2553
|
const wallets2 = [new UnisatAdapter(), new XverseAdapter(), new LeatherAdapter()];
|
|
2336
|
-
const [installedWallets, setInstalledWallets] =
|
|
2337
|
-
const [address, setAddress] =
|
|
2338
|
-
|
|
2554
|
+
const [installedWallets, setInstalledWallets] = useState17([]);
|
|
2555
|
+
const [address, setAddress] = useState17(null);
|
|
2556
|
+
useEffect12(() => {
|
|
2339
2557
|
const getInstalled = async () => {
|
|
2340
2558
|
const installed = await Promise.all(wallets2.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
2341
2559
|
wallet: wallet2,
|
|
@@ -2345,11 +2563,11 @@ var useBTCWallet = () => {
|
|
|
2345
2563
|
};
|
|
2346
2564
|
getInstalled();
|
|
2347
2565
|
}, []);
|
|
2348
|
-
const [wallet, chooseWallet] =
|
|
2566
|
+
const [wallet, chooseWallet] = useState17(null);
|
|
2349
2567
|
const onConnect = async () => {
|
|
2350
2568
|
setAddress(await wallet.connect());
|
|
2351
2569
|
};
|
|
2352
|
-
|
|
2570
|
+
useEffect12(() => {
|
|
2353
2571
|
if (!wallet) {
|
|
2354
2572
|
setAddress(null);
|
|
2355
2573
|
}
|
|
@@ -2365,24 +2583,24 @@ var useBTCWallet = () => {
|
|
|
2365
2583
|
};
|
|
2366
2584
|
|
|
2367
2585
|
// src/components/BTCModal/index.tsx
|
|
2368
|
-
import { jsx as
|
|
2586
|
+
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2369
2587
|
function BTCModal({
|
|
2370
2588
|
type = "login",
|
|
2371
2589
|
onSuccess,
|
|
2372
2590
|
...props
|
|
2373
2591
|
}) {
|
|
2374
2592
|
const isDownMd = useDownMd();
|
|
2375
|
-
const intl =
|
|
2593
|
+
const intl = useIntl13();
|
|
2376
2594
|
const { wallets: wallets2, installedWallets, chooseWallet, wallet, address, onConnect } = useBTCWallet();
|
|
2377
2595
|
const iconMaps = {
|
|
2378
|
-
leather: /* @__PURE__ */
|
|
2379
|
-
unisat: /* @__PURE__ */
|
|
2380
|
-
xverse: /* @__PURE__ */
|
|
2596
|
+
leather: /* @__PURE__ */ jsx23(LeatherIcon, { size: isDownMd ? 36 : 40 }),
|
|
2597
|
+
unisat: /* @__PURE__ */ jsx23(UnisatIcon, { size: isDownMd ? 36 : 40 }),
|
|
2598
|
+
xverse: /* @__PURE__ */ jsx23(XverseIcon, { size: isDownMd ? 36 : 40 })
|
|
2381
2599
|
};
|
|
2382
2600
|
const { events, login } = useMatch();
|
|
2383
|
-
const [status, setStatus] =
|
|
2384
|
-
const statusRef =
|
|
2385
|
-
const [error, setError] =
|
|
2601
|
+
const [status, setStatus] = useState18("");
|
|
2602
|
+
const statusRef = React6.useRef(status);
|
|
2603
|
+
const [error, setError] = useState18("");
|
|
2386
2604
|
const connected = useMemo8(() => {
|
|
2387
2605
|
return !!address;
|
|
2388
2606
|
}, [address]);
|
|
@@ -2398,7 +2616,7 @@ function BTCModal({
|
|
|
2398
2616
|
try {
|
|
2399
2617
|
setStatus("nonce");
|
|
2400
2618
|
statusRef.current = "nonce";
|
|
2401
|
-
const res = type == "bind" ? await getWalletInitApi({ address }) : await getWalletNonceApi({ address });
|
|
2619
|
+
const res = type == "bind" ? await getWalletInitApi({ address, type: "BTC" }) : await getWalletNonceApi({ address, type: "BTC" });
|
|
2402
2620
|
if (!isSuccess(res)) {
|
|
2403
2621
|
throw new Error(res.message);
|
|
2404
2622
|
}
|
|
@@ -2447,7 +2665,7 @@ function BTCModal({
|
|
|
2447
2665
|
statusRef.current = "";
|
|
2448
2666
|
}
|
|
2449
2667
|
};
|
|
2450
|
-
|
|
2668
|
+
useEffect13(() => {
|
|
2451
2669
|
if (wallet) {
|
|
2452
2670
|
console.log("onConnect");
|
|
2453
2671
|
try {
|
|
@@ -2460,12 +2678,12 @@ function BTCModal({
|
|
|
2460
2678
|
setStatus("");
|
|
2461
2679
|
}
|
|
2462
2680
|
}, [wallet]);
|
|
2463
|
-
|
|
2681
|
+
useEffect13(() => {
|
|
2464
2682
|
if (address) {
|
|
2465
2683
|
toLoginInWallet();
|
|
2466
2684
|
}
|
|
2467
2685
|
}, [address]);
|
|
2468
|
-
|
|
2686
|
+
useEffect13(() => {
|
|
2469
2687
|
if (!props.isOpen) {
|
|
2470
2688
|
disconnect();
|
|
2471
2689
|
}
|
|
@@ -2477,11 +2695,11 @@ function BTCModal({
|
|
|
2477
2695
|
statusRef.current = "";
|
|
2478
2696
|
setError("");
|
|
2479
2697
|
};
|
|
2480
|
-
return /* @__PURE__ */
|
|
2698
|
+
return /* @__PURE__ */ jsx23(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
2481
2699
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
2482
2700
|
}, {
|
|
2483
2701
|
name: "BTC"
|
|
2484
|
-
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */
|
|
2702
|
+
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ jsx23(
|
|
2485
2703
|
WalletModalContent,
|
|
2486
2704
|
{
|
|
2487
2705
|
error,
|
|
@@ -2494,9 +2712,9 @@ function BTCModal({
|
|
|
2494
2712
|
setVisible: () => {
|
|
2495
2713
|
}
|
|
2496
2714
|
}
|
|
2497
|
-
) : /* @__PURE__ */
|
|
2715
|
+
) : /* @__PURE__ */ jsx23("div", { className: "matchid-login-box", children: /* @__PURE__ */ jsxs18("div", { className: "matchid-login-recommend-list", children: [
|
|
2498
2716
|
installedWallets.map((wallet2) => {
|
|
2499
|
-
return /* @__PURE__ */
|
|
2717
|
+
return /* @__PURE__ */ jsx23(
|
|
2500
2718
|
RecommendItem,
|
|
2501
2719
|
{
|
|
2502
2720
|
icon: iconMaps[wallet2.walletKey],
|
|
@@ -2509,14 +2727,14 @@ function BTCModal({
|
|
|
2509
2727
|
);
|
|
2510
2728
|
}),
|
|
2511
2729
|
wallets2.filter((wallet2) => !installedWallets.find((installedWallet) => installedWallet.walletKey == wallet2.walletKey)).map((wallet2) => {
|
|
2512
|
-
return /* @__PURE__ */
|
|
2730
|
+
return /* @__PURE__ */ jsx23(
|
|
2513
2731
|
RecommendItem,
|
|
2514
2732
|
{
|
|
2515
2733
|
icon: iconMaps[wallet2.walletKey],
|
|
2516
2734
|
name: wallet2.name,
|
|
2517
2735
|
onClick: () => {
|
|
2518
2736
|
},
|
|
2519
|
-
footer: /* @__PURE__ */
|
|
2737
|
+
footer: /* @__PURE__ */ jsx23(Button, { size: "sm", onClick: () => {
|
|
2520
2738
|
window.open(wallet2.website);
|
|
2521
2739
|
}, children: "Install" })
|
|
2522
2740
|
},
|
|
@@ -2527,27 +2745,27 @@ function BTCModal({
|
|
|
2527
2745
|
}
|
|
2528
2746
|
|
|
2529
2747
|
// src/components/CEXBindModal/index.tsx
|
|
2530
|
-
import { useEffect as
|
|
2531
|
-
import { FormattedMessage as FormattedMessage10, useIntl as
|
|
2532
|
-
import { jsx as
|
|
2748
|
+
import { useEffect as useEffect14, useMemo as useMemo9, useState as useState19 } from "react";
|
|
2749
|
+
import { FormattedMessage as FormattedMessage10, useIntl as useIntl14 } from "react-intl";
|
|
2750
|
+
import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2533
2751
|
function CEXBindModal({
|
|
2534
2752
|
onClose,
|
|
2535
2753
|
type,
|
|
2536
2754
|
isOpen = false,
|
|
2537
2755
|
...props
|
|
2538
2756
|
}) {
|
|
2539
|
-
const intl =
|
|
2757
|
+
const intl = useIntl14();
|
|
2540
2758
|
const { events } = useMatch();
|
|
2541
|
-
const [APIPassphrase, setAPIPassphrase] =
|
|
2759
|
+
const [APIPassphrase, setAPIPassphrase] = useState19("");
|
|
2542
2760
|
const { refreshOverview } = useUserInfo();
|
|
2543
|
-
const [loading, setLoading] =
|
|
2544
|
-
const [key, setKey] =
|
|
2545
|
-
const [secret, setSecret] =
|
|
2546
|
-
const [error, setError] =
|
|
2761
|
+
const [loading, setLoading] = useState19(false);
|
|
2762
|
+
const [key, setKey] = useState19("");
|
|
2763
|
+
const [secret, setSecret] = useState19("");
|
|
2764
|
+
const [error, setError] = useState19("");
|
|
2547
2765
|
const needPassphrase = useMemo9(() => {
|
|
2548
2766
|
return ["bitget", "okx"].includes(type.toLowerCase());
|
|
2549
2767
|
}, [type]);
|
|
2550
|
-
|
|
2768
|
+
useEffect14(() => {
|
|
2551
2769
|
if (isOpen) {
|
|
2552
2770
|
setSecret("");
|
|
2553
2771
|
setKey("");
|
|
@@ -2584,20 +2802,20 @@ function CEXBindModal({
|
|
|
2584
2802
|
setLoading(false);
|
|
2585
2803
|
}
|
|
2586
2804
|
};
|
|
2587
|
-
return /* @__PURE__ */
|
|
2805
|
+
return /* @__PURE__ */ jsx24(ModalWithHeader, { showClose: true, isOpen, onClose, title: intl.formatMessage({
|
|
2588
2806
|
id: "CEXBindTitle"
|
|
2589
2807
|
}, {
|
|
2590
2808
|
type
|
|
2591
2809
|
}), ...props, children: /* @__PURE__ */ jsxs19("div", { className: "matchid-cex-modal", children: [
|
|
2592
2810
|
/* @__PURE__ */ jsxs19("div", { children: [
|
|
2593
|
-
/* @__PURE__ */
|
|
2594
|
-
/* @__PURE__ */
|
|
2595
|
-
/* @__PURE__ */
|
|
2596
|
-
/* @__PURE__ */
|
|
2811
|
+
/* @__PURE__ */ jsx24("p", { children: /* @__PURE__ */ jsx24(FormattedMessage10, { id: "CEXBindAttention" }) }),
|
|
2812
|
+
/* @__PURE__ */ jsx24("p", { children: /* @__PURE__ */ jsx24(FormattedMessage10, { id: "CEXBindTips1" }) }),
|
|
2813
|
+
/* @__PURE__ */ jsx24("p", { children: /* @__PURE__ */ jsx24(FormattedMessage10, { id: "CEXBindTips2" }) }),
|
|
2814
|
+
/* @__PURE__ */ jsx24("p", { children: /* @__PURE__ */ jsx24(FormattedMessage10, { id: "CEXBindTips3" }) })
|
|
2597
2815
|
] }),
|
|
2598
|
-
/* @__PURE__ */
|
|
2816
|
+
/* @__PURE__ */ jsx24(Field, { label: intl.formatMessage({
|
|
2599
2817
|
id: "CEXBindApiKey"
|
|
2600
|
-
}), children: /* @__PURE__ */
|
|
2818
|
+
}), children: /* @__PURE__ */ jsx24(
|
|
2601
2819
|
Input,
|
|
2602
2820
|
{
|
|
2603
2821
|
value: key,
|
|
@@ -2605,9 +2823,9 @@ function CEXBindModal({
|
|
|
2605
2823
|
placeholder: "**** **** ****"
|
|
2606
2824
|
}
|
|
2607
2825
|
) }),
|
|
2608
|
-
/* @__PURE__ */
|
|
2826
|
+
/* @__PURE__ */ jsx24(Field, { label: intl.formatMessage({
|
|
2609
2827
|
id: "CEXBindApiSecretKey"
|
|
2610
|
-
}), error:
|
|
2828
|
+
}), error: !needPassphrase && error, children: /* @__PURE__ */ jsx24(
|
|
2611
2829
|
Input,
|
|
2612
2830
|
{
|
|
2613
2831
|
value: secret,
|
|
@@ -2615,9 +2833,9 @@ function CEXBindModal({
|
|
|
2615
2833
|
placeholder: "**** **** ****"
|
|
2616
2834
|
}
|
|
2617
2835
|
) }),
|
|
2618
|
-
needPassphrase && /* @__PURE__ */
|
|
2836
|
+
needPassphrase && /* @__PURE__ */ jsx24(Field, { error, label: intl.formatMessage({
|
|
2619
2837
|
id: "CEXBindApiPassphrase"
|
|
2620
|
-
}), children: /* @__PURE__ */
|
|
2838
|
+
}), children: /* @__PURE__ */ jsx24(
|
|
2621
2839
|
Input,
|
|
2622
2840
|
{
|
|
2623
2841
|
value: APIPassphrase,
|
|
@@ -2625,7 +2843,7 @@ function CEXBindModal({
|
|
|
2625
2843
|
placeholder: "**** **** ****"
|
|
2626
2844
|
}
|
|
2627
2845
|
) }),
|
|
2628
|
-
/* @__PURE__ */
|
|
2846
|
+
/* @__PURE__ */ jsx24(
|
|
2629
2847
|
Button,
|
|
2630
2848
|
{
|
|
2631
2849
|
onClick: SubmitApi,
|
|
@@ -2633,24 +2851,25 @@ function CEXBindModal({
|
|
|
2633
2851
|
block: true,
|
|
2634
2852
|
loading,
|
|
2635
2853
|
disabled: !key || !secret,
|
|
2636
|
-
children: /* @__PURE__ */
|
|
2854
|
+
children: /* @__PURE__ */ jsx24(FormattedMessage10, { id: "continue" })
|
|
2637
2855
|
}
|
|
2638
2856
|
)
|
|
2639
2857
|
] }) });
|
|
2640
2858
|
}
|
|
2641
2859
|
|
|
2642
2860
|
// src/context/BusinessProvider.tsx
|
|
2643
|
-
import { Fragment as Fragment4, jsx as
|
|
2861
|
+
import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2644
2862
|
function BusinessProvider({ children }) {
|
|
2645
2863
|
const { overview, token } = useUserInfo();
|
|
2646
2864
|
const { recoveryModal } = useStore_default();
|
|
2647
2865
|
const { type: SOLType, isOpen: SOLIsOpen, close: SOLClose } = useSOLModalStore();
|
|
2866
|
+
const { type: TONType, isOpen: TONIsOpen, close: TONClose } = useTONModalStore();
|
|
2648
2867
|
const { type: TRONType, isOpen: TRONIsOpen, close: TRONClose } = useTRONModalStore();
|
|
2649
2868
|
const { type: BTCType, isOpen: BTCIsOpen, close: BTCClose } = useBTCModalStore();
|
|
2650
2869
|
const { type: CEXType, isOpen: CEXIsOpen, close: CEXClose } = useCEXBindModalStore();
|
|
2651
2870
|
return /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
2652
|
-
/* @__PURE__ */
|
|
2653
|
-
/* @__PURE__ */
|
|
2871
|
+
/* @__PURE__ */ jsx25(PasswordModal, { isOpen: !!token && !!overview && !overview.address && !!overview.did, showClose: false }),
|
|
2872
|
+
/* @__PURE__ */ jsx25(
|
|
2654
2873
|
RecoveryModal,
|
|
2655
2874
|
{
|
|
2656
2875
|
isOpen: !!token && !!overview && !!overview.address && recoveryModal.open,
|
|
@@ -2658,7 +2877,7 @@ function BusinessProvider({ children }) {
|
|
|
2658
2877
|
onSuccess: recoveryModal.success
|
|
2659
2878
|
}
|
|
2660
2879
|
),
|
|
2661
|
-
/* @__PURE__ */
|
|
2880
|
+
/* @__PURE__ */ jsx25(
|
|
2662
2881
|
SOLModal,
|
|
2663
2882
|
{
|
|
2664
2883
|
isOpen: SOLIsOpen && (SOLType == "login" && !overview && !token || SOLType == "bind" && !!token && !!overview),
|
|
@@ -2668,7 +2887,7 @@ function BusinessProvider({ children }) {
|
|
|
2668
2887
|
zIndex: 199
|
|
2669
2888
|
}
|
|
2670
2889
|
),
|
|
2671
|
-
/* @__PURE__ */
|
|
2890
|
+
/* @__PURE__ */ jsx25(
|
|
2672
2891
|
TRONModal,
|
|
2673
2892
|
{
|
|
2674
2893
|
isOpen: TRONIsOpen && (TRONType == "login" && !overview && !token || TRONType == "bind" && !!token && !!overview),
|
|
@@ -2678,7 +2897,17 @@ function BusinessProvider({ children }) {
|
|
|
2678
2897
|
zIndex: 199
|
|
2679
2898
|
}
|
|
2680
2899
|
),
|
|
2681
|
-
/* @__PURE__ */
|
|
2900
|
+
/* @__PURE__ */ jsx25(
|
|
2901
|
+
TONModal,
|
|
2902
|
+
{
|
|
2903
|
+
isOpen: TONIsOpen && (TONType == "login" && !overview && !token || TONType == "bind" && !!token && !!overview),
|
|
2904
|
+
onClose: TONClose,
|
|
2905
|
+
type: TONType,
|
|
2906
|
+
onSuccess: TONClose,
|
|
2907
|
+
zIndex: 199
|
|
2908
|
+
}
|
|
2909
|
+
),
|
|
2910
|
+
/* @__PURE__ */ jsx25(
|
|
2682
2911
|
BTCModal,
|
|
2683
2912
|
{
|
|
2684
2913
|
isOpen: BTCIsOpen && (BTCType == "login" && !overview && !token || BTCType == "bind" && !!token && !!overview),
|
|
@@ -2688,7 +2917,7 @@ function BusinessProvider({ children }) {
|
|
|
2688
2917
|
zIndex: 199
|
|
2689
2918
|
}
|
|
2690
2919
|
),
|
|
2691
|
-
/* @__PURE__ */
|
|
2920
|
+
/* @__PURE__ */ jsx25(
|
|
2692
2921
|
CEXBindModal,
|
|
2693
2922
|
{
|
|
2694
2923
|
isOpen: CEXIsOpen && (!!token && !!overview),
|
|
@@ -2702,17 +2931,17 @@ function BusinessProvider({ children }) {
|
|
|
2702
2931
|
}
|
|
2703
2932
|
|
|
2704
2933
|
// src/context/index.tsx
|
|
2705
|
-
import { jsx as
|
|
2934
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
2706
2935
|
var Providers = ({ children }) => {
|
|
2707
2936
|
return (
|
|
2708
2937
|
// <MpcWalletProvider>
|
|
2709
|
-
/* @__PURE__ */
|
|
2938
|
+
/* @__PURE__ */ jsx26(BusinessProvider, { children })
|
|
2710
2939
|
);
|
|
2711
2940
|
};
|
|
2712
2941
|
var context_default = Providers;
|
|
2713
2942
|
|
|
2714
2943
|
// src/hooks/useWalletInit.ts
|
|
2715
|
-
import { useEffect as
|
|
2944
|
+
import { useEffect as useEffect15, useState as useState20 } from "react";
|
|
2716
2945
|
|
|
2717
2946
|
// src/hooks/useWallet.tsx
|
|
2718
2947
|
import { toAccount } from "viem/accounts";
|
|
@@ -2852,17 +3081,17 @@ function useWalletInit({
|
|
|
2852
3081
|
const getWalletIframe = () => {
|
|
2853
3082
|
return document.getElementById("match-wallet");
|
|
2854
3083
|
};
|
|
2855
|
-
const [walletInited, setWalletInited] =
|
|
3084
|
+
const [walletInited, setWalletInited] = useState20(false);
|
|
2856
3085
|
const { appid, token, overview } = useLocalStore_default();
|
|
2857
3086
|
const { initWallet, generateWallet } = useWallet();
|
|
2858
|
-
const [iframeLoaded, setIframeLoaded] =
|
|
2859
|
-
|
|
3087
|
+
const [iframeLoaded, setIframeLoaded] = useState20(false);
|
|
3088
|
+
useEffect15(() => {
|
|
2860
3089
|
console.log("wallet status", {
|
|
2861
3090
|
iframeLoaded,
|
|
2862
3091
|
walletInited
|
|
2863
3092
|
});
|
|
2864
3093
|
}, [iframeLoaded, walletInited]);
|
|
2865
|
-
|
|
3094
|
+
useEffect15(() => {
|
|
2866
3095
|
if (endpoints.auth) {
|
|
2867
3096
|
if (!window.matchWalletMessageIdMap) {
|
|
2868
3097
|
window.matchWalletMessageIdMap = {};
|
|
@@ -2885,16 +3114,11 @@ function useWalletInit({
|
|
|
2885
3114
|
document.body.insertBefore(iframe, document.body.firstChild);
|
|
2886
3115
|
window.sendMatchWalletMessage = (method, data, retry = 5, times = 0) => {
|
|
2887
3116
|
try {
|
|
2888
|
-
if (!iframeLoaded) {
|
|
2889
|
-
throw new Error("Wallet not ready");
|
|
2890
|
-
}
|
|
2891
|
-
if (!walletInited) {
|
|
2892
|
-
throw new Error("Wallet not inited");
|
|
2893
|
-
}
|
|
2894
3117
|
if (!document.getElementById("match-wallet")) {
|
|
2895
3118
|
throw new Error("Wallet not found");
|
|
2896
3119
|
}
|
|
2897
3120
|
} catch (error) {
|
|
3121
|
+
console.error(`wallet init[${times}/${retry}]`, error);
|
|
2898
3122
|
if (times < retry) {
|
|
2899
3123
|
setTimeout(() => {
|
|
2900
3124
|
window.sendMatchWalletMessage(method, data, retry, times + 1);
|
|
@@ -2941,7 +3165,7 @@ function useWalletInit({
|
|
|
2941
3165
|
}
|
|
2942
3166
|
}
|
|
2943
3167
|
}, [endpoints.auth]);
|
|
2944
|
-
|
|
3168
|
+
useEffect15(() => {
|
|
2945
3169
|
const messageHandle = async (e) => {
|
|
2946
3170
|
if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
|
|
2947
3171
|
return;
|
|
@@ -2974,7 +3198,7 @@ function useWalletInit({
|
|
|
2974
3198
|
window.removeEventListener("message", messageHandle);
|
|
2975
3199
|
};
|
|
2976
3200
|
}, []);
|
|
2977
|
-
|
|
3201
|
+
useEffect15(() => {
|
|
2978
3202
|
if (token && overview && overview.did && walletInited) {
|
|
2979
3203
|
const did = overview.did.split(":")[2];
|
|
2980
3204
|
const newUserInit = async () => {
|
|
@@ -3005,7 +3229,7 @@ function useWalletInit({
|
|
|
3005
3229
|
}
|
|
3006
3230
|
|
|
3007
3231
|
// src/hooks/useInit.tsx
|
|
3008
|
-
import { useEffect as
|
|
3232
|
+
import { useEffect as useEffect16, useRef as useRef2 } from "react";
|
|
3009
3233
|
function useInit({
|
|
3010
3234
|
theme,
|
|
3011
3235
|
appid,
|
|
@@ -3028,19 +3252,19 @@ function useInit({
|
|
|
3028
3252
|
const searchParams = new URLSearchParams(window.location.search);
|
|
3029
3253
|
const matchToken = searchParams.get("matchToken");
|
|
3030
3254
|
const realEndpoints = endpoints || env_default.endpoints;
|
|
3031
|
-
|
|
3255
|
+
useEffect16(() => {
|
|
3032
3256
|
setTheme(theme);
|
|
3033
3257
|
}, [theme]);
|
|
3034
|
-
|
|
3258
|
+
useEffect16(() => {
|
|
3035
3259
|
setAppid(appid);
|
|
3036
3260
|
}, [appid]);
|
|
3037
|
-
|
|
3261
|
+
useEffect16(() => {
|
|
3038
3262
|
setEndpoints(realEndpoints);
|
|
3039
3263
|
}, [realEndpoints]);
|
|
3040
|
-
|
|
3264
|
+
useEffect16(() => {
|
|
3041
3265
|
setLocale(locale || "en");
|
|
3042
3266
|
}, [locale]);
|
|
3043
|
-
|
|
3267
|
+
useEffect16(() => {
|
|
3044
3268
|
if (matchToken) {
|
|
3045
3269
|
const tokenData = JSON.parse(atob(matchToken));
|
|
3046
3270
|
if (tokenData && tokenData.mid && tokenData.token) {
|
|
@@ -3051,7 +3275,7 @@ function useInit({
|
|
|
3051
3275
|
}
|
|
3052
3276
|
}
|
|
3053
3277
|
}, [matchToken]);
|
|
3054
|
-
|
|
3278
|
+
useEffect16(() => {
|
|
3055
3279
|
const onLoginMessage = (event) => {
|
|
3056
3280
|
const res = event.data;
|
|
3057
3281
|
if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
|
|
@@ -3087,7 +3311,7 @@ function useInit({
|
|
|
3087
3311
|
overviewLoadingRef.current = false;
|
|
3088
3312
|
}
|
|
3089
3313
|
};
|
|
3090
|
-
|
|
3314
|
+
useEffect16(() => {
|
|
3091
3315
|
if (token) {
|
|
3092
3316
|
loadOverview();
|
|
3093
3317
|
}
|
|
@@ -3594,7 +3818,7 @@ var messages = {
|
|
|
3594
3818
|
};
|
|
3595
3819
|
|
|
3596
3820
|
// src/MatchContext.tsx
|
|
3597
|
-
import { jsx as
|
|
3821
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
3598
3822
|
var queryClient = new QueryClient();
|
|
3599
3823
|
var MatchContext = createContext(void 0);
|
|
3600
3824
|
var MatchProvider = ({ children, appid, events, theme = "light", endpoints, locale }) => {
|
|
@@ -3615,7 +3839,7 @@ var MatchProvider = ({ children, appid, events, theme = "light", endpoints, loca
|
|
|
3615
3839
|
useWalletInit({
|
|
3616
3840
|
refreshOverview: loadOverview
|
|
3617
3841
|
});
|
|
3618
|
-
return /* @__PURE__ */
|
|
3842
|
+
return /* @__PURE__ */ jsx27(IntlProvider, { locale: realLocale, messages: messages[realLocale], children: /* @__PURE__ */ jsx27(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx27(
|
|
3619
3843
|
MatchContext.Provider,
|
|
3620
3844
|
{
|
|
3621
3845
|
value: {
|
|
@@ -3626,7 +3850,7 @@ var MatchProvider = ({ children, appid, events, theme = "light", endpoints, loca
|
|
|
3626
3850
|
theme,
|
|
3627
3851
|
locale: realLocale
|
|
3628
3852
|
},
|
|
3629
|
-
children: /* @__PURE__ */
|
|
3853
|
+
children: /* @__PURE__ */ jsx27(context_default, { children })
|
|
3630
3854
|
}
|
|
3631
3855
|
) }) });
|
|
3632
3856
|
};
|
|
@@ -3654,6 +3878,7 @@ function useUserInfo() {
|
|
|
3654
3878
|
const { events, login } = useMatch();
|
|
3655
3879
|
const { open: SOLOpen } = useSOLModalStore();
|
|
3656
3880
|
const { open: TRONOpen } = useTRONModalStore();
|
|
3881
|
+
const { open: TONOpen } = useTONModalStore();
|
|
3657
3882
|
const { open: BTCOpen } = useBTCModalStore();
|
|
3658
3883
|
const { open: CEXBindOpen } = useCEXBindModalStore();
|
|
3659
3884
|
const isLogin = useMemo10(() => !!token, [token]);
|
|
@@ -3702,6 +3927,8 @@ function useUserInfo() {
|
|
|
3702
3927
|
return SOLOpen("login");
|
|
3703
3928
|
case "tron":
|
|
3704
3929
|
return TRONOpen("login");
|
|
3930
|
+
case "ton":
|
|
3931
|
+
return TONOpen("login");
|
|
3705
3932
|
case "btc":
|
|
3706
3933
|
return BTCOpen("login");
|
|
3707
3934
|
case "telegram":
|
|
@@ -3793,6 +4020,8 @@ function useUserInfo() {
|
|
|
3793
4020
|
return SOLOpen("bind");
|
|
3794
4021
|
case "tron":
|
|
3795
4022
|
return TRONOpen("bind");
|
|
4023
|
+
case "ton":
|
|
4024
|
+
return TONOpen("bind");
|
|
3796
4025
|
case "btc":
|
|
3797
4026
|
return BTCOpen("bind");
|
|
3798
4027
|
case "telegram":
|
|
@@ -3845,9 +4074,9 @@ function useUserInfo() {
|
|
|
3845
4074
|
}
|
|
3846
4075
|
|
|
3847
4076
|
// src/hooks/useMatchEvents.ts
|
|
3848
|
-
import { useEffect as
|
|
4077
|
+
import { useEffect as useEffect17 } from "react";
|
|
3849
4078
|
function useMatchEvents(handlers) {
|
|
3850
|
-
|
|
4079
|
+
useEffect17(() => {
|
|
3851
4080
|
Object.entries(handlers).forEach(([event, handler2]) => {
|
|
3852
4081
|
if (handler2) {
|
|
3853
4082
|
eventManager_default.on(event, handler2);
|
|
@@ -3865,14 +4094,14 @@ function useMatchEvents(handlers) {
|
|
|
3865
4094
|
|
|
3866
4095
|
// src/hooks/useCopyClipboard.ts
|
|
3867
4096
|
import copy from "copy-to-clipboard";
|
|
3868
|
-
import { useCallback, useEffect as
|
|
4097
|
+
import { useCallback, useEffect as useEffect18, useState as useState21 } from "react";
|
|
3869
4098
|
function useCopyClipboard(timeout = 500) {
|
|
3870
|
-
const [isCopied, setIsCopied] =
|
|
4099
|
+
const [isCopied, setIsCopied] = useState21(false);
|
|
3871
4100
|
const staticCopy = useCallback((text) => {
|
|
3872
4101
|
const didCopy = copy(text);
|
|
3873
4102
|
setIsCopied(didCopy);
|
|
3874
4103
|
}, []);
|
|
3875
|
-
|
|
4104
|
+
useEffect18(() => {
|
|
3876
4105
|
if (isCopied) {
|
|
3877
4106
|
const hide = setTimeout(() => {
|
|
3878
4107
|
setIsCopied(false);
|
|
@@ -3917,9 +4146,10 @@ export {
|
|
|
3917
4146
|
UsernameModal,
|
|
3918
4147
|
SOLModal,
|
|
3919
4148
|
TRONModal,
|
|
4149
|
+
TONModal,
|
|
3920
4150
|
BTCModal,
|
|
3921
4151
|
components_exports,
|
|
3922
4152
|
MatchProvider,
|
|
3923
4153
|
useMatch
|
|
3924
4154
|
};
|
|
3925
|
-
//# sourceMappingURL=chunk-
|
|
4155
|
+
//# sourceMappingURL=chunk-RYZFW6P6.mjs.map
|