@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/hooks/index.js
CHANGED
|
@@ -349,10 +349,10 @@ var localStore = useLocalStore;
|
|
|
349
349
|
var useLocalStore_default = useLocalStore;
|
|
350
350
|
|
|
351
351
|
// src/hooks/useUserInfo.tsx
|
|
352
|
-
var
|
|
352
|
+
var import_react33 = require("react");
|
|
353
353
|
|
|
354
354
|
// src/MatchContext.tsx
|
|
355
|
-
var
|
|
355
|
+
var import_react32 = require("react");
|
|
356
356
|
|
|
357
357
|
// src/store/useModalStore.ts
|
|
358
358
|
var import_zustand2 = require("zustand");
|
|
@@ -660,6 +660,12 @@ var useBTCModalStore = (0, import_zustand2.create)((set) => ({
|
|
|
660
660
|
open: (type) => set({ isOpen: true, type }),
|
|
661
661
|
close: () => set({ isOpen: false })
|
|
662
662
|
}));
|
|
663
|
+
var useEVMModalStore = (0, import_zustand2.create)((set) => ({
|
|
664
|
+
isOpen: false,
|
|
665
|
+
type: "",
|
|
666
|
+
open: (type) => set({ isOpen: true, type }),
|
|
667
|
+
close: () => set({ isOpen: false })
|
|
668
|
+
}));
|
|
663
669
|
var useCEXBindModalStore = (0, import_zustand2.create)((set) => ({
|
|
664
670
|
type: "",
|
|
665
671
|
isOpen: false,
|
|
@@ -987,97 +993,8 @@ var import_react11 = require("react");
|
|
|
987
993
|
var import_react_intl8 = require("react-intl");
|
|
988
994
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
989
995
|
|
|
990
|
-
// src/components/TRONModal/index.tsx
|
|
991
|
-
var import_react14 = __toESM(require("react"));
|
|
992
|
-
|
|
993
|
-
// src/hooks/eventManager.ts
|
|
994
|
-
var EventManager = class {
|
|
995
|
-
constructor() {
|
|
996
|
-
this.listeners = {};
|
|
997
|
-
}
|
|
998
|
-
on(event, callback) {
|
|
999
|
-
if (!this.listeners[event]) {
|
|
1000
|
-
this.listeners[event] = /* @__PURE__ */ new Set();
|
|
1001
|
-
}
|
|
1002
|
-
this.listeners[event].add(callback);
|
|
1003
|
-
}
|
|
1004
|
-
off(event, callback) {
|
|
1005
|
-
if (this.listeners[event]) {
|
|
1006
|
-
this.listeners[event].delete(callback);
|
|
1007
|
-
if (this.listeners[event].size === 0) {
|
|
1008
|
-
delete this.listeners[event];
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
emit(event, ...args) {
|
|
1013
|
-
if (this.listeners[event]) {
|
|
1014
|
-
this.listeners[event].forEach((callback) => callback(...args));
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
};
|
|
1018
|
-
var eventManager = new EventManager();
|
|
1019
|
-
var eventManager_default = eventManager;
|
|
1020
|
-
|
|
1021
|
-
// src/components/TRONModal/index.tsx
|
|
1022
|
-
var import_react_intl9 = require("react-intl");
|
|
1023
|
-
|
|
1024
|
-
// src/components/WalletModalContent/index.tsx
|
|
1025
|
-
var import_react12 = require("react");
|
|
1026
|
-
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
1027
|
-
|
|
1028
|
-
// src/hooks/useTRONWallet.ts
|
|
1029
|
-
var import_react13 = require("react");
|
|
1030
|
-
|
|
1031
|
-
// src/components/TRONModal/index.tsx
|
|
1032
|
-
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
1033
|
-
|
|
1034
|
-
// src/components/TONModal/index.tsx
|
|
1035
|
-
var import_react15 = __toESM(require("react"));
|
|
1036
|
-
var import_react_intl10 = require("react-intl");
|
|
1037
|
-
var import_ui_react = require("@tonconnect/ui-react");
|
|
1038
|
-
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
1039
|
-
|
|
1040
|
-
// src/components/BTCModal/index.tsx
|
|
1041
|
-
var import_react17 = __toESM(require("react"));
|
|
1042
|
-
var import_react_intl11 = require("react-intl");
|
|
1043
|
-
|
|
1044
|
-
// src/lib/btc/XverseAdapter.ts
|
|
1045
|
-
var import_sats_connect = require("sats-connect");
|
|
1046
|
-
|
|
1047
|
-
// src/hooks/useBTCWallet.ts
|
|
1048
|
-
var import_react16 = require("react");
|
|
1049
|
-
|
|
1050
|
-
// src/components/BTCModal/index.tsx
|
|
1051
|
-
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
1052
|
-
|
|
1053
|
-
// src/components/WalletModal/index.tsx
|
|
1054
|
-
var import_react18 = require("react");
|
|
1055
|
-
var import_react_intl12 = require("react-intl");
|
|
1056
|
-
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
1057
|
-
|
|
1058
|
-
// src/components/AlphaAvatar/index.tsx
|
|
1059
|
-
var import_react19 = require("react");
|
|
1060
|
-
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
1061
|
-
function AlphaAvatar({ name, size = 40, className = "" }) {
|
|
1062
|
-
const [avatar, setAvatar] = (0, import_react19.useState)(void 0);
|
|
1063
|
-
(0, import_react19.useEffect)(() => {
|
|
1064
|
-
if (name) {
|
|
1065
|
-
const char = name[0].toUpperCase();
|
|
1066
|
-
setAvatar(char);
|
|
1067
|
-
}
|
|
1068
|
-
}, [name]);
|
|
1069
|
-
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
1070
|
-
width: size,
|
|
1071
|
-
height: size,
|
|
1072
|
-
fontSize: Math.ceil(size / 2)
|
|
1073
|
-
}, children: avatar });
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
// src/components/WalletAsset/index.tsx
|
|
1077
|
-
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
1078
|
-
|
|
1079
996
|
// src/ui/Drawer/index.tsx
|
|
1080
|
-
var
|
|
997
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
1081
998
|
function Drawer({
|
|
1082
999
|
children,
|
|
1083
1000
|
showClose = true,
|
|
@@ -1088,25 +1005,25 @@ function Drawer({
|
|
|
1088
1005
|
onBack
|
|
1089
1006
|
}) {
|
|
1090
1007
|
if (!isOpen) {
|
|
1091
|
-
return /* @__PURE__ */ (0,
|
|
1008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_jsx_runtime68.Fragment, {});
|
|
1092
1009
|
}
|
|
1093
|
-
return /* @__PURE__ */ (0,
|
|
1094
|
-
/* @__PURE__ */ (0,
|
|
1095
|
-
/* @__PURE__ */ (0,
|
|
1096
|
-
onBack && /* @__PURE__ */ (0,
|
|
1010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Overlay, { isOpen, zIndex, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "matchid-drawer", children: [
|
|
1011
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: `matchid-drawer-header matchid-flex`, children: [
|
|
1012
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: `matchid-drawer-header-content matchid-flex`, children: [
|
|
1013
|
+
onBack && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ArrowLeftIcon, { height: 25, width: 24, className: "matchid-drawer-header-back", onClick: onBack }),
|
|
1097
1014
|
title
|
|
1098
1015
|
] }),
|
|
1099
|
-
showClose && /* @__PURE__ */ (0,
|
|
1016
|
+
showClose && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(CloseRoundIcon, { className: "matchid-drawer-header-close", onClick: onClose })
|
|
1100
1017
|
] }),
|
|
1101
1018
|
children
|
|
1102
1019
|
] }) });
|
|
1103
1020
|
}
|
|
1104
1021
|
|
|
1105
1022
|
// src/ui/HashPanel/index.tsx
|
|
1106
|
-
var
|
|
1023
|
+
var import_react12 = require("react");
|
|
1107
1024
|
|
|
1108
1025
|
// src/ui/ModalDrawer/index.tsx
|
|
1109
|
-
var
|
|
1026
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
1110
1027
|
function ModalDrawer({
|
|
1111
1028
|
title,
|
|
1112
1029
|
drawerTitleVisible = true,
|
|
@@ -1114,9 +1031,9 @@ function ModalDrawer({
|
|
|
1114
1031
|
}) {
|
|
1115
1032
|
const isDownMd = useDownMd();
|
|
1116
1033
|
if (isDownMd) {
|
|
1117
|
-
return /* @__PURE__ */ (0,
|
|
1034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ModalWithHeader, { ...props, title });
|
|
1118
1035
|
}
|
|
1119
|
-
return /* @__PURE__ */ (0,
|
|
1036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Drawer, { ...props, title: drawerTitleVisible ? title : null });
|
|
1120
1037
|
}
|
|
1121
1038
|
|
|
1122
1039
|
// src/assets/img/confirm.gif
|
|
@@ -1172,7 +1089,7 @@ function useHash({
|
|
|
1172
1089
|
}
|
|
1173
1090
|
|
|
1174
1091
|
// src/ui/HashPanel/index.tsx
|
|
1175
|
-
var
|
|
1092
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
1176
1093
|
function HashPanel({
|
|
1177
1094
|
hash,
|
|
1178
1095
|
chain,
|
|
@@ -1180,7 +1097,7 @@ function HashPanel({
|
|
|
1180
1097
|
onClose,
|
|
1181
1098
|
zIndex
|
|
1182
1099
|
}) {
|
|
1183
|
-
const [status, setStatus] = (0,
|
|
1100
|
+
const [status, setStatus] = (0, import_react12.useState)("confirm");
|
|
1184
1101
|
const statusMaps = {
|
|
1185
1102
|
"confirm": {
|
|
1186
1103
|
icon: confirm_default,
|
|
@@ -1204,8 +1121,8 @@ function HashPanel({
|
|
|
1204
1121
|
}
|
|
1205
1122
|
};
|
|
1206
1123
|
const statusValue = statusMaps[status];
|
|
1207
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
1208
|
-
(0,
|
|
1124
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react12.useState)(true);
|
|
1125
|
+
(0, import_react12.useEffect)(() => {
|
|
1209
1126
|
if (hash) {
|
|
1210
1127
|
setShouldRefetch(true);
|
|
1211
1128
|
setStatus("pending");
|
|
@@ -1218,7 +1135,7 @@ function HashPanel({
|
|
|
1218
1135
|
chain,
|
|
1219
1136
|
refetchInterval: shouldRefetch ? 3e3 : false
|
|
1220
1137
|
});
|
|
1221
|
-
(0,
|
|
1138
|
+
(0, import_react12.useEffect)(() => {
|
|
1222
1139
|
if (hashQuery.data == 1 || hashQuery.data == -1) {
|
|
1223
1140
|
setShouldRefetch(false);
|
|
1224
1141
|
}
|
|
@@ -1231,14 +1148,14 @@ function HashPanel({
|
|
|
1231
1148
|
}
|
|
1232
1149
|
}, [hashQuery.data]);
|
|
1233
1150
|
const link = chain ? `${chain?.blockExplorers?.default.url}/tx/${hash}` : "";
|
|
1234
|
-
return /* @__PURE__ */ (0,
|
|
1151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
1235
1152
|
ModalDrawer,
|
|
1236
1153
|
{
|
|
1237
1154
|
isOpen,
|
|
1238
1155
|
showClose: true,
|
|
1239
1156
|
onClose,
|
|
1240
1157
|
zIndex,
|
|
1241
|
-
title: /* @__PURE__ */ (0,
|
|
1158
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
1242
1159
|
"div",
|
|
1243
1160
|
{
|
|
1244
1161
|
className: "matchid-hashpanel-header",
|
|
@@ -1248,39 +1165,39 @@ function HashPanel({
|
|
|
1248
1165
|
children: statusValue.text
|
|
1249
1166
|
}
|
|
1250
1167
|
),
|
|
1251
|
-
children: /* @__PURE__ */ (0,
|
|
1252
|
-
/* @__PURE__ */ (0,
|
|
1253
|
-
/* @__PURE__ */ (0,
|
|
1168
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "matchid-hashpanel-box", children: [
|
|
1169
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "matchid-hashpanel-content", children: [
|
|
1170
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: `matchid-hashpanel-status`, style: {
|
|
1254
1171
|
color: statusValue.color
|
|
1255
1172
|
}, children: statusValue.text }),
|
|
1256
|
-
/* @__PURE__ */ (0,
|
|
1257
|
-
hash && /* @__PURE__ */ (0,
|
|
1173
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("img", { src: statusValue.icon, alt: statusValue.text, className: `matchid-hashpanel-img` }),
|
|
1174
|
+
hash && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "matchid-hashpanel-hash", children: [
|
|
1258
1175
|
"Hash:",
|
|
1259
|
-
/* @__PURE__ */ (0,
|
|
1176
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("a", { href: link, target: "_blank", children: hash })
|
|
1260
1177
|
] })
|
|
1261
1178
|
] }),
|
|
1262
|
-
/* @__PURE__ */ (0,
|
|
1179
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Button, { onClick: onClose, size: "lg", block: true, children: "Back" })
|
|
1263
1180
|
] })
|
|
1264
1181
|
}
|
|
1265
1182
|
);
|
|
1266
1183
|
}
|
|
1267
1184
|
function HashPanel_default(props) {
|
|
1268
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
1185
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(HashPanel, { ...props });
|
|
1269
1186
|
}
|
|
1270
1187
|
|
|
1271
1188
|
// src/ui/Switch/index.tsx
|
|
1272
|
-
var
|
|
1189
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
1273
1190
|
|
|
1274
1191
|
// src/ui/AlphaAvatar/index.tsx
|
|
1275
|
-
var
|
|
1276
|
-
var
|
|
1277
|
-
function
|
|
1192
|
+
var import_react13 = require("react");
|
|
1193
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
1194
|
+
function AlphaAvatar({
|
|
1278
1195
|
name,
|
|
1279
1196
|
size = "default",
|
|
1280
1197
|
className = "",
|
|
1281
1198
|
style
|
|
1282
1199
|
}) {
|
|
1283
|
-
const avatar = (0,
|
|
1200
|
+
const avatar = (0, import_react13.useMemo)(() => {
|
|
1284
1201
|
if (name) {
|
|
1285
1202
|
const char = name[0].toUpperCase();
|
|
1286
1203
|
if (char.match(/[a-zA-Z0-9]/)) {
|
|
@@ -1290,7 +1207,7 @@ function AlphaAvatar2({
|
|
|
1290
1207
|
return "";
|
|
1291
1208
|
}, [name]);
|
|
1292
1209
|
const numberSize = typeof size === "number" ? size : size === "sm" ? 24 : size === "default" ? 40 : 64;
|
|
1293
|
-
return /* @__PURE__ */ (0,
|
|
1210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
1294
1211
|
width: numberSize,
|
|
1295
1212
|
height: numberSize,
|
|
1296
1213
|
fontSize: Math.ceil(numberSize / 2),
|
|
@@ -1299,7 +1216,7 @@ function AlphaAvatar2({
|
|
|
1299
1216
|
}
|
|
1300
1217
|
|
|
1301
1218
|
// src/ui/Radio/index.tsx
|
|
1302
|
-
var
|
|
1219
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
1303
1220
|
function Radio({
|
|
1304
1221
|
checked = false,
|
|
1305
1222
|
onChange,
|
|
@@ -1308,23 +1225,214 @@ function Radio({
|
|
|
1308
1225
|
className = "",
|
|
1309
1226
|
style = {}
|
|
1310
1227
|
}) {
|
|
1311
|
-
return /* @__PURE__ */ (0,
|
|
1228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { onClick: onChange, className: `matchid-radio ${className} ${checked ? "matchid-radio-checked" : ""}`, style: {
|
|
1312
1229
|
width: size,
|
|
1313
1230
|
height: size,
|
|
1314
1231
|
...style,
|
|
1315
1232
|
// @ts-ignore
|
|
1316
1233
|
"--matchid-radio-checked": color
|
|
1317
|
-
}, children: checked && /* @__PURE__ */ (0,
|
|
1234
|
+
}, children: checked && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: `matchid-radio-content`, style: {
|
|
1318
1235
|
width: Math.floor(size * 0.7),
|
|
1319
1236
|
height: Math.floor(size * 0.7)
|
|
1320
1237
|
} }) });
|
|
1321
1238
|
}
|
|
1322
1239
|
|
|
1323
|
-
// src/components/
|
|
1324
|
-
var
|
|
1240
|
+
// src/components/EVMModal/index.tsx
|
|
1241
|
+
var import_react16 = require("react");
|
|
1242
|
+
|
|
1243
|
+
// src/hooks/eventManager.ts
|
|
1244
|
+
var EventManager = class {
|
|
1245
|
+
constructor() {
|
|
1246
|
+
this.listeners = {};
|
|
1247
|
+
}
|
|
1248
|
+
on(event, callback) {
|
|
1249
|
+
if (!this.listeners[event]) {
|
|
1250
|
+
this.listeners[event] = /* @__PURE__ */ new Set();
|
|
1251
|
+
}
|
|
1252
|
+
this.listeners[event].add(callback);
|
|
1253
|
+
}
|
|
1254
|
+
off(event, callback) {
|
|
1255
|
+
if (this.listeners[event]) {
|
|
1256
|
+
this.listeners[event].delete(callback);
|
|
1257
|
+
if (this.listeners[event].size === 0) {
|
|
1258
|
+
delete this.listeners[event];
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
emit(event, ...args) {
|
|
1263
|
+
if (this.listeners[event]) {
|
|
1264
|
+
this.listeners[event].forEach((callback) => callback(...args));
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
var eventManager = new EventManager();
|
|
1269
|
+
var eventManager_default = eventManager;
|
|
1270
|
+
|
|
1271
|
+
// src/components/EVMModal/index.tsx
|
|
1272
|
+
var import_react_intl9 = require("react-intl");
|
|
1273
|
+
|
|
1274
|
+
// src/components/WalletModalContent/index.tsx
|
|
1275
|
+
var import_react14 = require("react");
|
|
1276
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
1277
|
+
|
|
1278
|
+
// src/components/EVMModal/index.tsx
|
|
1279
|
+
var import_chains = require("wagmi/chains");
|
|
1280
|
+
var import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
1281
|
+
var import_wagmi2 = require("wagmi");
|
|
1282
|
+
var import_wallets = require("@rainbow-me/rainbowkit/wallets");
|
|
1283
|
+
|
|
1284
|
+
// src/config/chains/MatchMain.ts
|
|
1325
1285
|
var import_viem2 = require("viem");
|
|
1286
|
+
var matchMain = /* @__PURE__ */ (0, import_viem2.defineChain)({
|
|
1287
|
+
//定义match链
|
|
1288
|
+
id: 698,
|
|
1289
|
+
name: "Matchain",
|
|
1290
|
+
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
1291
|
+
rpcUrls: {
|
|
1292
|
+
default: {
|
|
1293
|
+
http: ["https://rpc.matchain.io"]
|
|
1294
|
+
}
|
|
1295
|
+
},
|
|
1296
|
+
blockExplorers: {
|
|
1297
|
+
default: {
|
|
1298
|
+
name: "Matchscan",
|
|
1299
|
+
url: "https://matchscan.io/",
|
|
1300
|
+
apiUrl: "https://matchscan.io/api"
|
|
1301
|
+
}
|
|
1302
|
+
},
|
|
1303
|
+
iconUrl: "https://matchscan.io/static/identicon_logos/blockies.png",
|
|
1304
|
+
contracts: {
|
|
1305
|
+
multicall3: {
|
|
1306
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11"
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
// testnet: true,
|
|
1310
|
+
});
|
|
1311
|
+
|
|
1312
|
+
// src/config/chains/MatchTest.ts
|
|
1313
|
+
var import_viem3 = require("viem");
|
|
1314
|
+
var matchTest = /* @__PURE__ */ (0, import_viem3.defineChain)({
|
|
1315
|
+
//定义matchTest链
|
|
1316
|
+
id: 699,
|
|
1317
|
+
name: "MatchTest",
|
|
1318
|
+
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
1319
|
+
rpcUrls: {
|
|
1320
|
+
default: {
|
|
1321
|
+
http: ["https://testnet-rpc.matchain.io"]
|
|
1322
|
+
}
|
|
1323
|
+
},
|
|
1324
|
+
blockExplorers: {
|
|
1325
|
+
default: {
|
|
1326
|
+
name: "Matchscan",
|
|
1327
|
+
url: "https://testnet.matchscan.io/",
|
|
1328
|
+
apiUrl: "https://testnet.matchscan.io/api"
|
|
1329
|
+
}
|
|
1330
|
+
},
|
|
1331
|
+
iconUrl: "https://testnet.matchscan.io/static/identicon_logos/blockies.png",
|
|
1332
|
+
contracts: {
|
|
1333
|
+
multicall3: {
|
|
1334
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
1335
|
+
blockCreated: 751532
|
|
1336
|
+
},
|
|
1337
|
+
ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
|
|
1338
|
+
ensUniversalResolver: {
|
|
1339
|
+
address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",
|
|
1340
|
+
blockCreated: 5317080
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
// testnet: true,
|
|
1344
|
+
});
|
|
1345
|
+
|
|
1346
|
+
// src/hooks/useWalletBox.ts
|
|
1347
|
+
var import_react15 = require("react");
|
|
1348
|
+
|
|
1349
|
+
// src/hooks/useEthersSigner.ts
|
|
1350
|
+
var React4 = __toESM(require("react"));
|
|
1351
|
+
var import_wagmi = require("wagmi");
|
|
1352
|
+
var import_ethers = require("ethers");
|
|
1353
|
+
|
|
1354
|
+
// src/components/EVMModal/index.tsx
|
|
1355
|
+
var import_siwe = require("siwe");
|
|
1356
|
+
var import_styles = require("@rainbow-me/rainbowkit/styles.css");
|
|
1357
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
1358
|
+
var wagmiConfig = (0, import_rainbowkit.getDefaultConfig)({
|
|
1359
|
+
appName: "MatchID",
|
|
1360
|
+
projectId: "9ac6ea7e07860f04616fb311b447dee9",
|
|
1361
|
+
wallets: [
|
|
1362
|
+
{
|
|
1363
|
+
groupName: "Recommended",
|
|
1364
|
+
wallets: [
|
|
1365
|
+
import_wallets.metaMaskWallet,
|
|
1366
|
+
import_wallets.walletConnectWallet,
|
|
1367
|
+
import_wallets.okxWallet,
|
|
1368
|
+
import_wallets.bitgetWallet,
|
|
1369
|
+
import_wallets.injectedWallet
|
|
1370
|
+
]
|
|
1371
|
+
}
|
|
1372
|
+
],
|
|
1373
|
+
chains: [import_chains.mainnet, import_chains.polygon, import_chains.optimism, import_chains.arbitrum, import_chains.base, matchMain, matchTest, import_chains.bsc]
|
|
1374
|
+
});
|
|
1375
|
+
|
|
1376
|
+
// src/components/TRONModal/index.tsx
|
|
1377
|
+
var import_react18 = __toESM(require("react"));
|
|
1378
|
+
var import_react_intl10 = require("react-intl");
|
|
1379
|
+
|
|
1380
|
+
// src/hooks/useTRONWallet.ts
|
|
1381
|
+
var import_react17 = require("react");
|
|
1382
|
+
|
|
1383
|
+
// src/components/TRONModal/index.tsx
|
|
1384
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
1385
|
+
|
|
1386
|
+
// src/components/TONModal/index.tsx
|
|
1387
|
+
var import_react19 = __toESM(require("react"));
|
|
1388
|
+
var import_react_intl11 = require("react-intl");
|
|
1389
|
+
var import_ui_react = require("@tonconnect/ui-react");
|
|
1390
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
1391
|
+
|
|
1392
|
+
// src/components/BTCModal/index.tsx
|
|
1393
|
+
var import_react21 = __toESM(require("react"));
|
|
1394
|
+
var import_react_intl12 = require("react-intl");
|
|
1395
|
+
|
|
1396
|
+
// src/lib/btc/XverseAdapter.ts
|
|
1397
|
+
var import_sats_connect = require("sats-connect");
|
|
1398
|
+
|
|
1399
|
+
// src/hooks/useBTCWallet.ts
|
|
1400
|
+
var import_react20 = require("react");
|
|
1401
|
+
|
|
1402
|
+
// src/components/BTCModal/index.tsx
|
|
1403
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
1404
|
+
|
|
1405
|
+
// src/components/WalletModal/index.tsx
|
|
1406
|
+
var import_react22 = require("react");
|
|
1326
1407
|
var import_react_intl13 = require("react-intl");
|
|
1408
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
1409
|
+
|
|
1410
|
+
// src/components/AlphaAvatar/index.tsx
|
|
1411
|
+
var import_react23 = require("react");
|
|
1412
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
1413
|
+
function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
1414
|
+
const [avatar, setAvatar] = (0, import_react23.useState)(void 0);
|
|
1415
|
+
(0, import_react23.useEffect)(() => {
|
|
1416
|
+
if (name) {
|
|
1417
|
+
const char = name[0].toUpperCase();
|
|
1418
|
+
setAvatar(char);
|
|
1419
|
+
}
|
|
1420
|
+
}, [name]);
|
|
1421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
1422
|
+
width: size,
|
|
1423
|
+
height: size,
|
|
1424
|
+
fontSize: Math.ceil(size / 2)
|
|
1425
|
+
}, children: avatar });
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
// src/components/WalletAsset/index.tsx
|
|
1327
1429
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
1430
|
+
|
|
1431
|
+
// src/components/TokenSend/index.tsx
|
|
1432
|
+
var import_react24 = require("react");
|
|
1433
|
+
var import_viem4 = require("viem");
|
|
1434
|
+
var import_react_intl14 = require("react-intl");
|
|
1435
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
1328
1436
|
function Input2({
|
|
1329
1437
|
onChange,
|
|
1330
1438
|
placeholder,
|
|
@@ -1334,8 +1442,8 @@ function Input2({
|
|
|
1334
1442
|
error,
|
|
1335
1443
|
size = "df"
|
|
1336
1444
|
}) {
|
|
1337
|
-
return /* @__PURE__ */ (0,
|
|
1338
|
-
/* @__PURE__ */ (0,
|
|
1445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-input-box ${"matchid-token-input-" + size}`, children: [
|
|
1446
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
1339
1447
|
"input",
|
|
1340
1448
|
{
|
|
1341
1449
|
placeholder,
|
|
@@ -1346,7 +1454,7 @@ function Input2({
|
|
|
1346
1454
|
className: `matchid-token-input ${error ? "matchid-token-input-error" : ""}`
|
|
1347
1455
|
}
|
|
1348
1456
|
),
|
|
1349
|
-
error && /* @__PURE__ */ (0,
|
|
1457
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "matchid-token-input-error-text", children: error })
|
|
1350
1458
|
] });
|
|
1351
1459
|
}
|
|
1352
1460
|
function TokenSend({
|
|
@@ -1356,36 +1464,36 @@ function TokenSend({
|
|
|
1356
1464
|
onBack
|
|
1357
1465
|
}) {
|
|
1358
1466
|
const { list: chainList } = useMatchChain();
|
|
1359
|
-
const intl = (0,
|
|
1467
|
+
const intl = (0, import_react_intl14.useIntl)();
|
|
1360
1468
|
const { createWalletClient: createWalletClient2 } = useWallet();
|
|
1361
1469
|
const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
|
|
1362
|
-
const chain = (0,
|
|
1470
|
+
const chain = (0, import_react24.useMemo)(() => {
|
|
1363
1471
|
return chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
1364
1472
|
}, [chainList, token.chain_id]);
|
|
1365
|
-
const walletClient = (0,
|
|
1473
|
+
const walletClient = (0, import_react24.useMemo)(() => {
|
|
1366
1474
|
return createWalletClient2({
|
|
1367
1475
|
// @ts-ignore
|
|
1368
|
-
chain: (0,
|
|
1369
|
-
transport: (0,
|
|
1476
|
+
chain: (0, import_viem4.defineChain)(chain),
|
|
1477
|
+
transport: (0, import_viem4.http)()
|
|
1370
1478
|
});
|
|
1371
1479
|
}, [chain]);
|
|
1372
|
-
const [amount, setAmount] = (0,
|
|
1373
|
-
const [address, setAddress] = (0,
|
|
1374
|
-
const [loading, setLoading] = (0,
|
|
1375
|
-
const [sending, setSending] = (0,
|
|
1376
|
-
const [txError, setTxError] = (0,
|
|
1377
|
-
const transaction = (0,
|
|
1480
|
+
const [amount, setAmount] = (0, import_react24.useState)("");
|
|
1481
|
+
const [address, setAddress] = (0, import_react24.useState)("");
|
|
1482
|
+
const [loading, setLoading] = (0, import_react24.useState)(false);
|
|
1483
|
+
const [sending, setSending] = (0, import_react24.useState)(false);
|
|
1484
|
+
const [txError, setTxError] = (0, import_react24.useState)("");
|
|
1485
|
+
const transaction = (0, import_react24.useMemo)(() => {
|
|
1378
1486
|
const reg = /^0x[a-fA-F0-9]{40}$/;
|
|
1379
1487
|
if (!amount || !address || !reg.test(address)) {
|
|
1380
1488
|
return;
|
|
1381
1489
|
}
|
|
1382
|
-
const viemChain = (0,
|
|
1490
|
+
const viemChain = (0, import_viem4.defineChain)(chain);
|
|
1383
1491
|
const to = isNative ? address : token.address;
|
|
1384
|
-
const value = isNative ? (0,
|
|
1385
|
-
const data = isNative ? "0x" : (0,
|
|
1386
|
-
abi:
|
|
1492
|
+
const value = isNative ? (0, import_viem4.parseUnits)(amount, parseInt(token?.decimals || "18")) : BigInt(0);
|
|
1493
|
+
const data = isNative ? "0x" : (0, import_viem4.encodeFunctionData)({
|
|
1494
|
+
abi: import_viem4.erc20Abi,
|
|
1387
1495
|
functionName: "transfer",
|
|
1388
|
-
args: [address, (0,
|
|
1496
|
+
args: [address, (0, import_viem4.parseUnits)(amount, parseInt(token?.decimals || "18"))]
|
|
1389
1497
|
});
|
|
1390
1498
|
return {
|
|
1391
1499
|
to,
|
|
@@ -1405,7 +1513,7 @@ function TokenSend({
|
|
|
1405
1513
|
setLoading(false);
|
|
1406
1514
|
}
|
|
1407
1515
|
};
|
|
1408
|
-
const error = (0,
|
|
1516
|
+
const error = (0, import_react24.useMemo)(() => {
|
|
1409
1517
|
setTxError("");
|
|
1410
1518
|
let amountError = "";
|
|
1411
1519
|
let addressError = "";
|
|
@@ -1448,7 +1556,7 @@ function TokenSend({
|
|
|
1448
1556
|
setAmount(value);
|
|
1449
1557
|
}
|
|
1450
1558
|
};
|
|
1451
|
-
const canSend = (0,
|
|
1559
|
+
const canSend = (0, import_react24.useMemo)(() => {
|
|
1452
1560
|
return !error.amount && !error.address && amount && address;
|
|
1453
1561
|
}, [error]);
|
|
1454
1562
|
const onNext = async () => {
|
|
@@ -1458,7 +1566,7 @@ function TokenSend({
|
|
|
1458
1566
|
}
|
|
1459
1567
|
onClose();
|
|
1460
1568
|
};
|
|
1461
|
-
(0,
|
|
1569
|
+
(0, import_react24.useEffect)(() => {
|
|
1462
1570
|
const receiveMessage = (event) => {
|
|
1463
1571
|
if (event.data) {
|
|
1464
1572
|
if (event.data.source == "match-wallet") {
|
|
@@ -1474,24 +1582,24 @@ function TokenSend({
|
|
|
1474
1582
|
window.removeEventListener("message", receiveMessage);
|
|
1475
1583
|
};
|
|
1476
1584
|
}, []);
|
|
1477
|
-
return /* @__PURE__ */ (0,
|
|
1478
|
-
/* @__PURE__ */ (0,
|
|
1479
|
-
/* @__PURE__ */ (0,
|
|
1480
|
-
/* @__PURE__ */ (0,
|
|
1481
|
-
/* @__PURE__ */ (0,
|
|
1482
|
-
/* @__PURE__ */ (0,
|
|
1483
|
-
token.icon ? /* @__PURE__ */ (0,
|
|
1585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(ModalDrawer, { isOpen: true, onClose, zIndex, title: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react_intl14.FormattedMessage, { id: "send" }), onBack, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-send-box`, children: [
|
|
1586
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
1587
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-amount-content`, children: [
|
|
1588
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-amount-header`, children: [
|
|
1589
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: `matchid-token-amount-title`, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react_intl14.FormattedMessage, { id: "amount" }) }),
|
|
1590
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-amount-chain`, children: [
|
|
1591
|
+
token.icon ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
1484
1592
|
"img",
|
|
1485
1593
|
{
|
|
1486
1594
|
src: token?.icon,
|
|
1487
1595
|
alt: token?.symbol,
|
|
1488
1596
|
className: `matchid-token-amount-chain-icon`
|
|
1489
1597
|
}
|
|
1490
|
-
) : /* @__PURE__ */ (0,
|
|
1491
|
-
/* @__PURE__ */ (0,
|
|
1598
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(AlphaAvatar, { name: token.symbol || token.name || "", size: 16 }),
|
|
1599
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { children: token?.symbol })
|
|
1492
1600
|
] })
|
|
1493
1601
|
] }),
|
|
1494
|
-
/* @__PURE__ */ (0,
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
1495
1603
|
Input2,
|
|
1496
1604
|
{
|
|
1497
1605
|
type: "text",
|
|
@@ -1504,18 +1612,18 @@ function TokenSend({
|
|
|
1504
1612
|
error: error.amount || txError
|
|
1505
1613
|
}
|
|
1506
1614
|
),
|
|
1507
|
-
/* @__PURE__ */ (0,
|
|
1508
|
-
/* @__PURE__ */ (0,
|
|
1509
|
-
/* @__PURE__ */ (0,
|
|
1615
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-amount-footer`, children: [
|
|
1616
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-amount-title`, children: [
|
|
1617
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react_intl14.FormattedMessage, { id: "balance" }),
|
|
1510
1618
|
":"
|
|
1511
1619
|
] }),
|
|
1512
|
-
/* @__PURE__ */ (0,
|
|
1620
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: `matchid-token-amount-value`, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(NumberFormatter, { value: token.balance, tFixNum: 10, suffix: " " + token.symbol }) })
|
|
1513
1621
|
] }),
|
|
1514
|
-
/* @__PURE__ */ (0,
|
|
1622
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(TransferIcon, { className: "matchid-token-amount-transfer" })
|
|
1515
1623
|
] }),
|
|
1516
|
-
/* @__PURE__ */ (0,
|
|
1517
|
-
/* @__PURE__ */ (0,
|
|
1518
|
-
/* @__PURE__ */ (0,
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-address-content`, children: [
|
|
1625
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: `matchid-token-address-header`, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: `matchid-token-address-title`, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react_intl14.FormattedMessage, { id: "receiveTitle" }) }) }),
|
|
1626
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
1519
1627
|
Input2,
|
|
1520
1628
|
{
|
|
1521
1629
|
type: "text",
|
|
@@ -1531,7 +1639,7 @@ function TokenSend({
|
|
|
1531
1639
|
)
|
|
1532
1640
|
] })
|
|
1533
1641
|
] }),
|
|
1534
|
-
/* @__PURE__ */ (0,
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
1535
1643
|
Button,
|
|
1536
1644
|
{
|
|
1537
1645
|
size: "lg",
|
|
@@ -1540,20 +1648,20 @@ function TokenSend({
|
|
|
1540
1648
|
disabled: !canSend || !!txError,
|
|
1541
1649
|
onClick: onNext,
|
|
1542
1650
|
loading: loading || sending,
|
|
1543
|
-
children: /* @__PURE__ */ (0,
|
|
1651
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react_intl14.FormattedMessage, { id: "next" })
|
|
1544
1652
|
}
|
|
1545
1653
|
)
|
|
1546
1654
|
] }) });
|
|
1547
1655
|
}
|
|
1548
1656
|
|
|
1549
1657
|
// src/components/TokenDetail/index.tsx
|
|
1550
|
-
var import_react_intl14 = require("react-intl");
|
|
1551
|
-
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
1552
|
-
|
|
1553
|
-
// src/components/TokenSendList/index.tsx
|
|
1554
|
-
var import_react23 = require("react");
|
|
1555
1658
|
var import_react_intl15 = require("react-intl");
|
|
1556
1659
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
1660
|
+
|
|
1661
|
+
// src/components/TokenSendList/index.tsx
|
|
1662
|
+
var import_react25 = require("react");
|
|
1663
|
+
var import_react_intl16 = require("react-intl");
|
|
1664
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
1557
1665
|
function TokenSendList({ close }) {
|
|
1558
1666
|
const isDownMd = useDownMd();
|
|
1559
1667
|
const walletAssets = useMatchWalletAssets();
|
|
@@ -1561,20 +1669,20 @@ function TokenSendList({ close }) {
|
|
|
1561
1669
|
list: walletAssets.mergedAssets
|
|
1562
1670
|
});
|
|
1563
1671
|
const { list } = useMatchChain();
|
|
1564
|
-
const [checked, setChecked] = (0,
|
|
1672
|
+
const [checked, setChecked] = (0, import_react25.useState)();
|
|
1565
1673
|
const modal = useModal();
|
|
1566
1674
|
const onNext = () => {
|
|
1567
1675
|
checked && modal.show((props) => {
|
|
1568
|
-
return /* @__PURE__ */ (0,
|
|
1676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(TokenSend, { onClose: () => {
|
|
1569
1677
|
props.close();
|
|
1570
1678
|
close();
|
|
1571
1679
|
}, onBack: props.close, zIndex: props.zIndex, token: checked });
|
|
1572
1680
|
});
|
|
1573
1681
|
};
|
|
1574
|
-
return /* @__PURE__ */ (0,
|
|
1575
|
-
/* @__PURE__ */ (0,
|
|
1682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "matchid-token-send-list-box", children: [
|
|
1683
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "matchid-token-send-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
1576
1684
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
1577
|
-
return /* @__PURE__ */ (0,
|
|
1685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
1578
1686
|
"div",
|
|
1579
1687
|
{
|
|
1580
1688
|
className: `matchid-token-send-item ${checked?.address == n.address ? "matchid-token-send-chekced" : ""}`,
|
|
@@ -1582,18 +1690,18 @@ function TokenSendList({ close }) {
|
|
|
1582
1690
|
setChecked(n);
|
|
1583
1691
|
},
|
|
1584
1692
|
children: [
|
|
1585
|
-
/* @__PURE__ */ (0,
|
|
1586
|
-
/* @__PURE__ */ (0,
|
|
1587
|
-
/* @__PURE__ */ (0,
|
|
1588
|
-
n.icon ? /* @__PURE__ */ (0,
|
|
1589
|
-
|
|
1693
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Radio, { checked: checked?.address == n.address, size: isDownMd ? 18 : 24 }),
|
|
1694
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
1695
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "matchid-token-send-logo", children: [
|
|
1696
|
+
n.icon ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("img", { src: n.icon, alt: n.symbol, className: `matchid-token-send-icon` }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
1697
|
+
AlphaAvatar2,
|
|
1590
1698
|
{
|
|
1591
1699
|
className: `matchid-token-send-icon`,
|
|
1592
1700
|
size: isDownMd ? 28 : 40,
|
|
1593
1701
|
name: n.symbol || n.name || ""
|
|
1594
1702
|
}
|
|
1595
1703
|
),
|
|
1596
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
1704
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
1597
1705
|
"img",
|
|
1598
1706
|
{
|
|
1599
1707
|
src: chain.iconUrl,
|
|
@@ -1602,9 +1710,9 @@ function TokenSendList({ close }) {
|
|
|
1602
1710
|
}
|
|
1603
1711
|
)
|
|
1604
1712
|
] }),
|
|
1605
|
-
/* @__PURE__ */ (0,
|
|
1606
|
-
/* @__PURE__ */ (0,
|
|
1607
|
-
/* @__PURE__ */ (0,
|
|
1713
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: `matchid-token-send-info`, children: [
|
|
1714
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: `matchid-token-send-name`, children: n.symbol }),
|
|
1715
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: `matchid-token-send-balance`, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(NumberFormatter, { value: n.balance, tFixNum: 3 }) })
|
|
1608
1716
|
] })
|
|
1609
1717
|
] })
|
|
1610
1718
|
]
|
|
@@ -1612,15 +1720,15 @@ function TokenSendList({ close }) {
|
|
|
1612
1720
|
index
|
|
1613
1721
|
);
|
|
1614
1722
|
}) }),
|
|
1615
|
-
/* @__PURE__ */ (0,
|
|
1723
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Button, { size: "lg", highlight: true, block: true, disabled: !checked, onClick: onNext, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_react_intl16.FormattedMessage, { id: "next" }) })
|
|
1616
1724
|
] });
|
|
1617
1725
|
}
|
|
1618
1726
|
|
|
1619
1727
|
// src/components/TransactionList/index.tsx
|
|
1620
1728
|
var import_react_infinite_scroll_component = __toESM(require("react-infinite-scroll-component"));
|
|
1621
|
-
var
|
|
1622
|
-
var
|
|
1623
|
-
var
|
|
1729
|
+
var import_react26 = require("react");
|
|
1730
|
+
var import_viem5 = require("viem");
|
|
1731
|
+
var import_viem6 = require("viem");
|
|
1624
1732
|
|
|
1625
1733
|
// src/store/useContractStore.ts
|
|
1626
1734
|
var import_zustand3 = require("zustand");
|
|
@@ -1679,14 +1787,14 @@ var useContractStore = (0, import_zustand3.create)((0, import_middleware2.devtoo
|
|
|
1679
1787
|
var useContractStore_default = useContractStore;
|
|
1680
1788
|
|
|
1681
1789
|
// src/components/TransactionList/index.tsx
|
|
1682
|
-
var import_react_intl16 = require("react-intl");
|
|
1683
|
-
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
1684
|
-
|
|
1685
|
-
// src/components/CEXBindModal/index.tsx
|
|
1686
|
-
var import_react25 = require("react");
|
|
1687
1790
|
var import_react_intl17 = require("react-intl");
|
|
1688
1791
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
1689
1792
|
|
|
1793
|
+
// src/components/CEXBindModal/index.tsx
|
|
1794
|
+
var import_react27 = require("react");
|
|
1795
|
+
var import_react_intl18 = require("react-intl");
|
|
1796
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
1797
|
+
|
|
1690
1798
|
// src/context/BusinessProvider.tsx
|
|
1691
1799
|
var import_react_query3 = require("@tanstack/react-query");
|
|
1692
1800
|
|
|
@@ -1703,15 +1811,15 @@ var useStore = (0, import_zustand4.create)((set) => ({
|
|
|
1703
1811
|
var useStore_default = useStore;
|
|
1704
1812
|
|
|
1705
1813
|
// src/context/BusinessProvider.tsx
|
|
1706
|
-
var
|
|
1814
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
1707
1815
|
|
|
1708
1816
|
// src/context/ModalContext.tsx
|
|
1709
|
-
var
|
|
1817
|
+
var import_react28 = require("react");
|
|
1710
1818
|
var import_react_dom = require("react-dom");
|
|
1711
|
-
var
|
|
1712
|
-
var ModalContext = (0,
|
|
1819
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
1820
|
+
var ModalContext = (0, import_react28.createContext)(null);
|
|
1713
1821
|
function useModal() {
|
|
1714
|
-
const context = (0,
|
|
1822
|
+
const context = (0, import_react28.useContext)(ModalContext);
|
|
1715
1823
|
if (!context) {
|
|
1716
1824
|
throw new Error("useModal must be used within a ModalProvider");
|
|
1717
1825
|
}
|
|
@@ -1719,12 +1827,12 @@ function useModal() {
|
|
|
1719
1827
|
}
|
|
1720
1828
|
|
|
1721
1829
|
// src/context/ToastContext.tsx
|
|
1722
|
-
var
|
|
1830
|
+
var import_react29 = require("react");
|
|
1723
1831
|
var import_react_dom2 = require("react-dom");
|
|
1724
|
-
var
|
|
1725
|
-
var ToastContext = (0,
|
|
1832
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
1833
|
+
var ToastContext = (0, import_react29.createContext)(null);
|
|
1726
1834
|
function useToast() {
|
|
1727
|
-
const context = (0,
|
|
1835
|
+
const context = (0, import_react29.useContext)(ToastContext);
|
|
1728
1836
|
if (!context) {
|
|
1729
1837
|
throw new Error("useToast must be used within a ToastProvider");
|
|
1730
1838
|
}
|
|
@@ -1732,23 +1840,23 @@ function useToast() {
|
|
|
1732
1840
|
}
|
|
1733
1841
|
|
|
1734
1842
|
// src/context/index.tsx
|
|
1735
|
-
var
|
|
1843
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
1736
1844
|
|
|
1737
1845
|
// src/hooks/useWalletInit.ts
|
|
1738
|
-
var
|
|
1846
|
+
var import_react30 = require("react");
|
|
1739
1847
|
var AppClientId = getAppClientId();
|
|
1740
1848
|
|
|
1741
1849
|
// src/hooks/useInit.tsx
|
|
1742
|
-
var
|
|
1850
|
+
var import_react31 = require("react");
|
|
1743
1851
|
|
|
1744
1852
|
// src/MatchContext.tsx
|
|
1745
1853
|
var import_react_query4 = require("@tanstack/react-query");
|
|
1746
|
-
var
|
|
1747
|
-
var
|
|
1854
|
+
var import_react_intl19 = require("react-intl");
|
|
1855
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
1748
1856
|
var queryClient = new import_react_query4.QueryClient();
|
|
1749
|
-
var MatchContext = (0,
|
|
1857
|
+
var MatchContext = (0, import_react32.createContext)(void 0);
|
|
1750
1858
|
var useMatch = () => {
|
|
1751
|
-
const context = (0,
|
|
1859
|
+
const context = (0, import_react32.useContext)(MatchContext);
|
|
1752
1860
|
if (context === void 0) {
|
|
1753
1861
|
throw new Error("useMatch must be used within a MatchProvider");
|
|
1754
1862
|
}
|
|
@@ -1773,6 +1881,7 @@ function useUserInfo() {
|
|
|
1773
1881
|
const { setTgAppAuthCode, emailLoginKey, setEmailLoginKey } = useStore_default();
|
|
1774
1882
|
const isDownMd = useDownMd();
|
|
1775
1883
|
const { events, login } = useMatch();
|
|
1884
|
+
const { open: EVMOpen } = useEVMModalStore();
|
|
1776
1885
|
const { open: TRONOpen } = useTRONModalStore();
|
|
1777
1886
|
const { open: TONOpen } = useTONModalStore();
|
|
1778
1887
|
const { open: BTCOpen } = useBTCModalStore();
|
|
@@ -1781,7 +1890,7 @@ function useUserInfo() {
|
|
|
1781
1890
|
const getRedirectUri = () => {
|
|
1782
1891
|
return encodeURIComponent(window.location.href);
|
|
1783
1892
|
};
|
|
1784
|
-
const isLogin = (0,
|
|
1893
|
+
const isLogin = (0, import_react33.useMemo)(() => !!token && !!overview, [token, overview]);
|
|
1785
1894
|
const logout = async () => {
|
|
1786
1895
|
try {
|
|
1787
1896
|
await toLogoutApi();
|
|
@@ -1849,7 +1958,8 @@ function useUserInfo() {
|
|
|
1849
1958
|
case "wallet":
|
|
1850
1959
|
return walletModalStore.open("login", extra?.methods);
|
|
1851
1960
|
case "evm":
|
|
1852
|
-
return
|
|
1961
|
+
return EVMOpen("login");
|
|
1962
|
+
// return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`)
|
|
1853
1963
|
case "sol":
|
|
1854
1964
|
if (isDownMd) {
|
|
1855
1965
|
return window.location.href = `${endpoints.auth}login/sol?appid=${appid}&locale=${locale}&redirect_uri=${getRedirectUri()}`;
|
|
@@ -1941,7 +2051,8 @@ function useUserInfo() {
|
|
|
1941
2051
|
case "wallet":
|
|
1942
2052
|
return walletModalStore.open("bind", extra?.methods);
|
|
1943
2053
|
case "evm":
|
|
1944
|
-
return
|
|
2054
|
+
return EVMOpen("bind");
|
|
2055
|
+
// return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)))
|
|
1945
2056
|
case "sol":
|
|
1946
2057
|
if (isDownMd) {
|
|
1947
2058
|
return window.location.href = `${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}&redirect_uri=${getRedirectUri()}`;
|
|
@@ -2044,9 +2155,9 @@ function useUserInfo() {
|
|
|
2044
2155
|
}
|
|
2045
2156
|
|
|
2046
2157
|
// src/hooks/useMatchEvents.ts
|
|
2047
|
-
var
|
|
2158
|
+
var import_react34 = require("react");
|
|
2048
2159
|
function useMatchEvents(handlers) {
|
|
2049
|
-
(0,
|
|
2160
|
+
(0, import_react34.useEffect)(() => {
|
|
2050
2161
|
Object.entries(handlers).forEach(([event, handler2]) => {
|
|
2051
2162
|
if (handler2) {
|
|
2052
2163
|
eventManager_default.on(event, handler2);
|
|
@@ -2063,11 +2174,11 @@ function useMatchEvents(handlers) {
|
|
|
2063
2174
|
}
|
|
2064
2175
|
|
|
2065
2176
|
// src/hooks/useWallet.tsx
|
|
2066
|
-
var import_viem5 = require("viem");
|
|
2067
|
-
var import_accounts = require("viem/accounts");
|
|
2068
|
-
var import_viem6 = require("viem");
|
|
2069
|
-
var import_react33 = require("react");
|
|
2070
2177
|
var import_viem7 = require("viem");
|
|
2178
|
+
var import_accounts = require("viem/accounts");
|
|
2179
|
+
var import_viem8 = require("viem");
|
|
2180
|
+
var import_react35 = require("react");
|
|
2181
|
+
var import_viem9 = require("viem");
|
|
2071
2182
|
|
|
2072
2183
|
// src/store/useTransactionStore.ts
|
|
2073
2184
|
var import_zustand5 = require("zustand");
|
|
@@ -2100,7 +2211,7 @@ var useTransactionStore = (0, import_zustand5.create)((0, import_middleware3.dev
|
|
|
2100
2211
|
var useTransactionStore_default = useTransactionStore;
|
|
2101
2212
|
|
|
2102
2213
|
// src/hooks/useWallet.tsx
|
|
2103
|
-
var
|
|
2214
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
2104
2215
|
var AppClientId2 = "react-sdk-" + getVersion();
|
|
2105
2216
|
function useWallet() {
|
|
2106
2217
|
const { address, wallet: walletConfig } = useLocalStore_default();
|
|
@@ -2151,7 +2262,7 @@ function useWallet() {
|
|
|
2151
2262
|
throw error;
|
|
2152
2263
|
}
|
|
2153
2264
|
};
|
|
2154
|
-
const evmAccount = (0,
|
|
2265
|
+
const evmAccount = (0, import_react35.useMemo)(() => {
|
|
2155
2266
|
try {
|
|
2156
2267
|
return address ? (0, import_accounts.toAccount)({
|
|
2157
2268
|
address,
|
|
@@ -2190,14 +2301,14 @@ function useWallet() {
|
|
|
2190
2301
|
return void 0;
|
|
2191
2302
|
}
|
|
2192
2303
|
}, [address]);
|
|
2193
|
-
(0,
|
|
2304
|
+
(0, import_react35.useEffect)(() => {
|
|
2194
2305
|
matchlog_default.log("qwe-evmAccount", evmAccount);
|
|
2195
2306
|
}, [evmAccount]);
|
|
2196
2307
|
const realCreateWalletClient = (parameters) => {
|
|
2197
2308
|
if (!evmAccount) {
|
|
2198
2309
|
return;
|
|
2199
2310
|
}
|
|
2200
|
-
const obj = (0,
|
|
2311
|
+
const obj = (0, import_viem8.createWalletClient)({
|
|
2201
2312
|
...parameters,
|
|
2202
2313
|
account: evmAccount
|
|
2203
2314
|
});
|
|
@@ -2273,7 +2384,7 @@ function useWallet() {
|
|
|
2273
2384
|
address: evmAccount.address
|
|
2274
2385
|
});
|
|
2275
2386
|
modal.show((props) => {
|
|
2276
|
-
return /* @__PURE__ */ (0,
|
|
2387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, hash: txHash, chain: _chain });
|
|
2277
2388
|
});
|
|
2278
2389
|
clearInterval(window.matchProvider.transactionMessageIntervalMap[transactionId].interval);
|
|
2279
2390
|
delete window.matchProvider.transactionMessageIntervalMap[transactionId];
|
|
@@ -2287,7 +2398,7 @@ function useWallet() {
|
|
|
2287
2398
|
};
|
|
2288
2399
|
const deployContract = async (parameters2) => {
|
|
2289
2400
|
const { abi, args, bytecode, ...request3 } = parameters2;
|
|
2290
|
-
const calldata = (0,
|
|
2401
|
+
const calldata = (0, import_viem9.encodeDeployData)({ abi, args, bytecode });
|
|
2291
2402
|
return await sendTransaction({
|
|
2292
2403
|
...request3,
|
|
2293
2404
|
data: calldata
|
|
@@ -2295,7 +2406,7 @@ function useWallet() {
|
|
|
2295
2406
|
};
|
|
2296
2407
|
const writeContract = async (parameters2) => {
|
|
2297
2408
|
const { abi, address: address2, args, dataSuffix, functionName, ...request3 } = parameters2;
|
|
2298
|
-
const data = (0,
|
|
2409
|
+
const data = (0, import_viem7.encodeFunctionData)({
|
|
2299
2410
|
abi,
|
|
2300
2411
|
args,
|
|
2301
2412
|
functionName
|
|
@@ -2326,14 +2437,14 @@ function useWallet() {
|
|
|
2326
2437
|
|
|
2327
2438
|
// src/hooks/useCopyClipboard.ts
|
|
2328
2439
|
var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
|
|
2329
|
-
var
|
|
2440
|
+
var import_react36 = require("react");
|
|
2330
2441
|
function useCopyClipboard(timeout = 500) {
|
|
2331
|
-
const [isCopied, setIsCopied] = (0,
|
|
2332
|
-
const staticCopy = (0,
|
|
2442
|
+
const [isCopied, setIsCopied] = (0, import_react36.useState)(false);
|
|
2443
|
+
const staticCopy = (0, import_react36.useCallback)((text) => {
|
|
2333
2444
|
const didCopy = (0, import_copy_to_clipboard.default)(text);
|
|
2334
2445
|
setIsCopied(didCopy);
|
|
2335
2446
|
}, []);
|
|
2336
|
-
(0,
|
|
2447
|
+
(0, import_react36.useEffect)(() => {
|
|
2337
2448
|
if (isCopied) {
|
|
2338
2449
|
const hide = setTimeout(() => {
|
|
2339
2450
|
setIsCopied(false);
|
|
@@ -2403,16 +2514,16 @@ function useImportTokenListQuery({
|
|
|
2403
2514
|
}
|
|
2404
2515
|
|
|
2405
2516
|
// src/hooks/useMatchChain.tsx
|
|
2406
|
-
var
|
|
2407
|
-
var
|
|
2408
|
-
var
|
|
2409
|
-
var
|
|
2517
|
+
var import_react37 = require("react");
|
|
2518
|
+
var import_viem10 = require("viem");
|
|
2519
|
+
var import_react_intl20 = require("react-intl");
|
|
2520
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
2410
2521
|
function useMatchChain() {
|
|
2411
2522
|
const chainListQuery = useChainListQuery();
|
|
2412
2523
|
const modal = useModal();
|
|
2413
|
-
const intl = (0,
|
|
2524
|
+
const intl = (0, import_react_intl20.useIntl)();
|
|
2414
2525
|
const { chainId: storeChainId, setChainId } = useLocalStore_default();
|
|
2415
|
-
const chainId = (0,
|
|
2526
|
+
const chainId = (0, import_react37.useMemo)(() => {
|
|
2416
2527
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
2417
2528
|
return null;
|
|
2418
2529
|
}
|
|
@@ -2421,7 +2532,7 @@ function useMatchChain() {
|
|
|
2421
2532
|
}
|
|
2422
2533
|
return chainListQuery.data[0].id;
|
|
2423
2534
|
}, [storeChainId, chainListQuery.data]);
|
|
2424
|
-
const chain = (0,
|
|
2535
|
+
const chain = (0, import_react37.useMemo)(() => {
|
|
2425
2536
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
2426
2537
|
return null;
|
|
2427
2538
|
}
|
|
@@ -2435,30 +2546,30 @@ function useMatchChain() {
|
|
|
2435
2546
|
close
|
|
2436
2547
|
}) {
|
|
2437
2548
|
const { chainId: storeChainId2, setChainId: setChainId2 } = useLocalStore_default();
|
|
2438
|
-
const [selectedChainId, setSelectedChainId] = (0,
|
|
2549
|
+
const [selectedChainId, setSelectedChainId] = (0, import_react37.useState)(storeChainId2);
|
|
2439
2550
|
const isDownMd = useDownMd();
|
|
2440
|
-
return /* @__PURE__ */ (0,
|
|
2441
|
-
/* @__PURE__ */ (0,
|
|
2442
|
-
return /* @__PURE__ */ (0,
|
|
2551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: `matchid-change-network-box`, children: [
|
|
2552
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: `matchid-change-network-list`, children: chainListQuery.data?.map((item, index) => {
|
|
2553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
2443
2554
|
"div",
|
|
2444
2555
|
{
|
|
2445
2556
|
onClick: () => setSelectedChainId(item.id),
|
|
2446
2557
|
className: `matchid-change-network-item ${selectedChainId == item.id ? "matchid-change-network-selected" : ""}`,
|
|
2447
2558
|
children: [
|
|
2448
|
-
/* @__PURE__ */ (0,
|
|
2449
|
-
/* @__PURE__ */ (0,
|
|
2450
|
-
/* @__PURE__ */ (0,
|
|
2559
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: `matchid-change-network-item-content`, children: [
|
|
2560
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("img", { src: item.iconUrl, className: `matchid-change-network-item-icon` }),
|
|
2561
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "matchid-change-network-item-name", children: item.name })
|
|
2451
2562
|
] }),
|
|
2452
|
-
/* @__PURE__ */ (0,
|
|
2563
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Radio, { checked: selectedChainId === item.id, size: isDownMd ? 18 : 24 })
|
|
2453
2564
|
]
|
|
2454
2565
|
},
|
|
2455
2566
|
index
|
|
2456
2567
|
);
|
|
2457
2568
|
}) }),
|
|
2458
|
-
/* @__PURE__ */ (0,
|
|
2569
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Button, { size: "lg", highlight: true, onClick: () => {
|
|
2459
2570
|
setChainId2(selectedChainId || 0);
|
|
2460
2571
|
close();
|
|
2461
|
-
}, block: true, children: /* @__PURE__ */ (0,
|
|
2572
|
+
}, block: true, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_intl20.FormattedMessage, { id: "confirm" }) })
|
|
2462
2573
|
] });
|
|
2463
2574
|
}
|
|
2464
2575
|
const showChangeNetwork = () => {
|
|
@@ -2467,13 +2578,13 @@ function useMatchChain() {
|
|
|
2467
2578
|
content: ChangeNetwork
|
|
2468
2579
|
});
|
|
2469
2580
|
};
|
|
2470
|
-
const publicClient = (0,
|
|
2581
|
+
const publicClient = (0, import_react37.useMemo)(() => {
|
|
2471
2582
|
if (!chain) {
|
|
2472
2583
|
return null;
|
|
2473
2584
|
}
|
|
2474
|
-
return (0,
|
|
2585
|
+
return (0, import_viem10.createPublicClient)({
|
|
2475
2586
|
chain,
|
|
2476
|
-
transport: (0,
|
|
2587
|
+
transport: (0, import_viem10.http)()
|
|
2477
2588
|
});
|
|
2478
2589
|
}, [chain]);
|
|
2479
2590
|
return {
|
|
@@ -2485,29 +2596,29 @@ function useMatchChain() {
|
|
|
2485
2596
|
showChangeNetwork,
|
|
2486
2597
|
publicClient,
|
|
2487
2598
|
formatUnits: (value) => {
|
|
2488
|
-
return (0,
|
|
2599
|
+
return (0, import_viem10.formatUnits)(value, chain?.nativeCurrency.decimals || 18);
|
|
2489
2600
|
},
|
|
2490
2601
|
parseUnits: (value) => {
|
|
2491
|
-
return (0,
|
|
2602
|
+
return (0, import_viem10.parseUnits)(value, chain?.nativeCurrency.decimals || 18);
|
|
2492
2603
|
}
|
|
2493
2604
|
};
|
|
2494
2605
|
}
|
|
2495
2606
|
|
|
2496
2607
|
// src/hooks/useMatchWallet.tsx
|
|
2497
2608
|
var import_react_qrcode = require("react-qrcode");
|
|
2498
|
-
var
|
|
2609
|
+
var import_react39 = require("react");
|
|
2499
2610
|
var import_react_query8 = require("@tanstack/react-query");
|
|
2500
|
-
var
|
|
2501
|
-
var
|
|
2611
|
+
var import_viem13 = require("viem");
|
|
2612
|
+
var import_react_intl22 = require("react-intl");
|
|
2502
2613
|
|
|
2503
2614
|
// src/components/ImportToken/index.tsx
|
|
2504
|
-
var
|
|
2505
|
-
var
|
|
2615
|
+
var import_react38 = require("react");
|
|
2616
|
+
var import_react_intl21 = require("react-intl");
|
|
2506
2617
|
var import_react_query7 = require("@tanstack/react-query");
|
|
2507
|
-
var
|
|
2618
|
+
var import_viem12 = require("viem");
|
|
2508
2619
|
|
|
2509
2620
|
// src/hooks/useIsContract.ts
|
|
2510
|
-
var
|
|
2621
|
+
var import_viem11 = require("viem");
|
|
2511
2622
|
var import_react_query6 = require("@tanstack/react-query");
|
|
2512
2623
|
function useIsContract({
|
|
2513
2624
|
address,
|
|
@@ -2519,9 +2630,9 @@ function useIsContract({
|
|
|
2519
2630
|
queryFn: async () => {
|
|
2520
2631
|
if (!chain) return false;
|
|
2521
2632
|
if (!address) return false;
|
|
2522
|
-
const publicClient = (0,
|
|
2633
|
+
const publicClient = (0, import_viem11.createPublicClient)({
|
|
2523
2634
|
chain,
|
|
2524
|
-
transport: (0,
|
|
2635
|
+
transport: (0, import_viem11.http)()
|
|
2525
2636
|
});
|
|
2526
2637
|
const res = await publicClient.getCode({ address });
|
|
2527
2638
|
return res !== null && res !== void 0;
|
|
@@ -2531,27 +2642,27 @@ function useIsContract({
|
|
|
2531
2642
|
}
|
|
2532
2643
|
|
|
2533
2644
|
// src/components/ImportToken/index.tsx
|
|
2534
|
-
var
|
|
2645
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
2535
2646
|
function ImportToken({ close }) {
|
|
2536
|
-
const [status, setStatus] = (0,
|
|
2647
|
+
const [status, setStatus] = (0, import_react38.useState)("");
|
|
2537
2648
|
const { token } = useUserInfo();
|
|
2538
|
-
const [address, setAddress] = (0,
|
|
2539
|
-
const [symbol, setSymbol] = (0,
|
|
2540
|
-
const [decimals, setDecimals] = (0,
|
|
2541
|
-
const [error, setError] = (0,
|
|
2649
|
+
const [address, setAddress] = (0, import_react38.useState)("");
|
|
2650
|
+
const [symbol, setSymbol] = (0, import_react38.useState)("");
|
|
2651
|
+
const [decimals, setDecimals] = (0, import_react38.useState)("");
|
|
2652
|
+
const [error, setError] = (0, import_react38.useState)({});
|
|
2542
2653
|
const { publicClient, chainId, chain } = useMatchChain();
|
|
2543
2654
|
const getContractInfo = async () => {
|
|
2544
2655
|
if (!publicClient) return;
|
|
2545
2656
|
const calls = [
|
|
2546
2657
|
{
|
|
2547
2658
|
address,
|
|
2548
|
-
abi:
|
|
2659
|
+
abi: import_viem12.erc20Abi,
|
|
2549
2660
|
functionName: "symbol",
|
|
2550
2661
|
args: []
|
|
2551
2662
|
},
|
|
2552
2663
|
{
|
|
2553
2664
|
address,
|
|
2554
|
-
abi:
|
|
2665
|
+
abi: import_viem12.erc20Abi,
|
|
2555
2666
|
functionName: "decimals",
|
|
2556
2667
|
args: []
|
|
2557
2668
|
}
|
|
@@ -2571,8 +2682,8 @@ function ImportToken({ close }) {
|
|
|
2571
2682
|
});
|
|
2572
2683
|
}
|
|
2573
2684
|
};
|
|
2574
|
-
const intl = (0,
|
|
2575
|
-
(0,
|
|
2685
|
+
const intl = (0, import_react_intl21.useIntl)();
|
|
2686
|
+
(0, import_react38.useEffect)(() => {
|
|
2576
2687
|
if (address.length === 42) {
|
|
2577
2688
|
const reg = /^0x[0-9a-fA-F]{40}$/;
|
|
2578
2689
|
if (!reg.test(address)) {
|
|
@@ -2591,7 +2702,7 @@ function ImportToken({ close }) {
|
|
|
2591
2702
|
}
|
|
2592
2703
|
}
|
|
2593
2704
|
}, [address, publicClient]);
|
|
2594
|
-
const [loading, setLoading] = (0,
|
|
2705
|
+
const [loading, setLoading] = (0, import_react38.useState)(false);
|
|
2595
2706
|
const toast = useToast();
|
|
2596
2707
|
const queryClient2 = (0, import_react_query7.useQueryClient)();
|
|
2597
2708
|
const onImport = async () => {
|
|
@@ -2619,7 +2730,7 @@ function ImportToken({ close }) {
|
|
|
2619
2730
|
setLoading(false);
|
|
2620
2731
|
}
|
|
2621
2732
|
};
|
|
2622
|
-
const canImport = (0,
|
|
2733
|
+
const canImport = (0, import_react38.useMemo)(() => {
|
|
2623
2734
|
if (!address) {
|
|
2624
2735
|
return false;
|
|
2625
2736
|
}
|
|
@@ -2637,24 +2748,24 @@ function ImportToken({ close }) {
|
|
|
2637
2748
|
}, [error, address, symbol, decimals]);
|
|
2638
2749
|
const isContractQuery = useIsContract({
|
|
2639
2750
|
//@ts-ignore
|
|
2640
|
-
chain: (0,
|
|
2751
|
+
chain: (0, import_viem12.defineChain)(chain),
|
|
2641
2752
|
address,
|
|
2642
2753
|
enabled: canImport
|
|
2643
2754
|
});
|
|
2644
2755
|
if (status == "success" || status == "fail") {
|
|
2645
|
-
return /* @__PURE__ */ (0,
|
|
2646
|
-
/* @__PURE__ */ (0,
|
|
2647
|
-
/* @__PURE__ */ (0,
|
|
2648
|
-
/* @__PURE__ */ (0,
|
|
2756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: `matchid-import-token-result matchid-flex`, children: [
|
|
2757
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: `matchid-import-token-result-box matchid-flex`, children: [
|
|
2758
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("img", { src: status == "success" ? success_default : fail_default, alt: status == "success" ? "success" : "fail", className: `matchid-import-token-result-img` }),
|
|
2759
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: `matchid-import-token-result-text matchid-import-token-result-text-${status}`, children: status == "success" ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_intl21.FormattedMessage, { id: "importSuccess" }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_intl21.FormattedMessage, { id: "importFail" }) })
|
|
2649
2760
|
] }),
|
|
2650
|
-
status == "success" ? /* @__PURE__ */ (0,
|
|
2761
|
+
status == "success" ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Button, { size: "lg", onClick: close, block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_intl21.FormattedMessage, { id: "close" }) }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Button, { size: "lg", onClick: () => setStatus(""), block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_intl21.FormattedMessage, { id: "back" }) })
|
|
2651
2762
|
] });
|
|
2652
2763
|
}
|
|
2653
|
-
return /* @__PURE__ */ (0,
|
|
2654
|
-
/* @__PURE__ */ (0,
|
|
2655
|
-
/* @__PURE__ */ (0,
|
|
2764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: `matchid-import-token`, children: [
|
|
2765
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "matchid-import-token-form", children: [
|
|
2766
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Field, { label: intl.formatMessage({
|
|
2656
2767
|
id: "tokenSmartContract"
|
|
2657
|
-
}), error: error.address ? error.address : isContractQuery.isFetched && !isContractQuery.isLoading && !isContractQuery.data && canImport ? "Address isn't a contract address" : "", children: /* @__PURE__ */ (0,
|
|
2768
|
+
}), error: error.address ? error.address : isContractQuery.isFetched && !isContractQuery.isLoading && !isContractQuery.data && canImport ? "Address isn't a contract address" : "", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
2658
2769
|
Input,
|
|
2659
2770
|
{
|
|
2660
2771
|
placeholder: intl.formatMessage({
|
|
@@ -2665,9 +2776,9 @@ function ImportToken({ close }) {
|
|
|
2665
2776
|
maxLength: 42
|
|
2666
2777
|
}
|
|
2667
2778
|
) }),
|
|
2668
|
-
/* @__PURE__ */ (0,
|
|
2779
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Field, { label: intl.formatMessage({
|
|
2669
2780
|
id: "tokenSymbol"
|
|
2670
|
-
}), error: error.symbol, children: /* @__PURE__ */ (0,
|
|
2781
|
+
}), error: error.symbol, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
2671
2782
|
Input,
|
|
2672
2783
|
{
|
|
2673
2784
|
placeholder: intl.formatMessage({
|
|
@@ -2678,9 +2789,9 @@ function ImportToken({ close }) {
|
|
|
2678
2789
|
maxLength: 16
|
|
2679
2790
|
}
|
|
2680
2791
|
) }),
|
|
2681
|
-
/* @__PURE__ */ (0,
|
|
2792
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Field, { label: intl.formatMessage({
|
|
2682
2793
|
id: "tokenDecimals"
|
|
2683
|
-
}), error: error.decimals, children: /* @__PURE__ */ (0,
|
|
2794
|
+
}), error: error.decimals, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
2684
2795
|
Input,
|
|
2685
2796
|
{
|
|
2686
2797
|
placeholder: intl.formatMessage({
|
|
@@ -2692,7 +2803,7 @@ function ImportToken({ close }) {
|
|
|
2692
2803
|
}
|
|
2693
2804
|
) })
|
|
2694
2805
|
] }),
|
|
2695
|
-
/* @__PURE__ */ (0,
|
|
2806
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
2696
2807
|
Button,
|
|
2697
2808
|
{
|
|
2698
2809
|
size: "lg",
|
|
@@ -2701,20 +2812,20 @@ function ImportToken({ close }) {
|
|
|
2701
2812
|
loading: loading || isContractQuery.isLoading,
|
|
2702
2813
|
disabled: !canImport || !isContractQuery.data,
|
|
2703
2814
|
highlight: true,
|
|
2704
|
-
children: /* @__PURE__ */ (0,
|
|
2815
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_intl21.FormattedMessage, { id: "import" })
|
|
2705
2816
|
}
|
|
2706
2817
|
)
|
|
2707
2818
|
] });
|
|
2708
2819
|
}
|
|
2709
2820
|
|
|
2710
2821
|
// src/hooks/useMatchWallet.tsx
|
|
2711
|
-
var
|
|
2822
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
2712
2823
|
var ReceiveModal = () => {
|
|
2713
2824
|
const chain = useMatchChain();
|
|
2714
2825
|
const { address } = useWallet();
|
|
2715
2826
|
const [copied, setCopied] = useCopyClipboard();
|
|
2716
2827
|
const toast = useToast();
|
|
2717
|
-
const intl = (0,
|
|
2828
|
+
const intl = (0, import_react_intl22.useIntl)();
|
|
2718
2829
|
const onCopy = () => {
|
|
2719
2830
|
setCopied(address);
|
|
2720
2831
|
toast.success(intl.formatMessage({
|
|
@@ -2722,10 +2833,10 @@ var ReceiveModal = () => {
|
|
|
2722
2833
|
}));
|
|
2723
2834
|
};
|
|
2724
2835
|
const chainLink = chain.explorerLink("address/" + address);
|
|
2725
|
-
return /* @__PURE__ */ (0,
|
|
2726
|
-
/* @__PURE__ */ (0,
|
|
2727
|
-
/* @__PURE__ */ (0,
|
|
2728
|
-
/* @__PURE__ */ (0,
|
|
2836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: `matchid-receive-modal`, children: [
|
|
2837
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "matchid-receive-container", children: [
|
|
2838
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: `matchid-receive-text`, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react_intl22.FormattedMessage, { id: "receiveQrcode" }) }),
|
|
2839
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: `matchid-qr-container`, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
2729
2840
|
import_react_qrcode.QRCode,
|
|
2730
2841
|
{
|
|
2731
2842
|
margin: "0",
|
|
@@ -2733,7 +2844,7 @@ var ReceiveModal = () => {
|
|
|
2733
2844
|
value: address
|
|
2734
2845
|
}
|
|
2735
2846
|
) }),
|
|
2736
|
-
/* @__PURE__ */ (0,
|
|
2847
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
2737
2848
|
"a",
|
|
2738
2849
|
{
|
|
2739
2850
|
href: chainLink,
|
|
@@ -2743,8 +2854,8 @@ var ReceiveModal = () => {
|
|
|
2743
2854
|
}
|
|
2744
2855
|
)
|
|
2745
2856
|
] }),
|
|
2746
|
-
/* @__PURE__ */ (0,
|
|
2747
|
-
|
|
2857
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Button, { size: "lg", onClick: onCopy, block: true, highlight: true, disabled: copied, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
2858
|
+
import_react_intl22.FormattedMessage,
|
|
2748
2859
|
{
|
|
2749
2860
|
id: "copyAddress"
|
|
2750
2861
|
}
|
|
@@ -2753,7 +2864,7 @@ var ReceiveModal = () => {
|
|
|
2753
2864
|
};
|
|
2754
2865
|
function useMatchWallet() {
|
|
2755
2866
|
const modal = useModal();
|
|
2756
|
-
const intl = (0,
|
|
2867
|
+
const intl = (0, import_react_intl22.useIntl)();
|
|
2757
2868
|
const showReceiveModal = () => {
|
|
2758
2869
|
modal.open({
|
|
2759
2870
|
title: intl.formatMessage({
|
|
@@ -2785,12 +2896,12 @@ function useMatchWallet() {
|
|
|
2785
2896
|
};
|
|
2786
2897
|
}
|
|
2787
2898
|
function useMatchWalletRecords() {
|
|
2788
|
-
const [hasMore, setHasMore] = (0,
|
|
2789
|
-
const [items, setItems] = (0,
|
|
2899
|
+
const [hasMore, setHasMore] = (0, import_react39.useState)(true);
|
|
2900
|
+
const [items, setItems] = (0, import_react39.useState)([]);
|
|
2790
2901
|
const { chainId, publicClient } = useMatchChain();
|
|
2791
2902
|
const { address } = useWallet();
|
|
2792
|
-
const hasMoreRef = (0,
|
|
2793
|
-
const nextPageParamsRef = (0,
|
|
2903
|
+
const hasMoreRef = (0, import_react39.useRef)(hasMore);
|
|
2904
|
+
const nextPageParamsRef = (0, import_react39.useRef)(void 0);
|
|
2794
2905
|
const { contracts, setContracts } = useContractStore_default();
|
|
2795
2906
|
const fetchMoreData = async () => {
|
|
2796
2907
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
@@ -2817,7 +2928,7 @@ function useMatchWalletRecords() {
|
|
|
2817
2928
|
hasMoreRef.current = true;
|
|
2818
2929
|
fetchMoreData();
|
|
2819
2930
|
};
|
|
2820
|
-
(0,
|
|
2931
|
+
(0, import_react39.useEffect)(() => {
|
|
2821
2932
|
if (chainId && address) {
|
|
2822
2933
|
onInit();
|
|
2823
2934
|
}
|
|
@@ -2841,13 +2952,13 @@ function useMatchWalletRecords() {
|
|
|
2841
2952
|
for (const contract of contractUnique) {
|
|
2842
2953
|
calls.push({
|
|
2843
2954
|
address: contract,
|
|
2844
|
-
abi:
|
|
2955
|
+
abi: import_viem13.erc20Abi,
|
|
2845
2956
|
functionName: "symbol",
|
|
2846
2957
|
args: []
|
|
2847
2958
|
});
|
|
2848
2959
|
calls.push({
|
|
2849
2960
|
address: contract,
|
|
2850
|
-
abi:
|
|
2961
|
+
abi: import_viem13.erc20Abi,
|
|
2851
2962
|
functionName: "decimals",
|
|
2852
2963
|
args: []
|
|
2853
2964
|
});
|
|
@@ -2873,7 +2984,7 @@ function useMatchWalletRecords() {
|
|
|
2873
2984
|
setContracts(contractMap);
|
|
2874
2985
|
}
|
|
2875
2986
|
};
|
|
2876
|
-
const list = (0,
|
|
2987
|
+
const list = (0, import_react39.useMemo)(() => {
|
|
2877
2988
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
2878
2989
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
2879
2990
|
removeList.forEach((item) => {
|
|
@@ -2915,7 +3026,7 @@ function useMatchWalletAssets({
|
|
|
2915
3026
|
chainId: chainId || 0,
|
|
2916
3027
|
...assetListOptions
|
|
2917
3028
|
});
|
|
2918
|
-
const mergedAssets = (0,
|
|
3029
|
+
const mergedAssets = (0, import_react39.useMemo)(() => {
|
|
2919
3030
|
if (!assetListQuery.data && !importTokenQuery.data) return [];
|
|
2920
3031
|
const assetList = (assetListQuery.data || []).map((asset) => ({
|
|
2921
3032
|
...asset,
|
|
@@ -3002,14 +3113,14 @@ function useMatchWalletAssetList({
|
|
|
3002
3113
|
retry: 3
|
|
3003
3114
|
// Retry up to 3 times if failed
|
|
3004
3115
|
});
|
|
3005
|
-
const erc20Tokens = (0,
|
|
3116
|
+
const erc20Tokens = (0, import_react39.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
|
|
3006
3117
|
const erc20BalanceQuery = (0, import_react_query8.useQuery)({
|
|
3007
3118
|
queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
|
|
3008
3119
|
queryFn: async () => {
|
|
3009
3120
|
if (!erc20Tokens.length || !publicClient) return [];
|
|
3010
3121
|
const calls = erc20Tokens.map((token) => ({
|
|
3011
3122
|
address: token.address,
|
|
3012
|
-
abi:
|
|
3123
|
+
abi: import_viem13.erc20Abi,
|
|
3013
3124
|
functionName: "balanceOf",
|
|
3014
3125
|
args: [address]
|
|
3015
3126
|
}));
|
|
@@ -3030,7 +3141,7 @@ function useMatchWalletAssetList({
|
|
|
3030
3141
|
// Refresh every 15 seconds
|
|
3031
3142
|
retry: 3
|
|
3032
3143
|
});
|
|
3033
|
-
const enrichedAssets = (0,
|
|
3144
|
+
const enrichedAssets = (0, import_react39.useMemo)(() => {
|
|
3034
3145
|
if (!list) return [];
|
|
3035
3146
|
const erc20Balances = erc20BalanceQuery.data || [];
|
|
3036
3147
|
return list.map((asset) => {
|
|
@@ -3040,11 +3151,11 @@ function useMatchWalletAssetList({
|
|
|
3040
3151
|
const assetAddress = asset.address.toLowerCase();
|
|
3041
3152
|
if (assetAddress === NATIVE_TOKEN_ADDRESS) {
|
|
3042
3153
|
balanceValue = nativeBalanceQuery.data?.toString() || "0";
|
|
3043
|
-
balance = nativeBalanceQuery.data ? Number((0,
|
|
3154
|
+
balance = nativeBalanceQuery.data ? Number((0, import_viem13.formatUnits)(nativeBalanceQuery.data, decimals)) : 0;
|
|
3044
3155
|
} else {
|
|
3045
3156
|
const index = erc20Tokens.findIndex((t) => t.address.toLowerCase() === assetAddress);
|
|
3046
3157
|
if (index !== -1 && erc20Balances[index] && erc20Balances[index].status === "success") {
|
|
3047
|
-
balance = Number((0,
|
|
3158
|
+
balance = Number((0, import_viem13.formatUnits)(erc20Balances[index].result, decimals));
|
|
3048
3159
|
balanceValue = erc20Balances[index].result?.toString() || "0";
|
|
3049
3160
|
}
|
|
3050
3161
|
}
|
|
@@ -3052,7 +3163,7 @@ function useMatchWalletAssetList({
|
|
|
3052
3163
|
return { ...asset, balance, value, balanceValue };
|
|
3053
3164
|
});
|
|
3054
3165
|
}, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
|
|
3055
|
-
(0,
|
|
3166
|
+
(0, import_react39.useEffect)(() => {
|
|
3056
3167
|
const list2 = enrichedAssets.sort((a, b) => {
|
|
3057
3168
|
if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
|
|
3058
3169
|
if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
|
|
@@ -3077,14 +3188,14 @@ function useMatchWalletAssetList({
|
|
|
3077
3188
|
}
|
|
3078
3189
|
|
|
3079
3190
|
// src/hooks/useReceipt.tsx
|
|
3080
|
-
var
|
|
3191
|
+
var import_react40 = require("react");
|
|
3081
3192
|
var import_react_query9 = require("@tanstack/react-query");
|
|
3082
|
-
var
|
|
3193
|
+
var import_viem14 = require("viem");
|
|
3083
3194
|
var CACHE_TTL = 86400 * 30 * 1e3;
|
|
3084
3195
|
var MAX_CACHE_SIZE = 500;
|
|
3085
3196
|
var STORAGE_KEY = "match_receipt_logs";
|
|
3086
3197
|
function useReceiptCache() {
|
|
3087
|
-
const [cache, setCache] = (0,
|
|
3198
|
+
const [cache, setCache] = (0, import_react40.useState)(/* @__PURE__ */ new Map());
|
|
3088
3199
|
const isLocalStorageAvailable = (() => {
|
|
3089
3200
|
try {
|
|
3090
3201
|
const testKey = "__test__";
|
|
@@ -3095,7 +3206,7 @@ function useReceiptCache() {
|
|
|
3095
3206
|
return false;
|
|
3096
3207
|
}
|
|
3097
3208
|
})();
|
|
3098
|
-
(0,
|
|
3209
|
+
(0, import_react40.useEffect)(() => {
|
|
3099
3210
|
if (isLocalStorageAvailable) {
|
|
3100
3211
|
try {
|
|
3101
3212
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -3114,7 +3225,7 @@ function useReceiptCache() {
|
|
|
3114
3225
|
}
|
|
3115
3226
|
}
|
|
3116
3227
|
}, []);
|
|
3117
|
-
const updateLocalStorage = (0,
|
|
3228
|
+
const updateLocalStorage = (0, import_react40.useCallback)((updatedCache) => {
|
|
3118
3229
|
if (isLocalStorageAvailable) {
|
|
3119
3230
|
try {
|
|
3120
3231
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -3131,7 +3242,7 @@ function useReceiptCache() {
|
|
|
3131
3242
|
}
|
|
3132
3243
|
}
|
|
3133
3244
|
}, []);
|
|
3134
|
-
const set = (0,
|
|
3245
|
+
const set = (0, import_react40.useCallback)((key, value) => {
|
|
3135
3246
|
const now = Date.now();
|
|
3136
3247
|
const newCache = new Map(cache);
|
|
3137
3248
|
newCache.forEach((entry, k) => {
|
|
@@ -3149,7 +3260,7 @@ function useReceiptCache() {
|
|
|
3149
3260
|
setCache(newCache);
|
|
3150
3261
|
updateLocalStorage(newCache);
|
|
3151
3262
|
}, [cache, updateLocalStorage]);
|
|
3152
|
-
const get = (0,
|
|
3263
|
+
const get = (0, import_react40.useCallback)((key) => {
|
|
3153
3264
|
const entry = cache.get(key);
|
|
3154
3265
|
if (entry) {
|
|
3155
3266
|
if (Date.now() - entry.timestamp > CACHE_TTL) {
|
|
@@ -3163,7 +3274,7 @@ function useReceiptCache() {
|
|
|
3163
3274
|
}
|
|
3164
3275
|
return void 0;
|
|
3165
3276
|
}, [cache, updateLocalStorage]);
|
|
3166
|
-
const del = (0,
|
|
3277
|
+
const del = (0, import_react40.useCallback)((key) => {
|
|
3167
3278
|
if (cache.has(key)) {
|
|
3168
3279
|
const newCache = new Map(cache);
|
|
3169
3280
|
newCache.delete(key);
|
|
@@ -3171,7 +3282,7 @@ function useReceiptCache() {
|
|
|
3171
3282
|
updateLocalStorage(newCache);
|
|
3172
3283
|
}
|
|
3173
3284
|
}, [cache, updateLocalStorage]);
|
|
3174
|
-
const clear = (0,
|
|
3285
|
+
const clear = (0, import_react40.useCallback)(() => {
|
|
3175
3286
|
setCache(/* @__PURE__ */ new Map());
|
|
3176
3287
|
if (isLocalStorageAvailable) {
|
|
3177
3288
|
localStorage.removeItem(STORAGE_KEY);
|
|
@@ -3186,7 +3297,7 @@ function useReceipt2({
|
|
|
3186
3297
|
const { list } = useMatchChain();
|
|
3187
3298
|
const cache = useReceiptCache();
|
|
3188
3299
|
const chain = list?.find((item) => item.id === chainId);
|
|
3189
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
3300
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react40.useState)(true);
|
|
3190
3301
|
const query = (0, import_react_query9.useQuery)({
|
|
3191
3302
|
queryKey: ["match-tx-receipt", hash, chain],
|
|
3192
3303
|
queryFn: async () => {
|
|
@@ -3196,9 +3307,9 @@ function useReceipt2({
|
|
|
3196
3307
|
return cache.get(cacheKey);
|
|
3197
3308
|
}
|
|
3198
3309
|
try {
|
|
3199
|
-
const publicClient = (0,
|
|
3200
|
-
chain: (0,
|
|
3201
|
-
transport: (0,
|
|
3310
|
+
const publicClient = (0, import_viem14.createPublicClient)({
|
|
3311
|
+
chain: (0, import_viem14.defineChain)(chain),
|
|
3312
|
+
transport: (0, import_viem14.http)()
|
|
3202
3313
|
});
|
|
3203
3314
|
const receipt = await publicClient.getTransactionReceipt({ hash });
|
|
3204
3315
|
if (!receipt) {
|
|
@@ -3212,7 +3323,7 @@ function useReceipt2({
|
|
|
3212
3323
|
},
|
|
3213
3324
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
3214
3325
|
});
|
|
3215
|
-
(0,
|
|
3326
|
+
(0, import_react40.useEffect)(() => {
|
|
3216
3327
|
if (query.data) {
|
|
3217
3328
|
setShouldRefetch(false);
|
|
3218
3329
|
}
|
|
@@ -3221,14 +3332,14 @@ function useReceipt2({
|
|
|
3221
3332
|
}
|
|
3222
3333
|
|
|
3223
3334
|
// src/hooks/useTransaction.tsx
|
|
3224
|
-
var
|
|
3335
|
+
var import_react41 = require("react");
|
|
3225
3336
|
var import_react_query10 = require("@tanstack/react-query");
|
|
3226
|
-
var
|
|
3337
|
+
var import_viem15 = require("viem");
|
|
3227
3338
|
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
3228
3339
|
var MAX_CACHE_SIZE2 = 500;
|
|
3229
3340
|
var STORAGE_KEY2 = "match_transaction_logs";
|
|
3230
3341
|
function useTransactionCache() {
|
|
3231
|
-
const [cache, setCache] = (0,
|
|
3342
|
+
const [cache, setCache] = (0, import_react41.useState)(/* @__PURE__ */ new Map());
|
|
3232
3343
|
const isLocalStorageAvailable = (() => {
|
|
3233
3344
|
try {
|
|
3234
3345
|
const testKey = "__test__";
|
|
@@ -3239,7 +3350,7 @@ function useTransactionCache() {
|
|
|
3239
3350
|
return false;
|
|
3240
3351
|
}
|
|
3241
3352
|
})();
|
|
3242
|
-
(0,
|
|
3353
|
+
(0, import_react41.useEffect)(() => {
|
|
3243
3354
|
if (isLocalStorageAvailable) {
|
|
3244
3355
|
try {
|
|
3245
3356
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -3258,7 +3369,7 @@ function useTransactionCache() {
|
|
|
3258
3369
|
}
|
|
3259
3370
|
}
|
|
3260
3371
|
}, []);
|
|
3261
|
-
const updateLocalStorage = (0,
|
|
3372
|
+
const updateLocalStorage = (0, import_react41.useCallback)((updatedCache) => {
|
|
3262
3373
|
if (isLocalStorageAvailable) {
|
|
3263
3374
|
try {
|
|
3264
3375
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -3275,7 +3386,7 @@ function useTransactionCache() {
|
|
|
3275
3386
|
}
|
|
3276
3387
|
}
|
|
3277
3388
|
}, []);
|
|
3278
|
-
const set = (0,
|
|
3389
|
+
const set = (0, import_react41.useCallback)((key, value) => {
|
|
3279
3390
|
const now = Date.now();
|
|
3280
3391
|
const newCache = new Map(cache);
|
|
3281
3392
|
newCache.forEach((entry, k) => {
|
|
@@ -3293,7 +3404,7 @@ function useTransactionCache() {
|
|
|
3293
3404
|
setCache(newCache);
|
|
3294
3405
|
updateLocalStorage(newCache);
|
|
3295
3406
|
}, [cache, updateLocalStorage]);
|
|
3296
|
-
const get = (0,
|
|
3407
|
+
const get = (0, import_react41.useCallback)((key) => {
|
|
3297
3408
|
const entry = cache.get(key);
|
|
3298
3409
|
if (entry) {
|
|
3299
3410
|
if (Date.now() - entry.timestamp > CACHE_TTL2) {
|
|
@@ -3307,7 +3418,7 @@ function useTransactionCache() {
|
|
|
3307
3418
|
}
|
|
3308
3419
|
return void 0;
|
|
3309
3420
|
}, [cache, updateLocalStorage]);
|
|
3310
|
-
const del = (0,
|
|
3421
|
+
const del = (0, import_react41.useCallback)((key) => {
|
|
3311
3422
|
if (cache.has(key)) {
|
|
3312
3423
|
const newCache = new Map(cache);
|
|
3313
3424
|
newCache.delete(key);
|
|
@@ -3315,7 +3426,7 @@ function useTransactionCache() {
|
|
|
3315
3426
|
updateLocalStorage(newCache);
|
|
3316
3427
|
}
|
|
3317
3428
|
}, [cache, updateLocalStorage]);
|
|
3318
|
-
const clear = (0,
|
|
3429
|
+
const clear = (0, import_react41.useCallback)(() => {
|
|
3319
3430
|
setCache(/* @__PURE__ */ new Map());
|
|
3320
3431
|
if (isLocalStorageAvailable) {
|
|
3321
3432
|
localStorage.removeItem(STORAGE_KEY2);
|
|
@@ -3330,7 +3441,7 @@ function useTransaction({
|
|
|
3330
3441
|
const { list } = useMatchChain();
|
|
3331
3442
|
const cache = useTransactionCache();
|
|
3332
3443
|
const chain = list?.find((item) => item.id === chainId);
|
|
3333
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
3444
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react41.useState)(true);
|
|
3334
3445
|
const query = (0, import_react_query10.useQuery)({
|
|
3335
3446
|
queryKey: ["match-tx-transaction", hash, chain],
|
|
3336
3447
|
queryFn: async () => {
|
|
@@ -3340,9 +3451,9 @@ function useTransaction({
|
|
|
3340
3451
|
return cache.get(cacheKey);
|
|
3341
3452
|
}
|
|
3342
3453
|
try {
|
|
3343
|
-
const publicClient = (0,
|
|
3344
|
-
chain: (0,
|
|
3345
|
-
transport: (0,
|
|
3454
|
+
const publicClient = (0, import_viem15.createPublicClient)({
|
|
3455
|
+
chain: (0, import_viem15.defineChain)(chain),
|
|
3456
|
+
transport: (0, import_viem15.http)()
|
|
3346
3457
|
});
|
|
3347
3458
|
const transaction = await publicClient.getTransaction({ hash });
|
|
3348
3459
|
if (!transaction) {
|
|
@@ -3356,7 +3467,7 @@ function useTransaction({
|
|
|
3356
3467
|
},
|
|
3357
3468
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
3358
3469
|
});
|
|
3359
|
-
(0,
|
|
3470
|
+
(0, import_react41.useEffect)(() => {
|
|
3360
3471
|
if (query.data) {
|
|
3361
3472
|
setShouldRefetch(false);
|
|
3362
3473
|
}
|