@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.js CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.tsx
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
+ Api: () => api_exports,
33
34
  Components: () => components_exports,
34
35
  Hooks: () => hooks_exports,
35
36
  MatchProvider: () => MatchProvider,
@@ -428,7 +429,7 @@ function ModalWithHeader({
428
429
  }
429
430
 
430
431
  // src/components/PasswordModal/index.tsx
431
- var import_react5 = require("react");
432
+ var import_react4 = require("react");
432
433
 
433
434
  // src/components/Input/index.tsx
434
435
  var import_react = require("react");
@@ -629,6 +630,20 @@ var getToken = () => {
629
630
  }
630
631
  };
631
632
 
633
+ // src/utils/matchlog.ts
634
+ var matchDevExists = () => localStorage.getItem("matchid-sdk-react-debug") !== null;
635
+ var handler = {
636
+ get(target, prop) {
637
+ if (matchDevExists() && typeof target[prop] === "function") {
638
+ return target[prop].bind(console);
639
+ }
640
+ return () => {
641
+ };
642
+ }
643
+ };
644
+ var matchlog = new Proxy(console, handler);
645
+ var matchlog_default = matchlog;
646
+
632
647
  // src/api/request.ts
633
648
  var SUCCESS_CODE = 0;
634
649
  var isSuccess = (res) => {
@@ -650,7 +665,7 @@ var request = async (config) => {
650
665
  instance.defaults.headers.common["Authorization"] = token;
651
666
  }
652
667
  const { data } = await instance.request(config);
653
- console.log("api", data);
668
+ matchlog_default.log("api", data);
654
669
  if (data.code == 401001) {
655
670
  localStore.getState().logout();
656
671
  throw new Error("Your session has expired, please log in again");
@@ -706,6 +721,72 @@ var setUserNameApi = (data) => {
706
721
  data
707
722
  });
708
723
  };
724
+ var getBindListApi = () => {
725
+ return request_default({
726
+ url: `/bind/list`,
727
+ method: "GET"
728
+ });
729
+ };
730
+ var getPohListApi = () => {
731
+ return request_default({
732
+ url: `/poh/list`,
733
+ method: "GET"
734
+ });
735
+ };
736
+ var getBindInfoApi = () => {
737
+ return request_default({
738
+ url: `/bind`,
739
+ method: "GET"
740
+ });
741
+ };
742
+ var bindCexApi = ({ cex, api_key, api_secret }) => {
743
+ return request_default({
744
+ url: `/cex/subscribe`,
745
+ method: "POST",
746
+ data: { cex, api_key, api_secret }
747
+ });
748
+ };
749
+ var unBindApi = ({ type }) => {
750
+ return request_default({
751
+ url: `/unbind`,
752
+ method: "POST",
753
+ data: { type }
754
+ });
755
+ };
756
+ var unBindWalletApi = ({ address }) => {
757
+ return request_default({
758
+ url: `/wallet/unbind`,
759
+ method: "POST",
760
+ data: { address }
761
+ });
762
+ };
763
+ var verifyPohApi = ({
764
+ taskId,
765
+ schemaId,
766
+ publicFields,
767
+ allocatorAddress,
768
+ publicFieldsHash,
769
+ allocatorSignature,
770
+ uHash,
771
+ validatorAddress,
772
+ validatorSignature
773
+ }) => {
774
+ return request_default({
775
+ url: `/poh/zkpass`,
776
+ method: "POST",
777
+ data: {
778
+ taskId,
779
+ schemaId,
780
+ publicFields,
781
+ allocatorAddress,
782
+ publicFieldsHash,
783
+ allocatorSignature,
784
+ uHash,
785
+ validatorAddress,
786
+ validatorSignature
787
+ }
788
+ });
789
+ };
709
790
 
710
791
  // src/hooks/eventManager.ts
711
792
  var EventManager = class {
@@ -787,7 +868,7 @@ function useUserInfo() {
787
868
  };
788
869
  const loginByMethod = (method) => {
789
870
  const link = `${endpoints.back}auth/${method}?appid=${appid}&provider=${method}&redirect=${encodeURIComponent(endpoints.login + "login/" + method)}&authorization=${(/* @__PURE__ */ new Date()).getTime()}`;
790
- console.log("link", link);
871
+ matchlog_default.log("link", link);
791
872
  const authWindow = window.open(
792
873
  link,
793
874
  // Replace with the actual authorization URL
@@ -903,24 +984,21 @@ function useUserInfo() {
903
984
  var import_react3 = require("react");
904
985
  function useMatchEvents(handlers) {
905
986
  (0, import_react3.useEffect)(() => {
906
- Object.entries(handlers).forEach(([event, handler]) => {
907
- if (handler) {
908
- eventManager_default.on(event, handler);
987
+ Object.entries(handlers).forEach(([event, handler2]) => {
988
+ if (handler2) {
989
+ eventManager_default.on(event, handler2);
909
990
  }
910
991
  });
911
992
  return () => {
912
- Object.entries(handlers).forEach(([event, handler]) => {
913
- if (handler) {
914
- eventManager_default.off(event, handler);
993
+ Object.entries(handlers).forEach(([event, handler2]) => {
994
+ if (handler2) {
995
+ eventManager_default.off(event, handler2);
915
996
  }
916
997
  });
917
998
  };
918
999
  }, [handlers]);
919
1000
  }
920
1001
 
921
- // src/hooks/useWallet.tsx
922
- var import_react4 = require("react");
923
-
924
1002
  // src/store/useStore.ts
925
1003
  var import_zustand2 = require("zustand");
926
1004
  var useStore = (0, import_zustand2.create)((set) => ({
@@ -974,7 +1052,7 @@ function useWallet() {
974
1052
  const signMessage = async (message, type) => {
975
1053
  return new Promise(async (resolve, reject) => {
976
1054
  const res = await isRecovered();
977
- console.log("isRecovered", res);
1055
+ matchlog_default.log("isRecovered", res);
978
1056
  const getSign = async () => {
979
1057
  try {
980
1058
  const recoverRes = await window.waitMatchUntilWalletMessage("signMessage", {
@@ -992,7 +1070,7 @@ function useWallet() {
992
1070
  setRecoveryModal({
993
1071
  open: true,
994
1072
  success: async () => {
995
- console.log("recover Success");
1073
+ matchlog_default.log("recover Success");
996
1074
  await getSign();
997
1075
  },
998
1076
  close: async () => {
@@ -1005,14 +1083,15 @@ function useWallet() {
1005
1083
  did: overview?.did?.split(":")[2] || ""
1006
1084
  });
1007
1085
  } else {
1008
- getSign();
1086
+ await recoveryWallet("ethereum", "user_passcode_recovery_key");
1087
+ await getSign();
1009
1088
  }
1010
1089
  });
1011
1090
  };
1012
1091
  const signTransaction = async (transaction, type) => {
1013
1092
  return new Promise(async (resolve, reject) => {
1014
1093
  const res = await isRecovered();
1015
- console.log("isRecovered", res);
1094
+ matchlog_default.log("isRecovered", res);
1016
1095
  const getSign = async () => {
1017
1096
  try {
1018
1097
  const recoverRes = await window.waitMatchUntilWalletMessage("signTransaction", {
@@ -1030,7 +1109,7 @@ function useWallet() {
1030
1109
  setRecoveryModal({
1031
1110
  open: true,
1032
1111
  success: async () => {
1033
- console.log("recover Success");
1112
+ matchlog_default.log("recover Success");
1034
1113
  await getSign();
1035
1114
  },
1036
1115
  close: async () => {
@@ -1043,7 +1122,8 @@ function useWallet() {
1043
1122
  did: overview?.did?.split(":")[2] || ""
1044
1123
  });
1045
1124
  } else {
1046
- getSign();
1125
+ await recoveryWallet("ethereum", "user_passcode_recovery_key");
1126
+ await getSign();
1047
1127
  }
1048
1128
  });
1049
1129
  };
@@ -1063,131 +1143,6 @@ function useWallet() {
1063
1143
  isRecovered
1064
1144
  };
1065
1145
  }
1066
- var useWalletInit = ({
1067
- refreshOverview
1068
- }) => {
1069
- const { env } = useLocalStore_default();
1070
- const getWalletIframe = () => {
1071
- return document.getElementById("match-wallet");
1072
- };
1073
- const [walletInited, setWalletInited] = (0, import_react4.useState)(false);
1074
- const { appid, token, overview } = useLocalStore_default();
1075
- const { initWallet, generateWallet } = useWallet();
1076
- (0, import_react4.useEffect)(() => {
1077
- if (env) {
1078
- if (!window.matchWalletMessageIdMap) {
1079
- window.matchWalletMessageIdMap = {};
1080
- }
1081
- const config = env_default[env];
1082
- const endpoints = config.endpoints;
1083
- const existingIframe = getWalletIframe();
1084
- if (!existingIframe) {
1085
- const iframe = document.createElement("iframe");
1086
- iframe.id = "match-wallet";
1087
- iframe.src = endpoints.login + "wallet";
1088
- iframe.style.display = "none";
1089
- iframe.style.width = "0";
1090
- iframe.style.height = "0";
1091
- iframe.onload = () => {
1092
- setWalletInited(true);
1093
- };
1094
- document.body.insertBefore(iframe, document.body.firstChild);
1095
- window.sendMatchWalletMessage = (method, data) => {
1096
- const messageId = Date.now().toString() + Math.random().toString().slice(6);
1097
- const message = {
1098
- method,
1099
- data,
1100
- messageId,
1101
- source: "matchid"
1102
- };
1103
- if (document.getElementById("match-wallet")) {
1104
- getWalletIframe()?.contentWindow?.postMessage(message, "*");
1105
- return messageId;
1106
- }
1107
- console.error("not found iframe");
1108
- return false;
1109
- };
1110
- window.waitMatchUntilWalletMessage = async (method, data, timeout = 5e3) => {
1111
- return new Promise((resolve, reject) => {
1112
- const messageId = window.sendMatchWalletMessage(method, data);
1113
- if (!messageId) {
1114
- console.error("Can't find wallet message");
1115
- reject(new Error("Can't find wallet message"));
1116
- return;
1117
- }
1118
- window.matchWalletMessageIdMap[messageId] = { resolve, reject };
1119
- window.matchWalletMessageIdMap[messageId].timeout = setTimeout(() => {
1120
- console.error("Get wallet result timeout", {
1121
- messageId,
1122
- method,
1123
- data
1124
- });
1125
- delete window.matchWalletMessageIdMap[messageId];
1126
- reject(new Error("Get wallet result timeout"));
1127
- }, timeout);
1128
- });
1129
- };
1130
- } else {
1131
- if (existingIframe.src !== endpoints.login + "wallet") {
1132
- existingIframe.src = endpoints.login + "wallet";
1133
- }
1134
- setWalletInited(true);
1135
- }
1136
- }
1137
- }, [env]);
1138
- (0, import_react4.useEffect)(() => {
1139
- const messageHandle = async (e) => {
1140
- const res = e.data;
1141
- if (res.source != "match-wallet") {
1142
- return;
1143
- }
1144
- const messageId = res.messageId;
1145
- if (messageId && window.matchWalletMessageIdMap[messageId]) {
1146
- const { resolve, reject, timeout } = window.matchWalletMessageIdMap[messageId];
1147
- delete window.matchWalletMessageIdMap[messageId];
1148
- clearTimeout(timeout);
1149
- if (res.status == "success") {
1150
- resolve(res.data);
1151
- } else {
1152
- console.error("qwe-waller-error", res);
1153
- reject(new Error(res.data.message));
1154
- }
1155
- }
1156
- };
1157
- window.addEventListener("message", messageHandle);
1158
- return () => {
1159
- window.removeEventListener("message", messageHandle);
1160
- };
1161
- }, []);
1162
- (0, import_react4.useEffect)(() => {
1163
- if (token && overview && overview.did && walletInited) {
1164
- const did = overview.did.split(":")[2];
1165
- const newUserInit = async () => {
1166
- await window.waitMatchUntilWalletMessage(
1167
- "initCore",
1168
- {
1169
- AppId: appid,
1170
- AppClientId,
1171
- UserId: did,
1172
- AccessToken: token,
1173
- Address: ""
1174
- }
1175
- );
1176
- };
1177
- if (!overview.address) {
1178
- newUserInit();
1179
- } else {
1180
- initWallet({
1181
- address: overview.address,
1182
- did
1183
- });
1184
- }
1185
- }
1186
- }, [overview, token, walletInited]);
1187
- return {
1188
- walletInited
1189
- };
1190
- };
1191
1146
 
1192
1147
  // src/components/PasswordModal/index.tsx
1193
1148
  var import_jsx_runtime24 = require("react/jsx-runtime");
@@ -1199,27 +1154,27 @@ function PasswordModal({
1199
1154
  }) {
1200
1155
  const { refreshOverview } = useUserInfo();
1201
1156
  const { isLogin, did } = useUserInfo();
1202
- const [password, setPassword] = (0, import_react5.useState)("");
1203
- const [rePassword, setRePassword] = (0, import_react5.useState)("");
1204
- const [error, setError] = (0, import_react5.useState)("");
1157
+ const [password, setPassword] = (0, import_react4.useState)("");
1158
+ const [rePassword, setRePassword] = (0, import_react4.useState)("");
1159
+ const [error, setError] = (0, import_react4.useState)("");
1205
1160
  const { generateWallet } = useWallet();
1206
- const passwordError = (0, import_react5.useMemo)(() => {
1161
+ const passwordError = (0, import_react4.useMemo)(() => {
1207
1162
  if (password.length < 6) return "Password must be at least 6 characters";
1208
1163
  return "";
1209
1164
  }, [password]);
1210
- const rePasswordError = (0, import_react5.useMemo)(() => {
1165
+ const rePasswordError = (0, import_react4.useMemo)(() => {
1211
1166
  if (rePassword != password) {
1212
1167
  return "The password you entered twice do not match";
1213
1168
  }
1214
1169
  return "";
1215
1170
  }, [rePassword, password]);
1216
- (0, import_react5.useEffect)(() => {
1171
+ (0, import_react4.useEffect)(() => {
1217
1172
  if (isOpen) {
1218
1173
  setPassword("");
1219
1174
  setRePassword("");
1220
1175
  }
1221
1176
  }, [isOpen]);
1222
- const [isSubmitting, setIsSubmitting] = (0, import_react5.useState)(false);
1177
+ const [isSubmitting, setIsSubmitting] = (0, import_react4.useState)(false);
1223
1178
  const onContinue = async () => {
1224
1179
  if (isSubmitting) return;
1225
1180
  try {
@@ -1279,7 +1234,7 @@ function PasswordModal({
1279
1234
  }
1280
1235
 
1281
1236
  // src/components/RecoveryModal/index.tsx
1282
- var import_react6 = require("react");
1237
+ var import_react5 = require("react");
1283
1238
  var import_jsx_runtime25 = require("react/jsx-runtime");
1284
1239
  function RecoveryModal({
1285
1240
  title,
@@ -1289,19 +1244,19 @@ function RecoveryModal({
1289
1244
  }) {
1290
1245
  const { refreshOverview } = useUserInfo();
1291
1246
  const { isLogin } = useUserInfo();
1292
- const [password, setPassword] = (0, import_react6.useState)("");
1247
+ const [password, setPassword] = (0, import_react5.useState)("");
1293
1248
  const { recoveryWallet } = useWallet();
1294
- const [error, setError] = (0, import_react6.useState)("");
1295
- const passwordError = (0, import_react6.useMemo)(() => {
1249
+ const [error, setError] = (0, import_react5.useState)("");
1250
+ const passwordError = (0, import_react5.useMemo)(() => {
1296
1251
  if (password.length < 6) return "Password must be at least 6 characters";
1297
1252
  return "";
1298
1253
  }, [password]);
1299
- (0, import_react6.useEffect)(() => {
1254
+ (0, import_react5.useEffect)(() => {
1300
1255
  if (isOpen) {
1301
1256
  setPassword("");
1302
1257
  }
1303
1258
  }, [isOpen]);
1304
- const [isSubmitting, setIsSubmitting] = (0, import_react6.useState)(false);
1259
+ const [isSubmitting, setIsSubmitting] = (0, import_react5.useState)(false);
1305
1260
  const onContinue = async () => {
1306
1261
  if (isSubmitting) return;
1307
1262
  try {
@@ -1375,6 +1330,144 @@ var Providers = ({ children }) => {
1375
1330
  };
1376
1331
  var context_default = Providers;
1377
1332
 
1333
+ // src/hooks/useWalletInit.ts
1334
+ var import_react6 = require("react");
1335
+ var AppClientId2 = "react-sdk-" + getVersion();
1336
+ function useWalletInit({
1337
+ refreshOverview
1338
+ }) {
1339
+ const { env } = useLocalStore_default();
1340
+ const getWalletIframe = () => {
1341
+ return document.getElementById("match-wallet");
1342
+ };
1343
+ const [walletInited, setWalletInited] = (0, import_react6.useState)(false);
1344
+ const { appid, token, overview } = useLocalStore_default();
1345
+ const { initWallet, generateWallet } = useWallet();
1346
+ (0, import_react6.useEffect)(() => {
1347
+ if (env) {
1348
+ if (!window.matchWalletMessageIdMap) {
1349
+ window.matchWalletMessageIdMap = {};
1350
+ }
1351
+ const config = env_default[env];
1352
+ const endpoints = config.endpoints;
1353
+ const existingIframe = getWalletIframe();
1354
+ if (!existingIframe) {
1355
+ const iframe = document.createElement("iframe");
1356
+ iframe.id = "match-wallet";
1357
+ iframe.src = endpoints.login + "wallet";
1358
+ iframe.style.display = "none";
1359
+ iframe.style.width = "0";
1360
+ iframe.style.height = "0";
1361
+ document.body.insertBefore(iframe, document.body.firstChild);
1362
+ window.sendMatchWalletMessage = (method, data) => {
1363
+ const messageId = Date.now().toString() + Math.random().toString().slice(6);
1364
+ const message = {
1365
+ method,
1366
+ data,
1367
+ messageId,
1368
+ source: "matchid"
1369
+ };
1370
+ if (document.getElementById("match-wallet")) {
1371
+ matchlog_default.log("matchid.sdk.sendMatchWalletMessage", message, endpoints.login);
1372
+ getWalletIframe()?.contentWindow?.postMessage(message, endpoints.login);
1373
+ return messageId;
1374
+ }
1375
+ console.error("not found iframe");
1376
+ return false;
1377
+ };
1378
+ window.waitMatchUntilWalletMessage = async (method, data, timeout = 1e4) => {
1379
+ return new Promise((resolve, reject) => {
1380
+ const messageId = window.sendMatchWalletMessage(method, data);
1381
+ if (!messageId) {
1382
+ console.error("Can't find wallet message");
1383
+ reject(new Error("Can't find wallet message"));
1384
+ return;
1385
+ }
1386
+ window.matchWalletMessageIdMap[messageId] = { resolve, reject };
1387
+ window.matchWalletMessageIdMap[messageId].timeout = setTimeout(() => {
1388
+ console.error("Get wallet result timeout", {
1389
+ messageId,
1390
+ method,
1391
+ data
1392
+ });
1393
+ delete window.matchWalletMessageIdMap[messageId];
1394
+ reject(new Error("Get wallet result timeout"));
1395
+ }, timeout);
1396
+ });
1397
+ };
1398
+ } else {
1399
+ if (existingIframe.src !== endpoints.login + "wallet") {
1400
+ setWalletInited(false);
1401
+ existingIframe.src = endpoints.login + "wallet";
1402
+ } else {
1403
+ setWalletInited(true);
1404
+ }
1405
+ }
1406
+ }
1407
+ }, [env]);
1408
+ (0, import_react6.useEffect)(() => {
1409
+ const messageHandle = async (e) => {
1410
+ if (e.origin !== env_default[env].endpoints.login.substring(0, env_default[env].endpoints.login.length - 1)) {
1411
+ return;
1412
+ }
1413
+ const res = e.data;
1414
+ if (res.source != "match-wallet") {
1415
+ return;
1416
+ }
1417
+ matchlog_default.log("sdk.wallet.receive", e);
1418
+ const messageId = res.messageId;
1419
+ if (messageId == "init") {
1420
+ matchlog_default.log("wallet init");
1421
+ setWalletInited(true);
1422
+ return;
1423
+ }
1424
+ if (messageId && window.matchWalletMessageIdMap[messageId]) {
1425
+ const { resolve, reject, timeout } = window.matchWalletMessageIdMap[messageId];
1426
+ delete window.matchWalletMessageIdMap[messageId];
1427
+ clearTimeout(timeout);
1428
+ if (res.status == "success") {
1429
+ resolve(res.data);
1430
+ } else {
1431
+ console.error("qwe-waller-error", res);
1432
+ reject(new Error(res.data.message));
1433
+ }
1434
+ }
1435
+ };
1436
+ window.addEventListener("message", messageHandle);
1437
+ return () => {
1438
+ window.removeEventListener("message", messageHandle);
1439
+ };
1440
+ }, []);
1441
+ (0, import_react6.useEffect)(() => {
1442
+ if (token && overview && overview.did && walletInited) {
1443
+ const did = overview.did.split(":")[2];
1444
+ const newUserInit = async () => {
1445
+ await window.waitMatchUntilWalletMessage(
1446
+ "initCore",
1447
+ {
1448
+ AppId: appid,
1449
+ AppClientId: AppClientId2,
1450
+ UserId: did,
1451
+ AccessToken: token,
1452
+ Address: ""
1453
+ }
1454
+ );
1455
+ };
1456
+ if (!overview.address) {
1457
+ newUserInit();
1458
+ } else {
1459
+ initWallet({
1460
+ address: overview.address,
1461
+ did
1462
+ });
1463
+ }
1464
+ }
1465
+ }, [overview, token, walletInited]);
1466
+ return {
1467
+ walletInited
1468
+ };
1469
+ }
1470
+
1378
1471
  // src/hooks/useInit.tsx
1379
1472
  var import_react7 = require("react");
1380
1473
  function useInit({
@@ -1438,7 +1531,7 @@ function useInit({
1438
1531
  };
1439
1532
  }, []);
1440
1533
  const loadOverview = async () => {
1441
- console.log("loadOverview");
1534
+ matchlog_default.log("loadOverview");
1442
1535
  if (overviewLoadingRef.current) {
1443
1536
  return;
1444
1537
  }
@@ -1484,7 +1577,9 @@ function useInit({
1484
1577
  }
1485
1578
 
1486
1579
  // src/MatchContext.tsx
1580
+ var import_react_query = require("@tanstack/react-query");
1487
1581
  var import_jsx_runtime28 = require("react/jsx-runtime");
1582
+ var queryClient = new import_react_query.QueryClient();
1488
1583
  var MatchContext = (0, import_react8.createContext)(void 0);
1489
1584
  var MatchProvider = ({ children, appid, env = "main", events, theme = "light" }) => {
1490
1585
  const { loadOverview, login, config, endpoints } = useInit({
@@ -1496,7 +1591,7 @@ var MatchProvider = ({ children, appid, env = "main", events, theme = "light" })
1496
1591
  useWalletInit({
1497
1592
  refreshOverview: loadOverview
1498
1593
  });
1499
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1594
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1500
1595
  MatchContext.Provider,
1501
1596
  {
1502
1597
  value: {
@@ -1509,7 +1604,7 @@ var MatchProvider = ({ children, appid, env = "main", events, theme = "light" })
1509
1604
  },
1510
1605
  children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(context_default, { children })
1511
1606
  }
1512
- );
1607
+ ) });
1513
1608
  };
1514
1609
  var useMatch = () => {
1515
1610
  const context = (0, import_react8.useContext)(MatchContext);
@@ -1980,8 +2075,71 @@ function UsernameModal({
1980
2075
  }, onClick: props.onClose, size: "lg", block: true, children: "Next Time" })
1981
2076
  ] }) });
1982
2077
  }
2078
+
2079
+ // src/hooks/api/index.ts
2080
+ var api_exports = {};
2081
+ __export(api_exports, {
2082
+ bind: () => bind_exports,
2083
+ poh: () => poh_exports
2084
+ });
2085
+
2086
+ // src/hooks/api/bind.ts
2087
+ var bind_exports = {};
2088
+ __export(bind_exports, {
2089
+ bindCexApi: () => bindCexApi,
2090
+ unBindApi: () => unBindApi,
2091
+ unBindWalletApi: () => unBindWalletApi,
2092
+ useBindInfo: () => useBindInfo,
2093
+ useBindList: () => useBindList
2094
+ });
2095
+ var import_react_query2 = require("@tanstack/react-query");
2096
+ function useBindList(options) {
2097
+ const { isLogin } = useUserInfo();
2098
+ return (0, import_react_query2.useQuery)({
2099
+ queryKey: ["bindList"],
2100
+ enabled: isLogin,
2101
+ queryFn: async () => {
2102
+ let res = await getBindListApi();
2103
+ return res.data;
2104
+ },
2105
+ ...options
2106
+ });
2107
+ }
2108
+ function useBindInfo(options) {
2109
+ const { isLogin } = useUserInfo();
2110
+ return (0, import_react_query2.useQuery)({
2111
+ queryKey: ["bindInfo"],
2112
+ enabled: isLogin,
2113
+ queryFn: async () => {
2114
+ let res = await getBindInfoApi();
2115
+ return res.data;
2116
+ },
2117
+ ...options
2118
+ });
2119
+ }
2120
+
2121
+ // src/hooks/api/poh.ts
2122
+ var poh_exports = {};
2123
+ __export(poh_exports, {
2124
+ usePohList: () => usePohList,
2125
+ verifyPohApi: () => verifyPohApi
2126
+ });
2127
+ var import_react_query3 = require("@tanstack/react-query");
2128
+ function usePohList(options) {
2129
+ const { isLogin } = useUserInfo();
2130
+ return (0, import_react_query3.useQuery)({
2131
+ queryKey: ["pohList"],
2132
+ enabled: isLogin,
2133
+ queryFn: async () => {
2134
+ let res = await getPohListApi();
2135
+ return res.data;
2136
+ },
2137
+ ...options
2138
+ });
2139
+ }
1983
2140
  // Annotate the CommonJS export names for ESM import in node:
1984
2141
  0 && (module.exports = {
2142
+ Api,
1985
2143
  Components,
1986
2144
  Hooks,
1987
2145
  MatchProvider,