@matchain/matchid-sdk-react 0.1.40-alpha.3 → 0.1.40-alpha.5
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-XXZABHH6.mjs → chunk-222KVWTM.mjs} +317 -96
- package/dist/chunk-222KVWTM.mjs.map +1 -0
- package/dist/{chunk-ZBOW562R.mjs → chunk-XN6V3UI6.mjs} +2 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +243 -36
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +3 -1
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +37 -20
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +2 -2
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +41 -24
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- 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 +314 -100
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- 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-XXZABHH6.mjs.map +0 -1
- /package/dist/{chunk-ZBOW562R.mjs.map → chunk-XN6V3UI6.mjs.map} +0 -0
|
@@ -270,11 +270,11 @@ var getBindInfoApi = () => {
|
|
|
270
270
|
method: "GET"
|
|
271
271
|
});
|
|
272
272
|
};
|
|
273
|
-
var bindCexApi = (
|
|
273
|
+
var bindCexApi = (data) => {
|
|
274
274
|
return request_default({
|
|
275
275
|
url: `/api/v1/cex/subscribe`,
|
|
276
276
|
method: "POST",
|
|
277
|
-
data
|
|
277
|
+
data
|
|
278
278
|
});
|
|
279
279
|
};
|
|
280
280
|
var unBindApi = ({ type }) => {
|
|
@@ -337,28 +337,42 @@ var getAuthInfoApi = () => {
|
|
|
337
337
|
method: "GET"
|
|
338
338
|
});
|
|
339
339
|
};
|
|
340
|
-
var getWalletNonceApi = (
|
|
340
|
+
var getWalletNonceApi = (data) => {
|
|
341
341
|
return request_default({
|
|
342
342
|
url: `/api/v1/login/wallet/init`,
|
|
343
343
|
method: "POST",
|
|
344
|
-
data
|
|
344
|
+
data
|
|
345
345
|
});
|
|
346
346
|
};
|
|
347
|
-
var loginByWalletApi = ({
|
|
347
|
+
var loginByWalletApi = ({
|
|
348
|
+
type,
|
|
349
|
+
address,
|
|
350
|
+
signature,
|
|
351
|
+
message,
|
|
352
|
+
connector_type,
|
|
353
|
+
wallet_client_type
|
|
354
|
+
}) => {
|
|
348
355
|
return request_default({
|
|
349
356
|
url: `/api/v1/login/wallet`,
|
|
350
357
|
method: "POST",
|
|
351
358
|
data: { type, address, signature, message, connector_type, wallet_client_type }
|
|
352
359
|
});
|
|
353
360
|
};
|
|
354
|
-
var getWalletInitApi = (
|
|
361
|
+
var getWalletInitApi = (data) => {
|
|
355
362
|
return request_default({
|
|
356
363
|
url: `/api/v1/wallet/init`,
|
|
357
364
|
method: "POST",
|
|
358
|
-
data
|
|
365
|
+
data
|
|
359
366
|
});
|
|
360
367
|
};
|
|
361
|
-
var toBindWalletApi = ({
|
|
368
|
+
var toBindWalletApi = ({
|
|
369
|
+
type,
|
|
370
|
+
address,
|
|
371
|
+
signature,
|
|
372
|
+
message,
|
|
373
|
+
connector_type,
|
|
374
|
+
wallet_client_type
|
|
375
|
+
}) => {
|
|
362
376
|
return request_default({
|
|
363
377
|
url: `/api/v1/wallet/bind`,
|
|
364
378
|
method: "POST",
|
|
@@ -752,6 +766,12 @@ var useTRONModalStore = create3((set) => ({
|
|
|
752
766
|
open: (type) => set({ isOpen: true, type }),
|
|
753
767
|
close: () => set({ isOpen: false })
|
|
754
768
|
}));
|
|
769
|
+
var useTONModalStore = create3((set) => ({
|
|
770
|
+
isOpen: false,
|
|
771
|
+
type: "",
|
|
772
|
+
open: (type) => set({ isOpen: true, type }),
|
|
773
|
+
close: () => set({ isOpen: false })
|
|
774
|
+
}));
|
|
755
775
|
var useBTCModalStore = create3((set) => ({
|
|
756
776
|
isOpen: false,
|
|
757
777
|
type: "",
|
|
@@ -782,6 +802,7 @@ __export(components_exports, {
|
|
|
782
802
|
PasswordModal: () => PasswordModal,
|
|
783
803
|
Popover: () => Popover,
|
|
784
804
|
SOLModal: () => SOLModal,
|
|
805
|
+
TONModal: () => TONModal,
|
|
785
806
|
TRONModal: () => TRONModal,
|
|
786
807
|
UsernameModal: () => UsernameModal
|
|
787
808
|
});
|
|
@@ -1704,8 +1725,13 @@ function WalletModalContent({
|
|
|
1704
1725
|
text: error,
|
|
1705
1726
|
btnText: "Reconnect Wallet",
|
|
1706
1727
|
btnClick: async () => {
|
|
1728
|
+
console.log("click error");
|
|
1707
1729
|
setError("");
|
|
1708
|
-
|
|
1730
|
+
try {
|
|
1731
|
+
await disconnect();
|
|
1732
|
+
} catch (error2) {
|
|
1733
|
+
console.error(error2);
|
|
1734
|
+
}
|
|
1709
1735
|
setVisible(true);
|
|
1710
1736
|
},
|
|
1711
1737
|
statusImage: walletErrorImage,
|
|
@@ -1792,7 +1818,7 @@ function WalletContent({
|
|
|
1792
1818
|
try {
|
|
1793
1819
|
setStatus("nonce");
|
|
1794
1820
|
statusRef.current = "nonce";
|
|
1795
|
-
const res = type == "bind" ? await getWalletInitApi({ address }) : await getWalletNonceApi({ address });
|
|
1821
|
+
const res = type == "bind" ? await getWalletInitApi({ address, type: "SOL" }) : await getWalletNonceApi({ address, type: "SOL" });
|
|
1796
1822
|
if (!isSuccess(res)) {
|
|
1797
1823
|
throw new Error(res.message);
|
|
1798
1824
|
}
|
|
@@ -2059,7 +2085,7 @@ function TRONModal({
|
|
|
2059
2085
|
try {
|
|
2060
2086
|
setStatus("nonce");
|
|
2061
2087
|
statusRef.current = "nonce";
|
|
2062
|
-
const res = type == "bind" ? await getWalletInitApi({ address }) : await getWalletNonceApi({ address });
|
|
2088
|
+
const res = type == "bind" ? await getWalletInitApi({ address, type: "TRON" }) : await getWalletNonceApi({ address, type: "TRON" });
|
|
2063
2089
|
if (!isSuccess(res)) {
|
|
2064
2090
|
throw new Error(res.message);
|
|
2065
2091
|
}
|
|
@@ -2174,9 +2200,190 @@ function TRONModal({
|
|
|
2174
2200
|
] }) }) });
|
|
2175
2201
|
}
|
|
2176
2202
|
|
|
2177
|
-
// src/components/
|
|
2178
|
-
import React5, { useEffect as
|
|
2203
|
+
// src/components/TONModal/index.tsx
|
|
2204
|
+
import React5, { useEffect as useEffect11, useState as useState16 } from "react";
|
|
2179
2205
|
import { useIntl as useIntl12 } from "react-intl";
|
|
2206
|
+
import {
|
|
2207
|
+
TonConnectUIProvider,
|
|
2208
|
+
useTonAddress,
|
|
2209
|
+
useTonConnectModal,
|
|
2210
|
+
useTonConnectUI,
|
|
2211
|
+
useTonWallet
|
|
2212
|
+
} from "@tonconnect/ui-react";
|
|
2213
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2214
|
+
function WalletContent2({
|
|
2215
|
+
onSuccess,
|
|
2216
|
+
type
|
|
2217
|
+
}) {
|
|
2218
|
+
const { events, login } = useMatch();
|
|
2219
|
+
const [connected, setConnected] = useState16(false);
|
|
2220
|
+
const wallet = useTonWallet();
|
|
2221
|
+
const userFriendlyAddress = useTonAddress();
|
|
2222
|
+
const [tonConnectUI] = useTonConnectUI();
|
|
2223
|
+
const { state, open, close } = useTonConnectModal();
|
|
2224
|
+
const [status, setStatus] = useState16("");
|
|
2225
|
+
const statusRef = React5.useRef(status);
|
|
2226
|
+
const [error, setError] = useState16("");
|
|
2227
|
+
useEffect11(() => {
|
|
2228
|
+
const init = async () => {
|
|
2229
|
+
if (wallet) {
|
|
2230
|
+
await tonConnectUI.disconnect();
|
|
2231
|
+
}
|
|
2232
|
+
open();
|
|
2233
|
+
};
|
|
2234
|
+
init();
|
|
2235
|
+
tonConnectUI.onStatusChange((wallet2) => {
|
|
2236
|
+
matchlog_default.log("onStatusChange:", wallet2, wallet2?.connectItems?.tonProof, JSON.stringify(wallet2?.connectItems?.tonProof));
|
|
2237
|
+
if (wallet2?.connectItems?.tonProof && "proof" in wallet2.connectItems.tonProof) {
|
|
2238
|
+
matchlog_default.log(wallet2?.connectItems.tonProof.proof, wallet2?.account);
|
|
2239
|
+
const toLoginInWallet = async () => {
|
|
2240
|
+
if (statusRef.current || !wallet2) return;
|
|
2241
|
+
setStatus("signer");
|
|
2242
|
+
statusRef.current = "signer";
|
|
2243
|
+
try {
|
|
2244
|
+
const signature = {
|
|
2245
|
+
"address": wallet2?.account?.address,
|
|
2246
|
+
"network": wallet2?.account?.chain,
|
|
2247
|
+
"public_key": wallet2?.account?.publicKey,
|
|
2248
|
+
"proof": {
|
|
2249
|
+
//@ts-ignore
|
|
2250
|
+
...wallet2?.connectItems?.tonProof?.proof,
|
|
2251
|
+
"state_init": wallet2?.account?.walletStateInit
|
|
2252
|
+
}
|
|
2253
|
+
};
|
|
2254
|
+
let obj = {
|
|
2255
|
+
type: "TON",
|
|
2256
|
+
address: wallet2?.account?.publicKey,
|
|
2257
|
+
signature: JSON.stringify(signature),
|
|
2258
|
+
//@ts-ignore
|
|
2259
|
+
message: wallet2?.connectItems?.tonProof?.proof.payload,
|
|
2260
|
+
connector_type: "TON",
|
|
2261
|
+
wallet_client_type: wallet2?.name
|
|
2262
|
+
};
|
|
2263
|
+
console.log("signature", {
|
|
2264
|
+
signature,
|
|
2265
|
+
obj
|
|
2266
|
+
});
|
|
2267
|
+
const res1 = type == "bind" ? await toBindWalletApi(obj) : await loginByWalletApi(obj);
|
|
2268
|
+
if (res1) {
|
|
2269
|
+
if (!isSuccess(res1)) {
|
|
2270
|
+
throw new Error(res1.message);
|
|
2271
|
+
}
|
|
2272
|
+
matchlog_default.log(res1);
|
|
2273
|
+
setStatus("success");
|
|
2274
|
+
statusRef.current = "success";
|
|
2275
|
+
if (type == "bind") {
|
|
2276
|
+
events.onBind && events.onBind({
|
|
2277
|
+
type: "ton"
|
|
2278
|
+
});
|
|
2279
|
+
eventManager_default.emit("onBind", {
|
|
2280
|
+
type: "ton"
|
|
2281
|
+
});
|
|
2282
|
+
} else {
|
|
2283
|
+
await login({
|
|
2284
|
+
mid: res1.data.mid,
|
|
2285
|
+
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
2286
|
+
});
|
|
2287
|
+
}
|
|
2288
|
+
onSuccess && onSuccess();
|
|
2289
|
+
}
|
|
2290
|
+
} catch (error2) {
|
|
2291
|
+
setStatus("error");
|
|
2292
|
+
setError(error2.message);
|
|
2293
|
+
statusRef.current = "";
|
|
2294
|
+
}
|
|
2295
|
+
};
|
|
2296
|
+
toLoginInWallet();
|
|
2297
|
+
}
|
|
2298
|
+
});
|
|
2299
|
+
}, []);
|
|
2300
|
+
useEffect11(() => {
|
|
2301
|
+
if (wallet) {
|
|
2302
|
+
setConnected(true);
|
|
2303
|
+
console.log("Wallet connected:", wallet);
|
|
2304
|
+
} else {
|
|
2305
|
+
setConnected(false);
|
|
2306
|
+
open();
|
|
2307
|
+
statusRef.current = "";
|
|
2308
|
+
setStatus("");
|
|
2309
|
+
}
|
|
2310
|
+
}, [wallet]);
|
|
2311
|
+
useEffect11(() => {
|
|
2312
|
+
console.log({
|
|
2313
|
+
state,
|
|
2314
|
+
wallet
|
|
2315
|
+
});
|
|
2316
|
+
if (state.status == "opened") {
|
|
2317
|
+
const init = async () => {
|
|
2318
|
+
tonConnectUI.setConnectRequestParameters({ state: "loading" });
|
|
2319
|
+
const res = type == "bind" ? await getWalletInitApi({
|
|
2320
|
+
address: "tonconnect",
|
|
2321
|
+
type: "TON"
|
|
2322
|
+
}) : await getWalletNonceApi({ address: "tonconnect", type: "TON" });
|
|
2323
|
+
if (!isSuccess(res)) {
|
|
2324
|
+
tonConnectUI.setConnectRequestParameters(null);
|
|
2325
|
+
throw new Error(res.message);
|
|
2326
|
+
}
|
|
2327
|
+
tonConnectUI.setConnectRequestParameters({
|
|
2328
|
+
state: "ready",
|
|
2329
|
+
value: { tonProof: res.data.nonce }
|
|
2330
|
+
});
|
|
2331
|
+
};
|
|
2332
|
+
init();
|
|
2333
|
+
} else {
|
|
2334
|
+
if (!wallet) {
|
|
2335
|
+
setStatus("");
|
|
2336
|
+
statusRef.current = "";
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
}, [state]);
|
|
2340
|
+
return /* @__PURE__ */ jsx22(
|
|
2341
|
+
WalletModalContent,
|
|
2342
|
+
{
|
|
2343
|
+
connected,
|
|
2344
|
+
disconnect: tonConnectUI.disconnect,
|
|
2345
|
+
address: userFriendlyAddress,
|
|
2346
|
+
visible: state.status == "opened",
|
|
2347
|
+
setVisible: (v) => {
|
|
2348
|
+
console.log("setVisible", v);
|
|
2349
|
+
if (v) {
|
|
2350
|
+
setStatus("");
|
|
2351
|
+
statusRef.current = "";
|
|
2352
|
+
open();
|
|
2353
|
+
} else {
|
|
2354
|
+
close();
|
|
2355
|
+
}
|
|
2356
|
+
},
|
|
2357
|
+
error,
|
|
2358
|
+
setError,
|
|
2359
|
+
status
|
|
2360
|
+
}
|
|
2361
|
+
);
|
|
2362
|
+
}
|
|
2363
|
+
function TONModal({
|
|
2364
|
+
type = "login",
|
|
2365
|
+
onSuccess,
|
|
2366
|
+
...props
|
|
2367
|
+
}) {
|
|
2368
|
+
const intl = useIntl12();
|
|
2369
|
+
const { endpoints, appid } = useLocalStore_default();
|
|
2370
|
+
const manifestUrl = `${endpoints.back}api/v1/wallet/ton?appid=${appid}&url=` + encodeURIComponent(window.location.origin);
|
|
2371
|
+
return /* @__PURE__ */ jsx22(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
2372
|
+
id: type == "bind" ? "bindWith" : "loginWith"
|
|
2373
|
+
}, {
|
|
2374
|
+
name: "TON"
|
|
2375
|
+
}), children: /* @__PURE__ */ jsx22(
|
|
2376
|
+
TonConnectUIProvider,
|
|
2377
|
+
{
|
|
2378
|
+
manifestUrl,
|
|
2379
|
+
children: /* @__PURE__ */ jsx22(WalletContent2, { onSuccess, type })
|
|
2380
|
+
}
|
|
2381
|
+
) });
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
// src/components/BTCModal/index.tsx
|
|
2385
|
+
import React6, { useEffect as useEffect13, useMemo as useMemo8, useState as useState18 } from "react";
|
|
2386
|
+
import { useIntl as useIntl13 } from "react-intl";
|
|
2180
2387
|
|
|
2181
2388
|
// src/lib/btc/UnisatAdapter.ts
|
|
2182
2389
|
var UnisatAdapter = class {
|
|
@@ -2330,12 +2537,12 @@ var LeatherAdapter = class {
|
|
|
2330
2537
|
};
|
|
2331
2538
|
|
|
2332
2539
|
// src/hooks/useBTCWallet.ts
|
|
2333
|
-
import { useEffect as
|
|
2540
|
+
import { useEffect as useEffect12, useState as useState17 } from "react";
|
|
2334
2541
|
var useBTCWallet = () => {
|
|
2335
2542
|
const wallets2 = [new UnisatAdapter(), new XverseAdapter(), new LeatherAdapter()];
|
|
2336
|
-
const [installedWallets, setInstalledWallets] =
|
|
2337
|
-
const [address, setAddress] =
|
|
2338
|
-
|
|
2543
|
+
const [installedWallets, setInstalledWallets] = useState17([]);
|
|
2544
|
+
const [address, setAddress] = useState17(null);
|
|
2545
|
+
useEffect12(() => {
|
|
2339
2546
|
const getInstalled = async () => {
|
|
2340
2547
|
const installed = await Promise.all(wallets2.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
2341
2548
|
wallet: wallet2,
|
|
@@ -2345,11 +2552,11 @@ var useBTCWallet = () => {
|
|
|
2345
2552
|
};
|
|
2346
2553
|
getInstalled();
|
|
2347
2554
|
}, []);
|
|
2348
|
-
const [wallet, chooseWallet] =
|
|
2555
|
+
const [wallet, chooseWallet] = useState17(null);
|
|
2349
2556
|
const onConnect = async () => {
|
|
2350
2557
|
setAddress(await wallet.connect());
|
|
2351
2558
|
};
|
|
2352
|
-
|
|
2559
|
+
useEffect12(() => {
|
|
2353
2560
|
if (!wallet) {
|
|
2354
2561
|
setAddress(null);
|
|
2355
2562
|
}
|
|
@@ -2365,24 +2572,24 @@ var useBTCWallet = () => {
|
|
|
2365
2572
|
};
|
|
2366
2573
|
|
|
2367
2574
|
// src/components/BTCModal/index.tsx
|
|
2368
|
-
import { jsx as
|
|
2575
|
+
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2369
2576
|
function BTCModal({
|
|
2370
2577
|
type = "login",
|
|
2371
2578
|
onSuccess,
|
|
2372
2579
|
...props
|
|
2373
2580
|
}) {
|
|
2374
2581
|
const isDownMd = useDownMd();
|
|
2375
|
-
const intl =
|
|
2582
|
+
const intl = useIntl13();
|
|
2376
2583
|
const { wallets: wallets2, installedWallets, chooseWallet, wallet, address, onConnect } = useBTCWallet();
|
|
2377
2584
|
const iconMaps = {
|
|
2378
|
-
leather: /* @__PURE__ */
|
|
2379
|
-
unisat: /* @__PURE__ */
|
|
2380
|
-
xverse: /* @__PURE__ */
|
|
2585
|
+
leather: /* @__PURE__ */ jsx23(LeatherIcon, { size: isDownMd ? 36 : 40 }),
|
|
2586
|
+
unisat: /* @__PURE__ */ jsx23(UnisatIcon, { size: isDownMd ? 36 : 40 }),
|
|
2587
|
+
xverse: /* @__PURE__ */ jsx23(XverseIcon, { size: isDownMd ? 36 : 40 })
|
|
2381
2588
|
};
|
|
2382
2589
|
const { events, login } = useMatch();
|
|
2383
|
-
const [status, setStatus] =
|
|
2384
|
-
const statusRef =
|
|
2385
|
-
const [error, setError] =
|
|
2590
|
+
const [status, setStatus] = useState18("");
|
|
2591
|
+
const statusRef = React6.useRef(status);
|
|
2592
|
+
const [error, setError] = useState18("");
|
|
2386
2593
|
const connected = useMemo8(() => {
|
|
2387
2594
|
return !!address;
|
|
2388
2595
|
}, [address]);
|
|
@@ -2398,7 +2605,7 @@ function BTCModal({
|
|
|
2398
2605
|
try {
|
|
2399
2606
|
setStatus("nonce");
|
|
2400
2607
|
statusRef.current = "nonce";
|
|
2401
|
-
const res = type == "bind" ? await getWalletInitApi({ address }) : await getWalletNonceApi({ address });
|
|
2608
|
+
const res = type == "bind" ? await getWalletInitApi({ address, type: "BTC" }) : await getWalletNonceApi({ address, type: "BTC" });
|
|
2402
2609
|
if (!isSuccess(res)) {
|
|
2403
2610
|
throw new Error(res.message);
|
|
2404
2611
|
}
|
|
@@ -2447,7 +2654,7 @@ function BTCModal({
|
|
|
2447
2654
|
statusRef.current = "";
|
|
2448
2655
|
}
|
|
2449
2656
|
};
|
|
2450
|
-
|
|
2657
|
+
useEffect13(() => {
|
|
2451
2658
|
if (wallet) {
|
|
2452
2659
|
console.log("onConnect");
|
|
2453
2660
|
try {
|
|
@@ -2460,12 +2667,12 @@ function BTCModal({
|
|
|
2460
2667
|
setStatus("");
|
|
2461
2668
|
}
|
|
2462
2669
|
}, [wallet]);
|
|
2463
|
-
|
|
2670
|
+
useEffect13(() => {
|
|
2464
2671
|
if (address) {
|
|
2465
2672
|
toLoginInWallet();
|
|
2466
2673
|
}
|
|
2467
2674
|
}, [address]);
|
|
2468
|
-
|
|
2675
|
+
useEffect13(() => {
|
|
2469
2676
|
if (!props.isOpen) {
|
|
2470
2677
|
disconnect();
|
|
2471
2678
|
}
|
|
@@ -2477,11 +2684,11 @@ function BTCModal({
|
|
|
2477
2684
|
statusRef.current = "";
|
|
2478
2685
|
setError("");
|
|
2479
2686
|
};
|
|
2480
|
-
return /* @__PURE__ */
|
|
2687
|
+
return /* @__PURE__ */ jsx23(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
2481
2688
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
2482
2689
|
}, {
|
|
2483
2690
|
name: "BTC"
|
|
2484
|
-
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */
|
|
2691
|
+
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ jsx23(
|
|
2485
2692
|
WalletModalContent,
|
|
2486
2693
|
{
|
|
2487
2694
|
error,
|
|
@@ -2494,9 +2701,9 @@ function BTCModal({
|
|
|
2494
2701
|
setVisible: () => {
|
|
2495
2702
|
}
|
|
2496
2703
|
}
|
|
2497
|
-
) : /* @__PURE__ */
|
|
2704
|
+
) : /* @__PURE__ */ jsx23("div", { className: "matchid-login-box", children: /* @__PURE__ */ jsxs18("div", { className: "matchid-login-recommend-list", children: [
|
|
2498
2705
|
installedWallets.map((wallet2) => {
|
|
2499
|
-
return /* @__PURE__ */
|
|
2706
|
+
return /* @__PURE__ */ jsx23(
|
|
2500
2707
|
RecommendItem,
|
|
2501
2708
|
{
|
|
2502
2709
|
icon: iconMaps[wallet2.walletKey],
|
|
@@ -2509,14 +2716,14 @@ function BTCModal({
|
|
|
2509
2716
|
);
|
|
2510
2717
|
}),
|
|
2511
2718
|
wallets2.filter((wallet2) => !installedWallets.find((installedWallet) => installedWallet.walletKey == wallet2.walletKey)).map((wallet2) => {
|
|
2512
|
-
return /* @__PURE__ */
|
|
2719
|
+
return /* @__PURE__ */ jsx23(
|
|
2513
2720
|
RecommendItem,
|
|
2514
2721
|
{
|
|
2515
2722
|
icon: iconMaps[wallet2.walletKey],
|
|
2516
2723
|
name: wallet2.name,
|
|
2517
2724
|
onClick: () => {
|
|
2518
2725
|
},
|
|
2519
|
-
footer: /* @__PURE__ */
|
|
2726
|
+
footer: /* @__PURE__ */ jsx23(Button, { size: "sm", onClick: () => {
|
|
2520
2727
|
window.open(wallet2.website);
|
|
2521
2728
|
}, children: "Install" })
|
|
2522
2729
|
},
|
|
@@ -2527,27 +2734,27 @@ function BTCModal({
|
|
|
2527
2734
|
}
|
|
2528
2735
|
|
|
2529
2736
|
// src/components/CEXBindModal/index.tsx
|
|
2530
|
-
import { useEffect as
|
|
2531
|
-
import { FormattedMessage as FormattedMessage10, useIntl as
|
|
2532
|
-
import { jsx as
|
|
2737
|
+
import { useEffect as useEffect14, useMemo as useMemo9, useState as useState19 } from "react";
|
|
2738
|
+
import { FormattedMessage as FormattedMessage10, useIntl as useIntl14 } from "react-intl";
|
|
2739
|
+
import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2533
2740
|
function CEXBindModal({
|
|
2534
2741
|
onClose,
|
|
2535
2742
|
type,
|
|
2536
2743
|
isOpen = false,
|
|
2537
2744
|
...props
|
|
2538
2745
|
}) {
|
|
2539
|
-
const intl =
|
|
2746
|
+
const intl = useIntl14();
|
|
2540
2747
|
const { events } = useMatch();
|
|
2541
|
-
const [APIPassphrase, setAPIPassphrase] =
|
|
2748
|
+
const [APIPassphrase, setAPIPassphrase] = useState19("");
|
|
2542
2749
|
const { refreshOverview } = useUserInfo();
|
|
2543
|
-
const [loading, setLoading] =
|
|
2544
|
-
const [key, setKey] =
|
|
2545
|
-
const [secret, setSecret] =
|
|
2546
|
-
const [error, setError] =
|
|
2750
|
+
const [loading, setLoading] = useState19(false);
|
|
2751
|
+
const [key, setKey] = useState19("");
|
|
2752
|
+
const [secret, setSecret] = useState19("");
|
|
2753
|
+
const [error, setError] = useState19("");
|
|
2547
2754
|
const needPassphrase = useMemo9(() => {
|
|
2548
2755
|
return ["bitget", "okx"].includes(type.toLowerCase());
|
|
2549
2756
|
}, [type]);
|
|
2550
|
-
|
|
2757
|
+
useEffect14(() => {
|
|
2551
2758
|
if (isOpen) {
|
|
2552
2759
|
setSecret("");
|
|
2553
2760
|
setKey("");
|
|
@@ -2584,20 +2791,20 @@ function CEXBindModal({
|
|
|
2584
2791
|
setLoading(false);
|
|
2585
2792
|
}
|
|
2586
2793
|
};
|
|
2587
|
-
return /* @__PURE__ */
|
|
2794
|
+
return /* @__PURE__ */ jsx24(ModalWithHeader, { showClose: true, isOpen, onClose, title: intl.formatMessage({
|
|
2588
2795
|
id: "CEXBindTitle"
|
|
2589
2796
|
}, {
|
|
2590
2797
|
type
|
|
2591
2798
|
}), ...props, children: /* @__PURE__ */ jsxs19("div", { className: "matchid-cex-modal", children: [
|
|
2592
2799
|
/* @__PURE__ */ jsxs19("div", { children: [
|
|
2593
|
-
/* @__PURE__ */
|
|
2594
|
-
/* @__PURE__ */
|
|
2595
|
-
/* @__PURE__ */
|
|
2596
|
-
/* @__PURE__ */
|
|
2800
|
+
/* @__PURE__ */ jsx24("p", { children: /* @__PURE__ */ jsx24(FormattedMessage10, { id: "CEXBindAttention" }) }),
|
|
2801
|
+
/* @__PURE__ */ jsx24("p", { children: /* @__PURE__ */ jsx24(FormattedMessage10, { id: "CEXBindTips1" }) }),
|
|
2802
|
+
/* @__PURE__ */ jsx24("p", { children: /* @__PURE__ */ jsx24(FormattedMessage10, { id: "CEXBindTips2" }) }),
|
|
2803
|
+
/* @__PURE__ */ jsx24("p", { children: /* @__PURE__ */ jsx24(FormattedMessage10, { id: "CEXBindTips3" }) })
|
|
2597
2804
|
] }),
|
|
2598
|
-
/* @__PURE__ */
|
|
2805
|
+
/* @__PURE__ */ jsx24(Field, { label: intl.formatMessage({
|
|
2599
2806
|
id: "CEXBindApiKey"
|
|
2600
|
-
}), children: /* @__PURE__ */
|
|
2807
|
+
}), children: /* @__PURE__ */ jsx24(
|
|
2601
2808
|
Input,
|
|
2602
2809
|
{
|
|
2603
2810
|
value: key,
|
|
@@ -2605,9 +2812,9 @@ function CEXBindModal({
|
|
|
2605
2812
|
placeholder: "**** **** ****"
|
|
2606
2813
|
}
|
|
2607
2814
|
) }),
|
|
2608
|
-
/* @__PURE__ */
|
|
2815
|
+
/* @__PURE__ */ jsx24(Field, { label: intl.formatMessage({
|
|
2609
2816
|
id: "CEXBindApiSecretKey"
|
|
2610
|
-
}), error:
|
|
2817
|
+
}), error: !needPassphrase && error, children: /* @__PURE__ */ jsx24(
|
|
2611
2818
|
Input,
|
|
2612
2819
|
{
|
|
2613
2820
|
value: secret,
|
|
@@ -2615,9 +2822,9 @@ function CEXBindModal({
|
|
|
2615
2822
|
placeholder: "**** **** ****"
|
|
2616
2823
|
}
|
|
2617
2824
|
) }),
|
|
2618
|
-
needPassphrase && /* @__PURE__ */
|
|
2825
|
+
needPassphrase && /* @__PURE__ */ jsx24(Field, { error, label: intl.formatMessage({
|
|
2619
2826
|
id: "CEXBindApiPassphrase"
|
|
2620
|
-
}), children: /* @__PURE__ */
|
|
2827
|
+
}), children: /* @__PURE__ */ jsx24(
|
|
2621
2828
|
Input,
|
|
2622
2829
|
{
|
|
2623
2830
|
value: APIPassphrase,
|
|
@@ -2625,7 +2832,7 @@ function CEXBindModal({
|
|
|
2625
2832
|
placeholder: "**** **** ****"
|
|
2626
2833
|
}
|
|
2627
2834
|
) }),
|
|
2628
|
-
/* @__PURE__ */
|
|
2835
|
+
/* @__PURE__ */ jsx24(
|
|
2629
2836
|
Button,
|
|
2630
2837
|
{
|
|
2631
2838
|
onClick: SubmitApi,
|
|
@@ -2633,24 +2840,25 @@ function CEXBindModal({
|
|
|
2633
2840
|
block: true,
|
|
2634
2841
|
loading,
|
|
2635
2842
|
disabled: !key || !secret,
|
|
2636
|
-
children: /* @__PURE__ */
|
|
2843
|
+
children: /* @__PURE__ */ jsx24(FormattedMessage10, { id: "continue" })
|
|
2637
2844
|
}
|
|
2638
2845
|
)
|
|
2639
2846
|
] }) });
|
|
2640
2847
|
}
|
|
2641
2848
|
|
|
2642
2849
|
// src/context/BusinessProvider.tsx
|
|
2643
|
-
import { Fragment as Fragment4, jsx as
|
|
2850
|
+
import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2644
2851
|
function BusinessProvider({ children }) {
|
|
2645
2852
|
const { overview, token } = useUserInfo();
|
|
2646
2853
|
const { recoveryModal } = useStore_default();
|
|
2647
2854
|
const { type: SOLType, isOpen: SOLIsOpen, close: SOLClose } = useSOLModalStore();
|
|
2855
|
+
const { type: TONType, isOpen: TONIsOpen, close: TONClose } = useTONModalStore();
|
|
2648
2856
|
const { type: TRONType, isOpen: TRONIsOpen, close: TRONClose } = useTRONModalStore();
|
|
2649
2857
|
const { type: BTCType, isOpen: BTCIsOpen, close: BTCClose } = useBTCModalStore();
|
|
2650
2858
|
const { type: CEXType, isOpen: CEXIsOpen, close: CEXClose } = useCEXBindModalStore();
|
|
2651
2859
|
return /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
2652
|
-
/* @__PURE__ */
|
|
2653
|
-
/* @__PURE__ */
|
|
2860
|
+
/* @__PURE__ */ jsx25(PasswordModal, { isOpen: !!token && !!overview && !overview.address && !!overview.did, showClose: false }),
|
|
2861
|
+
/* @__PURE__ */ jsx25(
|
|
2654
2862
|
RecoveryModal,
|
|
2655
2863
|
{
|
|
2656
2864
|
isOpen: !!token && !!overview && !!overview.address && recoveryModal.open,
|
|
@@ -2658,7 +2866,7 @@ function BusinessProvider({ children }) {
|
|
|
2658
2866
|
onSuccess: recoveryModal.success
|
|
2659
2867
|
}
|
|
2660
2868
|
),
|
|
2661
|
-
/* @__PURE__ */
|
|
2869
|
+
/* @__PURE__ */ jsx25(
|
|
2662
2870
|
SOLModal,
|
|
2663
2871
|
{
|
|
2664
2872
|
isOpen: SOLIsOpen && (SOLType == "login" && !overview && !token || SOLType == "bind" && !!token && !!overview),
|
|
@@ -2668,7 +2876,7 @@ function BusinessProvider({ children }) {
|
|
|
2668
2876
|
zIndex: 199
|
|
2669
2877
|
}
|
|
2670
2878
|
),
|
|
2671
|
-
/* @__PURE__ */
|
|
2879
|
+
/* @__PURE__ */ jsx25(
|
|
2672
2880
|
TRONModal,
|
|
2673
2881
|
{
|
|
2674
2882
|
isOpen: TRONIsOpen && (TRONType == "login" && !overview && !token || TRONType == "bind" && !!token && !!overview),
|
|
@@ -2678,7 +2886,17 @@ function BusinessProvider({ children }) {
|
|
|
2678
2886
|
zIndex: 199
|
|
2679
2887
|
}
|
|
2680
2888
|
),
|
|
2681
|
-
/* @__PURE__ */
|
|
2889
|
+
/* @__PURE__ */ jsx25(
|
|
2890
|
+
TONModal,
|
|
2891
|
+
{
|
|
2892
|
+
isOpen: TONIsOpen && (TONType == "login" && !overview && !token || TONType == "bind" && !!token && !!overview),
|
|
2893
|
+
onClose: TONClose,
|
|
2894
|
+
type: TONType,
|
|
2895
|
+
onSuccess: TONClose,
|
|
2896
|
+
zIndex: 199
|
|
2897
|
+
}
|
|
2898
|
+
),
|
|
2899
|
+
/* @__PURE__ */ jsx25(
|
|
2682
2900
|
BTCModal,
|
|
2683
2901
|
{
|
|
2684
2902
|
isOpen: BTCIsOpen && (BTCType == "login" && !overview && !token || BTCType == "bind" && !!token && !!overview),
|
|
@@ -2688,7 +2906,7 @@ function BusinessProvider({ children }) {
|
|
|
2688
2906
|
zIndex: 199
|
|
2689
2907
|
}
|
|
2690
2908
|
),
|
|
2691
|
-
/* @__PURE__ */
|
|
2909
|
+
/* @__PURE__ */ jsx25(
|
|
2692
2910
|
CEXBindModal,
|
|
2693
2911
|
{
|
|
2694
2912
|
isOpen: CEXIsOpen && (!!token && !!overview),
|
|
@@ -2702,17 +2920,17 @@ function BusinessProvider({ children }) {
|
|
|
2702
2920
|
}
|
|
2703
2921
|
|
|
2704
2922
|
// src/context/index.tsx
|
|
2705
|
-
import { jsx as
|
|
2923
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
2706
2924
|
var Providers = ({ children }) => {
|
|
2707
2925
|
return (
|
|
2708
2926
|
// <MpcWalletProvider>
|
|
2709
|
-
/* @__PURE__ */
|
|
2927
|
+
/* @__PURE__ */ jsx26(BusinessProvider, { children })
|
|
2710
2928
|
);
|
|
2711
2929
|
};
|
|
2712
2930
|
var context_default = Providers;
|
|
2713
2931
|
|
|
2714
2932
|
// src/hooks/useWalletInit.ts
|
|
2715
|
-
import { useEffect as
|
|
2933
|
+
import { useEffect as useEffect15, useState as useState20 } from "react";
|
|
2716
2934
|
|
|
2717
2935
|
// src/hooks/useWallet.tsx
|
|
2718
2936
|
import { toAccount } from "viem/accounts";
|
|
@@ -2852,17 +3070,17 @@ function useWalletInit({
|
|
|
2852
3070
|
const getWalletIframe = () => {
|
|
2853
3071
|
return document.getElementById("match-wallet");
|
|
2854
3072
|
};
|
|
2855
|
-
const [walletInited, setWalletInited] =
|
|
3073
|
+
const [walletInited, setWalletInited] = useState20(false);
|
|
2856
3074
|
const { appid, token, overview } = useLocalStore_default();
|
|
2857
3075
|
const { initWallet, generateWallet } = useWallet();
|
|
2858
|
-
const [iframeLoaded, setIframeLoaded] =
|
|
2859
|
-
|
|
3076
|
+
const [iframeLoaded, setIframeLoaded] = useState20(false);
|
|
3077
|
+
useEffect15(() => {
|
|
2860
3078
|
console.log("wallet status", {
|
|
2861
3079
|
iframeLoaded,
|
|
2862
3080
|
walletInited
|
|
2863
3081
|
});
|
|
2864
3082
|
}, [iframeLoaded, walletInited]);
|
|
2865
|
-
|
|
3083
|
+
useEffect15(() => {
|
|
2866
3084
|
if (endpoints.auth) {
|
|
2867
3085
|
if (!window.matchWalletMessageIdMap) {
|
|
2868
3086
|
window.matchWalletMessageIdMap = {};
|
|
@@ -2885,9 +3103,6 @@ function useWalletInit({
|
|
|
2885
3103
|
document.body.insertBefore(iframe, document.body.firstChild);
|
|
2886
3104
|
window.sendMatchWalletMessage = (method, data, retry = 5, times = 0) => {
|
|
2887
3105
|
try {
|
|
2888
|
-
if (!walletInited) {
|
|
2889
|
-
throw new Error("Wallet not inited");
|
|
2890
|
-
}
|
|
2891
3106
|
if (!document.getElementById("match-wallet")) {
|
|
2892
3107
|
throw new Error("Wallet not found");
|
|
2893
3108
|
}
|
|
@@ -2939,7 +3154,7 @@ function useWalletInit({
|
|
|
2939
3154
|
}
|
|
2940
3155
|
}
|
|
2941
3156
|
}, [endpoints.auth]);
|
|
2942
|
-
|
|
3157
|
+
useEffect15(() => {
|
|
2943
3158
|
const messageHandle = async (e) => {
|
|
2944
3159
|
if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
|
|
2945
3160
|
return;
|
|
@@ -2972,7 +3187,7 @@ function useWalletInit({
|
|
|
2972
3187
|
window.removeEventListener("message", messageHandle);
|
|
2973
3188
|
};
|
|
2974
3189
|
}, []);
|
|
2975
|
-
|
|
3190
|
+
useEffect15(() => {
|
|
2976
3191
|
if (token && overview && overview.did && walletInited) {
|
|
2977
3192
|
const did = overview.did.split(":")[2];
|
|
2978
3193
|
const newUserInit = async () => {
|
|
@@ -3003,7 +3218,7 @@ function useWalletInit({
|
|
|
3003
3218
|
}
|
|
3004
3219
|
|
|
3005
3220
|
// src/hooks/useInit.tsx
|
|
3006
|
-
import { useEffect as
|
|
3221
|
+
import { useEffect as useEffect16, useRef as useRef2 } from "react";
|
|
3007
3222
|
function useInit({
|
|
3008
3223
|
theme,
|
|
3009
3224
|
appid,
|
|
@@ -3026,19 +3241,19 @@ function useInit({
|
|
|
3026
3241
|
const searchParams = new URLSearchParams(window.location.search);
|
|
3027
3242
|
const matchToken = searchParams.get("matchToken");
|
|
3028
3243
|
const realEndpoints = endpoints || env_default.endpoints;
|
|
3029
|
-
|
|
3244
|
+
useEffect16(() => {
|
|
3030
3245
|
setTheme(theme);
|
|
3031
3246
|
}, [theme]);
|
|
3032
|
-
|
|
3247
|
+
useEffect16(() => {
|
|
3033
3248
|
setAppid(appid);
|
|
3034
3249
|
}, [appid]);
|
|
3035
|
-
|
|
3250
|
+
useEffect16(() => {
|
|
3036
3251
|
setEndpoints(realEndpoints);
|
|
3037
3252
|
}, [realEndpoints]);
|
|
3038
|
-
|
|
3253
|
+
useEffect16(() => {
|
|
3039
3254
|
setLocale(locale || "en");
|
|
3040
3255
|
}, [locale]);
|
|
3041
|
-
|
|
3256
|
+
useEffect16(() => {
|
|
3042
3257
|
if (matchToken) {
|
|
3043
3258
|
const tokenData = JSON.parse(atob(matchToken));
|
|
3044
3259
|
if (tokenData && tokenData.mid && tokenData.token) {
|
|
@@ -3049,7 +3264,7 @@ function useInit({
|
|
|
3049
3264
|
}
|
|
3050
3265
|
}
|
|
3051
3266
|
}, [matchToken]);
|
|
3052
|
-
|
|
3267
|
+
useEffect16(() => {
|
|
3053
3268
|
const onLoginMessage = (event) => {
|
|
3054
3269
|
const res = event.data;
|
|
3055
3270
|
if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
|
|
@@ -3085,7 +3300,7 @@ function useInit({
|
|
|
3085
3300
|
overviewLoadingRef.current = false;
|
|
3086
3301
|
}
|
|
3087
3302
|
};
|
|
3088
|
-
|
|
3303
|
+
useEffect16(() => {
|
|
3089
3304
|
if (token) {
|
|
3090
3305
|
loadOverview();
|
|
3091
3306
|
}
|
|
@@ -3592,7 +3807,7 @@ var messages = {
|
|
|
3592
3807
|
};
|
|
3593
3808
|
|
|
3594
3809
|
// src/MatchContext.tsx
|
|
3595
|
-
import { jsx as
|
|
3810
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
3596
3811
|
var queryClient = new QueryClient();
|
|
3597
3812
|
var MatchContext = createContext(void 0);
|
|
3598
3813
|
var MatchProvider = ({ children, appid, events, theme = "light", endpoints, locale }) => {
|
|
@@ -3613,7 +3828,7 @@ var MatchProvider = ({ children, appid, events, theme = "light", endpoints, loca
|
|
|
3613
3828
|
useWalletInit({
|
|
3614
3829
|
refreshOverview: loadOverview
|
|
3615
3830
|
});
|
|
3616
|
-
return /* @__PURE__ */
|
|
3831
|
+
return /* @__PURE__ */ jsx27(IntlProvider, { locale: realLocale, messages: messages[realLocale], children: /* @__PURE__ */ jsx27(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx27(
|
|
3617
3832
|
MatchContext.Provider,
|
|
3618
3833
|
{
|
|
3619
3834
|
value: {
|
|
@@ -3624,7 +3839,7 @@ var MatchProvider = ({ children, appid, events, theme = "light", endpoints, loca
|
|
|
3624
3839
|
theme,
|
|
3625
3840
|
locale: realLocale
|
|
3626
3841
|
},
|
|
3627
|
-
children: /* @__PURE__ */
|
|
3842
|
+
children: /* @__PURE__ */ jsx27(context_default, { children })
|
|
3628
3843
|
}
|
|
3629
3844
|
) }) });
|
|
3630
3845
|
};
|
|
@@ -3652,6 +3867,7 @@ function useUserInfo() {
|
|
|
3652
3867
|
const { events, login } = useMatch();
|
|
3653
3868
|
const { open: SOLOpen } = useSOLModalStore();
|
|
3654
3869
|
const { open: TRONOpen } = useTRONModalStore();
|
|
3870
|
+
const { open: TONOpen } = useTONModalStore();
|
|
3655
3871
|
const { open: BTCOpen } = useBTCModalStore();
|
|
3656
3872
|
const { open: CEXBindOpen } = useCEXBindModalStore();
|
|
3657
3873
|
const isLogin = useMemo10(() => !!token, [token]);
|
|
@@ -3700,6 +3916,8 @@ function useUserInfo() {
|
|
|
3700
3916
|
return SOLOpen("login");
|
|
3701
3917
|
case "tron":
|
|
3702
3918
|
return TRONOpen("login");
|
|
3919
|
+
case "ton":
|
|
3920
|
+
return TONOpen("login");
|
|
3703
3921
|
case "btc":
|
|
3704
3922
|
return BTCOpen("login");
|
|
3705
3923
|
case "telegram":
|
|
@@ -3791,6 +4009,8 @@ function useUserInfo() {
|
|
|
3791
4009
|
return SOLOpen("bind");
|
|
3792
4010
|
case "tron":
|
|
3793
4011
|
return TRONOpen("bind");
|
|
4012
|
+
case "ton":
|
|
4013
|
+
return TONOpen("bind");
|
|
3794
4014
|
case "btc":
|
|
3795
4015
|
return BTCOpen("bind");
|
|
3796
4016
|
case "telegram":
|
|
@@ -3843,9 +4063,9 @@ function useUserInfo() {
|
|
|
3843
4063
|
}
|
|
3844
4064
|
|
|
3845
4065
|
// src/hooks/useMatchEvents.ts
|
|
3846
|
-
import { useEffect as
|
|
4066
|
+
import { useEffect as useEffect17 } from "react";
|
|
3847
4067
|
function useMatchEvents(handlers) {
|
|
3848
|
-
|
|
4068
|
+
useEffect17(() => {
|
|
3849
4069
|
Object.entries(handlers).forEach(([event, handler2]) => {
|
|
3850
4070
|
if (handler2) {
|
|
3851
4071
|
eventManager_default.on(event, handler2);
|
|
@@ -3863,14 +4083,14 @@ function useMatchEvents(handlers) {
|
|
|
3863
4083
|
|
|
3864
4084
|
// src/hooks/useCopyClipboard.ts
|
|
3865
4085
|
import copy from "copy-to-clipboard";
|
|
3866
|
-
import { useCallback, useEffect as
|
|
4086
|
+
import { useCallback, useEffect as useEffect18, useState as useState21 } from "react";
|
|
3867
4087
|
function useCopyClipboard(timeout = 500) {
|
|
3868
|
-
const [isCopied, setIsCopied] =
|
|
4088
|
+
const [isCopied, setIsCopied] = useState21(false);
|
|
3869
4089
|
const staticCopy = useCallback((text) => {
|
|
3870
4090
|
const didCopy = copy(text);
|
|
3871
4091
|
setIsCopied(didCopy);
|
|
3872
4092
|
}, []);
|
|
3873
|
-
|
|
4093
|
+
useEffect18(() => {
|
|
3874
4094
|
if (isCopied) {
|
|
3875
4095
|
const hide = setTimeout(() => {
|
|
3876
4096
|
setIsCopied(false);
|
|
@@ -3915,9 +4135,10 @@ export {
|
|
|
3915
4135
|
UsernameModal,
|
|
3916
4136
|
SOLModal,
|
|
3917
4137
|
TRONModal,
|
|
4138
|
+
TONModal,
|
|
3918
4139
|
BTCModal,
|
|
3919
4140
|
components_exports,
|
|
3920
4141
|
MatchProvider,
|
|
3921
4142
|
useMatch
|
|
3922
4143
|
};
|
|
3923
|
-
//# sourceMappingURL=chunk-
|
|
4144
|
+
//# sourceMappingURL=chunk-222KVWTM.mjs.map
|