@matchain/matchid-sdk-react 0.1.53-alpha.1 → 0.1.53-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icon/index.d.mts +1 -1
- package/dist/assets/icon/index.d.ts +1 -1
- package/dist/{chunk-6QTW3KXN.mjs → chunk-4A2YPGO3.mjs} +2 -2
- package/dist/{chunk-HLUFAIFV.mjs → chunk-MX7N57AH.mjs} +1 -1
- package/dist/{chunk-HLUFAIFV.mjs.map → chunk-MX7N57AH.mjs.map} +1 -1
- package/dist/{chunk-2DVC6WCN.mjs → chunk-W5A6WY7Y.mjs} +228 -415
- package/dist/chunk-W5A6WY7Y.mjs.map +1 -0
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +222 -394
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -4
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +74 -121
- 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 +252 -312
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/{index-DMUZQqNB.d.ts → index-B8cUP7cH.d.ts} +2 -2
- package/dist/{index-Bmir-Wor.d.mts → index-BCGJczpk.d.mts} +1 -1
- package/dist/{index-B-QfwtE5.d.mts → index-BS-NO8Y2.d.ts} +3 -3
- package/dist/{index-X_fw5wX_.d.ts → index-Bil_db2f.d.mts} +3 -3
- package/dist/{index-BUj9mOrS.d.ts → index-BsL6zo6a.d.ts} +1 -1
- package/dist/{index-CDqIk5k2.d.mts → index-CZqdmQu1.d.mts} +1 -1
- package/dist/{index-BDoEk1EK.d.ts → index-DNJuiNdz.d.mts} +4 -11
- package/dist/{index-XzSw1Bym.d.mts → index-Df-WlkXq.d.ts} +4 -11
- package/dist/{index-k2Uf0F94.d.ts → index-IwwXQ_QV.d.ts} +1 -1
- package/dist/{index-DvM6x6e6.d.ts → index-K5vXmiRX.d.ts} +1 -1
- package/dist/{index-B_o9HBS1.d.mts → index-iWHaT8HV.d.mts} +1 -1
- package/dist/{index-D5OzNRfu.d.mts → index-yy3VTdFU.d.mts} +2 -2
- package/dist/index.d.mts +7 -8
- package/dist/index.d.ts +7 -8
- package/dist/index.js +388 -537
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/{types-Dd_ExpLx.d.mts → types-CZbR7ERa.d.mts} +0 -1
- package/dist/{types-Dd_ExpLx.d.ts → types-CZbR7ERa.d.ts} +0 -1
- package/dist/ui/index.d.mts +3 -3
- package/dist/ui/index.d.ts +3 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +1 -1
- package/package.json +1 -5
- package/dist/chunk-2DVC6WCN.mjs.map +0 -1
- /package/dist/{chunk-6QTW3KXN.mjs.map → chunk-4A2YPGO3.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ __export(src_exports, {
|
|
|
44
44
|
module.exports = __toCommonJS(src_exports);
|
|
45
45
|
|
|
46
46
|
// src/MatchContext.tsx
|
|
47
|
-
var
|
|
47
|
+
var import_react39 = require("react");
|
|
48
48
|
|
|
49
49
|
// src/hooks/index.tsx
|
|
50
50
|
var hooks_exports = {};
|
|
@@ -574,6 +574,9 @@ var getVersion = () => {
|
|
|
574
574
|
function encodeBase64(input) {
|
|
575
575
|
return btoa(unescape(encodeURIComponent(input)));
|
|
576
576
|
}
|
|
577
|
+
function decodeBase64(input) {
|
|
578
|
+
return decodeURIComponent(escape(atob(input)));
|
|
579
|
+
}
|
|
577
580
|
var isValidEmail = (email) => {
|
|
578
581
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
579
582
|
};
|
|
@@ -1887,12 +1890,6 @@ function useWalletConfig() {
|
|
|
1887
1890
|
}
|
|
1888
1891
|
|
|
1889
1892
|
// src/store/useModalStore.ts
|
|
1890
|
-
var useSOLModalStore = (0, import_zustand2.create)((set) => ({
|
|
1891
|
-
isOpen: false,
|
|
1892
|
-
type: "",
|
|
1893
|
-
open: (type) => set({ isOpen: true, type }),
|
|
1894
|
-
close: () => set({ isOpen: false })
|
|
1895
|
-
}));
|
|
1896
1893
|
var useTRONModalStore = (0, import_zustand2.create)((set) => ({
|
|
1897
1894
|
isOpen: false,
|
|
1898
1895
|
type: "",
|
|
@@ -1953,13 +1950,16 @@ function useUserInfo() {
|
|
|
1953
1950
|
refreshOverview
|
|
1954
1951
|
} = useLocalStore_default();
|
|
1955
1952
|
const { setTgAppAuthCode, emailLoginKey, setEmailLoginKey } = useStore_default();
|
|
1953
|
+
const isDownMd = useDownMd();
|
|
1956
1954
|
const { events, login } = useMatch();
|
|
1957
|
-
const { open: SOLOpen } = useSOLModalStore();
|
|
1958
1955
|
const { open: TRONOpen } = useTRONModalStore();
|
|
1959
1956
|
const { open: TONOpen } = useTONModalStore();
|
|
1960
1957
|
const { open: BTCOpen } = useBTCModalStore();
|
|
1961
1958
|
const { open: CEXBindOpen } = useCEXBindModalStore();
|
|
1962
1959
|
const walletModalStore = useWalletModalStore();
|
|
1960
|
+
const getRedirectUri = () => {
|
|
1961
|
+
return encodeURIComponent(window.location.href);
|
|
1962
|
+
};
|
|
1963
1963
|
const isLogin = (0, import_react2.useMemo)(() => !!token && !!overview, [token, overview]);
|
|
1964
1964
|
const logout = async () => {
|
|
1965
1965
|
try {
|
|
@@ -2030,6 +2030,9 @@ function useUserInfo() {
|
|
|
2030
2030
|
case "evm":
|
|
2031
2031
|
return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`);
|
|
2032
2032
|
case "sol":
|
|
2033
|
+
if (isDownMd) {
|
|
2034
|
+
return window.location.href = `${endpoints.auth}login/sol?appid=${appid}&locale=${locale}&redirect_uri=${getRedirectUri()}`;
|
|
2035
|
+
}
|
|
2033
2036
|
return window.open(`${endpoints.auth}login/sol?appid=${appid}&locale=${locale}`);
|
|
2034
2037
|
case "tron":
|
|
2035
2038
|
return TRONOpen("login");
|
|
@@ -2072,7 +2075,7 @@ function useUserInfo() {
|
|
|
2072
2075
|
const res = await verifyEmailCodeApi(obj);
|
|
2073
2076
|
if (res && res.data && isSuccess(res)) {
|
|
2074
2077
|
await login({
|
|
2075
|
-
mid: res.data.mid,
|
|
2078
|
+
// mid: res.data.mid,
|
|
2076
2079
|
token: `${res.data.token_type} ${res.data.access_token}`
|
|
2077
2080
|
});
|
|
2078
2081
|
return true;
|
|
@@ -2119,7 +2122,10 @@ function useUserInfo() {
|
|
|
2119
2122
|
case "evm":
|
|
2120
2123
|
return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)));
|
|
2121
2124
|
case "sol":
|
|
2122
|
-
|
|
2125
|
+
if (isDownMd) {
|
|
2126
|
+
return window.location.href = `${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}&redirect_uri=${getRedirectUri()}`;
|
|
2127
|
+
}
|
|
2128
|
+
return window.open(`${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}`);
|
|
2123
2129
|
case "tron":
|
|
2124
2130
|
return TRONOpen("bind");
|
|
2125
2131
|
case "ton":
|
|
@@ -3359,7 +3365,6 @@ __export(components_exports, {
|
|
|
3359
3365
|
ModalWithHeader: () => ModalWithHeader,
|
|
3360
3366
|
Overlay: () => Overlay,
|
|
3361
3367
|
Popover: () => Popover,
|
|
3362
|
-
SOLModal: () => SOLModal,
|
|
3363
3368
|
TONModal: () => TONModal,
|
|
3364
3369
|
TRONModal: () => TRONModal,
|
|
3365
3370
|
TokenDetail: () => TokenDetail,
|
|
@@ -4119,23 +4124,8 @@ function UsernameModal({
|
|
|
4119
4124
|
] }) });
|
|
4120
4125
|
}
|
|
4121
4126
|
|
|
4122
|
-
// src/components/
|
|
4123
|
-
var
|
|
4124
|
-
var import_web3 = require("@solana/web3.js");
|
|
4125
|
-
var import_wallet_adapter_react = require("@solana/wallet-adapter-react");
|
|
4126
|
-
var import_wallet_adapter_react_ui = require("@solana/wallet-adapter-react-ui");
|
|
4127
|
-
|
|
4128
|
-
// node_modules/@solana/wallet-adapter-base/lib/esm/types.js
|
|
4129
|
-
var WalletAdapterNetwork;
|
|
4130
|
-
(function(WalletAdapterNetwork2) {
|
|
4131
|
-
WalletAdapterNetwork2["Mainnet"] = "mainnet-beta";
|
|
4132
|
-
WalletAdapterNetwork2["Testnet"] = "testnet";
|
|
4133
|
-
WalletAdapterNetwork2["Devnet"] = "devnet";
|
|
4134
|
-
})(WalletAdapterNetwork || (WalletAdapterNetwork = {}));
|
|
4135
|
-
|
|
4136
|
-
// src/components/SOLModal/index.tsx
|
|
4137
|
-
var import_wallet_adapter_wallets = require("@solana/wallet-adapter-wallets");
|
|
4138
|
-
var import_styles = require("@solana/wallet-adapter-react-ui/styles.css");
|
|
4127
|
+
// src/components/TRONModal/index.tsx
|
|
4128
|
+
var import_react23 = __toESM(require("react"));
|
|
4139
4129
|
var import_react_intl10 = require("react-intl");
|
|
4140
4130
|
|
|
4141
4131
|
// src/components/WalletModalContent/index.tsx
|
|
@@ -4238,164 +4228,6 @@ function WalletModalContent({
|
|
|
4238
4228
|
] }) });
|
|
4239
4229
|
}
|
|
4240
4230
|
|
|
4241
|
-
// src/components/SOLModal/index.tsx
|
|
4242
|
-
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
4243
|
-
function WalletContent({
|
|
4244
|
-
onSuccess,
|
|
4245
|
-
type
|
|
4246
|
-
}) {
|
|
4247
|
-
const { setVisible, visible } = (0, import_wallet_adapter_react_ui.useWalletModal)();
|
|
4248
|
-
const wallet = (0, import_wallet_adapter_react.useWallet)();
|
|
4249
|
-
const { events, login } = useMatch();
|
|
4250
|
-
const [status, setStatus] = (0, import_react22.useState)("");
|
|
4251
|
-
const statusRef = import_react22.default.useRef(status);
|
|
4252
|
-
const [error, setError] = (0, import_react22.useState)("");
|
|
4253
|
-
(0, import_react22.useEffect)(() => {
|
|
4254
|
-
const init = async () => {
|
|
4255
|
-
await wallet.disconnect();
|
|
4256
|
-
setVisible(true);
|
|
4257
|
-
};
|
|
4258
|
-
init();
|
|
4259
|
-
}, []);
|
|
4260
|
-
(0, import_react22.useEffect)(() => {
|
|
4261
|
-
if (wallet.connected) {
|
|
4262
|
-
console.log("wallet.connected", wallet.connected);
|
|
4263
|
-
toLoginInWallet();
|
|
4264
|
-
}
|
|
4265
|
-
}, [wallet.connected]);
|
|
4266
|
-
const toLoginInWallet = async () => {
|
|
4267
|
-
if (statusRef.current) return;
|
|
4268
|
-
const address = wallet.publicKey?.toBase58() || "";
|
|
4269
|
-
try {
|
|
4270
|
-
setStatus("nonce");
|
|
4271
|
-
statusRef.current = "nonce";
|
|
4272
|
-
const res = type == "bind" ? await getWalletInitApi({
|
|
4273
|
-
address,
|
|
4274
|
-
type: "SOL"
|
|
4275
|
-
}) : await getWalletNonceApi({ address, type: "SOL" });
|
|
4276
|
-
if (!isSuccess(res)) {
|
|
4277
|
-
throw new Error(res.message);
|
|
4278
|
-
}
|
|
4279
|
-
const nonce = res.code >= 0 ? res.data.nonce : null;
|
|
4280
|
-
if (nonce) {
|
|
4281
|
-
setStatus("signer");
|
|
4282
|
-
statusRef.current = "signer";
|
|
4283
|
-
const message = "By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.Nonce:" + res.data.nonce;
|
|
4284
|
-
const encodedMessage = new TextEncoder().encode(message);
|
|
4285
|
-
const signedMessage = await wallet.signMessage(encodedMessage);
|
|
4286
|
-
let obj = {
|
|
4287
|
-
type: "SOL",
|
|
4288
|
-
address,
|
|
4289
|
-
signature: Buffer.from(signedMessage).toString("base64"),
|
|
4290
|
-
message,
|
|
4291
|
-
connector_type: "SOL",
|
|
4292
|
-
wallet_client_type: wallet.wallet?.adapter.name || ""
|
|
4293
|
-
};
|
|
4294
|
-
const res1 = type == "bind" ? await toBindWalletApi(obj) : await loginByWalletApi(obj);
|
|
4295
|
-
if (res1) {
|
|
4296
|
-
if (!isSuccess(res1)) {
|
|
4297
|
-
throw new Error(res1.message);
|
|
4298
|
-
}
|
|
4299
|
-
matchlog_default.log(res1);
|
|
4300
|
-
setStatus("success");
|
|
4301
|
-
statusRef.current = "success";
|
|
4302
|
-
if (type == "bind") {
|
|
4303
|
-
events.onBind && events.onBind({
|
|
4304
|
-
type: "sol"
|
|
4305
|
-
});
|
|
4306
|
-
eventManager_default.emit("onBind", {
|
|
4307
|
-
type: "sol"
|
|
4308
|
-
});
|
|
4309
|
-
} else {
|
|
4310
|
-
await login({
|
|
4311
|
-
mid: res1.data.mid,
|
|
4312
|
-
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
4313
|
-
});
|
|
4314
|
-
}
|
|
4315
|
-
onSuccess && onSuccess();
|
|
4316
|
-
}
|
|
4317
|
-
}
|
|
4318
|
-
} catch (error2) {
|
|
4319
|
-
setStatus("error");
|
|
4320
|
-
setError(error2.message);
|
|
4321
|
-
statusRef.current = "";
|
|
4322
|
-
}
|
|
4323
|
-
};
|
|
4324
|
-
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
4325
|
-
WalletModalContent,
|
|
4326
|
-
{
|
|
4327
|
-
connected: wallet.connected,
|
|
4328
|
-
disconnect: wallet.disconnect,
|
|
4329
|
-
address: wallet.publicKey?.toBase58(),
|
|
4330
|
-
visible,
|
|
4331
|
-
setVisible,
|
|
4332
|
-
error,
|
|
4333
|
-
setError,
|
|
4334
|
-
status
|
|
4335
|
-
}
|
|
4336
|
-
);
|
|
4337
|
-
}
|
|
4338
|
-
var wallets = [
|
|
4339
|
-
new import_wallet_adapter_wallets.PhantomWalletAdapter(),
|
|
4340
|
-
new import_wallet_adapter_wallets.SolflareWalletAdapter(),
|
|
4341
|
-
new import_wallet_adapter_wallets.WalletConnectWalletAdapter({
|
|
4342
|
-
network: WalletAdapterNetwork.Mainnet,
|
|
4343
|
-
options: {
|
|
4344
|
-
relayUrl: "wss://relay.walletconnect.com"
|
|
4345
|
-
}
|
|
4346
|
-
}),
|
|
4347
|
-
new import_wallet_adapter_wallets.AlphaWalletAdapter(),
|
|
4348
|
-
new import_wallet_adapter_wallets.AvanaWalletAdapter(),
|
|
4349
|
-
new import_wallet_adapter_wallets.BitgetWalletAdapter(),
|
|
4350
|
-
new import_wallet_adapter_wallets.BitpieWalletAdapter(),
|
|
4351
|
-
new import_wallet_adapter_wallets.CloverWalletAdapter(),
|
|
4352
|
-
new import_wallet_adapter_wallets.Coin98WalletAdapter(),
|
|
4353
|
-
new import_wallet_adapter_wallets.CoinbaseWalletAdapter(),
|
|
4354
|
-
new import_wallet_adapter_wallets.CoinhubWalletAdapter(),
|
|
4355
|
-
new import_wallet_adapter_wallets.FractalWalletAdapter(),
|
|
4356
|
-
new import_wallet_adapter_wallets.HuobiWalletAdapter(),
|
|
4357
|
-
new import_wallet_adapter_wallets.HyperPayWalletAdapter(),
|
|
4358
|
-
new import_wallet_adapter_wallets.KeystoneWalletAdapter(),
|
|
4359
|
-
new import_wallet_adapter_wallets.KrystalWalletAdapter(),
|
|
4360
|
-
new import_wallet_adapter_wallets.LedgerWalletAdapter(),
|
|
4361
|
-
new import_wallet_adapter_wallets.MathWalletAdapter(),
|
|
4362
|
-
new import_wallet_adapter_wallets.NekoWalletAdapter(),
|
|
4363
|
-
new import_wallet_adapter_wallets.NightlyWalletAdapter(),
|
|
4364
|
-
new import_wallet_adapter_wallets.NufiWalletAdapter(),
|
|
4365
|
-
new import_wallet_adapter_wallets.OntoWalletAdapter(),
|
|
4366
|
-
new import_wallet_adapter_wallets.ParticleAdapter(),
|
|
4367
|
-
new import_wallet_adapter_wallets.SafePalWalletAdapter(),
|
|
4368
|
-
new import_wallet_adapter_wallets.SaifuWalletAdapter(),
|
|
4369
|
-
new import_wallet_adapter_wallets.SalmonWalletAdapter(),
|
|
4370
|
-
new import_wallet_adapter_wallets.SkyWalletAdapter(),
|
|
4371
|
-
new import_wallet_adapter_wallets.SolongWalletAdapter(),
|
|
4372
|
-
new import_wallet_adapter_wallets.SpotWalletAdapter(),
|
|
4373
|
-
new import_wallet_adapter_wallets.TokenaryWalletAdapter(),
|
|
4374
|
-
new import_wallet_adapter_wallets.TokenPocketWalletAdapter(),
|
|
4375
|
-
new import_wallet_adapter_wallets.TorusWalletAdapter(),
|
|
4376
|
-
new import_wallet_adapter_wallets.TrustWalletAdapter(),
|
|
4377
|
-
new import_wallet_adapter_wallets.XDEFIWalletAdapter()
|
|
4378
|
-
];
|
|
4379
|
-
function SOLConnectModal({
|
|
4380
|
-
type = "login",
|
|
4381
|
-
onSuccess,
|
|
4382
|
-
...props
|
|
4383
|
-
}) {
|
|
4384
|
-
const intl = (0, import_react_intl10.useIntl)();
|
|
4385
|
-
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
4386
|
-
id: type == "bind" ? "bindWith" : "loginWith"
|
|
4387
|
-
}, {
|
|
4388
|
-
name: "SOL"
|
|
4389
|
-
}), children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_wallet_adapter_react.ConnectionProvider, { endpoint: (0, import_web3.clusterApiUrl)("devnet"), children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_wallet_adapter_react.WalletProvider, { wallets, autoConnect: true, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_wallet_adapter_react_ui.WalletModalProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(WalletContent, { onSuccess, type }) }) }) }) });
|
|
4390
|
-
}
|
|
4391
|
-
function SOLModal(props) {
|
|
4392
|
-
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(SOLConnectModal, { ...props });
|
|
4393
|
-
}
|
|
4394
|
-
|
|
4395
|
-
// src/components/TRONModal/index.tsx
|
|
4396
|
-
var import_react24 = __toESM(require("react"));
|
|
4397
|
-
var import_react_intl11 = require("react-intl");
|
|
4398
|
-
|
|
4399
4231
|
// src/lib/tron/TronLinkAdapter.ts
|
|
4400
4232
|
var TronLinkAdapter = class {
|
|
4401
4233
|
constructor() {
|
|
@@ -4427,7 +4259,7 @@ var TronLinkAdapter = class {
|
|
|
4427
4259
|
};
|
|
4428
4260
|
|
|
4429
4261
|
// src/hooks/useTRONWallet.ts
|
|
4430
|
-
var
|
|
4262
|
+
var import_react22 = require("react");
|
|
4431
4263
|
|
|
4432
4264
|
// src/lib/tron/BitgetAdapter.ts
|
|
4433
4265
|
var BitgetAdapter = class {
|
|
@@ -4471,12 +4303,12 @@ var OKXAdapter = class {
|
|
|
4471
4303
|
|
|
4472
4304
|
// src/hooks/useTRONWallet.ts
|
|
4473
4305
|
var useTRONWallet = () => {
|
|
4474
|
-
const
|
|
4475
|
-
const [installedWallets, setInstalledWallets] = (0,
|
|
4476
|
-
const [address, setAddress] = (0,
|
|
4477
|
-
(0,
|
|
4306
|
+
const wallets = [new TronLinkAdapter(), new BitgetAdapter(), new OKXAdapter()];
|
|
4307
|
+
const [installedWallets, setInstalledWallets] = (0, import_react22.useState)([]);
|
|
4308
|
+
const [address, setAddress] = (0, import_react22.useState)(null);
|
|
4309
|
+
(0, import_react22.useEffect)(() => {
|
|
4478
4310
|
const getInstalled = async () => {
|
|
4479
|
-
const installed = await Promise.all(
|
|
4311
|
+
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
4480
4312
|
wallet: wallet2,
|
|
4481
4313
|
isInstalled
|
|
4482
4314
|
}))));
|
|
@@ -4484,18 +4316,18 @@ var useTRONWallet = () => {
|
|
|
4484
4316
|
};
|
|
4485
4317
|
getInstalled();
|
|
4486
4318
|
}, []);
|
|
4487
|
-
const [wallet, chooseWallet] = (0,
|
|
4319
|
+
const [wallet, chooseWallet] = (0, import_react22.useState)(null);
|
|
4488
4320
|
const onConnect = async () => {
|
|
4489
4321
|
setAddress(await wallet.connect());
|
|
4490
4322
|
};
|
|
4491
|
-
(0,
|
|
4323
|
+
(0, import_react22.useEffect)(() => {
|
|
4492
4324
|
if (!wallet) {
|
|
4493
4325
|
setAddress(null);
|
|
4494
4326
|
}
|
|
4495
4327
|
}, [wallet]);
|
|
4496
4328
|
return {
|
|
4497
4329
|
installedWallets,
|
|
4498
|
-
wallets
|
|
4330
|
+
wallets,
|
|
4499
4331
|
chooseWallet,
|
|
4500
4332
|
wallet,
|
|
4501
4333
|
address,
|
|
@@ -4504,25 +4336,25 @@ var useTRONWallet = () => {
|
|
|
4504
4336
|
};
|
|
4505
4337
|
|
|
4506
4338
|
// src/components/TRONModal/index.tsx
|
|
4507
|
-
var
|
|
4339
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
4508
4340
|
function TRONConnectModal({
|
|
4509
4341
|
type = "login",
|
|
4510
4342
|
onSuccess,
|
|
4511
4343
|
...props
|
|
4512
4344
|
}) {
|
|
4513
4345
|
const isDownMd = useDownMd();
|
|
4514
|
-
const intl = (0,
|
|
4515
|
-
const { wallets
|
|
4346
|
+
const intl = (0, import_react_intl10.useIntl)();
|
|
4347
|
+
const { wallets, installedWallets, chooseWallet, wallet, address, onConnect } = useTRONWallet();
|
|
4516
4348
|
const iconMaps = {
|
|
4517
|
-
tronlink: /* @__PURE__ */ (0,
|
|
4518
|
-
bitget: /* @__PURE__ */ (0,
|
|
4519
|
-
okx: /* @__PURE__ */ (0,
|
|
4349
|
+
tronlink: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(TronLinkIcon, { size: isDownMd ? 36 : 40 }),
|
|
4350
|
+
bitget: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(BitgetIcon, { size: isDownMd ? 36 : 40 }),
|
|
4351
|
+
okx: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(OKXIcon, { size: isDownMd ? 36 : 40 })
|
|
4520
4352
|
};
|
|
4521
4353
|
const { events, login } = useMatch();
|
|
4522
|
-
const [status, setStatus] = (0,
|
|
4523
|
-
const statusRef =
|
|
4524
|
-
const [error, setError] = (0,
|
|
4525
|
-
const connected = (0,
|
|
4354
|
+
const [status, setStatus] = (0, import_react23.useState)("");
|
|
4355
|
+
const statusRef = import_react23.default.useRef(status);
|
|
4356
|
+
const [error, setError] = (0, import_react23.useState)("");
|
|
4357
|
+
const connected = (0, import_react23.useMemo)(() => {
|
|
4526
4358
|
return !!address;
|
|
4527
4359
|
}, [address]);
|
|
4528
4360
|
const disconnect = async () => {
|
|
@@ -4577,7 +4409,7 @@ function TRONConnectModal({
|
|
|
4577
4409
|
});
|
|
4578
4410
|
} else {
|
|
4579
4411
|
await login({
|
|
4580
|
-
mid: res1.data.mid,
|
|
4412
|
+
// mid: res1.data.mid,
|
|
4581
4413
|
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
4582
4414
|
});
|
|
4583
4415
|
}
|
|
@@ -4590,7 +4422,7 @@ function TRONConnectModal({
|
|
|
4590
4422
|
statusRef.current = "";
|
|
4591
4423
|
}
|
|
4592
4424
|
};
|
|
4593
|
-
(0,
|
|
4425
|
+
(0, import_react23.useEffect)(() => {
|
|
4594
4426
|
if (wallet) {
|
|
4595
4427
|
console.log("onConnect");
|
|
4596
4428
|
onConnect();
|
|
@@ -4598,21 +4430,21 @@ function TRONConnectModal({
|
|
|
4598
4430
|
setStatus("");
|
|
4599
4431
|
}
|
|
4600
4432
|
}, [wallet]);
|
|
4601
|
-
(0,
|
|
4433
|
+
(0, import_react23.useEffect)(() => {
|
|
4602
4434
|
if (address) {
|
|
4603
4435
|
toLoginInWallet();
|
|
4604
4436
|
}
|
|
4605
4437
|
}, [address]);
|
|
4606
|
-
(0,
|
|
4438
|
+
(0, import_react23.useEffect)(() => {
|
|
4607
4439
|
if (!props.isOpen) {
|
|
4608
4440
|
disconnect();
|
|
4609
4441
|
}
|
|
4610
4442
|
}, [props.isOpen]);
|
|
4611
|
-
return /* @__PURE__ */ (0,
|
|
4443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
4612
4444
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
4613
4445
|
}, {
|
|
4614
4446
|
name: "TRON"
|
|
4615
|
-
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0,
|
|
4447
|
+
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
4616
4448
|
WalletModalContent,
|
|
4617
4449
|
{
|
|
4618
4450
|
error,
|
|
@@ -4625,9 +4457,9 @@ function TRONConnectModal({
|
|
|
4625
4457
|
setVisible: () => {
|
|
4626
4458
|
}
|
|
4627
4459
|
}
|
|
4628
|
-
) : /* @__PURE__ */ (0,
|
|
4460
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "matchid-login-box", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "matchid-login-recommend-list", children: [
|
|
4629
4461
|
installedWallets.map((wallet2) => {
|
|
4630
|
-
return /* @__PURE__ */ (0,
|
|
4462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
4631
4463
|
RecommendItem,
|
|
4632
4464
|
{
|
|
4633
4465
|
icon: iconMaps[wallet2.walletKey],
|
|
@@ -4639,15 +4471,15 @@ function TRONConnectModal({
|
|
|
4639
4471
|
wallet2.walletKey
|
|
4640
4472
|
);
|
|
4641
4473
|
}),
|
|
4642
|
-
|
|
4643
|
-
return /* @__PURE__ */ (0,
|
|
4474
|
+
wallets.filter((wallet2) => !installedWallets.find((installedWallet) => installedWallet.walletKey == wallet2.walletKey)).map((wallet2) => {
|
|
4475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
4644
4476
|
RecommendItem,
|
|
4645
4477
|
{
|
|
4646
4478
|
icon: iconMaps[wallet2.walletKey],
|
|
4647
4479
|
name: wallet2.name,
|
|
4648
4480
|
onClick: () => {
|
|
4649
4481
|
},
|
|
4650
|
-
footer: /* @__PURE__ */ (0,
|
|
4482
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Button, { size: "sm", onClick: () => {
|
|
4651
4483
|
window.open(wallet2.website);
|
|
4652
4484
|
}, children: "Install" })
|
|
4653
4485
|
},
|
|
@@ -4657,28 +4489,28 @@ function TRONConnectModal({
|
|
|
4657
4489
|
] }) }) });
|
|
4658
4490
|
}
|
|
4659
4491
|
function TRONModal(props) {
|
|
4660
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
4492
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(TRONConnectModal, { ...props, type: props.type });
|
|
4661
4493
|
}
|
|
4662
4494
|
|
|
4663
4495
|
// src/components/TONModal/index.tsx
|
|
4664
|
-
var
|
|
4665
|
-
var
|
|
4496
|
+
var import_react24 = __toESM(require("react"));
|
|
4497
|
+
var import_react_intl11 = require("react-intl");
|
|
4666
4498
|
var import_ui_react = require("@tonconnect/ui-react");
|
|
4667
|
-
var
|
|
4668
|
-
function
|
|
4499
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
4500
|
+
function WalletContent({
|
|
4669
4501
|
onSuccess,
|
|
4670
4502
|
type
|
|
4671
4503
|
}) {
|
|
4672
4504
|
const { events, login } = useMatch();
|
|
4673
|
-
const [connected, setConnected] = (0,
|
|
4505
|
+
const [connected, setConnected] = (0, import_react24.useState)(false);
|
|
4674
4506
|
const wallet = (0, import_ui_react.useTonWallet)();
|
|
4675
4507
|
const userFriendlyAddress = (0, import_ui_react.useTonAddress)();
|
|
4676
4508
|
const [tonConnectUI] = (0, import_ui_react.useTonConnectUI)();
|
|
4677
4509
|
const { state, open, close } = (0, import_ui_react.useTonConnectModal)();
|
|
4678
|
-
const [status, setStatus] = (0,
|
|
4679
|
-
const statusRef =
|
|
4680
|
-
const [error, setError] = (0,
|
|
4681
|
-
(0,
|
|
4510
|
+
const [status, setStatus] = (0, import_react24.useState)("");
|
|
4511
|
+
const statusRef = import_react24.default.useRef(status);
|
|
4512
|
+
const [error, setError] = (0, import_react24.useState)("");
|
|
4513
|
+
(0, import_react24.useEffect)(() => {
|
|
4682
4514
|
const init = async () => {
|
|
4683
4515
|
if (tonConnectUI.connected) {
|
|
4684
4516
|
await tonConnectUI.disconnect();
|
|
@@ -4735,7 +4567,7 @@ function WalletContent2({
|
|
|
4735
4567
|
});
|
|
4736
4568
|
} else {
|
|
4737
4569
|
await login({
|
|
4738
|
-
mid: res1.data.mid,
|
|
4570
|
+
// mid: res1.data.mid,
|
|
4739
4571
|
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
4740
4572
|
});
|
|
4741
4573
|
}
|
|
@@ -4751,7 +4583,7 @@ function WalletContent2({
|
|
|
4751
4583
|
}
|
|
4752
4584
|
});
|
|
4753
4585
|
}, []);
|
|
4754
|
-
(0,
|
|
4586
|
+
(0, import_react24.useEffect)(() => {
|
|
4755
4587
|
if (wallet) {
|
|
4756
4588
|
setConnected(true);
|
|
4757
4589
|
console.log("Wallet connected:", wallet);
|
|
@@ -4762,7 +4594,7 @@ function WalletContent2({
|
|
|
4762
4594
|
setStatus("");
|
|
4763
4595
|
}
|
|
4764
4596
|
}, [wallet]);
|
|
4765
|
-
(0,
|
|
4597
|
+
(0, import_react24.useEffect)(() => {
|
|
4766
4598
|
console.log({
|
|
4767
4599
|
state,
|
|
4768
4600
|
wallet
|
|
@@ -4791,7 +4623,7 @@ function WalletContent2({
|
|
|
4791
4623
|
}
|
|
4792
4624
|
}
|
|
4793
4625
|
}, [state]);
|
|
4794
|
-
return /* @__PURE__ */ (0,
|
|
4626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
4795
4627
|
WalletModalContent,
|
|
4796
4628
|
{
|
|
4797
4629
|
connected,
|
|
@@ -4822,28 +4654,28 @@ function TONConnectModal({
|
|
|
4822
4654
|
onSuccess,
|
|
4823
4655
|
...props
|
|
4824
4656
|
}) {
|
|
4825
|
-
const intl = (0,
|
|
4657
|
+
const intl = (0, import_react_intl11.useIntl)();
|
|
4826
4658
|
const { endpoints, appid } = useLocalStore_default();
|
|
4827
4659
|
const manifestUrl = `${endpoints.back}api/v1/wallet/ton?appid=${appid}&url=` + encodeURIComponent(window.location.origin);
|
|
4828
|
-
return /* @__PURE__ */ (0,
|
|
4660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
4829
4661
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
4830
4662
|
}, {
|
|
4831
4663
|
name: "TON"
|
|
4832
|
-
}), children: /* @__PURE__ */ (0,
|
|
4664
|
+
}), children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
4833
4665
|
import_ui_react.TonConnectUIProvider,
|
|
4834
4666
|
{
|
|
4835
4667
|
manifestUrl,
|
|
4836
|
-
children: /* @__PURE__ */ (0,
|
|
4668
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(WalletContent, { onSuccess, type })
|
|
4837
4669
|
}
|
|
4838
4670
|
) });
|
|
4839
4671
|
}
|
|
4840
4672
|
function TONModal(props) {
|
|
4841
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
4673
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(TONConnectModal, { ...props });
|
|
4842
4674
|
}
|
|
4843
4675
|
|
|
4844
4676
|
// src/components/BTCModal/index.tsx
|
|
4845
|
-
var
|
|
4846
|
-
var
|
|
4677
|
+
var import_react26 = __toESM(require("react"));
|
|
4678
|
+
var import_react_intl12 = require("react-intl");
|
|
4847
4679
|
|
|
4848
4680
|
// src/lib/btc/UnisatAdapter.ts
|
|
4849
4681
|
var UnisatAdapter = class {
|
|
@@ -4991,14 +4823,14 @@ var LeatherAdapter = class {
|
|
|
4991
4823
|
};
|
|
4992
4824
|
|
|
4993
4825
|
// src/hooks/useBTCWallet.ts
|
|
4994
|
-
var
|
|
4826
|
+
var import_react25 = require("react");
|
|
4995
4827
|
var useBTCWallet = () => {
|
|
4996
|
-
const
|
|
4997
|
-
const [installedWallets, setInstalledWallets] = (0,
|
|
4998
|
-
const [address, setAddress] = (0,
|
|
4999
|
-
(0,
|
|
4828
|
+
const wallets = [new UnisatAdapter(), new XverseAdapter(), new LeatherAdapter()];
|
|
4829
|
+
const [installedWallets, setInstalledWallets] = (0, import_react25.useState)([]);
|
|
4830
|
+
const [address, setAddress] = (0, import_react25.useState)(null);
|
|
4831
|
+
(0, import_react25.useEffect)(() => {
|
|
5000
4832
|
const getInstalled = async () => {
|
|
5001
|
-
const installed = await Promise.all(
|
|
4833
|
+
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
5002
4834
|
wallet: wallet2,
|
|
5003
4835
|
isInstalled
|
|
5004
4836
|
}))));
|
|
@@ -5006,18 +4838,18 @@ var useBTCWallet = () => {
|
|
|
5006
4838
|
};
|
|
5007
4839
|
getInstalled();
|
|
5008
4840
|
}, []);
|
|
5009
|
-
const [wallet, chooseWallet] = (0,
|
|
4841
|
+
const [wallet, chooseWallet] = (0, import_react25.useState)(null);
|
|
5010
4842
|
const onConnect = async () => {
|
|
5011
4843
|
setAddress(await wallet.connect());
|
|
5012
4844
|
};
|
|
5013
|
-
(0,
|
|
4845
|
+
(0, import_react25.useEffect)(() => {
|
|
5014
4846
|
if (!wallet) {
|
|
5015
4847
|
setAddress(null);
|
|
5016
4848
|
}
|
|
5017
4849
|
}, [wallet]);
|
|
5018
4850
|
return {
|
|
5019
4851
|
installedWallets,
|
|
5020
|
-
wallets
|
|
4852
|
+
wallets,
|
|
5021
4853
|
chooseWallet,
|
|
5022
4854
|
wallet,
|
|
5023
4855
|
address,
|
|
@@ -5026,25 +4858,25 @@ var useBTCWallet = () => {
|
|
|
5026
4858
|
};
|
|
5027
4859
|
|
|
5028
4860
|
// src/components/BTCModal/index.tsx
|
|
5029
|
-
var
|
|
4861
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
5030
4862
|
function BTCConnectModal({
|
|
5031
4863
|
type = "login",
|
|
5032
4864
|
onSuccess,
|
|
5033
4865
|
...props
|
|
5034
4866
|
}) {
|
|
5035
4867
|
const isDownMd = useDownMd();
|
|
5036
|
-
const intl = (0,
|
|
5037
|
-
const { wallets
|
|
4868
|
+
const intl = (0, import_react_intl12.useIntl)();
|
|
4869
|
+
const { wallets, installedWallets, chooseWallet, wallet, address, onConnect } = useBTCWallet();
|
|
5038
4870
|
const iconMaps = {
|
|
5039
|
-
leather: /* @__PURE__ */ (0,
|
|
5040
|
-
unisat: /* @__PURE__ */ (0,
|
|
5041
|
-
xverse: /* @__PURE__ */ (0,
|
|
4871
|
+
leather: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(LeatherIcon, { size: isDownMd ? 36 : 40 }),
|
|
4872
|
+
unisat: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(UnisatIcon, { size: isDownMd ? 36 : 40 }),
|
|
4873
|
+
xverse: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(XverseIcon, { size: isDownMd ? 36 : 40 })
|
|
5042
4874
|
};
|
|
5043
4875
|
const { events, login } = useMatch();
|
|
5044
|
-
const [status, setStatus] = (0,
|
|
5045
|
-
const statusRef =
|
|
5046
|
-
const [error, setError] = (0,
|
|
5047
|
-
const connected = (0,
|
|
4876
|
+
const [status, setStatus] = (0, import_react26.useState)("");
|
|
4877
|
+
const statusRef = import_react26.default.useRef(status);
|
|
4878
|
+
const [error, setError] = (0, import_react26.useState)("");
|
|
4879
|
+
const connected = (0, import_react26.useMemo)(() => {
|
|
5048
4880
|
return !!address;
|
|
5049
4881
|
}, [address]);
|
|
5050
4882
|
const disconnect = async () => {
|
|
@@ -5094,7 +4926,7 @@ function BTCConnectModal({
|
|
|
5094
4926
|
});
|
|
5095
4927
|
} else {
|
|
5096
4928
|
await login({
|
|
5097
|
-
mid: res1.data.mid,
|
|
4929
|
+
// mid: res1.data.mid,
|
|
5098
4930
|
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
5099
4931
|
});
|
|
5100
4932
|
}
|
|
@@ -5108,7 +4940,7 @@ function BTCConnectModal({
|
|
|
5108
4940
|
statusRef.current = "";
|
|
5109
4941
|
}
|
|
5110
4942
|
};
|
|
5111
|
-
(0,
|
|
4943
|
+
(0, import_react26.useEffect)(() => {
|
|
5112
4944
|
if (wallet) {
|
|
5113
4945
|
console.log("onConnect");
|
|
5114
4946
|
try {
|
|
@@ -5121,12 +4953,12 @@ function BTCConnectModal({
|
|
|
5121
4953
|
setStatus("");
|
|
5122
4954
|
}
|
|
5123
4955
|
}, [wallet]);
|
|
5124
|
-
(0,
|
|
4956
|
+
(0, import_react26.useEffect)(() => {
|
|
5125
4957
|
if (address) {
|
|
5126
4958
|
toLoginInWallet();
|
|
5127
4959
|
}
|
|
5128
4960
|
}, [address]);
|
|
5129
|
-
(0,
|
|
4961
|
+
(0, import_react26.useEffect)(() => {
|
|
5130
4962
|
if (!props.isOpen) {
|
|
5131
4963
|
disconnect();
|
|
5132
4964
|
}
|
|
@@ -5138,11 +4970,11 @@ function BTCConnectModal({
|
|
|
5138
4970
|
statusRef.current = "";
|
|
5139
4971
|
setError("");
|
|
5140
4972
|
};
|
|
5141
|
-
return /* @__PURE__ */ (0,
|
|
4973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5142
4974
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5143
4975
|
}, {
|
|
5144
4976
|
name: "BTC"
|
|
5145
|
-
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0,
|
|
4977
|
+
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5146
4978
|
WalletModalContent,
|
|
5147
4979
|
{
|
|
5148
4980
|
error,
|
|
@@ -5155,9 +4987,9 @@ function BTCConnectModal({
|
|
|
5155
4987
|
setVisible: () => {
|
|
5156
4988
|
}
|
|
5157
4989
|
}
|
|
5158
|
-
) : /* @__PURE__ */ (0,
|
|
4990
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "matchid-login-box", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "matchid-login-recommend-list", children: [
|
|
5159
4991
|
installedWallets.map((wallet2) => {
|
|
5160
|
-
return /* @__PURE__ */ (0,
|
|
4992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5161
4993
|
RecommendItem,
|
|
5162
4994
|
{
|
|
5163
4995
|
icon: iconMaps[wallet2.walletKey],
|
|
@@ -5169,15 +5001,15 @@ function BTCConnectModal({
|
|
|
5169
5001
|
wallet2.walletKey
|
|
5170
5002
|
);
|
|
5171
5003
|
}),
|
|
5172
|
-
|
|
5173
|
-
return /* @__PURE__ */ (0,
|
|
5004
|
+
wallets.filter((wallet2) => !installedWallets.find((installedWallet) => installedWallet.walletKey == wallet2.walletKey)).map((wallet2) => {
|
|
5005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5174
5006
|
RecommendItem,
|
|
5175
5007
|
{
|
|
5176
5008
|
icon: iconMaps[wallet2.walletKey],
|
|
5177
5009
|
name: wallet2.name,
|
|
5178
5010
|
onClick: () => {
|
|
5179
5011
|
},
|
|
5180
|
-
footer: /* @__PURE__ */ (0,
|
|
5012
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Button, { size: "sm", onClick: () => {
|
|
5181
5013
|
window.open(wallet2.website);
|
|
5182
5014
|
}, children: "Install" })
|
|
5183
5015
|
},
|
|
@@ -5187,23 +5019,23 @@ function BTCConnectModal({
|
|
|
5187
5019
|
] }) }) });
|
|
5188
5020
|
}
|
|
5189
5021
|
function BTCModal(props) {
|
|
5190
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
5022
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(BTCConnectModal, { ...props });
|
|
5191
5023
|
}
|
|
5192
5024
|
|
|
5193
5025
|
// src/components/WalletModal/index.tsx
|
|
5194
|
-
var
|
|
5195
|
-
var
|
|
5196
|
-
var
|
|
5026
|
+
var import_react27 = require("react");
|
|
5027
|
+
var import_react_intl13 = require("react-intl");
|
|
5028
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
5197
5029
|
function WalletConnectModal({
|
|
5198
5030
|
type,
|
|
5199
5031
|
methods: _methods,
|
|
5200
5032
|
...props
|
|
5201
5033
|
}) {
|
|
5202
|
-
const intl = (0,
|
|
5034
|
+
const intl = (0, import_react_intl13.useIntl)();
|
|
5203
5035
|
const { walletMap } = useWalletConfig();
|
|
5204
5036
|
const { bind, login } = useUserInfo();
|
|
5205
5037
|
const config = useAppConfig();
|
|
5206
|
-
const methods = (0,
|
|
5038
|
+
const methods = (0, import_react27.useMemo)(() => {
|
|
5207
5039
|
if (_methods) return _methods;
|
|
5208
5040
|
if (!config.platform) {
|
|
5209
5041
|
return [];
|
|
@@ -5211,13 +5043,13 @@ function WalletConnectModal({
|
|
|
5211
5043
|
const platform = config.platform.map((p) => p.toLowerCase());
|
|
5212
5044
|
return WALLET_METHODS.filter((m) => platform.includes(m));
|
|
5213
5045
|
}, [config.platform, _methods]);
|
|
5214
|
-
return /* @__PURE__ */ (0,
|
|
5046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5215
5047
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5216
5048
|
}, {
|
|
5217
5049
|
name: ""
|
|
5218
|
-
}), children: /* @__PURE__ */ (0,
|
|
5050
|
+
}), children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "matchid-login-box", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "matchid-login-recommend-list", children: methods.map((method, index) => {
|
|
5219
5051
|
const m = walletMap[method];
|
|
5220
|
-
return /* @__PURE__ */ (0,
|
|
5052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
5221
5053
|
RecommendItem,
|
|
5222
5054
|
{
|
|
5223
5055
|
icon: m?.icon,
|
|
@@ -5231,21 +5063,21 @@ function WalletConnectModal({
|
|
|
5231
5063
|
}) }) }) });
|
|
5232
5064
|
}
|
|
5233
5065
|
function WalletModal(props) {
|
|
5234
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
5066
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(WalletConnectModal, { ...props });
|
|
5235
5067
|
}
|
|
5236
5068
|
|
|
5237
5069
|
// src/components/AlphaAvatar/index.tsx
|
|
5238
|
-
var
|
|
5239
|
-
var
|
|
5070
|
+
var import_react28 = require("react");
|
|
5071
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
5240
5072
|
function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
5241
|
-
const [avatar, setAvatar] = (0,
|
|
5242
|
-
(0,
|
|
5073
|
+
const [avatar, setAvatar] = (0, import_react28.useState)(void 0);
|
|
5074
|
+
(0, import_react28.useEffect)(() => {
|
|
5243
5075
|
if (name) {
|
|
5244
5076
|
const char = name[0].toUpperCase();
|
|
5245
5077
|
setAvatar(char);
|
|
5246
5078
|
}
|
|
5247
5079
|
}, [name]);
|
|
5248
|
-
return /* @__PURE__ */ (0,
|
|
5080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
5249
5081
|
width: size,
|
|
5250
5082
|
height: size,
|
|
5251
5083
|
fontSize: Math.ceil(size / 2)
|
|
@@ -5253,7 +5085,7 @@ function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
|
5253
5085
|
}
|
|
5254
5086
|
|
|
5255
5087
|
// src/components/WalletAsset/index.tsx
|
|
5256
|
-
var
|
|
5088
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
5257
5089
|
function WalletAsset({
|
|
5258
5090
|
onAssetClick,
|
|
5259
5091
|
matchWalletAssetsOptions
|
|
@@ -5263,7 +5095,7 @@ function WalletAsset({
|
|
|
5263
5095
|
list: walletAssets.mergedAssets
|
|
5264
5096
|
});
|
|
5265
5097
|
const { list } = useMatchChain();
|
|
5266
|
-
return /* @__PURE__ */ (0,
|
|
5098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "matchid-wallet-asset-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
5267
5099
|
const clickFunc = onAssetClick && onAssetClick(n);
|
|
5268
5100
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
5269
5101
|
const getFooterColor = () => {
|
|
@@ -5278,11 +5110,11 @@ function WalletAsset({
|
|
|
5278
5110
|
}
|
|
5279
5111
|
return "";
|
|
5280
5112
|
};
|
|
5281
|
-
return /* @__PURE__ */ (0,
|
|
5113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: `matchid-wallet-asset-item`, onClick: clickFunc, style: {
|
|
5282
5114
|
cursor: clickFunc ? "pointer" : "default"
|
|
5283
5115
|
}, children: [
|
|
5284
|
-
/* @__PURE__ */ (0,
|
|
5285
|
-
n.icon ? /* @__PURE__ */ (0,
|
|
5116
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "matchid-wallet-asset-logo", title: n.symbol || n.name || "", children: [
|
|
5117
|
+
n.icon ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("img", { src: n.icon, alt: n.symbol, className: `matchid-wallet-asset-icon` }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
5286
5118
|
AlphaAvatar2,
|
|
5287
5119
|
{
|
|
5288
5120
|
className: `matchid-wallet-asset-icon`,
|
|
@@ -5290,12 +5122,12 @@ function WalletAsset({
|
|
|
5290
5122
|
name: n.symbol || n.name || ""
|
|
5291
5123
|
}
|
|
5292
5124
|
),
|
|
5293
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
5125
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-wallet-asset-chain` })
|
|
5294
5126
|
] }),
|
|
5295
|
-
/* @__PURE__ */ (0,
|
|
5296
|
-
/* @__PURE__ */ (0,
|
|
5297
|
-
"price" in n && /* @__PURE__ */ (0,
|
|
5298
|
-
/* @__PURE__ */ (0,
|
|
5127
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: `matchid-wallet-asset-info`, children: [
|
|
5128
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: `matchid-wallet-asset-name`, children: n.symbol }),
|
|
5129
|
+
"price" in n && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: `matchid-wallet-asset-content`, children: [
|
|
5130
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "matchid-wallet-asset-price", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
5299
5131
|
NumberFormatter,
|
|
5300
5132
|
{
|
|
5301
5133
|
value: n.price,
|
|
@@ -5303,7 +5135,7 @@ function WalletAsset({
|
|
|
5303
5135
|
tFixNum: 2
|
|
5304
5136
|
}
|
|
5305
5137
|
) }),
|
|
5306
|
-
/* @__PURE__ */ (0,
|
|
5138
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "matchid-wallet-asset-value", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
5307
5139
|
NumberFormatter,
|
|
5308
5140
|
{
|
|
5309
5141
|
value: n.value,
|
|
@@ -5312,15 +5144,15 @@ function WalletAsset({
|
|
|
5312
5144
|
}
|
|
5313
5145
|
) })
|
|
5314
5146
|
] }),
|
|
5315
|
-
/* @__PURE__ */ (0,
|
|
5316
|
-
/* @__PURE__ */ (0,
|
|
5147
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: `matchid-wallet-asset-footer`, children: [
|
|
5148
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: `matchid-wallet-asset-balance`, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
5317
5149
|
NumberFormatter,
|
|
5318
5150
|
{
|
|
5319
5151
|
value: n.balance,
|
|
5320
5152
|
tFixNum: 3
|
|
5321
5153
|
}
|
|
5322
5154
|
) }),
|
|
5323
|
-
"price_change_24h" in n && /* @__PURE__ */ (0,
|
|
5155
|
+
"price_change_24h" in n && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: `matchid-wallet-asset-change ${getFooterColor()}`, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
5324
5156
|
NumberFormatter,
|
|
5325
5157
|
{
|
|
5326
5158
|
prefix: `${(n?.price_change_24h || 0) < 0 ? "-" : "+"} `,
|
|
@@ -5336,10 +5168,10 @@ function WalletAsset({
|
|
|
5336
5168
|
}
|
|
5337
5169
|
|
|
5338
5170
|
// src/components/TokenSend/index.tsx
|
|
5339
|
-
var
|
|
5171
|
+
var import_react29 = require("react");
|
|
5340
5172
|
var import_viem6 = require("viem");
|
|
5341
|
-
var
|
|
5342
|
-
var
|
|
5173
|
+
var import_react_intl14 = require("react-intl");
|
|
5174
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
5343
5175
|
function Input2({
|
|
5344
5176
|
onChange,
|
|
5345
5177
|
placeholder,
|
|
@@ -5349,8 +5181,8 @@ function Input2({
|
|
|
5349
5181
|
error,
|
|
5350
5182
|
size = "df"
|
|
5351
5183
|
}) {
|
|
5352
|
-
return /* @__PURE__ */ (0,
|
|
5353
|
-
/* @__PURE__ */ (0,
|
|
5184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: `matchid-token-input-box ${"matchid-token-input-" + size}`, children: [
|
|
5185
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
5354
5186
|
"input",
|
|
5355
5187
|
{
|
|
5356
5188
|
placeholder,
|
|
@@ -5361,7 +5193,7 @@ function Input2({
|
|
|
5361
5193
|
className: `matchid-token-input ${error ? "matchid-token-input-error" : ""}`
|
|
5362
5194
|
}
|
|
5363
5195
|
),
|
|
5364
|
-
error && /* @__PURE__ */ (0,
|
|
5196
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "matchid-token-input-error-text", children: error })
|
|
5365
5197
|
] });
|
|
5366
5198
|
}
|
|
5367
5199
|
function TokenSend({
|
|
@@ -5371,25 +5203,25 @@ function TokenSend({
|
|
|
5371
5203
|
onBack
|
|
5372
5204
|
}) {
|
|
5373
5205
|
const { list: chainList } = useMatchChain();
|
|
5374
|
-
const intl = (0,
|
|
5206
|
+
const intl = (0, import_react_intl14.useIntl)();
|
|
5375
5207
|
const { createWalletClient: createWalletClient2 } = useWallet();
|
|
5376
5208
|
const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
|
|
5377
|
-
const chain = (0,
|
|
5209
|
+
const chain = (0, import_react29.useMemo)(() => {
|
|
5378
5210
|
return chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
5379
5211
|
}, [chainList, token.chain_id]);
|
|
5380
|
-
const walletClient = (0,
|
|
5212
|
+
const walletClient = (0, import_react29.useMemo)(() => {
|
|
5381
5213
|
return createWalletClient2({
|
|
5382
5214
|
// @ts-ignore
|
|
5383
5215
|
chain: (0, import_viem6.defineChain)(chain),
|
|
5384
5216
|
transport: (0, import_viem6.http)()
|
|
5385
5217
|
});
|
|
5386
5218
|
}, [chain]);
|
|
5387
|
-
const [amount, setAmount] = (0,
|
|
5388
|
-
const [address, setAddress] = (0,
|
|
5389
|
-
const [loading, setLoading] = (0,
|
|
5390
|
-
const [sending, setSending] = (0,
|
|
5391
|
-
const [txError, setTxError] = (0,
|
|
5392
|
-
const transaction = (0,
|
|
5219
|
+
const [amount, setAmount] = (0, import_react29.useState)("");
|
|
5220
|
+
const [address, setAddress] = (0, import_react29.useState)("");
|
|
5221
|
+
const [loading, setLoading] = (0, import_react29.useState)(false);
|
|
5222
|
+
const [sending, setSending] = (0, import_react29.useState)(false);
|
|
5223
|
+
const [txError, setTxError] = (0, import_react29.useState)("");
|
|
5224
|
+
const transaction = (0, import_react29.useMemo)(() => {
|
|
5393
5225
|
const reg = /^0x[a-fA-F0-9]{40}$/;
|
|
5394
5226
|
if (!amount || !address || !reg.test(address)) {
|
|
5395
5227
|
return;
|
|
@@ -5420,7 +5252,7 @@ function TokenSend({
|
|
|
5420
5252
|
setLoading(false);
|
|
5421
5253
|
}
|
|
5422
5254
|
};
|
|
5423
|
-
const error = (0,
|
|
5255
|
+
const error = (0, import_react29.useMemo)(() => {
|
|
5424
5256
|
setTxError("");
|
|
5425
5257
|
let amountError = "";
|
|
5426
5258
|
let addressError = "";
|
|
@@ -5463,7 +5295,7 @@ function TokenSend({
|
|
|
5463
5295
|
setAmount(value);
|
|
5464
5296
|
}
|
|
5465
5297
|
};
|
|
5466
|
-
const canSend = (0,
|
|
5298
|
+
const canSend = (0, import_react29.useMemo)(() => {
|
|
5467
5299
|
return !error.amount && !error.address && amount && address;
|
|
5468
5300
|
}, [error]);
|
|
5469
5301
|
const onNext = async () => {
|
|
@@ -5473,7 +5305,7 @@ function TokenSend({
|
|
|
5473
5305
|
}
|
|
5474
5306
|
onClose();
|
|
5475
5307
|
};
|
|
5476
|
-
(0,
|
|
5308
|
+
(0, import_react29.useEffect)(() => {
|
|
5477
5309
|
const receiveMessage = (event) => {
|
|
5478
5310
|
if (event.data) {
|
|
5479
5311
|
if (event.data.source == "match-wallet") {
|
|
@@ -5489,24 +5321,24 @@ function TokenSend({
|
|
|
5489
5321
|
window.removeEventListener("message", receiveMessage);
|
|
5490
5322
|
};
|
|
5491
5323
|
}, []);
|
|
5492
|
-
return /* @__PURE__ */ (0,
|
|
5493
|
-
/* @__PURE__ */ (0,
|
|
5494
|
-
/* @__PURE__ */ (0,
|
|
5495
|
-
/* @__PURE__ */ (0,
|
|
5496
|
-
/* @__PURE__ */ (0,
|
|
5497
|
-
/* @__PURE__ */ (0,
|
|
5498
|
-
token.icon ? /* @__PURE__ */ (0,
|
|
5324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ModalDrawer, { isOpen: true, onClose, zIndex, title: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_react_intl14.FormattedMessage, { id: "send" }), onBack, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: `matchid-token-send-box`, children: [
|
|
5325
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
5326
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: `matchid-token-amount-content`, children: [
|
|
5327
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: `matchid-token-amount-header`, children: [
|
|
5328
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: `matchid-token-amount-title`, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_react_intl14.FormattedMessage, { id: "amount" }) }),
|
|
5329
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: `matchid-token-amount-chain`, children: [
|
|
5330
|
+
token.icon ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
5499
5331
|
"img",
|
|
5500
5332
|
{
|
|
5501
5333
|
src: token?.icon,
|
|
5502
5334
|
alt: token?.symbol,
|
|
5503
5335
|
className: `matchid-token-amount-chain-icon`
|
|
5504
5336
|
}
|
|
5505
|
-
) : /* @__PURE__ */ (0,
|
|
5506
|
-
/* @__PURE__ */ (0,
|
|
5337
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(AlphaAvatar, { name: token.symbol || token.name || "", size: 16 }),
|
|
5338
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { children: token?.symbol })
|
|
5507
5339
|
] })
|
|
5508
5340
|
] }),
|
|
5509
|
-
/* @__PURE__ */ (0,
|
|
5341
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
5510
5342
|
Input2,
|
|
5511
5343
|
{
|
|
5512
5344
|
type: "text",
|
|
@@ -5519,18 +5351,18 @@ function TokenSend({
|
|
|
5519
5351
|
error: error.amount || txError
|
|
5520
5352
|
}
|
|
5521
5353
|
),
|
|
5522
|
-
/* @__PURE__ */ (0,
|
|
5523
|
-
/* @__PURE__ */ (0,
|
|
5524
|
-
/* @__PURE__ */ (0,
|
|
5354
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: `matchid-token-amount-footer`, children: [
|
|
5355
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: `matchid-token-amount-title`, children: [
|
|
5356
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_react_intl14.FormattedMessage, { id: "balance" }),
|
|
5525
5357
|
":"
|
|
5526
5358
|
] }),
|
|
5527
|
-
/* @__PURE__ */ (0,
|
|
5359
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: `matchid-token-amount-value`, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(NumberFormatter, { value: token.balance, tFixNum: 10, suffix: " " + token.symbol }) })
|
|
5528
5360
|
] }),
|
|
5529
|
-
/* @__PURE__ */ (0,
|
|
5361
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(TransferIcon, { className: "matchid-token-amount-transfer" })
|
|
5530
5362
|
] }),
|
|
5531
|
-
/* @__PURE__ */ (0,
|
|
5532
|
-
/* @__PURE__ */ (0,
|
|
5533
|
-
/* @__PURE__ */ (0,
|
|
5363
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: `matchid-token-address-content`, children: [
|
|
5364
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: `matchid-token-address-header`, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: `matchid-token-address-title`, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_react_intl14.FormattedMessage, { id: "receiveTitle" }) }) }),
|
|
5365
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
5534
5366
|
Input2,
|
|
5535
5367
|
{
|
|
5536
5368
|
type: "text",
|
|
@@ -5546,7 +5378,7 @@ function TokenSend({
|
|
|
5546
5378
|
)
|
|
5547
5379
|
] })
|
|
5548
5380
|
] }),
|
|
5549
|
-
/* @__PURE__ */ (0,
|
|
5381
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
5550
5382
|
Button,
|
|
5551
5383
|
{
|
|
5552
5384
|
size: "lg",
|
|
@@ -5555,15 +5387,15 @@ function TokenSend({
|
|
|
5555
5387
|
disabled: !canSend || !!txError,
|
|
5556
5388
|
onClick: onNext,
|
|
5557
5389
|
loading: loading || sending,
|
|
5558
|
-
children: /* @__PURE__ */ (0,
|
|
5390
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_react_intl14.FormattedMessage, { id: "next" })
|
|
5559
5391
|
}
|
|
5560
5392
|
)
|
|
5561
5393
|
] }) });
|
|
5562
5394
|
}
|
|
5563
5395
|
|
|
5564
5396
|
// src/components/TokenDetail/index.tsx
|
|
5565
|
-
var
|
|
5566
|
-
var
|
|
5397
|
+
var import_react_intl15 = require("react-intl");
|
|
5398
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
5567
5399
|
function TokenDetail({
|
|
5568
5400
|
onClose,
|
|
5569
5401
|
token
|
|
@@ -5573,41 +5405,41 @@ function TokenDetail({
|
|
|
5573
5405
|
const chain = chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
5574
5406
|
const onSend = () => {
|
|
5575
5407
|
modal.show((props) => {
|
|
5576
|
-
return /* @__PURE__ */ (0,
|
|
5408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(TokenSend, { onClose: () => {
|
|
5577
5409
|
props.close();
|
|
5578
5410
|
onClose();
|
|
5579
5411
|
}, onBack: props.close, zIndex: props.zIndex, token });
|
|
5580
5412
|
});
|
|
5581
5413
|
};
|
|
5582
|
-
const intl = (0,
|
|
5583
|
-
return /* @__PURE__ */ (0,
|
|
5414
|
+
const intl = (0, import_react_intl15.useIntl)();
|
|
5415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ModalDrawer, { isOpen: true, title: intl.formatMessage({
|
|
5584
5416
|
id: "tokenDetails"
|
|
5585
|
-
}), onClose, children: /* @__PURE__ */ (0,
|
|
5586
|
-
/* @__PURE__ */ (0,
|
|
5587
|
-
/* @__PURE__ */ (0,
|
|
5588
|
-
/* @__PURE__ */ (0,
|
|
5589
|
-
token.icon ? /* @__PURE__ */ (0,
|
|
5590
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
5417
|
+
}), onClose, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-detail`, children: [
|
|
5418
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-main`, children: [
|
|
5419
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-info`, children: [
|
|
5420
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-logo`, children: [
|
|
5421
|
+
token.icon ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("img", { src: token.icon, alt: token.symbol, className: `matchid-token-icon` }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(AlphaAvatar, { className: `matchid-token-icon`, size: 48, name: token.symbol || token.name || "" }),
|
|
5422
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-token-chain` })
|
|
5591
5423
|
] }),
|
|
5592
|
-
/* @__PURE__ */ (0,
|
|
5593
|
-
/* @__PURE__ */ (0,
|
|
5424
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-name`, children: [
|
|
5425
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(NumberFormatter, { value: token.balance, tFixNum: 10 }),
|
|
5594
5426
|
" ",
|
|
5595
5427
|
token.symbol
|
|
5596
5428
|
] })
|
|
5597
5429
|
] }),
|
|
5598
|
-
token.address.toLowerCase() != NATIVE_TOKEN_ADDRESS && /* @__PURE__ */ (0,
|
|
5599
|
-
/* @__PURE__ */ (0,
|
|
5600
|
-
/* @__PURE__ */ (0,
|
|
5430
|
+
token.address.toLowerCase() != NATIVE_TOKEN_ADDRESS && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-contract`, children: [
|
|
5431
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "matchid-token-contract-title", children: "Contract address" }),
|
|
5432
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "matchid-token-contract-address", children: token.address })
|
|
5601
5433
|
] })
|
|
5602
5434
|
] }),
|
|
5603
|
-
/* @__PURE__ */ (0,
|
|
5435
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Button, { size: "lg", block: true, highlight: true, onClick: onSend, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react_intl15.FormattedMessage, { id: "send" }) })
|
|
5604
5436
|
] }) });
|
|
5605
5437
|
}
|
|
5606
5438
|
|
|
5607
5439
|
// src/components/TokenSendList/index.tsx
|
|
5608
|
-
var
|
|
5609
|
-
var
|
|
5610
|
-
var
|
|
5440
|
+
var import_react30 = require("react");
|
|
5441
|
+
var import_react_intl16 = require("react-intl");
|
|
5442
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
5611
5443
|
function TokenSendList({ close }) {
|
|
5612
5444
|
const isDownMd = useDownMd();
|
|
5613
5445
|
const walletAssets = useMatchWalletAssets();
|
|
@@ -5615,20 +5447,20 @@ function TokenSendList({ close }) {
|
|
|
5615
5447
|
list: walletAssets.mergedAssets
|
|
5616
5448
|
});
|
|
5617
5449
|
const { list } = useMatchChain();
|
|
5618
|
-
const [checked, setChecked] = (0,
|
|
5450
|
+
const [checked, setChecked] = (0, import_react30.useState)();
|
|
5619
5451
|
const modal = useModal();
|
|
5620
5452
|
const onNext = () => {
|
|
5621
5453
|
checked && modal.show((props) => {
|
|
5622
|
-
return /* @__PURE__ */ (0,
|
|
5454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(TokenSend, { onClose: () => {
|
|
5623
5455
|
props.close();
|
|
5624
5456
|
close();
|
|
5625
5457
|
}, onBack: props.close, zIndex: props.zIndex, token: checked });
|
|
5626
5458
|
});
|
|
5627
5459
|
};
|
|
5628
|
-
return /* @__PURE__ */ (0,
|
|
5629
|
-
/* @__PURE__ */ (0,
|
|
5460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "matchid-token-send-list-box", children: [
|
|
5461
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "matchid-token-send-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
5630
5462
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
5631
|
-
return /* @__PURE__ */ (0,
|
|
5463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
5632
5464
|
"div",
|
|
5633
5465
|
{
|
|
5634
5466
|
className: `matchid-token-send-item ${checked?.address == n.address ? "matchid-token-send-chekced" : ""}`,
|
|
@@ -5636,10 +5468,10 @@ function TokenSendList({ close }) {
|
|
|
5636
5468
|
setChecked(n);
|
|
5637
5469
|
},
|
|
5638
5470
|
children: [
|
|
5639
|
-
/* @__PURE__ */ (0,
|
|
5640
|
-
/* @__PURE__ */ (0,
|
|
5641
|
-
/* @__PURE__ */ (0,
|
|
5642
|
-
n.icon ? /* @__PURE__ */ (0,
|
|
5471
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Radio, { checked: checked?.address == n.address, size: isDownMd ? 18 : 24 }),
|
|
5472
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
5473
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "matchid-token-send-logo", children: [
|
|
5474
|
+
n.icon ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("img", { src: n.icon, alt: n.symbol, className: `matchid-token-send-icon` }) : /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5643
5475
|
AlphaAvatar2,
|
|
5644
5476
|
{
|
|
5645
5477
|
className: `matchid-token-send-icon`,
|
|
@@ -5647,7 +5479,7 @@ function TokenSendList({ close }) {
|
|
|
5647
5479
|
name: n.symbol || n.name || ""
|
|
5648
5480
|
}
|
|
5649
5481
|
),
|
|
5650
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
5482
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5651
5483
|
"img",
|
|
5652
5484
|
{
|
|
5653
5485
|
src: chain.iconUrl,
|
|
@@ -5656,9 +5488,9 @@ function TokenSendList({ close }) {
|
|
|
5656
5488
|
}
|
|
5657
5489
|
)
|
|
5658
5490
|
] }),
|
|
5659
|
-
/* @__PURE__ */ (0,
|
|
5660
|
-
/* @__PURE__ */ (0,
|
|
5661
|
-
/* @__PURE__ */ (0,
|
|
5491
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-send-info`, children: [
|
|
5492
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: `matchid-token-send-name`, children: n.symbol }),
|
|
5493
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: `matchid-token-send-balance`, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(NumberFormatter, { value: n.balance, tFixNum: 3 }) })
|
|
5662
5494
|
] })
|
|
5663
5495
|
] })
|
|
5664
5496
|
]
|
|
@@ -5666,13 +5498,13 @@ function TokenSendList({ close }) {
|
|
|
5666
5498
|
index
|
|
5667
5499
|
);
|
|
5668
5500
|
}) }),
|
|
5669
|
-
/* @__PURE__ */ (0,
|
|
5501
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Button, { size: "lg", highlight: true, block: true, disabled: !checked, onClick: onNext, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react_intl16.FormattedMessage, { id: "next" }) })
|
|
5670
5502
|
] });
|
|
5671
5503
|
}
|
|
5672
5504
|
|
|
5673
5505
|
// src/components/TransactionList/index.tsx
|
|
5674
5506
|
var import_react_infinite_scroll_component = __toESM(require("react-infinite-scroll-component"));
|
|
5675
|
-
var
|
|
5507
|
+
var import_react31 = require("react");
|
|
5676
5508
|
var import_viem7 = require("viem");
|
|
5677
5509
|
var import_viem8 = require("viem");
|
|
5678
5510
|
|
|
@@ -5733,15 +5565,15 @@ var useContractStore = (0, import_zustand5.create)((0, import_middleware3.devtoo
|
|
|
5733
5565
|
var useContractStore_default = useContractStore;
|
|
5734
5566
|
|
|
5735
5567
|
// src/components/TransactionList/index.tsx
|
|
5736
|
-
var
|
|
5737
|
-
var
|
|
5568
|
+
var import_react_intl17 = require("react-intl");
|
|
5569
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
5738
5570
|
var Item = ({ data }) => {
|
|
5739
5571
|
const { address } = useWallet();
|
|
5740
5572
|
const isOut = data.from.toLowerCase() == address.toLowerCase();
|
|
5741
5573
|
const { chain, chainId, explorerLink, formatUnits: chainFormatUnits } = useMatchChain();
|
|
5742
5574
|
const { contracts } = useContractStore_default();
|
|
5743
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
5744
|
-
const transferType = (0,
|
|
5575
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react31.useState)(true);
|
|
5576
|
+
const transferType = (0, import_react31.useMemo)(() => {
|
|
5745
5577
|
const methodId = data.input.substring(2, 10);
|
|
5746
5578
|
if (methodId == "095ea7b3") {
|
|
5747
5579
|
return "erc20_approve";
|
|
@@ -5751,7 +5583,7 @@ var Item = ({ data }) => {
|
|
|
5751
5583
|
}
|
|
5752
5584
|
return "unknown";
|
|
5753
5585
|
}, [data.input]);
|
|
5754
|
-
const to = (0,
|
|
5586
|
+
const to = (0, import_react31.useMemo)(() => {
|
|
5755
5587
|
if (!isOut) {
|
|
5756
5588
|
return data.from;
|
|
5757
5589
|
}
|
|
@@ -5764,7 +5596,7 @@ var Item = ({ data }) => {
|
|
|
5764
5596
|
}
|
|
5765
5597
|
return data.to;
|
|
5766
5598
|
}, [data.input, transferType, data.to, isOut]);
|
|
5767
|
-
const amount = (0,
|
|
5599
|
+
const amount = (0, import_react31.useMemo)(() => {
|
|
5768
5600
|
if (transferType == "erc20_transfer") {
|
|
5769
5601
|
const decodeData = (0, import_viem7.decodeFunctionData)({
|
|
5770
5602
|
abi: import_viem8.erc20Abi,
|
|
@@ -5782,7 +5614,7 @@ var Item = ({ data }) => {
|
|
|
5782
5614
|
refetchInterval: shouldRefetch ? 3e3 : false,
|
|
5783
5615
|
enabled: shouldRefetch && data.source == "local"
|
|
5784
5616
|
});
|
|
5785
|
-
const status = (0,
|
|
5617
|
+
const status = (0, import_react31.useMemo)(() => {
|
|
5786
5618
|
if (data.source == "matchain") {
|
|
5787
5619
|
switch (data.extra.status) {
|
|
5788
5620
|
case "ok":
|
|
@@ -5809,30 +5641,30 @@ var Item = ({ data }) => {
|
|
|
5809
5641
|
}
|
|
5810
5642
|
return "loading";
|
|
5811
5643
|
}, [data.extra?.status, data.source, hashQuery.data]);
|
|
5812
|
-
(0,
|
|
5644
|
+
(0, import_react31.useEffect)(() => {
|
|
5813
5645
|
if (data.hash) {
|
|
5814
5646
|
setShouldRefetch(status == "loading");
|
|
5815
5647
|
}
|
|
5816
5648
|
}, [status, data.hash]);
|
|
5817
|
-
const symbol = (0,
|
|
5649
|
+
const symbol = (0, import_react31.useMemo)(() => {
|
|
5818
5650
|
if (transferType == "erc20_transfer") {
|
|
5819
5651
|
const contract = contracts[`${chainId}-${data.to.toLowerCase()}`];
|
|
5820
5652
|
return contract?.symbol || contract?.name || "unknown";
|
|
5821
5653
|
}
|
|
5822
5654
|
return chain?.nativeCurrency.symbol || chain?.nativeCurrency.name;
|
|
5823
5655
|
}, [transferType, chain, contracts, chainId, data.to]);
|
|
5824
|
-
return /* @__PURE__ */ (0,
|
|
5656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
5825
5657
|
"a",
|
|
5826
5658
|
{
|
|
5827
5659
|
href: explorerLink(`tx/${data.hash}`),
|
|
5828
5660
|
target: "_blank",
|
|
5829
5661
|
className: `matchid-transaction-item`,
|
|
5830
5662
|
children: [
|
|
5831
|
-
/* @__PURE__ */ (0,
|
|
5832
|
-
/* @__PURE__ */ (0,
|
|
5833
|
-
/* @__PURE__ */ (0,
|
|
5834
|
-
/* @__PURE__ */ (0,
|
|
5835
|
-
/* @__PURE__ */ (0,
|
|
5663
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-transacton-item-container`, children: [
|
|
5664
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "matchid-transaction-item-icon", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ArrowSendIcon, { className: !isOut ? "rotate-180" : "" }) }),
|
|
5665
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-transaction-item-details`, children: [
|
|
5666
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: `matchid-transaction-item-address`, children: formatAddress(to, 6, 4) }),
|
|
5667
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
5836
5668
|
"div",
|
|
5837
5669
|
{
|
|
5838
5670
|
className: `matchid-transaction-item-timestamp`,
|
|
@@ -5841,11 +5673,11 @@ var Item = ({ data }) => {
|
|
|
5841
5673
|
)
|
|
5842
5674
|
] })
|
|
5843
5675
|
] }),
|
|
5844
|
-
/* @__PURE__ */ (0,
|
|
5845
|
-
/* @__PURE__ */ (0,
|
|
5846
|
-
status == "loading" && /* @__PURE__ */ (0,
|
|
5847
|
-
status == "success" && /* @__PURE__ */ (0,
|
|
5848
|
-
status == "error" && /* @__PURE__ */ (0,
|
|
5676
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-transaction-item-amount ${"matchid-transaction-item-" + status}`, children: [
|
|
5677
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(NumberFormatter, { value: amount, tFixNum: 6, prefix: isOut ? "-" : "+", suffix: " " + symbol }),
|
|
5678
|
+
status == "loading" && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(LoadingIcon_default, { color: "#000000", size: 16, rotate: true }),
|
|
5679
|
+
status == "success" && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(CheckRoundIcon, { size: 16 }),
|
|
5680
|
+
status == "error" && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(InfoRoundIcon, { size: 16 })
|
|
5849
5681
|
] })
|
|
5850
5682
|
]
|
|
5851
5683
|
}
|
|
@@ -5855,33 +5687,33 @@ function TransactionList({
|
|
|
5855
5687
|
scrollableTarget
|
|
5856
5688
|
}) {
|
|
5857
5689
|
const { fetchMoreData, hasMore, items } = useMatchWalletRecords();
|
|
5858
|
-
return /* @__PURE__ */ (0,
|
|
5690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
5859
5691
|
import_react_infinite_scroll_component.default,
|
|
5860
5692
|
{
|
|
5861
5693
|
scrollableTarget,
|
|
5862
5694
|
dataLength: items.length,
|
|
5863
5695
|
next: fetchMoreData,
|
|
5864
5696
|
hasMore,
|
|
5865
|
-
loader: /* @__PURE__ */ (0,
|
|
5866
|
-
/* @__PURE__ */ (0,
|
|
5697
|
+
loader: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "matchid-list-nomore", children: [
|
|
5698
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(LoadingIcon_default, { rotate: true, size: 16, color: "black" }),
|
|
5867
5699
|
"Loading..."
|
|
5868
5700
|
] }),
|
|
5869
|
-
endMessage: items.length > 0 ? /* @__PURE__ */ (0,
|
|
5870
|
-
children: items.length == 0 && !hasMore ? /* @__PURE__ */ (0,
|
|
5701
|
+
endMessage: items.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: `matchid-list-nomore`, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react_intl17.FormattedMessage, { id: "noMoreRecords" }) }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: `matchid-list-nomore`, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react_intl17.FormattedMessage, { id: "noRecords" }) }),
|
|
5702
|
+
children: items.length == 0 && !hasMore ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "mt-[150px]" }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: `matchid-transaction-list`, children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Item, { data: item }, index)) })
|
|
5871
5703
|
}
|
|
5872
5704
|
);
|
|
5873
5705
|
}
|
|
5874
5706
|
|
|
5875
5707
|
// src/hooks/useMatchWallet.tsx
|
|
5876
5708
|
var import_react_qrcode = require("react-qrcode");
|
|
5877
|
-
var
|
|
5709
|
+
var import_react33 = require("react");
|
|
5878
5710
|
var import_react_query6 = require("@tanstack/react-query");
|
|
5879
5711
|
var import_viem11 = require("viem");
|
|
5880
|
-
var
|
|
5712
|
+
var import_react_intl19 = require("react-intl");
|
|
5881
5713
|
|
|
5882
5714
|
// src/components/ImportToken/index.tsx
|
|
5883
|
-
var
|
|
5884
|
-
var
|
|
5715
|
+
var import_react32 = require("react");
|
|
5716
|
+
var import_react_intl18 = require("react-intl");
|
|
5885
5717
|
var import_react_query5 = require("@tanstack/react-query");
|
|
5886
5718
|
var import_viem10 = require("viem");
|
|
5887
5719
|
|
|
@@ -5910,14 +5742,14 @@ function useIsContract({
|
|
|
5910
5742
|
}
|
|
5911
5743
|
|
|
5912
5744
|
// src/components/ImportToken/index.tsx
|
|
5913
|
-
var
|
|
5745
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
5914
5746
|
function ImportToken({ close }) {
|
|
5915
|
-
const [status, setStatus] = (0,
|
|
5747
|
+
const [status, setStatus] = (0, import_react32.useState)("");
|
|
5916
5748
|
const { token } = useUserInfo();
|
|
5917
|
-
const [address, setAddress] = (0,
|
|
5918
|
-
const [symbol, setSymbol] = (0,
|
|
5919
|
-
const [decimals, setDecimals] = (0,
|
|
5920
|
-
const [error, setError] = (0,
|
|
5749
|
+
const [address, setAddress] = (0, import_react32.useState)("");
|
|
5750
|
+
const [symbol, setSymbol] = (0, import_react32.useState)("");
|
|
5751
|
+
const [decimals, setDecimals] = (0, import_react32.useState)("");
|
|
5752
|
+
const [error, setError] = (0, import_react32.useState)({});
|
|
5921
5753
|
const { publicClient, chainId, chain } = useMatchChain();
|
|
5922
5754
|
const getContractInfo = async () => {
|
|
5923
5755
|
if (!publicClient) return;
|
|
@@ -5950,8 +5782,8 @@ function ImportToken({ close }) {
|
|
|
5950
5782
|
});
|
|
5951
5783
|
}
|
|
5952
5784
|
};
|
|
5953
|
-
const intl = (0,
|
|
5954
|
-
(0,
|
|
5785
|
+
const intl = (0, import_react_intl18.useIntl)();
|
|
5786
|
+
(0, import_react32.useEffect)(() => {
|
|
5955
5787
|
if (address.length === 42) {
|
|
5956
5788
|
const reg = /^0x[0-9a-fA-F]{40}$/;
|
|
5957
5789
|
if (!reg.test(address)) {
|
|
@@ -5970,7 +5802,7 @@ function ImportToken({ close }) {
|
|
|
5970
5802
|
}
|
|
5971
5803
|
}
|
|
5972
5804
|
}, [address, publicClient]);
|
|
5973
|
-
const [loading, setLoading] = (0,
|
|
5805
|
+
const [loading, setLoading] = (0, import_react32.useState)(false);
|
|
5974
5806
|
const toast = useToast();
|
|
5975
5807
|
const queryClient2 = (0, import_react_query5.useQueryClient)();
|
|
5976
5808
|
const onImport = async () => {
|
|
@@ -5998,7 +5830,7 @@ function ImportToken({ close }) {
|
|
|
5998
5830
|
setLoading(false);
|
|
5999
5831
|
}
|
|
6000
5832
|
};
|
|
6001
|
-
const canImport = (0,
|
|
5833
|
+
const canImport = (0, import_react32.useMemo)(() => {
|
|
6002
5834
|
if (!address) {
|
|
6003
5835
|
return false;
|
|
6004
5836
|
}
|
|
@@ -6021,19 +5853,19 @@ function ImportToken({ close }) {
|
|
|
6021
5853
|
enabled: canImport
|
|
6022
5854
|
});
|
|
6023
5855
|
if (status == "success" || status == "fail") {
|
|
6024
|
-
return /* @__PURE__ */ (0,
|
|
6025
|
-
/* @__PURE__ */ (0,
|
|
6026
|
-
/* @__PURE__ */ (0,
|
|
6027
|
-
/* @__PURE__ */ (0,
|
|
5856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: `matchid-import-token-result matchid-flex`, children: [
|
|
5857
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: `matchid-import-token-result-box matchid-flex`, children: [
|
|
5858
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("img", { src: status == "success" ? success_default : fail_default, alt: status == "success" ? "success" : "fail", className: `matchid-import-token-result-img` }),
|
|
5859
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: `matchid-import-token-result-text matchid-import-token-result-text-${status}`, children: status == "success" ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react_intl18.FormattedMessage, { id: "importSuccess" }) : /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react_intl18.FormattedMessage, { id: "importFail" }) })
|
|
6028
5860
|
] }),
|
|
6029
|
-
status == "success" ? /* @__PURE__ */ (0,
|
|
5861
|
+
status == "success" ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Button, { size: "lg", onClick: close, block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react_intl18.FormattedMessage, { id: "close" }) }) : /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Button, { size: "lg", onClick: () => setStatus(""), block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react_intl18.FormattedMessage, { id: "back" }) })
|
|
6030
5862
|
] });
|
|
6031
5863
|
}
|
|
6032
|
-
return /* @__PURE__ */ (0,
|
|
6033
|
-
/* @__PURE__ */ (0,
|
|
6034
|
-
/* @__PURE__ */ (0,
|
|
5864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: `matchid-import-token`, children: [
|
|
5865
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "matchid-import-token-form", children: [
|
|
5866
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Field, { label: intl.formatMessage({
|
|
6035
5867
|
id: "tokenSmartContract"
|
|
6036
|
-
}), error: error.address ? error.address : isContractQuery.isFetched && !isContractQuery.isLoading && !isContractQuery.data && canImport ? "Address isn't a contract address" : "", children: /* @__PURE__ */ (0,
|
|
5868
|
+
}), error: error.address ? error.address : isContractQuery.isFetched && !isContractQuery.isLoading && !isContractQuery.data && canImport ? "Address isn't a contract address" : "", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
6037
5869
|
Input,
|
|
6038
5870
|
{
|
|
6039
5871
|
placeholder: intl.formatMessage({
|
|
@@ -6044,9 +5876,9 @@ function ImportToken({ close }) {
|
|
|
6044
5876
|
maxLength: 42
|
|
6045
5877
|
}
|
|
6046
5878
|
) }),
|
|
6047
|
-
/* @__PURE__ */ (0,
|
|
5879
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Field, { label: intl.formatMessage({
|
|
6048
5880
|
id: "tokenSymbol"
|
|
6049
|
-
}), error: error.symbol, children: /* @__PURE__ */ (0,
|
|
5881
|
+
}), error: error.symbol, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
6050
5882
|
Input,
|
|
6051
5883
|
{
|
|
6052
5884
|
placeholder: intl.formatMessage({
|
|
@@ -6057,9 +5889,9 @@ function ImportToken({ close }) {
|
|
|
6057
5889
|
maxLength: 16
|
|
6058
5890
|
}
|
|
6059
5891
|
) }),
|
|
6060
|
-
/* @__PURE__ */ (0,
|
|
5892
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Field, { label: intl.formatMessage({
|
|
6061
5893
|
id: "tokenDecimals"
|
|
6062
|
-
}), error: error.decimals, children: /* @__PURE__ */ (0,
|
|
5894
|
+
}), error: error.decimals, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
6063
5895
|
Input,
|
|
6064
5896
|
{
|
|
6065
5897
|
placeholder: intl.formatMessage({
|
|
@@ -6071,7 +5903,7 @@ function ImportToken({ close }) {
|
|
|
6071
5903
|
}
|
|
6072
5904
|
) })
|
|
6073
5905
|
] }),
|
|
6074
|
-
/* @__PURE__ */ (0,
|
|
5906
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
6075
5907
|
Button,
|
|
6076
5908
|
{
|
|
6077
5909
|
size: "lg",
|
|
@@ -6080,20 +5912,20 @@ function ImportToken({ close }) {
|
|
|
6080
5912
|
loading: loading || isContractQuery.isLoading,
|
|
6081
5913
|
disabled: !canImport || !isContractQuery.data,
|
|
6082
5914
|
highlight: true,
|
|
6083
|
-
children: /* @__PURE__ */ (0,
|
|
5915
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react_intl18.FormattedMessage, { id: "import" })
|
|
6084
5916
|
}
|
|
6085
5917
|
)
|
|
6086
5918
|
] });
|
|
6087
5919
|
}
|
|
6088
5920
|
|
|
6089
5921
|
// src/hooks/useMatchWallet.tsx
|
|
6090
|
-
var
|
|
5922
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
6091
5923
|
var ReceiveModal = () => {
|
|
6092
5924
|
const chain = useMatchChain();
|
|
6093
5925
|
const { address } = useWallet();
|
|
6094
5926
|
const [copied, setCopied] = useCopyClipboard();
|
|
6095
5927
|
const toast = useToast();
|
|
6096
|
-
const intl = (0,
|
|
5928
|
+
const intl = (0, import_react_intl19.useIntl)();
|
|
6097
5929
|
const onCopy = () => {
|
|
6098
5930
|
setCopied(address);
|
|
6099
5931
|
toast.success(intl.formatMessage({
|
|
@@ -6101,10 +5933,10 @@ var ReceiveModal = () => {
|
|
|
6101
5933
|
}));
|
|
6102
5934
|
};
|
|
6103
5935
|
const chainLink = chain.explorerLink("address/" + address);
|
|
6104
|
-
return /* @__PURE__ */ (0,
|
|
6105
|
-
/* @__PURE__ */ (0,
|
|
6106
|
-
/* @__PURE__ */ (0,
|
|
6107
|
-
/* @__PURE__ */ (0,
|
|
5936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `matchid-receive-modal`, children: [
|
|
5937
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "matchid-receive-container", children: [
|
|
5938
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: `matchid-receive-text`, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_react_intl19.FormattedMessage, { id: "receiveQrcode" }) }),
|
|
5939
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: `matchid-qr-container`, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
6108
5940
|
import_react_qrcode.QRCode,
|
|
6109
5941
|
{
|
|
6110
5942
|
margin: "0",
|
|
@@ -6112,7 +5944,7 @@ var ReceiveModal = () => {
|
|
|
6112
5944
|
value: address
|
|
6113
5945
|
}
|
|
6114
5946
|
) }),
|
|
6115
|
-
/* @__PURE__ */ (0,
|
|
5947
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
6116
5948
|
"a",
|
|
6117
5949
|
{
|
|
6118
5950
|
href: chainLink,
|
|
@@ -6122,8 +5954,8 @@ var ReceiveModal = () => {
|
|
|
6122
5954
|
}
|
|
6123
5955
|
)
|
|
6124
5956
|
] }),
|
|
6125
|
-
/* @__PURE__ */ (0,
|
|
6126
|
-
|
|
5957
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Button, { size: "lg", onClick: onCopy, block: true, highlight: true, disabled: copied, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5958
|
+
import_react_intl19.FormattedMessage,
|
|
6127
5959
|
{
|
|
6128
5960
|
id: "copyAddress"
|
|
6129
5961
|
}
|
|
@@ -6132,7 +5964,7 @@ var ReceiveModal = () => {
|
|
|
6132
5964
|
};
|
|
6133
5965
|
function useMatchWallet() {
|
|
6134
5966
|
const modal = useModal();
|
|
6135
|
-
const intl = (0,
|
|
5967
|
+
const intl = (0, import_react_intl19.useIntl)();
|
|
6136
5968
|
const showReceiveModal = () => {
|
|
6137
5969
|
modal.open({
|
|
6138
5970
|
title: intl.formatMessage({
|
|
@@ -6164,12 +5996,12 @@ function useMatchWallet() {
|
|
|
6164
5996
|
};
|
|
6165
5997
|
}
|
|
6166
5998
|
function useMatchWalletRecords() {
|
|
6167
|
-
const [hasMore, setHasMore] = (0,
|
|
6168
|
-
const [items, setItems] = (0,
|
|
5999
|
+
const [hasMore, setHasMore] = (0, import_react33.useState)(true);
|
|
6000
|
+
const [items, setItems] = (0, import_react33.useState)([]);
|
|
6169
6001
|
const { chainId, publicClient } = useMatchChain();
|
|
6170
6002
|
const { address } = useWallet();
|
|
6171
|
-
const hasMoreRef = (0,
|
|
6172
|
-
const nextPageParamsRef = (0,
|
|
6003
|
+
const hasMoreRef = (0, import_react33.useRef)(hasMore);
|
|
6004
|
+
const nextPageParamsRef = (0, import_react33.useRef)(void 0);
|
|
6173
6005
|
const { contracts, setContracts } = useContractStore_default();
|
|
6174
6006
|
const fetchMoreData = async () => {
|
|
6175
6007
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
@@ -6196,7 +6028,7 @@ function useMatchWalletRecords() {
|
|
|
6196
6028
|
hasMoreRef.current = true;
|
|
6197
6029
|
fetchMoreData();
|
|
6198
6030
|
};
|
|
6199
|
-
(0,
|
|
6031
|
+
(0, import_react33.useEffect)(() => {
|
|
6200
6032
|
if (chainId && address) {
|
|
6201
6033
|
onInit();
|
|
6202
6034
|
}
|
|
@@ -6252,7 +6084,7 @@ function useMatchWalletRecords() {
|
|
|
6252
6084
|
setContracts(contractMap);
|
|
6253
6085
|
}
|
|
6254
6086
|
};
|
|
6255
|
-
const list = (0,
|
|
6087
|
+
const list = (0, import_react33.useMemo)(() => {
|
|
6256
6088
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
6257
6089
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
6258
6090
|
removeList.forEach((item) => {
|
|
@@ -6294,7 +6126,7 @@ function useMatchWalletAssets({
|
|
|
6294
6126
|
chainId: chainId || 0,
|
|
6295
6127
|
...assetListOptions
|
|
6296
6128
|
});
|
|
6297
|
-
const mergedAssets = (0,
|
|
6129
|
+
const mergedAssets = (0, import_react33.useMemo)(() => {
|
|
6298
6130
|
if (!assetListQuery.data && !importTokenQuery.data) return [];
|
|
6299
6131
|
const assetList = (assetListQuery.data || []).map((asset) => ({
|
|
6300
6132
|
...asset,
|
|
@@ -6381,7 +6213,7 @@ function useMatchWalletAssetList({
|
|
|
6381
6213
|
retry: 3
|
|
6382
6214
|
// Retry up to 3 times if failed
|
|
6383
6215
|
});
|
|
6384
|
-
const erc20Tokens = (0,
|
|
6216
|
+
const erc20Tokens = (0, import_react33.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
|
|
6385
6217
|
const erc20BalanceQuery = (0, import_react_query6.useQuery)({
|
|
6386
6218
|
queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
|
|
6387
6219
|
queryFn: async () => {
|
|
@@ -6409,7 +6241,7 @@ function useMatchWalletAssetList({
|
|
|
6409
6241
|
// Refresh every 15 seconds
|
|
6410
6242
|
retry: 3
|
|
6411
6243
|
});
|
|
6412
|
-
const enrichedAssets = (0,
|
|
6244
|
+
const enrichedAssets = (0, import_react33.useMemo)(() => {
|
|
6413
6245
|
if (!list) return [];
|
|
6414
6246
|
const erc20Balances = erc20BalanceQuery.data || [];
|
|
6415
6247
|
return list.map((asset) => {
|
|
@@ -6431,7 +6263,7 @@ function useMatchWalletAssetList({
|
|
|
6431
6263
|
return { ...asset, balance, value, balanceValue };
|
|
6432
6264
|
});
|
|
6433
6265
|
}, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
|
|
6434
|
-
(0,
|
|
6266
|
+
(0, import_react33.useEffect)(() => {
|
|
6435
6267
|
const list2 = enrichedAssets.sort((a, b) => {
|
|
6436
6268
|
if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
|
|
6437
6269
|
if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
|
|
@@ -6456,14 +6288,14 @@ function useMatchWalletAssetList({
|
|
|
6456
6288
|
}
|
|
6457
6289
|
|
|
6458
6290
|
// src/hooks/useReceipt.tsx
|
|
6459
|
-
var
|
|
6291
|
+
var import_react34 = require("react");
|
|
6460
6292
|
var import_react_query7 = require("@tanstack/react-query");
|
|
6461
6293
|
var import_viem12 = require("viem");
|
|
6462
6294
|
var CACHE_TTL = 86400 * 30 * 1e3;
|
|
6463
6295
|
var MAX_CACHE_SIZE = 500;
|
|
6464
6296
|
var STORAGE_KEY = "match_receipt_logs";
|
|
6465
6297
|
function useReceiptCache() {
|
|
6466
|
-
const [cache, setCache] = (0,
|
|
6298
|
+
const [cache, setCache] = (0, import_react34.useState)(/* @__PURE__ */ new Map());
|
|
6467
6299
|
const isLocalStorageAvailable = (() => {
|
|
6468
6300
|
try {
|
|
6469
6301
|
const testKey = "__test__";
|
|
@@ -6474,7 +6306,7 @@ function useReceiptCache() {
|
|
|
6474
6306
|
return false;
|
|
6475
6307
|
}
|
|
6476
6308
|
})();
|
|
6477
|
-
(0,
|
|
6309
|
+
(0, import_react34.useEffect)(() => {
|
|
6478
6310
|
if (isLocalStorageAvailable) {
|
|
6479
6311
|
try {
|
|
6480
6312
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -6493,7 +6325,7 @@ function useReceiptCache() {
|
|
|
6493
6325
|
}
|
|
6494
6326
|
}
|
|
6495
6327
|
}, []);
|
|
6496
|
-
const updateLocalStorage = (0,
|
|
6328
|
+
const updateLocalStorage = (0, import_react34.useCallback)((updatedCache) => {
|
|
6497
6329
|
if (isLocalStorageAvailable) {
|
|
6498
6330
|
try {
|
|
6499
6331
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -6510,7 +6342,7 @@ function useReceiptCache() {
|
|
|
6510
6342
|
}
|
|
6511
6343
|
}
|
|
6512
6344
|
}, []);
|
|
6513
|
-
const set = (0,
|
|
6345
|
+
const set = (0, import_react34.useCallback)((key, value) => {
|
|
6514
6346
|
const now = Date.now();
|
|
6515
6347
|
const newCache = new Map(cache);
|
|
6516
6348
|
newCache.forEach((entry, k) => {
|
|
@@ -6528,7 +6360,7 @@ function useReceiptCache() {
|
|
|
6528
6360
|
setCache(newCache);
|
|
6529
6361
|
updateLocalStorage(newCache);
|
|
6530
6362
|
}, [cache, updateLocalStorage]);
|
|
6531
|
-
const get = (0,
|
|
6363
|
+
const get = (0, import_react34.useCallback)((key) => {
|
|
6532
6364
|
const entry = cache.get(key);
|
|
6533
6365
|
if (entry) {
|
|
6534
6366
|
if (Date.now() - entry.timestamp > CACHE_TTL) {
|
|
@@ -6542,7 +6374,7 @@ function useReceiptCache() {
|
|
|
6542
6374
|
}
|
|
6543
6375
|
return void 0;
|
|
6544
6376
|
}, [cache, updateLocalStorage]);
|
|
6545
|
-
const del = (0,
|
|
6377
|
+
const del = (0, import_react34.useCallback)((key) => {
|
|
6546
6378
|
if (cache.has(key)) {
|
|
6547
6379
|
const newCache = new Map(cache);
|
|
6548
6380
|
newCache.delete(key);
|
|
@@ -6550,7 +6382,7 @@ function useReceiptCache() {
|
|
|
6550
6382
|
updateLocalStorage(newCache);
|
|
6551
6383
|
}
|
|
6552
6384
|
}, [cache, updateLocalStorage]);
|
|
6553
|
-
const clear = (0,
|
|
6385
|
+
const clear = (0, import_react34.useCallback)(() => {
|
|
6554
6386
|
setCache(/* @__PURE__ */ new Map());
|
|
6555
6387
|
if (isLocalStorageAvailable) {
|
|
6556
6388
|
localStorage.removeItem(STORAGE_KEY);
|
|
@@ -6565,7 +6397,7 @@ function useReceipt2({
|
|
|
6565
6397
|
const { list } = useMatchChain();
|
|
6566
6398
|
const cache = useReceiptCache();
|
|
6567
6399
|
const chain = list?.find((item) => item.id === chainId);
|
|
6568
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
6400
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react34.useState)(true);
|
|
6569
6401
|
const query = (0, import_react_query7.useQuery)({
|
|
6570
6402
|
queryKey: ["match-tx-receipt", hash, chain],
|
|
6571
6403
|
queryFn: async () => {
|
|
@@ -6591,7 +6423,7 @@ function useReceipt2({
|
|
|
6591
6423
|
},
|
|
6592
6424
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
6593
6425
|
});
|
|
6594
|
-
(0,
|
|
6426
|
+
(0, import_react34.useEffect)(() => {
|
|
6595
6427
|
if (query.data) {
|
|
6596
6428
|
setShouldRefetch(false);
|
|
6597
6429
|
}
|
|
@@ -6600,14 +6432,14 @@ function useReceipt2({
|
|
|
6600
6432
|
}
|
|
6601
6433
|
|
|
6602
6434
|
// src/hooks/useTransaction.tsx
|
|
6603
|
-
var
|
|
6435
|
+
var import_react35 = require("react");
|
|
6604
6436
|
var import_react_query8 = require("@tanstack/react-query");
|
|
6605
6437
|
var import_viem13 = require("viem");
|
|
6606
6438
|
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
6607
6439
|
var MAX_CACHE_SIZE2 = 500;
|
|
6608
6440
|
var STORAGE_KEY2 = "match_transaction_logs";
|
|
6609
6441
|
function useTransactionCache() {
|
|
6610
|
-
const [cache, setCache] = (0,
|
|
6442
|
+
const [cache, setCache] = (0, import_react35.useState)(/* @__PURE__ */ new Map());
|
|
6611
6443
|
const isLocalStorageAvailable = (() => {
|
|
6612
6444
|
try {
|
|
6613
6445
|
const testKey = "__test__";
|
|
@@ -6618,7 +6450,7 @@ function useTransactionCache() {
|
|
|
6618
6450
|
return false;
|
|
6619
6451
|
}
|
|
6620
6452
|
})();
|
|
6621
|
-
(0,
|
|
6453
|
+
(0, import_react35.useEffect)(() => {
|
|
6622
6454
|
if (isLocalStorageAvailable) {
|
|
6623
6455
|
try {
|
|
6624
6456
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -6637,7 +6469,7 @@ function useTransactionCache() {
|
|
|
6637
6469
|
}
|
|
6638
6470
|
}
|
|
6639
6471
|
}, []);
|
|
6640
|
-
const updateLocalStorage = (0,
|
|
6472
|
+
const updateLocalStorage = (0, import_react35.useCallback)((updatedCache) => {
|
|
6641
6473
|
if (isLocalStorageAvailable) {
|
|
6642
6474
|
try {
|
|
6643
6475
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -6654,7 +6486,7 @@ function useTransactionCache() {
|
|
|
6654
6486
|
}
|
|
6655
6487
|
}
|
|
6656
6488
|
}, []);
|
|
6657
|
-
const set = (0,
|
|
6489
|
+
const set = (0, import_react35.useCallback)((key, value) => {
|
|
6658
6490
|
const now = Date.now();
|
|
6659
6491
|
const newCache = new Map(cache);
|
|
6660
6492
|
newCache.forEach((entry, k) => {
|
|
@@ -6672,7 +6504,7 @@ function useTransactionCache() {
|
|
|
6672
6504
|
setCache(newCache);
|
|
6673
6505
|
updateLocalStorage(newCache);
|
|
6674
6506
|
}, [cache, updateLocalStorage]);
|
|
6675
|
-
const get = (0,
|
|
6507
|
+
const get = (0, import_react35.useCallback)((key) => {
|
|
6676
6508
|
const entry = cache.get(key);
|
|
6677
6509
|
if (entry) {
|
|
6678
6510
|
if (Date.now() - entry.timestamp > CACHE_TTL2) {
|
|
@@ -6686,7 +6518,7 @@ function useTransactionCache() {
|
|
|
6686
6518
|
}
|
|
6687
6519
|
return void 0;
|
|
6688
6520
|
}, [cache, updateLocalStorage]);
|
|
6689
|
-
const del = (0,
|
|
6521
|
+
const del = (0, import_react35.useCallback)((key) => {
|
|
6690
6522
|
if (cache.has(key)) {
|
|
6691
6523
|
const newCache = new Map(cache);
|
|
6692
6524
|
newCache.delete(key);
|
|
@@ -6694,7 +6526,7 @@ function useTransactionCache() {
|
|
|
6694
6526
|
updateLocalStorage(newCache);
|
|
6695
6527
|
}
|
|
6696
6528
|
}, [cache, updateLocalStorage]);
|
|
6697
|
-
const clear = (0,
|
|
6529
|
+
const clear = (0, import_react35.useCallback)(() => {
|
|
6698
6530
|
setCache(/* @__PURE__ */ new Map());
|
|
6699
6531
|
if (isLocalStorageAvailable) {
|
|
6700
6532
|
localStorage.removeItem(STORAGE_KEY2);
|
|
@@ -6709,7 +6541,7 @@ function useTransaction({
|
|
|
6709
6541
|
const { list } = useMatchChain();
|
|
6710
6542
|
const cache = useTransactionCache();
|
|
6711
6543
|
const chain = list?.find((item) => item.id === chainId);
|
|
6712
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
6544
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react35.useState)(true);
|
|
6713
6545
|
const query = (0, import_react_query8.useQuery)({
|
|
6714
6546
|
queryKey: ["match-tx-transaction", hash, chain],
|
|
6715
6547
|
queryFn: async () => {
|
|
@@ -6735,7 +6567,7 @@ function useTransaction({
|
|
|
6735
6567
|
},
|
|
6736
6568
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
6737
6569
|
});
|
|
6738
|
-
(0,
|
|
6570
|
+
(0, import_react35.useEffect)(() => {
|
|
6739
6571
|
if (query.data) {
|
|
6740
6572
|
setShouldRefetch(false);
|
|
6741
6573
|
}
|
|
@@ -6744,27 +6576,27 @@ function useTransaction({
|
|
|
6744
6576
|
}
|
|
6745
6577
|
|
|
6746
6578
|
// src/components/CEXBindModal/index.tsx
|
|
6747
|
-
var
|
|
6748
|
-
var
|
|
6749
|
-
var
|
|
6579
|
+
var import_react36 = require("react");
|
|
6580
|
+
var import_react_intl20 = require("react-intl");
|
|
6581
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
6750
6582
|
function CEXBindModal({
|
|
6751
6583
|
onClose,
|
|
6752
6584
|
type,
|
|
6753
6585
|
isOpen = false,
|
|
6754
6586
|
...props
|
|
6755
6587
|
}) {
|
|
6756
|
-
const intl = (0,
|
|
6588
|
+
const intl = (0, import_react_intl20.useIntl)();
|
|
6757
6589
|
const { events } = useMatch();
|
|
6758
|
-
const [APIPassphrase, setAPIPassphrase] = (0,
|
|
6590
|
+
const [APIPassphrase, setAPIPassphrase] = (0, import_react36.useState)("");
|
|
6759
6591
|
const { refreshOverview } = useUserInfo();
|
|
6760
|
-
const [loading, setLoading] = (0,
|
|
6761
|
-
const [key, setKey] = (0,
|
|
6762
|
-
const [secret, setSecret] = (0,
|
|
6763
|
-
const [error, setError] = (0,
|
|
6764
|
-
const needPassphrase = (0,
|
|
6592
|
+
const [loading, setLoading] = (0, import_react36.useState)(false);
|
|
6593
|
+
const [key, setKey] = (0, import_react36.useState)("");
|
|
6594
|
+
const [secret, setSecret] = (0, import_react36.useState)("");
|
|
6595
|
+
const [error, setError] = (0, import_react36.useState)("");
|
|
6596
|
+
const needPassphrase = (0, import_react36.useMemo)(() => {
|
|
6765
6597
|
return ["bitget", "okx"].includes(type.toLowerCase());
|
|
6766
6598
|
}, [type]);
|
|
6767
|
-
(0,
|
|
6599
|
+
(0, import_react36.useEffect)(() => {
|
|
6768
6600
|
if (isOpen) {
|
|
6769
6601
|
setSecret("");
|
|
6770
6602
|
setKey("");
|
|
@@ -6801,20 +6633,20 @@ function CEXBindModal({
|
|
|
6801
6633
|
setLoading(false);
|
|
6802
6634
|
}
|
|
6803
6635
|
};
|
|
6804
|
-
return /* @__PURE__ */ (0,
|
|
6636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ModalWithHeader, { showClose: true, isOpen, onClose, title: intl.formatMessage({
|
|
6805
6637
|
id: "CEXBindTitle"
|
|
6806
6638
|
}, {
|
|
6807
6639
|
type
|
|
6808
|
-
}), ...props, children: /* @__PURE__ */ (0,
|
|
6809
|
-
/* @__PURE__ */ (0,
|
|
6810
|
-
/* @__PURE__ */ (0,
|
|
6811
|
-
/* @__PURE__ */ (0,
|
|
6812
|
-
/* @__PURE__ */ (0,
|
|
6813
|
-
/* @__PURE__ */ (0,
|
|
6640
|
+
}), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "matchid-cex-modal", children: [
|
|
6641
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { children: [
|
|
6642
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl20.FormattedMessage, { id: "CEXBindAttention" }) }),
|
|
6643
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl20.FormattedMessage, { id: "CEXBindTips1" }) }),
|
|
6644
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl20.FormattedMessage, { id: "CEXBindTips2" }) }),
|
|
6645
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl20.FormattedMessage, { id: "CEXBindTips3" }) })
|
|
6814
6646
|
] }),
|
|
6815
|
-
/* @__PURE__ */ (0,
|
|
6647
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Field, { label: intl.formatMessage({
|
|
6816
6648
|
id: "CEXBindApiKey"
|
|
6817
|
-
}), children: /* @__PURE__ */ (0,
|
|
6649
|
+
}), children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
6818
6650
|
Input,
|
|
6819
6651
|
{
|
|
6820
6652
|
value: key,
|
|
@@ -6822,9 +6654,9 @@ function CEXBindModal({
|
|
|
6822
6654
|
placeholder: "**** **** ****"
|
|
6823
6655
|
}
|
|
6824
6656
|
) }),
|
|
6825
|
-
/* @__PURE__ */ (0,
|
|
6657
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Field, { label: intl.formatMessage({
|
|
6826
6658
|
id: "CEXBindApiSecretKey"
|
|
6827
|
-
}), error: !needPassphrase && error, children: /* @__PURE__ */ (0,
|
|
6659
|
+
}), error: !needPassphrase && error, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
6828
6660
|
Input,
|
|
6829
6661
|
{
|
|
6830
6662
|
value: secret,
|
|
@@ -6832,9 +6664,9 @@ function CEXBindModal({
|
|
|
6832
6664
|
placeholder: "**** **** ****"
|
|
6833
6665
|
}
|
|
6834
6666
|
) }),
|
|
6835
|
-
needPassphrase && /* @__PURE__ */ (0,
|
|
6667
|
+
needPassphrase && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Field, { error, label: intl.formatMessage({
|
|
6836
6668
|
id: "CEXBindApiPassphrase"
|
|
6837
|
-
}), children: /* @__PURE__ */ (0,
|
|
6669
|
+
}), children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
6838
6670
|
Input,
|
|
6839
6671
|
{
|
|
6840
6672
|
value: APIPassphrase,
|
|
@@ -6842,7 +6674,7 @@ function CEXBindModal({
|
|
|
6842
6674
|
placeholder: "**** **** ****"
|
|
6843
6675
|
}
|
|
6844
6676
|
) }),
|
|
6845
|
-
/* @__PURE__ */ (0,
|
|
6677
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
6846
6678
|
Button,
|
|
6847
6679
|
{
|
|
6848
6680
|
onClick: SubmitApi,
|
|
@@ -6850,7 +6682,7 @@ function CEXBindModal({
|
|
|
6850
6682
|
block: true,
|
|
6851
6683
|
loading,
|
|
6852
6684
|
disabled: !key || !secret,
|
|
6853
|
-
children: /* @__PURE__ */ (0,
|
|
6685
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl20.FormattedMessage, { id: "continue" })
|
|
6854
6686
|
}
|
|
6855
6687
|
)
|
|
6856
6688
|
] }) });
|
|
@@ -6858,10 +6690,9 @@ function CEXBindModal({
|
|
|
6858
6690
|
|
|
6859
6691
|
// src/context/BusinessProvider.tsx
|
|
6860
6692
|
var import_react_query9 = require("@tanstack/react-query");
|
|
6861
|
-
var
|
|
6693
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
6862
6694
|
function BusinessProvider({ children }) {
|
|
6863
6695
|
const { overview, token } = useUserInfo();
|
|
6864
|
-
const { type: SOLType, isOpen: SOLIsOpen, close: SOLClose } = useSOLModalStore();
|
|
6865
6696
|
const { type: TONType, isOpen: TONIsOpen, close: TONClose } = useTONModalStore();
|
|
6866
6697
|
const { type: TRONType, isOpen: TRONIsOpen, close: TRONClose } = useTRONModalStore();
|
|
6867
6698
|
const { type: BTCType, isOpen: BTCIsOpen, close: BTCClose } = useBTCModalStore();
|
|
@@ -6882,7 +6713,7 @@ function BusinessProvider({ children }) {
|
|
|
6882
6713
|
if (isSuccess(res)) {
|
|
6883
6714
|
setTgAppAuthCode("");
|
|
6884
6715
|
await login({
|
|
6885
|
-
mid:
|
|
6716
|
+
// mid:'',
|
|
6886
6717
|
token: `${res.data.token_type} ${res.data.access_token}`
|
|
6887
6718
|
});
|
|
6888
6719
|
return true;
|
|
@@ -6892,18 +6723,8 @@ function BusinessProvider({ children }) {
|
|
|
6892
6723
|
enabled: !!tgAppAuthCode,
|
|
6893
6724
|
refetchInterval: 1e3 * 5
|
|
6894
6725
|
});
|
|
6895
|
-
return /* @__PURE__ */ (0,
|
|
6896
|
-
/* @__PURE__ */ (0,
|
|
6897
|
-
SOLModal,
|
|
6898
|
-
{
|
|
6899
|
-
isOpen: SOLIsOpen && (SOLType == "login" && !overview && !token || SOLType == "bind" && !!token && !!overview),
|
|
6900
|
-
onClose: SOLClose,
|
|
6901
|
-
type: SOLType,
|
|
6902
|
-
onSuccess: () => walletModalClose(SOLClose),
|
|
6903
|
-
zIndex: 199
|
|
6904
|
-
}
|
|
6905
|
-
),
|
|
6906
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
6726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
|
|
6727
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
6907
6728
|
TRONModal,
|
|
6908
6729
|
{
|
|
6909
6730
|
isOpen: TRONIsOpen && (TRONType == "login" && !overview && !token || TRONType == "bind" && !!token && !!overview),
|
|
@@ -6913,7 +6734,7 @@ function BusinessProvider({ children }) {
|
|
|
6913
6734
|
zIndex: 199
|
|
6914
6735
|
}
|
|
6915
6736
|
),
|
|
6916
|
-
/* @__PURE__ */ (0,
|
|
6737
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
6917
6738
|
TONModal,
|
|
6918
6739
|
{
|
|
6919
6740
|
isOpen: TONIsOpen && (TONType == "login" && !overview && !token || TONType == "bind" && !!token && !!overview),
|
|
@@ -6923,7 +6744,7 @@ function BusinessProvider({ children }) {
|
|
|
6923
6744
|
zIndex: 199
|
|
6924
6745
|
}
|
|
6925
6746
|
),
|
|
6926
|
-
/* @__PURE__ */ (0,
|
|
6747
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
6927
6748
|
BTCModal,
|
|
6928
6749
|
{
|
|
6929
6750
|
isOpen: BTCIsOpen && (BTCType == "login" && !overview && !token || BTCType == "bind" && !!token && !!overview),
|
|
@@ -6933,7 +6754,7 @@ function BusinessProvider({ children }) {
|
|
|
6933
6754
|
zIndex: 199
|
|
6934
6755
|
}
|
|
6935
6756
|
),
|
|
6936
|
-
/* @__PURE__ */ (0,
|
|
6757
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
6937
6758
|
CEXBindModal,
|
|
6938
6759
|
{
|
|
6939
6760
|
isOpen: CEXIsOpen && (!!token && !!overview),
|
|
@@ -6942,7 +6763,7 @@ function BusinessProvider({ children }) {
|
|
|
6942
6763
|
zIndex: 199
|
|
6943
6764
|
}
|
|
6944
6765
|
),
|
|
6945
|
-
/* @__PURE__ */ (0,
|
|
6766
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
6946
6767
|
WalletModal,
|
|
6947
6768
|
{
|
|
6948
6769
|
isOpen: WalletModalStore.isOpen && (WalletModalStore.type == "login" && !overview && !token || WalletModalStore.type == "bind" && !!token && !!overview),
|
|
@@ -6957,14 +6778,14 @@ function BusinessProvider({ children }) {
|
|
|
6957
6778
|
}
|
|
6958
6779
|
|
|
6959
6780
|
// src/context/index.tsx
|
|
6960
|
-
var
|
|
6781
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
6961
6782
|
var Providers = ({ children }) => {
|
|
6962
|
-
return /* @__PURE__ */ (0,
|
|
6783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToastProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ModalProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(BusinessProvider, { children }) }) });
|
|
6963
6784
|
};
|
|
6964
6785
|
var context_default = Providers;
|
|
6965
6786
|
|
|
6966
6787
|
// src/hooks/useWalletInit.ts
|
|
6967
|
-
var
|
|
6788
|
+
var import_react37 = require("react");
|
|
6968
6789
|
|
|
6969
6790
|
// src/utils/wallet.ts
|
|
6970
6791
|
var sendMessage = ({ method, data, resolve, reject, timeout }) => {
|
|
@@ -6997,11 +6818,11 @@ function useWalletInit({
|
|
|
6997
6818
|
}) {
|
|
6998
6819
|
const { endpoints, token, setWallet, appid, refreshOverview } = useLocalStore_default();
|
|
6999
6820
|
const { setWalletReady, walletReady } = useStore_default();
|
|
7000
|
-
const iframeReadyRef = (0,
|
|
7001
|
-
(0,
|
|
6821
|
+
const iframeReadyRef = (0, import_react37.useRef)(walletReady);
|
|
6822
|
+
(0, import_react37.useEffect)(() => {
|
|
7002
6823
|
setWallet(config);
|
|
7003
6824
|
}, [config]);
|
|
7004
|
-
(0,
|
|
6825
|
+
(0, import_react37.useEffect)(() => {
|
|
7005
6826
|
matchlog_default.log("sdk.mpc.status", walletReady, iframeReadyRef.current);
|
|
7006
6827
|
iframeReadyRef.current = walletReady;
|
|
7007
6828
|
if (iframeReadyRef.current) {
|
|
@@ -7018,7 +6839,7 @@ function useWalletInit({
|
|
|
7018
6839
|
onReady();
|
|
7019
6840
|
}
|
|
7020
6841
|
}, [walletReady]);
|
|
7021
|
-
(0,
|
|
6842
|
+
(0, import_react37.useEffect)(() => {
|
|
7022
6843
|
if (!endpoints.auth || !appid || !token || !config) {
|
|
7023
6844
|
const existingIframe = getWalletIframe();
|
|
7024
6845
|
if (existingIframe) {
|
|
@@ -7118,7 +6939,7 @@ function useWalletInit({
|
|
|
7118
6939
|
}
|
|
7119
6940
|
}
|
|
7120
6941
|
}, [endpoints.auth, appid, token, config]);
|
|
7121
|
-
(0,
|
|
6942
|
+
(0, import_react37.useEffect)(() => {
|
|
7122
6943
|
const messageHandle = async (e) => {
|
|
7123
6944
|
if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
|
|
7124
6945
|
return;
|
|
@@ -7199,7 +7020,7 @@ function useWalletInit({
|
|
|
7199
7020
|
}
|
|
7200
7021
|
|
|
7201
7022
|
// src/hooks/useInit.tsx
|
|
7202
|
-
var
|
|
7023
|
+
var import_react38 = require("react");
|
|
7203
7024
|
function useInit({
|
|
7204
7025
|
theme,
|
|
7205
7026
|
appid,
|
|
@@ -7219,39 +7040,70 @@ function useInit({
|
|
|
7219
7040
|
locale: realLocale
|
|
7220
7041
|
} = useLocalStore_default();
|
|
7221
7042
|
const walletModalStore = useWalletModalStore();
|
|
7222
|
-
const overviewLoadingRef = (0,
|
|
7043
|
+
const overviewLoadingRef = (0, import_react38.useRef)(false);
|
|
7223
7044
|
const searchParams = new URLSearchParams(window.location.search);
|
|
7224
7045
|
const matchToken = searchParams.get("matchToken");
|
|
7046
|
+
const matchidt = searchParams.get("matchidt");
|
|
7225
7047
|
const realEndpoints = endpoints || env_default.endpoints;
|
|
7226
|
-
(0,
|
|
7048
|
+
(0, import_react38.useEffect)(() => {
|
|
7227
7049
|
setTheme(theme);
|
|
7228
7050
|
}, [theme]);
|
|
7229
|
-
(0,
|
|
7051
|
+
(0, import_react38.useEffect)(() => {
|
|
7230
7052
|
setAppid(appid);
|
|
7231
7053
|
}, [appid]);
|
|
7232
|
-
(0,
|
|
7054
|
+
(0, import_react38.useEffect)(() => {
|
|
7233
7055
|
setEndpoints(realEndpoints);
|
|
7234
7056
|
}, [realEndpoints]);
|
|
7235
|
-
(0,
|
|
7057
|
+
(0, import_react38.useEffect)(() => {
|
|
7236
7058
|
setLocale(locale || "en");
|
|
7237
7059
|
}, [locale]);
|
|
7238
|
-
(0,
|
|
7060
|
+
(0, import_react38.useEffect)(() => {
|
|
7239
7061
|
if (matchToken) {
|
|
7240
7062
|
const tokenData = JSON.parse(atob(matchToken));
|
|
7241
7063
|
if (tokenData && tokenData.mid && tokenData.token) {
|
|
7242
7064
|
login({
|
|
7243
|
-
mid: tokenData.mid,
|
|
7065
|
+
// mid: tokenData.mid,
|
|
7244
7066
|
token: "Bearer " + tokenData.token
|
|
7245
7067
|
});
|
|
7246
7068
|
}
|
|
7247
7069
|
}
|
|
7248
7070
|
}, [matchToken]);
|
|
7249
|
-
(0,
|
|
7071
|
+
(0, import_react38.useEffect)(() => {
|
|
7072
|
+
if (matchidt) {
|
|
7073
|
+
const tokenData = decodeURIComponent(matchidt);
|
|
7074
|
+
const data = JSON.parse(decodeBase64(tokenData));
|
|
7075
|
+
if (data) {
|
|
7076
|
+
matchlog_default.log("matchidt", data);
|
|
7077
|
+
if (data.action == "login") {
|
|
7078
|
+
const newtoken = data.token || `${data.token_type} ${data.access_token}`;
|
|
7079
|
+
login({
|
|
7080
|
+
// mid: tokenData.mid,
|
|
7081
|
+
token: newtoken
|
|
7082
|
+
});
|
|
7083
|
+
} else if (data.action == "bind") {
|
|
7084
|
+
eventManager_default.emit("onBind", {
|
|
7085
|
+
type: data.type
|
|
7086
|
+
});
|
|
7087
|
+
if (events && events.onBind) {
|
|
7088
|
+
events.onBind({
|
|
7089
|
+
type: data.type
|
|
7090
|
+
});
|
|
7091
|
+
}
|
|
7092
|
+
}
|
|
7093
|
+
const url = window.location.href;
|
|
7094
|
+
const urlObj = new URL(url);
|
|
7095
|
+
urlObj.searchParams.delete("matchidt");
|
|
7096
|
+
window.history.replaceState({}, "", urlObj.toString());
|
|
7097
|
+
return;
|
|
7098
|
+
}
|
|
7099
|
+
}
|
|
7100
|
+
}, [matchidt]);
|
|
7101
|
+
(0, import_react38.useEffect)(() => {
|
|
7250
7102
|
const onLoginMessage = (event) => {
|
|
7251
7103
|
const res = event.data;
|
|
7252
7104
|
if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
|
|
7253
7105
|
login({
|
|
7254
|
-
mid: res.data.mid,
|
|
7106
|
+
// mid: res.data.mid,
|
|
7255
7107
|
token: res.data.token || `${res.data.token_type} ${res.data.access_token}`
|
|
7256
7108
|
});
|
|
7257
7109
|
} else if (res.event == "bind") {
|
|
@@ -7283,23 +7135,22 @@ function useInit({
|
|
|
7283
7135
|
overviewLoadingRef.current = false;
|
|
7284
7136
|
}
|
|
7285
7137
|
};
|
|
7286
|
-
(0,
|
|
7138
|
+
(0, import_react38.useEffect)(() => {
|
|
7287
7139
|
if (token) {
|
|
7288
7140
|
loadOverview();
|
|
7289
7141
|
}
|
|
7290
7142
|
}, [token]);
|
|
7291
|
-
const login = async ({
|
|
7292
|
-
setMid(mid);
|
|
7143
|
+
const login = async ({ token: token2 }) => {
|
|
7293
7144
|
setToken(token2);
|
|
7294
7145
|
const overview = await loadOverview();
|
|
7295
7146
|
eventManager_default.emit("onLogin", {
|
|
7296
|
-
mid,
|
|
7147
|
+
// mid,
|
|
7297
7148
|
token: token2,
|
|
7298
7149
|
did: overview?.did
|
|
7299
7150
|
});
|
|
7300
7151
|
if (events && events?.onLogin) {
|
|
7301
7152
|
events.onLogin({
|
|
7302
|
-
mid,
|
|
7153
|
+
// mid,
|
|
7303
7154
|
token: token2,
|
|
7304
7155
|
did: overview?.did
|
|
7305
7156
|
});
|
|
@@ -7315,7 +7166,7 @@ function useInit({
|
|
|
7315
7166
|
|
|
7316
7167
|
// src/MatchContext.tsx
|
|
7317
7168
|
var import_react_query10 = require("@tanstack/react-query");
|
|
7318
|
-
var
|
|
7169
|
+
var import_react_intl21 = require("react-intl");
|
|
7319
7170
|
|
|
7320
7171
|
// src/i18n/en.json
|
|
7321
7172
|
var en_default = {
|
|
@@ -8060,9 +7911,9 @@ var messages = {
|
|
|
8060
7911
|
};
|
|
8061
7912
|
|
|
8062
7913
|
// src/MatchContext.tsx
|
|
8063
|
-
var
|
|
7914
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
8064
7915
|
var queryClient = new import_react_query10.QueryClient();
|
|
8065
|
-
var MatchContext = (0,
|
|
7916
|
+
var MatchContext = (0, import_react39.createContext)(void 0);
|
|
8066
7917
|
var MatchProvider = ({
|
|
8067
7918
|
children,
|
|
8068
7919
|
appid,
|
|
@@ -8082,7 +7933,7 @@ var MatchProvider = ({
|
|
|
8082
7933
|
useWalletInit({
|
|
8083
7934
|
config: wallet
|
|
8084
7935
|
});
|
|
8085
|
-
return /* @__PURE__ */ (0,
|
|
7936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_intl21.IntlProvider, { locale: realLocale, messages: messages[realLocale], children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_query10.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
8086
7937
|
MatchContext.Provider,
|
|
8087
7938
|
{
|
|
8088
7939
|
value: {
|
|
@@ -8093,12 +7944,12 @@ var MatchProvider = ({
|
|
|
8093
7944
|
theme,
|
|
8094
7945
|
locale: realLocale
|
|
8095
7946
|
},
|
|
8096
|
-
children: /* @__PURE__ */ (0,
|
|
7947
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(context_default, { children })
|
|
8097
7948
|
}
|
|
8098
7949
|
) }) });
|
|
8099
7950
|
};
|
|
8100
7951
|
var useMatch = () => {
|
|
8101
|
-
const context = (0,
|
|
7952
|
+
const context = (0, import_react39.useContext)(MatchContext);
|
|
8102
7953
|
if (context === void 0) {
|
|
8103
7954
|
throw new Error("useMatch must be used within a MatchProvider");
|
|
8104
7955
|
}
|