@matchain/matchid-sdk-react 0.1.8 → 0.1.10

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/index.mjs CHANGED
@@ -395,7 +395,7 @@ function ModalWithHeader({
395
395
  }
396
396
 
397
397
  // src/components/PasswordModal/index.tsx
398
- import { useEffect as useEffect3, useMemo as useMemo3, useState as useState3 } from "react";
398
+ import { useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
399
399
 
400
400
  // src/components/Input/index.tsx
401
401
  import { useState } from "react";
@@ -596,6 +596,20 @@ var getToken = () => {
596
596
  }
597
597
  };
598
598
 
599
+ // src/utils/matchlog.ts
600
+ var matchDevExists = () => localStorage.getItem("matchid-sdk-react-debug") !== null;
601
+ var handler = {
602
+ get(target, prop) {
603
+ if (matchDevExists() && typeof target[prop] === "function") {
604
+ return target[prop].bind(console);
605
+ }
606
+ return () => {
607
+ };
608
+ }
609
+ };
610
+ var matchlog = new Proxy(console, handler);
611
+ var matchlog_default = matchlog;
612
+
599
613
  // src/api/request.ts
600
614
  var SUCCESS_CODE = 0;
601
615
  var isSuccess = (res) => {
@@ -617,7 +631,7 @@ var request = async (config) => {
617
631
  instance.defaults.headers.common["Authorization"] = token;
618
632
  }
619
633
  const { data } = await instance.request(config);
620
- console.log("api", data);
634
+ matchlog_default.log("api", data);
621
635
  if (data.code == 401001) {
622
636
  localStore.getState().logout();
623
637
  throw new Error("Your session has expired, please log in again");
@@ -673,6 +687,72 @@ var setUserNameApi = (data) => {
673
687
  data
674
688
  });
675
689
  };
690
+ var getBindListApi = () => {
691
+ return request_default({
692
+ url: `/bind/list`,
693
+ method: "GET"
694
+ });
695
+ };
696
+ var getPohListApi = () => {
697
+ return request_default({
698
+ url: `/poh/list`,
699
+ method: "GET"
700
+ });
701
+ };
702
+ var getBindInfoApi = () => {
703
+ return request_default({
704
+ url: `/bind`,
705
+ method: "GET"
706
+ });
707
+ };
708
+ var bindCexApi = ({ cex, api_key, api_secret }) => {
709
+ return request_default({
710
+ url: `/cex/subscribe`,
711
+ method: "POST",
712
+ data: { cex, api_key, api_secret }
713
+ });
714
+ };
715
+ var unBindApi = ({ type }) => {
716
+ return request_default({
717
+ url: `/unbind`,
718
+ method: "POST",
719
+ data: { type }
720
+ });
721
+ };
722
+ var unBindWalletApi = ({ address }) => {
723
+ return request_default({
724
+ url: `/wallet/unbind`,
725
+ method: "POST",
726
+ data: { address }
727
+ });
728
+ };
729
+ var verifyPohApi = ({
730
+ taskId,
731
+ schemaId,
732
+ publicFields,
733
+ allocatorAddress,
734
+ publicFieldsHash,
735
+ allocatorSignature,
736
+ uHash,
737
+ validatorAddress,
738
+ validatorSignature
739
+ }) => {
740
+ return request_default({
741
+ url: `/poh/zkpass`,
742
+ method: "POST",
743
+ data: {
744
+ taskId,
745
+ schemaId,
746
+ publicFields,
747
+ allocatorAddress,
748
+ publicFieldsHash,
749
+ allocatorSignature,
750
+ uHash,
751
+ validatorAddress,
752
+ validatorSignature
753
+ }
754
+ });
755
+ };
676
756
 
677
757
  // src/hooks/eventManager.ts
678
758
  var EventManager = class {
@@ -754,7 +834,7 @@ function useUserInfo() {
754
834
  };
755
835
  const loginByMethod = (method) => {
756
836
  const link = `${endpoints.back}auth/${method}?appid=${appid}&provider=${method}&redirect=${encodeURIComponent(endpoints.login + "login/" + method)}&authorization=${(/* @__PURE__ */ new Date()).getTime()}`;
757
- console.log("link", link);
837
+ matchlog_default.log("link", link);
758
838
  const authWindow = window.open(
759
839
  link,
760
840
  // Replace with the actual authorization URL
@@ -870,24 +950,21 @@ function useUserInfo() {
870
950
  import { useEffect } from "react";
871
951
  function useMatchEvents(handlers) {
872
952
  useEffect(() => {
873
- Object.entries(handlers).forEach(([event, handler]) => {
874
- if (handler) {
875
- eventManager_default.on(event, handler);
953
+ Object.entries(handlers).forEach(([event, handler2]) => {
954
+ if (handler2) {
955
+ eventManager_default.on(event, handler2);
876
956
  }
877
957
  });
878
958
  return () => {
879
- Object.entries(handlers).forEach(([event, handler]) => {
880
- if (handler) {
881
- eventManager_default.off(event, handler);
959
+ Object.entries(handlers).forEach(([event, handler2]) => {
960
+ if (handler2) {
961
+ eventManager_default.off(event, handler2);
882
962
  }
883
963
  });
884
964
  };
885
965
  }, [handlers]);
886
966
  }
887
967
 
888
- // src/hooks/useWallet.tsx
889
- import { useEffect as useEffect2, useState as useState2 } from "react";
890
-
891
968
  // src/store/useStore.ts
892
969
  import { create as create2 } from "zustand";
893
970
  var useStore = create2((set) => ({
@@ -941,7 +1018,7 @@ function useWallet() {
941
1018
  const signMessage = async (message, type) => {
942
1019
  return new Promise(async (resolve, reject) => {
943
1020
  const res = await isRecovered();
944
- console.log("isRecovered", res);
1021
+ matchlog_default.log("isRecovered", res);
945
1022
  const getSign = async () => {
946
1023
  try {
947
1024
  const recoverRes = await window.waitMatchUntilWalletMessage("signMessage", {
@@ -959,7 +1036,7 @@ function useWallet() {
959
1036
  setRecoveryModal({
960
1037
  open: true,
961
1038
  success: async () => {
962
- console.log("recover Success");
1039
+ matchlog_default.log("recover Success");
963
1040
  await getSign();
964
1041
  },
965
1042
  close: async () => {
@@ -972,14 +1049,15 @@ function useWallet() {
972
1049
  did: overview?.did?.split(":")[2] || ""
973
1050
  });
974
1051
  } else {
975
- getSign();
1052
+ await recoveryWallet("ethereum", "user_passcode_recovery_key");
1053
+ await getSign();
976
1054
  }
977
1055
  });
978
1056
  };
979
1057
  const signTransaction = async (transaction, type) => {
980
1058
  return new Promise(async (resolve, reject) => {
981
1059
  const res = await isRecovered();
982
- console.log("isRecovered", res);
1060
+ matchlog_default.log("isRecovered", res);
983
1061
  const getSign = async () => {
984
1062
  try {
985
1063
  const recoverRes = await window.waitMatchUntilWalletMessage("signTransaction", {
@@ -997,7 +1075,7 @@ function useWallet() {
997
1075
  setRecoveryModal({
998
1076
  open: true,
999
1077
  success: async () => {
1000
- console.log("recover Success");
1078
+ matchlog_default.log("recover Success");
1001
1079
  await getSign();
1002
1080
  },
1003
1081
  close: async () => {
@@ -1010,7 +1088,8 @@ function useWallet() {
1010
1088
  did: overview?.did?.split(":")[2] || ""
1011
1089
  });
1012
1090
  } else {
1013
- getSign();
1091
+ await recoveryWallet("ethereum", "user_passcode_recovery_key");
1092
+ await getSign();
1014
1093
  }
1015
1094
  });
1016
1095
  };
@@ -1030,131 +1109,6 @@ function useWallet() {
1030
1109
  isRecovered
1031
1110
  };
1032
1111
  }
1033
- var useWalletInit = ({
1034
- refreshOverview
1035
- }) => {
1036
- const { env } = useLocalStore_default();
1037
- const getWalletIframe = () => {
1038
- return document.getElementById("match-wallet");
1039
- };
1040
- const [walletInited, setWalletInited] = useState2(false);
1041
- const { appid, token, overview } = useLocalStore_default();
1042
- const { initWallet, generateWallet } = useWallet();
1043
- useEffect2(() => {
1044
- if (env) {
1045
- if (!window.matchWalletMessageIdMap) {
1046
- window.matchWalletMessageIdMap = {};
1047
- }
1048
- const config = env_default[env];
1049
- const endpoints = config.endpoints;
1050
- const existingIframe = getWalletIframe();
1051
- if (!existingIframe) {
1052
- const iframe = document.createElement("iframe");
1053
- iframe.id = "match-wallet";
1054
- iframe.src = endpoints.login + "wallet";
1055
- iframe.style.display = "none";
1056
- iframe.style.width = "0";
1057
- iframe.style.height = "0";
1058
- iframe.onload = () => {
1059
- setWalletInited(true);
1060
- };
1061
- document.body.insertBefore(iframe, document.body.firstChild);
1062
- window.sendMatchWalletMessage = (method, data) => {
1063
- const messageId = Date.now().toString() + Math.random().toString().slice(6);
1064
- const message = {
1065
- method,
1066
- data,
1067
- messageId,
1068
- source: "matchid"
1069
- };
1070
- if (document.getElementById("match-wallet")) {
1071
- getWalletIframe()?.contentWindow?.postMessage(message, "*");
1072
- return messageId;
1073
- }
1074
- console.error("not found iframe");
1075
- return false;
1076
- };
1077
- window.waitMatchUntilWalletMessage = async (method, data, timeout = 5e3) => {
1078
- return new Promise((resolve, reject) => {
1079
- const messageId = window.sendMatchWalletMessage(method, data);
1080
- if (!messageId) {
1081
- console.error("Can't find wallet message");
1082
- reject(new Error("Can't find wallet message"));
1083
- return;
1084
- }
1085
- window.matchWalletMessageIdMap[messageId] = { resolve, reject };
1086
- window.matchWalletMessageIdMap[messageId].timeout = setTimeout(() => {
1087
- console.error("Get wallet result timeout", {
1088
- messageId,
1089
- method,
1090
- data
1091
- });
1092
- delete window.matchWalletMessageIdMap[messageId];
1093
- reject(new Error("Get wallet result timeout"));
1094
- }, timeout);
1095
- });
1096
- };
1097
- } else {
1098
- if (existingIframe.src !== endpoints.login + "wallet") {
1099
- existingIframe.src = endpoints.login + "wallet";
1100
- }
1101
- setWalletInited(true);
1102
- }
1103
- }
1104
- }, [env]);
1105
- useEffect2(() => {
1106
- const messageHandle = async (e) => {
1107
- const res = e.data;
1108
- if (res.source != "match-wallet") {
1109
- return;
1110
- }
1111
- const messageId = res.messageId;
1112
- if (messageId && window.matchWalletMessageIdMap[messageId]) {
1113
- const { resolve, reject, timeout } = window.matchWalletMessageIdMap[messageId];
1114
- delete window.matchWalletMessageIdMap[messageId];
1115
- clearTimeout(timeout);
1116
- if (res.status == "success") {
1117
- resolve(res.data);
1118
- } else {
1119
- console.error("qwe-waller-error", res);
1120
- reject(new Error(res.data.message));
1121
- }
1122
- }
1123
- };
1124
- window.addEventListener("message", messageHandle);
1125
- return () => {
1126
- window.removeEventListener("message", messageHandle);
1127
- };
1128
- }, []);
1129
- useEffect2(() => {
1130
- if (token && overview && overview.did && walletInited) {
1131
- const did = overview.did.split(":")[2];
1132
- const newUserInit = async () => {
1133
- await window.waitMatchUntilWalletMessage(
1134
- "initCore",
1135
- {
1136
- AppId: appid,
1137
- AppClientId,
1138
- UserId: did,
1139
- AccessToken: token,
1140
- Address: ""
1141
- }
1142
- );
1143
- };
1144
- if (!overview.address) {
1145
- newUserInit();
1146
- } else {
1147
- initWallet({
1148
- address: overview.address,
1149
- did
1150
- });
1151
- }
1152
- }
1153
- }, [overview, token, walletInited]);
1154
- return {
1155
- walletInited
1156
- };
1157
- };
1158
1112
 
1159
1113
  // src/components/PasswordModal/index.tsx
1160
1114
  import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
@@ -1166,27 +1120,27 @@ function PasswordModal({
1166
1120
  }) {
1167
1121
  const { refreshOverview } = useUserInfo();
1168
1122
  const { isLogin, did } = useUserInfo();
1169
- const [password, setPassword] = useState3("");
1170
- const [rePassword, setRePassword] = useState3("");
1171
- const [error, setError] = useState3("");
1123
+ const [password, setPassword] = useState2("");
1124
+ const [rePassword, setRePassword] = useState2("");
1125
+ const [error, setError] = useState2("");
1172
1126
  const { generateWallet } = useWallet();
1173
- const passwordError = useMemo3(() => {
1127
+ const passwordError = useMemo2(() => {
1174
1128
  if (password.length < 6) return "Password must be at least 6 characters";
1175
1129
  return "";
1176
1130
  }, [password]);
1177
- const rePasswordError = useMemo3(() => {
1131
+ const rePasswordError = useMemo2(() => {
1178
1132
  if (rePassword != password) {
1179
1133
  return "The password you entered twice do not match";
1180
1134
  }
1181
1135
  return "";
1182
1136
  }, [rePassword, password]);
1183
- useEffect3(() => {
1137
+ useEffect2(() => {
1184
1138
  if (isOpen) {
1185
1139
  setPassword("");
1186
1140
  setRePassword("");
1187
1141
  }
1188
1142
  }, [isOpen]);
1189
- const [isSubmitting, setIsSubmitting] = useState3(false);
1143
+ const [isSubmitting, setIsSubmitting] = useState2(false);
1190
1144
  const onContinue = async () => {
1191
1145
  if (isSubmitting) return;
1192
1146
  try {
@@ -1246,7 +1200,7 @@ function PasswordModal({
1246
1200
  }
1247
1201
 
1248
1202
  // src/components/RecoveryModal/index.tsx
1249
- import { useEffect as useEffect4, useMemo as useMemo4, useState as useState4 } from "react";
1203
+ import { useEffect as useEffect3, useMemo as useMemo3, useState as useState3 } from "react";
1250
1204
  import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
1251
1205
  function RecoveryModal({
1252
1206
  title,
@@ -1256,19 +1210,19 @@ function RecoveryModal({
1256
1210
  }) {
1257
1211
  const { refreshOverview } = useUserInfo();
1258
1212
  const { isLogin } = useUserInfo();
1259
- const [password, setPassword] = useState4("");
1213
+ const [password, setPassword] = useState3("");
1260
1214
  const { recoveryWallet } = useWallet();
1261
- const [error, setError] = useState4("");
1262
- const passwordError = useMemo4(() => {
1215
+ const [error, setError] = useState3("");
1216
+ const passwordError = useMemo3(() => {
1263
1217
  if (password.length < 6) return "Password must be at least 6 characters";
1264
1218
  return "";
1265
1219
  }, [password]);
1266
- useEffect4(() => {
1220
+ useEffect3(() => {
1267
1221
  if (isOpen) {
1268
1222
  setPassword("");
1269
1223
  }
1270
1224
  }, [isOpen]);
1271
- const [isSubmitting, setIsSubmitting] = useState4(false);
1225
+ const [isSubmitting, setIsSubmitting] = useState3(false);
1272
1226
  const onContinue = async () => {
1273
1227
  if (isSubmitting) return;
1274
1228
  try {
@@ -1342,8 +1296,146 @@ var Providers = ({ children }) => {
1342
1296
  };
1343
1297
  var context_default = Providers;
1344
1298
 
1299
+ // src/hooks/useWalletInit.ts
1300
+ import { useEffect as useEffect4, useState as useState4 } from "react";
1301
+ var AppClientId2 = "react-sdk-" + getVersion();
1302
+ function useWalletInit({
1303
+ refreshOverview
1304
+ }) {
1305
+ const { env } = useLocalStore_default();
1306
+ const getWalletIframe = () => {
1307
+ return document.getElementById("match-wallet");
1308
+ };
1309
+ const [walletInited, setWalletInited] = useState4(false);
1310
+ const { appid, token, overview } = useLocalStore_default();
1311
+ const { initWallet, generateWallet } = useWallet();
1312
+ useEffect4(() => {
1313
+ if (env) {
1314
+ if (!window.matchWalletMessageIdMap) {
1315
+ window.matchWalletMessageIdMap = {};
1316
+ }
1317
+ const config = env_default[env];
1318
+ const endpoints = config.endpoints;
1319
+ const existingIframe = getWalletIframe();
1320
+ if (!existingIframe) {
1321
+ const iframe = document.createElement("iframe");
1322
+ iframe.id = "match-wallet";
1323
+ iframe.src = endpoints.login + "wallet";
1324
+ iframe.style.display = "none";
1325
+ iframe.style.width = "0";
1326
+ iframe.style.height = "0";
1327
+ document.body.insertBefore(iframe, document.body.firstChild);
1328
+ window.sendMatchWalletMessage = (method, data) => {
1329
+ const messageId = Date.now().toString() + Math.random().toString().slice(6);
1330
+ const message = {
1331
+ method,
1332
+ data,
1333
+ messageId,
1334
+ source: "matchid"
1335
+ };
1336
+ if (document.getElementById("match-wallet")) {
1337
+ matchlog_default.log("matchid.sdk.sendMatchWalletMessage", message, endpoints.login);
1338
+ getWalletIframe()?.contentWindow?.postMessage(message, endpoints.login);
1339
+ return messageId;
1340
+ }
1341
+ console.error("not found iframe");
1342
+ return false;
1343
+ };
1344
+ window.waitMatchUntilWalletMessage = async (method, data, timeout = 1e4) => {
1345
+ return new Promise((resolve, reject) => {
1346
+ const messageId = window.sendMatchWalletMessage(method, data);
1347
+ if (!messageId) {
1348
+ console.error("Can't find wallet message");
1349
+ reject(new Error("Can't find wallet message"));
1350
+ return;
1351
+ }
1352
+ window.matchWalletMessageIdMap[messageId] = { resolve, reject };
1353
+ window.matchWalletMessageIdMap[messageId].timeout = setTimeout(() => {
1354
+ console.error("Get wallet result timeout", {
1355
+ messageId,
1356
+ method,
1357
+ data
1358
+ });
1359
+ delete window.matchWalletMessageIdMap[messageId];
1360
+ reject(new Error("Get wallet result timeout"));
1361
+ }, timeout);
1362
+ });
1363
+ };
1364
+ } else {
1365
+ if (existingIframe.src !== endpoints.login + "wallet") {
1366
+ setWalletInited(false);
1367
+ existingIframe.src = endpoints.login + "wallet";
1368
+ } else {
1369
+ setWalletInited(true);
1370
+ }
1371
+ }
1372
+ }
1373
+ }, [env]);
1374
+ useEffect4(() => {
1375
+ const messageHandle = async (e) => {
1376
+ if (e.origin !== env_default[env].endpoints.login.substring(0, env_default[env].endpoints.login.length - 1)) {
1377
+ return;
1378
+ }
1379
+ const res = e.data;
1380
+ if (res.source != "match-wallet") {
1381
+ return;
1382
+ }
1383
+ matchlog_default.log("sdk.wallet.receive", e);
1384
+ const messageId = res.messageId;
1385
+ if (messageId == "init") {
1386
+ matchlog_default.log("wallet init");
1387
+ setWalletInited(true);
1388
+ return;
1389
+ }
1390
+ if (messageId && window.matchWalletMessageIdMap[messageId]) {
1391
+ const { resolve, reject, timeout } = window.matchWalletMessageIdMap[messageId];
1392
+ delete window.matchWalletMessageIdMap[messageId];
1393
+ clearTimeout(timeout);
1394
+ if (res.status == "success") {
1395
+ resolve(res.data);
1396
+ } else {
1397
+ console.error("qwe-waller-error", res);
1398
+ reject(new Error(res.data.message));
1399
+ }
1400
+ }
1401
+ };
1402
+ window.addEventListener("message", messageHandle);
1403
+ return () => {
1404
+ window.removeEventListener("message", messageHandle);
1405
+ };
1406
+ }, []);
1407
+ useEffect4(() => {
1408
+ if (token && overview && overview.did && walletInited) {
1409
+ const did = overview.did.split(":")[2];
1410
+ const newUserInit = async () => {
1411
+ await window.waitMatchUntilWalletMessage(
1412
+ "initCore",
1413
+ {
1414
+ AppId: appid,
1415
+ AppClientId: AppClientId2,
1416
+ UserId: did,
1417
+ AccessToken: token,
1418
+ Address: ""
1419
+ }
1420
+ );
1421
+ };
1422
+ if (!overview.address) {
1423
+ newUserInit();
1424
+ } else {
1425
+ initWallet({
1426
+ address: overview.address,
1427
+ did
1428
+ });
1429
+ }
1430
+ }
1431
+ }, [overview, token, walletInited]);
1432
+ return {
1433
+ walletInited
1434
+ };
1435
+ }
1436
+
1345
1437
  // src/hooks/useInit.tsx
1346
- import { useEffect as useEffect5, useRef as useRef2 } from "react";
1438
+ import { useEffect as useEffect5, useRef } from "react";
1347
1439
  function useInit({
1348
1440
  theme,
1349
1441
  appid,
@@ -1359,7 +1451,7 @@ function useInit({
1359
1451
  setOverview,
1360
1452
  setTheme
1361
1453
  } = useLocalStore_default();
1362
- const overviewLoadingRef = useRef2(false);
1454
+ const overviewLoadingRef = useRef(false);
1363
1455
  const searchParams = new URLSearchParams(window.location.search);
1364
1456
  const matchToken = searchParams.get("matchToken");
1365
1457
  const config = env_default[env];
@@ -1405,7 +1497,7 @@ function useInit({
1405
1497
  };
1406
1498
  }, []);
1407
1499
  const loadOverview = async () => {
1408
- console.log("loadOverview");
1500
+ matchlog_default.log("loadOverview");
1409
1501
  if (overviewLoadingRef.current) {
1410
1502
  return;
1411
1503
  }
@@ -1451,7 +1543,9 @@ function useInit({
1451
1543
  }
1452
1544
 
1453
1545
  // src/MatchContext.tsx
1546
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
1454
1547
  import { jsx as jsx28 } from "react/jsx-runtime";
1548
+ var queryClient = new QueryClient();
1455
1549
  var MatchContext = createContext(void 0);
1456
1550
  var MatchProvider = ({ children, appid, env = "main", events, theme = "light" }) => {
1457
1551
  const { loadOverview, login, config, endpoints } = useInit({
@@ -1463,7 +1557,7 @@ var MatchProvider = ({ children, appid, env = "main", events, theme = "light" })
1463
1557
  useWalletInit({
1464
1558
  refreshOverview: loadOverview
1465
1559
  });
1466
- return /* @__PURE__ */ jsx28(
1560
+ return /* @__PURE__ */ jsx28(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx28(
1467
1561
  MatchContext.Provider,
1468
1562
  {
1469
1563
  value: {
@@ -1476,7 +1570,7 @@ var MatchProvider = ({ children, appid, env = "main", events, theme = "light" })
1476
1570
  },
1477
1571
  children: /* @__PURE__ */ jsx28(context_default, { children })
1478
1572
  }
1479
- );
1573
+ ) });
1480
1574
  };
1481
1575
  var useMatch = () => {
1482
1576
  const context = useContext(MatchContext);
@@ -1507,7 +1601,7 @@ __export(components_exports, {
1507
1601
  import { useEffect as useEffect9, useState as useState8 } from "react";
1508
1602
 
1509
1603
  // src/components/EmailModal/StepEmail.tsx
1510
- import { useEffect as useEffect7, useMemo as useMemo5, useState as useState6 } from "react";
1604
+ import { useEffect as useEffect7, useMemo as useMemo4, useState as useState6 } from "react";
1511
1605
  import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
1512
1606
  function StepEmail(props) {
1513
1607
  const [emailVal, setEmailVal] = useState6("");
@@ -1516,7 +1610,7 @@ function StepEmail(props) {
1516
1610
  setEmailVal(props.email);
1517
1611
  }
1518
1612
  }, []);
1519
- const canContinue = useMemo5(() => {
1613
+ const canContinue = useMemo4(() => {
1520
1614
  return isValidEmail(emailVal);
1521
1615
  }, [emailVal]);
1522
1616
  const onContinue = async () => {
@@ -1538,7 +1632,7 @@ function StepEmail(props) {
1538
1632
  }
1539
1633
 
1540
1634
  // src/components/EmailModal/StepVerify.tsx
1541
- import { useEffect as useEffect8, useMemo as useMemo6, useRef as useRef4, useState as useState7 } from "react";
1635
+ import { useEffect as useEffect8, useMemo as useMemo5, useRef as useRef3, useState as useState7 } from "react";
1542
1636
 
1543
1637
  // src/config/index.tsx
1544
1638
  var EMAIL_INTERVAL = 60;
@@ -1552,11 +1646,11 @@ function StepVerify(props) {
1552
1646
  const [code, setCode] = useState7("");
1553
1647
  const [sending, setSending] = useState7(false);
1554
1648
  const [submitting, setSubmitting] = useState7(false);
1555
- const sendTimeRef = useRef4(0);
1649
+ const sendTimeRef = useRef3(0);
1556
1650
  const [sendBtnText, setSendBtnText] = useState7("Send");
1557
1651
  const intervalTime = EMAIL_INTERVAL;
1558
1652
  const codeLength = EMAIL_CODE_LENGTH;
1559
- const intervalRef = useRef4(null);
1653
+ const intervalRef = useRef3(null);
1560
1654
  const onSend = async () => {
1561
1655
  if (sendTimeRef.current > 0) {
1562
1656
  return;
@@ -1590,7 +1684,7 @@ function StepVerify(props) {
1590
1684
  }
1591
1685
  };
1592
1686
  }, []);
1593
- const canContinue = useMemo6(() => {
1687
+ const canContinue = useMemo5(() => {
1594
1688
  return code.length === codeLength;
1595
1689
  }, [code]);
1596
1690
  const onContinue = async () => {
@@ -1686,7 +1780,7 @@ function EmailModal({
1686
1780
  }
1687
1781
 
1688
1782
  // src/components/LoginBox/index.tsx
1689
- import { useMemo as useMemo7, useState as useState9 } from "react";
1783
+ import { useMemo as useMemo6, useState as useState9 } from "react";
1690
1784
  import { Fragment as Fragment3, jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
1691
1785
  function LoginBox({
1692
1786
  methods,
@@ -1701,7 +1795,7 @@ function LoginBox({
1701
1795
  "telegram",
1702
1796
  "X"
1703
1797
  ];
1704
- const methodList = useMemo7(() => {
1798
+ const methodList = useMemo6(() => {
1705
1799
  return methods || defaultMethods;
1706
1800
  }, [methods]);
1707
1801
  const LoginItem = ({
@@ -1840,7 +1934,7 @@ function LoginButton({
1840
1934
  }
1841
1935
 
1842
1936
  // src/components/UsernameModal/index.tsx
1843
- import { useEffect as useEffect10, useMemo as useMemo8, useState as useState11 } from "react";
1937
+ import { useEffect as useEffect10, useMemo as useMemo7, useState as useState11 } from "react";
1844
1938
 
1845
1939
  // src/assets/icon/InfoRoundIcon.tsx
1846
1940
  import { jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
@@ -1890,10 +1984,10 @@ function UsernameModal({
1890
1984
  setError("");
1891
1985
  }
1892
1986
  }, [isOpen]);
1893
- const isValid = useMemo8(() => {
1987
+ const isValid = useMemo7(() => {
1894
1988
  return isValidUsername(val);
1895
1989
  }, [val]);
1896
- const isLength = useMemo8(() => {
1990
+ const isLength = useMemo7(() => {
1897
1991
  return val.length >= 2 && val.length <= 32;
1898
1992
  }, [val]);
1899
1993
  const isSafe = isValid && isLength;
@@ -1947,7 +2041,70 @@ function UsernameModal({
1947
2041
  }, onClick: props.onClose, size: "lg", block: true, children: "Next Time" })
1948
2042
  ] }) });
1949
2043
  }
2044
+
2045
+ // src/hooks/api/index.ts
2046
+ var api_exports = {};
2047
+ __export(api_exports, {
2048
+ bind: () => bind_exports,
2049
+ poh: () => poh_exports
2050
+ });
2051
+
2052
+ // src/hooks/api/bind.ts
2053
+ var bind_exports = {};
2054
+ __export(bind_exports, {
2055
+ bindCexApi: () => bindCexApi,
2056
+ unBindApi: () => unBindApi,
2057
+ unBindWalletApi: () => unBindWalletApi,
2058
+ useBindInfo: () => useBindInfo,
2059
+ useBindList: () => useBindList
2060
+ });
2061
+ import { useQuery } from "@tanstack/react-query";
2062
+ function useBindList(options) {
2063
+ const { isLogin } = useUserInfo();
2064
+ return useQuery({
2065
+ queryKey: ["bindList"],
2066
+ enabled: isLogin,
2067
+ queryFn: async () => {
2068
+ let res = await getBindListApi();
2069
+ return res.data;
2070
+ },
2071
+ ...options
2072
+ });
2073
+ }
2074
+ function useBindInfo(options) {
2075
+ const { isLogin } = useUserInfo();
2076
+ return useQuery({
2077
+ queryKey: ["bindInfo"],
2078
+ enabled: isLogin,
2079
+ queryFn: async () => {
2080
+ let res = await getBindInfoApi();
2081
+ return res.data;
2082
+ },
2083
+ ...options
2084
+ });
2085
+ }
2086
+
2087
+ // src/hooks/api/poh.ts
2088
+ var poh_exports = {};
2089
+ __export(poh_exports, {
2090
+ usePohList: () => usePohList,
2091
+ verifyPohApi: () => verifyPohApi
2092
+ });
2093
+ import { useQuery as useQuery2 } from "@tanstack/react-query";
2094
+ function usePohList(options) {
2095
+ const { isLogin } = useUserInfo();
2096
+ return useQuery2({
2097
+ queryKey: ["pohList"],
2098
+ enabled: isLogin,
2099
+ queryFn: async () => {
2100
+ let res = await getPohListApi();
2101
+ return res.data;
2102
+ },
2103
+ ...options
2104
+ });
2105
+ }
1950
2106
  export {
2107
+ api_exports as Api,
1951
2108
  components_exports as Components,
1952
2109
  hooks_exports as Hooks,
1953
2110
  MatchProvider,