@matchain/matchid-sdk-react 0.1.53-alpha.3 → 0.1.53-alpha.4
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-4EVF2PXX.mjs → chunk-4J3KZCLG.mjs} +2 -2
- package/dist/{chunk-HYQ3T6WW.mjs → chunk-JX73EY6V.mjs} +2 -14
- package/dist/chunk-JX73EY6V.mjs.map +1 -0
- package/dist/{chunk-3YF3P77J.mjs → chunk-XXZZYALJ.mjs} +766 -188
- package/dist/chunk-XXZZYALJ.mjs.map +1 -0
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +829 -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 +1068 -508
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -7
- 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/dist/{chunk-4EVF2PXX.mjs.map → chunk-4J3KZCLG.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,653 @@ 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 { status, setStatus, error, setError, statusRef, nonce, setNonce, init } = useWalletBox({
|
|
4682
|
+
onInit: async ({ setStatus: setStatus2 }) => {
|
|
4683
|
+
setStatus2("start");
|
|
4684
|
+
}
|
|
4685
|
+
});
|
|
4686
|
+
(0, import_react23.useEffect)(() => {
|
|
4687
|
+
console.log(`status=${status}`, `connectModalOpen=${connectModalOpen}`, `address=${address}`, `isConnected=${isConnected}`);
|
|
4688
|
+
}, [status, connectModalOpen, isConnected, address]);
|
|
4689
|
+
(0, import_react23.useEffect)(() => {
|
|
4690
|
+
if (connectModalOpen) {
|
|
4691
|
+
setStatus("connecting");
|
|
4692
|
+
return;
|
|
4693
|
+
}
|
|
4694
|
+
if (!connectModalOpen && address) {
|
|
4695
|
+
toLoginInWallet(address);
|
|
4696
|
+
return;
|
|
4697
|
+
}
|
|
4698
|
+
if (!connectModalOpen && !address) {
|
|
4699
|
+
setStatus("start");
|
|
4700
|
+
}
|
|
4701
|
+
}, [connectModalOpen, address]);
|
|
4702
|
+
(0, import_react23.useEffect)(() => {
|
|
4703
|
+
if (openConnectModal && !address) {
|
|
4704
|
+
openConnectModal && openConnectModal();
|
|
4705
|
+
}
|
|
4706
|
+
}, [openConnectModal]);
|
|
4707
|
+
const toLoginInWallet = async (address2) => {
|
|
4708
|
+
if (statusRef.current != "start" && statusRef.current != "connecting") return;
|
|
4709
|
+
try {
|
|
4710
|
+
if (!address2) {
|
|
4711
|
+
throw new Error("Wallet address is empty");
|
|
4712
|
+
}
|
|
4713
|
+
setStatus("nonce");
|
|
4714
|
+
const res = type == "bind" ? await getWalletInitApi({
|
|
4715
|
+
address: address2,
|
|
4716
|
+
type: "EVM"
|
|
4717
|
+
}) : await getWalletNonceApi({ address: address2, type: "EVM" });
|
|
4718
|
+
if (!isSuccess(res)) {
|
|
4719
|
+
throw new Error(res.message);
|
|
4720
|
+
}
|
|
4721
|
+
setNonce(res.data.nonce);
|
|
4722
|
+
} catch (error2) {
|
|
4723
|
+
console.error("toLoginInWallet", error2);
|
|
4724
|
+
setStatus("error");
|
|
4725
|
+
setError(error2.message);
|
|
4726
|
+
}
|
|
4727
|
+
};
|
|
4728
|
+
const signature = (0, import_react23.useCallback)(async () => {
|
|
4729
|
+
if (!nonce || status != "nonce") {
|
|
4730
|
+
return;
|
|
4731
|
+
}
|
|
4732
|
+
try {
|
|
4733
|
+
const signer = await getEthersSigner(config);
|
|
4734
|
+
if (!signer) return;
|
|
4735
|
+
matchlog_default.log("signature", nonce, status);
|
|
4736
|
+
if (!address) {
|
|
4737
|
+
throw new Error("Wallet address is empty");
|
|
4738
|
+
}
|
|
4739
|
+
setStatus("signer");
|
|
4740
|
+
const params = {
|
|
4741
|
+
domain: window.location.host,
|
|
4742
|
+
address,
|
|
4743
|
+
statement: "By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",
|
|
4744
|
+
uri: window.location.origin,
|
|
4745
|
+
nonce,
|
|
4746
|
+
version: "1",
|
|
4747
|
+
chainId
|
|
4748
|
+
};
|
|
4749
|
+
const message = new import_siwe.SiweMessage({ ...params });
|
|
4750
|
+
const signature2 = await signer.signMessage(message.prepareMessage());
|
|
4751
|
+
const obj = {
|
|
4752
|
+
type: "EVM",
|
|
4753
|
+
address,
|
|
4754
|
+
signature: signature2,
|
|
4755
|
+
message: `${message.prepareMessage()}`,
|
|
4756
|
+
connector_type: connector?.type || "",
|
|
4757
|
+
wallet_client_type: connector?.name || ""
|
|
4758
|
+
};
|
|
4759
|
+
const res = type == "bind" ? await toBindWalletApi(obj) : await loginByWalletApi(obj);
|
|
4760
|
+
if (!isSuccess(res)) {
|
|
4761
|
+
throw new Error(res.message);
|
|
4762
|
+
}
|
|
4763
|
+
matchlog_default.log(res);
|
|
4764
|
+
setStatus("success");
|
|
4765
|
+
if (type == "bind") {
|
|
4766
|
+
events.onBind && events.onBind({
|
|
4767
|
+
type: "evm"
|
|
4768
|
+
});
|
|
4769
|
+
eventManager_default.emit("onBind", {
|
|
4770
|
+
type: "evm"
|
|
4771
|
+
});
|
|
4772
|
+
} else {
|
|
4773
|
+
await login({
|
|
4774
|
+
token: `${res.data.token_type} ${res.data.access_token}`
|
|
4775
|
+
});
|
|
4776
|
+
}
|
|
4777
|
+
onSuccess && onSuccess();
|
|
4778
|
+
} catch (error2) {
|
|
4779
|
+
console.error("signature", error2);
|
|
4780
|
+
setStatus("error");
|
|
4781
|
+
setError(error2.message);
|
|
4782
|
+
}
|
|
4783
|
+
}, [nonce, status, address]);
|
|
4784
|
+
(0, import_react23.useEffect)(() => {
|
|
4785
|
+
if (signature) {
|
|
4786
|
+
signature();
|
|
4787
|
+
}
|
|
4788
|
+
}, [signature]);
|
|
4789
|
+
const onError = async () => {
|
|
4790
|
+
if (isConnected) {
|
|
4791
|
+
try {
|
|
4792
|
+
await disconnectAsync();
|
|
4793
|
+
} catch (error2) {
|
|
4794
|
+
console.error("disconnectAsync", error2);
|
|
4795
|
+
}
|
|
4796
|
+
}
|
|
4797
|
+
setError("");
|
|
4798
|
+
setNonce(void 0);
|
|
4799
|
+
setStatus("start");
|
|
4800
|
+
openConnectModal?.();
|
|
4801
|
+
};
|
|
4802
|
+
const onConnect = async () => {
|
|
4803
|
+
console.log("onConnect");
|
|
4804
|
+
setError("");
|
|
4805
|
+
setNonce(void 0);
|
|
4806
|
+
openConnectModal?.();
|
|
4807
|
+
};
|
|
4808
|
+
const onDisconnect = async () => {
|
|
4809
|
+
await disconnectAsync();
|
|
4810
|
+
setError("");
|
|
4811
|
+
setNonce(void 0);
|
|
4812
|
+
setStatus("start");
|
|
4813
|
+
};
|
|
4814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
4815
|
+
WalletModalContentV2,
|
|
4816
|
+
{
|
|
4817
|
+
status,
|
|
4818
|
+
onSuccess: async () => onSuccess?.(),
|
|
4819
|
+
error,
|
|
4820
|
+
onError,
|
|
4821
|
+
onConnect,
|
|
4822
|
+
onDisconnect
|
|
4823
|
+
}
|
|
4824
|
+
);
|
|
4825
|
+
}
|
|
4826
|
+
var wagmiConfig = (0, import_rainbowkit.getDefaultConfig)({
|
|
4827
|
+
appName: "MatchID",
|
|
4828
|
+
projectId: "9ac6ea7e07860f04616fb311b447dee9",
|
|
4829
|
+
wallets: [
|
|
4830
|
+
{
|
|
4831
|
+
groupName: "Recommended",
|
|
4832
|
+
wallets: [
|
|
4833
|
+
import_wallets.metaMaskWallet,
|
|
4834
|
+
import_wallets.walletConnectWallet,
|
|
4835
|
+
import_wallets.okxWallet,
|
|
4836
|
+
import_wallets.bitgetWallet,
|
|
4837
|
+
import_wallets.injectedWallet
|
|
4838
|
+
]
|
|
4839
|
+
}
|
|
4840
|
+
],
|
|
4841
|
+
chains: [import_chains.mainnet, import_chains.polygon, import_chains.optimism, import_chains.arbitrum, import_chains.base, matchMain, matchTest, import_chains.bsc]
|
|
4842
|
+
});
|
|
4843
|
+
function EVMConnectModal({
|
|
4844
|
+
type = "login",
|
|
4845
|
+
onSuccess,
|
|
4846
|
+
...props
|
|
4365
4847
|
}) {
|
|
4366
|
-
const isDownMd = useDownMd();
|
|
4367
4848
|
const intl = (0, import_react_intl10.useIntl)();
|
|
4849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
4850
|
+
id: type == "bind" ? "bindWith" : "loginWith"
|
|
4851
|
+
}, {
|
|
4852
|
+
name: "EVM"
|
|
4853
|
+
}), 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 }) }) }) });
|
|
4854
|
+
}
|
|
4855
|
+
function EVMModal(props) {
|
|
4856
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(EVMConnectModal, { ...props });
|
|
4857
|
+
}
|
|
4858
|
+
|
|
4859
|
+
// src/components/TRONModal/index.tsx
|
|
4860
|
+
var import_react25 = __toESM(require("react"));
|
|
4861
|
+
var import_react_intl11 = require("react-intl");
|
|
4862
|
+
|
|
4863
|
+
// src/lib/tron/TronLinkAdapter.ts
|
|
4864
|
+
var TronLinkAdapter = class {
|
|
4865
|
+
constructor() {
|
|
4866
|
+
this.name = "TronLink Wallet";
|
|
4867
|
+
this.website = "https://www.tronlink.org/";
|
|
4868
|
+
this.walletKey = "tronlink";
|
|
4869
|
+
}
|
|
4870
|
+
async isInstalled() {
|
|
4871
|
+
return typeof window.tronWeb !== "undefined" && typeof window.tronLink !== "undefined";
|
|
4872
|
+
}
|
|
4873
|
+
async connect() {
|
|
4874
|
+
if (!await this.isInstalled()) throw new Error("TronLink Wallet is not installed");
|
|
4875
|
+
if (!window.tronWeb.defaultAddress.base58) {
|
|
4876
|
+
await window.tronWeb.request(
|
|
4877
|
+
{
|
|
4878
|
+
method: "tron_requestAccounts",
|
|
4879
|
+
params: window.tronLink.tronlinkParams
|
|
4880
|
+
}
|
|
4881
|
+
);
|
|
4882
|
+
}
|
|
4883
|
+
if (!window.tronWeb.defaultAddress.base58) {
|
|
4884
|
+
throw new Error("Your should unlink your wallet and try again");
|
|
4885
|
+
}
|
|
4886
|
+
return window.tronWeb.defaultAddress.base58;
|
|
4887
|
+
}
|
|
4888
|
+
async signMessage(message) {
|
|
4889
|
+
return await window.tronWeb.trx.signMessageV2(message);
|
|
4890
|
+
}
|
|
4891
|
+
};
|
|
4892
|
+
|
|
4893
|
+
// src/hooks/useTRONWallet.ts
|
|
4894
|
+
var import_react24 = require("react");
|
|
4895
|
+
|
|
4896
|
+
// src/lib/tron/BitgetAdapter.ts
|
|
4897
|
+
var BitgetAdapter = class {
|
|
4898
|
+
constructor() {
|
|
4899
|
+
this.name = "Bitget Wallet";
|
|
4900
|
+
this.website = "https://web3.bitget.com/zh-CN/wallet-download";
|
|
4901
|
+
this.walletKey = "bitget";
|
|
4902
|
+
}
|
|
4903
|
+
async isInstalled() {
|
|
4904
|
+
return typeof window.bitkeep !== "undefined" && typeof window.bitkeep.tronWeb !== "undefined" && typeof window.bitkeep.tronLink !== "undefined";
|
|
4905
|
+
}
|
|
4906
|
+
async connect() {
|
|
4907
|
+
if (!await this.isInstalled()) throw new Error("Bitkeep Wallet is not installed");
|
|
4908
|
+
await window.bitkeep.tronLink.request({ method: "tron_requestAccounts" });
|
|
4909
|
+
return window.bitkeep.tronWeb.defaultAddress.base58;
|
|
4910
|
+
}
|
|
4911
|
+
async signMessage(message) {
|
|
4912
|
+
return await window.bitkeep.tronWeb.trx.signMessageV2(message);
|
|
4913
|
+
}
|
|
4914
|
+
};
|
|
4915
|
+
|
|
4916
|
+
// src/lib/tron/OKXAdapter.ts
|
|
4917
|
+
var OKXAdapter = class {
|
|
4918
|
+
constructor() {
|
|
4919
|
+
this.name = "OKX Wallet";
|
|
4920
|
+
this.website = "https://www.okx.com/zh-hans/download";
|
|
4921
|
+
this.walletKey = "okx";
|
|
4922
|
+
}
|
|
4923
|
+
async isInstalled() {
|
|
4924
|
+
return typeof window.okxwallet !== "undefined" && typeof window.okxwallet.tronWeb !== "undefined" && typeof window.okxwallet.tronLink !== "undefined";
|
|
4925
|
+
}
|
|
4926
|
+
async connect() {
|
|
4927
|
+
if (!await this.isInstalled()) throw new Error("OKX Wallet is not installed");
|
|
4928
|
+
await window.okxwallet.tronLink.request({ method: "tron_requestAccounts" });
|
|
4929
|
+
return window.okxwallet.tronWeb.defaultAddress.base58;
|
|
4930
|
+
}
|
|
4931
|
+
async signMessage(message) {
|
|
4932
|
+
return await window.okxwallet.tronWeb.trx.signMessageV2(message);
|
|
4933
|
+
}
|
|
4934
|
+
};
|
|
4935
|
+
|
|
4936
|
+
// src/hooks/useTRONWallet.ts
|
|
4937
|
+
var useTRONWallet = () => {
|
|
4938
|
+
const wallets = [new TronLinkAdapter(), new BitgetAdapter(), new OKXAdapter()];
|
|
4939
|
+
const [installedWallets, setInstalledWallets] = (0, import_react24.useState)([]);
|
|
4940
|
+
const [address, setAddress] = (0, import_react24.useState)(null);
|
|
4941
|
+
(0, import_react24.useEffect)(() => {
|
|
4942
|
+
const getInstalled = async () => {
|
|
4943
|
+
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
4944
|
+
wallet: wallet2,
|
|
4945
|
+
isInstalled
|
|
4946
|
+
}))));
|
|
4947
|
+
setInstalledWallets(installed.filter(({ isInstalled }) => isInstalled).map(({ wallet: wallet2 }) => wallet2));
|
|
4948
|
+
};
|
|
4949
|
+
getInstalled();
|
|
4950
|
+
}, []);
|
|
4951
|
+
const [wallet, chooseWallet] = (0, import_react24.useState)(null);
|
|
4952
|
+
const onConnect = async () => {
|
|
4953
|
+
setAddress(await wallet.connect());
|
|
4954
|
+
};
|
|
4955
|
+
(0, import_react24.useEffect)(() => {
|
|
4956
|
+
if (!wallet) {
|
|
4957
|
+
setAddress(null);
|
|
4958
|
+
}
|
|
4959
|
+
}, [wallet]);
|
|
4960
|
+
return {
|
|
4961
|
+
installedWallets,
|
|
4962
|
+
wallets,
|
|
4963
|
+
chooseWallet,
|
|
4964
|
+
wallet,
|
|
4965
|
+
address,
|
|
4966
|
+
onConnect
|
|
4967
|
+
};
|
|
4968
|
+
};
|
|
4969
|
+
|
|
4970
|
+
// src/components/TRONModal/index.tsx
|
|
4971
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
4972
|
+
function TRONConnectModal({
|
|
4973
|
+
type = "login",
|
|
4974
|
+
onSuccess,
|
|
4975
|
+
...props
|
|
4976
|
+
}) {
|
|
4977
|
+
const isDownMd = useDownMd();
|
|
4978
|
+
const intl = (0, import_react_intl11.useIntl)();
|
|
4368
4979
|
const { wallets, installedWallets, chooseWallet, wallet, address, onConnect } = useTRONWallet();
|
|
4369
4980
|
const iconMaps = {
|
|
4370
|
-
tronlink: /* @__PURE__ */ (0,
|
|
4371
|
-
bitget: /* @__PURE__ */ (0,
|
|
4372
|
-
okx: /* @__PURE__ */ (0,
|
|
4981
|
+
tronlink: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(TronLinkIcon, { size: isDownMd ? 36 : 40 }),
|
|
4982
|
+
bitget: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(BitgetIcon, { size: isDownMd ? 36 : 40 }),
|
|
4983
|
+
okx: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(OKXIcon, { size: isDownMd ? 36 : 40 })
|
|
4373
4984
|
};
|
|
4374
4985
|
const { events, login } = useMatch();
|
|
4375
|
-
const [status, setStatus] = (0,
|
|
4376
|
-
const statusRef =
|
|
4377
|
-
const [error, setError] = (0,
|
|
4378
|
-
const connected = (0,
|
|
4986
|
+
const [status, setStatus] = (0, import_react25.useState)("");
|
|
4987
|
+
const statusRef = import_react25.default.useRef(status);
|
|
4988
|
+
const [error, setError] = (0, import_react25.useState)("");
|
|
4989
|
+
const connected = (0, import_react25.useMemo)(() => {
|
|
4379
4990
|
return !!address;
|
|
4380
4991
|
}, [address]);
|
|
4381
4992
|
const disconnect = async () => {
|
|
@@ -4443,7 +5054,7 @@ function TRONConnectModal({
|
|
|
4443
5054
|
statusRef.current = "";
|
|
4444
5055
|
}
|
|
4445
5056
|
};
|
|
4446
|
-
(0,
|
|
5057
|
+
(0, import_react25.useEffect)(() => {
|
|
4447
5058
|
if (wallet) {
|
|
4448
5059
|
console.log("onConnect");
|
|
4449
5060
|
onConnect();
|
|
@@ -4451,21 +5062,21 @@ function TRONConnectModal({
|
|
|
4451
5062
|
setStatus("");
|
|
4452
5063
|
}
|
|
4453
5064
|
}, [wallet]);
|
|
4454
|
-
(0,
|
|
5065
|
+
(0, import_react25.useEffect)(() => {
|
|
4455
5066
|
if (address) {
|
|
4456
5067
|
toLoginInWallet();
|
|
4457
5068
|
}
|
|
4458
5069
|
}, [address]);
|
|
4459
|
-
(0,
|
|
5070
|
+
(0, import_react25.useEffect)(() => {
|
|
4460
5071
|
if (!props.isOpen) {
|
|
4461
5072
|
disconnect();
|
|
4462
5073
|
}
|
|
4463
5074
|
}, [props.isOpen]);
|
|
4464
|
-
return /* @__PURE__ */ (0,
|
|
5075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
4465
5076
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
4466
5077
|
}, {
|
|
4467
5078
|
name: "TRON"
|
|
4468
|
-
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0,
|
|
5079
|
+
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
4469
5080
|
WalletModalContent,
|
|
4470
5081
|
{
|
|
4471
5082
|
error,
|
|
@@ -4478,9 +5089,9 @@ function TRONConnectModal({
|
|
|
4478
5089
|
setVisible: () => {
|
|
4479
5090
|
}
|
|
4480
5091
|
}
|
|
4481
|
-
) : /* @__PURE__ */ (0,
|
|
5092
|
+
) : /* @__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
5093
|
installedWallets.map((wallet2) => {
|
|
4483
|
-
return /* @__PURE__ */ (0,
|
|
5094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
4484
5095
|
RecommendItem,
|
|
4485
5096
|
{
|
|
4486
5097
|
icon: iconMaps[wallet2.walletKey],
|
|
@@ -4493,14 +5104,14 @@ function TRONConnectModal({
|
|
|
4493
5104
|
);
|
|
4494
5105
|
}),
|
|
4495
5106
|
wallets.filter((wallet2) => !installedWallets.find((installedWallet) => installedWallet.walletKey == wallet2.walletKey)).map((wallet2) => {
|
|
4496
|
-
return /* @__PURE__ */ (0,
|
|
5107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
4497
5108
|
RecommendItem,
|
|
4498
5109
|
{
|
|
4499
5110
|
icon: iconMaps[wallet2.walletKey],
|
|
4500
5111
|
name: wallet2.name,
|
|
4501
5112
|
onClick: () => {
|
|
4502
5113
|
},
|
|
4503
|
-
footer: /* @__PURE__ */ (0,
|
|
5114
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Button, { size: "sm", onClick: () => {
|
|
4504
5115
|
window.open(wallet2.website);
|
|
4505
5116
|
}, children: "Install" })
|
|
4506
5117
|
},
|
|
@@ -4510,28 +5121,28 @@ function TRONConnectModal({
|
|
|
4510
5121
|
] }) }) });
|
|
4511
5122
|
}
|
|
4512
5123
|
function TRONModal(props) {
|
|
4513
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
5124
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(TRONConnectModal, { ...props, type: props.type });
|
|
4514
5125
|
}
|
|
4515
5126
|
|
|
4516
5127
|
// src/components/TONModal/index.tsx
|
|
4517
|
-
var
|
|
4518
|
-
var
|
|
5128
|
+
var import_react26 = __toESM(require("react"));
|
|
5129
|
+
var import_react_intl12 = require("react-intl");
|
|
4519
5130
|
var import_ui_react = require("@tonconnect/ui-react");
|
|
4520
|
-
var
|
|
4521
|
-
function
|
|
5131
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
5132
|
+
function WalletContent2({
|
|
4522
5133
|
onSuccess,
|
|
4523
5134
|
type
|
|
4524
5135
|
}) {
|
|
4525
5136
|
const { events, login } = useMatch();
|
|
4526
|
-
const [connected, setConnected] = (0,
|
|
5137
|
+
const [connected, setConnected] = (0, import_react26.useState)(false);
|
|
4527
5138
|
const wallet = (0, import_ui_react.useTonWallet)();
|
|
4528
5139
|
const userFriendlyAddress = (0, import_ui_react.useTonAddress)();
|
|
4529
5140
|
const [tonConnectUI] = (0, import_ui_react.useTonConnectUI)();
|
|
4530
5141
|
const { state, open, close } = (0, import_ui_react.useTonConnectModal)();
|
|
4531
|
-
const [status, setStatus] = (0,
|
|
4532
|
-
const statusRef =
|
|
4533
|
-
const [error, setError] = (0,
|
|
4534
|
-
(0,
|
|
5142
|
+
const [status, setStatus] = (0, import_react26.useState)("");
|
|
5143
|
+
const statusRef = import_react26.default.useRef(status);
|
|
5144
|
+
const [error, setError] = (0, import_react26.useState)("");
|
|
5145
|
+
(0, import_react26.useEffect)(() => {
|
|
4535
5146
|
const init = async () => {
|
|
4536
5147
|
if (tonConnectUI.connected) {
|
|
4537
5148
|
await tonConnectUI.disconnect();
|
|
@@ -4604,7 +5215,7 @@ function WalletContent({
|
|
|
4604
5215
|
}
|
|
4605
5216
|
});
|
|
4606
5217
|
}, []);
|
|
4607
|
-
(0,
|
|
5218
|
+
(0, import_react26.useEffect)(() => {
|
|
4608
5219
|
if (wallet) {
|
|
4609
5220
|
setConnected(true);
|
|
4610
5221
|
console.log("Wallet connected:", wallet);
|
|
@@ -4615,7 +5226,7 @@ function WalletContent({
|
|
|
4615
5226
|
setStatus("");
|
|
4616
5227
|
}
|
|
4617
5228
|
}, [wallet]);
|
|
4618
|
-
(0,
|
|
5229
|
+
(0, import_react26.useEffect)(() => {
|
|
4619
5230
|
console.log({
|
|
4620
5231
|
state,
|
|
4621
5232
|
wallet
|
|
@@ -4644,7 +5255,7 @@ function WalletContent({
|
|
|
4644
5255
|
}
|
|
4645
5256
|
}
|
|
4646
5257
|
}, [state]);
|
|
4647
|
-
return /* @__PURE__ */ (0,
|
|
5258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
4648
5259
|
WalletModalContent,
|
|
4649
5260
|
{
|
|
4650
5261
|
connected,
|
|
@@ -4675,28 +5286,28 @@ function TONConnectModal({
|
|
|
4675
5286
|
onSuccess,
|
|
4676
5287
|
...props
|
|
4677
5288
|
}) {
|
|
4678
|
-
const intl = (0,
|
|
5289
|
+
const intl = (0, import_react_intl12.useIntl)();
|
|
4679
5290
|
const { endpoints, appid } = useLocalStore_default();
|
|
4680
5291
|
const manifestUrl = `${endpoints.back}api/v1/wallet/ton?appid=${appid}&url=` + encodeURIComponent(window.location.origin);
|
|
4681
|
-
return /* @__PURE__ */ (0,
|
|
5292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
4682
5293
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
4683
5294
|
}, {
|
|
4684
5295
|
name: "TON"
|
|
4685
|
-
}), children: /* @__PURE__ */ (0,
|
|
5296
|
+
}), children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
4686
5297
|
import_ui_react.TonConnectUIProvider,
|
|
4687
5298
|
{
|
|
4688
5299
|
manifestUrl,
|
|
4689
|
-
children: /* @__PURE__ */ (0,
|
|
5300
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(WalletContent2, { onSuccess, type })
|
|
4690
5301
|
}
|
|
4691
5302
|
) });
|
|
4692
5303
|
}
|
|
4693
5304
|
function TONModal(props) {
|
|
4694
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
5305
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(TONConnectModal, { ...props });
|
|
4695
5306
|
}
|
|
4696
5307
|
|
|
4697
5308
|
// src/components/BTCModal/index.tsx
|
|
4698
|
-
var
|
|
4699
|
-
var
|
|
5309
|
+
var import_react28 = __toESM(require("react"));
|
|
5310
|
+
var import_react_intl13 = require("react-intl");
|
|
4700
5311
|
|
|
4701
5312
|
// src/lib/btc/UnisatAdapter.ts
|
|
4702
5313
|
var UnisatAdapter = class {
|
|
@@ -4844,7 +5455,7 @@ var LeatherAdapter = class {
|
|
|
4844
5455
|
};
|
|
4845
5456
|
|
|
4846
5457
|
// src/hooks/useBTCWallet.ts
|
|
4847
|
-
var
|
|
5458
|
+
var import_react27 = require("react");
|
|
4848
5459
|
|
|
4849
5460
|
// src/lib/btc/PhantomAdapter.ts
|
|
4850
5461
|
var PhantomAdapter = class {
|
|
@@ -4882,9 +5493,9 @@ var PhantomAdapter = class {
|
|
|
4882
5493
|
// src/hooks/useBTCWallet.ts
|
|
4883
5494
|
var useBTCWallet = () => {
|
|
4884
5495
|
const wallets = [new UnisatAdapter(), new XverseAdapter(), new LeatherAdapter(), new PhantomAdapter()];
|
|
4885
|
-
const [installedWallets, setInstalledWallets] = (0,
|
|
4886
|
-
const [address, setAddress] = (0,
|
|
4887
|
-
(0,
|
|
5496
|
+
const [installedWallets, setInstalledWallets] = (0, import_react27.useState)([]);
|
|
5497
|
+
const [address, setAddress] = (0, import_react27.useState)(null);
|
|
5498
|
+
(0, import_react27.useEffect)(() => {
|
|
4888
5499
|
const getInstalled = async () => {
|
|
4889
5500
|
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
4890
5501
|
wallet: wallet2,
|
|
@@ -4894,11 +5505,11 @@ var useBTCWallet = () => {
|
|
|
4894
5505
|
};
|
|
4895
5506
|
getInstalled();
|
|
4896
5507
|
}, []);
|
|
4897
|
-
const [wallet, chooseWallet] = (0,
|
|
5508
|
+
const [wallet, chooseWallet] = (0, import_react27.useState)(null);
|
|
4898
5509
|
const onConnect = async () => {
|
|
4899
5510
|
setAddress(await wallet.connect());
|
|
4900
5511
|
};
|
|
4901
|
-
(0,
|
|
5512
|
+
(0, import_react27.useEffect)(() => {
|
|
4902
5513
|
if (!wallet) {
|
|
4903
5514
|
setAddress(null);
|
|
4904
5515
|
}
|
|
@@ -4914,26 +5525,26 @@ var useBTCWallet = () => {
|
|
|
4914
5525
|
};
|
|
4915
5526
|
|
|
4916
5527
|
// src/components/BTCModal/index.tsx
|
|
4917
|
-
var
|
|
5528
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
4918
5529
|
function BTCConnectModal({
|
|
4919
5530
|
type = "login",
|
|
4920
5531
|
onSuccess,
|
|
4921
5532
|
...props
|
|
4922
5533
|
}) {
|
|
4923
5534
|
const isDownMd = useDownMd();
|
|
4924
|
-
const intl = (0,
|
|
5535
|
+
const intl = (0, import_react_intl13.useIntl)();
|
|
4925
5536
|
const { wallets, installedWallets, chooseWallet, wallet, address, onConnect } = useBTCWallet();
|
|
4926
5537
|
const iconMaps = {
|
|
4927
|
-
leather: /* @__PURE__ */ (0,
|
|
4928
|
-
unisat: /* @__PURE__ */ (0,
|
|
4929
|
-
xverse: /* @__PURE__ */ (0,
|
|
4930
|
-
phantom: /* @__PURE__ */ (0,
|
|
5538
|
+
leather: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(LeatherIcon, { size: isDownMd ? 36 : 40 }),
|
|
5539
|
+
unisat: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(UnisatIcon, { size: isDownMd ? 36 : 40 }),
|
|
5540
|
+
xverse: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(XverseIcon, { size: isDownMd ? 36 : 40 }),
|
|
5541
|
+
phantom: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(PhantomIcon, { size: isDownMd ? 36 : 40 })
|
|
4931
5542
|
};
|
|
4932
5543
|
const { events, login } = useMatch();
|
|
4933
|
-
const [status, setStatus] = (0,
|
|
4934
|
-
const statusRef =
|
|
4935
|
-
const [error, setError] = (0,
|
|
4936
|
-
const connected = (0,
|
|
5544
|
+
const [status, setStatus] = (0, import_react28.useState)("");
|
|
5545
|
+
const statusRef = import_react28.default.useRef(status);
|
|
5546
|
+
const [error, setError] = (0, import_react28.useState)("");
|
|
5547
|
+
const connected = (0, import_react28.useMemo)(() => {
|
|
4937
5548
|
return !!address;
|
|
4938
5549
|
}, [address]);
|
|
4939
5550
|
const disconnect = async () => {
|
|
@@ -4997,7 +5608,7 @@ function BTCConnectModal({
|
|
|
4997
5608
|
statusRef.current = "";
|
|
4998
5609
|
}
|
|
4999
5610
|
};
|
|
5000
|
-
(0,
|
|
5611
|
+
(0, import_react28.useEffect)(() => {
|
|
5001
5612
|
if (wallet) {
|
|
5002
5613
|
console.log("onConnect");
|
|
5003
5614
|
try {
|
|
@@ -5010,12 +5621,12 @@ function BTCConnectModal({
|
|
|
5010
5621
|
setStatus("");
|
|
5011
5622
|
}
|
|
5012
5623
|
}, [wallet]);
|
|
5013
|
-
(0,
|
|
5624
|
+
(0, import_react28.useEffect)(() => {
|
|
5014
5625
|
if (address) {
|
|
5015
5626
|
toLoginInWallet();
|
|
5016
5627
|
}
|
|
5017
5628
|
}, [address]);
|
|
5018
|
-
(0,
|
|
5629
|
+
(0, import_react28.useEffect)(() => {
|
|
5019
5630
|
if (!props.isOpen) {
|
|
5020
5631
|
disconnect();
|
|
5021
5632
|
}
|
|
@@ -5027,11 +5638,11 @@ function BTCConnectModal({
|
|
|
5027
5638
|
statusRef.current = "";
|
|
5028
5639
|
setError("");
|
|
5029
5640
|
};
|
|
5030
|
-
return /* @__PURE__ */ (0,
|
|
5641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5031
5642
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5032
5643
|
}, {
|
|
5033
5644
|
name: "BTC"
|
|
5034
|
-
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0,
|
|
5645
|
+
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
5035
5646
|
WalletModalContent,
|
|
5036
5647
|
{
|
|
5037
5648
|
error,
|
|
@@ -5044,9 +5655,9 @@ function BTCConnectModal({
|
|
|
5044
5655
|
setVisible: () => {
|
|
5045
5656
|
}
|
|
5046
5657
|
}
|
|
5047
|
-
) : /* @__PURE__ */ (0,
|
|
5658
|
+
) : /* @__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
5659
|
installedWallets.map((wallet2) => {
|
|
5049
|
-
return /* @__PURE__ */ (0,
|
|
5660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
5050
5661
|
RecommendItem,
|
|
5051
5662
|
{
|
|
5052
5663
|
icon: iconMaps[wallet2.walletKey],
|
|
@@ -5059,14 +5670,14 @@ function BTCConnectModal({
|
|
|
5059
5670
|
);
|
|
5060
5671
|
}),
|
|
5061
5672
|
wallets.filter((wallet2) => !installedWallets.find((installedWallet) => installedWallet.walletKey == wallet2.walletKey)).map((wallet2) => {
|
|
5062
|
-
return /* @__PURE__ */ (0,
|
|
5673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
5063
5674
|
RecommendItem,
|
|
5064
5675
|
{
|
|
5065
5676
|
icon: iconMaps[wallet2.walletKey],
|
|
5066
5677
|
name: wallet2.name,
|
|
5067
5678
|
onClick: () => {
|
|
5068
5679
|
},
|
|
5069
|
-
footer: /* @__PURE__ */ (0,
|
|
5680
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Button, { size: "sm", onClick: () => {
|
|
5070
5681
|
window.open(wallet2.website);
|
|
5071
5682
|
}, children: "Install" })
|
|
5072
5683
|
},
|
|
@@ -5076,23 +5687,23 @@ function BTCConnectModal({
|
|
|
5076
5687
|
] }) }) });
|
|
5077
5688
|
}
|
|
5078
5689
|
function BTCModal(props) {
|
|
5079
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
5690
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(BTCConnectModal, { ...props });
|
|
5080
5691
|
}
|
|
5081
5692
|
|
|
5082
5693
|
// src/components/WalletModal/index.tsx
|
|
5083
|
-
var
|
|
5084
|
-
var
|
|
5085
|
-
var
|
|
5694
|
+
var import_react29 = require("react");
|
|
5695
|
+
var import_react_intl14 = require("react-intl");
|
|
5696
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
5086
5697
|
function WalletConnectModal({
|
|
5087
5698
|
type,
|
|
5088
5699
|
methods: _methods,
|
|
5089
5700
|
...props
|
|
5090
5701
|
}) {
|
|
5091
|
-
const intl = (0,
|
|
5702
|
+
const intl = (0, import_react_intl14.useIntl)();
|
|
5092
5703
|
const { walletMap } = useWalletConfig();
|
|
5093
5704
|
const { bind, login } = useUserInfo();
|
|
5094
5705
|
const config = useAppConfig();
|
|
5095
|
-
const methods = (0,
|
|
5706
|
+
const methods = (0, import_react29.useMemo)(() => {
|
|
5096
5707
|
if (_methods) return _methods;
|
|
5097
5708
|
if (!config.platform) {
|
|
5098
5709
|
return [];
|
|
@@ -5100,13 +5711,13 @@ function WalletConnectModal({
|
|
|
5100
5711
|
const platform = config.platform.map((p) => p.toLowerCase());
|
|
5101
5712
|
return WALLET_METHODS.filter((m) => platform.includes(m));
|
|
5102
5713
|
}, [config.platform, _methods]);
|
|
5103
|
-
return /* @__PURE__ */ (0,
|
|
5714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5104
5715
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5105
5716
|
}, {
|
|
5106
5717
|
name: ""
|
|
5107
|
-
}), children: /* @__PURE__ */ (0,
|
|
5718
|
+
}), 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
5719
|
const m = walletMap[method];
|
|
5109
|
-
return /* @__PURE__ */ (0,
|
|
5720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
5110
5721
|
RecommendItem,
|
|
5111
5722
|
{
|
|
5112
5723
|
icon: m?.icon,
|
|
@@ -5120,21 +5731,21 @@ function WalletConnectModal({
|
|
|
5120
5731
|
}) }) }) });
|
|
5121
5732
|
}
|
|
5122
5733
|
function WalletModal(props) {
|
|
5123
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
5734
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(WalletConnectModal, { ...props });
|
|
5124
5735
|
}
|
|
5125
5736
|
|
|
5126
5737
|
// src/components/AlphaAvatar/index.tsx
|
|
5127
|
-
var
|
|
5128
|
-
var
|
|
5738
|
+
var import_react30 = require("react");
|
|
5739
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
5129
5740
|
function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
5130
|
-
const [avatar, setAvatar] = (0,
|
|
5131
|
-
(0,
|
|
5741
|
+
const [avatar, setAvatar] = (0, import_react30.useState)(void 0);
|
|
5742
|
+
(0, import_react30.useEffect)(() => {
|
|
5132
5743
|
if (name) {
|
|
5133
5744
|
const char = name[0].toUpperCase();
|
|
5134
5745
|
setAvatar(char);
|
|
5135
5746
|
}
|
|
5136
5747
|
}, [name]);
|
|
5137
|
-
return /* @__PURE__ */ (0,
|
|
5748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
5138
5749
|
width: size,
|
|
5139
5750
|
height: size,
|
|
5140
5751
|
fontSize: Math.ceil(size / 2)
|
|
@@ -5142,7 +5753,7 @@ function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
|
5142
5753
|
}
|
|
5143
5754
|
|
|
5144
5755
|
// src/components/WalletAsset/index.tsx
|
|
5145
|
-
var
|
|
5756
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
5146
5757
|
function WalletAsset({
|
|
5147
5758
|
onAssetClick,
|
|
5148
5759
|
matchWalletAssetsOptions
|
|
@@ -5152,7 +5763,7 @@ function WalletAsset({
|
|
|
5152
5763
|
list: walletAssets.mergedAssets
|
|
5153
5764
|
});
|
|
5154
5765
|
const { list } = useMatchChain();
|
|
5155
|
-
return /* @__PURE__ */ (0,
|
|
5766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "matchid-wallet-asset-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
5156
5767
|
const clickFunc = onAssetClick && onAssetClick(n);
|
|
5157
5768
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
5158
5769
|
const getFooterColor = () => {
|
|
@@ -5167,11 +5778,11 @@ function WalletAsset({
|
|
|
5167
5778
|
}
|
|
5168
5779
|
return "";
|
|
5169
5780
|
};
|
|
5170
|
-
return /* @__PURE__ */ (0,
|
|
5781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-wallet-asset-item`, onClick: clickFunc, style: {
|
|
5171
5782
|
cursor: clickFunc ? "pointer" : "default"
|
|
5172
5783
|
}, children: [
|
|
5173
|
-
/* @__PURE__ */ (0,
|
|
5174
|
-
n.icon ? /* @__PURE__ */ (0,
|
|
5784
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "matchid-wallet-asset-logo", title: n.symbol || n.name || "", children: [
|
|
5785
|
+
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
5786
|
AlphaAvatar2,
|
|
5176
5787
|
{
|
|
5177
5788
|
className: `matchid-wallet-asset-icon`,
|
|
@@ -5179,12 +5790,12 @@ function WalletAsset({
|
|
|
5179
5790
|
name: n.symbol || n.name || ""
|
|
5180
5791
|
}
|
|
5181
5792
|
),
|
|
5182
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
5793
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-wallet-asset-chain` })
|
|
5183
5794
|
] }),
|
|
5184
|
-
/* @__PURE__ */ (0,
|
|
5185
|
-
/* @__PURE__ */ (0,
|
|
5186
|
-
"price" in n && /* @__PURE__ */ (0,
|
|
5187
|
-
/* @__PURE__ */ (0,
|
|
5795
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-wallet-asset-info`, children: [
|
|
5796
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: `matchid-wallet-asset-name`, children: n.symbol }),
|
|
5797
|
+
"price" in n && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-wallet-asset-content`, children: [
|
|
5798
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "matchid-wallet-asset-price", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
5188
5799
|
NumberFormatter,
|
|
5189
5800
|
{
|
|
5190
5801
|
value: n.price,
|
|
@@ -5192,7 +5803,7 @@ function WalletAsset({
|
|
|
5192
5803
|
tFixNum: 2
|
|
5193
5804
|
}
|
|
5194
5805
|
) }),
|
|
5195
|
-
/* @__PURE__ */ (0,
|
|
5806
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "matchid-wallet-asset-value", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
5196
5807
|
NumberFormatter,
|
|
5197
5808
|
{
|
|
5198
5809
|
value: n.value,
|
|
@@ -5201,15 +5812,15 @@ function WalletAsset({
|
|
|
5201
5812
|
}
|
|
5202
5813
|
) })
|
|
5203
5814
|
] }),
|
|
5204
|
-
/* @__PURE__ */ (0,
|
|
5205
|
-
/* @__PURE__ */ (0,
|
|
5815
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-wallet-asset-footer`, children: [
|
|
5816
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: `matchid-wallet-asset-balance`, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
5206
5817
|
NumberFormatter,
|
|
5207
5818
|
{
|
|
5208
5819
|
value: n.balance,
|
|
5209
5820
|
tFixNum: 3
|
|
5210
5821
|
}
|
|
5211
5822
|
) }),
|
|
5212
|
-
"price_change_24h" in n && /* @__PURE__ */ (0,
|
|
5823
|
+
"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
5824
|
NumberFormatter,
|
|
5214
5825
|
{
|
|
5215
5826
|
prefix: `${(n?.price_change_24h || 0) < 0 ? "-" : "+"} `,
|
|
@@ -5225,10 +5836,10 @@ function WalletAsset({
|
|
|
5225
5836
|
}
|
|
5226
5837
|
|
|
5227
5838
|
// src/components/TokenSend/index.tsx
|
|
5228
|
-
var
|
|
5229
|
-
var
|
|
5230
|
-
var
|
|
5231
|
-
var
|
|
5839
|
+
var import_react31 = require("react");
|
|
5840
|
+
var import_viem10 = require("viem");
|
|
5841
|
+
var import_react_intl15 = require("react-intl");
|
|
5842
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
5232
5843
|
function Input2({
|
|
5233
5844
|
onChange,
|
|
5234
5845
|
placeholder,
|
|
@@ -5238,8 +5849,8 @@ function Input2({
|
|
|
5238
5849
|
error,
|
|
5239
5850
|
size = "df"
|
|
5240
5851
|
}) {
|
|
5241
|
-
return /* @__PURE__ */ (0,
|
|
5242
|
-
/* @__PURE__ */ (0,
|
|
5852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-input-box ${"matchid-token-input-" + size}`, children: [
|
|
5853
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5243
5854
|
"input",
|
|
5244
5855
|
{
|
|
5245
5856
|
placeholder,
|
|
@@ -5250,7 +5861,7 @@ function Input2({
|
|
|
5250
5861
|
className: `matchid-token-input ${error ? "matchid-token-input-error" : ""}`
|
|
5251
5862
|
}
|
|
5252
5863
|
),
|
|
5253
|
-
error && /* @__PURE__ */ (0,
|
|
5864
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "matchid-token-input-error-text", children: error })
|
|
5254
5865
|
] });
|
|
5255
5866
|
}
|
|
5256
5867
|
function TokenSend({
|
|
@@ -5260,36 +5871,36 @@ function TokenSend({
|
|
|
5260
5871
|
onBack
|
|
5261
5872
|
}) {
|
|
5262
5873
|
const { list: chainList } = useMatchChain();
|
|
5263
|
-
const intl = (0,
|
|
5874
|
+
const intl = (0, import_react_intl15.useIntl)();
|
|
5264
5875
|
const { createWalletClient: createWalletClient2 } = useWallet();
|
|
5265
5876
|
const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
|
|
5266
|
-
const chain = (0,
|
|
5877
|
+
const chain = (0, import_react31.useMemo)(() => {
|
|
5267
5878
|
return chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
5268
5879
|
}, [chainList, token.chain_id]);
|
|
5269
|
-
const walletClient = (0,
|
|
5880
|
+
const walletClient = (0, import_react31.useMemo)(() => {
|
|
5270
5881
|
return createWalletClient2({
|
|
5271
5882
|
// @ts-ignore
|
|
5272
|
-
chain: (0,
|
|
5273
|
-
transport: (0,
|
|
5883
|
+
chain: (0, import_viem10.defineChain)(chain),
|
|
5884
|
+
transport: (0, import_viem10.http)()
|
|
5274
5885
|
});
|
|
5275
5886
|
}, [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,
|
|
5887
|
+
const [amount, setAmount] = (0, import_react31.useState)("");
|
|
5888
|
+
const [address, setAddress] = (0, import_react31.useState)("");
|
|
5889
|
+
const [loading, setLoading] = (0, import_react31.useState)(false);
|
|
5890
|
+
const [sending, setSending] = (0, import_react31.useState)(false);
|
|
5891
|
+
const [txError, setTxError] = (0, import_react31.useState)("");
|
|
5892
|
+
const transaction = (0, import_react31.useMemo)(() => {
|
|
5282
5893
|
const reg = /^0x[a-fA-F0-9]{40}$/;
|
|
5283
5894
|
if (!amount || !address || !reg.test(address)) {
|
|
5284
5895
|
return;
|
|
5285
5896
|
}
|
|
5286
|
-
const viemChain = (0,
|
|
5897
|
+
const viemChain = (0, import_viem10.defineChain)(chain);
|
|
5287
5898
|
const to = isNative ? address : token.address;
|
|
5288
|
-
const value = isNative ? (0,
|
|
5289
|
-
const data = isNative ? "0x" : (0,
|
|
5290
|
-
abi:
|
|
5899
|
+
const value = isNative ? (0, import_viem10.parseUnits)(amount, parseInt(token?.decimals || "18")) : BigInt(0);
|
|
5900
|
+
const data = isNative ? "0x" : (0, import_viem10.encodeFunctionData)({
|
|
5901
|
+
abi: import_viem10.erc20Abi,
|
|
5291
5902
|
functionName: "transfer",
|
|
5292
|
-
args: [address, (0,
|
|
5903
|
+
args: [address, (0, import_viem10.parseUnits)(amount, parseInt(token?.decimals || "18"))]
|
|
5293
5904
|
});
|
|
5294
5905
|
return {
|
|
5295
5906
|
to,
|
|
@@ -5309,7 +5920,7 @@ function TokenSend({
|
|
|
5309
5920
|
setLoading(false);
|
|
5310
5921
|
}
|
|
5311
5922
|
};
|
|
5312
|
-
const error = (0,
|
|
5923
|
+
const error = (0, import_react31.useMemo)(() => {
|
|
5313
5924
|
setTxError("");
|
|
5314
5925
|
let amountError = "";
|
|
5315
5926
|
let addressError = "";
|
|
@@ -5352,7 +5963,7 @@ function TokenSend({
|
|
|
5352
5963
|
setAmount(value);
|
|
5353
5964
|
}
|
|
5354
5965
|
};
|
|
5355
|
-
const canSend = (0,
|
|
5966
|
+
const canSend = (0, import_react31.useMemo)(() => {
|
|
5356
5967
|
return !error.amount && !error.address && amount && address;
|
|
5357
5968
|
}, [error]);
|
|
5358
5969
|
const onNext = async () => {
|
|
@@ -5362,7 +5973,7 @@ function TokenSend({
|
|
|
5362
5973
|
}
|
|
5363
5974
|
onClose();
|
|
5364
5975
|
};
|
|
5365
|
-
(0,
|
|
5976
|
+
(0, import_react31.useEffect)(() => {
|
|
5366
5977
|
const receiveMessage = (event) => {
|
|
5367
5978
|
if (event.data) {
|
|
5368
5979
|
if (event.data.source == "match-wallet") {
|
|
@@ -5378,24 +5989,24 @@ function TokenSend({
|
|
|
5378
5989
|
window.removeEventListener("message", receiveMessage);
|
|
5379
5990
|
};
|
|
5380
5991
|
}, []);
|
|
5381
|
-
return /* @__PURE__ */ (0,
|
|
5382
|
-
/* @__PURE__ */ (0,
|
|
5383
|
-
/* @__PURE__ */ (0,
|
|
5384
|
-
/* @__PURE__ */ (0,
|
|
5385
|
-
/* @__PURE__ */ (0,
|
|
5386
|
-
/* @__PURE__ */ (0,
|
|
5387
|
-
token.icon ? /* @__PURE__ */ (0,
|
|
5992
|
+
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: [
|
|
5993
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
5994
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-amount-content`, children: [
|
|
5995
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-amount-header`, children: [
|
|
5996
|
+
/* @__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" }) }),
|
|
5997
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-amount-chain`, children: [
|
|
5998
|
+
token.icon ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5388
5999
|
"img",
|
|
5389
6000
|
{
|
|
5390
6001
|
src: token?.icon,
|
|
5391
6002
|
alt: token?.symbol,
|
|
5392
6003
|
className: `matchid-token-amount-chain-icon`
|
|
5393
6004
|
}
|
|
5394
|
-
) : /* @__PURE__ */ (0,
|
|
5395
|
-
/* @__PURE__ */ (0,
|
|
6005
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(AlphaAvatar, { name: token.symbol || token.name || "", size: 16 }),
|
|
6006
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { children: token?.symbol })
|
|
5396
6007
|
] })
|
|
5397
6008
|
] }),
|
|
5398
|
-
/* @__PURE__ */ (0,
|
|
6009
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5399
6010
|
Input2,
|
|
5400
6011
|
{
|
|
5401
6012
|
type: "text",
|
|
@@ -5408,18 +6019,18 @@ function TokenSend({
|
|
|
5408
6019
|
error: error.amount || txError
|
|
5409
6020
|
}
|
|
5410
6021
|
),
|
|
5411
|
-
/* @__PURE__ */ (0,
|
|
5412
|
-
/* @__PURE__ */ (0,
|
|
5413
|
-
/* @__PURE__ */ (0,
|
|
6022
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-amount-footer`, children: [
|
|
6023
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-amount-title`, children: [
|
|
6024
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react_intl15.FormattedMessage, { id: "balance" }),
|
|
5414
6025
|
":"
|
|
5415
6026
|
] }),
|
|
5416
|
-
/* @__PURE__ */ (0,
|
|
6027
|
+
/* @__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
6028
|
] }),
|
|
5418
|
-
/* @__PURE__ */ (0,
|
|
6029
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(TransferIcon, { className: "matchid-token-amount-transfer" })
|
|
5419
6030
|
] }),
|
|
5420
|
-
/* @__PURE__ */ (0,
|
|
5421
|
-
/* @__PURE__ */ (0,
|
|
5422
|
-
/* @__PURE__ */ (0,
|
|
6031
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `matchid-token-address-content`, children: [
|
|
6032
|
+
/* @__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" }) }) }),
|
|
6033
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5423
6034
|
Input2,
|
|
5424
6035
|
{
|
|
5425
6036
|
type: "text",
|
|
@@ -5435,7 +6046,7 @@ function TokenSend({
|
|
|
5435
6046
|
)
|
|
5436
6047
|
] })
|
|
5437
6048
|
] }),
|
|
5438
|
-
/* @__PURE__ */ (0,
|
|
6049
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5439
6050
|
Button,
|
|
5440
6051
|
{
|
|
5441
6052
|
size: "lg",
|
|
@@ -5444,15 +6055,15 @@ function TokenSend({
|
|
|
5444
6055
|
disabled: !canSend || !!txError,
|
|
5445
6056
|
onClick: onNext,
|
|
5446
6057
|
loading: loading || sending,
|
|
5447
|
-
children: /* @__PURE__ */ (0,
|
|
6058
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react_intl15.FormattedMessage, { id: "next" })
|
|
5448
6059
|
}
|
|
5449
6060
|
)
|
|
5450
6061
|
] }) });
|
|
5451
6062
|
}
|
|
5452
6063
|
|
|
5453
6064
|
// src/components/TokenDetail/index.tsx
|
|
5454
|
-
var
|
|
5455
|
-
var
|
|
6065
|
+
var import_react_intl16 = require("react-intl");
|
|
6066
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
5456
6067
|
function TokenDetail({
|
|
5457
6068
|
onClose,
|
|
5458
6069
|
token
|
|
@@ -5462,41 +6073,41 @@ function TokenDetail({
|
|
|
5462
6073
|
const chain = chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
5463
6074
|
const onSend = () => {
|
|
5464
6075
|
modal.show((props) => {
|
|
5465
|
-
return /* @__PURE__ */ (0,
|
|
6076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TokenSend, { onClose: () => {
|
|
5466
6077
|
props.close();
|
|
5467
6078
|
onClose();
|
|
5468
6079
|
}, onBack: props.close, zIndex: props.zIndex, token });
|
|
5469
6080
|
});
|
|
5470
6081
|
};
|
|
5471
|
-
const intl = (0,
|
|
5472
|
-
return /* @__PURE__ */ (0,
|
|
6082
|
+
const intl = (0, import_react_intl16.useIntl)();
|
|
6083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ModalDrawer, { isOpen: true, title: intl.formatMessage({
|
|
5473
6084
|
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,
|
|
6085
|
+
}), onClose, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-token-detail`, children: [
|
|
6086
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-token-main`, children: [
|
|
6087
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-token-info`, children: [
|
|
6088
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-token-logo`, children: [
|
|
6089
|
+
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 || "" }),
|
|
6090
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-token-chain` })
|
|
5480
6091
|
] }),
|
|
5481
|
-
/* @__PURE__ */ (0,
|
|
5482
|
-
/* @__PURE__ */ (0,
|
|
6092
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-token-name`, children: [
|
|
6093
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(NumberFormatter, { value: token.balance, tFixNum: 10 }),
|
|
5483
6094
|
" ",
|
|
5484
6095
|
token.symbol
|
|
5485
6096
|
] })
|
|
5486
6097
|
] }),
|
|
5487
|
-
token.address.toLowerCase() != NATIVE_TOKEN_ADDRESS && /* @__PURE__ */ (0,
|
|
5488
|
-
/* @__PURE__ */ (0,
|
|
5489
|
-
/* @__PURE__ */ (0,
|
|
6098
|
+
token.address.toLowerCase() != NATIVE_TOKEN_ADDRESS && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-token-contract`, children: [
|
|
6099
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "matchid-token-contract-title", children: "Contract address" }),
|
|
6100
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "matchid-token-contract-address", children: token.address })
|
|
5490
6101
|
] })
|
|
5491
6102
|
] }),
|
|
5492
|
-
/* @__PURE__ */ (0,
|
|
6103
|
+
/* @__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
6104
|
] }) });
|
|
5494
6105
|
}
|
|
5495
6106
|
|
|
5496
6107
|
// src/components/TokenSendList/index.tsx
|
|
5497
|
-
var
|
|
5498
|
-
var
|
|
5499
|
-
var
|
|
6108
|
+
var import_react32 = require("react");
|
|
6109
|
+
var import_react_intl17 = require("react-intl");
|
|
6110
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
5500
6111
|
function TokenSendList({ close }) {
|
|
5501
6112
|
const isDownMd = useDownMd();
|
|
5502
6113
|
const walletAssets = useMatchWalletAssets();
|
|
@@ -5504,20 +6115,20 @@ function TokenSendList({ close }) {
|
|
|
5504
6115
|
list: walletAssets.mergedAssets
|
|
5505
6116
|
});
|
|
5506
6117
|
const { list } = useMatchChain();
|
|
5507
|
-
const [checked, setChecked] = (0,
|
|
6118
|
+
const [checked, setChecked] = (0, import_react32.useState)();
|
|
5508
6119
|
const modal = useModal();
|
|
5509
6120
|
const onNext = () => {
|
|
5510
6121
|
checked && modal.show((props) => {
|
|
5511
|
-
return /* @__PURE__ */ (0,
|
|
6122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(TokenSend, { onClose: () => {
|
|
5512
6123
|
props.close();
|
|
5513
6124
|
close();
|
|
5514
6125
|
}, onBack: props.close, zIndex: props.zIndex, token: checked });
|
|
5515
6126
|
});
|
|
5516
6127
|
};
|
|
5517
|
-
return /* @__PURE__ */ (0,
|
|
5518
|
-
/* @__PURE__ */ (0,
|
|
6128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "matchid-token-send-list-box", children: [
|
|
6129
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "matchid-token-send-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
5519
6130
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
5520
|
-
return /* @__PURE__ */ (0,
|
|
6131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
5521
6132
|
"div",
|
|
5522
6133
|
{
|
|
5523
6134
|
className: `matchid-token-send-item ${checked?.address == n.address ? "matchid-token-send-chekced" : ""}`,
|
|
@@ -5525,10 +6136,10 @@ function TokenSendList({ close }) {
|
|
|
5525
6136
|
setChecked(n);
|
|
5526
6137
|
},
|
|
5527
6138
|
children: [
|
|
5528
|
-
/* @__PURE__ */ (0,
|
|
5529
|
-
/* @__PURE__ */ (0,
|
|
5530
|
-
/* @__PURE__ */ (0,
|
|
5531
|
-
n.icon ? /* @__PURE__ */ (0,
|
|
6139
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Radio, { checked: checked?.address == n.address, size: isDownMd ? 18 : 24 }),
|
|
6140
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
6141
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "matchid-token-send-logo", children: [
|
|
6142
|
+
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
6143
|
AlphaAvatar2,
|
|
5533
6144
|
{
|
|
5534
6145
|
className: `matchid-token-send-icon`,
|
|
@@ -5536,7 +6147,7 @@ function TokenSendList({ close }) {
|
|
|
5536
6147
|
name: n.symbol || n.name || ""
|
|
5537
6148
|
}
|
|
5538
6149
|
),
|
|
5539
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
6150
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
5540
6151
|
"img",
|
|
5541
6152
|
{
|
|
5542
6153
|
src: chain.iconUrl,
|
|
@@ -5545,9 +6156,9 @@ function TokenSendList({ close }) {
|
|
|
5545
6156
|
}
|
|
5546
6157
|
)
|
|
5547
6158
|
] }),
|
|
5548
|
-
/* @__PURE__ */ (0,
|
|
5549
|
-
/* @__PURE__ */ (0,
|
|
5550
|
-
/* @__PURE__ */ (0,
|
|
6159
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: `matchid-token-send-info`, children: [
|
|
6160
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: `matchid-token-send-name`, children: n.symbol }),
|
|
6161
|
+
/* @__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
6162
|
] })
|
|
5552
6163
|
] })
|
|
5553
6164
|
]
|
|
@@ -5555,15 +6166,15 @@ function TokenSendList({ close }) {
|
|
|
5555
6166
|
index
|
|
5556
6167
|
);
|
|
5557
6168
|
}) }),
|
|
5558
|
-
/* @__PURE__ */ (0,
|
|
6169
|
+
/* @__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
6170
|
] });
|
|
5560
6171
|
}
|
|
5561
6172
|
|
|
5562
6173
|
// src/components/TransactionList/index.tsx
|
|
5563
6174
|
var import_react_infinite_scroll_component = __toESM(require("react-infinite-scroll-component"));
|
|
5564
|
-
var
|
|
5565
|
-
var
|
|
5566
|
-
var
|
|
6175
|
+
var import_react33 = require("react");
|
|
6176
|
+
var import_viem11 = require("viem");
|
|
6177
|
+
var import_viem12 = require("viem");
|
|
5567
6178
|
|
|
5568
6179
|
// src/store/useContractStore.ts
|
|
5569
6180
|
var import_zustand5 = require("zustand");
|
|
@@ -5622,15 +6233,15 @@ var useContractStore = (0, import_zustand5.create)((0, import_middleware3.devtoo
|
|
|
5622
6233
|
var useContractStore_default = useContractStore;
|
|
5623
6234
|
|
|
5624
6235
|
// src/components/TransactionList/index.tsx
|
|
5625
|
-
var
|
|
5626
|
-
var
|
|
6236
|
+
var import_react_intl18 = require("react-intl");
|
|
6237
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
5627
6238
|
var Item = ({ data }) => {
|
|
5628
6239
|
const { address } = useWallet();
|
|
5629
6240
|
const isOut = data.from.toLowerCase() == address.toLowerCase();
|
|
5630
6241
|
const { chain, chainId, explorerLink, formatUnits: chainFormatUnits } = useMatchChain();
|
|
5631
6242
|
const { contracts } = useContractStore_default();
|
|
5632
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
5633
|
-
const transferType = (0,
|
|
6243
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react33.useState)(true);
|
|
6244
|
+
const transferType = (0, import_react33.useMemo)(() => {
|
|
5634
6245
|
const methodId = data.input.substring(2, 10);
|
|
5635
6246
|
if (methodId == "095ea7b3") {
|
|
5636
6247
|
return "erc20_approve";
|
|
@@ -5640,38 +6251,38 @@ var Item = ({ data }) => {
|
|
|
5640
6251
|
}
|
|
5641
6252
|
return "unknown";
|
|
5642
6253
|
}, [data.input]);
|
|
5643
|
-
const to = (0,
|
|
6254
|
+
const to = (0, import_react33.useMemo)(() => {
|
|
5644
6255
|
if (!isOut) {
|
|
5645
6256
|
return data.from;
|
|
5646
6257
|
}
|
|
5647
6258
|
if (transferType == "erc20_transfer") {
|
|
5648
|
-
const decodeData = (0,
|
|
5649
|
-
abi:
|
|
6259
|
+
const decodeData = (0, import_viem11.decodeFunctionData)({
|
|
6260
|
+
abi: import_viem12.erc20Abi,
|
|
5650
6261
|
data: data.input
|
|
5651
6262
|
});
|
|
5652
6263
|
return decodeData.args[0];
|
|
5653
6264
|
}
|
|
5654
6265
|
return data.to;
|
|
5655
6266
|
}, [data.input, transferType, data.to, isOut]);
|
|
5656
|
-
const amount = (0,
|
|
6267
|
+
const amount = (0, import_react33.useMemo)(() => {
|
|
5657
6268
|
if (transferType == "erc20_transfer") {
|
|
5658
|
-
const decodeData = (0,
|
|
5659
|
-
abi:
|
|
6269
|
+
const decodeData = (0, import_viem11.decodeFunctionData)({
|
|
6270
|
+
abi: import_viem12.erc20Abi,
|
|
5660
6271
|
data: data.input
|
|
5661
6272
|
});
|
|
5662
6273
|
const value = decodeData.args[1];
|
|
5663
|
-
return (0,
|
|
6274
|
+
return (0, import_viem11.formatUnits)(value, contracts[`${chainId}-${data.to.toLowerCase()}`]?.decimals || 18);
|
|
5664
6275
|
}
|
|
5665
6276
|
return chainFormatUnits(BigInt(data.value));
|
|
5666
6277
|
}, [data.input, transferType, data.value, contracts, chainId, data.to]);
|
|
5667
6278
|
const hashQuery = useHash({
|
|
5668
6279
|
hash: data.hash,
|
|
5669
6280
|
//@ts-ignore
|
|
5670
|
-
chain: (0,
|
|
6281
|
+
chain: (0, import_viem11.defineChain)(chain),
|
|
5671
6282
|
refetchInterval: shouldRefetch ? 3e3 : false,
|
|
5672
6283
|
enabled: shouldRefetch && data.source == "local"
|
|
5673
6284
|
});
|
|
5674
|
-
const status = (0,
|
|
6285
|
+
const status = (0, import_react33.useMemo)(() => {
|
|
5675
6286
|
if (data.source == "matchain") {
|
|
5676
6287
|
switch (data.extra.status) {
|
|
5677
6288
|
case "ok":
|
|
@@ -5698,30 +6309,30 @@ var Item = ({ data }) => {
|
|
|
5698
6309
|
}
|
|
5699
6310
|
return "loading";
|
|
5700
6311
|
}, [data.extra?.status, data.source, hashQuery.data]);
|
|
5701
|
-
(0,
|
|
6312
|
+
(0, import_react33.useEffect)(() => {
|
|
5702
6313
|
if (data.hash) {
|
|
5703
6314
|
setShouldRefetch(status == "loading");
|
|
5704
6315
|
}
|
|
5705
6316
|
}, [status, data.hash]);
|
|
5706
|
-
const symbol = (0,
|
|
6317
|
+
const symbol = (0, import_react33.useMemo)(() => {
|
|
5707
6318
|
if (transferType == "erc20_transfer") {
|
|
5708
6319
|
const contract = contracts[`${chainId}-${data.to.toLowerCase()}`];
|
|
5709
6320
|
return contract?.symbol || contract?.name || "unknown";
|
|
5710
6321
|
}
|
|
5711
6322
|
return chain?.nativeCurrency.symbol || chain?.nativeCurrency.name;
|
|
5712
6323
|
}, [transferType, chain, contracts, chainId, data.to]);
|
|
5713
|
-
return /* @__PURE__ */ (0,
|
|
6324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
5714
6325
|
"a",
|
|
5715
6326
|
{
|
|
5716
6327
|
href: explorerLink(`tx/${data.hash}`),
|
|
5717
6328
|
target: "_blank",
|
|
5718
6329
|
className: `matchid-transaction-item`,
|
|
5719
6330
|
children: [
|
|
5720
|
-
/* @__PURE__ */ (0,
|
|
5721
|
-
/* @__PURE__ */ (0,
|
|
5722
|
-
/* @__PURE__ */ (0,
|
|
5723
|
-
/* @__PURE__ */ (0,
|
|
5724
|
-
/* @__PURE__ */ (0,
|
|
6331
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `matchid-transacton-item-container`, children: [
|
|
6332
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "matchid-transaction-item-icon", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ArrowSendIcon, { className: !isOut ? "rotate-180" : "" }) }),
|
|
6333
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `matchid-transaction-item-details`, children: [
|
|
6334
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: `matchid-transaction-item-address`, children: formatAddress(to, 6, 4) }),
|
|
6335
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5725
6336
|
"div",
|
|
5726
6337
|
{
|
|
5727
6338
|
className: `matchid-transaction-item-timestamp`,
|
|
@@ -5730,11 +6341,11 @@ var Item = ({ data }) => {
|
|
|
5730
6341
|
)
|
|
5731
6342
|
] })
|
|
5732
6343
|
] }),
|
|
5733
|
-
/* @__PURE__ */ (0,
|
|
5734
|
-
/* @__PURE__ */ (0,
|
|
5735
|
-
status == "loading" && /* @__PURE__ */ (0,
|
|
5736
|
-
status == "success" && /* @__PURE__ */ (0,
|
|
5737
|
-
status == "error" && /* @__PURE__ */ (0,
|
|
6344
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `matchid-transaction-item-amount ${"matchid-transaction-item-" + status}`, children: [
|
|
6345
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(NumberFormatter, { value: amount, tFixNum: 6, prefix: isOut ? "-" : "+", suffix: " " + symbol }),
|
|
6346
|
+
status == "loading" && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(LoadingIcon_default, { color: "#000000", size: 16, rotate: true }),
|
|
6347
|
+
status == "success" && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(CheckRoundIcon, { size: 16 }),
|
|
6348
|
+
status == "error" && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(InfoRoundIcon, { size: 16 })
|
|
5738
6349
|
] })
|
|
5739
6350
|
]
|
|
5740
6351
|
}
|
|
@@ -5744,38 +6355,38 @@ function TransactionList({
|
|
|
5744
6355
|
scrollableTarget
|
|
5745
6356
|
}) {
|
|
5746
6357
|
const { fetchMoreData, hasMore, items } = useMatchWalletRecords();
|
|
5747
|
-
return /* @__PURE__ */ (0,
|
|
6358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5748
6359
|
import_react_infinite_scroll_component.default,
|
|
5749
6360
|
{
|
|
5750
6361
|
scrollableTarget,
|
|
5751
6362
|
dataLength: items.length,
|
|
5752
6363
|
next: fetchMoreData,
|
|
5753
6364
|
hasMore,
|
|
5754
|
-
loader: /* @__PURE__ */ (0,
|
|
5755
|
-
/* @__PURE__ */ (0,
|
|
6365
|
+
loader: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "matchid-list-nomore", children: [
|
|
6366
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(LoadingIcon_default, { rotate: true, size: 16, color: "black" }),
|
|
5756
6367
|
"Loading..."
|
|
5757
6368
|
] }),
|
|
5758
|
-
endMessage: items.length > 0 ? /* @__PURE__ */ (0,
|
|
5759
|
-
children: items.length == 0 && !hasMore ? /* @__PURE__ */ (0,
|
|
6369
|
+
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" }) }),
|
|
6370
|
+
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
6371
|
}
|
|
5761
6372
|
);
|
|
5762
6373
|
}
|
|
5763
6374
|
|
|
5764
6375
|
// src/hooks/useMatchWallet.tsx
|
|
5765
6376
|
var import_react_qrcode = require("react-qrcode");
|
|
5766
|
-
var
|
|
6377
|
+
var import_react35 = require("react");
|
|
5767
6378
|
var import_react_query6 = require("@tanstack/react-query");
|
|
5768
|
-
var
|
|
5769
|
-
var
|
|
6379
|
+
var import_viem15 = require("viem");
|
|
6380
|
+
var import_react_intl20 = require("react-intl");
|
|
5770
6381
|
|
|
5771
6382
|
// src/components/ImportToken/index.tsx
|
|
5772
|
-
var
|
|
5773
|
-
var
|
|
6383
|
+
var import_react34 = require("react");
|
|
6384
|
+
var import_react_intl19 = require("react-intl");
|
|
5774
6385
|
var import_react_query5 = require("@tanstack/react-query");
|
|
5775
|
-
var
|
|
6386
|
+
var import_viem14 = require("viem");
|
|
5776
6387
|
|
|
5777
6388
|
// src/hooks/useIsContract.ts
|
|
5778
|
-
var
|
|
6389
|
+
var import_viem13 = require("viem");
|
|
5779
6390
|
var import_react_query4 = require("@tanstack/react-query");
|
|
5780
6391
|
function useIsContract({
|
|
5781
6392
|
address,
|
|
@@ -5787,9 +6398,9 @@ function useIsContract({
|
|
|
5787
6398
|
queryFn: async () => {
|
|
5788
6399
|
if (!chain) return false;
|
|
5789
6400
|
if (!address) return false;
|
|
5790
|
-
const publicClient = (0,
|
|
6401
|
+
const publicClient = (0, import_viem13.createPublicClient)({
|
|
5791
6402
|
chain,
|
|
5792
|
-
transport: (0,
|
|
6403
|
+
transport: (0, import_viem13.http)()
|
|
5793
6404
|
});
|
|
5794
6405
|
const res = await publicClient.getCode({ address });
|
|
5795
6406
|
return res !== null && res !== void 0;
|
|
@@ -5799,27 +6410,27 @@ function useIsContract({
|
|
|
5799
6410
|
}
|
|
5800
6411
|
|
|
5801
6412
|
// src/components/ImportToken/index.tsx
|
|
5802
|
-
var
|
|
6413
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
5803
6414
|
function ImportToken({ close }) {
|
|
5804
|
-
const [status, setStatus] = (0,
|
|
6415
|
+
const [status, setStatus] = (0, import_react34.useState)("");
|
|
5805
6416
|
const { token } = useUserInfo();
|
|
5806
|
-
const [address, setAddress] = (0,
|
|
5807
|
-
const [symbol, setSymbol] = (0,
|
|
5808
|
-
const [decimals, setDecimals] = (0,
|
|
5809
|
-
const [error, setError] = (0,
|
|
6417
|
+
const [address, setAddress] = (0, import_react34.useState)("");
|
|
6418
|
+
const [symbol, setSymbol] = (0, import_react34.useState)("");
|
|
6419
|
+
const [decimals, setDecimals] = (0, import_react34.useState)("");
|
|
6420
|
+
const [error, setError] = (0, import_react34.useState)({});
|
|
5810
6421
|
const { publicClient, chainId, chain } = useMatchChain();
|
|
5811
6422
|
const getContractInfo = async () => {
|
|
5812
6423
|
if (!publicClient) return;
|
|
5813
6424
|
const calls = [
|
|
5814
6425
|
{
|
|
5815
6426
|
address,
|
|
5816
|
-
abi:
|
|
6427
|
+
abi: import_viem14.erc20Abi,
|
|
5817
6428
|
functionName: "symbol",
|
|
5818
6429
|
args: []
|
|
5819
6430
|
},
|
|
5820
6431
|
{
|
|
5821
6432
|
address,
|
|
5822
|
-
abi:
|
|
6433
|
+
abi: import_viem14.erc20Abi,
|
|
5823
6434
|
functionName: "decimals",
|
|
5824
6435
|
args: []
|
|
5825
6436
|
}
|
|
@@ -5839,8 +6450,8 @@ function ImportToken({ close }) {
|
|
|
5839
6450
|
});
|
|
5840
6451
|
}
|
|
5841
6452
|
};
|
|
5842
|
-
const intl = (0,
|
|
5843
|
-
(0,
|
|
6453
|
+
const intl = (0, import_react_intl19.useIntl)();
|
|
6454
|
+
(0, import_react34.useEffect)(() => {
|
|
5844
6455
|
if (address.length === 42) {
|
|
5845
6456
|
const reg = /^0x[0-9a-fA-F]{40}$/;
|
|
5846
6457
|
if (!reg.test(address)) {
|
|
@@ -5859,7 +6470,7 @@ function ImportToken({ close }) {
|
|
|
5859
6470
|
}
|
|
5860
6471
|
}
|
|
5861
6472
|
}, [address, publicClient]);
|
|
5862
|
-
const [loading, setLoading] = (0,
|
|
6473
|
+
const [loading, setLoading] = (0, import_react34.useState)(false);
|
|
5863
6474
|
const toast = useToast();
|
|
5864
6475
|
const queryClient2 = (0, import_react_query5.useQueryClient)();
|
|
5865
6476
|
const onImport = async () => {
|
|
@@ -5887,7 +6498,7 @@ function ImportToken({ close }) {
|
|
|
5887
6498
|
setLoading(false);
|
|
5888
6499
|
}
|
|
5889
6500
|
};
|
|
5890
|
-
const canImport = (0,
|
|
6501
|
+
const canImport = (0, import_react34.useMemo)(() => {
|
|
5891
6502
|
if (!address) {
|
|
5892
6503
|
return false;
|
|
5893
6504
|
}
|
|
@@ -5905,24 +6516,24 @@ function ImportToken({ close }) {
|
|
|
5905
6516
|
}, [error, address, symbol, decimals]);
|
|
5906
6517
|
const isContractQuery = useIsContract({
|
|
5907
6518
|
//@ts-ignore
|
|
5908
|
-
chain: (0,
|
|
6519
|
+
chain: (0, import_viem14.defineChain)(chain),
|
|
5909
6520
|
address,
|
|
5910
6521
|
enabled: canImport
|
|
5911
6522
|
});
|
|
5912
6523
|
if (status == "success" || status == "fail") {
|
|
5913
|
-
return /* @__PURE__ */ (0,
|
|
5914
|
-
/* @__PURE__ */ (0,
|
|
5915
|
-
/* @__PURE__ */ (0,
|
|
5916
|
-
/* @__PURE__ */ (0,
|
|
6524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `matchid-import-token-result matchid-flex`, children: [
|
|
6525
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `matchid-import-token-result-box matchid-flex`, children: [
|
|
6526
|
+
/* @__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` }),
|
|
6527
|
+
/* @__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
6528
|
] }),
|
|
5918
|
-
status == "success" ? /* @__PURE__ */ (0,
|
|
6529
|
+
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
6530
|
] });
|
|
5920
6531
|
}
|
|
5921
|
-
return /* @__PURE__ */ (0,
|
|
5922
|
-
/* @__PURE__ */ (0,
|
|
5923
|
-
/* @__PURE__ */ (0,
|
|
6532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `matchid-import-token`, children: [
|
|
6533
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "matchid-import-token-form", children: [
|
|
6534
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Field, { label: intl.formatMessage({
|
|
5924
6535
|
id: "tokenSmartContract"
|
|
5925
|
-
}), error: error.address ? error.address : isContractQuery.isFetched && !isContractQuery.isLoading && !isContractQuery.data && canImport ? "Address isn't a contract address" : "", children: /* @__PURE__ */ (0,
|
|
6536
|
+
}), 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
6537
|
Input,
|
|
5927
6538
|
{
|
|
5928
6539
|
placeholder: intl.formatMessage({
|
|
@@ -5933,9 +6544,9 @@ function ImportToken({ close }) {
|
|
|
5933
6544
|
maxLength: 42
|
|
5934
6545
|
}
|
|
5935
6546
|
) }),
|
|
5936
|
-
/* @__PURE__ */ (0,
|
|
6547
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Field, { label: intl.formatMessage({
|
|
5937
6548
|
id: "tokenSymbol"
|
|
5938
|
-
}), error: error.symbol, children: /* @__PURE__ */ (0,
|
|
6549
|
+
}), error: error.symbol, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5939
6550
|
Input,
|
|
5940
6551
|
{
|
|
5941
6552
|
placeholder: intl.formatMessage({
|
|
@@ -5946,9 +6557,9 @@ function ImportToken({ close }) {
|
|
|
5946
6557
|
maxLength: 16
|
|
5947
6558
|
}
|
|
5948
6559
|
) }),
|
|
5949
|
-
/* @__PURE__ */ (0,
|
|
6560
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Field, { label: intl.formatMessage({
|
|
5950
6561
|
id: "tokenDecimals"
|
|
5951
|
-
}), error: error.decimals, children: /* @__PURE__ */ (0,
|
|
6562
|
+
}), error: error.decimals, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5952
6563
|
Input,
|
|
5953
6564
|
{
|
|
5954
6565
|
placeholder: intl.formatMessage({
|
|
@@ -5960,7 +6571,7 @@ function ImportToken({ close }) {
|
|
|
5960
6571
|
}
|
|
5961
6572
|
) })
|
|
5962
6573
|
] }),
|
|
5963
|
-
/* @__PURE__ */ (0,
|
|
6574
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5964
6575
|
Button,
|
|
5965
6576
|
{
|
|
5966
6577
|
size: "lg",
|
|
@@ -5969,20 +6580,20 @@ function ImportToken({ close }) {
|
|
|
5969
6580
|
loading: loading || isContractQuery.isLoading,
|
|
5970
6581
|
disabled: !canImport || !isContractQuery.data,
|
|
5971
6582
|
highlight: true,
|
|
5972
|
-
children: /* @__PURE__ */ (0,
|
|
6583
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl19.FormattedMessage, { id: "import" })
|
|
5973
6584
|
}
|
|
5974
6585
|
)
|
|
5975
6586
|
] });
|
|
5976
6587
|
}
|
|
5977
6588
|
|
|
5978
6589
|
// src/hooks/useMatchWallet.tsx
|
|
5979
|
-
var
|
|
6590
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
5980
6591
|
var ReceiveModal = () => {
|
|
5981
6592
|
const chain = useMatchChain();
|
|
5982
6593
|
const { address } = useWallet();
|
|
5983
6594
|
const [copied, setCopied] = useCopyClipboard();
|
|
5984
6595
|
const toast = useToast();
|
|
5985
|
-
const intl = (0,
|
|
6596
|
+
const intl = (0, import_react_intl20.useIntl)();
|
|
5986
6597
|
const onCopy = () => {
|
|
5987
6598
|
setCopied(address);
|
|
5988
6599
|
toast.success(intl.formatMessage({
|
|
@@ -5990,10 +6601,10 @@ var ReceiveModal = () => {
|
|
|
5990
6601
|
}));
|
|
5991
6602
|
};
|
|
5992
6603
|
const chainLink = chain.explorerLink("address/" + address);
|
|
5993
|
-
return /* @__PURE__ */ (0,
|
|
5994
|
-
/* @__PURE__ */ (0,
|
|
5995
|
-
/* @__PURE__ */ (0,
|
|
5996
|
-
/* @__PURE__ */ (0,
|
|
6604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: `matchid-receive-modal`, children: [
|
|
6605
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "matchid-receive-container", children: [
|
|
6606
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: `matchid-receive-text`, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react_intl20.FormattedMessage, { id: "receiveQrcode" }) }),
|
|
6607
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: `matchid-qr-container`, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
5997
6608
|
import_react_qrcode.QRCode,
|
|
5998
6609
|
{
|
|
5999
6610
|
margin: "0",
|
|
@@ -6001,7 +6612,7 @@ var ReceiveModal = () => {
|
|
|
6001
6612
|
value: address
|
|
6002
6613
|
}
|
|
6003
6614
|
) }),
|
|
6004
|
-
/* @__PURE__ */ (0,
|
|
6615
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
6005
6616
|
"a",
|
|
6006
6617
|
{
|
|
6007
6618
|
href: chainLink,
|
|
@@ -6011,8 +6622,8 @@ var ReceiveModal = () => {
|
|
|
6011
6622
|
}
|
|
6012
6623
|
)
|
|
6013
6624
|
] }),
|
|
6014
|
-
/* @__PURE__ */ (0,
|
|
6015
|
-
|
|
6625
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Button, { size: "lg", onClick: onCopy, block: true, highlight: true, disabled: copied, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
6626
|
+
import_react_intl20.FormattedMessage,
|
|
6016
6627
|
{
|
|
6017
6628
|
id: "copyAddress"
|
|
6018
6629
|
}
|
|
@@ -6021,7 +6632,7 @@ var ReceiveModal = () => {
|
|
|
6021
6632
|
};
|
|
6022
6633
|
function useMatchWallet() {
|
|
6023
6634
|
const modal = useModal();
|
|
6024
|
-
const intl = (0,
|
|
6635
|
+
const intl = (0, import_react_intl20.useIntl)();
|
|
6025
6636
|
const showReceiveModal = () => {
|
|
6026
6637
|
modal.open({
|
|
6027
6638
|
title: intl.formatMessage({
|
|
@@ -6053,12 +6664,12 @@ function useMatchWallet() {
|
|
|
6053
6664
|
};
|
|
6054
6665
|
}
|
|
6055
6666
|
function useMatchWalletRecords() {
|
|
6056
|
-
const [hasMore, setHasMore] = (0,
|
|
6057
|
-
const [items, setItems] = (0,
|
|
6667
|
+
const [hasMore, setHasMore] = (0, import_react35.useState)(true);
|
|
6668
|
+
const [items, setItems] = (0, import_react35.useState)([]);
|
|
6058
6669
|
const { chainId, publicClient } = useMatchChain();
|
|
6059
6670
|
const { address } = useWallet();
|
|
6060
|
-
const hasMoreRef = (0,
|
|
6061
|
-
const nextPageParamsRef = (0,
|
|
6671
|
+
const hasMoreRef = (0, import_react35.useRef)(hasMore);
|
|
6672
|
+
const nextPageParamsRef = (0, import_react35.useRef)(void 0);
|
|
6062
6673
|
const { contracts, setContracts } = useContractStore_default();
|
|
6063
6674
|
const fetchMoreData = async () => {
|
|
6064
6675
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
@@ -6085,7 +6696,7 @@ function useMatchWalletRecords() {
|
|
|
6085
6696
|
hasMoreRef.current = true;
|
|
6086
6697
|
fetchMoreData();
|
|
6087
6698
|
};
|
|
6088
|
-
(0,
|
|
6699
|
+
(0, import_react35.useEffect)(() => {
|
|
6089
6700
|
if (chainId && address) {
|
|
6090
6701
|
onInit();
|
|
6091
6702
|
}
|
|
@@ -6109,13 +6720,13 @@ function useMatchWalletRecords() {
|
|
|
6109
6720
|
for (const contract of contractUnique) {
|
|
6110
6721
|
calls.push({
|
|
6111
6722
|
address: contract,
|
|
6112
|
-
abi:
|
|
6723
|
+
abi: import_viem15.erc20Abi,
|
|
6113
6724
|
functionName: "symbol",
|
|
6114
6725
|
args: []
|
|
6115
6726
|
});
|
|
6116
6727
|
calls.push({
|
|
6117
6728
|
address: contract,
|
|
6118
|
-
abi:
|
|
6729
|
+
abi: import_viem15.erc20Abi,
|
|
6119
6730
|
functionName: "decimals",
|
|
6120
6731
|
args: []
|
|
6121
6732
|
});
|
|
@@ -6141,7 +6752,7 @@ function useMatchWalletRecords() {
|
|
|
6141
6752
|
setContracts(contractMap);
|
|
6142
6753
|
}
|
|
6143
6754
|
};
|
|
6144
|
-
const list = (0,
|
|
6755
|
+
const list = (0, import_react35.useMemo)(() => {
|
|
6145
6756
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
6146
6757
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
6147
6758
|
removeList.forEach((item) => {
|
|
@@ -6183,7 +6794,7 @@ function useMatchWalletAssets({
|
|
|
6183
6794
|
chainId: chainId || 0,
|
|
6184
6795
|
...assetListOptions
|
|
6185
6796
|
});
|
|
6186
|
-
const mergedAssets = (0,
|
|
6797
|
+
const mergedAssets = (0, import_react35.useMemo)(() => {
|
|
6187
6798
|
if (!assetListQuery.data && !importTokenQuery.data) return [];
|
|
6188
6799
|
const assetList = (assetListQuery.data || []).map((asset) => ({
|
|
6189
6800
|
...asset,
|
|
@@ -6270,14 +6881,14 @@ function useMatchWalletAssetList({
|
|
|
6270
6881
|
retry: 3
|
|
6271
6882
|
// Retry up to 3 times if failed
|
|
6272
6883
|
});
|
|
6273
|
-
const erc20Tokens = (0,
|
|
6884
|
+
const erc20Tokens = (0, import_react35.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
|
|
6274
6885
|
const erc20BalanceQuery = (0, import_react_query6.useQuery)({
|
|
6275
6886
|
queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
|
|
6276
6887
|
queryFn: async () => {
|
|
6277
6888
|
if (!erc20Tokens.length || !publicClient) return [];
|
|
6278
6889
|
const calls = erc20Tokens.map((token) => ({
|
|
6279
6890
|
address: token.address,
|
|
6280
|
-
abi:
|
|
6891
|
+
abi: import_viem15.erc20Abi,
|
|
6281
6892
|
functionName: "balanceOf",
|
|
6282
6893
|
args: [address]
|
|
6283
6894
|
}));
|
|
@@ -6298,7 +6909,7 @@ function useMatchWalletAssetList({
|
|
|
6298
6909
|
// Refresh every 15 seconds
|
|
6299
6910
|
retry: 3
|
|
6300
6911
|
});
|
|
6301
|
-
const enrichedAssets = (0,
|
|
6912
|
+
const enrichedAssets = (0, import_react35.useMemo)(() => {
|
|
6302
6913
|
if (!list) return [];
|
|
6303
6914
|
const erc20Balances = erc20BalanceQuery.data || [];
|
|
6304
6915
|
return list.map((asset) => {
|
|
@@ -6308,11 +6919,11 @@ function useMatchWalletAssetList({
|
|
|
6308
6919
|
const assetAddress = asset.address.toLowerCase();
|
|
6309
6920
|
if (assetAddress === NATIVE_TOKEN_ADDRESS) {
|
|
6310
6921
|
balanceValue = nativeBalanceQuery.data?.toString() || "0";
|
|
6311
|
-
balance = nativeBalanceQuery.data ? Number((0,
|
|
6922
|
+
balance = nativeBalanceQuery.data ? Number((0, import_viem15.formatUnits)(nativeBalanceQuery.data, decimals)) : 0;
|
|
6312
6923
|
} else {
|
|
6313
6924
|
const index = erc20Tokens.findIndex((t) => t.address.toLowerCase() === assetAddress);
|
|
6314
6925
|
if (index !== -1 && erc20Balances[index] && erc20Balances[index].status === "success") {
|
|
6315
|
-
balance = Number((0,
|
|
6926
|
+
balance = Number((0, import_viem15.formatUnits)(erc20Balances[index].result, decimals));
|
|
6316
6927
|
balanceValue = erc20Balances[index].result?.toString() || "0";
|
|
6317
6928
|
}
|
|
6318
6929
|
}
|
|
@@ -6320,7 +6931,7 @@ function useMatchWalletAssetList({
|
|
|
6320
6931
|
return { ...asset, balance, value, balanceValue };
|
|
6321
6932
|
});
|
|
6322
6933
|
}, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
|
|
6323
|
-
(0,
|
|
6934
|
+
(0, import_react35.useEffect)(() => {
|
|
6324
6935
|
const list2 = enrichedAssets.sort((a, b) => {
|
|
6325
6936
|
if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
|
|
6326
6937
|
if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
|
|
@@ -6345,14 +6956,14 @@ function useMatchWalletAssetList({
|
|
|
6345
6956
|
}
|
|
6346
6957
|
|
|
6347
6958
|
// src/hooks/useReceipt.tsx
|
|
6348
|
-
var
|
|
6959
|
+
var import_react36 = require("react");
|
|
6349
6960
|
var import_react_query7 = require("@tanstack/react-query");
|
|
6350
|
-
var
|
|
6961
|
+
var import_viem16 = require("viem");
|
|
6351
6962
|
var CACHE_TTL = 86400 * 30 * 1e3;
|
|
6352
6963
|
var MAX_CACHE_SIZE = 500;
|
|
6353
6964
|
var STORAGE_KEY = "match_receipt_logs";
|
|
6354
6965
|
function useReceiptCache() {
|
|
6355
|
-
const [cache, setCache] = (0,
|
|
6966
|
+
const [cache, setCache] = (0, import_react36.useState)(/* @__PURE__ */ new Map());
|
|
6356
6967
|
const isLocalStorageAvailable = (() => {
|
|
6357
6968
|
try {
|
|
6358
6969
|
const testKey = "__test__";
|
|
@@ -6363,7 +6974,7 @@ function useReceiptCache() {
|
|
|
6363
6974
|
return false;
|
|
6364
6975
|
}
|
|
6365
6976
|
})();
|
|
6366
|
-
(0,
|
|
6977
|
+
(0, import_react36.useEffect)(() => {
|
|
6367
6978
|
if (isLocalStorageAvailable) {
|
|
6368
6979
|
try {
|
|
6369
6980
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -6382,7 +6993,7 @@ function useReceiptCache() {
|
|
|
6382
6993
|
}
|
|
6383
6994
|
}
|
|
6384
6995
|
}, []);
|
|
6385
|
-
const updateLocalStorage = (0,
|
|
6996
|
+
const updateLocalStorage = (0, import_react36.useCallback)((updatedCache) => {
|
|
6386
6997
|
if (isLocalStorageAvailable) {
|
|
6387
6998
|
try {
|
|
6388
6999
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -6399,7 +7010,7 @@ function useReceiptCache() {
|
|
|
6399
7010
|
}
|
|
6400
7011
|
}
|
|
6401
7012
|
}, []);
|
|
6402
|
-
const set = (0,
|
|
7013
|
+
const set = (0, import_react36.useCallback)((key, value) => {
|
|
6403
7014
|
const now = Date.now();
|
|
6404
7015
|
const newCache = new Map(cache);
|
|
6405
7016
|
newCache.forEach((entry, k) => {
|
|
@@ -6417,7 +7028,7 @@ function useReceiptCache() {
|
|
|
6417
7028
|
setCache(newCache);
|
|
6418
7029
|
updateLocalStorage(newCache);
|
|
6419
7030
|
}, [cache, updateLocalStorage]);
|
|
6420
|
-
const get = (0,
|
|
7031
|
+
const get = (0, import_react36.useCallback)((key) => {
|
|
6421
7032
|
const entry = cache.get(key);
|
|
6422
7033
|
if (entry) {
|
|
6423
7034
|
if (Date.now() - entry.timestamp > CACHE_TTL) {
|
|
@@ -6431,7 +7042,7 @@ function useReceiptCache() {
|
|
|
6431
7042
|
}
|
|
6432
7043
|
return void 0;
|
|
6433
7044
|
}, [cache, updateLocalStorage]);
|
|
6434
|
-
const del = (0,
|
|
7045
|
+
const del = (0, import_react36.useCallback)((key) => {
|
|
6435
7046
|
if (cache.has(key)) {
|
|
6436
7047
|
const newCache = new Map(cache);
|
|
6437
7048
|
newCache.delete(key);
|
|
@@ -6439,7 +7050,7 @@ function useReceiptCache() {
|
|
|
6439
7050
|
updateLocalStorage(newCache);
|
|
6440
7051
|
}
|
|
6441
7052
|
}, [cache, updateLocalStorage]);
|
|
6442
|
-
const clear = (0,
|
|
7053
|
+
const clear = (0, import_react36.useCallback)(() => {
|
|
6443
7054
|
setCache(/* @__PURE__ */ new Map());
|
|
6444
7055
|
if (isLocalStorageAvailable) {
|
|
6445
7056
|
localStorage.removeItem(STORAGE_KEY);
|
|
@@ -6454,7 +7065,7 @@ function useReceipt2({
|
|
|
6454
7065
|
const { list } = useMatchChain();
|
|
6455
7066
|
const cache = useReceiptCache();
|
|
6456
7067
|
const chain = list?.find((item) => item.id === chainId);
|
|
6457
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
7068
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react36.useState)(true);
|
|
6458
7069
|
const query = (0, import_react_query7.useQuery)({
|
|
6459
7070
|
queryKey: ["match-tx-receipt", hash, chain],
|
|
6460
7071
|
queryFn: async () => {
|
|
@@ -6464,9 +7075,9 @@ function useReceipt2({
|
|
|
6464
7075
|
return cache.get(cacheKey);
|
|
6465
7076
|
}
|
|
6466
7077
|
try {
|
|
6467
|
-
const publicClient = (0,
|
|
6468
|
-
chain: (0,
|
|
6469
|
-
transport: (0,
|
|
7078
|
+
const publicClient = (0, import_viem16.createPublicClient)({
|
|
7079
|
+
chain: (0, import_viem16.defineChain)(chain),
|
|
7080
|
+
transport: (0, import_viem16.http)()
|
|
6470
7081
|
});
|
|
6471
7082
|
const receipt = await publicClient.getTransactionReceipt({ hash });
|
|
6472
7083
|
if (!receipt) {
|
|
@@ -6480,7 +7091,7 @@ function useReceipt2({
|
|
|
6480
7091
|
},
|
|
6481
7092
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
6482
7093
|
});
|
|
6483
|
-
(0,
|
|
7094
|
+
(0, import_react36.useEffect)(() => {
|
|
6484
7095
|
if (query.data) {
|
|
6485
7096
|
setShouldRefetch(false);
|
|
6486
7097
|
}
|
|
@@ -6489,14 +7100,14 @@ function useReceipt2({
|
|
|
6489
7100
|
}
|
|
6490
7101
|
|
|
6491
7102
|
// src/hooks/useTransaction.tsx
|
|
6492
|
-
var
|
|
7103
|
+
var import_react37 = require("react");
|
|
6493
7104
|
var import_react_query8 = require("@tanstack/react-query");
|
|
6494
|
-
var
|
|
7105
|
+
var import_viem17 = require("viem");
|
|
6495
7106
|
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
6496
7107
|
var MAX_CACHE_SIZE2 = 500;
|
|
6497
7108
|
var STORAGE_KEY2 = "match_transaction_logs";
|
|
6498
7109
|
function useTransactionCache() {
|
|
6499
|
-
const [cache, setCache] = (0,
|
|
7110
|
+
const [cache, setCache] = (0, import_react37.useState)(/* @__PURE__ */ new Map());
|
|
6500
7111
|
const isLocalStorageAvailable = (() => {
|
|
6501
7112
|
try {
|
|
6502
7113
|
const testKey = "__test__";
|
|
@@ -6507,7 +7118,7 @@ function useTransactionCache() {
|
|
|
6507
7118
|
return false;
|
|
6508
7119
|
}
|
|
6509
7120
|
})();
|
|
6510
|
-
(0,
|
|
7121
|
+
(0, import_react37.useEffect)(() => {
|
|
6511
7122
|
if (isLocalStorageAvailable) {
|
|
6512
7123
|
try {
|
|
6513
7124
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -6526,7 +7137,7 @@ function useTransactionCache() {
|
|
|
6526
7137
|
}
|
|
6527
7138
|
}
|
|
6528
7139
|
}, []);
|
|
6529
|
-
const updateLocalStorage = (0,
|
|
7140
|
+
const updateLocalStorage = (0, import_react37.useCallback)((updatedCache) => {
|
|
6530
7141
|
if (isLocalStorageAvailable) {
|
|
6531
7142
|
try {
|
|
6532
7143
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -6543,7 +7154,7 @@ function useTransactionCache() {
|
|
|
6543
7154
|
}
|
|
6544
7155
|
}
|
|
6545
7156
|
}, []);
|
|
6546
|
-
const set = (0,
|
|
7157
|
+
const set = (0, import_react37.useCallback)((key, value) => {
|
|
6547
7158
|
const now = Date.now();
|
|
6548
7159
|
const newCache = new Map(cache);
|
|
6549
7160
|
newCache.forEach((entry, k) => {
|
|
@@ -6561,7 +7172,7 @@ function useTransactionCache() {
|
|
|
6561
7172
|
setCache(newCache);
|
|
6562
7173
|
updateLocalStorage(newCache);
|
|
6563
7174
|
}, [cache, updateLocalStorage]);
|
|
6564
|
-
const get = (0,
|
|
7175
|
+
const get = (0, import_react37.useCallback)((key) => {
|
|
6565
7176
|
const entry = cache.get(key);
|
|
6566
7177
|
if (entry) {
|
|
6567
7178
|
if (Date.now() - entry.timestamp > CACHE_TTL2) {
|
|
@@ -6575,7 +7186,7 @@ function useTransactionCache() {
|
|
|
6575
7186
|
}
|
|
6576
7187
|
return void 0;
|
|
6577
7188
|
}, [cache, updateLocalStorage]);
|
|
6578
|
-
const del = (0,
|
|
7189
|
+
const del = (0, import_react37.useCallback)((key) => {
|
|
6579
7190
|
if (cache.has(key)) {
|
|
6580
7191
|
const newCache = new Map(cache);
|
|
6581
7192
|
newCache.delete(key);
|
|
@@ -6583,7 +7194,7 @@ function useTransactionCache() {
|
|
|
6583
7194
|
updateLocalStorage(newCache);
|
|
6584
7195
|
}
|
|
6585
7196
|
}, [cache, updateLocalStorage]);
|
|
6586
|
-
const clear = (0,
|
|
7197
|
+
const clear = (0, import_react37.useCallback)(() => {
|
|
6587
7198
|
setCache(/* @__PURE__ */ new Map());
|
|
6588
7199
|
if (isLocalStorageAvailable) {
|
|
6589
7200
|
localStorage.removeItem(STORAGE_KEY2);
|
|
@@ -6598,7 +7209,7 @@ function useTransaction({
|
|
|
6598
7209
|
const { list } = useMatchChain();
|
|
6599
7210
|
const cache = useTransactionCache();
|
|
6600
7211
|
const chain = list?.find((item) => item.id === chainId);
|
|
6601
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
7212
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react37.useState)(true);
|
|
6602
7213
|
const query = (0, import_react_query8.useQuery)({
|
|
6603
7214
|
queryKey: ["match-tx-transaction", hash, chain],
|
|
6604
7215
|
queryFn: async () => {
|
|
@@ -6608,9 +7219,9 @@ function useTransaction({
|
|
|
6608
7219
|
return cache.get(cacheKey);
|
|
6609
7220
|
}
|
|
6610
7221
|
try {
|
|
6611
|
-
const publicClient = (0,
|
|
6612
|
-
chain: (0,
|
|
6613
|
-
transport: (0,
|
|
7222
|
+
const publicClient = (0, import_viem17.createPublicClient)({
|
|
7223
|
+
chain: (0, import_viem17.defineChain)(chain),
|
|
7224
|
+
transport: (0, import_viem17.http)()
|
|
6614
7225
|
});
|
|
6615
7226
|
const transaction = await publicClient.getTransaction({ hash });
|
|
6616
7227
|
if (!transaction) {
|
|
@@ -6624,7 +7235,7 @@ function useTransaction({
|
|
|
6624
7235
|
},
|
|
6625
7236
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
6626
7237
|
});
|
|
6627
|
-
(0,
|
|
7238
|
+
(0, import_react37.useEffect)(() => {
|
|
6628
7239
|
if (query.data) {
|
|
6629
7240
|
setShouldRefetch(false);
|
|
6630
7241
|
}
|
|
@@ -6633,27 +7244,27 @@ function useTransaction({
|
|
|
6633
7244
|
}
|
|
6634
7245
|
|
|
6635
7246
|
// src/components/CEXBindModal/index.tsx
|
|
6636
|
-
var
|
|
6637
|
-
var
|
|
6638
|
-
var
|
|
7247
|
+
var import_react38 = require("react");
|
|
7248
|
+
var import_react_intl21 = require("react-intl");
|
|
7249
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
6639
7250
|
function CEXBindModal({
|
|
6640
7251
|
onClose,
|
|
6641
7252
|
type,
|
|
6642
7253
|
isOpen = false,
|
|
6643
7254
|
...props
|
|
6644
7255
|
}) {
|
|
6645
|
-
const intl = (0,
|
|
7256
|
+
const intl = (0, import_react_intl21.useIntl)();
|
|
6646
7257
|
const { events } = useMatch();
|
|
6647
|
-
const [APIPassphrase, setAPIPassphrase] = (0,
|
|
7258
|
+
const [APIPassphrase, setAPIPassphrase] = (0, import_react38.useState)("");
|
|
6648
7259
|
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,
|
|
7260
|
+
const [loading, setLoading] = (0, import_react38.useState)(false);
|
|
7261
|
+
const [key, setKey] = (0, import_react38.useState)("");
|
|
7262
|
+
const [secret, setSecret] = (0, import_react38.useState)("");
|
|
7263
|
+
const [error, setError] = (0, import_react38.useState)("");
|
|
7264
|
+
const needPassphrase = (0, import_react38.useMemo)(() => {
|
|
6654
7265
|
return ["bitget", "okx"].includes(type.toLowerCase());
|
|
6655
7266
|
}, [type]);
|
|
6656
|
-
(0,
|
|
7267
|
+
(0, import_react38.useEffect)(() => {
|
|
6657
7268
|
if (isOpen) {
|
|
6658
7269
|
setSecret("");
|
|
6659
7270
|
setKey("");
|
|
@@ -6690,20 +7301,20 @@ function CEXBindModal({
|
|
|
6690
7301
|
setLoading(false);
|
|
6691
7302
|
}
|
|
6692
7303
|
};
|
|
6693
|
-
return /* @__PURE__ */ (0,
|
|
7304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ModalWithHeader, { showClose: true, isOpen, onClose, title: intl.formatMessage({
|
|
6694
7305
|
id: "CEXBindTitle"
|
|
6695
7306
|
}, {
|
|
6696
7307
|
type
|
|
6697
|
-
}), ...props, children: /* @__PURE__ */ (0,
|
|
6698
|
-
/* @__PURE__ */ (0,
|
|
6699
|
-
/* @__PURE__ */ (0,
|
|
6700
|
-
/* @__PURE__ */ (0,
|
|
6701
|
-
/* @__PURE__ */ (0,
|
|
6702
|
-
/* @__PURE__ */ (0,
|
|
7308
|
+
}), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "matchid-cex-modal", children: [
|
|
7309
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { children: [
|
|
7310
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl21.FormattedMessage, { id: "CEXBindAttention" }) }),
|
|
7311
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl21.FormattedMessage, { id: "CEXBindTips1" }) }),
|
|
7312
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl21.FormattedMessage, { id: "CEXBindTips2" }) }),
|
|
7313
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl21.FormattedMessage, { id: "CEXBindTips3" }) })
|
|
6703
7314
|
] }),
|
|
6704
|
-
/* @__PURE__ */ (0,
|
|
7315
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Field, { label: intl.formatMessage({
|
|
6705
7316
|
id: "CEXBindApiKey"
|
|
6706
|
-
}), children: /* @__PURE__ */ (0,
|
|
7317
|
+
}), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
6707
7318
|
Input,
|
|
6708
7319
|
{
|
|
6709
7320
|
value: key,
|
|
@@ -6711,9 +7322,9 @@ function CEXBindModal({
|
|
|
6711
7322
|
placeholder: "**** **** ****"
|
|
6712
7323
|
}
|
|
6713
7324
|
) }),
|
|
6714
|
-
/* @__PURE__ */ (0,
|
|
7325
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Field, { label: intl.formatMessage({
|
|
6715
7326
|
id: "CEXBindApiSecretKey"
|
|
6716
|
-
}), error: !needPassphrase && error, children: /* @__PURE__ */ (0,
|
|
7327
|
+
}), error: !needPassphrase && error, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
6717
7328
|
Input,
|
|
6718
7329
|
{
|
|
6719
7330
|
value: secret,
|
|
@@ -6721,9 +7332,9 @@ function CEXBindModal({
|
|
|
6721
7332
|
placeholder: "**** **** ****"
|
|
6722
7333
|
}
|
|
6723
7334
|
) }),
|
|
6724
|
-
needPassphrase && /* @__PURE__ */ (0,
|
|
7335
|
+
needPassphrase && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Field, { error, label: intl.formatMessage({
|
|
6725
7336
|
id: "CEXBindApiPassphrase"
|
|
6726
|
-
}), children: /* @__PURE__ */ (0,
|
|
7337
|
+
}), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
6727
7338
|
Input,
|
|
6728
7339
|
{
|
|
6729
7340
|
value: APIPassphrase,
|
|
@@ -6731,7 +7342,7 @@ function CEXBindModal({
|
|
|
6731
7342
|
placeholder: "**** **** ****"
|
|
6732
7343
|
}
|
|
6733
7344
|
) }),
|
|
6734
|
-
/* @__PURE__ */ (0,
|
|
7345
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
6735
7346
|
Button,
|
|
6736
7347
|
{
|
|
6737
7348
|
onClick: SubmitApi,
|
|
@@ -6739,7 +7350,7 @@ function CEXBindModal({
|
|
|
6739
7350
|
block: true,
|
|
6740
7351
|
loading,
|
|
6741
7352
|
disabled: !key || !secret,
|
|
6742
|
-
children: /* @__PURE__ */ (0,
|
|
7353
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl21.FormattedMessage, { id: "continue" })
|
|
6743
7354
|
}
|
|
6744
7355
|
)
|
|
6745
7356
|
] }) });
|
|
@@ -6747,9 +7358,10 @@ function CEXBindModal({
|
|
|
6747
7358
|
|
|
6748
7359
|
// src/context/BusinessProvider.tsx
|
|
6749
7360
|
var import_react_query9 = require("@tanstack/react-query");
|
|
6750
|
-
var
|
|
7361
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
6751
7362
|
function BusinessProvider({ children }) {
|
|
6752
7363
|
const { overview, token } = useUserInfo();
|
|
7364
|
+
const { type: EVMType, isOpen: EVMIsOpen, close: EVMClose } = useEVMModalStore();
|
|
6753
7365
|
const { type: TONType, isOpen: TONIsOpen, close: TONClose } = useTONModalStore();
|
|
6754
7366
|
const { type: TRONType, isOpen: TRONIsOpen, close: TRONClose } = useTRONModalStore();
|
|
6755
7367
|
const { type: BTCType, isOpen: BTCIsOpen, close: BTCClose } = useBTCModalStore();
|
|
@@ -6780,8 +7392,18 @@ function BusinessProvider({ children }) {
|
|
|
6780
7392
|
enabled: !!tgAppAuthCode,
|
|
6781
7393
|
refetchInterval: 1e3 * 5
|
|
6782
7394
|
});
|
|
6783
|
-
return /* @__PURE__ */ (0,
|
|
6784
|
-
/* @__PURE__ */ (0,
|
|
7395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
7396
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
7397
|
+
EVMModal,
|
|
7398
|
+
{
|
|
7399
|
+
isOpen: EVMIsOpen && (EVMType == "login" && !overview && !token || EVMType == "bind" && !!token && !!overview),
|
|
7400
|
+
onClose: EVMClose,
|
|
7401
|
+
type: EVMType,
|
|
7402
|
+
onSuccess: EVMClose,
|
|
7403
|
+
zIndex: 199
|
|
7404
|
+
}
|
|
7405
|
+
),
|
|
7406
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6785
7407
|
TRONModal,
|
|
6786
7408
|
{
|
|
6787
7409
|
isOpen: TRONIsOpen && (TRONType == "login" && !overview && !token || TRONType == "bind" && !!token && !!overview),
|
|
@@ -6791,7 +7413,7 @@ function BusinessProvider({ children }) {
|
|
|
6791
7413
|
zIndex: 199
|
|
6792
7414
|
}
|
|
6793
7415
|
),
|
|
6794
|
-
/* @__PURE__ */ (0,
|
|
7416
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6795
7417
|
TONModal,
|
|
6796
7418
|
{
|
|
6797
7419
|
isOpen: TONIsOpen && (TONType == "login" && !overview && !token || TONType == "bind" && !!token && !!overview),
|
|
@@ -6801,7 +7423,7 @@ function BusinessProvider({ children }) {
|
|
|
6801
7423
|
zIndex: 199
|
|
6802
7424
|
}
|
|
6803
7425
|
),
|
|
6804
|
-
/* @__PURE__ */ (0,
|
|
7426
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6805
7427
|
BTCModal,
|
|
6806
7428
|
{
|
|
6807
7429
|
isOpen: BTCIsOpen && (BTCType == "login" && !overview && !token || BTCType == "bind" && !!token && !!overview),
|
|
@@ -6811,7 +7433,7 @@ function BusinessProvider({ children }) {
|
|
|
6811
7433
|
zIndex: 199
|
|
6812
7434
|
}
|
|
6813
7435
|
),
|
|
6814
|
-
/* @__PURE__ */ (0,
|
|
7436
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6815
7437
|
CEXBindModal,
|
|
6816
7438
|
{
|
|
6817
7439
|
isOpen: CEXIsOpen && (!!token && !!overview),
|
|
@@ -6820,7 +7442,7 @@ function BusinessProvider({ children }) {
|
|
|
6820
7442
|
zIndex: 199
|
|
6821
7443
|
}
|
|
6822
7444
|
),
|
|
6823
|
-
/* @__PURE__ */ (0,
|
|
7445
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
6824
7446
|
WalletModal,
|
|
6825
7447
|
{
|
|
6826
7448
|
isOpen: WalletModalStore.isOpen && (WalletModalStore.type == "login" && !overview && !token || WalletModalStore.type == "bind" && !!token && !!overview),
|
|
@@ -6835,14 +7457,14 @@ function BusinessProvider({ children }) {
|
|
|
6835
7457
|
}
|
|
6836
7458
|
|
|
6837
7459
|
// src/context/index.tsx
|
|
6838
|
-
var
|
|
7460
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
6839
7461
|
var Providers = ({ children }) => {
|
|
6840
|
-
return /* @__PURE__ */ (0,
|
|
7462
|
+
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
7463
|
};
|
|
6842
7464
|
var context_default = Providers;
|
|
6843
7465
|
|
|
6844
7466
|
// src/hooks/useWalletInit.ts
|
|
6845
|
-
var
|
|
7467
|
+
var import_react39 = require("react");
|
|
6846
7468
|
|
|
6847
7469
|
// src/utils/wallet.ts
|
|
6848
7470
|
var sendMessage = ({ method, data, resolve, reject, timeout }) => {
|
|
@@ -6875,11 +7497,11 @@ function useWalletInit({
|
|
|
6875
7497
|
}) {
|
|
6876
7498
|
const { endpoints, token, setWallet, appid, refreshOverview } = useLocalStore_default();
|
|
6877
7499
|
const { setWalletReady, walletReady } = useStore_default();
|
|
6878
|
-
const iframeReadyRef = (0,
|
|
6879
|
-
(0,
|
|
7500
|
+
const iframeReadyRef = (0, import_react39.useRef)(walletReady);
|
|
7501
|
+
(0, import_react39.useEffect)(() => {
|
|
6880
7502
|
setWallet(config);
|
|
6881
7503
|
}, [config]);
|
|
6882
|
-
(0,
|
|
7504
|
+
(0, import_react39.useEffect)(() => {
|
|
6883
7505
|
matchlog_default.log("sdk.mpc.status", walletReady, iframeReadyRef.current);
|
|
6884
7506
|
iframeReadyRef.current = walletReady;
|
|
6885
7507
|
if (iframeReadyRef.current) {
|
|
@@ -6896,7 +7518,7 @@ function useWalletInit({
|
|
|
6896
7518
|
onReady();
|
|
6897
7519
|
}
|
|
6898
7520
|
}, [walletReady]);
|
|
6899
|
-
(0,
|
|
7521
|
+
(0, import_react39.useEffect)(() => {
|
|
6900
7522
|
if (!endpoints.auth || !appid || !token || !config) {
|
|
6901
7523
|
const existingIframe = getWalletIframe();
|
|
6902
7524
|
if (existingIframe) {
|
|
@@ -6996,7 +7618,7 @@ function useWalletInit({
|
|
|
6996
7618
|
}
|
|
6997
7619
|
}
|
|
6998
7620
|
}, [endpoints.auth, appid, token, config]);
|
|
6999
|
-
(0,
|
|
7621
|
+
(0, import_react39.useEffect)(() => {
|
|
7000
7622
|
const messageHandle = async (e) => {
|
|
7001
7623
|
if (e.origin !== endpoints.auth.substring(0, endpoints.auth.length - 1)) {
|
|
7002
7624
|
return;
|
|
@@ -7077,7 +7699,7 @@ function useWalletInit({
|
|
|
7077
7699
|
}
|
|
7078
7700
|
|
|
7079
7701
|
// src/hooks/useInit.tsx
|
|
7080
|
-
var
|
|
7702
|
+
var import_react40 = require("react");
|
|
7081
7703
|
function useInit({
|
|
7082
7704
|
theme,
|
|
7083
7705
|
appid,
|
|
@@ -7097,24 +7719,24 @@ function useInit({
|
|
|
7097
7719
|
locale: realLocale
|
|
7098
7720
|
} = useLocalStore_default();
|
|
7099
7721
|
const walletModalStore = useWalletModalStore();
|
|
7100
|
-
const overviewLoadingRef = (0,
|
|
7722
|
+
const overviewLoadingRef = (0, import_react40.useRef)(false);
|
|
7101
7723
|
const searchParams = new URLSearchParams(window.location.search);
|
|
7102
7724
|
const matchToken = searchParams.get("matchToken");
|
|
7103
7725
|
const matchidt = searchParams.get("matchidt");
|
|
7104
7726
|
const realEndpoints = endpoints || env_default.endpoints;
|
|
7105
|
-
(0,
|
|
7727
|
+
(0, import_react40.useEffect)(() => {
|
|
7106
7728
|
setTheme(theme);
|
|
7107
7729
|
}, [theme]);
|
|
7108
|
-
(0,
|
|
7730
|
+
(0, import_react40.useEffect)(() => {
|
|
7109
7731
|
setAppid(appid);
|
|
7110
7732
|
}, [appid]);
|
|
7111
|
-
(0,
|
|
7733
|
+
(0, import_react40.useEffect)(() => {
|
|
7112
7734
|
setEndpoints(realEndpoints);
|
|
7113
7735
|
}, [realEndpoints]);
|
|
7114
|
-
(0,
|
|
7736
|
+
(0, import_react40.useEffect)(() => {
|
|
7115
7737
|
setLocale(locale || "en");
|
|
7116
7738
|
}, [locale]);
|
|
7117
|
-
(0,
|
|
7739
|
+
(0, import_react40.useEffect)(() => {
|
|
7118
7740
|
if (matchToken) {
|
|
7119
7741
|
const tokenData = JSON.parse(atob(matchToken));
|
|
7120
7742
|
if (tokenData && tokenData.mid && tokenData.token) {
|
|
@@ -7125,7 +7747,7 @@ function useInit({
|
|
|
7125
7747
|
}
|
|
7126
7748
|
}
|
|
7127
7749
|
}, [matchToken]);
|
|
7128
|
-
(0,
|
|
7750
|
+
(0, import_react40.useEffect)(() => {
|
|
7129
7751
|
if (matchidt) {
|
|
7130
7752
|
const tokenData = decodeURIComponent(matchidt);
|
|
7131
7753
|
const data = JSON.parse(decodeBase64(tokenData));
|
|
@@ -7155,7 +7777,7 @@ function useInit({
|
|
|
7155
7777
|
}
|
|
7156
7778
|
}
|
|
7157
7779
|
}, [matchidt]);
|
|
7158
|
-
(0,
|
|
7780
|
+
(0, import_react40.useEffect)(() => {
|
|
7159
7781
|
const onLoginMessage = (event) => {
|
|
7160
7782
|
const res = event.data;
|
|
7161
7783
|
if (res.event === "login" && res.data && (res.data.token || res.data.token_type && res.data.access_token)) {
|
|
@@ -7192,7 +7814,7 @@ function useInit({
|
|
|
7192
7814
|
overviewLoadingRef.current = false;
|
|
7193
7815
|
}
|
|
7194
7816
|
};
|
|
7195
|
-
(0,
|
|
7817
|
+
(0, import_react40.useEffect)(() => {
|
|
7196
7818
|
if (token) {
|
|
7197
7819
|
loadOverview();
|
|
7198
7820
|
}
|
|
@@ -7223,7 +7845,7 @@ function useInit({
|
|
|
7223
7845
|
|
|
7224
7846
|
// src/MatchContext.tsx
|
|
7225
7847
|
var import_react_query10 = require("@tanstack/react-query");
|
|
7226
|
-
var
|
|
7848
|
+
var import_react_intl22 = require("react-intl");
|
|
7227
7849
|
|
|
7228
7850
|
// src/i18n/en.json
|
|
7229
7851
|
var en_default = {
|
|
@@ -7968,9 +8590,9 @@ var messages = {
|
|
|
7968
8590
|
};
|
|
7969
8591
|
|
|
7970
8592
|
// src/MatchContext.tsx
|
|
7971
|
-
var
|
|
8593
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
7972
8594
|
var queryClient = new import_react_query10.QueryClient();
|
|
7973
|
-
var MatchContext = (0,
|
|
8595
|
+
var MatchContext = (0, import_react41.createContext)(void 0);
|
|
7974
8596
|
var MatchProvider = ({
|
|
7975
8597
|
children,
|
|
7976
8598
|
appid,
|
|
@@ -7990,7 +8612,7 @@ var MatchProvider = ({
|
|
|
7990
8612
|
useWalletInit({
|
|
7991
8613
|
config: wallet
|
|
7992
8614
|
});
|
|
7993
|
-
return /* @__PURE__ */ (0,
|
|
8615
|
+
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
8616
|
MatchContext.Provider,
|
|
7995
8617
|
{
|
|
7996
8618
|
value: {
|
|
@@ -8001,12 +8623,12 @@ var MatchProvider = ({
|
|
|
8001
8623
|
theme,
|
|
8002
8624
|
locale: realLocale
|
|
8003
8625
|
},
|
|
8004
|
-
children: /* @__PURE__ */ (0,
|
|
8626
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(context_default, { children })
|
|
8005
8627
|
}
|
|
8006
8628
|
) }) });
|
|
8007
8629
|
};
|
|
8008
8630
|
var useMatch = () => {
|
|
8009
|
-
const context = (0,
|
|
8631
|
+
const context = (0, import_react41.useContext)(MatchContext);
|
|
8010
8632
|
if (context === void 0) {
|
|
8011
8633
|
throw new Error("useMatch must be used within a MatchProvider");
|
|
8012
8634
|
}
|
|
@@ -8092,68 +8714,6 @@ __export(chains_exports, {
|
|
|
8092
8714
|
MatchTest: () => matchTest
|
|
8093
8715
|
});
|
|
8094
8716
|
|
|
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
8717
|
// src/types/index.ts
|
|
8158
8718
|
var types_exports = {};
|
|
8159
8719
|
__export(types_exports, {
|