@matchain/matchid-sdk-react 0.1.55-alpha.11 → 0.1.55-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.mts +2 -2
- package/dist/api.d.ts +2 -2
- package/dist/api.js +20 -20
- package/dist/api.js.map +1 -1
- package/dist/api.mjs +2 -2
- package/dist/assets/lottie.d.mts +1 -1
- package/dist/assets/lottie.d.ts +1 -1
- package/dist/chains.d.mts +1 -1
- package/dist/chains.d.ts +1 -1
- package/dist/{chunk-JTNCYI5F.mjs → chunk-25VAJMUX.mjs} +2 -2
- package/dist/{chunk-5WFY6MWJ.mjs → chunk-BB4OTBUS.mjs} +165 -155
- package/dist/chunk-BB4OTBUS.mjs.map +1 -0
- package/dist/components.d.mts +3 -3
- package/dist/components.d.ts +3 -3
- package/dist/components.js +172 -162
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +1 -1
- package/dist/hooks.d.mts +4 -2
- package/dist/hooks.d.ts +4 -2
- package/dist/hooks.js +109 -104
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/icon.d.mts +2 -2
- package/dist/icon.d.ts +2 -2
- package/dist/{index-De5vVOFw.d.mts → index--EI6w9pi.d.mts} +1008 -1002
- package/dist/{index-Bx7ztInz.d.ts → index-4dZbgWG2.d.ts} +1 -1
- package/dist/{index-DXRGMAbv.d.mts → index-B50DU_xT.d.mts} +4 -4
- package/dist/{index-DXRGMAbv.d.ts → index-B50DU_xT.d.ts} +4 -4
- package/dist/{index-BTO2pJRz.d.ts → index-B80rDuha.d.ts} +1 -1
- package/dist/{index-DY5CjOq2.d.ts → index-BBghnVDr.d.ts} +1 -1
- package/dist/{index-DL0LMDQ0.d.mts → index-C14uKUDG.d.mts} +2 -2
- package/dist/{index-DysgDUCb.d.mts → index-CDTTHSh0.d.mts} +14 -14
- package/dist/{index-DysgDUCb.d.ts → index-CDTTHSh0.d.ts} +14 -14
- package/dist/{index-HYPgwvkU.d.mts → index-CHtFnnZk.d.mts} +1 -1
- package/dist/{index-ChUeWRxV.d.ts → index-Cl0JpAc1.d.ts} +1008 -1002
- package/dist/{index-CopoHLm5.d.ts → index-CwHXzvvB.d.ts} +1 -1
- package/dist/{index-8h2kA48e.d.ts → index-DGbpUvkd.d.ts} +2 -2
- package/dist/{index-B-u8_Lcy.d.ts → index-Dx4OFZhG.d.mts} +5 -6
- package/dist/{index-BW1GRpQ3.d.mts → index-FKxw4Vaa.d.mts} +1 -1
- package/dist/{index-D6wTVWuu.d.mts → index-QPdWAVPk.d.mts} +1 -1
- package/dist/{index-D2hhRO2j.d.mts → index-TjbO7d74.d.mts} +1 -1
- package/dist/{index-Ba8t2zs6.d.mts → index-hiCo96Vc.d.ts} +5 -6
- package/dist/index.d.mts +18 -17
- package/dist/index.d.ts +18 -17
- package/dist/index.js +121 -111
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{types-Ch54HuTY.d.mts → types-DEsY_CPH.d.mts} +1 -1
- package/dist/{types-Ch54HuTY.d.ts → types-DEsY_CPH.d.ts} +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/ui.d.mts +3 -3
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +14 -9
- package/dist/ui.js.map +1 -1
- package/dist/ui.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-5WFY6MWJ.mjs.map +0 -1
- /package/dist/{chunk-JTNCYI5F.mjs.map → chunk-25VAJMUX.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -48,7 +48,7 @@ __export(src_exports, {
|
|
|
48
48
|
module.exports = __toCommonJS(src_exports);
|
|
49
49
|
|
|
50
50
|
// src/MatchContext.tsx
|
|
51
|
-
var
|
|
51
|
+
var import_react43 = require("react");
|
|
52
52
|
|
|
53
53
|
// src/hooks/index.tsx
|
|
54
54
|
var hooks_exports = {};
|
|
@@ -2430,11 +2430,11 @@ var RecoveryType = /* @__PURE__ */ ((RecoveryType3) => {
|
|
|
2430
2430
|
// src/hooks/useWallet.tsx
|
|
2431
2431
|
var import_accounts = require("viem/accounts");
|
|
2432
2432
|
var import_viem8 = require("viem");
|
|
2433
|
-
var
|
|
2433
|
+
var import_react32 = require("react");
|
|
2434
2434
|
var import_viem9 = require("viem");
|
|
2435
2435
|
|
|
2436
2436
|
// src/context/ModalContext.tsx
|
|
2437
|
-
var
|
|
2437
|
+
var import_react31 = __toESM(require("react"));
|
|
2438
2438
|
var import_react_dom = require("react-dom");
|
|
2439
2439
|
|
|
2440
2440
|
// src/ui/index.ts
|
|
@@ -2447,7 +2447,7 @@ __export(ui_exports, {
|
|
|
2447
2447
|
Field: () => Field,
|
|
2448
2448
|
HashPanel: () => HashPanel_default,
|
|
2449
2449
|
Input: () => Input,
|
|
2450
|
-
Lottie: () =>
|
|
2450
|
+
Lottie: () => Lottie_default,
|
|
2451
2451
|
Modal: () => Modal,
|
|
2452
2452
|
ModalDrawer: () => ModalDrawer,
|
|
2453
2453
|
ModalWithHeader: () => ModalWithHeader,
|
|
@@ -3545,7 +3545,7 @@ function WalletModalContent({
|
|
|
3545
3545
|
}, [visible, connected, status, error, address]);
|
|
3546
3546
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "matchid-wallet-container", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `matchid-wallet-box`, children: [
|
|
3547
3547
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `matchid-wallet-content`, children: [
|
|
3548
|
-
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
3548
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Lottie_default, { animationData: pageData.statusImage, style: {
|
|
3549
3549
|
width: 128,
|
|
3550
3550
|
height: 128
|
|
3551
3551
|
} }),
|
|
@@ -3629,7 +3629,7 @@ function WalletModalContentV2(props) {
|
|
|
3629
3629
|
}, [props, submitting]);
|
|
3630
3630
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "matchid-wallet-container", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `matchid-wallet-box`, children: [
|
|
3631
3631
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `matchid-wallet-content`, children: [
|
|
3632
|
-
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
3632
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Lottie_default, { animationData: pageData.statusImage, style: {
|
|
3633
3633
|
width: 128,
|
|
3634
3634
|
height: 128
|
|
3635
3635
|
} }),
|
|
@@ -3699,7 +3699,7 @@ var import_wagmi = require("wagmi");
|
|
|
3699
3699
|
var import_ethers = require("ethers");
|
|
3700
3700
|
|
|
3701
3701
|
// node_modules/@wagmi/core/dist/esm/version.js
|
|
3702
|
-
var version = "2.16.
|
|
3702
|
+
var version = "2.16.5";
|
|
3703
3703
|
|
|
3704
3704
|
// node_modules/@wagmi/core/dist/esm/utils/getVersion.js
|
|
3705
3705
|
var getVersion2 = () => `@wagmi/core@${version}`;
|
|
@@ -3850,7 +3850,11 @@ async function getConnectorClient(config, parameters = {}) {
|
|
|
3850
3850
|
if (config.state.status === "reconnecting" && !connector2.getAccounts && !connector2.getChainId)
|
|
3851
3851
|
throw new ConnectorUnavailableReconnectingError({ connector: connector2 });
|
|
3852
3852
|
const [accounts, chainId2] = await Promise.all([
|
|
3853
|
-
connector2.getAccounts()
|
|
3853
|
+
connector2.getAccounts().catch((e) => {
|
|
3854
|
+
if (parameters.account === null)
|
|
3855
|
+
return [];
|
|
3856
|
+
throw e;
|
|
3857
|
+
}),
|
|
3854
3858
|
connector2.getChainId()
|
|
3855
3859
|
]);
|
|
3856
3860
|
connection = {
|
|
@@ -3873,7 +3877,8 @@ async function getConnectorClient(config, parameters = {}) {
|
|
|
3873
3877
|
if (connector.getClient)
|
|
3874
3878
|
return connector.getClient({ chainId });
|
|
3875
3879
|
const account = (0, import_utils6.parseAccount)(parameters.account ?? connection.accounts[0]);
|
|
3876
|
-
|
|
3880
|
+
if (account)
|
|
3881
|
+
account.address = (0, import_utils6.getAddress)(account.address);
|
|
3877
3882
|
if (parameters.account && !connection.accounts.some((x) => x.toLowerCase() === account.address.toLowerCase()))
|
|
3878
3883
|
throw new ConnectorAccountNotFoundError({
|
|
3879
3884
|
address: account.address,
|
|
@@ -5831,7 +5836,7 @@ function HashPanel({
|
|
|
5831
5836
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: `matchid-hashpanel-status`, style: {
|
|
5832
5837
|
color: statusValue.color
|
|
5833
5838
|
}, children: statusValue.text }),
|
|
5834
|
-
statusValue.lottie ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
5839
|
+
statusValue.lottie ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Lottie_default, { animationData: statusValue.lottie, style: {
|
|
5835
5840
|
width: "96px",
|
|
5836
5841
|
height: "96px"
|
|
5837
5842
|
} }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("img", { src: statusValue.icon, alt: statusValue.text, className: `matchid-hashpanel-img` }),
|
|
@@ -5957,33 +5962,38 @@ function Tabs(props) {
|
|
|
5957
5962
|
}
|
|
5958
5963
|
|
|
5959
5964
|
// src/ui/Lottie/index.tsx
|
|
5960
|
-
var
|
|
5965
|
+
var import_react30 = require("react");
|
|
5961
5966
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
}
|
|
5967
|
+
var LazyLottie = (props) => {
|
|
5968
|
+
const [LottieReact, setLottieReact] = (0, import_react30.useState)(null);
|
|
5969
|
+
(0, import_react30.useEffect)(() => {
|
|
5970
|
+
import("lottie-react").then((mod) => {
|
|
5971
|
+
setLottieReact(mod.default || mod);
|
|
5972
|
+
});
|
|
5973
|
+
}, []);
|
|
5974
|
+
if (!LottieReact) return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { children: "Loading..." });
|
|
5975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(LottieReact, { loop: true, autoplay: true, ...props });
|
|
5976
|
+
};
|
|
5977
|
+
var Lottie_default = LazyLottie;
|
|
5968
5978
|
|
|
5969
5979
|
// src/context/ModalContext.tsx
|
|
5970
5980
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
5971
|
-
var ModalContext = (0,
|
|
5981
|
+
var ModalContext = (0, import_react31.createContext)(null);
|
|
5972
5982
|
function ModalProvider({ children }) {
|
|
5973
|
-
const [modalState, setModalState] = (0,
|
|
5983
|
+
const [modalState, setModalState] = (0, import_react31.useState)({
|
|
5974
5984
|
modals: [],
|
|
5975
5985
|
highestZIndex: 100
|
|
5976
5986
|
});
|
|
5977
|
-
const getNextIndex = (0,
|
|
5987
|
+
const getNextIndex = (0, import_react31.useCallback)(() => {
|
|
5978
5988
|
return Math.max(...modalState.modals.map((modal) => modal.index), 0) + 1 || 100;
|
|
5979
5989
|
}, [modalState]);
|
|
5980
|
-
const closeModal = (0,
|
|
5990
|
+
const closeModal = (0, import_react31.useCallback)((index) => {
|
|
5981
5991
|
setModalState((prevState) => ({
|
|
5982
5992
|
modals: prevState.modals.filter((modal) => modal.index !== index),
|
|
5983
5993
|
highestZIndex: prevState.highestZIndex
|
|
5984
5994
|
}));
|
|
5985
5995
|
}, []);
|
|
5986
|
-
const show = (0,
|
|
5996
|
+
const show = (0, import_react31.useCallback)((content, index) => {
|
|
5987
5997
|
setModalState((prevState) => {
|
|
5988
5998
|
const modalIndex = index !== void 0 ? index : getNextIndex();
|
|
5989
5999
|
const newZIndex = prevState.highestZIndex + 1;
|
|
@@ -5999,7 +6009,7 @@ function ModalProvider({ children }) {
|
|
|
5999
6009
|
};
|
|
6000
6010
|
});
|
|
6001
6011
|
}, [getNextIndex, closeModal]);
|
|
6002
|
-
const open = (0,
|
|
6012
|
+
const open = (0, import_react31.useCallback)((props) => {
|
|
6003
6013
|
setModalState((prevState) => {
|
|
6004
6014
|
const modalIndex = props.index !== void 0 ? props.index : getNextIndex();
|
|
6005
6015
|
const newZIndex = prevState.highestZIndex + 1;
|
|
@@ -6017,7 +6027,7 @@ function ModalProvider({ children }) {
|
|
|
6017
6027
|
}, [getNextIndex, closeModal]);
|
|
6018
6028
|
const modalElements = modalState.modals.sort((a, b) => b.zIndex - a.zIndex).map(
|
|
6019
6029
|
(modal) => modal.visible ? (0, import_react_dom.createPortal)(
|
|
6020
|
-
|
|
6030
|
+
import_react31.default.createElement(modal.content, { zIndex: modal.zIndex, close: modal.close }),
|
|
6021
6031
|
document.body
|
|
6022
6032
|
) : null
|
|
6023
6033
|
);
|
|
@@ -6027,7 +6037,7 @@ function ModalProvider({ children }) {
|
|
|
6027
6037
|
] });
|
|
6028
6038
|
}
|
|
6029
6039
|
function useModal() {
|
|
6030
|
-
const context = (0,
|
|
6040
|
+
const context = (0, import_react31.useContext)(ModalContext);
|
|
6031
6041
|
if (!context) {
|
|
6032
6042
|
throw new Error("useModal must be used within a ModalProvider");
|
|
6033
6043
|
}
|
|
@@ -6116,7 +6126,7 @@ function useWallet() {
|
|
|
6116
6126
|
throw error;
|
|
6117
6127
|
}
|
|
6118
6128
|
};
|
|
6119
|
-
const evmAccount = (0,
|
|
6129
|
+
const evmAccount = (0, import_react32.useMemo)(() => {
|
|
6120
6130
|
try {
|
|
6121
6131
|
return address ? (0, import_accounts.toAccount)({
|
|
6122
6132
|
address,
|
|
@@ -6155,7 +6165,7 @@ function useWallet() {
|
|
|
6155
6165
|
return void 0;
|
|
6156
6166
|
}
|
|
6157
6167
|
}, [address]);
|
|
6158
|
-
(0,
|
|
6168
|
+
(0, import_react32.useEffect)(() => {
|
|
6159
6169
|
matchlog_default.log("qwe-evmAccount", evmAccount);
|
|
6160
6170
|
}, [evmAccount]);
|
|
6161
6171
|
const realCreateWalletClient = (parameters) => {
|
|
@@ -6298,14 +6308,14 @@ function useWallet() {
|
|
|
6298
6308
|
|
|
6299
6309
|
// src/hooks/useCopyClipboard.ts
|
|
6300
6310
|
var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
|
|
6301
|
-
var
|
|
6311
|
+
var import_react33 = require("react");
|
|
6302
6312
|
function useCopyClipboard(timeout = 500) {
|
|
6303
|
-
const [isCopied, setIsCopied] = (0,
|
|
6304
|
-
const staticCopy = (0,
|
|
6313
|
+
const [isCopied, setIsCopied] = (0, import_react33.useState)(false);
|
|
6314
|
+
const staticCopy = (0, import_react33.useCallback)((text) => {
|
|
6305
6315
|
const didCopy = (0, import_copy_to_clipboard.default)(text);
|
|
6306
6316
|
setIsCopied(didCopy);
|
|
6307
6317
|
}, []);
|
|
6308
|
-
(0,
|
|
6318
|
+
(0, import_react33.useEffect)(() => {
|
|
6309
6319
|
if (isCopied) {
|
|
6310
6320
|
const hide = setTimeout(() => {
|
|
6311
6321
|
setIsCopied(false);
|
|
@@ -6320,24 +6330,24 @@ function useCopyClipboard(timeout = 500) {
|
|
|
6320
6330
|
}
|
|
6321
6331
|
|
|
6322
6332
|
// src/context/ToastContext.tsx
|
|
6323
|
-
var
|
|
6333
|
+
var import_react34 = require("react");
|
|
6324
6334
|
var import_react_dom2 = require("react-dom");
|
|
6325
6335
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
6326
|
-
var ToastContext = (0,
|
|
6336
|
+
var ToastContext = (0, import_react34.createContext)(null);
|
|
6327
6337
|
function ToastProvider({ children, zIndex = 299 }) {
|
|
6328
|
-
const [toasts, setToasts] = (0,
|
|
6329
|
-
const removeToast = (0,
|
|
6338
|
+
const [toasts, setToasts] = (0, import_react34.useState)([]);
|
|
6339
|
+
const removeToast = (0, import_react34.useCallback)((id) => {
|
|
6330
6340
|
setToasts((prev) => prev.filter((toast) => toast.id !== id));
|
|
6331
6341
|
}, []);
|
|
6332
|
-
const show = (0,
|
|
6342
|
+
const show = (0, import_react34.useCallback)(({ icon, timeout = 3e3, text }) => {
|
|
6333
6343
|
const id = Date.now() + Math.random();
|
|
6334
6344
|
setToasts((prev) => [...prev, { id, icon, text }]);
|
|
6335
6345
|
setTimeout(() => removeToast(id), timeout);
|
|
6336
6346
|
}, [removeToast]);
|
|
6337
|
-
const success = (0,
|
|
6347
|
+
const success = (0, import_react34.useCallback)((text, timeout) => {
|
|
6338
6348
|
show({ icon: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(CheckRoundIcon, { color: "#2FCC00", size: 24 }), text, timeout });
|
|
6339
6349
|
}, [show]);
|
|
6340
|
-
const error = (0,
|
|
6350
|
+
const error = (0, import_react34.useCallback)((text, timeout) => {
|
|
6341
6351
|
show({ icon: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ErrorRoundIcon, { size: 24 }), text, timeout });
|
|
6342
6352
|
}, [show]);
|
|
6343
6353
|
const ToastComponent = (0, import_react_dom2.createPortal)(
|
|
@@ -6362,7 +6372,7 @@ function ToastProvider({ children, zIndex = 299 }) {
|
|
|
6362
6372
|
] });
|
|
6363
6373
|
}
|
|
6364
6374
|
function useToast() {
|
|
6365
|
-
const context = (0,
|
|
6375
|
+
const context = (0, import_react34.useContext)(ToastContext);
|
|
6366
6376
|
if (!context) {
|
|
6367
6377
|
throw new Error("useToast must be used within a ToastProvider");
|
|
6368
6378
|
}
|
|
@@ -6498,7 +6508,7 @@ function useWalletAssetListQuery({
|
|
|
6498
6508
|
}
|
|
6499
6509
|
|
|
6500
6510
|
// src/hooks/useMatchChain.tsx
|
|
6501
|
-
var
|
|
6511
|
+
var import_react35 = require("react");
|
|
6502
6512
|
var import_viem10 = require("viem");
|
|
6503
6513
|
var import_react_intl19 = require("react-intl");
|
|
6504
6514
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
@@ -6507,7 +6517,7 @@ function useMatchChain() {
|
|
|
6507
6517
|
const modal = useModal();
|
|
6508
6518
|
const intl = (0, import_react_intl19.useIntl)();
|
|
6509
6519
|
const { chainId: storeChainId, setChainId } = useLocalStore_default();
|
|
6510
|
-
const chainId = (0,
|
|
6520
|
+
const chainId = (0, import_react35.useMemo)(() => {
|
|
6511
6521
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
6512
6522
|
return null;
|
|
6513
6523
|
}
|
|
@@ -6516,7 +6526,7 @@ function useMatchChain() {
|
|
|
6516
6526
|
}
|
|
6517
6527
|
return chainListQuery.data[0].id;
|
|
6518
6528
|
}, [storeChainId, chainListQuery.data]);
|
|
6519
|
-
const chain = (0,
|
|
6529
|
+
const chain = (0, import_react35.useMemo)(() => {
|
|
6520
6530
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
6521
6531
|
return null;
|
|
6522
6532
|
}
|
|
@@ -6530,7 +6540,7 @@ function useMatchChain() {
|
|
|
6530
6540
|
close
|
|
6531
6541
|
}) {
|
|
6532
6542
|
const { chainId: storeChainId2, setChainId: setChainId2 } = useLocalStore_default();
|
|
6533
|
-
const [selectedChainId, setSelectedChainId] = (0,
|
|
6543
|
+
const [selectedChainId, setSelectedChainId] = (0, import_react35.useState)(storeChainId2);
|
|
6534
6544
|
const isDownMd = useDownMd();
|
|
6535
6545
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: `matchid-change-network-box`, children: [
|
|
6536
6546
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: `matchid-change-network-list`, children: chainListQuery.data?.map((item, index) => {
|
|
@@ -6562,7 +6572,7 @@ function useMatchChain() {
|
|
|
6562
6572
|
content: ChangeNetwork
|
|
6563
6573
|
});
|
|
6564
6574
|
};
|
|
6565
|
-
const publicClient = (0,
|
|
6575
|
+
const publicClient = (0, import_react35.useMemo)(() => {
|
|
6566
6576
|
if (!chain) {
|
|
6567
6577
|
return null;
|
|
6568
6578
|
}
|
|
@@ -6590,13 +6600,13 @@ function useMatchChain() {
|
|
|
6590
6600
|
|
|
6591
6601
|
// src/hooks/useMatchWallet.tsx
|
|
6592
6602
|
var import_react_qrcode = require("react-qrcode");
|
|
6593
|
-
var
|
|
6603
|
+
var import_react37 = require("react");
|
|
6594
6604
|
var import_react_query6 = require("@tanstack/react-query");
|
|
6595
6605
|
var import_viem13 = require("viem");
|
|
6596
6606
|
var import_react_intl21 = require("react-intl");
|
|
6597
6607
|
|
|
6598
6608
|
// src/components/ImportToken/index.tsx
|
|
6599
|
-
var
|
|
6609
|
+
var import_react36 = require("react");
|
|
6600
6610
|
var import_react_intl20 = require("react-intl");
|
|
6601
6611
|
var import_react_query5 = require("@tanstack/react-query");
|
|
6602
6612
|
var import_viem12 = require("viem");
|
|
@@ -6628,12 +6638,12 @@ function useIsContract({
|
|
|
6628
6638
|
// src/components/ImportToken/index.tsx
|
|
6629
6639
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
6630
6640
|
function ImportToken({ close }) {
|
|
6631
|
-
const [status, setStatus] = (0,
|
|
6641
|
+
const [status, setStatus] = (0, import_react36.useState)("");
|
|
6632
6642
|
const { token } = useUserInfo();
|
|
6633
|
-
const [address, setAddress] = (0,
|
|
6634
|
-
const [symbol, setSymbol] = (0,
|
|
6635
|
-
const [decimals, setDecimals] = (0,
|
|
6636
|
-
const [error, setError] = (0,
|
|
6643
|
+
const [address, setAddress] = (0, import_react36.useState)("");
|
|
6644
|
+
const [symbol, setSymbol] = (0, import_react36.useState)("");
|
|
6645
|
+
const [decimals, setDecimals] = (0, import_react36.useState)("");
|
|
6646
|
+
const [error, setError] = (0, import_react36.useState)({});
|
|
6637
6647
|
const { publicClient, chainId, chain } = useMatchChain();
|
|
6638
6648
|
const getContractInfo = async () => {
|
|
6639
6649
|
if (!publicClient) return;
|
|
@@ -6667,7 +6677,7 @@ function ImportToken({ close }) {
|
|
|
6667
6677
|
}
|
|
6668
6678
|
};
|
|
6669
6679
|
const intl = (0, import_react_intl20.useIntl)();
|
|
6670
|
-
(0,
|
|
6680
|
+
(0, import_react36.useEffect)(() => {
|
|
6671
6681
|
if (address.length === 42) {
|
|
6672
6682
|
const reg = /^0x[0-9a-fA-F]{40}$/;
|
|
6673
6683
|
if (!reg.test(address)) {
|
|
@@ -6686,7 +6696,7 @@ function ImportToken({ close }) {
|
|
|
6686
6696
|
}
|
|
6687
6697
|
}
|
|
6688
6698
|
}, [address, publicClient]);
|
|
6689
|
-
const [loading, setLoading] = (0,
|
|
6699
|
+
const [loading, setLoading] = (0, import_react36.useState)(false);
|
|
6690
6700
|
const toast = useToast();
|
|
6691
6701
|
const queryClient2 = (0, import_react_query5.useQueryClient)();
|
|
6692
6702
|
const onImport = async () => {
|
|
@@ -6714,7 +6724,7 @@ function ImportToken({ close }) {
|
|
|
6714
6724
|
setLoading(false);
|
|
6715
6725
|
}
|
|
6716
6726
|
};
|
|
6717
|
-
const canImport = (0,
|
|
6727
|
+
const canImport = (0, import_react36.useMemo)(() => {
|
|
6718
6728
|
if (!address) {
|
|
6719
6729
|
return false;
|
|
6720
6730
|
}
|
|
@@ -6739,7 +6749,7 @@ function ImportToken({ close }) {
|
|
|
6739
6749
|
if (status == "success" || status == "fail") {
|
|
6740
6750
|
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: `matchid-import-token-result matchid-flex`, children: [
|
|
6741
6751
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: `matchid-import-token-result-box matchid-flex`, children: [
|
|
6742
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: `matchid-import-token-result-img`, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
6752
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: `matchid-import-token-result-img`, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Lottie_default, { animationData: status == "success" ? success_default : fail_default, style: {
|
|
6743
6753
|
width: "96px",
|
|
6744
6754
|
height: "96px"
|
|
6745
6755
|
} }) }),
|
|
@@ -6883,12 +6893,12 @@ function useMatchWallet() {
|
|
|
6883
6893
|
};
|
|
6884
6894
|
}
|
|
6885
6895
|
function useMatchWalletRecords() {
|
|
6886
|
-
const [hasMore, setHasMore] = (0,
|
|
6887
|
-
const [items, setItems] = (0,
|
|
6896
|
+
const [hasMore, setHasMore] = (0, import_react37.useState)(true);
|
|
6897
|
+
const [items, setItems] = (0, import_react37.useState)([]);
|
|
6888
6898
|
const { chainId, publicClient } = useMatchChain();
|
|
6889
6899
|
const { address } = useWallet();
|
|
6890
|
-
const hasMoreRef = (0,
|
|
6891
|
-
const nextPageParamsRef = (0,
|
|
6900
|
+
const hasMoreRef = (0, import_react37.useRef)(hasMore);
|
|
6901
|
+
const nextPageParamsRef = (0, import_react37.useRef)(void 0);
|
|
6892
6902
|
const { contracts, setContracts } = useContractStore_default();
|
|
6893
6903
|
const fetchMoreData = async () => {
|
|
6894
6904
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
@@ -6915,7 +6925,7 @@ function useMatchWalletRecords() {
|
|
|
6915
6925
|
hasMoreRef.current = true;
|
|
6916
6926
|
fetchMoreData();
|
|
6917
6927
|
};
|
|
6918
|
-
(0,
|
|
6928
|
+
(0, import_react37.useEffect)(() => {
|
|
6919
6929
|
if (chainId && address) {
|
|
6920
6930
|
onInit();
|
|
6921
6931
|
}
|
|
@@ -6971,7 +6981,7 @@ function useMatchWalletRecords() {
|
|
|
6971
6981
|
setContracts(contractMap);
|
|
6972
6982
|
}
|
|
6973
6983
|
};
|
|
6974
|
-
const list = (0,
|
|
6984
|
+
const list = (0, import_react37.useMemo)(() => {
|
|
6975
6985
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
6976
6986
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
6977
6987
|
removeList.forEach((item) => {
|
|
@@ -7013,7 +7023,7 @@ function useMatchWalletAssets({
|
|
|
7013
7023
|
chainId: chainId || 0,
|
|
7014
7024
|
...assetListOptions
|
|
7015
7025
|
});
|
|
7016
|
-
const mergedAssets = (0,
|
|
7026
|
+
const mergedAssets = (0, import_react37.useMemo)(() => {
|
|
7017
7027
|
if (!assetListQuery.data && !importTokenQuery.data) return [];
|
|
7018
7028
|
const assetList = (assetListQuery.data || []).map((asset) => ({
|
|
7019
7029
|
...asset,
|
|
@@ -7100,7 +7110,7 @@ function useMatchWalletAssetList({
|
|
|
7100
7110
|
retry: 3
|
|
7101
7111
|
// Retry up to 3 times if failed
|
|
7102
7112
|
});
|
|
7103
|
-
const erc20Tokens = (0,
|
|
7113
|
+
const erc20Tokens = (0, import_react37.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
|
|
7104
7114
|
const erc20BalanceQuery = (0, import_react_query6.useQuery)({
|
|
7105
7115
|
queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
|
|
7106
7116
|
queryFn: async () => {
|
|
@@ -7128,7 +7138,7 @@ function useMatchWalletAssetList({
|
|
|
7128
7138
|
// Refresh every 15 seconds
|
|
7129
7139
|
retry: 3
|
|
7130
7140
|
});
|
|
7131
|
-
const enrichedAssets = (0,
|
|
7141
|
+
const enrichedAssets = (0, import_react37.useMemo)(() => {
|
|
7132
7142
|
if (!list) return [];
|
|
7133
7143
|
const erc20Balances = erc20BalanceQuery.data || [];
|
|
7134
7144
|
return list.map((asset) => {
|
|
@@ -7150,7 +7160,7 @@ function useMatchWalletAssetList({
|
|
|
7150
7160
|
return { ...asset, balance, value, balanceValue };
|
|
7151
7161
|
});
|
|
7152
7162
|
}, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
|
|
7153
|
-
(0,
|
|
7163
|
+
(0, import_react37.useEffect)(() => {
|
|
7154
7164
|
const list2 = enrichedAssets.sort((a, b) => {
|
|
7155
7165
|
if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
|
|
7156
7166
|
if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
|
|
@@ -7175,14 +7185,14 @@ function useMatchWalletAssetList({
|
|
|
7175
7185
|
}
|
|
7176
7186
|
|
|
7177
7187
|
// src/hooks/useReceipt.tsx
|
|
7178
|
-
var
|
|
7188
|
+
var import_react38 = require("react");
|
|
7179
7189
|
var import_react_query7 = require("@tanstack/react-query");
|
|
7180
7190
|
var import_viem14 = require("viem");
|
|
7181
7191
|
var CACHE_TTL = 86400 * 30 * 1e3;
|
|
7182
7192
|
var MAX_CACHE_SIZE = 500;
|
|
7183
7193
|
var STORAGE_KEY = "match_receipt_logs";
|
|
7184
7194
|
function useReceiptCache() {
|
|
7185
|
-
const [cache, setCache] = (0,
|
|
7195
|
+
const [cache, setCache] = (0, import_react38.useState)(/* @__PURE__ */ new Map());
|
|
7186
7196
|
const isLocalStorageAvailable = (() => {
|
|
7187
7197
|
try {
|
|
7188
7198
|
const testKey = "__test__";
|
|
@@ -7193,7 +7203,7 @@ function useReceiptCache() {
|
|
|
7193
7203
|
return false;
|
|
7194
7204
|
}
|
|
7195
7205
|
})();
|
|
7196
|
-
(0,
|
|
7206
|
+
(0, import_react38.useEffect)(() => {
|
|
7197
7207
|
if (isLocalStorageAvailable) {
|
|
7198
7208
|
try {
|
|
7199
7209
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -7212,7 +7222,7 @@ function useReceiptCache() {
|
|
|
7212
7222
|
}
|
|
7213
7223
|
}
|
|
7214
7224
|
}, []);
|
|
7215
|
-
const updateLocalStorage = (0,
|
|
7225
|
+
const updateLocalStorage = (0, import_react38.useCallback)((updatedCache) => {
|
|
7216
7226
|
if (isLocalStorageAvailable) {
|
|
7217
7227
|
try {
|
|
7218
7228
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -7229,7 +7239,7 @@ function useReceiptCache() {
|
|
|
7229
7239
|
}
|
|
7230
7240
|
}
|
|
7231
7241
|
}, []);
|
|
7232
|
-
const set = (0,
|
|
7242
|
+
const set = (0, import_react38.useCallback)((key, value) => {
|
|
7233
7243
|
const now = Date.now();
|
|
7234
7244
|
const newCache = new Map(cache);
|
|
7235
7245
|
newCache.forEach((entry, k) => {
|
|
@@ -7247,7 +7257,7 @@ function useReceiptCache() {
|
|
|
7247
7257
|
setCache(newCache);
|
|
7248
7258
|
updateLocalStorage(newCache);
|
|
7249
7259
|
}, [cache, updateLocalStorage]);
|
|
7250
|
-
const get = (0,
|
|
7260
|
+
const get = (0, import_react38.useCallback)((key) => {
|
|
7251
7261
|
const entry = cache.get(key);
|
|
7252
7262
|
if (entry) {
|
|
7253
7263
|
if (Date.now() - entry.timestamp > CACHE_TTL) {
|
|
@@ -7261,7 +7271,7 @@ function useReceiptCache() {
|
|
|
7261
7271
|
}
|
|
7262
7272
|
return void 0;
|
|
7263
7273
|
}, [cache, updateLocalStorage]);
|
|
7264
|
-
const del = (0,
|
|
7274
|
+
const del = (0, import_react38.useCallback)((key) => {
|
|
7265
7275
|
if (cache.has(key)) {
|
|
7266
7276
|
const newCache = new Map(cache);
|
|
7267
7277
|
newCache.delete(key);
|
|
@@ -7269,7 +7279,7 @@ function useReceiptCache() {
|
|
|
7269
7279
|
updateLocalStorage(newCache);
|
|
7270
7280
|
}
|
|
7271
7281
|
}, [cache, updateLocalStorage]);
|
|
7272
|
-
const clear = (0,
|
|
7282
|
+
const clear = (0, import_react38.useCallback)(() => {
|
|
7273
7283
|
setCache(/* @__PURE__ */ new Map());
|
|
7274
7284
|
if (isLocalStorageAvailable) {
|
|
7275
7285
|
localStorage.removeItem(STORAGE_KEY);
|
|
@@ -7284,7 +7294,7 @@ function useReceipt2({
|
|
|
7284
7294
|
const { list } = useMatchChain();
|
|
7285
7295
|
const cache = useReceiptCache();
|
|
7286
7296
|
const chain = list?.find((item) => item.id === chainId);
|
|
7287
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
7297
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react38.useState)(true);
|
|
7288
7298
|
const query = (0, import_react_query7.useQuery)({
|
|
7289
7299
|
queryKey: ["match-tx-receipt", hash, chain],
|
|
7290
7300
|
queryFn: async () => {
|
|
@@ -7310,7 +7320,7 @@ function useReceipt2({
|
|
|
7310
7320
|
},
|
|
7311
7321
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
7312
7322
|
});
|
|
7313
|
-
(0,
|
|
7323
|
+
(0, import_react38.useEffect)(() => {
|
|
7314
7324
|
if (query.data) {
|
|
7315
7325
|
setShouldRefetch(false);
|
|
7316
7326
|
}
|
|
@@ -7319,14 +7329,14 @@ function useReceipt2({
|
|
|
7319
7329
|
}
|
|
7320
7330
|
|
|
7321
7331
|
// src/hooks/useTransaction.tsx
|
|
7322
|
-
var
|
|
7332
|
+
var import_react39 = require("react");
|
|
7323
7333
|
var import_react_query8 = require("@tanstack/react-query");
|
|
7324
7334
|
var import_viem15 = require("viem");
|
|
7325
7335
|
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
7326
7336
|
var MAX_CACHE_SIZE2 = 500;
|
|
7327
7337
|
var STORAGE_KEY2 = "match_transaction_logs";
|
|
7328
7338
|
function useTransactionCache() {
|
|
7329
|
-
const [cache, setCache] = (0,
|
|
7339
|
+
const [cache, setCache] = (0, import_react39.useState)(/* @__PURE__ */ new Map());
|
|
7330
7340
|
const isLocalStorageAvailable = (() => {
|
|
7331
7341
|
try {
|
|
7332
7342
|
const testKey = "__test__";
|
|
@@ -7337,7 +7347,7 @@ function useTransactionCache() {
|
|
|
7337
7347
|
return false;
|
|
7338
7348
|
}
|
|
7339
7349
|
})();
|
|
7340
|
-
(0,
|
|
7350
|
+
(0, import_react39.useEffect)(() => {
|
|
7341
7351
|
if (isLocalStorageAvailable) {
|
|
7342
7352
|
try {
|
|
7343
7353
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -7356,7 +7366,7 @@ function useTransactionCache() {
|
|
|
7356
7366
|
}
|
|
7357
7367
|
}
|
|
7358
7368
|
}, []);
|
|
7359
|
-
const updateLocalStorage = (0,
|
|
7369
|
+
const updateLocalStorage = (0, import_react39.useCallback)((updatedCache) => {
|
|
7360
7370
|
if (isLocalStorageAvailable) {
|
|
7361
7371
|
try {
|
|
7362
7372
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -7373,7 +7383,7 @@ function useTransactionCache() {
|
|
|
7373
7383
|
}
|
|
7374
7384
|
}
|
|
7375
7385
|
}, []);
|
|
7376
|
-
const set = (0,
|
|
7386
|
+
const set = (0, import_react39.useCallback)((key, value) => {
|
|
7377
7387
|
const now = Date.now();
|
|
7378
7388
|
const newCache = new Map(cache);
|
|
7379
7389
|
newCache.forEach((entry, k) => {
|
|
@@ -7391,7 +7401,7 @@ function useTransactionCache() {
|
|
|
7391
7401
|
setCache(newCache);
|
|
7392
7402
|
updateLocalStorage(newCache);
|
|
7393
7403
|
}, [cache, updateLocalStorage]);
|
|
7394
|
-
const get = (0,
|
|
7404
|
+
const get = (0, import_react39.useCallback)((key) => {
|
|
7395
7405
|
const entry = cache.get(key);
|
|
7396
7406
|
if (entry) {
|
|
7397
7407
|
if (Date.now() - entry.timestamp > CACHE_TTL2) {
|
|
@@ -7405,7 +7415,7 @@ function useTransactionCache() {
|
|
|
7405
7415
|
}
|
|
7406
7416
|
return void 0;
|
|
7407
7417
|
}, [cache, updateLocalStorage]);
|
|
7408
|
-
const del = (0,
|
|
7418
|
+
const del = (0, import_react39.useCallback)((key) => {
|
|
7409
7419
|
if (cache.has(key)) {
|
|
7410
7420
|
const newCache = new Map(cache);
|
|
7411
7421
|
newCache.delete(key);
|
|
@@ -7413,7 +7423,7 @@ function useTransactionCache() {
|
|
|
7413
7423
|
updateLocalStorage(newCache);
|
|
7414
7424
|
}
|
|
7415
7425
|
}, [cache, updateLocalStorage]);
|
|
7416
|
-
const clear = (0,
|
|
7426
|
+
const clear = (0, import_react39.useCallback)(() => {
|
|
7417
7427
|
setCache(/* @__PURE__ */ new Map());
|
|
7418
7428
|
if (isLocalStorageAvailable) {
|
|
7419
7429
|
localStorage.removeItem(STORAGE_KEY2);
|
|
@@ -7428,7 +7438,7 @@ function useTransaction({
|
|
|
7428
7438
|
const { list } = useMatchChain();
|
|
7429
7439
|
const cache = useTransactionCache();
|
|
7430
7440
|
const chain = list?.find((item) => item.id === chainId);
|
|
7431
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
7441
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react39.useState)(true);
|
|
7432
7442
|
const query = (0, import_react_query8.useQuery)({
|
|
7433
7443
|
queryKey: ["match-tx-transaction", hash, chain],
|
|
7434
7444
|
queryFn: async () => {
|
|
@@ -7454,7 +7464,7 @@ function useTransaction({
|
|
|
7454
7464
|
},
|
|
7455
7465
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
7456
7466
|
});
|
|
7457
|
-
(0,
|
|
7467
|
+
(0, import_react39.useEffect)(() => {
|
|
7458
7468
|
if (query.data) {
|
|
7459
7469
|
setShouldRefetch(false);
|
|
7460
7470
|
}
|
|
@@ -7463,7 +7473,7 @@ function useTransaction({
|
|
|
7463
7473
|
}
|
|
7464
7474
|
|
|
7465
7475
|
// src/components/CEXBindModal/index.tsx
|
|
7466
|
-
var
|
|
7476
|
+
var import_react40 = require("react");
|
|
7467
7477
|
var import_react_intl22 = require("react-intl");
|
|
7468
7478
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
7469
7479
|
function CEXBindModal({
|
|
@@ -7474,16 +7484,16 @@ function CEXBindModal({
|
|
|
7474
7484
|
}) {
|
|
7475
7485
|
const intl = (0, import_react_intl22.useIntl)();
|
|
7476
7486
|
const { events } = useMatch();
|
|
7477
|
-
const [APIPassphrase, setAPIPassphrase] = (0,
|
|
7487
|
+
const [APIPassphrase, setAPIPassphrase] = (0, import_react40.useState)("");
|
|
7478
7488
|
const { refreshOverview } = useUserInfo();
|
|
7479
|
-
const [loading, setLoading] = (0,
|
|
7480
|
-
const [key, setKey] = (0,
|
|
7481
|
-
const [secret, setSecret] = (0,
|
|
7482
|
-
const [error, setError] = (0,
|
|
7483
|
-
const needPassphrase = (0,
|
|
7489
|
+
const [loading, setLoading] = (0, import_react40.useState)(false);
|
|
7490
|
+
const [key, setKey] = (0, import_react40.useState)("");
|
|
7491
|
+
const [secret, setSecret] = (0, import_react40.useState)("");
|
|
7492
|
+
const [error, setError] = (0, import_react40.useState)("");
|
|
7493
|
+
const needPassphrase = (0, import_react40.useMemo)(() => {
|
|
7484
7494
|
return ["bitget", "okx"].includes(type.toLowerCase());
|
|
7485
7495
|
}, [type]);
|
|
7486
|
-
(0,
|
|
7496
|
+
(0, import_react40.useEffect)(() => {
|
|
7487
7497
|
if (isOpen) {
|
|
7488
7498
|
setSecret("");
|
|
7489
7499
|
setKey("");
|
|
@@ -7683,7 +7693,7 @@ var Providers = ({ children }) => {
|
|
|
7683
7693
|
var context_default = Providers;
|
|
7684
7694
|
|
|
7685
7695
|
// src/hooks/useWalletInit.ts
|
|
7686
|
-
var
|
|
7696
|
+
var import_react41 = require("react");
|
|
7687
7697
|
|
|
7688
7698
|
// src/utils/wallet.ts
|
|
7689
7699
|
var sendMessage = ({ method, data, resolve, reject, timeout }) => {
|
|
@@ -7716,11 +7726,11 @@ function useWalletInit({
|
|
|
7716
7726
|
}) {
|
|
7717
7727
|
const { endpoints, token, setWallet, appid, refreshOverview } = useLocalStore_default();
|
|
7718
7728
|
const { setWalletReady, walletReady } = useStore_default();
|
|
7719
|
-
const iframeReadyRef = (0,
|
|
7720
|
-
(0,
|
|
7729
|
+
const iframeReadyRef = (0, import_react41.useRef)(walletReady);
|
|
7730
|
+
(0, import_react41.useEffect)(() => {
|
|
7721
7731
|
setWallet(config);
|
|
7722
7732
|
}, [config]);
|
|
7723
|
-
(0,
|
|
7733
|
+
(0, import_react41.useEffect)(() => {
|
|
7724
7734
|
matchlog_default.log("sdk.mpc.status", walletReady, iframeReadyRef.current);
|
|
7725
7735
|
iframeReadyRef.current = walletReady;
|
|
7726
7736
|
if (iframeReadyRef.current) {
|
|
@@ -7737,7 +7747,7 @@ function useWalletInit({
|
|
|
7737
7747
|
onReady();
|
|
7738
7748
|
}
|
|
7739
7749
|
}, [walletReady]);
|
|
7740
|
-
(0,
|
|
7750
|
+
(0, import_react41.useEffect)(() => {
|
|
7741
7751
|
if (!endpoints.auth || !appid || !token || !config) {
|
|
7742
7752
|
const existingIframe = getWalletIframe();
|
|
7743
7753
|
if (existingIframe) {
|
|
@@ -7837,7 +7847,7 @@ function useWalletInit({
|
|
|
7837
7847
|
}
|
|
7838
7848
|
}
|
|
7839
7849
|
}, [endpoints.auth, appid, token, config]);
|
|
7840
|
-
(0,
|
|
7850
|
+
(0, import_react41.useEffect)(() => {
|
|
7841
7851
|
const messageHandle = async (e) => {
|
|
7842
7852
|
if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
|
|
7843
7853
|
return;
|
|
@@ -7918,7 +7928,7 @@ function useWalletInit({
|
|
|
7918
7928
|
}
|
|
7919
7929
|
|
|
7920
7930
|
// src/hooks/useInit.tsx
|
|
7921
|
-
var
|
|
7931
|
+
var import_react42 = require("react");
|
|
7922
7932
|
function useInit({
|
|
7923
7933
|
theme,
|
|
7924
7934
|
appid,
|
|
@@ -7938,24 +7948,24 @@ function useInit({
|
|
|
7938
7948
|
locale: realLocale
|
|
7939
7949
|
} = useLocalStore_default();
|
|
7940
7950
|
const walletModalStore = useWalletModalStore();
|
|
7941
|
-
const overviewLoadingRef = (0,
|
|
7951
|
+
const overviewLoadingRef = (0, import_react42.useRef)(false);
|
|
7942
7952
|
const searchParams = new URLSearchParams(window.location.search);
|
|
7943
7953
|
const matchToken = searchParams.get("matchToken");
|
|
7944
7954
|
const matchidt = searchParams.get("matchidt");
|
|
7945
7955
|
const realEndpoints = endpoints || env_default.endpoints;
|
|
7946
|
-
(0,
|
|
7956
|
+
(0, import_react42.useEffect)(() => {
|
|
7947
7957
|
setTheme(theme);
|
|
7948
7958
|
}, [theme]);
|
|
7949
|
-
(0,
|
|
7959
|
+
(0, import_react42.useEffect)(() => {
|
|
7950
7960
|
setAppid(appid);
|
|
7951
7961
|
}, [appid]);
|
|
7952
|
-
(0,
|
|
7962
|
+
(0, import_react42.useEffect)(() => {
|
|
7953
7963
|
setEndpoints(realEndpoints);
|
|
7954
7964
|
}, [realEndpoints]);
|
|
7955
|
-
(0,
|
|
7965
|
+
(0, import_react42.useEffect)(() => {
|
|
7956
7966
|
setLocale(locale || "en");
|
|
7957
7967
|
}, [locale]);
|
|
7958
|
-
(0,
|
|
7968
|
+
(0, import_react42.useEffect)(() => {
|
|
7959
7969
|
if (matchToken) {
|
|
7960
7970
|
const tokenData = JSON.parse(atob(matchToken));
|
|
7961
7971
|
if (tokenData && tokenData.mid && tokenData.token) {
|
|
@@ -7966,7 +7976,7 @@ function useInit({
|
|
|
7966
7976
|
}
|
|
7967
7977
|
}
|
|
7968
7978
|
}, [matchToken]);
|
|
7969
|
-
(0,
|
|
7979
|
+
(0, import_react42.useEffect)(() => {
|
|
7970
7980
|
if (matchidt) {
|
|
7971
7981
|
const tokenData = decodeURIComponent(matchidt);
|
|
7972
7982
|
const data = JSON.parse(decodeBase64(tokenData));
|
|
@@ -7996,7 +8006,7 @@ function useInit({
|
|
|
7996
8006
|
}
|
|
7997
8007
|
}
|
|
7998
8008
|
}, [matchidt]);
|
|
7999
|
-
(0,
|
|
8009
|
+
(0, import_react42.useEffect)(() => {
|
|
8000
8010
|
const onLoginMessage = (event) => {
|
|
8001
8011
|
const res = event.data;
|
|
8002
8012
|
if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
|
|
@@ -8033,7 +8043,7 @@ function useInit({
|
|
|
8033
8043
|
overviewLoadingRef.current = false;
|
|
8034
8044
|
}
|
|
8035
8045
|
};
|
|
8036
|
-
(0,
|
|
8046
|
+
(0, import_react42.useEffect)(() => {
|
|
8037
8047
|
if (token) {
|
|
8038
8048
|
loadOverview();
|
|
8039
8049
|
}
|
|
@@ -8959,7 +8969,7 @@ var wagmiConfig = (0, import_rainbowkit2.getDefaultConfig)({
|
|
|
8959
8969
|
],
|
|
8960
8970
|
chains: [import_chains.mainnet, import_chains.polygon, import_chains.optimism, import_chains.arbitrum, import_chains.base, matchMain, matchTest, import_chains.bsc]
|
|
8961
8971
|
});
|
|
8962
|
-
var MatchContext = (0,
|
|
8972
|
+
var MatchContext = (0, import_react43.createContext)(void 0);
|
|
8963
8973
|
var MatchProvider = ({
|
|
8964
8974
|
children,
|
|
8965
8975
|
appid,
|
|
@@ -8995,7 +9005,7 @@ var MatchProvider = ({
|
|
|
8995
9005
|
) }) }) }) });
|
|
8996
9006
|
};
|
|
8997
9007
|
var useMatch = () => {
|
|
8998
|
-
const context = (0,
|
|
9008
|
+
const context = (0, import_react43.useContext)(MatchContext);
|
|
8999
9009
|
if (context === void 0) {
|
|
9000
9010
|
throw new Error("useMatch must be used within a MatchProvider");
|
|
9001
9011
|
}
|