@matchain/matchid-sdk-react 0.1.53-alpha.3 → 0.1.53-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icon/index.d.mts +1 -1
- package/dist/assets/icon/index.d.ts +1 -1
- package/dist/chunk-3CR66BEX.mjs +19 -0
- package/dist/chunk-3CR66BEX.mjs.map +1 -0
- package/dist/{chunk-HYQ3T6WW.mjs → chunk-JX73EY6V.mjs} +2 -14
- package/dist/chunk-JX73EY6V.mjs.map +1 -0
- package/dist/{chunk-3YF3P77J.mjs → chunk-LEHYGXVJ.mjs} +780 -188
- package/dist/chunk-LEHYGXVJ.mjs.map +1 -0
- package/dist/{chunk-4EVF2PXX.mjs → chunk-RT42O3OC.mjs} +2 -2
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +843 -217
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +6 -3
- package/dist/config/chains/index.mjs +2 -1
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +169 -58
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +5 -4
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +457 -346
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +4 -3
- package/dist/{index-CcN5ls1U.d.ts → index-BaYTgL99.d.mts} +3 -2
- package/dist/{index-lKJjj0w4.d.ts → index-BhU3hF7y.d.ts} +2 -2
- package/dist/{index-DrEKzXYX.d.mts → index-Bpd2gBNh.d.mts} +1 -1
- package/dist/{index-BSUoL5Jo.d.mts → index-C5StsjWY.d.ts} +11 -4
- package/dist/{index-DgwlV4ve.d.ts → index-CFqk8eNo.d.ts} +12 -12
- package/dist/{index-DXRsJY9h.d.mts → index-D1QeVZyN.d.ts} +3 -2
- package/dist/{index-BVO4Bt59.d.ts → index-D_UNctDI.d.mts} +11 -4
- package/dist/{index-Cul4qlZl.d.ts → index-DaXXoRxr.d.ts} +1 -1
- package/dist/{index-BKHtf1Tu.d.ts → index-Dt92N6yZ.d.ts} +1 -1
- package/dist/{index-ba3VTkaV.d.mts → index-W6yjuOKT.d.mts} +1 -1
- package/dist/{index-EPwrSSOz.d.mts → index-mxbJ8CFx.d.mts} +12 -12
- package/dist/{index-CvVl_Xw1.d.mts → index-wqqEUufi.d.mts} +2 -2
- package/dist/index.css +3 -0
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1082 -508
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -10
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/{types-Bgd3Ac92.d.mts → types-Bx_FJ11s.d.mts} +2 -1
- package/dist/{types-Bgd3Ac92.d.ts → types-Bx_FJ11s.d.ts} +2 -1
- package/dist/ui/index.d.mts +3 -3
- package/dist/ui/index.d.ts +3 -3
- package/example/src/pages/User/index.tsx +7 -1
- package/package.json +2 -1
- package/dist/chunk-3YF3P77J.mjs.map +0 -1
- package/dist/chunk-HYQ3T6WW.mjs.map +0 -1
- package/example/dist/assets/ccip-nxE3Zma4.js +0 -1
- package/example/dist/assets/index-BFAv3rdU.css +0 -1
- package/example/dist/assets/index-DMWWRDPI.js +0 -1658
- package/example/dist/index.html +0 -14
- /package/dist/{chunk-4EVF2PXX.mjs.map → chunk-RT42O3OC.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_react41 = require("react");
|
|
48
48
|
|
|
49
49
|
// src/hooks/index.tsx
|
|
50
50
|
var hooks_exports = {};
|
|
@@ -1929,6 +1929,12 @@ var useBTCModalStore = (0, import_zustand2.create)((set) => ({
|
|
|
1929
1929
|
open: (type) => set({ isOpen: true, type }),
|
|
1930
1930
|
close: () => set({ isOpen: false })
|
|
1931
1931
|
}));
|
|
1932
|
+
var useEVMModalStore = (0, import_zustand2.create)((set) => ({
|
|
1933
|
+
isOpen: false,
|
|
1934
|
+
type: "",
|
|
1935
|
+
open: (type) => set({ isOpen: true, type }),
|
|
1936
|
+
close: () => set({ isOpen: false })
|
|
1937
|
+
}));
|
|
1932
1938
|
var useCEXBindModalStore = (0, import_zustand2.create)((set) => ({
|
|
1933
1939
|
type: "",
|
|
1934
1940
|
isOpen: false,
|
|
@@ -1973,6 +1979,7 @@ function useUserInfo() {
|
|
|
1973
1979
|
const { setTgAppAuthCode, emailLoginKey, setEmailLoginKey } = useStore_default();
|
|
1974
1980
|
const isDownMd = useDownMd();
|
|
1975
1981
|
const { events, login } = useMatch();
|
|
1982
|
+
const { open: EVMOpen } = useEVMModalStore();
|
|
1976
1983
|
const { open: TRONOpen } = useTRONModalStore();
|
|
1977
1984
|
const { open: TONOpen } = useTONModalStore();
|
|
1978
1985
|
const { open: BTCOpen } = useBTCModalStore();
|
|
@@ -2049,7 +2056,8 @@ function useUserInfo() {
|
|
|
2049
2056
|
case "wallet":
|
|
2050
2057
|
return walletModalStore.open("login", extra?.methods);
|
|
2051
2058
|
case "evm":
|
|
2052
|
-
return
|
|
2059
|
+
return EVMOpen("login");
|
|
2060
|
+
// return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`)
|
|
2053
2061
|
case "sol":
|
|
2054
2062
|
if (isDownMd) {
|
|
2055
2063
|
return window.location.href = `${endpoints.auth}login/sol?appid=${appid}&locale=${locale}&redirect_uri=${getRedirectUri()}`;
|
|
@@ -2141,7 +2149,8 @@ function useUserInfo() {
|
|
|
2141
2149
|
case "wallet":
|
|
2142
2150
|
return walletModalStore.open("bind", extra?.methods);
|
|
2143
2151
|
case "evm":
|
|
2144
|
-
return
|
|
2152
|
+
return EVMOpen("bind");
|
|
2153
|
+
// return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)))
|
|
2145
2154
|
case "sol":
|
|
2146
2155
|
if (isDownMd) {
|
|
2147
2156
|
return window.location.href = `${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}&redirect_uri=${getRedirectUri()}`;
|
|
@@ -3375,6 +3384,7 @@ var components_exports = {};
|
|
|
3375
3384
|
__export(components_exports, {
|
|
3376
3385
|
BTCModal: () => BTCModal,
|
|
3377
3386
|
Button: () => Button,
|
|
3387
|
+
EVMModal: () => EVMModal,
|
|
3378
3388
|
EmailModal: () => EmailModal,
|
|
3379
3389
|
Field: () => Field,
|
|
3380
3390
|
Input: () => Input,
|
|
@@ -4145,8 +4155,8 @@ function UsernameModal({
|
|
|
4145
4155
|
] }) });
|
|
4146
4156
|
}
|
|
4147
4157
|
|
|
4148
|
-
// src/components/
|
|
4149
|
-
var import_react23 =
|
|
4158
|
+
// src/components/EVMModal/index.tsx
|
|
4159
|
+
var import_react23 = require("react");
|
|
4150
4160
|
var import_react_intl10 = require("react-intl");
|
|
4151
4161
|
|
|
4152
4162
|
// src/components/WalletModalContent/index.tsx
|
|
@@ -4233,7 +4243,88 @@ function WalletModalContent({
|
|
|
4233
4243
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "matchid-wallet-container", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `matchid-wallet-box`, children: [
|
|
4234
4244
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `matchid-wallet-content`, children: [
|
|
4235
4245
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("img", { src: pageData.statusImage }),
|
|
4236
|
-
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: pageData.isError ? "
|
|
4246
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: pageData.isError ? "matchid-error" : "", children: pageData.text })
|
|
4247
|
+
] }),
|
|
4248
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
4249
|
+
Button,
|
|
4250
|
+
{
|
|
4251
|
+
block: true,
|
|
4252
|
+
size: "lg",
|
|
4253
|
+
onClick: pageData.btnClick,
|
|
4254
|
+
loading: pageData.btnLoading,
|
|
4255
|
+
disabled: pageData.btnDisabled,
|
|
4256
|
+
children: pageData.btnText
|
|
4257
|
+
}
|
|
4258
|
+
)
|
|
4259
|
+
] }) });
|
|
4260
|
+
}
|
|
4261
|
+
function WalletModalContentV2(props) {
|
|
4262
|
+
const [submitting, setSubmitting] = (0, import_react21.useState)(false);
|
|
4263
|
+
const pageData = (0, import_react21.useMemo)(() => {
|
|
4264
|
+
const { status } = props;
|
|
4265
|
+
if (status == "success") {
|
|
4266
|
+
return {
|
|
4267
|
+
btnText: "Disconnect Wallet",
|
|
4268
|
+
btnClick: async () => {
|
|
4269
|
+
setSubmitting(true);
|
|
4270
|
+
await props.onDisconnect?.();
|
|
4271
|
+
setSubmitting(false);
|
|
4272
|
+
},
|
|
4273
|
+
text: "Wallet connection successful!",
|
|
4274
|
+
statusImage: walletConnectedImage,
|
|
4275
|
+
btnLoading: submitting
|
|
4276
|
+
};
|
|
4277
|
+
}
|
|
4278
|
+
if (status == "error") {
|
|
4279
|
+
return {
|
|
4280
|
+
text: props.error || "Unknown Error",
|
|
4281
|
+
btnText: "Reconnect Wallet",
|
|
4282
|
+
btnClick: async () => {
|
|
4283
|
+
setSubmitting(true);
|
|
4284
|
+
await props.onError?.();
|
|
4285
|
+
setSubmitting(false);
|
|
4286
|
+
},
|
|
4287
|
+
statusImage: walletErrorImage,
|
|
4288
|
+
isError: true,
|
|
4289
|
+
btnLoading: submitting
|
|
4290
|
+
};
|
|
4291
|
+
}
|
|
4292
|
+
if (status == "nonce") {
|
|
4293
|
+
return {
|
|
4294
|
+
btnLoading: true,
|
|
4295
|
+
text: "Connecting",
|
|
4296
|
+
statusImage: walletConnectingImage
|
|
4297
|
+
};
|
|
4298
|
+
}
|
|
4299
|
+
if (status == "signer") {
|
|
4300
|
+
return {
|
|
4301
|
+
btnLoading: true,
|
|
4302
|
+
text: "Signing",
|
|
4303
|
+
statusImage: walletSigningImage
|
|
4304
|
+
};
|
|
4305
|
+
}
|
|
4306
|
+
if (status == "connecting") {
|
|
4307
|
+
return {
|
|
4308
|
+
btnLoading: true,
|
|
4309
|
+
text: "Connecting",
|
|
4310
|
+
statusImage: walletConnectingImage
|
|
4311
|
+
};
|
|
4312
|
+
}
|
|
4313
|
+
return {
|
|
4314
|
+
btnText: "Connect Wallet",
|
|
4315
|
+
btnClick: async () => {
|
|
4316
|
+
setSubmitting(true);
|
|
4317
|
+
await props.onConnect?.();
|
|
4318
|
+
setSubmitting(false);
|
|
4319
|
+
},
|
|
4320
|
+
text: "Please Connect your wallet",
|
|
4321
|
+
statusImage: walletConnectImage
|
|
4322
|
+
};
|
|
4323
|
+
}, [props, submitting]);
|
|
4324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "matchid-wallet-container", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `matchid-wallet-box`, children: [
|
|
4325
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `matchid-wallet-content`, children: [
|
|
4326
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("img", { src: pageData.statusImage }),
|
|
4327
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: props.status == "error" ? "matchid-error" : "", children: pageData.text })
|
|
4237
4328
|
] }),
|
|
4238
4329
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
4239
4330
|
Button,
|
|
@@ -4249,133 +4340,667 @@ function WalletModalContent({
|
|
|
4249
4340
|
] }) });
|
|
4250
4341
|
}
|
|
4251
4342
|
|
|
4252
|
-
// src/
|
|
4253
|
-
var
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
params: window.tronLink.tronlinkParams
|
|
4269
|
-
}
|
|
4270
|
-
);
|
|
4343
|
+
// src/components/EVMModal/index.tsx
|
|
4344
|
+
var import_chains = require("wagmi/chains");
|
|
4345
|
+
var import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
4346
|
+
var import_wagmi2 = require("wagmi");
|
|
4347
|
+
var import_wallets = require("@rainbow-me/rainbowkit/wallets");
|
|
4348
|
+
|
|
4349
|
+
// src/config/chains/MatchMain.ts
|
|
4350
|
+
var import_viem6 = require("viem");
|
|
4351
|
+
var matchMain = /* @__PURE__ */ (0, import_viem6.defineChain)({
|
|
4352
|
+
//定义match链
|
|
4353
|
+
id: 698,
|
|
4354
|
+
name: "Matchain",
|
|
4355
|
+
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
4356
|
+
rpcUrls: {
|
|
4357
|
+
default: {
|
|
4358
|
+
http: ["https://rpc.matchain.io"]
|
|
4271
4359
|
}
|
|
4272
|
-
|
|
4273
|
-
|
|
4360
|
+
},
|
|
4361
|
+
blockExplorers: {
|
|
4362
|
+
default: {
|
|
4363
|
+
name: "Matchscan",
|
|
4364
|
+
url: "https://matchscan.io/",
|
|
4365
|
+
apiUrl: "https://matchscan.io/api"
|
|
4366
|
+
}
|
|
4367
|
+
},
|
|
4368
|
+
iconUrl: "https://matchscan.io/static/identicon_logos/blockies.png",
|
|
4369
|
+
contracts: {
|
|
4370
|
+
multicall3: {
|
|
4371
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11"
|
|
4274
4372
|
}
|
|
4275
|
-
return window.tronWeb.defaultAddress.base58;
|
|
4276
4373
|
}
|
|
4277
|
-
|
|
4278
|
-
|
|
4374
|
+
// testnet: true,
|
|
4375
|
+
});
|
|
4376
|
+
|
|
4377
|
+
// src/config/chains/MatchTest.ts
|
|
4378
|
+
var import_viem7 = require("viem");
|
|
4379
|
+
var matchTest = /* @__PURE__ */ (0, import_viem7.defineChain)({
|
|
4380
|
+
//定义matchTest链
|
|
4381
|
+
id: 699,
|
|
4382
|
+
name: "MatchTest",
|
|
4383
|
+
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
4384
|
+
rpcUrls: {
|
|
4385
|
+
default: {
|
|
4386
|
+
http: ["https://testnet-rpc.matchain.io"]
|
|
4387
|
+
}
|
|
4388
|
+
},
|
|
4389
|
+
blockExplorers: {
|
|
4390
|
+
default: {
|
|
4391
|
+
name: "Matchscan",
|
|
4392
|
+
url: "https://testnet.matchscan.io/",
|
|
4393
|
+
apiUrl: "https://testnet.matchscan.io/api"
|
|
4394
|
+
}
|
|
4395
|
+
},
|
|
4396
|
+
iconUrl: "https://testnet.matchscan.io/static/identicon_logos/blockies.png",
|
|
4397
|
+
contracts: {
|
|
4398
|
+
multicall3: {
|
|
4399
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
4400
|
+
blockCreated: 751532
|
|
4401
|
+
},
|
|
4402
|
+
ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
|
|
4403
|
+
ensUniversalResolver: {
|
|
4404
|
+
address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",
|
|
4405
|
+
blockCreated: 5317080
|
|
4406
|
+
}
|
|
4279
4407
|
}
|
|
4280
|
-
|
|
4408
|
+
// testnet: true,
|
|
4409
|
+
});
|
|
4281
4410
|
|
|
4282
|
-
// src/hooks/
|
|
4411
|
+
// src/hooks/useWalletBox.ts
|
|
4283
4412
|
var import_react22 = require("react");
|
|
4413
|
+
function useWalletBox({
|
|
4414
|
+
onInit
|
|
4415
|
+
}) {
|
|
4416
|
+
const [status, setStateStatus] = (0, import_react22.useState)("start");
|
|
4417
|
+
const [error, setError] = (0, import_react22.useState)("");
|
|
4418
|
+
const statusRef = (0, import_react22.useRef)(status);
|
|
4419
|
+
const [nonce, setNonce] = (0, import_react22.useState)();
|
|
4420
|
+
const setStatus = (status2) => {
|
|
4421
|
+
statusRef.current = status2;
|
|
4422
|
+
setStateStatus(status2);
|
|
4423
|
+
};
|
|
4424
|
+
const init = () => {
|
|
4425
|
+
setError("");
|
|
4426
|
+
setNonce(null);
|
|
4427
|
+
};
|
|
4428
|
+
(0, import_react22.useEffect)(() => {
|
|
4429
|
+
init();
|
|
4430
|
+
onInit({
|
|
4431
|
+
setStatus
|
|
4432
|
+
});
|
|
4433
|
+
return () => {
|
|
4434
|
+
setStatus("start");
|
|
4435
|
+
setNonce(null);
|
|
4436
|
+
setError("");
|
|
4437
|
+
};
|
|
4438
|
+
}, []);
|
|
4439
|
+
return {
|
|
4440
|
+
status,
|
|
4441
|
+
statusRef,
|
|
4442
|
+
setStatus,
|
|
4443
|
+
error,
|
|
4444
|
+
setError,
|
|
4445
|
+
nonce,
|
|
4446
|
+
setNonce,
|
|
4447
|
+
init
|
|
4448
|
+
};
|
|
4449
|
+
}
|
|
4284
4450
|
|
|
4285
|
-
// src/
|
|
4286
|
-
var
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4451
|
+
// src/hooks/useEthersSigner.ts
|
|
4452
|
+
var React5 = __toESM(require("react"));
|
|
4453
|
+
var import_wagmi = require("wagmi");
|
|
4454
|
+
var import_ethers = require("ethers");
|
|
4455
|
+
|
|
4456
|
+
// node_modules/@wagmi/core/dist/esm/version.js
|
|
4457
|
+
var version = "2.16.3";
|
|
4458
|
+
|
|
4459
|
+
// node_modules/@wagmi/core/dist/esm/utils/getVersion.js
|
|
4460
|
+
var getVersion2 = () => `@wagmi/core@${version}`;
|
|
4461
|
+
|
|
4462
|
+
// node_modules/@wagmi/core/dist/esm/errors/base.js
|
|
4463
|
+
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
4464
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4465
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4466
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
4467
|
+
};
|
|
4468
|
+
var _BaseError_instances;
|
|
4469
|
+
var _BaseError_walk;
|
|
4470
|
+
var BaseError = class _BaseError extends Error {
|
|
4471
|
+
get docsBaseUrl() {
|
|
4472
|
+
return "https://wagmi.sh/core";
|
|
4291
4473
|
}
|
|
4292
|
-
|
|
4293
|
-
return
|
|
4474
|
+
get version() {
|
|
4475
|
+
return getVersion2();
|
|
4294
4476
|
}
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4477
|
+
constructor(shortMessage, options = {}) {
|
|
4478
|
+
super();
|
|
4479
|
+
_BaseError_instances.add(this);
|
|
4480
|
+
Object.defineProperty(this, "details", {
|
|
4481
|
+
enumerable: true,
|
|
4482
|
+
configurable: true,
|
|
4483
|
+
writable: true,
|
|
4484
|
+
value: void 0
|
|
4485
|
+
});
|
|
4486
|
+
Object.defineProperty(this, "docsPath", {
|
|
4487
|
+
enumerable: true,
|
|
4488
|
+
configurable: true,
|
|
4489
|
+
writable: true,
|
|
4490
|
+
value: void 0
|
|
4491
|
+
});
|
|
4492
|
+
Object.defineProperty(this, "metaMessages", {
|
|
4493
|
+
enumerable: true,
|
|
4494
|
+
configurable: true,
|
|
4495
|
+
writable: true,
|
|
4496
|
+
value: void 0
|
|
4497
|
+
});
|
|
4498
|
+
Object.defineProperty(this, "shortMessage", {
|
|
4499
|
+
enumerable: true,
|
|
4500
|
+
configurable: true,
|
|
4501
|
+
writable: true,
|
|
4502
|
+
value: void 0
|
|
4503
|
+
});
|
|
4504
|
+
Object.defineProperty(this, "name", {
|
|
4505
|
+
enumerable: true,
|
|
4506
|
+
configurable: true,
|
|
4507
|
+
writable: true,
|
|
4508
|
+
value: "WagmiCoreError"
|
|
4509
|
+
});
|
|
4510
|
+
const details = options.cause instanceof _BaseError ? options.cause.details : options.cause?.message ? options.cause.message : options.details;
|
|
4511
|
+
const docsPath = options.cause instanceof _BaseError ? options.cause.docsPath || options.docsPath : options.docsPath;
|
|
4512
|
+
this.message = [
|
|
4513
|
+
shortMessage || "An error occurred.",
|
|
4514
|
+
"",
|
|
4515
|
+
...options.metaMessages ? [...options.metaMessages, ""] : [],
|
|
4516
|
+
...docsPath ? [
|
|
4517
|
+
`Docs: ${this.docsBaseUrl}${docsPath}.html${options.docsSlug ? `#${options.docsSlug}` : ""}`
|
|
4518
|
+
] : [],
|
|
4519
|
+
...details ? [`Details: ${details}`] : [],
|
|
4520
|
+
`Version: ${this.version}`
|
|
4521
|
+
].join("\n");
|
|
4522
|
+
if (options.cause)
|
|
4523
|
+
this.cause = options.cause;
|
|
4524
|
+
this.details = details;
|
|
4525
|
+
this.docsPath = docsPath;
|
|
4526
|
+
this.metaMessages = options.metaMessages;
|
|
4527
|
+
this.shortMessage = shortMessage;
|
|
4299
4528
|
}
|
|
4300
|
-
|
|
4301
|
-
return
|
|
4529
|
+
walk(fn) {
|
|
4530
|
+
return __classPrivateFieldGet(this, _BaseError_instances, "m", _BaseError_walk).call(this, this, fn);
|
|
4302
4531
|
}
|
|
4303
4532
|
};
|
|
4533
|
+
_BaseError_instances = /* @__PURE__ */ new WeakSet(), _BaseError_walk = function _BaseError_walk2(err, fn) {
|
|
4534
|
+
if (fn?.(err))
|
|
4535
|
+
return err;
|
|
4536
|
+
if (err.cause)
|
|
4537
|
+
return __classPrivateFieldGet(this, _BaseError_instances, "m", _BaseError_walk2).call(this, err.cause, fn);
|
|
4538
|
+
return err;
|
|
4539
|
+
};
|
|
4304
4540
|
|
|
4305
|
-
//
|
|
4306
|
-
var
|
|
4541
|
+
// node_modules/@wagmi/core/dist/esm/errors/config.js
|
|
4542
|
+
var ConnectorNotConnectedError = class extends BaseError {
|
|
4307
4543
|
constructor() {
|
|
4308
|
-
|
|
4309
|
-
this
|
|
4310
|
-
|
|
4544
|
+
super("Connector not connected.");
|
|
4545
|
+
Object.defineProperty(this, "name", {
|
|
4546
|
+
enumerable: true,
|
|
4547
|
+
configurable: true,
|
|
4548
|
+
writable: true,
|
|
4549
|
+
value: "ConnectorNotConnectedError"
|
|
4550
|
+
});
|
|
4311
4551
|
}
|
|
4312
|
-
|
|
4313
|
-
|
|
4552
|
+
};
|
|
4553
|
+
var ConnectorAccountNotFoundError = class extends BaseError {
|
|
4554
|
+
constructor({ address, connector }) {
|
|
4555
|
+
super(`Account "${address}" not found for connector "${connector.name}".`);
|
|
4556
|
+
Object.defineProperty(this, "name", {
|
|
4557
|
+
enumerable: true,
|
|
4558
|
+
configurable: true,
|
|
4559
|
+
writable: true,
|
|
4560
|
+
value: "ConnectorAccountNotFoundError"
|
|
4561
|
+
});
|
|
4314
4562
|
}
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4563
|
+
};
|
|
4564
|
+
var ConnectorChainMismatchError = class extends BaseError {
|
|
4565
|
+
constructor({ connectionChainId, connectorChainId }) {
|
|
4566
|
+
super(`The current chain of the connector (id: ${connectorChainId}) does not match the connection's chain (id: ${connectionChainId}).`, {
|
|
4567
|
+
metaMessages: [
|
|
4568
|
+
`Current Chain ID: ${connectorChainId}`,
|
|
4569
|
+
`Expected Chain ID: ${connectionChainId}`
|
|
4570
|
+
]
|
|
4571
|
+
});
|
|
4572
|
+
Object.defineProperty(this, "name", {
|
|
4573
|
+
enumerable: true,
|
|
4574
|
+
configurable: true,
|
|
4575
|
+
writable: true,
|
|
4576
|
+
value: "ConnectorChainMismatchError"
|
|
4577
|
+
});
|
|
4319
4578
|
}
|
|
4320
|
-
|
|
4321
|
-
|
|
4579
|
+
};
|
|
4580
|
+
var ConnectorUnavailableReconnectingError = class extends BaseError {
|
|
4581
|
+
constructor({ connector }) {
|
|
4582
|
+
super(`Connector "${connector.name}" unavailable while reconnecting.`, {
|
|
4583
|
+
details: [
|
|
4584
|
+
"During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uid`.",
|
|
4585
|
+
"All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.",
|
|
4586
|
+
"This error commonly occurs for connectors that asynchronously inject after reconnection has already started."
|
|
4587
|
+
].join(" ")
|
|
4588
|
+
});
|
|
4589
|
+
Object.defineProperty(this, "name", {
|
|
4590
|
+
enumerable: true,
|
|
4591
|
+
configurable: true,
|
|
4592
|
+
writable: true,
|
|
4593
|
+
value: "ConnectorUnavailableReconnectingError"
|
|
4594
|
+
});
|
|
4322
4595
|
}
|
|
4323
4596
|
};
|
|
4324
4597
|
|
|
4325
|
-
//
|
|
4326
|
-
var
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
(
|
|
4331
|
-
const
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4598
|
+
// node_modules/@wagmi/core/dist/esm/actions/getConnectorClient.js
|
|
4599
|
+
var import_viem8 = require("viem");
|
|
4600
|
+
var import_utils7 = require("viem/utils");
|
|
4601
|
+
async function getConnectorClient(config, parameters = {}) {
|
|
4602
|
+
let connection;
|
|
4603
|
+
if (parameters.connector) {
|
|
4604
|
+
const { connector: connector2 } = parameters;
|
|
4605
|
+
if (config.state.status === "reconnecting" && !connector2.getAccounts && !connector2.getChainId)
|
|
4606
|
+
throw new ConnectorUnavailableReconnectingError({ connector: connector2 });
|
|
4607
|
+
const [accounts, chainId2] = await Promise.all([
|
|
4608
|
+
connector2.getAccounts(),
|
|
4609
|
+
connector2.getChainId()
|
|
4610
|
+
]);
|
|
4611
|
+
connection = {
|
|
4612
|
+
accounts,
|
|
4613
|
+
chainId: chainId2,
|
|
4614
|
+
connector: connector2
|
|
4337
4615
|
};
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
(
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4616
|
+
} else
|
|
4617
|
+
connection = config.state.connections.get(config.state.current);
|
|
4618
|
+
if (!connection)
|
|
4619
|
+
throw new ConnectorNotConnectedError();
|
|
4620
|
+
const chainId = parameters.chainId ?? connection.chainId;
|
|
4621
|
+
const connectorChainId = await connection.connector.getChainId();
|
|
4622
|
+
if (connectorChainId !== connection.chainId)
|
|
4623
|
+
throw new ConnectorChainMismatchError({
|
|
4624
|
+
connectionChainId: connection.chainId,
|
|
4625
|
+
connectorChainId
|
|
4626
|
+
});
|
|
4627
|
+
const connector = connection.connector;
|
|
4628
|
+
if (connector.getClient)
|
|
4629
|
+
return connector.getClient({ chainId });
|
|
4630
|
+
const account = (0, import_utils7.parseAccount)(parameters.account ?? connection.accounts[0]);
|
|
4631
|
+
account.address = (0, import_utils7.getAddress)(account.address);
|
|
4632
|
+
if (parameters.account && !connection.accounts.some((x) => x.toLowerCase() === account.address.toLowerCase()))
|
|
4633
|
+
throw new ConnectorAccountNotFoundError({
|
|
4634
|
+
address: account.address,
|
|
4635
|
+
connector
|
|
4636
|
+
});
|
|
4637
|
+
const chain = config.chains.find((chain2) => chain2.id === chainId);
|
|
4638
|
+
const provider = await connection.connector.getProvider({ chainId });
|
|
4639
|
+
return (0, import_viem8.createClient)({
|
|
4640
|
+
account,
|
|
4641
|
+
chain,
|
|
4642
|
+
name: "Connector Client",
|
|
4643
|
+
transport: (opts) => (0, import_viem8.custom)(provider)({ ...opts, retryCount: 0 })
|
|
4644
|
+
});
|
|
4645
|
+
}
|
|
4646
|
+
|
|
4647
|
+
// node_modules/@wagmi/core/dist/esm/exports/index.js
|
|
4648
|
+
var import_viem9 = require("viem");
|
|
4649
|
+
|
|
4650
|
+
// src/hooks/useEthersSigner.ts
|
|
4651
|
+
function clientToSigner(client) {
|
|
4652
|
+
const { account, chain, transport } = client;
|
|
4653
|
+
const network = {
|
|
4654
|
+
chainId: chain.id,
|
|
4655
|
+
name: chain.name,
|
|
4656
|
+
ensAddress: chain.contracts?.ensRegistry?.address
|
|
4356
4657
|
};
|
|
4357
|
-
|
|
4658
|
+
const provider = new import_ethers.providers.Web3Provider(transport, network);
|
|
4659
|
+
const signer = provider.getSigner(account.address);
|
|
4660
|
+
return signer;
|
|
4661
|
+
}
|
|
4662
|
+
async function getEthersSigner(config, { chainId } = {}) {
|
|
4663
|
+
const client = await getConnectorClient(config, { chainId });
|
|
4664
|
+
return clientToSigner(client);
|
|
4665
|
+
}
|
|
4358
4666
|
|
|
4359
|
-
// src/components/
|
|
4667
|
+
// src/components/EVMModal/index.tsx
|
|
4668
|
+
var import_siwe = require("siwe");
|
|
4669
|
+
var import_styles = require("@rainbow-me/rainbowkit/styles.css");
|
|
4360
4670
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
4361
|
-
function
|
|
4362
|
-
type = "login",
|
|
4671
|
+
function WalletContent({
|
|
4363
4672
|
onSuccess,
|
|
4364
|
-
|
|
4673
|
+
type
|
|
4674
|
+
}) {
|
|
4675
|
+
const config = (0, import_wagmi2.useConfig)();
|
|
4676
|
+
const { openConnectModal, connectModalOpen } = (0, import_rainbowkit.useConnectModal)();
|
|
4677
|
+
const { address, connector, isConnected } = (0, import_wagmi2.useAccount)();
|
|
4678
|
+
const { disconnectAsync } = (0, import_wagmi2.useDisconnect)({ config });
|
|
4679
|
+
const chainId = (0, import_wagmi2.useChainId)();
|
|
4680
|
+
const { events, login } = useMatch();
|
|
4681
|
+
const [inited, setInited] = (0, import_react23.useState)(false);
|
|
4682
|
+
const { status, setStatus, error, setError, statusRef, nonce, setNonce, init } = useWalletBox({
|
|
4683
|
+
onInit: async ({ setStatus: setStatus2 }) => {
|
|
4684
|
+
setStatus2("start");
|
|
4685
|
+
}
|
|
4686
|
+
});
|
|
4687
|
+
(0, import_react23.useEffect)(() => {
|
|
4688
|
+
matchlog_default.log(`status=${status}`, `connectModalOpen=${connectModalOpen}`, `address=${address}`, `isConnected=${isConnected}`);
|
|
4689
|
+
}, [status, connectModalOpen, isConnected, address]);
|
|
4690
|
+
(0, import_react23.useEffect)(() => {
|
|
4691
|
+
if (connectModalOpen) {
|
|
4692
|
+
setStatus("connecting");
|
|
4693
|
+
return;
|
|
4694
|
+
}
|
|
4695
|
+
if (!connectModalOpen && address) {
|
|
4696
|
+
toLoginInWallet(address);
|
|
4697
|
+
return;
|
|
4698
|
+
}
|
|
4699
|
+
if (!connectModalOpen && !address) {
|
|
4700
|
+
setStatus("start");
|
|
4701
|
+
}
|
|
4702
|
+
}, [connectModalOpen, address]);
|
|
4703
|
+
(0, import_react23.useEffect)(() => {
|
|
4704
|
+
if (openConnectModal && !isConnected && !inited) {
|
|
4705
|
+
openConnectModal && openConnectModal();
|
|
4706
|
+
setInited(true);
|
|
4707
|
+
}
|
|
4708
|
+
}, [openConnectModal, inited]);
|
|
4709
|
+
const toLoginInWallet = async (address2) => {
|
|
4710
|
+
if (statusRef.current != "start" && statusRef.current != "connecting") return;
|
|
4711
|
+
try {
|
|
4712
|
+
if (!address2) {
|
|
4713
|
+
throw new Error("Wallet address is empty");
|
|
4714
|
+
}
|
|
4715
|
+
setStatus("nonce");
|
|
4716
|
+
const res = type == "bind" ? await getWalletInitApi({
|
|
4717
|
+
address: address2,
|
|
4718
|
+
type: "EVM"
|
|
4719
|
+
}) : await getWalletNonceApi({ address: address2, type: "EVM" });
|
|
4720
|
+
if (!isSuccess(res)) {
|
|
4721
|
+
throw new Error(res.message);
|
|
4722
|
+
}
|
|
4723
|
+
setNonce(res.data.nonce);
|
|
4724
|
+
} catch (error2) {
|
|
4725
|
+
console.error("toLoginInWallet", error2);
|
|
4726
|
+
setStatus("error");
|
|
4727
|
+
setError(error2.message);
|
|
4728
|
+
}
|
|
4729
|
+
};
|
|
4730
|
+
const signature = (0, import_react23.useCallback)(async () => {
|
|
4731
|
+
if (!nonce || status != "nonce") {
|
|
4732
|
+
return;
|
|
4733
|
+
}
|
|
4734
|
+
try {
|
|
4735
|
+
const signer = await getEthersSigner(config);
|
|
4736
|
+
if (!signer) return;
|
|
4737
|
+
matchlog_default.log("signature", nonce, status);
|
|
4738
|
+
if (!address) {
|
|
4739
|
+
throw new Error("Wallet address is empty");
|
|
4740
|
+
}
|
|
4741
|
+
setStatus("signer");
|
|
4742
|
+
const params = {
|
|
4743
|
+
domain: window.location.host,
|
|
4744
|
+
address,
|
|
4745
|
+
statement: "By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",
|
|
4746
|
+
uri: window.location.origin,
|
|
4747
|
+
nonce,
|
|
4748
|
+
version: "1",
|
|
4749
|
+
chainId
|
|
4750
|
+
};
|
|
4751
|
+
const message = new import_siwe.SiweMessage({ ...params });
|
|
4752
|
+
const signature2 = await signer.signMessage(message.prepareMessage());
|
|
4753
|
+
const obj = {
|
|
4754
|
+
type: "EVM",
|
|
4755
|
+
address,
|
|
4756
|
+
signature: signature2,
|
|
4757
|
+
message: `${message.prepareMessage()}`,
|
|
4758
|
+
connector_type: connector?.type || "",
|
|
4759
|
+
wallet_client_type: connector?.name || ""
|
|
4760
|
+
};
|
|
4761
|
+
const res = type == "bind" ? await toBindWalletApi(obj) : await loginByWalletApi(obj);
|
|
4762
|
+
if (!isSuccess(res)) {
|
|
4763
|
+
throw new Error(res.message);
|
|
4764
|
+
}
|
|
4765
|
+
matchlog_default.log(res);
|
|
4766
|
+
setStatus("success");
|
|
4767
|
+
if (type == "bind") {
|
|
4768
|
+
events.onBind && events.onBind({
|
|
4769
|
+
type: "evm"
|
|
4770
|
+
});
|
|
4771
|
+
eventManager_default.emit("onBind", {
|
|
4772
|
+
type: "evm"
|
|
4773
|
+
});
|
|
4774
|
+
} else {
|
|
4775
|
+
await login({
|
|
4776
|
+
token: `${res.data.token_type} ${res.data.access_token}`
|
|
4777
|
+
});
|
|
4778
|
+
}
|
|
4779
|
+
onSuccess && onSuccess();
|
|
4780
|
+
} catch (error2) {
|
|
4781
|
+
console.error("signature", error2);
|
|
4782
|
+
setStatus("error");
|
|
4783
|
+
setError(error2.message);
|
|
4784
|
+
}
|
|
4785
|
+
}, [nonce, status, address]);
|
|
4786
|
+
(0, import_react23.useEffect)(() => {
|
|
4787
|
+
if (signature) {
|
|
4788
|
+
signature();
|
|
4789
|
+
}
|
|
4790
|
+
}, [signature]);
|
|
4791
|
+
const onError = async () => {
|
|
4792
|
+
if (isConnected) {
|
|
4793
|
+
try {
|
|
4794
|
+
await disconnectAsync();
|
|
4795
|
+
} catch (error2) {
|
|
4796
|
+
console.error("disconnectAsync", error2);
|
|
4797
|
+
}
|
|
4798
|
+
}
|
|
4799
|
+
setError("");
|
|
4800
|
+
setNonce(void 0);
|
|
4801
|
+
setStatus("start");
|
|
4802
|
+
openConnectModal?.();
|
|
4803
|
+
};
|
|
4804
|
+
const onConnect = async () => {
|
|
4805
|
+
if (isConnected) {
|
|
4806
|
+
try {
|
|
4807
|
+
await disconnectAsync();
|
|
4808
|
+
} catch (error2) {
|
|
4809
|
+
console.error("disconnectAsync", error2);
|
|
4810
|
+
}
|
|
4811
|
+
}
|
|
4812
|
+
setError("");
|
|
4813
|
+
setNonce(void 0);
|
|
4814
|
+
openConnectModal?.();
|
|
4815
|
+
};
|
|
4816
|
+
const onDisconnect = async () => {
|
|
4817
|
+
if (isConnected) {
|
|
4818
|
+
try {
|
|
4819
|
+
await disconnectAsync();
|
|
4820
|
+
} catch (error2) {
|
|
4821
|
+
console.error("disconnectAsync", error2);
|
|
4822
|
+
}
|
|
4823
|
+
}
|
|
4824
|
+
setError("");
|
|
4825
|
+
setNonce(void 0);
|
|
4826
|
+
setStatus("start");
|
|
4827
|
+
};
|
|
4828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
4829
|
+
WalletModalContentV2,
|
|
4830
|
+
{
|
|
4831
|
+
status,
|
|
4832
|
+
onSuccess: async () => onSuccess?.(),
|
|
4833
|
+
error,
|
|
4834
|
+
onError,
|
|
4835
|
+
onConnect,
|
|
4836
|
+
onDisconnect
|
|
4837
|
+
}
|
|
4838
|
+
);
|
|
4839
|
+
}
|
|
4840
|
+
var wagmiConfig = (0, import_rainbowkit.getDefaultConfig)({
|
|
4841
|
+
appName: "MatchID",
|
|
4842
|
+
projectId: "9ac6ea7e07860f04616fb311b447dee9",
|
|
4843
|
+
wallets: [
|
|
4844
|
+
{
|
|
4845
|
+
groupName: "Recommended",
|
|
4846
|
+
wallets: [
|
|
4847
|
+
import_wallets.metaMaskWallet,
|
|
4848
|
+
import_wallets.walletConnectWallet,
|
|
4849
|
+
import_wallets.okxWallet,
|
|
4850
|
+
import_wallets.bitgetWallet,
|
|
4851
|
+
import_wallets.injectedWallet
|
|
4852
|
+
]
|
|
4853
|
+
}
|
|
4854
|
+
],
|
|
4855
|
+
chains: [import_chains.mainnet, import_chains.polygon, import_chains.optimism, import_chains.arbitrum, import_chains.base, matchMain, matchTest, import_chains.bsc]
|
|
4856
|
+
});
|
|
4857
|
+
function EVMConnectModal({
|
|
4858
|
+
type = "login",
|
|
4859
|
+
onSuccess,
|
|
4860
|
+
...props
|
|
4365
4861
|
}) {
|
|
4366
|
-
const isDownMd = useDownMd();
|
|
4367
4862
|
const intl = (0, import_react_intl10.useIntl)();
|
|
4863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
4864
|
+
id: type == "bind" ? "bindWith" : "loginWith"
|
|
4865
|
+
}, {
|
|
4866
|
+
name: "EVM"
|
|
4867
|
+
}), children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_wagmi2.WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_rainbowkit.RainbowKitProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(WalletContent, { onSuccess, type }) }) }) });
|
|
4868
|
+
}
|
|
4869
|
+
function EVMModal(props) {
|
|
4870
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(EVMConnectModal, { ...props });
|
|
4871
|
+
}
|
|
4872
|
+
|
|
4873
|
+
// src/components/TRONModal/index.tsx
|
|
4874
|
+
var import_react25 = __toESM(require("react"));
|
|
4875
|
+
var import_react_intl11 = require("react-intl");
|
|
4876
|
+
|
|
4877
|
+
// src/lib/tron/TronLinkAdapter.ts
|
|
4878
|
+
var TronLinkAdapter = class {
|
|
4879
|
+
constructor() {
|
|
4880
|
+
this.name = "TronLink Wallet";
|
|
4881
|
+
this.website = "https://www.tronlink.org/";
|
|
4882
|
+
this.walletKey = "tronlink";
|
|
4883
|
+
}
|
|
4884
|
+
async isInstalled() {
|
|
4885
|
+
return typeof window.tronWeb !== "undefined" && typeof window.tronLink !== "undefined";
|
|
4886
|
+
}
|
|
4887
|
+
async connect() {
|
|
4888
|
+
if (!await this.isInstalled()) throw new Error("TronLink Wallet is not installed");
|
|
4889
|
+
if (!window.tronWeb.defaultAddress.base58) {
|
|
4890
|
+
await window.tronWeb.request(
|
|
4891
|
+
{
|
|
4892
|
+
method: "tron_requestAccounts",
|
|
4893
|
+
params: window.tronLink.tronlinkParams
|
|
4894
|
+
}
|
|
4895
|
+
);
|
|
4896
|
+
}
|
|
4897
|
+
if (!window.tronWeb.defaultAddress.base58) {
|
|
4898
|
+
throw new Error("Your should unlink your wallet and try again");
|
|
4899
|
+
}
|
|
4900
|
+
return window.tronWeb.defaultAddress.base58;
|
|
4901
|
+
}
|
|
4902
|
+
async signMessage(message) {
|
|
4903
|
+
return await window.tronWeb.trx.signMessageV2(message);
|
|
4904
|
+
}
|
|
4905
|
+
};
|
|
4906
|
+
|
|
4907
|
+
// src/hooks/useTRONWallet.ts
|
|
4908
|
+
var import_react24 = require("react");
|
|
4909
|
+
|
|
4910
|
+
// src/lib/tron/BitgetAdapter.ts
|
|
4911
|
+
var BitgetAdapter = class {
|
|
4912
|
+
constructor() {
|
|
4913
|
+
this.name = "Bitget Wallet";
|
|
4914
|
+
this.website = "https://web3.bitget.com/zh-CN/wallet-download";
|
|
4915
|
+
this.walletKey = "bitget";
|
|
4916
|
+
}
|
|
4917
|
+
async isInstalled() {
|
|
4918
|
+
return typeof window.bitkeep !== "undefined" && typeof window.bitkeep.tronWeb !== "undefined" && typeof window.bitkeep.tronLink !== "undefined";
|
|
4919
|
+
}
|
|
4920
|
+
async connect() {
|
|
4921
|
+
if (!await this.isInstalled()) throw new Error("Bitkeep Wallet is not installed");
|
|
4922
|
+
await window.bitkeep.tronLink.request({ method: "tron_requestAccounts" });
|
|
4923
|
+
return window.bitkeep.tronWeb.defaultAddress.base58;
|
|
4924
|
+
}
|
|
4925
|
+
async signMessage(message) {
|
|
4926
|
+
return await window.bitkeep.tronWeb.trx.signMessageV2(message);
|
|
4927
|
+
}
|
|
4928
|
+
};
|
|
4929
|
+
|
|
4930
|
+
// src/lib/tron/OKXAdapter.ts
|
|
4931
|
+
var OKXAdapter = class {
|
|
4932
|
+
constructor() {
|
|
4933
|
+
this.name = "OKX Wallet";
|
|
4934
|
+
this.website = "https://www.okx.com/zh-hans/download";
|
|
4935
|
+
this.walletKey = "okx";
|
|
4936
|
+
}
|
|
4937
|
+
async isInstalled() {
|
|
4938
|
+
return typeof window.okxwallet !== "undefined" && typeof window.okxwallet.tronWeb !== "undefined" && typeof window.okxwallet.tronLink !== "undefined";
|
|
4939
|
+
}
|
|
4940
|
+
async connect() {
|
|
4941
|
+
if (!await this.isInstalled()) throw new Error("OKX Wallet is not installed");
|
|
4942
|
+
await window.okxwallet.tronLink.request({ method: "tron_requestAccounts" });
|
|
4943
|
+
return window.okxwallet.tronWeb.defaultAddress.base58;
|
|
4944
|
+
}
|
|
4945
|
+
async signMessage(message) {
|
|
4946
|
+
return await window.okxwallet.tronWeb.trx.signMessageV2(message);
|
|
4947
|
+
}
|
|
4948
|
+
};
|
|
4949
|
+
|
|
4950
|
+
// src/hooks/useTRONWallet.ts
|
|
4951
|
+
var useTRONWallet = () => {
|
|
4952
|
+
const wallets = [new TronLinkAdapter(), new BitgetAdapter(), new OKXAdapter()];
|
|
4953
|
+
const [installedWallets, setInstalledWallets] = (0, import_react24.useState)([]);
|
|
4954
|
+
const [address, setAddress] = (0, import_react24.useState)(null);
|
|
4955
|
+
(0, import_react24.useEffect)(() => {
|
|
4956
|
+
const getInstalled = async () => {
|
|
4957
|
+
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
4958
|
+
wallet: wallet2,
|
|
4959
|
+
isInstalled
|
|
4960
|
+
}))));
|
|
4961
|
+
setInstalledWallets(installed.filter(({ isInstalled }) => isInstalled).map(({ wallet: wallet2 }) => wallet2));
|
|
4962
|
+
};
|
|
4963
|
+
getInstalled();
|
|
4964
|
+
}, []);
|
|
4965
|
+
const [wallet, chooseWallet] = (0, import_react24.useState)(null);
|
|
4966
|
+
const onConnect = async () => {
|
|
4967
|
+
setAddress(await wallet.connect());
|
|
4968
|
+
};
|
|
4969
|
+
(0, import_react24.useEffect)(() => {
|
|
4970
|
+
if (!wallet) {
|
|
4971
|
+
setAddress(null);
|
|
4972
|
+
}
|
|
4973
|
+
}, [wallet]);
|
|
4974
|
+
return {
|
|
4975
|
+
installedWallets,
|
|
4976
|
+
wallets,
|
|
4977
|
+
chooseWallet,
|
|
4978
|
+
wallet,
|
|
4979
|
+
address,
|
|
4980
|
+
onConnect
|
|
4981
|
+
};
|
|
4982
|
+
};
|
|
4983
|
+
|
|
4984
|
+
// src/components/TRONModal/index.tsx
|
|
4985
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
4986
|
+
function TRONConnectModal({
|
|
4987
|
+
type = "login",
|
|
4988
|
+
onSuccess,
|
|
4989
|
+
...props
|
|
4990
|
+
}) {
|
|
4991
|
+
const isDownMd = useDownMd();
|
|
4992
|
+
const intl = (0, import_react_intl11.useIntl)();
|
|
4368
4993
|
const { wallets, installedWallets, chooseWallet, wallet, address, onConnect } = useTRONWallet();
|
|
4369
4994
|
const iconMaps = {
|
|
4370
|
-
tronlink: /* @__PURE__ */ (0,
|
|
4371
|
-
bitget: /* @__PURE__ */ (0,
|
|
4372
|
-
okx: /* @__PURE__ */ (0,
|
|
4995
|
+
tronlink: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(TronLinkIcon, { size: isDownMd ? 36 : 40 }),
|
|
4996
|
+
bitget: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(BitgetIcon, { size: isDownMd ? 36 : 40 }),
|
|
4997
|
+
okx: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(OKXIcon, { size: isDownMd ? 36 : 40 })
|
|
4373
4998
|
};
|
|
4374
4999
|
const { events, login } = useMatch();
|
|
4375
|
-
const [status, setStatus] = (0,
|
|
4376
|
-
const statusRef =
|
|
4377
|
-
const [error, setError] = (0,
|
|
4378
|
-
const connected = (0,
|
|
5000
|
+
const [status, setStatus] = (0, import_react25.useState)("");
|
|
5001
|
+
const statusRef = import_react25.default.useRef(status);
|
|
5002
|
+
const [error, setError] = (0, import_react25.useState)("");
|
|
5003
|
+
const connected = (0, import_react25.useMemo)(() => {
|
|
4379
5004
|
return !!address;
|
|
4380
5005
|
}, [address]);
|
|
4381
5006
|
const disconnect = async () => {
|
|
@@ -4443,7 +5068,7 @@ function TRONConnectModal({
|
|
|
4443
5068
|
statusRef.current = "";
|
|
4444
5069
|
}
|
|
4445
5070
|
};
|
|
4446
|
-
(0,
|
|
5071
|
+
(0, import_react25.useEffect)(() => {
|
|
4447
5072
|
if (wallet) {
|
|
4448
5073
|
console.log("onConnect");
|
|
4449
5074
|
onConnect();
|
|
@@ -4451,21 +5076,21 @@ function TRONConnectModal({
|
|
|
4451
5076
|
setStatus("");
|
|
4452
5077
|
}
|
|
4453
5078
|
}, [wallet]);
|
|
4454
|
-
(0,
|
|
5079
|
+
(0, import_react25.useEffect)(() => {
|
|
4455
5080
|
if (address) {
|
|
4456
5081
|
toLoginInWallet();
|
|
4457
5082
|
}
|
|
4458
5083
|
}, [address]);
|
|
4459
|
-
(0,
|
|
5084
|
+
(0, import_react25.useEffect)(() => {
|
|
4460
5085
|
if (!props.isOpen) {
|
|
4461
5086
|
disconnect();
|
|
4462
5087
|
}
|
|
4463
5088
|
}, [props.isOpen]);
|
|
4464
|
-
return /* @__PURE__ */ (0,
|
|
5089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
4465
5090
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
4466
5091
|
}, {
|
|
4467
5092
|
name: "TRON"
|
|
4468
|
-
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0,
|
|
5093
|
+
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
4469
5094
|
WalletModalContent,
|
|
4470
5095
|
{
|
|
4471
5096
|
error,
|
|
@@ -4478,9 +5103,9 @@ function TRONConnectModal({
|
|
|
4478
5103
|
setVisible: () => {
|
|
4479
5104
|
}
|
|
4480
5105
|
}
|
|
4481
|
-
) : /* @__PURE__ */ (0,
|
|
5106
|
+
) : /* @__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: [
|
|
4482
5107
|
installedWallets.map((wallet2) => {
|
|
4483
|
-
return /* @__PURE__ */ (0,
|
|
5108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
4484
5109
|
RecommendItem,
|
|
4485
5110
|
{
|
|
4486
5111
|
icon: iconMaps[wallet2.walletKey],
|
|
@@ -4493,14 +5118,14 @@ function TRONConnectModal({
|
|
|
4493
5118
|
);
|
|
4494
5119
|
}),
|
|
4495
5120
|
wallets.filter((wallet2) => !installedWallets.find((installedWallet) => installedWallet.walletKey == wallet2.walletKey)).map((wallet2) => {
|
|
4496
|
-
return /* @__PURE__ */ (0,
|
|
5121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
4497
5122
|
RecommendItem,
|
|
4498
5123
|
{
|
|
4499
5124
|
icon: iconMaps[wallet2.walletKey],
|
|
4500
5125
|
name: wallet2.name,
|
|
4501
5126
|
onClick: () => {
|
|
4502
5127
|
},
|
|
4503
|
-
footer: /* @__PURE__ */ (0,
|
|
5128
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Button, { size: "sm", onClick: () => {
|
|
4504
5129
|
window.open(wallet2.website);
|
|
4505
5130
|
}, children: "Install" })
|
|
4506
5131
|
},
|
|
@@ -4510,28 +5135,28 @@ function TRONConnectModal({
|
|
|
4510
5135
|
] }) }) });
|
|
4511
5136
|
}
|
|
4512
5137
|
function TRONModal(props) {
|
|
4513
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
5138
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(TRONConnectModal, { ...props, type: props.type });
|
|
4514
5139
|
}
|
|
4515
5140
|
|
|
4516
5141
|
// src/components/TONModal/index.tsx
|
|
4517
|
-
var
|
|
4518
|
-
var
|
|
5142
|
+
var import_react26 = __toESM(require("react"));
|
|
5143
|
+
var import_react_intl12 = require("react-intl");
|
|
4519
5144
|
var import_ui_react = require("@tonconnect/ui-react");
|
|
4520
|
-
var
|
|
4521
|
-
function
|
|
5145
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
5146
|
+
function WalletContent2({
|
|
4522
5147
|
onSuccess,
|
|
4523
5148
|
type
|
|
4524
5149
|
}) {
|
|
4525
5150
|
const { events, login } = useMatch();
|
|
4526
|
-
const [connected, setConnected] = (0,
|
|
5151
|
+
const [connected, setConnected] = (0, import_react26.useState)(false);
|
|
4527
5152
|
const wallet = (0, import_ui_react.useTonWallet)();
|
|
4528
5153
|
const userFriendlyAddress = (0, import_ui_react.useTonAddress)();
|
|
4529
5154
|
const [tonConnectUI] = (0, import_ui_react.useTonConnectUI)();
|
|
4530
5155
|
const { state, open, close } = (0, import_ui_react.useTonConnectModal)();
|
|
4531
|
-
const [status, setStatus] = (0,
|
|
4532
|
-
const statusRef =
|
|
4533
|
-
const [error, setError] = (0,
|
|
4534
|
-
(0,
|
|
5156
|
+
const [status, setStatus] = (0, import_react26.useState)("");
|
|
5157
|
+
const statusRef = import_react26.default.useRef(status);
|
|
5158
|
+
const [error, setError] = (0, import_react26.useState)("");
|
|
5159
|
+
(0, import_react26.useEffect)(() => {
|
|
4535
5160
|
const init = async () => {
|
|
4536
5161
|
if (tonConnectUI.connected) {
|
|
4537
5162
|
await tonConnectUI.disconnect();
|
|
@@ -4604,7 +5229,7 @@ function WalletContent({
|
|
|
4604
5229
|
}
|
|
4605
5230
|
});
|
|
4606
5231
|
}, []);
|
|
4607
|
-
(0,
|
|
5232
|
+
(0, import_react26.useEffect)(() => {
|
|
4608
5233
|
if (wallet) {
|
|
4609
5234
|
setConnected(true);
|
|
4610
5235
|
console.log("Wallet connected:", wallet);
|
|
@@ -4615,7 +5240,7 @@ function WalletContent({
|
|
|
4615
5240
|
setStatus("");
|
|
4616
5241
|
}
|
|
4617
5242
|
}, [wallet]);
|
|
4618
|
-
(0,
|
|
5243
|
+
(0, import_react26.useEffect)(() => {
|
|
4619
5244
|
console.log({
|
|
4620
5245
|
state,
|
|
4621
5246
|
wallet
|
|
@@ -4644,7 +5269,7 @@ function WalletContent({
|
|
|
4644
5269
|
}
|
|
4645
5270
|
}
|
|
4646
5271
|
}, [state]);
|
|
4647
|
-
return /* @__PURE__ */ (0,
|
|
5272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
4648
5273
|
WalletModalContent,
|
|
4649
5274
|
{
|
|
4650
5275
|
connected,
|
|
@@ -4675,28 +5300,28 @@ function TONConnectModal({
|
|
|
4675
5300
|
onSuccess,
|
|
4676
5301
|
...props
|
|
4677
5302
|
}) {
|
|
4678
|
-
const intl = (0,
|
|
5303
|
+
const intl = (0, import_react_intl12.useIntl)();
|
|
4679
5304
|
const { endpoints, appid } = useLocalStore_default();
|
|
4680
5305
|
const manifestUrl = `${endpoints.back}api/v1/wallet/ton?appid=${appid}&url=` + encodeURIComponent(window.location.origin);
|
|
4681
|
-
return /* @__PURE__ */ (0,
|
|
5306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
4682
5307
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
4683
5308
|
}, {
|
|
4684
5309
|
name: "TON"
|
|
4685
|
-
}), children: /* @__PURE__ */ (0,
|
|
5310
|
+
}), children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
4686
5311
|
import_ui_react.TonConnectUIProvider,
|
|
4687
5312
|
{
|
|
4688
5313
|
manifestUrl,
|
|
4689
|
-
children: /* @__PURE__ */ (0,
|
|
5314
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(WalletContent2, { onSuccess, type })
|
|
4690
5315
|
}
|
|
4691
5316
|
) });
|
|
4692
5317
|
}
|
|
4693
5318
|
function TONModal(props) {
|
|
4694
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
5319
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(TONConnectModal, { ...props });
|
|
4695
5320
|
}
|
|
4696
5321
|
|
|
4697
5322
|
// src/components/BTCModal/index.tsx
|
|
4698
|
-
var
|
|
4699
|
-
var
|
|
5323
|
+
var import_react28 = __toESM(require("react"));
|
|
5324
|
+
var import_react_intl13 = require("react-intl");
|
|
4700
5325
|
|
|
4701
5326
|
// src/lib/btc/UnisatAdapter.ts
|
|
4702
5327
|
var UnisatAdapter = class {
|
|
@@ -4844,7 +5469,7 @@ var LeatherAdapter = class {
|
|
|
4844
5469
|
};
|
|
4845
5470
|
|
|
4846
5471
|
// src/hooks/useBTCWallet.ts
|
|
4847
|
-
var
|
|
5472
|
+
var import_react27 = require("react");
|
|
4848
5473
|
|
|
4849
5474
|
// src/lib/btc/PhantomAdapter.ts
|
|
4850
5475
|
var PhantomAdapter = class {
|
|
@@ -4882,9 +5507,9 @@ var PhantomAdapter = class {
|
|
|
4882
5507
|
// src/hooks/useBTCWallet.ts
|
|
4883
5508
|
var useBTCWallet = () => {
|
|
4884
5509
|
const wallets = [new UnisatAdapter(), new XverseAdapter(), new LeatherAdapter(), new PhantomAdapter()];
|
|
4885
|
-
const [installedWallets, setInstalledWallets] = (0,
|
|
4886
|
-
const [address, setAddress] = (0,
|
|
4887
|
-
(0,
|
|
5510
|
+
const [installedWallets, setInstalledWallets] = (0, import_react27.useState)([]);
|
|
5511
|
+
const [address, setAddress] = (0, import_react27.useState)(null);
|
|
5512
|
+
(0, import_react27.useEffect)(() => {
|
|
4888
5513
|
const getInstalled = async () => {
|
|
4889
5514
|
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
4890
5515
|
wallet: wallet2,
|
|
@@ -4894,11 +5519,11 @@ var useBTCWallet = () => {
|
|
|
4894
5519
|
};
|
|
4895
5520
|
getInstalled();
|
|
4896
5521
|
}, []);
|
|
4897
|
-
const [wallet, chooseWallet] = (0,
|
|
5522
|
+
const [wallet, chooseWallet] = (0, import_react27.useState)(null);
|
|
4898
5523
|
const onConnect = async () => {
|
|
4899
5524
|
setAddress(await wallet.connect());
|
|
4900
5525
|
};
|
|
4901
|
-
(0,
|
|
5526
|
+
(0, import_react27.useEffect)(() => {
|
|
4902
5527
|
if (!wallet) {
|
|
4903
5528
|
setAddress(null);
|
|
4904
5529
|
}
|
|
@@ -4914,26 +5539,26 @@ var useBTCWallet = () => {
|
|
|
4914
5539
|
};
|
|
4915
5540
|
|
|
4916
5541
|
// src/components/BTCModal/index.tsx
|
|
4917
|
-
var
|
|
5542
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
4918
5543
|
function BTCConnectModal({
|
|
4919
5544
|
type = "login",
|
|
4920
5545
|
onSuccess,
|
|
4921
5546
|
...props
|
|
4922
5547
|
}) {
|
|
4923
5548
|
const isDownMd = useDownMd();
|
|
4924
|
-
const intl = (0,
|
|
5549
|
+
const intl = (0, import_react_intl13.useIntl)();
|
|
4925
5550
|
const { wallets, installedWallets, chooseWallet, wallet, address, onConnect } = useBTCWallet();
|
|
4926
5551
|
const iconMaps = {
|
|
4927
|
-
leather: /* @__PURE__ */ (0,
|
|
4928
|
-
unisat: /* @__PURE__ */ (0,
|
|
4929
|
-
xverse: /* @__PURE__ */ (0,
|
|
4930
|
-
phantom: /* @__PURE__ */ (0,
|
|
5552
|
+
leather: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(LeatherIcon, { size: isDownMd ? 36 : 40 }),
|
|
5553
|
+
unisat: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(UnisatIcon, { size: isDownMd ? 36 : 40 }),
|
|
5554
|
+
xverse: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(XverseIcon, { size: isDownMd ? 36 : 40 }),
|
|
5555
|
+
phantom: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(PhantomIcon, { size: isDownMd ? 36 : 40 })
|
|
4931
5556
|
};
|
|
4932
5557
|
const { events, login } = useMatch();
|
|
4933
|
-
const [status, setStatus] = (0,
|
|
4934
|
-
const statusRef =
|
|
4935
|
-
const [error, setError] = (0,
|
|
4936
|
-
const connected = (0,
|
|
5558
|
+
const [status, setStatus] = (0, import_react28.useState)("");
|
|
5559
|
+
const statusRef = import_react28.default.useRef(status);
|
|
5560
|
+
const [error, setError] = (0, import_react28.useState)("");
|
|
5561
|
+
const connected = (0, import_react28.useMemo)(() => {
|
|
4937
5562
|
return !!address;
|
|
4938
5563
|
}, [address]);
|
|
4939
5564
|
const disconnect = async () => {
|
|
@@ -4997,7 +5622,7 @@ function BTCConnectModal({
|
|
|
4997
5622
|
statusRef.current = "";
|
|
4998
5623
|
}
|
|
4999
5624
|
};
|
|
5000
|
-
(0,
|
|
5625
|
+
(0, import_react28.useEffect)(() => {
|
|
5001
5626
|
if (wallet) {
|
|
5002
5627
|
console.log("onConnect");
|
|
5003
5628
|
try {
|
|
@@ -5010,12 +5635,12 @@ function BTCConnectModal({
|
|
|
5010
5635
|
setStatus("");
|
|
5011
5636
|
}
|
|
5012
5637
|
}, [wallet]);
|
|
5013
|
-
(0,
|
|
5638
|
+
(0, import_react28.useEffect)(() => {
|
|
5014
5639
|
if (address) {
|
|
5015
5640
|
toLoginInWallet();
|
|
5016
5641
|
}
|
|
5017
5642
|
}, [address]);
|
|
5018
|
-
(0,
|
|
5643
|
+
(0, import_react28.useEffect)(() => {
|
|
5019
5644
|
if (!props.isOpen) {
|
|
5020
5645
|
disconnect();
|
|
5021
5646
|
}
|
|
@@ -5027,11 +5652,11 @@ function BTCConnectModal({
|
|
|
5027
5652
|
statusRef.current = "";
|
|
5028
5653
|
setError("");
|
|
5029
5654
|
};
|
|
5030
|
-
return /* @__PURE__ */ (0,
|
|
5655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5031
5656
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5032
5657
|
}, {
|
|
5033
5658
|
name: "BTC"
|
|
5034
|
-
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0,
|
|
5659
|
+
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
5035
5660
|
WalletModalContent,
|
|
5036
5661
|
{
|
|
5037
5662
|
error,
|
|
@@ -5044,9 +5669,9 @@ function BTCConnectModal({
|
|
|
5044
5669
|
setVisible: () => {
|
|
5045
5670
|
}
|
|
5046
5671
|
}
|
|
5047
|
-
) : /* @__PURE__ */ (0,
|
|
5672
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "matchid-login-box", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "matchid-login-recommend-list", children: [
|
|
5048
5673
|
installedWallets.map((wallet2) => {
|
|
5049
|
-
return /* @__PURE__ */ (0,
|
|
5674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
5050
5675
|
RecommendItem,
|
|
5051
5676
|
{
|
|
5052
5677
|
icon: iconMaps[wallet2.walletKey],
|
|
@@ -5059,14 +5684,14 @@ function BTCConnectModal({
|
|
|
5059
5684
|
);
|
|
5060
5685
|
}),
|
|
5061
5686
|
wallets.filter((wallet2) => !installedWallets.find((installedWallet) => installedWallet.walletKey == wallet2.walletKey)).map((wallet2) => {
|
|
5062
|
-
return /* @__PURE__ */ (0,
|
|
5687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
5063
5688
|
RecommendItem,
|
|
5064
5689
|
{
|
|
5065
5690
|
icon: iconMaps[wallet2.walletKey],
|
|
5066
5691
|
name: wallet2.name,
|
|
5067
5692
|
onClick: () => {
|
|
5068
5693
|
},
|
|
5069
|
-
footer: /* @__PURE__ */ (0,
|
|
5694
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Button, { size: "sm", onClick: () => {
|
|
5070
5695
|
window.open(wallet2.website);
|
|
5071
5696
|
}, children: "Install" })
|
|
5072
5697
|
},
|
|
@@ -5076,23 +5701,23 @@ function BTCConnectModal({
|
|
|
5076
5701
|
] }) }) });
|
|
5077
5702
|
}
|
|
5078
5703
|
function BTCModal(props) {
|
|
5079
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
5704
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(BTCConnectModal, { ...props });
|
|
5080
5705
|
}
|
|
5081
5706
|
|
|
5082
5707
|
// src/components/WalletModal/index.tsx
|
|
5083
|
-
var
|
|
5084
|
-
var
|
|
5085
|
-
var
|
|
5708
|
+
var import_react29 = require("react");
|
|
5709
|
+
var import_react_intl14 = require("react-intl");
|
|
5710
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
5086
5711
|
function WalletConnectModal({
|
|
5087
5712
|
type,
|
|
5088
5713
|
methods: _methods,
|
|
5089
5714
|
...props
|
|
5090
5715
|
}) {
|
|
5091
|
-
const intl = (0,
|
|
5716
|
+
const intl = (0, import_react_intl14.useIntl)();
|
|
5092
5717
|
const { walletMap } = useWalletConfig();
|
|
5093
5718
|
const { bind, login } = useUserInfo();
|
|
5094
5719
|
const config = useAppConfig();
|
|
5095
|
-
const methods = (0,
|
|
5720
|
+
const methods = (0, import_react29.useMemo)(() => {
|
|
5096
5721
|
if (_methods) return _methods;
|
|
5097
5722
|
if (!config.platform) {
|
|
5098
5723
|
return [];
|
|
@@ -5100,13 +5725,13 @@ function WalletConnectModal({
|
|
|
5100
5725
|
const platform = config.platform.map((p) => p.toLowerCase());
|
|
5101
5726
|
return WALLET_METHODS.filter((m) => platform.includes(m));
|
|
5102
5727
|
}, [config.platform, _methods]);
|
|
5103
|
-
return /* @__PURE__ */ (0,
|
|
5728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5104
5729
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5105
5730
|
}, {
|
|
5106
5731
|
name: ""
|
|
5107
|
-
}), children: /* @__PURE__ */ (0,
|
|
5732
|
+
}), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "matchid-login-box", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "matchid-login-recommend-list", children: methods.map((method, index) => {
|
|
5108
5733
|
const m = walletMap[method];
|
|
5109
|
-
return /* @__PURE__ */ (0,
|
|
5734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
5110
5735
|
RecommendItem,
|
|
5111
5736
|
{
|
|
5112
5737
|
icon: m?.icon,
|
|
@@ -5120,21 +5745,21 @@ function WalletConnectModal({
|
|
|
5120
5745
|
}) }) }) });
|
|
5121
5746
|
}
|
|
5122
5747
|
function WalletModal(props) {
|
|
5123
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
5748
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(WalletConnectModal, { ...props });
|
|
5124
5749
|
}
|
|
5125
5750
|
|
|
5126
5751
|
// src/components/AlphaAvatar/index.tsx
|
|
5127
|
-
var
|
|
5128
|
-
var
|
|
5752
|
+
var import_react30 = require("react");
|
|
5753
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
5129
5754
|
function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
5130
|
-
const [avatar, setAvatar] = (0,
|
|
5131
|
-
(0,
|
|
5755
|
+
const [avatar, setAvatar] = (0, import_react30.useState)(void 0);
|
|
5756
|
+
(0, import_react30.useEffect)(() => {
|
|
5132
5757
|
if (name) {
|
|
5133
5758
|
const char = name[0].toUpperCase();
|
|
5134
5759
|
setAvatar(char);
|
|
5135
5760
|
}
|
|
5136
5761
|
}, [name]);
|
|
5137
|
-
return /* @__PURE__ */ (0,
|
|
5762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
5138
5763
|
width: size,
|
|
5139
5764
|
height: size,
|
|
5140
5765
|
fontSize: Math.ceil(size / 2)
|
|
@@ -5142,7 +5767,7 @@ function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
|
5142
5767
|
}
|
|
5143
5768
|
|
|
5144
5769
|
// src/components/WalletAsset/index.tsx
|
|
5145
|
-
var
|
|
5770
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
5146
5771
|
function WalletAsset({
|
|
5147
5772
|
onAssetClick,
|
|
5148
5773
|
matchWalletAssetsOptions
|
|
@@ -5152,7 +5777,7 @@ function WalletAsset({
|
|
|
5152
5777
|
list: walletAssets.mergedAssets
|
|
5153
5778
|
});
|
|
5154
5779
|
const { list } = useMatchChain();
|
|
5155
|
-
return /* @__PURE__ */ (0,
|
|
5780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "matchid-wallet-asset-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
5156
5781
|
const clickFunc = onAssetClick && onAssetClick(n);
|
|
5157
5782
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
5158
5783
|
const getFooterColor = () => {
|
|
@@ -5167,11 +5792,11 @@ function WalletAsset({
|
|
|
5167
5792
|
}
|
|
5168
5793
|
return "";
|
|
5169
5794
|
};
|
|
5170
|
-
return /* @__PURE__ */ (0,
|
|
5795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-wallet-asset-item`, onClick: clickFunc, style: {
|
|
5171
5796
|
cursor: clickFunc ? "pointer" : "default"
|
|
5172
5797
|
}, children: [
|
|
5173
|
-
/* @__PURE__ */ (0,
|
|
5174
|
-
n.icon ? /* @__PURE__ */ (0,
|
|
5798
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "matchid-wallet-asset-logo", title: n.symbol || n.name || "", children: [
|
|
5799
|
+
n.icon ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("img", { src: n.icon, alt: n.symbol, className: `matchid-wallet-asset-icon` }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
5175
5800
|
AlphaAvatar2,
|
|
5176
5801
|
{
|
|
5177
5802
|
className: `matchid-wallet-asset-icon`,
|
|
@@ -5179,12 +5804,12 @@ function WalletAsset({
|
|
|
5179
5804
|
name: n.symbol || n.name || ""
|
|
5180
5805
|
}
|
|
5181
5806
|
),
|
|
5182
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
5807
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-wallet-asset-chain` })
|
|
5183
5808
|
] }),
|
|
5184
|
-
/* @__PURE__ */ (0,
|
|
5185
|
-
/* @__PURE__ */ (0,
|
|
5186
|
-
"price" in n && /* @__PURE__ */ (0,
|
|
5187
|
-
/* @__PURE__ */ (0,
|
|
5809
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-wallet-asset-info`, children: [
|
|
5810
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: `matchid-wallet-asset-name`, children: n.symbol }),
|
|
5811
|
+
"price" in n && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-wallet-asset-content`, children: [
|
|
5812
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "matchid-wallet-asset-price", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
5188
5813
|
NumberFormatter,
|
|
5189
5814
|
{
|
|
5190
5815
|
value: n.price,
|
|
@@ -5192,7 +5817,7 @@ function WalletAsset({
|
|
|
5192
5817
|
tFixNum: 2
|
|
5193
5818
|
}
|
|
5194
5819
|
) }),
|
|
5195
|
-
/* @__PURE__ */ (0,
|
|
5820
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "matchid-wallet-asset-value", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
5196
5821
|
NumberFormatter,
|
|
5197
5822
|
{
|
|
5198
5823
|
value: n.value,
|
|
@@ -5201,15 +5826,15 @@ function WalletAsset({
|
|
|
5201
5826
|
}
|
|
5202
5827
|
) })
|
|
5203
5828
|
] }),
|
|
5204
|
-
/* @__PURE__ */ (0,
|
|
5205
|
-
/* @__PURE__ */ (0,
|
|
5829
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-wallet-asset-footer`, children: [
|
|
5830
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: `matchid-wallet-asset-balance`, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
5206
5831
|
NumberFormatter,
|
|
5207
5832
|
{
|
|
5208
5833
|
value: n.balance,
|
|
5209
5834
|
tFixNum: 3
|
|
5210
5835
|
}
|
|
5211
5836
|
) }),
|
|
5212
|
-
"price_change_24h" in n && /* @__PURE__ */ (0,
|
|
5837
|
+
"price_change_24h" in n && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: `matchid-wallet-asset-change ${getFooterColor()}`, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
5213
5838
|
NumberFormatter,
|
|
5214
5839
|
{
|
|
5215
5840
|
prefix: `${(n?.price_change_24h || 0) < 0 ? "-" : "+"} `,
|
|
@@ -5225,10 +5850,10 @@ function WalletAsset({
|
|
|
5225
5850
|
}
|
|
5226
5851
|
|
|
5227
5852
|
// src/components/TokenSend/index.tsx
|
|
5228
|
-
var
|
|
5229
|
-
var
|
|
5230
|
-
var
|
|
5231
|
-
var
|
|
5853
|
+
var import_react31 = require("react");
|
|
5854
|
+
var import_viem10 = require("viem");
|
|
5855
|
+
var import_react_intl15 = require("react-intl");
|
|
5856
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
5232
5857
|
function Input2({
|
|
5233
5858
|
onChange,
|
|
5234
5859
|
placeholder,
|
|
@@ -5238,8 +5863,8 @@ function Input2({
|
|
|
5238
5863
|
error,
|
|
5239
5864
|
size = "df"
|
|
5240
5865
|
}) {
|
|
5241
|
-
return /* @__PURE__ */ (0,
|
|
5242
|
-
/* @__PURE__ */ (0,
|
|
5866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-input-box ${"matchid-token-input-" + size}`, children: [
|
|
5867
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5243
5868
|
"input",
|
|
5244
5869
|
{
|
|
5245
5870
|
placeholder,
|
|
@@ -5250,7 +5875,7 @@ function Input2({
|
|
|
5250
5875
|
className: `matchid-token-input ${error ? "matchid-token-input-error" : ""}`
|
|
5251
5876
|
}
|
|
5252
5877
|
),
|
|
5253
|
-
error && /* @__PURE__ */ (0,
|
|
5878
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "matchid-token-input-error-text", children: error })
|
|
5254
5879
|
] });
|
|
5255
5880
|
}
|
|
5256
5881
|
function TokenSend({
|
|
@@ -5260,36 +5885,36 @@ function TokenSend({
|
|
|
5260
5885
|
onBack
|
|
5261
5886
|
}) {
|
|
5262
5887
|
const { list: chainList } = useMatchChain();
|
|
5263
|
-
const intl = (0,
|
|
5888
|
+
const intl = (0, import_react_intl15.useIntl)();
|
|
5264
5889
|
const { createWalletClient: createWalletClient2 } = useWallet();
|
|
5265
5890
|
const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
|
|
5266
|
-
const chain = (0,
|
|
5891
|
+
const chain = (0, import_react31.useMemo)(() => {
|
|
5267
5892
|
return chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
5268
5893
|
}, [chainList, token.chain_id]);
|
|
5269
|
-
const walletClient = (0,
|
|
5894
|
+
const walletClient = (0, import_react31.useMemo)(() => {
|
|
5270
5895
|
return createWalletClient2({
|
|
5271
5896
|
// @ts-ignore
|
|
5272
|
-
chain: (0,
|
|
5273
|
-
transport: (0,
|
|
5897
|
+
chain: (0, import_viem10.defineChain)(chain),
|
|
5898
|
+
transport: (0, import_viem10.http)()
|
|
5274
5899
|
});
|
|
5275
5900
|
}, [chain]);
|
|
5276
|
-
const [amount, setAmount] = (0,
|
|
5277
|
-
const [address, setAddress] = (0,
|
|
5278
|
-
const [loading, setLoading] = (0,
|
|
5279
|
-
const [sending, setSending] = (0,
|
|
5280
|
-
const [txError, setTxError] = (0,
|
|
5281
|
-
const transaction = (0,
|
|
5901
|
+
const [amount, setAmount] = (0, import_react31.useState)("");
|
|
5902
|
+
const [address, setAddress] = (0, import_react31.useState)("");
|
|
5903
|
+
const [loading, setLoading] = (0, import_react31.useState)(false);
|
|
5904
|
+
const [sending, setSending] = (0, import_react31.useState)(false);
|
|
5905
|
+
const [txError, setTxError] = (0, import_react31.useState)("");
|
|
5906
|
+
const transaction = (0, import_react31.useMemo)(() => {
|
|
5282
5907
|
const reg = /^0x[a-fA-F0-9]{40}$/;
|
|
5283
5908
|
if (!amount || !address || !reg.test(address)) {
|
|
5284
5909
|
return;
|
|
5285
5910
|
}
|
|
5286
|
-
const viemChain = (0,
|
|
5911
|
+
const viemChain = (0, import_viem10.defineChain)(chain);
|
|
5287
5912
|
const to = isNative ? address : token.address;
|
|
5288
|
-
const value = isNative ? (0,
|
|
5289
|
-
const data = isNative ? "0x" : (0,
|
|
5290
|
-
abi:
|
|
5913
|
+
const value = isNative ? (0, import_viem10.parseUnits)(amount, parseInt(token?.decimals || "18")) : BigInt(0);
|
|
5914
|
+
const data = isNative ? "0x" : (0, import_viem10.encodeFunctionData)({
|
|
5915
|
+
abi: import_viem10.erc20Abi,
|
|
5291
5916
|
functionName: "transfer",
|
|
5292
|
-
args: [address, (0,
|
|
5917
|
+
args: [address, (0, import_viem10.parseUnits)(amount, parseInt(token?.decimals || "18"))]
|
|
5293
5918
|
});
|
|
5294
5919
|
return {
|
|
5295
5920
|
to,
|
|
@@ -5309,7 +5934,7 @@ function TokenSend({
|
|
|
5309
5934
|
setLoading(false);
|
|
5310
5935
|
}
|
|
5311
5936
|
};
|
|
5312
|
-
const error = (0,
|
|
5937
|
+
const error = (0, import_react31.useMemo)(() => {
|
|
5313
5938
|
setTxError("");
|
|
5314
5939
|
let amountError = "";
|
|
5315
5940
|
let addressError = "";
|
|
@@ -5352,7 +5977,7 @@ function TokenSend({
|
|
|
5352
5977
|
setAmount(value);
|
|
5353
5978
|
}
|
|
5354
5979
|
};
|
|
5355
|
-
const canSend = (0,
|
|
5980
|
+
const canSend = (0, import_react31.useMemo)(() => {
|
|
5356
5981
|
return !error.amount && !error.address && amount && address;
|
|
5357
5982
|
}, [error]);
|
|
5358
5983
|
const onNext = async () => {
|
|
@@ -5362,7 +5987,7 @@ function TokenSend({
|
|
|
5362
5987
|
}
|
|
5363
5988
|
onClose();
|
|
5364
5989
|
};
|
|
5365
|
-
(0,
|
|
5990
|
+
(0, import_react31.useEffect)(() => {
|
|
5366
5991
|
const receiveMessage = (event) => {
|
|
5367
5992
|
if (event.data) {
|
|
5368
5993
|
if (event.data.source == "match-wallet") {
|
|
@@ -5378,24 +6003,24 @@ function TokenSend({
|
|
|
5378
6003
|
window.removeEventListener("message", receiveMessage);
|
|
5379
6004
|
};
|
|
5380
6005
|
}, []);
|
|
5381
|
-
return /* @__PURE__ */ (0,
|
|
5382
|
-
/* @__PURE__ */ (0,
|
|
5383
|
-
/* @__PURE__ */ (0,
|
|
5384
|
-
/* @__PURE__ */ (0,
|
|
5385
|
-
/* @__PURE__ */ (0,
|
|
5386
|
-
/* @__PURE__ */ (0,
|
|
5387
|
-
token.icon ? /* @__PURE__ */ (0,
|
|
6006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ModalDrawer, { isOpen: true, onClose, zIndex, title: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react_intl15.FormattedMessage, { id: "send" }), onBack, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-send-box`, children: [
|
|
6007
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
6008
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-amount-content`, children: [
|
|
6009
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-amount-header`, children: [
|
|
6010
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: `matchid-token-amount-title`, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react_intl15.FormattedMessage, { id: "amount" }) }),
|
|
6011
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-amount-chain`, children: [
|
|
6012
|
+
token.icon ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5388
6013
|
"img",
|
|
5389
6014
|
{
|
|
5390
6015
|
src: token?.icon,
|
|
5391
6016
|
alt: token?.symbol,
|
|
5392
6017
|
className: `matchid-token-amount-chain-icon`
|
|
5393
6018
|
}
|
|
5394
|
-
) : /* @__PURE__ */ (0,
|
|
5395
|
-
/* @__PURE__ */ (0,
|
|
6019
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(AlphaAvatar, { name: token.symbol || token.name || "", size: 16 }),
|
|
6020
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { children: token?.symbol })
|
|
5396
6021
|
] })
|
|
5397
6022
|
] }),
|
|
5398
|
-
/* @__PURE__ */ (0,
|
|
6023
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5399
6024
|
Input2,
|
|
5400
6025
|
{
|
|
5401
6026
|
type: "text",
|
|
@@ -5408,18 +6033,18 @@ function TokenSend({
|
|
|
5408
6033
|
error: error.amount || txError
|
|
5409
6034
|
}
|
|
5410
6035
|
),
|
|
5411
|
-
/* @__PURE__ */ (0,
|
|
5412
|
-
/* @__PURE__ */ (0,
|
|
5413
|
-
/* @__PURE__ */ (0,
|
|
6036
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-amount-footer`, children: [
|
|
6037
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-amount-title`, children: [
|
|
6038
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react_intl15.FormattedMessage, { id: "balance" }),
|
|
5414
6039
|
":"
|
|
5415
6040
|
] }),
|
|
5416
|
-
/* @__PURE__ */ (0,
|
|
6041
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: `matchid-token-amount-value`, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(NumberFormatter, { value: token.balance, tFixNum: 10, suffix: " " + token.symbol }) })
|
|
5417
6042
|
] }),
|
|
5418
|
-
/* @__PURE__ */ (0,
|
|
6043
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(TransferIcon, { className: "matchid-token-amount-transfer" })
|
|
5419
6044
|
] }),
|
|
5420
|
-
/* @__PURE__ */ (0,
|
|
5421
|
-
/* @__PURE__ */ (0,
|
|
5422
|
-
/* @__PURE__ */ (0,
|
|
6045
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-address-content`, children: [
|
|
6046
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: `matchid-token-address-header`, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: `matchid-token-address-title`, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react_intl15.FormattedMessage, { id: "receiveTitle" }) }) }),
|
|
6047
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5423
6048
|
Input2,
|
|
5424
6049
|
{
|
|
5425
6050
|
type: "text",
|
|
@@ -5435,7 +6060,7 @@ function TokenSend({
|
|
|
5435
6060
|
)
|
|
5436
6061
|
] })
|
|
5437
6062
|
] }),
|
|
5438
|
-
/* @__PURE__ */ (0,
|
|
6063
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5439
6064
|
Button,
|
|
5440
6065
|
{
|
|
5441
6066
|
size: "lg",
|
|
@@ -5444,15 +6069,15 @@ function TokenSend({
|
|
|
5444
6069
|
disabled: !canSend || !!txError,
|
|
5445
6070
|
onClick: onNext,
|
|
5446
6071
|
loading: loading || sending,
|
|
5447
|
-
children: /* @__PURE__ */ (0,
|
|
6072
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react_intl15.FormattedMessage, { id: "next" })
|
|
5448
6073
|
}
|
|
5449
6074
|
)
|
|
5450
6075
|
] }) });
|
|
5451
6076
|
}
|
|
5452
6077
|
|
|
5453
6078
|
// src/components/TokenDetail/index.tsx
|
|
5454
|
-
var
|
|
5455
|
-
var
|
|
6079
|
+
var import_react_intl16 = require("react-intl");
|
|
6080
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
5456
6081
|
function TokenDetail({
|
|
5457
6082
|
onClose,
|
|
5458
6083
|
token
|
|
@@ -5462,41 +6087,41 @@ function TokenDetail({
|
|
|
5462
6087
|
const chain = chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
5463
6088
|
const onSend = () => {
|
|
5464
6089
|
modal.show((props) => {
|
|
5465
|
-
return /* @__PURE__ */ (0,
|
|
6090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TokenSend, { onClose: () => {
|
|
5466
6091
|
props.close();
|
|
5467
6092
|
onClose();
|
|
5468
6093
|
}, onBack: props.close, zIndex: props.zIndex, token });
|
|
5469
6094
|
});
|
|
5470
6095
|
};
|
|
5471
|
-
const intl = (0,
|
|
5472
|
-
return /* @__PURE__ */ (0,
|
|
6096
|
+
const intl = (0, import_react_intl16.useIntl)();
|
|
6097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ModalDrawer, { isOpen: true, title: intl.formatMessage({
|
|
5473
6098
|
id: "tokenDetails"
|
|
5474
|
-
}), onClose, children: /* @__PURE__ */ (0,
|
|
5475
|
-
/* @__PURE__ */ (0,
|
|
5476
|
-
/* @__PURE__ */ (0,
|
|
5477
|
-
/* @__PURE__ */ (0,
|
|
5478
|
-
token.icon ? /* @__PURE__ */ (0,
|
|
5479
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
6099
|
+
}), onClose, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-token-detail`, children: [
|
|
6100
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-token-main`, children: [
|
|
6101
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-token-info`, children: [
|
|
6102
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-token-logo`, children: [
|
|
6103
|
+
token.icon ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("img", { src: token.icon, alt: token.symbol, className: `matchid-token-icon` }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(AlphaAvatar, { className: `matchid-token-icon`, size: 48, name: token.symbol || token.name || "" }),
|
|
6104
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-token-chain` })
|
|
5480
6105
|
] }),
|
|
5481
|
-
/* @__PURE__ */ (0,
|
|
5482
|
-
/* @__PURE__ */ (0,
|
|
6106
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-token-name`, children: [
|
|
6107
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(NumberFormatter, { value: token.balance, tFixNum: 10 }),
|
|
5483
6108
|
" ",
|
|
5484
6109
|
token.symbol
|
|
5485
6110
|
] })
|
|
5486
6111
|
] }),
|
|
5487
|
-
token.address.toLowerCase() != NATIVE_TOKEN_ADDRESS && /* @__PURE__ */ (0,
|
|
5488
|
-
/* @__PURE__ */ (0,
|
|
5489
|
-
/* @__PURE__ */ (0,
|
|
6112
|
+
token.address.toLowerCase() != NATIVE_TOKEN_ADDRESS && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-token-contract`, children: [
|
|
6113
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "matchid-token-contract-title", children: "Contract address" }),
|
|
6114
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "matchid-token-contract-address", children: token.address })
|
|
5490
6115
|
] })
|
|
5491
6116
|
] }),
|
|
5492
|
-
/* @__PURE__ */ (0,
|
|
6117
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Button, { size: "lg", block: true, highlight: true, onClick: onSend, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react_intl16.FormattedMessage, { id: "send" }) })
|
|
5493
6118
|
] }) });
|
|
5494
6119
|
}
|
|
5495
6120
|
|
|
5496
6121
|
// src/components/TokenSendList/index.tsx
|
|
5497
|
-
var
|
|
5498
|
-
var
|
|
5499
|
-
var
|
|
6122
|
+
var import_react32 = require("react");
|
|
6123
|
+
var import_react_intl17 = require("react-intl");
|
|
6124
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
5500
6125
|
function TokenSendList({ close }) {
|
|
5501
6126
|
const isDownMd = useDownMd();
|
|
5502
6127
|
const walletAssets = useMatchWalletAssets();
|
|
@@ -5504,20 +6129,20 @@ function TokenSendList({ close }) {
|
|
|
5504
6129
|
list: walletAssets.mergedAssets
|
|
5505
6130
|
});
|
|
5506
6131
|
const { list } = useMatchChain();
|
|
5507
|
-
const [checked, setChecked] = (0,
|
|
6132
|
+
const [checked, setChecked] = (0, import_react32.useState)();
|
|
5508
6133
|
const modal = useModal();
|
|
5509
6134
|
const onNext = () => {
|
|
5510
6135
|
checked && modal.show((props) => {
|
|
5511
|
-
return /* @__PURE__ */ (0,
|
|
6136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(TokenSend, { onClose: () => {
|
|
5512
6137
|
props.close();
|
|
5513
6138
|
close();
|
|
5514
6139
|
}, onBack: props.close, zIndex: props.zIndex, token: checked });
|
|
5515
6140
|
});
|
|
5516
6141
|
};
|
|
5517
|
-
return /* @__PURE__ */ (0,
|
|
5518
|
-
/* @__PURE__ */ (0,
|
|
6142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "matchid-token-send-list-box", children: [
|
|
6143
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "matchid-token-send-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
5519
6144
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
5520
|
-
return /* @__PURE__ */ (0,
|
|
6145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
5521
6146
|
"div",
|
|
5522
6147
|
{
|
|
5523
6148
|
className: `matchid-token-send-item ${checked?.address == n.address ? "matchid-token-send-chekced" : ""}`,
|
|
@@ -5525,10 +6150,10 @@ function TokenSendList({ close }) {
|
|
|
5525
6150
|
setChecked(n);
|
|
5526
6151
|
},
|
|
5527
6152
|
children: [
|
|
5528
|
-
/* @__PURE__ */ (0,
|
|
5529
|
-
/* @__PURE__ */ (0,
|
|
5530
|
-
/* @__PURE__ */ (0,
|
|
5531
|
-
n.icon ? /* @__PURE__ */ (0,
|
|
6153
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Radio, { checked: checked?.address == n.address, size: isDownMd ? 18 : 24 }),
|
|
6154
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
6155
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "matchid-token-send-logo", children: [
|
|
6156
|
+
n.icon ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("img", { src: n.icon, alt: n.symbol, className: `matchid-token-send-icon` }) : /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
5532
6157
|
AlphaAvatar2,
|
|
5533
6158
|
{
|
|
5534
6159
|
className: `matchid-token-send-icon`,
|
|
@@ -5536,7 +6161,7 @@ function TokenSendList({ close }) {
|
|
|
5536
6161
|
name: n.symbol || n.name || ""
|
|
5537
6162
|
}
|
|
5538
6163
|
),
|
|
5539
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
6164
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
5540
6165
|
"img",
|
|
5541
6166
|
{
|
|
5542
6167
|
src: chain.iconUrl,
|
|
@@ -5545,9 +6170,9 @@ function TokenSendList({ close }) {
|
|
|
5545
6170
|
}
|
|
5546
6171
|
)
|
|
5547
6172
|
] }),
|
|
5548
|
-
/* @__PURE__ */ (0,
|
|
5549
|
-
/* @__PURE__ */ (0,
|
|
5550
|
-
/* @__PURE__ */ (0,
|
|
6173
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: `matchid-token-send-info`, children: [
|
|
6174
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: `matchid-token-send-name`, children: n.symbol }),
|
|
6175
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: `matchid-token-send-balance`, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(NumberFormatter, { value: n.balance, tFixNum: 3 }) })
|
|
5551
6176
|
] })
|
|
5552
6177
|
] })
|
|
5553
6178
|
]
|
|
@@ -5555,15 +6180,15 @@ function TokenSendList({ close }) {
|
|
|
5555
6180
|
index
|
|
5556
6181
|
);
|
|
5557
6182
|
}) }),
|
|
5558
|
-
/* @__PURE__ */ (0,
|
|
6183
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Button, { size: "lg", highlight: true, block: true, disabled: !checked, onClick: onNext, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react_intl17.FormattedMessage, { id: "next" }) })
|
|
5559
6184
|
] });
|
|
5560
6185
|
}
|
|
5561
6186
|
|
|
5562
6187
|
// src/components/TransactionList/index.tsx
|
|
5563
6188
|
var import_react_infinite_scroll_component = __toESM(require("react-infinite-scroll-component"));
|
|
5564
|
-
var
|
|
5565
|
-
var
|
|
5566
|
-
var
|
|
6189
|
+
var import_react33 = require("react");
|
|
6190
|
+
var import_viem11 = require("viem");
|
|
6191
|
+
var import_viem12 = require("viem");
|
|
5567
6192
|
|
|
5568
6193
|
// src/store/useContractStore.ts
|
|
5569
6194
|
var import_zustand5 = require("zustand");
|
|
@@ -5622,15 +6247,15 @@ var useContractStore = (0, import_zustand5.create)((0, import_middleware3.devtoo
|
|
|
5622
6247
|
var useContractStore_default = useContractStore;
|
|
5623
6248
|
|
|
5624
6249
|
// src/components/TransactionList/index.tsx
|
|
5625
|
-
var
|
|
5626
|
-
var
|
|
6250
|
+
var import_react_intl18 = require("react-intl");
|
|
6251
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
5627
6252
|
var Item = ({ data }) => {
|
|
5628
6253
|
const { address } = useWallet();
|
|
5629
6254
|
const isOut = data.from.toLowerCase() == address.toLowerCase();
|
|
5630
6255
|
const { chain, chainId, explorerLink, formatUnits: chainFormatUnits } = useMatchChain();
|
|
5631
6256
|
const { contracts } = useContractStore_default();
|
|
5632
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
5633
|
-
const transferType = (0,
|
|
6257
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react33.useState)(true);
|
|
6258
|
+
const transferType = (0, import_react33.useMemo)(() => {
|
|
5634
6259
|
const methodId = data.input.substring(2, 10);
|
|
5635
6260
|
if (methodId == "095ea7b3") {
|
|
5636
6261
|
return "erc20_approve";
|
|
@@ -5640,38 +6265,38 @@ var Item = ({ data }) => {
|
|
|
5640
6265
|
}
|
|
5641
6266
|
return "unknown";
|
|
5642
6267
|
}, [data.input]);
|
|
5643
|
-
const to = (0,
|
|
6268
|
+
const to = (0, import_react33.useMemo)(() => {
|
|
5644
6269
|
if (!isOut) {
|
|
5645
6270
|
return data.from;
|
|
5646
6271
|
}
|
|
5647
6272
|
if (transferType == "erc20_transfer") {
|
|
5648
|
-
const decodeData = (0,
|
|
5649
|
-
abi:
|
|
6273
|
+
const decodeData = (0, import_viem11.decodeFunctionData)({
|
|
6274
|
+
abi: import_viem12.erc20Abi,
|
|
5650
6275
|
data: data.input
|
|
5651
6276
|
});
|
|
5652
6277
|
return decodeData.args[0];
|
|
5653
6278
|
}
|
|
5654
6279
|
return data.to;
|
|
5655
6280
|
}, [data.input, transferType, data.to, isOut]);
|
|
5656
|
-
const amount = (0,
|
|
6281
|
+
const amount = (0, import_react33.useMemo)(() => {
|
|
5657
6282
|
if (transferType == "erc20_transfer") {
|
|
5658
|
-
const decodeData = (0,
|
|
5659
|
-
abi:
|
|
6283
|
+
const decodeData = (0, import_viem11.decodeFunctionData)({
|
|
6284
|
+
abi: import_viem12.erc20Abi,
|
|
5660
6285
|
data: data.input
|
|
5661
6286
|
});
|
|
5662
6287
|
const value = decodeData.args[1];
|
|
5663
|
-
return (0,
|
|
6288
|
+
return (0, import_viem11.formatUnits)(value, contracts[`${chainId}-${data.to.toLowerCase()}`]?.decimals || 18);
|
|
5664
6289
|
}
|
|
5665
6290
|
return chainFormatUnits(BigInt(data.value));
|
|
5666
6291
|
}, [data.input, transferType, data.value, contracts, chainId, data.to]);
|
|
5667
6292
|
const hashQuery = useHash({
|
|
5668
6293
|
hash: data.hash,
|
|
5669
6294
|
//@ts-ignore
|
|
5670
|
-
chain: (0,
|
|
6295
|
+
chain: (0, import_viem11.defineChain)(chain),
|
|
5671
6296
|
refetchInterval: shouldRefetch ? 3e3 : false,
|
|
5672
6297
|
enabled: shouldRefetch && data.source == "local"
|
|
5673
6298
|
});
|
|
5674
|
-
const status = (0,
|
|
6299
|
+
const status = (0, import_react33.useMemo)(() => {
|
|
5675
6300
|
if (data.source == "matchain") {
|
|
5676
6301
|
switch (data.extra.status) {
|
|
5677
6302
|
case "ok":
|
|
@@ -5698,30 +6323,30 @@ var Item = ({ data }) => {
|
|
|
5698
6323
|
}
|
|
5699
6324
|
return "loading";
|
|
5700
6325
|
}, [data.extra?.status, data.source, hashQuery.data]);
|
|
5701
|
-
(0,
|
|
6326
|
+
(0, import_react33.useEffect)(() => {
|
|
5702
6327
|
if (data.hash) {
|
|
5703
6328
|
setShouldRefetch(status == "loading");
|
|
5704
6329
|
}
|
|
5705
6330
|
}, [status, data.hash]);
|
|
5706
|
-
const symbol = (0,
|
|
6331
|
+
const symbol = (0, import_react33.useMemo)(() => {
|
|
5707
6332
|
if (transferType == "erc20_transfer") {
|
|
5708
6333
|
const contract = contracts[`${chainId}-${data.to.toLowerCase()}`];
|
|
5709
6334
|
return contract?.symbol || contract?.name || "unknown";
|
|
5710
6335
|
}
|
|
5711
6336
|
return chain?.nativeCurrency.symbol || chain?.nativeCurrency.name;
|
|
5712
6337
|
}, [transferType, chain, contracts, chainId, data.to]);
|
|
5713
|
-
return /* @__PURE__ */ (0,
|
|
6338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
5714
6339
|
"a",
|
|
5715
6340
|
{
|
|
5716
6341
|
href: explorerLink(`tx/${data.hash}`),
|
|
5717
6342
|
target: "_blank",
|
|
5718
6343
|
className: `matchid-transaction-item`,
|
|
5719
6344
|
children: [
|
|
5720
|
-
/* @__PURE__ */ (0,
|
|
5721
|
-
/* @__PURE__ */ (0,
|
|
5722
|
-
/* @__PURE__ */ (0,
|
|
5723
|
-
/* @__PURE__ */ (0,
|
|
5724
|
-
/* @__PURE__ */ (0,
|
|
6345
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `matchid-transacton-item-container`, children: [
|
|
6346
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "matchid-transaction-item-icon", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ArrowSendIcon, { className: !isOut ? "rotate-180" : "" }) }),
|
|
6347
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `matchid-transaction-item-details`, children: [
|
|
6348
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: `matchid-transaction-item-address`, children: formatAddress(to, 6, 4) }),
|
|
6349
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5725
6350
|
"div",
|
|
5726
6351
|
{
|
|
5727
6352
|
className: `matchid-transaction-item-timestamp`,
|
|
@@ -5730,11 +6355,11 @@ var Item = ({ data }) => {
|
|
|
5730
6355
|
)
|
|
5731
6356
|
] })
|
|
5732
6357
|
] }),
|
|
5733
|
-
/* @__PURE__ */ (0,
|
|
5734
|
-
/* @__PURE__ */ (0,
|
|
5735
|
-
status == "loading" && /* @__PURE__ */ (0,
|
|
5736
|
-
status == "success" && /* @__PURE__ */ (0,
|
|
5737
|
-
status == "error" && /* @__PURE__ */ (0,
|
|
6358
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `matchid-transaction-item-amount ${"matchid-transaction-item-" + status}`, children: [
|
|
6359
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(NumberFormatter, { value: amount, tFixNum: 6, prefix: isOut ? "-" : "+", suffix: " " + symbol }),
|
|
6360
|
+
status == "loading" && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(LoadingIcon_default, { color: "#000000", size: 16, rotate: true }),
|
|
6361
|
+
status == "success" && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(CheckRoundIcon, { size: 16 }),
|
|
6362
|
+
status == "error" && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(InfoRoundIcon, { size: 16 })
|
|
5738
6363
|
] })
|
|
5739
6364
|
]
|
|
5740
6365
|
}
|
|
@@ -5744,38 +6369,38 @@ function TransactionList({
|
|
|
5744
6369
|
scrollableTarget
|
|
5745
6370
|
}) {
|
|
5746
6371
|
const { fetchMoreData, hasMore, items } = useMatchWalletRecords();
|
|
5747
|
-
return /* @__PURE__ */ (0,
|
|
6372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5748
6373
|
import_react_infinite_scroll_component.default,
|
|
5749
6374
|
{
|
|
5750
6375
|
scrollableTarget,
|
|
5751
6376
|
dataLength: items.length,
|
|
5752
6377
|
next: fetchMoreData,
|
|
5753
6378
|
hasMore,
|
|
5754
|
-
loader: /* @__PURE__ */ (0,
|
|
5755
|
-
/* @__PURE__ */ (0,
|
|
6379
|
+
loader: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "matchid-list-nomore", children: [
|
|
6380
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(LoadingIcon_default, { rotate: true, size: 16, color: "black" }),
|
|
5756
6381
|
"Loading..."
|
|
5757
6382
|
] }),
|
|
5758
|
-
endMessage: items.length > 0 ? /* @__PURE__ */ (0,
|
|
5759
|
-
children: items.length == 0 && !hasMore ? /* @__PURE__ */ (0,
|
|
6383
|
+
endMessage: items.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: `matchid-list-nomore`, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_react_intl18.FormattedMessage, { id: "noMoreRecords" }) }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: `matchid-list-nomore`, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_react_intl18.FormattedMessage, { id: "noRecords" }) }),
|
|
6384
|
+
children: items.length == 0 && !hasMore ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "mt-[150px]" }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: `matchid-transaction-list`, children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Item, { data: item }, index)) })
|
|
5760
6385
|
}
|
|
5761
6386
|
);
|
|
5762
6387
|
}
|
|
5763
6388
|
|
|
5764
6389
|
// src/hooks/useMatchWallet.tsx
|
|
5765
6390
|
var import_react_qrcode = require("react-qrcode");
|
|
5766
|
-
var
|
|
6391
|
+
var import_react35 = require("react");
|
|
5767
6392
|
var import_react_query6 = require("@tanstack/react-query");
|
|
5768
|
-
var
|
|
5769
|
-
var
|
|
6393
|
+
var import_viem15 = require("viem");
|
|
6394
|
+
var import_react_intl20 = require("react-intl");
|
|
5770
6395
|
|
|
5771
6396
|
// src/components/ImportToken/index.tsx
|
|
5772
|
-
var
|
|
5773
|
-
var
|
|
6397
|
+
var import_react34 = require("react");
|
|
6398
|
+
var import_react_intl19 = require("react-intl");
|
|
5774
6399
|
var import_react_query5 = require("@tanstack/react-query");
|
|
5775
|
-
var
|
|
6400
|
+
var import_viem14 = require("viem");
|
|
5776
6401
|
|
|
5777
6402
|
// src/hooks/useIsContract.ts
|
|
5778
|
-
var
|
|
6403
|
+
var import_viem13 = require("viem");
|
|
5779
6404
|
var import_react_query4 = require("@tanstack/react-query");
|
|
5780
6405
|
function useIsContract({
|
|
5781
6406
|
address,
|
|
@@ -5787,9 +6412,9 @@ function useIsContract({
|
|
|
5787
6412
|
queryFn: async () => {
|
|
5788
6413
|
if (!chain) return false;
|
|
5789
6414
|
if (!address) return false;
|
|
5790
|
-
const publicClient = (0,
|
|
6415
|
+
const publicClient = (0, import_viem13.createPublicClient)({
|
|
5791
6416
|
chain,
|
|
5792
|
-
transport: (0,
|
|
6417
|
+
transport: (0, import_viem13.http)()
|
|
5793
6418
|
});
|
|
5794
6419
|
const res = await publicClient.getCode({ address });
|
|
5795
6420
|
return res !== null && res !== void 0;
|
|
@@ -5799,27 +6424,27 @@ function useIsContract({
|
|
|
5799
6424
|
}
|
|
5800
6425
|
|
|
5801
6426
|
// src/components/ImportToken/index.tsx
|
|
5802
|
-
var
|
|
6427
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
5803
6428
|
function ImportToken({ close }) {
|
|
5804
|
-
const [status, setStatus] = (0,
|
|
6429
|
+
const [status, setStatus] = (0, import_react34.useState)("");
|
|
5805
6430
|
const { token } = useUserInfo();
|
|
5806
|
-
const [address, setAddress] = (0,
|
|
5807
|
-
const [symbol, setSymbol] = (0,
|
|
5808
|
-
const [decimals, setDecimals] = (0,
|
|
5809
|
-
const [error, setError] = (0,
|
|
6431
|
+
const [address, setAddress] = (0, import_react34.useState)("");
|
|
6432
|
+
const [symbol, setSymbol] = (0, import_react34.useState)("");
|
|
6433
|
+
const [decimals, setDecimals] = (0, import_react34.useState)("");
|
|
6434
|
+
const [error, setError] = (0, import_react34.useState)({});
|
|
5810
6435
|
const { publicClient, chainId, chain } = useMatchChain();
|
|
5811
6436
|
const getContractInfo = async () => {
|
|
5812
6437
|
if (!publicClient) return;
|
|
5813
6438
|
const calls = [
|
|
5814
6439
|
{
|
|
5815
6440
|
address,
|
|
5816
|
-
abi:
|
|
6441
|
+
abi: import_viem14.erc20Abi,
|
|
5817
6442
|
functionName: "symbol",
|
|
5818
6443
|
args: []
|
|
5819
6444
|
},
|
|
5820
6445
|
{
|
|
5821
6446
|
address,
|
|
5822
|
-
abi:
|
|
6447
|
+
abi: import_viem14.erc20Abi,
|
|
5823
6448
|
functionName: "decimals",
|
|
5824
6449
|
args: []
|
|
5825
6450
|
}
|
|
@@ -5839,8 +6464,8 @@ function ImportToken({ close }) {
|
|
|
5839
6464
|
});
|
|
5840
6465
|
}
|
|
5841
6466
|
};
|
|
5842
|
-
const intl = (0,
|
|
5843
|
-
(0,
|
|
6467
|
+
const intl = (0, import_react_intl19.useIntl)();
|
|
6468
|
+
(0, import_react34.useEffect)(() => {
|
|
5844
6469
|
if (address.length === 42) {
|
|
5845
6470
|
const reg = /^0x[0-9a-fA-F]{40}$/;
|
|
5846
6471
|
if (!reg.test(address)) {
|
|
@@ -5859,7 +6484,7 @@ function ImportToken({ close }) {
|
|
|
5859
6484
|
}
|
|
5860
6485
|
}
|
|
5861
6486
|
}, [address, publicClient]);
|
|
5862
|
-
const [loading, setLoading] = (0,
|
|
6487
|
+
const [loading, setLoading] = (0, import_react34.useState)(false);
|
|
5863
6488
|
const toast = useToast();
|
|
5864
6489
|
const queryClient2 = (0, import_react_query5.useQueryClient)();
|
|
5865
6490
|
const onImport = async () => {
|
|
@@ -5887,7 +6512,7 @@ function ImportToken({ close }) {
|
|
|
5887
6512
|
setLoading(false);
|
|
5888
6513
|
}
|
|
5889
6514
|
};
|
|
5890
|
-
const canImport = (0,
|
|
6515
|
+
const canImport = (0, import_react34.useMemo)(() => {
|
|
5891
6516
|
if (!address) {
|
|
5892
6517
|
return false;
|
|
5893
6518
|
}
|
|
@@ -5905,24 +6530,24 @@ function ImportToken({ close }) {
|
|
|
5905
6530
|
}, [error, address, symbol, decimals]);
|
|
5906
6531
|
const isContractQuery = useIsContract({
|
|
5907
6532
|
//@ts-ignore
|
|
5908
|
-
chain: (0,
|
|
6533
|
+
chain: (0, import_viem14.defineChain)(chain),
|
|
5909
6534
|
address,
|
|
5910
6535
|
enabled: canImport
|
|
5911
6536
|
});
|
|
5912
6537
|
if (status == "success" || status == "fail") {
|
|
5913
|
-
return /* @__PURE__ */ (0,
|
|
5914
|
-
/* @__PURE__ */ (0,
|
|
5915
|
-
/* @__PURE__ */ (0,
|
|
5916
|
-
/* @__PURE__ */ (0,
|
|
6538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `matchid-import-token-result matchid-flex`, children: [
|
|
6539
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `matchid-import-token-result-box matchid-flex`, children: [
|
|
6540
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("img", { src: status == "success" ? success_default : fail_default, alt: status == "success" ? "success" : "fail", className: `matchid-import-token-result-img` }),
|
|
6541
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: `matchid-import-token-result-text matchid-import-token-result-text-${status}`, children: status == "success" ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl19.FormattedMessage, { id: "importSuccess" }) : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl19.FormattedMessage, { id: "importFail" }) })
|
|
5917
6542
|
] }),
|
|
5918
|
-
status == "success" ? /* @__PURE__ */ (0,
|
|
6543
|
+
status == "success" ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Button, { size: "lg", onClick: close, block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl19.FormattedMessage, { id: "close" }) }) : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Button, { size: "lg", onClick: () => setStatus(""), block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl19.FormattedMessage, { id: "back" }) })
|
|
5919
6544
|
] });
|
|
5920
6545
|
}
|
|
5921
|
-
return /* @__PURE__ */ (0,
|
|
5922
|
-
/* @__PURE__ */ (0,
|
|
5923
|
-
/* @__PURE__ */ (0,
|
|
6546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `matchid-import-token`, children: [
|
|
6547
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "matchid-import-token-form", children: [
|
|
6548
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Field, { label: intl.formatMessage({
|
|
5924
6549
|
id: "tokenSmartContract"
|
|
5925
|
-
}), error: error.address ? error.address : isContractQuery.isFetched && !isContractQuery.isLoading && !isContractQuery.data && canImport ? "Address isn't a contract address" : "", children: /* @__PURE__ */ (0,
|
|
6550
|
+
}), error: error.address ? error.address : isContractQuery.isFetched && !isContractQuery.isLoading && !isContractQuery.data && canImport ? "Address isn't a contract address" : "", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5926
6551
|
Input,
|
|
5927
6552
|
{
|
|
5928
6553
|
placeholder: intl.formatMessage({
|
|
@@ -5933,9 +6558,9 @@ function ImportToken({ close }) {
|
|
|
5933
6558
|
maxLength: 42
|
|
5934
6559
|
}
|
|
5935
6560
|
) }),
|
|
5936
|
-
/* @__PURE__ */ (0,
|
|
6561
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Field, { label: intl.formatMessage({
|
|
5937
6562
|
id: "tokenSymbol"
|
|
5938
|
-
}), error: error.symbol, children: /* @__PURE__ */ (0,
|
|
6563
|
+
}), error: error.symbol, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5939
6564
|
Input,
|
|
5940
6565
|
{
|
|
5941
6566
|
placeholder: intl.formatMessage({
|
|
@@ -5946,9 +6571,9 @@ function ImportToken({ close }) {
|
|
|
5946
6571
|
maxLength: 16
|
|
5947
6572
|
}
|
|
5948
6573
|
) }),
|
|
5949
|
-
/* @__PURE__ */ (0,
|
|
6574
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Field, { label: intl.formatMessage({
|
|
5950
6575
|
id: "tokenDecimals"
|
|
5951
|
-
}), error: error.decimals, children: /* @__PURE__ */ (0,
|
|
6576
|
+
}), error: error.decimals, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5952
6577
|
Input,
|
|
5953
6578
|
{
|
|
5954
6579
|
placeholder: intl.formatMessage({
|
|
@@ -5960,7 +6585,7 @@ function ImportToken({ close }) {
|
|
|
5960
6585
|
}
|
|
5961
6586
|
) })
|
|
5962
6587
|
] }),
|
|
5963
|
-
/* @__PURE__ */ (0,
|
|
6588
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5964
6589
|
Button,
|
|
5965
6590
|
{
|
|
5966
6591
|
size: "lg",
|
|
@@ -5969,20 +6594,20 @@ function ImportToken({ close }) {
|
|
|
5969
6594
|
loading: loading || isContractQuery.isLoading,
|
|
5970
6595
|
disabled: !canImport || !isContractQuery.data,
|
|
5971
6596
|
highlight: true,
|
|
5972
|
-
children: /* @__PURE__ */ (0,
|
|
6597
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl19.FormattedMessage, { id: "import" })
|
|
5973
6598
|
}
|
|
5974
6599
|
)
|
|
5975
6600
|
] });
|
|
5976
6601
|
}
|
|
5977
6602
|
|
|
5978
6603
|
// src/hooks/useMatchWallet.tsx
|
|
5979
|
-
var
|
|
6604
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
5980
6605
|
var ReceiveModal = () => {
|
|
5981
6606
|
const chain = useMatchChain();
|
|
5982
6607
|
const { address } = useWallet();
|
|
5983
6608
|
const [copied, setCopied] = useCopyClipboard();
|
|
5984
6609
|
const toast = useToast();
|
|
5985
|
-
const intl = (0,
|
|
6610
|
+
const intl = (0, import_react_intl20.useIntl)();
|
|
5986
6611
|
const onCopy = () => {
|
|
5987
6612
|
setCopied(address);
|
|
5988
6613
|
toast.success(intl.formatMessage({
|
|
@@ -5990,10 +6615,10 @@ var ReceiveModal = () => {
|
|
|
5990
6615
|
}));
|
|
5991
6616
|
};
|
|
5992
6617
|
const chainLink = chain.explorerLink("address/" + address);
|
|
5993
|
-
return /* @__PURE__ */ (0,
|
|
5994
|
-
/* @__PURE__ */ (0,
|
|
5995
|
-
/* @__PURE__ */ (0,
|
|
5996
|
-
/* @__PURE__ */ (0,
|
|
6618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: `matchid-receive-modal`, children: [
|
|
6619
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "matchid-receive-container", children: [
|
|
6620
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: `matchid-receive-text`, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react_intl20.FormattedMessage, { id: "receiveQrcode" }) }),
|
|
6621
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: `matchid-qr-container`, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
5997
6622
|
import_react_qrcode.QRCode,
|
|
5998
6623
|
{
|
|
5999
6624
|
margin: "0",
|
|
@@ -6001,7 +6626,7 @@ var ReceiveModal = () => {
|
|
|
6001
6626
|
value: address
|
|
6002
6627
|
}
|
|
6003
6628
|
) }),
|
|
6004
|
-
/* @__PURE__ */ (0,
|
|
6629
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
6005
6630
|
"a",
|
|
6006
6631
|
{
|
|
6007
6632
|
href: chainLink,
|
|
@@ -6011,8 +6636,8 @@ var ReceiveModal = () => {
|
|
|
6011
6636
|
}
|
|
6012
6637
|
)
|
|
6013
6638
|
] }),
|
|
6014
|
-
/* @__PURE__ */ (0,
|
|
6015
|
-
|
|
6639
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Button, { size: "lg", onClick: onCopy, block: true, highlight: true, disabled: copied, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
6640
|
+
import_react_intl20.FormattedMessage,
|
|
6016
6641
|
{
|
|
6017
6642
|
id: "copyAddress"
|
|
6018
6643
|
}
|
|
@@ -6021,7 +6646,7 @@ var ReceiveModal = () => {
|
|
|
6021
6646
|
};
|
|
6022
6647
|
function useMatchWallet() {
|
|
6023
6648
|
const modal = useModal();
|
|
6024
|
-
const intl = (0,
|
|
6649
|
+
const intl = (0, import_react_intl20.useIntl)();
|
|
6025
6650
|
const showReceiveModal = () => {
|
|
6026
6651
|
modal.open({
|
|
6027
6652
|
title: intl.formatMessage({
|
|
@@ -6053,12 +6678,12 @@ function useMatchWallet() {
|
|
|
6053
6678
|
};
|
|
6054
6679
|
}
|
|
6055
6680
|
function useMatchWalletRecords() {
|
|
6056
|
-
const [hasMore, setHasMore] = (0,
|
|
6057
|
-
const [items, setItems] = (0,
|
|
6681
|
+
const [hasMore, setHasMore] = (0, import_react35.useState)(true);
|
|
6682
|
+
const [items, setItems] = (0, import_react35.useState)([]);
|
|
6058
6683
|
const { chainId, publicClient } = useMatchChain();
|
|
6059
6684
|
const { address } = useWallet();
|
|
6060
|
-
const hasMoreRef = (0,
|
|
6061
|
-
const nextPageParamsRef = (0,
|
|
6685
|
+
const hasMoreRef = (0, import_react35.useRef)(hasMore);
|
|
6686
|
+
const nextPageParamsRef = (0, import_react35.useRef)(void 0);
|
|
6062
6687
|
const { contracts, setContracts } = useContractStore_default();
|
|
6063
6688
|
const fetchMoreData = async () => {
|
|
6064
6689
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
@@ -6085,7 +6710,7 @@ function useMatchWalletRecords() {
|
|
|
6085
6710
|
hasMoreRef.current = true;
|
|
6086
6711
|
fetchMoreData();
|
|
6087
6712
|
};
|
|
6088
|
-
(0,
|
|
6713
|
+
(0, import_react35.useEffect)(() => {
|
|
6089
6714
|
if (chainId && address) {
|
|
6090
6715
|
onInit();
|
|
6091
6716
|
}
|
|
@@ -6109,13 +6734,13 @@ function useMatchWalletRecords() {
|
|
|
6109
6734
|
for (const contract of contractUnique) {
|
|
6110
6735
|
calls.push({
|
|
6111
6736
|
address: contract,
|
|
6112
|
-
abi:
|
|
6737
|
+
abi: import_viem15.erc20Abi,
|
|
6113
6738
|
functionName: "symbol",
|
|
6114
6739
|
args: []
|
|
6115
6740
|
});
|
|
6116
6741
|
calls.push({
|
|
6117
6742
|
address: contract,
|
|
6118
|
-
abi:
|
|
6743
|
+
abi: import_viem15.erc20Abi,
|
|
6119
6744
|
functionName: "decimals",
|
|
6120
6745
|
args: []
|
|
6121
6746
|
});
|
|
@@ -6141,7 +6766,7 @@ function useMatchWalletRecords() {
|
|
|
6141
6766
|
setContracts(contractMap);
|
|
6142
6767
|
}
|
|
6143
6768
|
};
|
|
6144
|
-
const list = (0,
|
|
6769
|
+
const list = (0, import_react35.useMemo)(() => {
|
|
6145
6770
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
6146
6771
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
6147
6772
|
removeList.forEach((item) => {
|
|
@@ -6183,7 +6808,7 @@ function useMatchWalletAssets({
|
|
|
6183
6808
|
chainId: chainId || 0,
|
|
6184
6809
|
...assetListOptions
|
|
6185
6810
|
});
|
|
6186
|
-
const mergedAssets = (0,
|
|
6811
|
+
const mergedAssets = (0, import_react35.useMemo)(() => {
|
|
6187
6812
|
if (!assetListQuery.data && !importTokenQuery.data) return [];
|
|
6188
6813
|
const assetList = (assetListQuery.data || []).map((asset) => ({
|
|
6189
6814
|
...asset,
|
|
@@ -6270,14 +6895,14 @@ function useMatchWalletAssetList({
|
|
|
6270
6895
|
retry: 3
|
|
6271
6896
|
// Retry up to 3 times if failed
|
|
6272
6897
|
});
|
|
6273
|
-
const erc20Tokens = (0,
|
|
6898
|
+
const erc20Tokens = (0, import_react35.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
|
|
6274
6899
|
const erc20BalanceQuery = (0, import_react_query6.useQuery)({
|
|
6275
6900
|
queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
|
|
6276
6901
|
queryFn: async () => {
|
|
6277
6902
|
if (!erc20Tokens.length || !publicClient) return [];
|
|
6278
6903
|
const calls = erc20Tokens.map((token) => ({
|
|
6279
6904
|
address: token.address,
|
|
6280
|
-
abi:
|
|
6905
|
+
abi: import_viem15.erc20Abi,
|
|
6281
6906
|
functionName: "balanceOf",
|
|
6282
6907
|
args: [address]
|
|
6283
6908
|
}));
|
|
@@ -6298,7 +6923,7 @@ function useMatchWalletAssetList({
|
|
|
6298
6923
|
// Refresh every 15 seconds
|
|
6299
6924
|
retry: 3
|
|
6300
6925
|
});
|
|
6301
|
-
const enrichedAssets = (0,
|
|
6926
|
+
const enrichedAssets = (0, import_react35.useMemo)(() => {
|
|
6302
6927
|
if (!list) return [];
|
|
6303
6928
|
const erc20Balances = erc20BalanceQuery.data || [];
|
|
6304
6929
|
return list.map((asset) => {
|
|
@@ -6308,11 +6933,11 @@ function useMatchWalletAssetList({
|
|
|
6308
6933
|
const assetAddress = asset.address.toLowerCase();
|
|
6309
6934
|
if (assetAddress === NATIVE_TOKEN_ADDRESS) {
|
|
6310
6935
|
balanceValue = nativeBalanceQuery.data?.toString() || "0";
|
|
6311
|
-
balance = nativeBalanceQuery.data ? Number((0,
|
|
6936
|
+
balance = nativeBalanceQuery.data ? Number((0, import_viem15.formatUnits)(nativeBalanceQuery.data, decimals)) : 0;
|
|
6312
6937
|
} else {
|
|
6313
6938
|
const index = erc20Tokens.findIndex((t) => t.address.toLowerCase() === assetAddress);
|
|
6314
6939
|
if (index !== -1 && erc20Balances[index] && erc20Balances[index].status === "success") {
|
|
6315
|
-
balance = Number((0,
|
|
6940
|
+
balance = Number((0, import_viem15.formatUnits)(erc20Balances[index].result, decimals));
|
|
6316
6941
|
balanceValue = erc20Balances[index].result?.toString() || "0";
|
|
6317
6942
|
}
|
|
6318
6943
|
}
|
|
@@ -6320,7 +6945,7 @@ function useMatchWalletAssetList({
|
|
|
6320
6945
|
return { ...asset, balance, value, balanceValue };
|
|
6321
6946
|
});
|
|
6322
6947
|
}, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
|
|
6323
|
-
(0,
|
|
6948
|
+
(0, import_react35.useEffect)(() => {
|
|
6324
6949
|
const list2 = enrichedAssets.sort((a, b) => {
|
|
6325
6950
|
if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
|
|
6326
6951
|
if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
|
|
@@ -6345,14 +6970,14 @@ function useMatchWalletAssetList({
|
|
|
6345
6970
|
}
|
|
6346
6971
|
|
|
6347
6972
|
// src/hooks/useReceipt.tsx
|
|
6348
|
-
var
|
|
6973
|
+
var import_react36 = require("react");
|
|
6349
6974
|
var import_react_query7 = require("@tanstack/react-query");
|
|
6350
|
-
var
|
|
6975
|
+
var import_viem16 = require("viem");
|
|
6351
6976
|
var CACHE_TTL = 86400 * 30 * 1e3;
|
|
6352
6977
|
var MAX_CACHE_SIZE = 500;
|
|
6353
6978
|
var STORAGE_KEY = "match_receipt_logs";
|
|
6354
6979
|
function useReceiptCache() {
|
|
6355
|
-
const [cache, setCache] = (0,
|
|
6980
|
+
const [cache, setCache] = (0, import_react36.useState)(/* @__PURE__ */ new Map());
|
|
6356
6981
|
const isLocalStorageAvailable = (() => {
|
|
6357
6982
|
try {
|
|
6358
6983
|
const testKey = "__test__";
|
|
@@ -6363,7 +6988,7 @@ function useReceiptCache() {
|
|
|
6363
6988
|
return false;
|
|
6364
6989
|
}
|
|
6365
6990
|
})();
|
|
6366
|
-
(0,
|
|
6991
|
+
(0, import_react36.useEffect)(() => {
|
|
6367
6992
|
if (isLocalStorageAvailable) {
|
|
6368
6993
|
try {
|
|
6369
6994
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -6382,7 +7007,7 @@ function useReceiptCache() {
|
|
|
6382
7007
|
}
|
|
6383
7008
|
}
|
|
6384
7009
|
}, []);
|
|
6385
|
-
const updateLocalStorage = (0,
|
|
7010
|
+
const updateLocalStorage = (0, import_react36.useCallback)((updatedCache) => {
|
|
6386
7011
|
if (isLocalStorageAvailable) {
|
|
6387
7012
|
try {
|
|
6388
7013
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -6399,7 +7024,7 @@ function useReceiptCache() {
|
|
|
6399
7024
|
}
|
|
6400
7025
|
}
|
|
6401
7026
|
}, []);
|
|
6402
|
-
const set = (0,
|
|
7027
|
+
const set = (0, import_react36.useCallback)((key, value) => {
|
|
6403
7028
|
const now = Date.now();
|
|
6404
7029
|
const newCache = new Map(cache);
|
|
6405
7030
|
newCache.forEach((entry, k) => {
|
|
@@ -6417,7 +7042,7 @@ function useReceiptCache() {
|
|
|
6417
7042
|
setCache(newCache);
|
|
6418
7043
|
updateLocalStorage(newCache);
|
|
6419
7044
|
}, [cache, updateLocalStorage]);
|
|
6420
|
-
const get = (0,
|
|
7045
|
+
const get = (0, import_react36.useCallback)((key) => {
|
|
6421
7046
|
const entry = cache.get(key);
|
|
6422
7047
|
if (entry) {
|
|
6423
7048
|
if (Date.now() - entry.timestamp > CACHE_TTL) {
|
|
@@ -6431,7 +7056,7 @@ function useReceiptCache() {
|
|
|
6431
7056
|
}
|
|
6432
7057
|
return void 0;
|
|
6433
7058
|
}, [cache, updateLocalStorage]);
|
|
6434
|
-
const del = (0,
|
|
7059
|
+
const del = (0, import_react36.useCallback)((key) => {
|
|
6435
7060
|
if (cache.has(key)) {
|
|
6436
7061
|
const newCache = new Map(cache);
|
|
6437
7062
|
newCache.delete(key);
|
|
@@ -6439,7 +7064,7 @@ function useReceiptCache() {
|
|
|
6439
7064
|
updateLocalStorage(newCache);
|
|
6440
7065
|
}
|
|
6441
7066
|
}, [cache, updateLocalStorage]);
|
|
6442
|
-
const clear = (0,
|
|
7067
|
+
const clear = (0, import_react36.useCallback)(() => {
|
|
6443
7068
|
setCache(/* @__PURE__ */ new Map());
|
|
6444
7069
|
if (isLocalStorageAvailable) {
|
|
6445
7070
|
localStorage.removeItem(STORAGE_KEY);
|
|
@@ -6454,7 +7079,7 @@ function useReceipt2({
|
|
|
6454
7079
|
const { list } = useMatchChain();
|
|
6455
7080
|
const cache = useReceiptCache();
|
|
6456
7081
|
const chain = list?.find((item) => item.id === chainId);
|
|
6457
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
7082
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react36.useState)(true);
|
|
6458
7083
|
const query = (0, import_react_query7.useQuery)({
|
|
6459
7084
|
queryKey: ["match-tx-receipt", hash, chain],
|
|
6460
7085
|
queryFn: async () => {
|
|
@@ -6464,9 +7089,9 @@ function useReceipt2({
|
|
|
6464
7089
|
return cache.get(cacheKey);
|
|
6465
7090
|
}
|
|
6466
7091
|
try {
|
|
6467
|
-
const publicClient = (0,
|
|
6468
|
-
chain: (0,
|
|
6469
|
-
transport: (0,
|
|
7092
|
+
const publicClient = (0, import_viem16.createPublicClient)({
|
|
7093
|
+
chain: (0, import_viem16.defineChain)(chain),
|
|
7094
|
+
transport: (0, import_viem16.http)()
|
|
6470
7095
|
});
|
|
6471
7096
|
const receipt = await publicClient.getTransactionReceipt({ hash });
|
|
6472
7097
|
if (!receipt) {
|
|
@@ -6480,7 +7105,7 @@ function useReceipt2({
|
|
|
6480
7105
|
},
|
|
6481
7106
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
6482
7107
|
});
|
|
6483
|
-
(0,
|
|
7108
|
+
(0, import_react36.useEffect)(() => {
|
|
6484
7109
|
if (query.data) {
|
|
6485
7110
|
setShouldRefetch(false);
|
|
6486
7111
|
}
|
|
@@ -6489,14 +7114,14 @@ function useReceipt2({
|
|
|
6489
7114
|
}
|
|
6490
7115
|
|
|
6491
7116
|
// src/hooks/useTransaction.tsx
|
|
6492
|
-
var
|
|
7117
|
+
var import_react37 = require("react");
|
|
6493
7118
|
var import_react_query8 = require("@tanstack/react-query");
|
|
6494
|
-
var
|
|
7119
|
+
var import_viem17 = require("viem");
|
|
6495
7120
|
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
6496
7121
|
var MAX_CACHE_SIZE2 = 500;
|
|
6497
7122
|
var STORAGE_KEY2 = "match_transaction_logs";
|
|
6498
7123
|
function useTransactionCache() {
|
|
6499
|
-
const [cache, setCache] = (0,
|
|
7124
|
+
const [cache, setCache] = (0, import_react37.useState)(/* @__PURE__ */ new Map());
|
|
6500
7125
|
const isLocalStorageAvailable = (() => {
|
|
6501
7126
|
try {
|
|
6502
7127
|
const testKey = "__test__";
|
|
@@ -6507,7 +7132,7 @@ function useTransactionCache() {
|
|
|
6507
7132
|
return false;
|
|
6508
7133
|
}
|
|
6509
7134
|
})();
|
|
6510
|
-
(0,
|
|
7135
|
+
(0, import_react37.useEffect)(() => {
|
|
6511
7136
|
if (isLocalStorageAvailable) {
|
|
6512
7137
|
try {
|
|
6513
7138
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -6526,7 +7151,7 @@ function useTransactionCache() {
|
|
|
6526
7151
|
}
|
|
6527
7152
|
}
|
|
6528
7153
|
}, []);
|
|
6529
|
-
const updateLocalStorage = (0,
|
|
7154
|
+
const updateLocalStorage = (0, import_react37.useCallback)((updatedCache) => {
|
|
6530
7155
|
if (isLocalStorageAvailable) {
|
|
6531
7156
|
try {
|
|
6532
7157
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -6543,7 +7168,7 @@ function useTransactionCache() {
|
|
|
6543
7168
|
}
|
|
6544
7169
|
}
|
|
6545
7170
|
}, []);
|
|
6546
|
-
const set = (0,
|
|
7171
|
+
const set = (0, import_react37.useCallback)((key, value) => {
|
|
6547
7172
|
const now = Date.now();
|
|
6548
7173
|
const newCache = new Map(cache);
|
|
6549
7174
|
newCache.forEach((entry, k) => {
|
|
@@ -6561,7 +7186,7 @@ function useTransactionCache() {
|
|
|
6561
7186
|
setCache(newCache);
|
|
6562
7187
|
updateLocalStorage(newCache);
|
|
6563
7188
|
}, [cache, updateLocalStorage]);
|
|
6564
|
-
const get = (0,
|
|
7189
|
+
const get = (0, import_react37.useCallback)((key) => {
|
|
6565
7190
|
const entry = cache.get(key);
|
|
6566
7191
|
if (entry) {
|
|
6567
7192
|
if (Date.now() - entry.timestamp > CACHE_TTL2) {
|
|
@@ -6575,7 +7200,7 @@ function useTransactionCache() {
|
|
|
6575
7200
|
}
|
|
6576
7201
|
return void 0;
|
|
6577
7202
|
}, [cache, updateLocalStorage]);
|
|
6578
|
-
const del = (0,
|
|
7203
|
+
const del = (0, import_react37.useCallback)((key) => {
|
|
6579
7204
|
if (cache.has(key)) {
|
|
6580
7205
|
const newCache = new Map(cache);
|
|
6581
7206
|
newCache.delete(key);
|
|
@@ -6583,7 +7208,7 @@ function useTransactionCache() {
|
|
|
6583
7208
|
updateLocalStorage(newCache);
|
|
6584
7209
|
}
|
|
6585
7210
|
}, [cache, updateLocalStorage]);
|
|
6586
|
-
const clear = (0,
|
|
7211
|
+
const clear = (0, import_react37.useCallback)(() => {
|
|
6587
7212
|
setCache(/* @__PURE__ */ new Map());
|
|
6588
7213
|
if (isLocalStorageAvailable) {
|
|
6589
7214
|
localStorage.removeItem(STORAGE_KEY2);
|
|
@@ -6598,7 +7223,7 @@ function useTransaction({
|
|
|
6598
7223
|
const { list } = useMatchChain();
|
|
6599
7224
|
const cache = useTransactionCache();
|
|
6600
7225
|
const chain = list?.find((item) => item.id === chainId);
|
|
6601
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
7226
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react37.useState)(true);
|
|
6602
7227
|
const query = (0, import_react_query8.useQuery)({
|
|
6603
7228
|
queryKey: ["match-tx-transaction", hash, chain],
|
|
6604
7229
|
queryFn: async () => {
|
|
@@ -6608,9 +7233,9 @@ function useTransaction({
|
|
|
6608
7233
|
return cache.get(cacheKey);
|
|
6609
7234
|
}
|
|
6610
7235
|
try {
|
|
6611
|
-
const publicClient = (0,
|
|
6612
|
-
chain: (0,
|
|
6613
|
-
transport: (0,
|
|
7236
|
+
const publicClient = (0, import_viem17.createPublicClient)({
|
|
7237
|
+
chain: (0, import_viem17.defineChain)(chain),
|
|
7238
|
+
transport: (0, import_viem17.http)()
|
|
6614
7239
|
});
|
|
6615
7240
|
const transaction = await publicClient.getTransaction({ hash });
|
|
6616
7241
|
if (!transaction) {
|
|
@@ -6624,7 +7249,7 @@ function useTransaction({
|
|
|
6624
7249
|
},
|
|
6625
7250
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
6626
7251
|
});
|
|
6627
|
-
(0,
|
|
7252
|
+
(0, import_react37.useEffect)(() => {
|
|
6628
7253
|
if (query.data) {
|
|
6629
7254
|
setShouldRefetch(false);
|
|
6630
7255
|
}
|
|
@@ -6633,27 +7258,27 @@ function useTransaction({
|
|
|
6633
7258
|
}
|
|
6634
7259
|
|
|
6635
7260
|
// src/components/CEXBindModal/index.tsx
|
|
6636
|
-
var
|
|
6637
|
-
var
|
|
6638
|
-
var
|
|
7261
|
+
var import_react38 = require("react");
|
|
7262
|
+
var import_react_intl21 = require("react-intl");
|
|
7263
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
6639
7264
|
function CEXBindModal({
|
|
6640
7265
|
onClose,
|
|
6641
7266
|
type,
|
|
6642
7267
|
isOpen = false,
|
|
6643
7268
|
...props
|
|
6644
7269
|
}) {
|
|
6645
|
-
const intl = (0,
|
|
7270
|
+
const intl = (0, import_react_intl21.useIntl)();
|
|
6646
7271
|
const { events } = useMatch();
|
|
6647
|
-
const [APIPassphrase, setAPIPassphrase] = (0,
|
|
7272
|
+
const [APIPassphrase, setAPIPassphrase] = (0, import_react38.useState)("");
|
|
6648
7273
|
const { refreshOverview } = useUserInfo();
|
|
6649
|
-
const [loading, setLoading] = (0,
|
|
6650
|
-
const [key, setKey] = (0,
|
|
6651
|
-
const [secret, setSecret] = (0,
|
|
6652
|
-
const [error, setError] = (0,
|
|
6653
|
-
const needPassphrase = (0,
|
|
7274
|
+
const [loading, setLoading] = (0, import_react38.useState)(false);
|
|
7275
|
+
const [key, setKey] = (0, import_react38.useState)("");
|
|
7276
|
+
const [secret, setSecret] = (0, import_react38.useState)("");
|
|
7277
|
+
const [error, setError] = (0, import_react38.useState)("");
|
|
7278
|
+
const needPassphrase = (0, import_react38.useMemo)(() => {
|
|
6654
7279
|
return ["bitget", "okx"].includes(type.toLowerCase());
|
|
6655
7280
|
}, [type]);
|
|
6656
|
-
(0,
|
|
7281
|
+
(0, import_react38.useEffect)(() => {
|
|
6657
7282
|
if (isOpen) {
|
|
6658
7283
|
setSecret("");
|
|
6659
7284
|
setKey("");
|
|
@@ -6690,20 +7315,20 @@ function CEXBindModal({
|
|
|
6690
7315
|
setLoading(false);
|
|
6691
7316
|
}
|
|
6692
7317
|
};
|
|
6693
|
-
return /* @__PURE__ */ (0,
|
|
7318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ModalWithHeader, { showClose: true, isOpen, onClose, title: intl.formatMessage({
|
|
6694
7319
|
id: "CEXBindTitle"
|
|
6695
7320
|
}, {
|
|
6696
7321
|
type
|
|
6697
|
-
}), ...props, children: /* @__PURE__ */ (0,
|
|
6698
|
-
/* @__PURE__ */ (0,
|
|
6699
|
-
/* @__PURE__ */ (0,
|
|
6700
|
-
/* @__PURE__ */ (0,
|
|
6701
|
-
/* @__PURE__ */ (0,
|
|
6702
|
-
/* @__PURE__ */ (0,
|
|
7322
|
+
}), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "matchid-cex-modal", children: [
|
|
7323
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { children: [
|
|
7324
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl21.FormattedMessage, { id: "CEXBindAttention" }) }),
|
|
7325
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl21.FormattedMessage, { id: "CEXBindTips1" }) }),
|
|
7326
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl21.FormattedMessage, { id: "CEXBindTips2" }) }),
|
|
7327
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl21.FormattedMessage, { id: "CEXBindTips3" }) })
|
|
6703
7328
|
] }),
|
|
6704
|
-
/* @__PURE__ */ (0,
|
|
7329
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Field, { label: intl.formatMessage({
|
|
6705
7330
|
id: "CEXBindApiKey"
|
|
6706
|
-
}), children: /* @__PURE__ */ (0,
|
|
7331
|
+
}), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
6707
7332
|
Input,
|
|
6708
7333
|
{
|
|
6709
7334
|
value: key,
|
|
@@ -6711,9 +7336,9 @@ function CEXBindModal({
|
|
|
6711
7336
|
placeholder: "**** **** ****"
|
|
6712
7337
|
}
|
|
6713
7338
|
) }),
|
|
6714
|
-
/* @__PURE__ */ (0,
|
|
7339
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Field, { label: intl.formatMessage({
|
|
6715
7340
|
id: "CEXBindApiSecretKey"
|
|
6716
|
-
}), error: !needPassphrase && error, children: /* @__PURE__ */ (0,
|
|
7341
|
+
}), error: !needPassphrase && error, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
6717
7342
|
Input,
|
|
6718
7343
|
{
|
|
6719
7344
|
value: secret,
|
|
@@ -6721,9 +7346,9 @@ function CEXBindModal({
|
|
|
6721
7346
|
placeholder: "**** **** ****"
|
|
6722
7347
|
}
|
|
6723
7348
|
) }),
|
|
6724
|
-
needPassphrase && /* @__PURE__ */ (0,
|
|
7349
|
+
needPassphrase && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Field, { error, label: intl.formatMessage({
|
|
6725
7350
|
id: "CEXBindApiPassphrase"
|
|
6726
|
-
}), children: /* @__PURE__ */ (0,
|
|
7351
|
+
}), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
6727
7352
|
Input,
|
|
6728
7353
|
{
|
|
6729
7354
|
value: APIPassphrase,
|
|
@@ -6731,7 +7356,7 @@ function CEXBindModal({
|
|
|
6731
7356
|
placeholder: "**** **** ****"
|
|
6732
7357
|
}
|
|
6733
7358
|
) }),
|
|
6734
|
-
/* @__PURE__ */ (0,
|
|
7359
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
6735
7360
|
Button,
|
|
6736
7361
|
{
|
|
6737
7362
|
onClick: SubmitApi,
|
|
@@ -6739,7 +7364,7 @@ function CEXBindModal({
|
|
|
6739
7364
|
block: true,
|
|
6740
7365
|
loading,
|
|
6741
7366
|
disabled: !key || !secret,
|
|
6742
|
-
children: /* @__PURE__ */ (0,
|
|
7367
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl21.FormattedMessage, { id: "continue" })
|
|
6743
7368
|
}
|
|
6744
7369
|
)
|
|
6745
7370
|
] }) });
|
|
@@ -6747,9 +7372,10 @@ function CEXBindModal({
|
|
|
6747
7372
|
|
|
6748
7373
|
// src/context/BusinessProvider.tsx
|
|
6749
7374
|
var import_react_query9 = require("@tanstack/react-query");
|
|
6750
|
-
var
|
|
7375
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
6751
7376
|
function BusinessProvider({ children }) {
|
|
6752
7377
|
const { overview, token } = useUserInfo();
|
|
7378
|
+
const { type: EVMType, isOpen: EVMIsOpen, close: EVMClose } = useEVMModalStore();
|
|
6753
7379
|
const { type: TONType, isOpen: TONIsOpen, close: TONClose } = useTONModalStore();
|
|
6754
7380
|
const { type: TRONType, isOpen: TRONIsOpen, close: TRONClose } = useTRONModalStore();
|
|
6755
7381
|
const { type: BTCType, isOpen: BTCIsOpen, close: BTCClose } = useBTCModalStore();
|
|
@@ -6780,8 +7406,18 @@ function BusinessProvider({ children }) {
|
|
|
6780
7406
|
enabled: !!tgAppAuthCode,
|
|
6781
7407
|
refetchInterval: 1e3 * 5
|
|
6782
7408
|
});
|
|
6783
|
-
return /* @__PURE__ */ (0,
|
|
6784
|
-
/* @__PURE__ */ (0,
|
|
7409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
7410
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
7411
|
+
EVMModal,
|
|
7412
|
+
{
|
|
7413
|
+
isOpen: EVMIsOpen && (EVMType == "login" && !overview && !token || EVMType == "bind" && !!token && !!overview),
|
|
7414
|
+
onClose: EVMClose,
|
|
7415
|
+
type: EVMType,
|
|
7416
|
+
onSuccess: EVMClose,
|
|
7417
|
+
zIndex: 199
|
|
7418
|
+
}
|
|
7419
|
+
),
|
|
7420
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6785
7421
|
TRONModal,
|
|
6786
7422
|
{
|
|
6787
7423
|
isOpen: TRONIsOpen && (TRONType == "login" && !overview && !token || TRONType == "bind" && !!token && !!overview),
|
|
@@ -6791,7 +7427,7 @@ function BusinessProvider({ children }) {
|
|
|
6791
7427
|
zIndex: 199
|
|
6792
7428
|
}
|
|
6793
7429
|
),
|
|
6794
|
-
/* @__PURE__ */ (0,
|
|
7430
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6795
7431
|
TONModal,
|
|
6796
7432
|
{
|
|
6797
7433
|
isOpen: TONIsOpen && (TONType == "login" && !overview && !token || TONType == "bind" && !!token && !!overview),
|
|
@@ -6801,7 +7437,7 @@ function BusinessProvider({ children }) {
|
|
|
6801
7437
|
zIndex: 199
|
|
6802
7438
|
}
|
|
6803
7439
|
),
|
|
6804
|
-
/* @__PURE__ */ (0,
|
|
7440
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6805
7441
|
BTCModal,
|
|
6806
7442
|
{
|
|
6807
7443
|
isOpen: BTCIsOpen && (BTCType == "login" && !overview && !token || BTCType == "bind" && !!token && !!overview),
|
|
@@ -6811,7 +7447,7 @@ function BusinessProvider({ children }) {
|
|
|
6811
7447
|
zIndex: 199
|
|
6812
7448
|
}
|
|
6813
7449
|
),
|
|
6814
|
-
/* @__PURE__ */ (0,
|
|
7450
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6815
7451
|
CEXBindModal,
|
|
6816
7452
|
{
|
|
6817
7453
|
isOpen: CEXIsOpen && (!!token && !!overview),
|
|
@@ -6820,7 +7456,7 @@ function BusinessProvider({ children }) {
|
|
|
6820
7456
|
zIndex: 199
|
|
6821
7457
|
}
|
|
6822
7458
|
),
|
|
6823
|
-
/* @__PURE__ */ (0,
|
|
7459
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6824
7460
|
WalletModal,
|
|
6825
7461
|
{
|
|
6826
7462
|
isOpen: WalletModalStore.isOpen && (WalletModalStore.type == "login" && !overview && !token || WalletModalStore.type == "bind" && !!token && !!overview),
|
|
@@ -6835,14 +7471,14 @@ function BusinessProvider({ children }) {
|
|
|
6835
7471
|
}
|
|
6836
7472
|
|
|
6837
7473
|
// src/context/index.tsx
|
|
6838
|
-
var
|
|
7474
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
6839
7475
|
var Providers = ({ children }) => {
|
|
6840
|
-
return /* @__PURE__ */ (0,
|
|
7476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToastProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ModalProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(BusinessProvider, { children }) }) });
|
|
6841
7477
|
};
|
|
6842
7478
|
var context_default = Providers;
|
|
6843
7479
|
|
|
6844
7480
|
// src/hooks/useWalletInit.ts
|
|
6845
|
-
var
|
|
7481
|
+
var import_react39 = require("react");
|
|
6846
7482
|
|
|
6847
7483
|
// src/utils/wallet.ts
|
|
6848
7484
|
var sendMessage = ({ method, data, resolve, reject, timeout }) => {
|
|
@@ -6875,11 +7511,11 @@ function useWalletInit({
|
|
|
6875
7511
|
}) {
|
|
6876
7512
|
const { endpoints, token, setWallet, appid, refreshOverview } = useLocalStore_default();
|
|
6877
7513
|
const { setWalletReady, walletReady } = useStore_default();
|
|
6878
|
-
const iframeReadyRef = (0,
|
|
6879
|
-
(0,
|
|
7514
|
+
const iframeReadyRef = (0, import_react39.useRef)(walletReady);
|
|
7515
|
+
(0, import_react39.useEffect)(() => {
|
|
6880
7516
|
setWallet(config);
|
|
6881
7517
|
}, [config]);
|
|
6882
|
-
(0,
|
|
7518
|
+
(0, import_react39.useEffect)(() => {
|
|
6883
7519
|
matchlog_default.log("sdk.mpc.status", walletReady, iframeReadyRef.current);
|
|
6884
7520
|
iframeReadyRef.current = walletReady;
|
|
6885
7521
|
if (iframeReadyRef.current) {
|
|
@@ -6896,7 +7532,7 @@ function useWalletInit({
|
|
|
6896
7532
|
onReady();
|
|
6897
7533
|
}
|
|
6898
7534
|
}, [walletReady]);
|
|
6899
|
-
(0,
|
|
7535
|
+
(0, import_react39.useEffect)(() => {
|
|
6900
7536
|
if (!endpoints.auth || !appid || !token || !config) {
|
|
6901
7537
|
const existingIframe = getWalletIframe();
|
|
6902
7538
|
if (existingIframe) {
|
|
@@ -6996,7 +7632,7 @@ function useWalletInit({
|
|
|
6996
7632
|
}
|
|
6997
7633
|
}
|
|
6998
7634
|
}, [endpoints.auth, appid, token, config]);
|
|
6999
|
-
(0,
|
|
7635
|
+
(0, import_react39.useEffect)(() => {
|
|
7000
7636
|
const messageHandle = async (e) => {
|
|
7001
7637
|
if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
|
|
7002
7638
|
return;
|
|
@@ -7077,7 +7713,7 @@ function useWalletInit({
|
|
|
7077
7713
|
}
|
|
7078
7714
|
|
|
7079
7715
|
// src/hooks/useInit.tsx
|
|
7080
|
-
var
|
|
7716
|
+
var import_react40 = require("react");
|
|
7081
7717
|
function useInit({
|
|
7082
7718
|
theme,
|
|
7083
7719
|
appid,
|
|
@@ -7097,24 +7733,24 @@ function useInit({
|
|
|
7097
7733
|
locale: realLocale
|
|
7098
7734
|
} = useLocalStore_default();
|
|
7099
7735
|
const walletModalStore = useWalletModalStore();
|
|
7100
|
-
const overviewLoadingRef = (0,
|
|
7736
|
+
const overviewLoadingRef = (0, import_react40.useRef)(false);
|
|
7101
7737
|
const searchParams = new URLSearchParams(window.location.search);
|
|
7102
7738
|
const matchToken = searchParams.get("matchToken");
|
|
7103
7739
|
const matchidt = searchParams.get("matchidt");
|
|
7104
7740
|
const realEndpoints = endpoints || env_default.endpoints;
|
|
7105
|
-
(0,
|
|
7741
|
+
(0, import_react40.useEffect)(() => {
|
|
7106
7742
|
setTheme(theme);
|
|
7107
7743
|
}, [theme]);
|
|
7108
|
-
(0,
|
|
7744
|
+
(0, import_react40.useEffect)(() => {
|
|
7109
7745
|
setAppid(appid);
|
|
7110
7746
|
}, [appid]);
|
|
7111
|
-
(0,
|
|
7747
|
+
(0, import_react40.useEffect)(() => {
|
|
7112
7748
|
setEndpoints(realEndpoints);
|
|
7113
7749
|
}, [realEndpoints]);
|
|
7114
|
-
(0,
|
|
7750
|
+
(0, import_react40.useEffect)(() => {
|
|
7115
7751
|
setLocale(locale || "en");
|
|
7116
7752
|
}, [locale]);
|
|
7117
|
-
(0,
|
|
7753
|
+
(0, import_react40.useEffect)(() => {
|
|
7118
7754
|
if (matchToken) {
|
|
7119
7755
|
const tokenData = JSON.parse(atob(matchToken));
|
|
7120
7756
|
if (tokenData && tokenData.mid && tokenData.token) {
|
|
@@ -7125,7 +7761,7 @@ function useInit({
|
|
|
7125
7761
|
}
|
|
7126
7762
|
}
|
|
7127
7763
|
}, [matchToken]);
|
|
7128
|
-
(0,
|
|
7764
|
+
(0, import_react40.useEffect)(() => {
|
|
7129
7765
|
if (matchidt) {
|
|
7130
7766
|
const tokenData = decodeURIComponent(matchidt);
|
|
7131
7767
|
const data = JSON.parse(decodeBase64(tokenData));
|
|
@@ -7155,7 +7791,7 @@ function useInit({
|
|
|
7155
7791
|
}
|
|
7156
7792
|
}
|
|
7157
7793
|
}, [matchidt]);
|
|
7158
|
-
(0,
|
|
7794
|
+
(0, import_react40.useEffect)(() => {
|
|
7159
7795
|
const onLoginMessage = (event) => {
|
|
7160
7796
|
const res = event.data;
|
|
7161
7797
|
if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
|
|
@@ -7192,7 +7828,7 @@ function useInit({
|
|
|
7192
7828
|
overviewLoadingRef.current = false;
|
|
7193
7829
|
}
|
|
7194
7830
|
};
|
|
7195
|
-
(0,
|
|
7831
|
+
(0, import_react40.useEffect)(() => {
|
|
7196
7832
|
if (token) {
|
|
7197
7833
|
loadOverview();
|
|
7198
7834
|
}
|
|
@@ -7223,7 +7859,7 @@ function useInit({
|
|
|
7223
7859
|
|
|
7224
7860
|
// src/MatchContext.tsx
|
|
7225
7861
|
var import_react_query10 = require("@tanstack/react-query");
|
|
7226
|
-
var
|
|
7862
|
+
var import_react_intl22 = require("react-intl");
|
|
7227
7863
|
|
|
7228
7864
|
// src/i18n/en.json
|
|
7229
7865
|
var en_default = {
|
|
@@ -7968,9 +8604,9 @@ var messages = {
|
|
|
7968
8604
|
};
|
|
7969
8605
|
|
|
7970
8606
|
// src/MatchContext.tsx
|
|
7971
|
-
var
|
|
8607
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
7972
8608
|
var queryClient = new import_react_query10.QueryClient();
|
|
7973
|
-
var MatchContext = (0,
|
|
8609
|
+
var MatchContext = (0, import_react41.createContext)(void 0);
|
|
7974
8610
|
var MatchProvider = ({
|
|
7975
8611
|
children,
|
|
7976
8612
|
appid,
|
|
@@ -7990,7 +8626,7 @@ var MatchProvider = ({
|
|
|
7990
8626
|
useWalletInit({
|
|
7991
8627
|
config: wallet
|
|
7992
8628
|
});
|
|
7993
|
-
return /* @__PURE__ */ (0,
|
|
8629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react_intl22.IntlProvider, { locale: realLocale, messages: messages[realLocale], children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react_query10.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
7994
8630
|
MatchContext.Provider,
|
|
7995
8631
|
{
|
|
7996
8632
|
value: {
|
|
@@ -8001,12 +8637,12 @@ var MatchProvider = ({
|
|
|
8001
8637
|
theme,
|
|
8002
8638
|
locale: realLocale
|
|
8003
8639
|
},
|
|
8004
|
-
children: /* @__PURE__ */ (0,
|
|
8640
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(context_default, { children })
|
|
8005
8641
|
}
|
|
8006
8642
|
) }) });
|
|
8007
8643
|
};
|
|
8008
8644
|
var useMatch = () => {
|
|
8009
|
-
const context = (0,
|
|
8645
|
+
const context = (0, import_react41.useContext)(MatchContext);
|
|
8010
8646
|
if (context === void 0) {
|
|
8011
8647
|
throw new Error("useMatch must be used within a MatchProvider");
|
|
8012
8648
|
}
|
|
@@ -8092,68 +8728,6 @@ __export(chains_exports, {
|
|
|
8092
8728
|
MatchTest: () => matchTest
|
|
8093
8729
|
});
|
|
8094
8730
|
|
|
8095
|
-
// src/config/chains/MatchMain.ts
|
|
8096
|
-
var import_viem14 = require("viem");
|
|
8097
|
-
var matchMain = /* @__PURE__ */ (0, import_viem14.defineChain)({
|
|
8098
|
-
//定义match链
|
|
8099
|
-
id: 698,
|
|
8100
|
-
name: "Matchain",
|
|
8101
|
-
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
8102
|
-
rpcUrls: {
|
|
8103
|
-
default: {
|
|
8104
|
-
http: ["https://rpc.matchain.io"]
|
|
8105
|
-
}
|
|
8106
|
-
},
|
|
8107
|
-
blockExplorers: {
|
|
8108
|
-
default: {
|
|
8109
|
-
name: "Matchscan",
|
|
8110
|
-
url: "https://matchscan.io/",
|
|
8111
|
-
apiUrl: "https://matchscan.io/api"
|
|
8112
|
-
}
|
|
8113
|
-
},
|
|
8114
|
-
iconUrl: "https://matchscan.io/static/identicon_logos/blockies.png",
|
|
8115
|
-
contracts: {
|
|
8116
|
-
multicall3: {
|
|
8117
|
-
address: "0xca11bde05977b3631167028862be2a173976ca11"
|
|
8118
|
-
}
|
|
8119
|
-
}
|
|
8120
|
-
// testnet: true,
|
|
8121
|
-
});
|
|
8122
|
-
|
|
8123
|
-
// src/config/chains/MatchTest.ts
|
|
8124
|
-
var import_viem15 = require("viem");
|
|
8125
|
-
var matchTest = /* @__PURE__ */ (0, import_viem15.defineChain)({
|
|
8126
|
-
//定义matchTest链
|
|
8127
|
-
id: 699,
|
|
8128
|
-
name: "MatchTest",
|
|
8129
|
-
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
8130
|
-
rpcUrls: {
|
|
8131
|
-
default: {
|
|
8132
|
-
http: ["https://testnet-rpc.matchain.io"]
|
|
8133
|
-
}
|
|
8134
|
-
},
|
|
8135
|
-
blockExplorers: {
|
|
8136
|
-
default: {
|
|
8137
|
-
name: "Matchscan",
|
|
8138
|
-
url: "https://testnet.matchscan.io/",
|
|
8139
|
-
apiUrl: "https://testnet.matchscan.io/api"
|
|
8140
|
-
}
|
|
8141
|
-
},
|
|
8142
|
-
iconUrl: "https://testnet.matchscan.io/static/identicon_logos/blockies.png",
|
|
8143
|
-
contracts: {
|
|
8144
|
-
multicall3: {
|
|
8145
|
-
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
8146
|
-
blockCreated: 751532
|
|
8147
|
-
},
|
|
8148
|
-
ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
|
|
8149
|
-
ensUniversalResolver: {
|
|
8150
|
-
address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",
|
|
8151
|
-
blockCreated: 5317080
|
|
8152
|
-
}
|
|
8153
|
-
}
|
|
8154
|
-
// testnet: true,
|
|
8155
|
-
});
|
|
8156
|
-
|
|
8157
8731
|
// src/types/index.ts
|
|
8158
8732
|
var types_exports = {};
|
|
8159
8733
|
__export(types_exports, {
|