@matchain/matchid-sdk-react 0.1.53-alpha.0 → 0.1.53-alpha.2
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-YQHI5BIZ.mjs → chunk-4A2YPGO3.mjs} +2 -2
- package/dist/{chunk-HLUFAIFV.mjs → chunk-MX7N57AH.mjs} +1 -1
- package/dist/{chunk-HLUFAIFV.mjs.map → chunk-MX7N57AH.mjs.map} +1 -1
- package/dist/{chunk-LRJDS2OK.mjs → chunk-W5A6WY7Y.mjs} +229 -416
- package/dist/chunk-W5A6WY7Y.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 +223 -395
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -4
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +75 -122
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +3 -3
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +253 -313
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/{index-CO1j3Cxc.d.ts → index-B8cUP7cH.d.ts} +2 -2
- package/dist/{index-C29kl7io.d.mts → index-BCGJczpk.d.mts} +1 -1
- package/dist/{index-Bsfb3Ysq.d.mts → index-BS-NO8Y2.d.ts} +3 -3
- package/dist/{index-C7InzeOC.d.ts → index-Bil_db2f.d.mts} +3 -3
- package/dist/{index-BlYHNOxm.d.ts → index-BsL6zo6a.d.ts} +1 -1
- package/dist/{index-CteYYAoN.d.mts → index-CZqdmQu1.d.mts} +1 -1
- package/dist/{index-Ce5JlNJv.d.ts → index-DNJuiNdz.d.mts} +4 -11
- package/dist/{index-0EM3dXJ4.d.mts → index-Df-WlkXq.d.ts} +4 -11
- package/dist/{index-BNNgBoTN.d.ts → index-IwwXQ_QV.d.ts} +1 -1
- package/dist/{index-BoIDCH41.d.ts → index-K5vXmiRX.d.ts} +1 -1
- package/dist/{index-CGx_yc95.d.mts → index-iWHaT8HV.d.mts} +1 -1
- package/dist/{index-CqO8nMTh.d.mts → index-yy3VTdFU.d.mts} +2 -2
- package/dist/index.css +18 -6
- package/dist/index.d.mts +7 -8
- package/dist/index.d.ts +7 -8
- package/dist/index.js +389 -538
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -9
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/{types-Cv5UhCIP.d.mts → types-CZbR7ERa.d.mts} +1 -2
- package/dist/{types-Cv5UhCIP.d.ts → types-CZbR7ERa.d.ts} +1 -2
- package/dist/ui/index.d.mts +3 -3
- package/dist/ui/index.d.ts +3 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +1 -1
- package/example/dist/assets/{TransportWebHID-BwG9Tbw2.js → TransportWebHID-BEu7tC0r.js} +1 -1
- package/example/dist/assets/{bignumber-FiRdtNkj.js → bignumber-iG7K-qxw.js} +1 -1
- package/example/dist/assets/{ccip-CJyR03AW.js → ccip-a6wQ1Vcb.js} +1 -1
- package/example/dist/assets/{draggabilly-1Sl0icBA.js → draggabilly-CRYR_S0q.js} +1 -1
- package/example/dist/assets/{index-RIWy1Hg7.js → index--dp9m9Ep.js} +1 -1
- package/example/dist/assets/{index-DATAk5xI.js → index-BDTHolFv.js} +1 -1
- package/example/dist/assets/{index-CcgesoWE.js → index-BZl59qLb.js} +20 -20
- package/example/dist/assets/{index-DxxLiL3_.js → index-BmMbYNHO.js} +3 -3
- package/example/dist/assets/{index-D8N4Z5B5.js → index-C7cxVRDF.js} +71 -71
- package/example/dist/assets/{index-BAfSBdWW.js → index-CJk171Yb.js} +1 -1
- package/example/dist/assets/{index-DN1wW-Mo.js → index-CQiBesAa.js} +1 -1
- package/example/dist/assets/{index-D5RU9xxK.js → index-D62loNA9.js} +1 -1
- package/example/dist/assets/{index-CYk2C9XJ.js → index-DqyX3FG6.js} +1 -1
- package/example/dist/assets/{solanaEmbed.esm-CNS-QKE2.js → solanaEmbed.esm-Djn-u4Vn.js} +1 -1
- package/example/dist/index.html +1 -1
- package/example/package.json +2 -1
- package/example/src/App.tsx +18 -5
- package/example/src/store/useLocalStore.ts +9 -0
- package/package.json +1 -5
- package/dist/chunk-LRJDS2OK.mjs.map +0 -1
- /package/dist/{chunk-YQHI5BIZ.mjs.map → chunk-4A2YPGO3.mjs.map} +0 -0
package/dist/hooks/index.js
CHANGED
|
@@ -43,7 +43,7 @@ __export(hooks_exports, {
|
|
|
43
43
|
useToast: () => useToast,
|
|
44
44
|
useTransaction: () => useTransaction,
|
|
45
45
|
useUserInfo: () => useUserInfo,
|
|
46
|
-
useWallet: () =>
|
|
46
|
+
useWallet: () => useWallet
|
|
47
47
|
});
|
|
48
48
|
module.exports = __toCommonJS(hooks_exports);
|
|
49
49
|
|
|
@@ -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_react31 = require("react");
|
|
353
353
|
|
|
354
354
|
// src/MatchContext.tsx
|
|
355
|
-
var
|
|
355
|
+
var import_react30 = require("react");
|
|
356
356
|
|
|
357
357
|
// src/store/useModalStore.ts
|
|
358
358
|
var import_zustand2 = require("zustand");
|
|
@@ -639,12 +639,6 @@ var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
|
639
639
|
var DEFAULT_WALLET_METHODS = ["evm", "sol", "btc", "tron", "ton"];
|
|
640
640
|
|
|
641
641
|
// src/store/useModalStore.ts
|
|
642
|
-
var useSOLModalStore = (0, import_zustand2.create)((set) => ({
|
|
643
|
-
isOpen: false,
|
|
644
|
-
type: "",
|
|
645
|
-
open: (type) => set({ isOpen: true, type }),
|
|
646
|
-
close: () => set({ isOpen: false })
|
|
647
|
-
}));
|
|
648
642
|
var useTRONModalStore = (0, import_zustand2.create)((set) => ({
|
|
649
643
|
isOpen: false,
|
|
650
644
|
type: "",
|
|
@@ -990,8 +984,8 @@ var import_react11 = require("react");
|
|
|
990
984
|
var import_react_intl8 = require("react-intl");
|
|
991
985
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
992
986
|
|
|
993
|
-
// src/components/
|
|
994
|
-
var
|
|
987
|
+
// src/components/TRONModal/index.tsx
|
|
988
|
+
var import_react14 = __toESM(require("react"));
|
|
995
989
|
|
|
996
990
|
// src/hooks/eventManager.ts
|
|
997
991
|
var EventManager = class {
|
|
@@ -1021,118 +1015,55 @@ var EventManager = class {
|
|
|
1021
1015
|
var eventManager = new EventManager();
|
|
1022
1016
|
var eventManager_default = eventManager;
|
|
1023
1017
|
|
|
1024
|
-
// src/components/
|
|
1025
|
-
var import_web3 = require("@solana/web3.js");
|
|
1026
|
-
var import_wallet_adapter_react = require("@solana/wallet-adapter-react");
|
|
1027
|
-
var import_wallet_adapter_react_ui = require("@solana/wallet-adapter-react-ui");
|
|
1028
|
-
|
|
1029
|
-
// node_modules/@solana/wallet-adapter-base/lib/esm/types.js
|
|
1030
|
-
var WalletAdapterNetwork;
|
|
1031
|
-
(function(WalletAdapterNetwork2) {
|
|
1032
|
-
WalletAdapterNetwork2["Mainnet"] = "mainnet-beta";
|
|
1033
|
-
WalletAdapterNetwork2["Testnet"] = "testnet";
|
|
1034
|
-
WalletAdapterNetwork2["Devnet"] = "devnet";
|
|
1035
|
-
})(WalletAdapterNetwork || (WalletAdapterNetwork = {}));
|
|
1036
|
-
|
|
1037
|
-
// src/components/SOLModal/index.tsx
|
|
1038
|
-
var import_wallet_adapter_wallets = require("@solana/wallet-adapter-wallets");
|
|
1039
|
-
var import_styles = require("@solana/wallet-adapter-react-ui/styles.css");
|
|
1018
|
+
// src/components/TRONModal/index.tsx
|
|
1040
1019
|
var import_react_intl9 = require("react-intl");
|
|
1041
1020
|
|
|
1042
1021
|
// src/components/WalletModalContent/index.tsx
|
|
1043
1022
|
var import_react12 = require("react");
|
|
1044
1023
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
1045
1024
|
|
|
1046
|
-
// src/components/SOLModal/index.tsx
|
|
1047
|
-
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
1048
|
-
var wallets = [
|
|
1049
|
-
new import_wallet_adapter_wallets.PhantomWalletAdapter(),
|
|
1050
|
-
new import_wallet_adapter_wallets.SolflareWalletAdapter(),
|
|
1051
|
-
new import_wallet_adapter_wallets.WalletConnectWalletAdapter({
|
|
1052
|
-
network: WalletAdapterNetwork.Mainnet,
|
|
1053
|
-
options: {
|
|
1054
|
-
relayUrl: "wss://relay.walletconnect.com"
|
|
1055
|
-
}
|
|
1056
|
-
}),
|
|
1057
|
-
new import_wallet_adapter_wallets.AlphaWalletAdapter(),
|
|
1058
|
-
new import_wallet_adapter_wallets.AvanaWalletAdapter(),
|
|
1059
|
-
new import_wallet_adapter_wallets.BitgetWalletAdapter(),
|
|
1060
|
-
new import_wallet_adapter_wallets.BitpieWalletAdapter(),
|
|
1061
|
-
new import_wallet_adapter_wallets.CloverWalletAdapter(),
|
|
1062
|
-
new import_wallet_adapter_wallets.Coin98WalletAdapter(),
|
|
1063
|
-
new import_wallet_adapter_wallets.CoinbaseWalletAdapter(),
|
|
1064
|
-
new import_wallet_adapter_wallets.CoinhubWalletAdapter(),
|
|
1065
|
-
new import_wallet_adapter_wallets.FractalWalletAdapter(),
|
|
1066
|
-
new import_wallet_adapter_wallets.HuobiWalletAdapter(),
|
|
1067
|
-
new import_wallet_adapter_wallets.HyperPayWalletAdapter(),
|
|
1068
|
-
new import_wallet_adapter_wallets.KeystoneWalletAdapter(),
|
|
1069
|
-
new import_wallet_adapter_wallets.KrystalWalletAdapter(),
|
|
1070
|
-
new import_wallet_adapter_wallets.LedgerWalletAdapter(),
|
|
1071
|
-
new import_wallet_adapter_wallets.MathWalletAdapter(),
|
|
1072
|
-
new import_wallet_adapter_wallets.NekoWalletAdapter(),
|
|
1073
|
-
new import_wallet_adapter_wallets.NightlyWalletAdapter(),
|
|
1074
|
-
new import_wallet_adapter_wallets.NufiWalletAdapter(),
|
|
1075
|
-
new import_wallet_adapter_wallets.OntoWalletAdapter(),
|
|
1076
|
-
new import_wallet_adapter_wallets.ParticleAdapter(),
|
|
1077
|
-
new import_wallet_adapter_wallets.SafePalWalletAdapter(),
|
|
1078
|
-
new import_wallet_adapter_wallets.SaifuWalletAdapter(),
|
|
1079
|
-
new import_wallet_adapter_wallets.SalmonWalletAdapter(),
|
|
1080
|
-
new import_wallet_adapter_wallets.SkyWalletAdapter(),
|
|
1081
|
-
new import_wallet_adapter_wallets.SolongWalletAdapter(),
|
|
1082
|
-
new import_wallet_adapter_wallets.SpotWalletAdapter(),
|
|
1083
|
-
new import_wallet_adapter_wallets.TokenaryWalletAdapter(),
|
|
1084
|
-
new import_wallet_adapter_wallets.TokenPocketWalletAdapter(),
|
|
1085
|
-
new import_wallet_adapter_wallets.TorusWalletAdapter(),
|
|
1086
|
-
new import_wallet_adapter_wallets.TrustWalletAdapter(),
|
|
1087
|
-
new import_wallet_adapter_wallets.XDEFIWalletAdapter()
|
|
1088
|
-
];
|
|
1089
|
-
|
|
1090
|
-
// src/components/TRONModal/index.tsx
|
|
1091
|
-
var import_react15 = __toESM(require("react"));
|
|
1092
|
-
var import_react_intl10 = require("react-intl");
|
|
1093
|
-
|
|
1094
1025
|
// src/hooks/useTRONWallet.ts
|
|
1095
|
-
var
|
|
1026
|
+
var import_react13 = require("react");
|
|
1096
1027
|
|
|
1097
1028
|
// src/components/TRONModal/index.tsx
|
|
1098
|
-
var
|
|
1029
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
1099
1030
|
|
|
1100
1031
|
// src/components/TONModal/index.tsx
|
|
1101
|
-
var
|
|
1102
|
-
var
|
|
1032
|
+
var import_react15 = __toESM(require("react"));
|
|
1033
|
+
var import_react_intl10 = require("react-intl");
|
|
1103
1034
|
var import_ui_react = require("@tonconnect/ui-react");
|
|
1104
|
-
var
|
|
1035
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
1105
1036
|
|
|
1106
1037
|
// src/components/BTCModal/index.tsx
|
|
1107
|
-
var
|
|
1108
|
-
var
|
|
1038
|
+
var import_react17 = __toESM(require("react"));
|
|
1039
|
+
var import_react_intl11 = require("react-intl");
|
|
1109
1040
|
|
|
1110
1041
|
// src/lib/btc/XverseAdapter.ts
|
|
1111
1042
|
var import_sats_connect = require("sats-connect");
|
|
1112
1043
|
|
|
1113
1044
|
// src/hooks/useBTCWallet.ts
|
|
1114
|
-
var
|
|
1045
|
+
var import_react16 = require("react");
|
|
1115
1046
|
|
|
1116
1047
|
// src/components/BTCModal/index.tsx
|
|
1117
|
-
var
|
|
1048
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
1118
1049
|
|
|
1119
1050
|
// src/components/WalletModal/index.tsx
|
|
1120
|
-
var
|
|
1121
|
-
var
|
|
1122
|
-
var
|
|
1051
|
+
var import_react18 = require("react");
|
|
1052
|
+
var import_react_intl12 = require("react-intl");
|
|
1053
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
1123
1054
|
|
|
1124
1055
|
// src/components/AlphaAvatar/index.tsx
|
|
1125
|
-
var
|
|
1126
|
-
var
|
|
1056
|
+
var import_react19 = require("react");
|
|
1057
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
1127
1058
|
function AlphaAvatar({ name, size = 40, className = "" }) {
|
|
1128
|
-
const [avatar, setAvatar] = (0,
|
|
1129
|
-
(0,
|
|
1059
|
+
const [avatar, setAvatar] = (0, import_react19.useState)(void 0);
|
|
1060
|
+
(0, import_react19.useEffect)(() => {
|
|
1130
1061
|
if (name) {
|
|
1131
1062
|
const char = name[0].toUpperCase();
|
|
1132
1063
|
setAvatar(char);
|
|
1133
1064
|
}
|
|
1134
1065
|
}, [name]);
|
|
1135
|
-
return /* @__PURE__ */ (0,
|
|
1066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
1136
1067
|
width: size,
|
|
1137
1068
|
height: size,
|
|
1138
1069
|
fontSize: Math.ceil(size / 2)
|
|
@@ -1140,10 +1071,10 @@ function AlphaAvatar({ name, size = 40, className = "" }) {
|
|
|
1140
1071
|
}
|
|
1141
1072
|
|
|
1142
1073
|
// src/components/WalletAsset/index.tsx
|
|
1143
|
-
var
|
|
1074
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
1144
1075
|
|
|
1145
1076
|
// src/ui/Drawer/index.tsx
|
|
1146
|
-
var
|
|
1077
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
1147
1078
|
function Drawer({
|
|
1148
1079
|
children,
|
|
1149
1080
|
showClose = true,
|
|
@@ -1154,25 +1085,25 @@ function Drawer({
|
|
|
1154
1085
|
onBack
|
|
1155
1086
|
}) {
|
|
1156
1087
|
if (!isOpen) {
|
|
1157
|
-
return /* @__PURE__ */ (0,
|
|
1088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_jsx_runtime74.Fragment, {});
|
|
1158
1089
|
}
|
|
1159
|
-
return /* @__PURE__ */ (0,
|
|
1160
|
-
/* @__PURE__ */ (0,
|
|
1161
|
-
/* @__PURE__ */ (0,
|
|
1162
|
-
onBack && /* @__PURE__ */ (0,
|
|
1090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Overlay, { isOpen, zIndex, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "matchid-drawer", children: [
|
|
1091
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: `matchid-drawer-header matchid-flex`, children: [
|
|
1092
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: `matchid-drawer-header-content matchid-flex`, children: [
|
|
1093
|
+
onBack && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ArrowLeftIcon, { height: 25, width: 24, className: "matchid-drawer-header-back", onClick: onBack }),
|
|
1163
1094
|
title
|
|
1164
1095
|
] }),
|
|
1165
|
-
showClose && /* @__PURE__ */ (0,
|
|
1096
|
+
showClose && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(CloseRoundIcon, { className: "matchid-drawer-header-close", onClick: onClose })
|
|
1166
1097
|
] }),
|
|
1167
1098
|
children
|
|
1168
1099
|
] }) });
|
|
1169
1100
|
}
|
|
1170
1101
|
|
|
1171
1102
|
// src/ui/HashPanel/index.tsx
|
|
1172
|
-
var
|
|
1103
|
+
var import_react20 = require("react");
|
|
1173
1104
|
|
|
1174
1105
|
// src/ui/ModalDrawer/index.tsx
|
|
1175
|
-
var
|
|
1106
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
1176
1107
|
function ModalDrawer({
|
|
1177
1108
|
title,
|
|
1178
1109
|
drawerTitleVisible = true,
|
|
@@ -1180,9 +1111,9 @@ function ModalDrawer({
|
|
|
1180
1111
|
}) {
|
|
1181
1112
|
const isDownMd = useDownMd();
|
|
1182
1113
|
if (isDownMd) {
|
|
1183
|
-
return /* @__PURE__ */ (0,
|
|
1114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ModalWithHeader, { ...props, title });
|
|
1184
1115
|
}
|
|
1185
|
-
return /* @__PURE__ */ (0,
|
|
1116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Drawer, { ...props, title: drawerTitleVisible ? title : null });
|
|
1186
1117
|
}
|
|
1187
1118
|
|
|
1188
1119
|
// src/assets/img/confirm.gif
|
|
@@ -1238,7 +1169,7 @@ function useHash({
|
|
|
1238
1169
|
}
|
|
1239
1170
|
|
|
1240
1171
|
// src/ui/HashPanel/index.tsx
|
|
1241
|
-
var
|
|
1172
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
1242
1173
|
function HashPanel({
|
|
1243
1174
|
hash,
|
|
1244
1175
|
chain,
|
|
@@ -1246,7 +1177,7 @@ function HashPanel({
|
|
|
1246
1177
|
onClose,
|
|
1247
1178
|
zIndex
|
|
1248
1179
|
}) {
|
|
1249
|
-
const [status, setStatus] = (0,
|
|
1180
|
+
const [status, setStatus] = (0, import_react20.useState)("confirm");
|
|
1250
1181
|
const statusMaps = {
|
|
1251
1182
|
"confirm": {
|
|
1252
1183
|
icon: confirm_default,
|
|
@@ -1270,8 +1201,8 @@ function HashPanel({
|
|
|
1270
1201
|
}
|
|
1271
1202
|
};
|
|
1272
1203
|
const statusValue = statusMaps[status];
|
|
1273
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
1274
|
-
(0,
|
|
1204
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react20.useState)(true);
|
|
1205
|
+
(0, import_react20.useEffect)(() => {
|
|
1275
1206
|
if (hash) {
|
|
1276
1207
|
setShouldRefetch(true);
|
|
1277
1208
|
setStatus("pending");
|
|
@@ -1284,7 +1215,7 @@ function HashPanel({
|
|
|
1284
1215
|
chain,
|
|
1285
1216
|
refetchInterval: shouldRefetch ? 3e3 : false
|
|
1286
1217
|
});
|
|
1287
|
-
(0,
|
|
1218
|
+
(0, import_react20.useEffect)(() => {
|
|
1288
1219
|
if (hashQuery.data == 1 || hashQuery.data == -1) {
|
|
1289
1220
|
setShouldRefetch(false);
|
|
1290
1221
|
}
|
|
@@ -1297,14 +1228,14 @@ function HashPanel({
|
|
|
1297
1228
|
}
|
|
1298
1229
|
}, [hashQuery.data]);
|
|
1299
1230
|
const link = chain ? `${chain?.blockExplorers?.default.url}/tx/${hash}` : "";
|
|
1300
|
-
return /* @__PURE__ */ (0,
|
|
1231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
1301
1232
|
ModalDrawer,
|
|
1302
1233
|
{
|
|
1303
1234
|
isOpen,
|
|
1304
1235
|
showClose: true,
|
|
1305
1236
|
onClose,
|
|
1306
1237
|
zIndex,
|
|
1307
|
-
title: /* @__PURE__ */ (0,
|
|
1238
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
1308
1239
|
"div",
|
|
1309
1240
|
{
|
|
1310
1241
|
className: "matchid-hashpanel-header",
|
|
@@ -1314,39 +1245,39 @@ function HashPanel({
|
|
|
1314
1245
|
children: statusValue.text
|
|
1315
1246
|
}
|
|
1316
1247
|
),
|
|
1317
|
-
children: /* @__PURE__ */ (0,
|
|
1318
|
-
/* @__PURE__ */ (0,
|
|
1319
|
-
/* @__PURE__ */ (0,
|
|
1248
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "matchid-hashpanel-box", children: [
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "matchid-hashpanel-content", children: [
|
|
1250
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: `matchid-hashpanel-status`, style: {
|
|
1320
1251
|
color: statusValue.color
|
|
1321
1252
|
}, children: statusValue.text }),
|
|
1322
|
-
/* @__PURE__ */ (0,
|
|
1323
|
-
hash && /* @__PURE__ */ (0,
|
|
1253
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("img", { src: statusValue.icon, alt: statusValue.text, className: `matchid-hashpanel-img` }),
|
|
1254
|
+
hash && /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "matchid-hashpanel-hash", children: [
|
|
1324
1255
|
"Hash:",
|
|
1325
|
-
/* @__PURE__ */ (0,
|
|
1256
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("a", { href: link, target: "_blank", children: hash })
|
|
1326
1257
|
] })
|
|
1327
1258
|
] }),
|
|
1328
|
-
/* @__PURE__ */ (0,
|
|
1259
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Button, { onClick: onClose, size: "lg", block: true, children: "Back" })
|
|
1329
1260
|
] })
|
|
1330
1261
|
}
|
|
1331
1262
|
);
|
|
1332
1263
|
}
|
|
1333
1264
|
function HashPanel_default(props) {
|
|
1334
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
1265
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(HashPanel, { ...props });
|
|
1335
1266
|
}
|
|
1336
1267
|
|
|
1337
1268
|
// src/ui/Switch/index.tsx
|
|
1338
|
-
var
|
|
1269
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
1339
1270
|
|
|
1340
1271
|
// src/ui/AlphaAvatar/index.tsx
|
|
1341
|
-
var
|
|
1342
|
-
var
|
|
1272
|
+
var import_react21 = require("react");
|
|
1273
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
1343
1274
|
function AlphaAvatar2({
|
|
1344
1275
|
name,
|
|
1345
1276
|
size = "default",
|
|
1346
1277
|
className = "",
|
|
1347
1278
|
style
|
|
1348
1279
|
}) {
|
|
1349
|
-
const avatar = (0,
|
|
1280
|
+
const avatar = (0, import_react21.useMemo)(() => {
|
|
1350
1281
|
if (name) {
|
|
1351
1282
|
const char = name[0].toUpperCase();
|
|
1352
1283
|
if (char.match(/[a-zA-Z0-9]/)) {
|
|
@@ -1356,7 +1287,7 @@ function AlphaAvatar2({
|
|
|
1356
1287
|
return "";
|
|
1357
1288
|
}, [name]);
|
|
1358
1289
|
const numberSize = typeof size === "number" ? size : size === "sm" ? 24 : size === "default" ? 40 : 64;
|
|
1359
|
-
return /* @__PURE__ */ (0,
|
|
1290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
1360
1291
|
width: numberSize,
|
|
1361
1292
|
height: numberSize,
|
|
1362
1293
|
fontSize: Math.ceil(numberSize / 2),
|
|
@@ -1365,7 +1296,7 @@ function AlphaAvatar2({
|
|
|
1365
1296
|
}
|
|
1366
1297
|
|
|
1367
1298
|
// src/ui/Radio/index.tsx
|
|
1368
|
-
var
|
|
1299
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
1369
1300
|
function Radio({
|
|
1370
1301
|
checked = false,
|
|
1371
1302
|
onChange,
|
|
@@ -1374,23 +1305,23 @@ function Radio({
|
|
|
1374
1305
|
className = "",
|
|
1375
1306
|
style = {}
|
|
1376
1307
|
}) {
|
|
1377
|
-
return /* @__PURE__ */ (0,
|
|
1308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { onClick: onChange, className: `matchid-radio ${className} ${checked ? "matchid-radio-checked" : ""}`, style: {
|
|
1378
1309
|
width: size,
|
|
1379
1310
|
height: size,
|
|
1380
1311
|
...style,
|
|
1381
1312
|
// @ts-ignore
|
|
1382
1313
|
"--matchid-radio-checked": color
|
|
1383
|
-
}, children: checked && /* @__PURE__ */ (0,
|
|
1314
|
+
}, children: checked && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: `matchid-radio-content`, style: {
|
|
1384
1315
|
width: Math.floor(size * 0.7),
|
|
1385
1316
|
height: Math.floor(size * 0.7)
|
|
1386
1317
|
} }) });
|
|
1387
1318
|
}
|
|
1388
1319
|
|
|
1389
1320
|
// src/components/TokenSend/index.tsx
|
|
1390
|
-
var
|
|
1321
|
+
var import_react22 = require("react");
|
|
1391
1322
|
var import_viem2 = require("viem");
|
|
1392
|
-
var
|
|
1393
|
-
var
|
|
1323
|
+
var import_react_intl13 = require("react-intl");
|
|
1324
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
1394
1325
|
function Input2({
|
|
1395
1326
|
onChange,
|
|
1396
1327
|
placeholder,
|
|
@@ -1400,8 +1331,8 @@ function Input2({
|
|
|
1400
1331
|
error,
|
|
1401
1332
|
size = "df"
|
|
1402
1333
|
}) {
|
|
1403
|
-
return /* @__PURE__ */ (0,
|
|
1404
|
-
/* @__PURE__ */ (0,
|
|
1334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: `matchid-token-input-box ${"matchid-token-input-" + size}`, children: [
|
|
1335
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
1405
1336
|
"input",
|
|
1406
1337
|
{
|
|
1407
1338
|
placeholder,
|
|
@@ -1412,7 +1343,7 @@ function Input2({
|
|
|
1412
1343
|
className: `matchid-token-input ${error ? "matchid-token-input-error" : ""}`
|
|
1413
1344
|
}
|
|
1414
1345
|
),
|
|
1415
|
-
error && /* @__PURE__ */ (0,
|
|
1346
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "matchid-token-input-error-text", children: error })
|
|
1416
1347
|
] });
|
|
1417
1348
|
}
|
|
1418
1349
|
function TokenSend({
|
|
@@ -1422,25 +1353,25 @@ function TokenSend({
|
|
|
1422
1353
|
onBack
|
|
1423
1354
|
}) {
|
|
1424
1355
|
const { list: chainList } = useMatchChain();
|
|
1425
|
-
const intl = (0,
|
|
1426
|
-
const { createWalletClient: createWalletClient2 } =
|
|
1356
|
+
const intl = (0, import_react_intl13.useIntl)();
|
|
1357
|
+
const { createWalletClient: createWalletClient2 } = useWallet();
|
|
1427
1358
|
const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
|
|
1428
|
-
const chain = (0,
|
|
1359
|
+
const chain = (0, import_react22.useMemo)(() => {
|
|
1429
1360
|
return chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
1430
1361
|
}, [chainList, token.chain_id]);
|
|
1431
|
-
const walletClient = (0,
|
|
1362
|
+
const walletClient = (0, import_react22.useMemo)(() => {
|
|
1432
1363
|
return createWalletClient2({
|
|
1433
1364
|
// @ts-ignore
|
|
1434
1365
|
chain: (0, import_viem2.defineChain)(chain),
|
|
1435
1366
|
transport: (0, import_viem2.http)()
|
|
1436
1367
|
});
|
|
1437
1368
|
}, [chain]);
|
|
1438
|
-
const [amount, setAmount] = (0,
|
|
1439
|
-
const [address, setAddress] = (0,
|
|
1440
|
-
const [loading, setLoading] = (0,
|
|
1441
|
-
const [sending, setSending] = (0,
|
|
1442
|
-
const [txError, setTxError] = (0,
|
|
1443
|
-
const transaction = (0,
|
|
1369
|
+
const [amount, setAmount] = (0, import_react22.useState)("");
|
|
1370
|
+
const [address, setAddress] = (0, import_react22.useState)("");
|
|
1371
|
+
const [loading, setLoading] = (0, import_react22.useState)(false);
|
|
1372
|
+
const [sending, setSending] = (0, import_react22.useState)(false);
|
|
1373
|
+
const [txError, setTxError] = (0, import_react22.useState)("");
|
|
1374
|
+
const transaction = (0, import_react22.useMemo)(() => {
|
|
1444
1375
|
const reg = /^0x[a-fA-F0-9]{40}$/;
|
|
1445
1376
|
if (!amount || !address || !reg.test(address)) {
|
|
1446
1377
|
return;
|
|
@@ -1471,7 +1402,7 @@ function TokenSend({
|
|
|
1471
1402
|
setLoading(false);
|
|
1472
1403
|
}
|
|
1473
1404
|
};
|
|
1474
|
-
const error = (0,
|
|
1405
|
+
const error = (0, import_react22.useMemo)(() => {
|
|
1475
1406
|
setTxError("");
|
|
1476
1407
|
let amountError = "";
|
|
1477
1408
|
let addressError = "";
|
|
@@ -1514,7 +1445,7 @@ function TokenSend({
|
|
|
1514
1445
|
setAmount(value);
|
|
1515
1446
|
}
|
|
1516
1447
|
};
|
|
1517
|
-
const canSend = (0,
|
|
1448
|
+
const canSend = (0, import_react22.useMemo)(() => {
|
|
1518
1449
|
return !error.amount && !error.address && amount && address;
|
|
1519
1450
|
}, [error]);
|
|
1520
1451
|
const onNext = async () => {
|
|
@@ -1524,7 +1455,7 @@ function TokenSend({
|
|
|
1524
1455
|
}
|
|
1525
1456
|
onClose();
|
|
1526
1457
|
};
|
|
1527
|
-
(0,
|
|
1458
|
+
(0, import_react22.useEffect)(() => {
|
|
1528
1459
|
const receiveMessage = (event) => {
|
|
1529
1460
|
if (event.data) {
|
|
1530
1461
|
if (event.data.source == "match-wallet") {
|
|
@@ -1540,24 +1471,24 @@ function TokenSend({
|
|
|
1540
1471
|
window.removeEventListener("message", receiveMessage);
|
|
1541
1472
|
};
|
|
1542
1473
|
}, []);
|
|
1543
|
-
return /* @__PURE__ */ (0,
|
|
1544
|
-
/* @__PURE__ */ (0,
|
|
1545
|
-
/* @__PURE__ */ (0,
|
|
1546
|
-
/* @__PURE__ */ (0,
|
|
1547
|
-
/* @__PURE__ */ (0,
|
|
1548
|
-
/* @__PURE__ */ (0,
|
|
1549
|
-
token.icon ? /* @__PURE__ */ (0,
|
|
1474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ModalDrawer, { isOpen: true, onClose, zIndex, title: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react_intl13.FormattedMessage, { id: "send" }), onBack, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: `matchid-token-send-box`, children: [
|
|
1475
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
1476
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: `matchid-token-amount-content`, children: [
|
|
1477
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: `matchid-token-amount-header`, children: [
|
|
1478
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: `matchid-token-amount-title`, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react_intl13.FormattedMessage, { id: "amount" }) }),
|
|
1479
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: `matchid-token-amount-chain`, children: [
|
|
1480
|
+
token.icon ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
1550
1481
|
"img",
|
|
1551
1482
|
{
|
|
1552
1483
|
src: token?.icon,
|
|
1553
1484
|
alt: token?.symbol,
|
|
1554
1485
|
className: `matchid-token-amount-chain-icon`
|
|
1555
1486
|
}
|
|
1556
|
-
) : /* @__PURE__ */ (0,
|
|
1557
|
-
/* @__PURE__ */ (0,
|
|
1487
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(AlphaAvatar2, { name: token.symbol || token.name || "", size: 16 }),
|
|
1488
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { children: token?.symbol })
|
|
1558
1489
|
] })
|
|
1559
1490
|
] }),
|
|
1560
|
-
/* @__PURE__ */ (0,
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
1561
1492
|
Input2,
|
|
1562
1493
|
{
|
|
1563
1494
|
type: "text",
|
|
@@ -1570,18 +1501,18 @@ function TokenSend({
|
|
|
1570
1501
|
error: error.amount || txError
|
|
1571
1502
|
}
|
|
1572
1503
|
),
|
|
1573
|
-
/* @__PURE__ */ (0,
|
|
1574
|
-
/* @__PURE__ */ (0,
|
|
1575
|
-
/* @__PURE__ */ (0,
|
|
1504
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: `matchid-token-amount-footer`, children: [
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: `matchid-token-amount-title`, children: [
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react_intl13.FormattedMessage, { id: "balance" }),
|
|
1576
1507
|
":"
|
|
1577
1508
|
] }),
|
|
1578
|
-
/* @__PURE__ */ (0,
|
|
1509
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: `matchid-token-amount-value`, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(NumberFormatter, { value: token.balance, tFixNum: 10, suffix: " " + token.symbol }) })
|
|
1579
1510
|
] }),
|
|
1580
|
-
/* @__PURE__ */ (0,
|
|
1511
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(TransferIcon, { className: "matchid-token-amount-transfer" })
|
|
1581
1512
|
] }),
|
|
1582
|
-
/* @__PURE__ */ (0,
|
|
1583
|
-
/* @__PURE__ */ (0,
|
|
1584
|
-
/* @__PURE__ */ (0,
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: `matchid-token-address-content`, children: [
|
|
1514
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: `matchid-token-address-header`, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: `matchid-token-address-title`, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react_intl13.FormattedMessage, { id: "receiveTitle" }) }) }),
|
|
1515
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
1585
1516
|
Input2,
|
|
1586
1517
|
{
|
|
1587
1518
|
type: "text",
|
|
@@ -1597,7 +1528,7 @@ function TokenSend({
|
|
|
1597
1528
|
)
|
|
1598
1529
|
] })
|
|
1599
1530
|
] }),
|
|
1600
|
-
/* @__PURE__ */ (0,
|
|
1531
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
1601
1532
|
Button,
|
|
1602
1533
|
{
|
|
1603
1534
|
size: "lg",
|
|
@@ -1606,20 +1537,20 @@ function TokenSend({
|
|
|
1606
1537
|
disabled: !canSend || !!txError,
|
|
1607
1538
|
onClick: onNext,
|
|
1608
1539
|
loading: loading || sending,
|
|
1609
|
-
children: /* @__PURE__ */ (0,
|
|
1540
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react_intl13.FormattedMessage, { id: "next" })
|
|
1610
1541
|
}
|
|
1611
1542
|
)
|
|
1612
1543
|
] }) });
|
|
1613
1544
|
}
|
|
1614
1545
|
|
|
1615
1546
|
// src/components/TokenDetail/index.tsx
|
|
1616
|
-
var
|
|
1617
|
-
var
|
|
1547
|
+
var import_react_intl14 = require("react-intl");
|
|
1548
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
1618
1549
|
|
|
1619
1550
|
// src/components/TokenSendList/index.tsx
|
|
1620
|
-
var
|
|
1621
|
-
var
|
|
1622
|
-
var
|
|
1551
|
+
var import_react23 = require("react");
|
|
1552
|
+
var import_react_intl15 = require("react-intl");
|
|
1553
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
1623
1554
|
function TokenSendList({ close }) {
|
|
1624
1555
|
const isDownMd = useDownMd();
|
|
1625
1556
|
const walletAssets = useMatchWalletAssets();
|
|
@@ -1627,20 +1558,20 @@ function TokenSendList({ close }) {
|
|
|
1627
1558
|
list: walletAssets.mergedAssets
|
|
1628
1559
|
});
|
|
1629
1560
|
const { list } = useMatchChain();
|
|
1630
|
-
const [checked, setChecked] = (0,
|
|
1561
|
+
const [checked, setChecked] = (0, import_react23.useState)();
|
|
1631
1562
|
const modal = useModal();
|
|
1632
1563
|
const onNext = () => {
|
|
1633
1564
|
checked && modal.show((props) => {
|
|
1634
|
-
return /* @__PURE__ */ (0,
|
|
1565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(TokenSend, { onClose: () => {
|
|
1635
1566
|
props.close();
|
|
1636
1567
|
close();
|
|
1637
1568
|
}, onBack: props.close, zIndex: props.zIndex, token: checked });
|
|
1638
1569
|
});
|
|
1639
1570
|
};
|
|
1640
|
-
return /* @__PURE__ */ (0,
|
|
1641
|
-
/* @__PURE__ */ (0,
|
|
1571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "matchid-token-send-list-box", children: [
|
|
1572
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "matchid-token-send-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
1642
1573
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
1643
|
-
return /* @__PURE__ */ (0,
|
|
1574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
1644
1575
|
"div",
|
|
1645
1576
|
{
|
|
1646
1577
|
className: `matchid-token-send-item ${checked?.address == n.address ? "matchid-token-send-chekced" : ""}`,
|
|
@@ -1648,10 +1579,10 @@ function TokenSendList({ close }) {
|
|
|
1648
1579
|
setChecked(n);
|
|
1649
1580
|
},
|
|
1650
1581
|
children: [
|
|
1651
|
-
/* @__PURE__ */ (0,
|
|
1652
|
-
/* @__PURE__ */ (0,
|
|
1653
|
-
/* @__PURE__ */ (0,
|
|
1654
|
-
n.icon ? /* @__PURE__ */ (0,
|
|
1582
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Radio, { checked: checked?.address == n.address, size: isDownMd ? 18 : 24 }),
|
|
1583
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
1584
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "matchid-token-send-logo", children: [
|
|
1585
|
+
n.icon ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("img", { src: n.icon, alt: n.symbol, className: `matchid-token-send-icon` }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
1655
1586
|
AlphaAvatar,
|
|
1656
1587
|
{
|
|
1657
1588
|
className: `matchid-token-send-icon`,
|
|
@@ -1659,7 +1590,7 @@ function TokenSendList({ close }) {
|
|
|
1659
1590
|
name: n.symbol || n.name || ""
|
|
1660
1591
|
}
|
|
1661
1592
|
),
|
|
1662
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
1593
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
1663
1594
|
"img",
|
|
1664
1595
|
{
|
|
1665
1596
|
src: chain.iconUrl,
|
|
@@ -1668,9 +1599,9 @@ function TokenSendList({ close }) {
|
|
|
1668
1599
|
}
|
|
1669
1600
|
)
|
|
1670
1601
|
] }),
|
|
1671
|
-
/* @__PURE__ */ (0,
|
|
1672
|
-
/* @__PURE__ */ (0,
|
|
1673
|
-
/* @__PURE__ */ (0,
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-send-info`, children: [
|
|
1603
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: `matchid-token-send-name`, children: n.symbol }),
|
|
1604
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: `matchid-token-send-balance`, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(NumberFormatter, { value: n.balance, tFixNum: 3 }) })
|
|
1674
1605
|
] })
|
|
1675
1606
|
] })
|
|
1676
1607
|
]
|
|
@@ -1678,13 +1609,13 @@ function TokenSendList({ close }) {
|
|
|
1678
1609
|
index
|
|
1679
1610
|
);
|
|
1680
1611
|
}) }),
|
|
1681
|
-
/* @__PURE__ */ (0,
|
|
1612
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Button, { size: "lg", highlight: true, block: true, disabled: !checked, onClick: onNext, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react_intl15.FormattedMessage, { id: "next" }) })
|
|
1682
1613
|
] });
|
|
1683
1614
|
}
|
|
1684
1615
|
|
|
1685
1616
|
// src/components/TransactionList/index.tsx
|
|
1686
1617
|
var import_react_infinite_scroll_component = __toESM(require("react-infinite-scroll-component"));
|
|
1687
|
-
var
|
|
1618
|
+
var import_react24 = require("react");
|
|
1688
1619
|
var import_viem3 = require("viem");
|
|
1689
1620
|
var import_viem4 = require("viem");
|
|
1690
1621
|
|
|
@@ -1745,13 +1676,13 @@ var useContractStore = (0, import_zustand3.create)((0, import_middleware2.devtoo
|
|
|
1745
1676
|
var useContractStore_default = useContractStore;
|
|
1746
1677
|
|
|
1747
1678
|
// src/components/TransactionList/index.tsx
|
|
1748
|
-
var
|
|
1749
|
-
var
|
|
1679
|
+
var import_react_intl16 = require("react-intl");
|
|
1680
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
1750
1681
|
|
|
1751
1682
|
// src/components/CEXBindModal/index.tsx
|
|
1752
|
-
var
|
|
1753
|
-
var
|
|
1754
|
-
var
|
|
1683
|
+
var import_react25 = require("react");
|
|
1684
|
+
var import_react_intl17 = require("react-intl");
|
|
1685
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
1755
1686
|
|
|
1756
1687
|
// src/context/BusinessProvider.tsx
|
|
1757
1688
|
var import_react_query3 = require("@tanstack/react-query");
|
|
@@ -1769,15 +1700,15 @@ var useStore = (0, import_zustand4.create)((set) => ({
|
|
|
1769
1700
|
var useStore_default = useStore;
|
|
1770
1701
|
|
|
1771
1702
|
// src/context/BusinessProvider.tsx
|
|
1772
|
-
var
|
|
1703
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
1773
1704
|
|
|
1774
1705
|
// src/context/ModalContext.tsx
|
|
1775
|
-
var
|
|
1706
|
+
var import_react26 = require("react");
|
|
1776
1707
|
var import_react_dom = require("react-dom");
|
|
1777
|
-
var
|
|
1778
|
-
var ModalContext = (0,
|
|
1708
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
1709
|
+
var ModalContext = (0, import_react26.createContext)(null);
|
|
1779
1710
|
function useModal() {
|
|
1780
|
-
const context = (0,
|
|
1711
|
+
const context = (0, import_react26.useContext)(ModalContext);
|
|
1781
1712
|
if (!context) {
|
|
1782
1713
|
throw new Error("useModal must be used within a ModalProvider");
|
|
1783
1714
|
}
|
|
@@ -1785,12 +1716,12 @@ function useModal() {
|
|
|
1785
1716
|
}
|
|
1786
1717
|
|
|
1787
1718
|
// src/context/ToastContext.tsx
|
|
1788
|
-
var
|
|
1719
|
+
var import_react27 = require("react");
|
|
1789
1720
|
var import_react_dom2 = require("react-dom");
|
|
1790
|
-
var
|
|
1791
|
-
var ToastContext = (0,
|
|
1721
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
1722
|
+
var ToastContext = (0, import_react27.createContext)(null);
|
|
1792
1723
|
function useToast() {
|
|
1793
|
-
const context = (0,
|
|
1724
|
+
const context = (0, import_react27.useContext)(ToastContext);
|
|
1794
1725
|
if (!context) {
|
|
1795
1726
|
throw new Error("useToast must be used within a ToastProvider");
|
|
1796
1727
|
}
|
|
@@ -1798,23 +1729,23 @@ function useToast() {
|
|
|
1798
1729
|
}
|
|
1799
1730
|
|
|
1800
1731
|
// src/context/index.tsx
|
|
1801
|
-
var
|
|
1732
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
1802
1733
|
|
|
1803
1734
|
// src/hooks/useWalletInit.ts
|
|
1804
|
-
var
|
|
1735
|
+
var import_react28 = require("react");
|
|
1805
1736
|
var AppClientId = getAppClientId();
|
|
1806
1737
|
|
|
1807
1738
|
// src/hooks/useInit.tsx
|
|
1808
|
-
var
|
|
1739
|
+
var import_react29 = require("react");
|
|
1809
1740
|
|
|
1810
1741
|
// src/MatchContext.tsx
|
|
1811
1742
|
var import_react_query4 = require("@tanstack/react-query");
|
|
1812
|
-
var
|
|
1813
|
-
var
|
|
1743
|
+
var import_react_intl18 = require("react-intl");
|
|
1744
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
1814
1745
|
var queryClient = new import_react_query4.QueryClient();
|
|
1815
|
-
var MatchContext = (0,
|
|
1746
|
+
var MatchContext = (0, import_react30.createContext)(void 0);
|
|
1816
1747
|
var useMatch = () => {
|
|
1817
|
-
const context = (0,
|
|
1748
|
+
const context = (0, import_react30.useContext)(MatchContext);
|
|
1818
1749
|
if (context === void 0) {
|
|
1819
1750
|
throw new Error("useMatch must be used within a MatchProvider");
|
|
1820
1751
|
}
|
|
@@ -1837,14 +1768,17 @@ function useUserInfo() {
|
|
|
1837
1768
|
refreshOverview
|
|
1838
1769
|
} = useLocalStore_default();
|
|
1839
1770
|
const { setTgAppAuthCode, emailLoginKey, setEmailLoginKey } = useStore_default();
|
|
1771
|
+
const isDownMd = useDownMd();
|
|
1840
1772
|
const { events, login } = useMatch();
|
|
1841
|
-
const { open: SOLOpen } = useSOLModalStore();
|
|
1842
1773
|
const { open: TRONOpen } = useTRONModalStore();
|
|
1843
1774
|
const { open: TONOpen } = useTONModalStore();
|
|
1844
1775
|
const { open: BTCOpen } = useBTCModalStore();
|
|
1845
1776
|
const { open: CEXBindOpen } = useCEXBindModalStore();
|
|
1846
1777
|
const walletModalStore = useWalletModalStore();
|
|
1847
|
-
const
|
|
1778
|
+
const getRedirectUri = () => {
|
|
1779
|
+
return encodeURIComponent(window.location.href);
|
|
1780
|
+
};
|
|
1781
|
+
const isLogin = (0, import_react31.useMemo)(() => !!token && !!overview, [token, overview]);
|
|
1848
1782
|
const logout = async () => {
|
|
1849
1783
|
try {
|
|
1850
1784
|
await toLogoutApi();
|
|
@@ -1914,7 +1848,10 @@ function useUserInfo() {
|
|
|
1914
1848
|
case "evm":
|
|
1915
1849
|
return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`);
|
|
1916
1850
|
case "sol":
|
|
1917
|
-
|
|
1851
|
+
if (isDownMd) {
|
|
1852
|
+
return window.location.href = `${endpoints.auth}login/sol?appid=${appid}&locale=${locale}&redirect_uri=${getRedirectUri()}`;
|
|
1853
|
+
}
|
|
1854
|
+
return window.open(`${endpoints.auth}login/sol?appid=${appid}&locale=${locale}`);
|
|
1918
1855
|
case "tron":
|
|
1919
1856
|
return TRONOpen("login");
|
|
1920
1857
|
case "ton":
|
|
@@ -1956,7 +1893,7 @@ function useUserInfo() {
|
|
|
1956
1893
|
const res = await verifyEmailCodeApi(obj);
|
|
1957
1894
|
if (res && res.data && isSuccess(res)) {
|
|
1958
1895
|
await login({
|
|
1959
|
-
mid: res.data.mid,
|
|
1896
|
+
// mid: res.data.mid,
|
|
1960
1897
|
token: `${res.data.token_type} ${res.data.access_token}`
|
|
1961
1898
|
});
|
|
1962
1899
|
return true;
|
|
@@ -2003,7 +1940,10 @@ function useUserInfo() {
|
|
|
2003
1940
|
case "evm":
|
|
2004
1941
|
return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)));
|
|
2005
1942
|
case "sol":
|
|
2006
|
-
|
|
1943
|
+
if (isDownMd) {
|
|
1944
|
+
return window.location.href = `${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}&redirect_uri=${getRedirectUri()}`;
|
|
1945
|
+
}
|
|
1946
|
+
return window.open(`${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}`);
|
|
2007
1947
|
case "tron":
|
|
2008
1948
|
return TRONOpen("bind");
|
|
2009
1949
|
case "ton":
|
|
@@ -2101,9 +2041,9 @@ function useUserInfo() {
|
|
|
2101
2041
|
}
|
|
2102
2042
|
|
|
2103
2043
|
// src/hooks/useMatchEvents.ts
|
|
2104
|
-
var
|
|
2044
|
+
var import_react32 = require("react");
|
|
2105
2045
|
function useMatchEvents(handlers) {
|
|
2106
|
-
(0,
|
|
2046
|
+
(0, import_react32.useEffect)(() => {
|
|
2107
2047
|
Object.entries(handlers).forEach(([event, handler2]) => {
|
|
2108
2048
|
if (handler2) {
|
|
2109
2049
|
eventManager_default.on(event, handler2);
|
|
@@ -2123,7 +2063,7 @@ function useMatchEvents(handlers) {
|
|
|
2123
2063
|
var import_viem5 = require("viem");
|
|
2124
2064
|
var import_accounts = require("viem/accounts");
|
|
2125
2065
|
var import_viem6 = require("viem");
|
|
2126
|
-
var
|
|
2066
|
+
var import_react33 = require("react");
|
|
2127
2067
|
var import_viem7 = require("viem");
|
|
2128
2068
|
|
|
2129
2069
|
// src/store/useTransactionStore.ts
|
|
@@ -2157,9 +2097,9 @@ var useTransactionStore = (0, import_zustand5.create)((0, import_middleware3.dev
|
|
|
2157
2097
|
var useTransactionStore_default = useTransactionStore;
|
|
2158
2098
|
|
|
2159
2099
|
// src/hooks/useWallet.tsx
|
|
2160
|
-
var
|
|
2100
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
2161
2101
|
var AppClientId2 = "react-sdk-" + getVersion();
|
|
2162
|
-
function
|
|
2102
|
+
function useWallet() {
|
|
2163
2103
|
const { address, wallet: walletConfig } = useLocalStore_default();
|
|
2164
2104
|
const { walletReady } = useStore_default();
|
|
2165
2105
|
const modal = useModal();
|
|
@@ -2208,7 +2148,7 @@ function useWallet2() {
|
|
|
2208
2148
|
throw error;
|
|
2209
2149
|
}
|
|
2210
2150
|
};
|
|
2211
|
-
const evmAccount = (0,
|
|
2151
|
+
const evmAccount = (0, import_react33.useMemo)(() => {
|
|
2212
2152
|
try {
|
|
2213
2153
|
return address ? (0, import_accounts.toAccount)({
|
|
2214
2154
|
address,
|
|
@@ -2247,7 +2187,7 @@ function useWallet2() {
|
|
|
2247
2187
|
return void 0;
|
|
2248
2188
|
}
|
|
2249
2189
|
}, [address]);
|
|
2250
|
-
(0,
|
|
2190
|
+
(0, import_react33.useEffect)(() => {
|
|
2251
2191
|
matchlog_default.log("qwe-evmAccount", evmAccount);
|
|
2252
2192
|
}, [evmAccount]);
|
|
2253
2193
|
const realCreateWalletClient = (parameters) => {
|
|
@@ -2330,7 +2270,7 @@ function useWallet2() {
|
|
|
2330
2270
|
address: evmAccount.address
|
|
2331
2271
|
});
|
|
2332
2272
|
modal.show((props) => {
|
|
2333
|
-
return /* @__PURE__ */ (0,
|
|
2273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, hash: txHash, chain: _chain });
|
|
2334
2274
|
});
|
|
2335
2275
|
clearInterval(window.matchProvider.transactionMessageIntervalMap[transactionId].interval);
|
|
2336
2276
|
delete window.matchProvider.transactionMessageIntervalMap[transactionId];
|
|
@@ -2383,14 +2323,14 @@ function useWallet2() {
|
|
|
2383
2323
|
|
|
2384
2324
|
// src/hooks/useCopyClipboard.ts
|
|
2385
2325
|
var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
|
|
2386
|
-
var
|
|
2326
|
+
var import_react34 = require("react");
|
|
2387
2327
|
function useCopyClipboard(timeout = 500) {
|
|
2388
|
-
const [isCopied, setIsCopied] = (0,
|
|
2389
|
-
const staticCopy = (0,
|
|
2328
|
+
const [isCopied, setIsCopied] = (0, import_react34.useState)(false);
|
|
2329
|
+
const staticCopy = (0, import_react34.useCallback)((text) => {
|
|
2390
2330
|
const didCopy = (0, import_copy_to_clipboard.default)(text);
|
|
2391
2331
|
setIsCopied(didCopy);
|
|
2392
2332
|
}, []);
|
|
2393
|
-
(0,
|
|
2333
|
+
(0, import_react34.useEffect)(() => {
|
|
2394
2334
|
if (isCopied) {
|
|
2395
2335
|
const hide = setTimeout(() => {
|
|
2396
2336
|
setIsCopied(false);
|
|
@@ -2460,16 +2400,16 @@ function useImportTokenListQuery({
|
|
|
2460
2400
|
}
|
|
2461
2401
|
|
|
2462
2402
|
// src/hooks/useMatchChain.tsx
|
|
2463
|
-
var
|
|
2403
|
+
var import_react35 = require("react");
|
|
2464
2404
|
var import_viem8 = require("viem");
|
|
2465
|
-
var
|
|
2466
|
-
var
|
|
2405
|
+
var import_react_intl19 = require("react-intl");
|
|
2406
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
2467
2407
|
function useMatchChain() {
|
|
2468
2408
|
const chainListQuery = useChainListQuery();
|
|
2469
2409
|
const modal = useModal();
|
|
2470
|
-
const intl = (0,
|
|
2410
|
+
const intl = (0, import_react_intl19.useIntl)();
|
|
2471
2411
|
const { chainId: storeChainId, setChainId } = useLocalStore_default();
|
|
2472
|
-
const chainId = (0,
|
|
2412
|
+
const chainId = (0, import_react35.useMemo)(() => {
|
|
2473
2413
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
2474
2414
|
return null;
|
|
2475
2415
|
}
|
|
@@ -2478,7 +2418,7 @@ function useMatchChain() {
|
|
|
2478
2418
|
}
|
|
2479
2419
|
return chainListQuery.data[0].id;
|
|
2480
2420
|
}, [storeChainId, chainListQuery.data]);
|
|
2481
|
-
const chain = (0,
|
|
2421
|
+
const chain = (0, import_react35.useMemo)(() => {
|
|
2482
2422
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
2483
2423
|
return null;
|
|
2484
2424
|
}
|
|
@@ -2492,30 +2432,30 @@ function useMatchChain() {
|
|
|
2492
2432
|
close
|
|
2493
2433
|
}) {
|
|
2494
2434
|
const { chainId: storeChainId2, setChainId: setChainId2 } = useLocalStore_default();
|
|
2495
|
-
const [selectedChainId, setSelectedChainId] = (0,
|
|
2435
|
+
const [selectedChainId, setSelectedChainId] = (0, import_react35.useState)(storeChainId2);
|
|
2496
2436
|
const isDownMd = useDownMd();
|
|
2497
|
-
return /* @__PURE__ */ (0,
|
|
2498
|
-
/* @__PURE__ */ (0,
|
|
2499
|
-
return /* @__PURE__ */ (0,
|
|
2437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: `matchid-change-network-box`, children: [
|
|
2438
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: `matchid-change-network-list`, children: chainListQuery.data?.map((item, index) => {
|
|
2439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
2500
2440
|
"div",
|
|
2501
2441
|
{
|
|
2502
2442
|
onClick: () => setSelectedChainId(item.id),
|
|
2503
2443
|
className: `matchid-change-network-item ${selectedChainId == item.id ? "matchid-change-network-selected" : ""}`,
|
|
2504
2444
|
children: [
|
|
2505
|
-
/* @__PURE__ */ (0,
|
|
2506
|
-
/* @__PURE__ */ (0,
|
|
2507
|
-
/* @__PURE__ */ (0,
|
|
2445
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: `matchid-change-network-item-content`, children: [
|
|
2446
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("img", { src: item.iconUrl, className: `matchid-change-network-item-icon` }),
|
|
2447
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "matchid-change-network-item-name", children: item.name })
|
|
2508
2448
|
] }),
|
|
2509
|
-
/* @__PURE__ */ (0,
|
|
2449
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Radio, { checked: selectedChainId === item.id, size: isDownMd ? 18 : 24 })
|
|
2510
2450
|
]
|
|
2511
2451
|
},
|
|
2512
2452
|
index
|
|
2513
2453
|
);
|
|
2514
2454
|
}) }),
|
|
2515
|
-
/* @__PURE__ */ (0,
|
|
2455
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Button, { size: "lg", highlight: true, onClick: () => {
|
|
2516
2456
|
setChainId2(selectedChainId || 0);
|
|
2517
2457
|
close();
|
|
2518
|
-
}, block: true, children: /* @__PURE__ */ (0,
|
|
2458
|
+
}, block: true, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react_intl19.FormattedMessage, { id: "confirm" }) })
|
|
2519
2459
|
] });
|
|
2520
2460
|
}
|
|
2521
2461
|
const showChangeNetwork = () => {
|
|
@@ -2524,7 +2464,7 @@ function useMatchChain() {
|
|
|
2524
2464
|
content: ChangeNetwork
|
|
2525
2465
|
});
|
|
2526
2466
|
};
|
|
2527
|
-
const publicClient = (0,
|
|
2467
|
+
const publicClient = (0, import_react35.useMemo)(() => {
|
|
2528
2468
|
if (!chain) {
|
|
2529
2469
|
return null;
|
|
2530
2470
|
}
|
|
@@ -2552,14 +2492,14 @@ function useMatchChain() {
|
|
|
2552
2492
|
|
|
2553
2493
|
// src/hooks/useMatchWallet.tsx
|
|
2554
2494
|
var import_react_qrcode = require("react-qrcode");
|
|
2555
|
-
var
|
|
2495
|
+
var import_react37 = require("react");
|
|
2556
2496
|
var import_react_query8 = require("@tanstack/react-query");
|
|
2557
2497
|
var import_viem11 = require("viem");
|
|
2558
|
-
var
|
|
2498
|
+
var import_react_intl21 = require("react-intl");
|
|
2559
2499
|
|
|
2560
2500
|
// src/components/ImportToken/index.tsx
|
|
2561
|
-
var
|
|
2562
|
-
var
|
|
2501
|
+
var import_react36 = require("react");
|
|
2502
|
+
var import_react_intl20 = require("react-intl");
|
|
2563
2503
|
var import_react_query7 = require("@tanstack/react-query");
|
|
2564
2504
|
var import_viem10 = require("viem");
|
|
2565
2505
|
|
|
@@ -2588,14 +2528,14 @@ function useIsContract({
|
|
|
2588
2528
|
}
|
|
2589
2529
|
|
|
2590
2530
|
// src/components/ImportToken/index.tsx
|
|
2591
|
-
var
|
|
2531
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
2592
2532
|
function ImportToken({ close }) {
|
|
2593
|
-
const [status, setStatus] = (0,
|
|
2533
|
+
const [status, setStatus] = (0, import_react36.useState)("");
|
|
2594
2534
|
const { token } = useUserInfo();
|
|
2595
|
-
const [address, setAddress] = (0,
|
|
2596
|
-
const [symbol, setSymbol] = (0,
|
|
2597
|
-
const [decimals, setDecimals] = (0,
|
|
2598
|
-
const [error, setError] = (0,
|
|
2535
|
+
const [address, setAddress] = (0, import_react36.useState)("");
|
|
2536
|
+
const [symbol, setSymbol] = (0, import_react36.useState)("");
|
|
2537
|
+
const [decimals, setDecimals] = (0, import_react36.useState)("");
|
|
2538
|
+
const [error, setError] = (0, import_react36.useState)({});
|
|
2599
2539
|
const { publicClient, chainId, chain } = useMatchChain();
|
|
2600
2540
|
const getContractInfo = async () => {
|
|
2601
2541
|
if (!publicClient) return;
|
|
@@ -2628,8 +2568,8 @@ function ImportToken({ close }) {
|
|
|
2628
2568
|
});
|
|
2629
2569
|
}
|
|
2630
2570
|
};
|
|
2631
|
-
const intl = (0,
|
|
2632
|
-
(0,
|
|
2571
|
+
const intl = (0, import_react_intl20.useIntl)();
|
|
2572
|
+
(0, import_react36.useEffect)(() => {
|
|
2633
2573
|
if (address.length === 42) {
|
|
2634
2574
|
const reg = /^0x[0-9a-fA-F]{40}$/;
|
|
2635
2575
|
if (!reg.test(address)) {
|
|
@@ -2648,7 +2588,7 @@ function ImportToken({ close }) {
|
|
|
2648
2588
|
}
|
|
2649
2589
|
}
|
|
2650
2590
|
}, [address, publicClient]);
|
|
2651
|
-
const [loading, setLoading] = (0,
|
|
2591
|
+
const [loading, setLoading] = (0, import_react36.useState)(false);
|
|
2652
2592
|
const toast = useToast();
|
|
2653
2593
|
const queryClient2 = (0, import_react_query7.useQueryClient)();
|
|
2654
2594
|
const onImport = async () => {
|
|
@@ -2676,7 +2616,7 @@ function ImportToken({ close }) {
|
|
|
2676
2616
|
setLoading(false);
|
|
2677
2617
|
}
|
|
2678
2618
|
};
|
|
2679
|
-
const canImport = (0,
|
|
2619
|
+
const canImport = (0, import_react36.useMemo)(() => {
|
|
2680
2620
|
if (!address) {
|
|
2681
2621
|
return false;
|
|
2682
2622
|
}
|
|
@@ -2699,19 +2639,19 @@ function ImportToken({ close }) {
|
|
|
2699
2639
|
enabled: canImport
|
|
2700
2640
|
});
|
|
2701
2641
|
if (status == "success" || status == "fail") {
|
|
2702
|
-
return /* @__PURE__ */ (0,
|
|
2703
|
-
/* @__PURE__ */ (0,
|
|
2704
|
-
/* @__PURE__ */ (0,
|
|
2705
|
-
/* @__PURE__ */ (0,
|
|
2642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: `matchid-import-token-result matchid-flex`, children: [
|
|
2643
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: `matchid-import-token-result-box matchid-flex`, children: [
|
|
2644
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("img", { src: status == "success" ? success_default : fail_default, alt: status == "success" ? "success" : "fail", className: `matchid-import-token-result-img` }),
|
|
2645
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: `matchid-import-token-result-text matchid-import-token-result-text-${status}`, children: status == "success" ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl20.FormattedMessage, { id: "importSuccess" }) : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl20.FormattedMessage, { id: "importFail" }) })
|
|
2706
2646
|
] }),
|
|
2707
|
-
status == "success" ? /* @__PURE__ */ (0,
|
|
2647
|
+
status == "success" ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Button, { size: "lg", onClick: close, block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl20.FormattedMessage, { id: "close" }) }) : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Button, { size: "lg", onClick: () => setStatus(""), block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl20.FormattedMessage, { id: "back" }) })
|
|
2708
2648
|
] });
|
|
2709
2649
|
}
|
|
2710
|
-
return /* @__PURE__ */ (0,
|
|
2711
|
-
/* @__PURE__ */ (0,
|
|
2712
|
-
/* @__PURE__ */ (0,
|
|
2650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: `matchid-import-token`, children: [
|
|
2651
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "matchid-import-token-form", children: [
|
|
2652
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Field, { label: intl.formatMessage({
|
|
2713
2653
|
id: "tokenSmartContract"
|
|
2714
|
-
}), error: error.address ? error.address : isContractQuery.isFetched && !isContractQuery.isLoading && !isContractQuery.data && canImport ? "Address isn't a contract address" : "", children: /* @__PURE__ */ (0,
|
|
2654
|
+
}), error: error.address ? error.address : isContractQuery.isFetched && !isContractQuery.isLoading && !isContractQuery.data && canImport ? "Address isn't a contract address" : "", children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
2715
2655
|
Input,
|
|
2716
2656
|
{
|
|
2717
2657
|
placeholder: intl.formatMessage({
|
|
@@ -2722,9 +2662,9 @@ function ImportToken({ close }) {
|
|
|
2722
2662
|
maxLength: 42
|
|
2723
2663
|
}
|
|
2724
2664
|
) }),
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2665
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Field, { label: intl.formatMessage({
|
|
2726
2666
|
id: "tokenSymbol"
|
|
2727
|
-
}), error: error.symbol, children: /* @__PURE__ */ (0,
|
|
2667
|
+
}), error: error.symbol, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
2728
2668
|
Input,
|
|
2729
2669
|
{
|
|
2730
2670
|
placeholder: intl.formatMessage({
|
|
@@ -2735,9 +2675,9 @@ function ImportToken({ close }) {
|
|
|
2735
2675
|
maxLength: 16
|
|
2736
2676
|
}
|
|
2737
2677
|
) }),
|
|
2738
|
-
/* @__PURE__ */ (0,
|
|
2678
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Field, { label: intl.formatMessage({
|
|
2739
2679
|
id: "tokenDecimals"
|
|
2740
|
-
}), error: error.decimals, children: /* @__PURE__ */ (0,
|
|
2680
|
+
}), error: error.decimals, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
2741
2681
|
Input,
|
|
2742
2682
|
{
|
|
2743
2683
|
placeholder: intl.formatMessage({
|
|
@@ -2749,7 +2689,7 @@ function ImportToken({ close }) {
|
|
|
2749
2689
|
}
|
|
2750
2690
|
) })
|
|
2751
2691
|
] }),
|
|
2752
|
-
/* @__PURE__ */ (0,
|
|
2692
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
2753
2693
|
Button,
|
|
2754
2694
|
{
|
|
2755
2695
|
size: "lg",
|
|
@@ -2758,20 +2698,20 @@ function ImportToken({ close }) {
|
|
|
2758
2698
|
loading: loading || isContractQuery.isLoading,
|
|
2759
2699
|
disabled: !canImport || !isContractQuery.data,
|
|
2760
2700
|
highlight: true,
|
|
2761
|
-
children: /* @__PURE__ */ (0,
|
|
2701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl20.FormattedMessage, { id: "import" })
|
|
2762
2702
|
}
|
|
2763
2703
|
)
|
|
2764
2704
|
] });
|
|
2765
2705
|
}
|
|
2766
2706
|
|
|
2767
2707
|
// src/hooks/useMatchWallet.tsx
|
|
2768
|
-
var
|
|
2708
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
2769
2709
|
var ReceiveModal = () => {
|
|
2770
2710
|
const chain = useMatchChain();
|
|
2771
|
-
const { address } =
|
|
2711
|
+
const { address } = useWallet();
|
|
2772
2712
|
const [copied, setCopied] = useCopyClipboard();
|
|
2773
2713
|
const toast = useToast();
|
|
2774
|
-
const intl = (0,
|
|
2714
|
+
const intl = (0, import_react_intl21.useIntl)();
|
|
2775
2715
|
const onCopy = () => {
|
|
2776
2716
|
setCopied(address);
|
|
2777
2717
|
toast.success(intl.formatMessage({
|
|
@@ -2779,10 +2719,10 @@ var ReceiveModal = () => {
|
|
|
2779
2719
|
}));
|
|
2780
2720
|
};
|
|
2781
2721
|
const chainLink = chain.explorerLink("address/" + address);
|
|
2782
|
-
return /* @__PURE__ */ (0,
|
|
2783
|
-
/* @__PURE__ */ (0,
|
|
2784
|
-
/* @__PURE__ */ (0,
|
|
2785
|
-
/* @__PURE__ */ (0,
|
|
2722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: `matchid-receive-modal`, children: [
|
|
2723
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "matchid-receive-container", children: [
|
|
2724
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: `matchid-receive-text`, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_intl21.FormattedMessage, { id: "receiveQrcode" }) }),
|
|
2725
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: `matchid-qr-container`, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
2786
2726
|
import_react_qrcode.QRCode,
|
|
2787
2727
|
{
|
|
2788
2728
|
margin: "0",
|
|
@@ -2790,7 +2730,7 @@ var ReceiveModal = () => {
|
|
|
2790
2730
|
value: address
|
|
2791
2731
|
}
|
|
2792
2732
|
) }),
|
|
2793
|
-
/* @__PURE__ */ (0,
|
|
2733
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
2794
2734
|
"a",
|
|
2795
2735
|
{
|
|
2796
2736
|
href: chainLink,
|
|
@@ -2800,8 +2740,8 @@ var ReceiveModal = () => {
|
|
|
2800
2740
|
}
|
|
2801
2741
|
)
|
|
2802
2742
|
] }),
|
|
2803
|
-
/* @__PURE__ */ (0,
|
|
2804
|
-
|
|
2743
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Button, { size: "lg", onClick: onCopy, block: true, highlight: true, disabled: copied, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
2744
|
+
import_react_intl21.FormattedMessage,
|
|
2805
2745
|
{
|
|
2806
2746
|
id: "copyAddress"
|
|
2807
2747
|
}
|
|
@@ -2810,7 +2750,7 @@ var ReceiveModal = () => {
|
|
|
2810
2750
|
};
|
|
2811
2751
|
function useMatchWallet() {
|
|
2812
2752
|
const modal = useModal();
|
|
2813
|
-
const intl = (0,
|
|
2753
|
+
const intl = (0, import_react_intl21.useIntl)();
|
|
2814
2754
|
const showReceiveModal = () => {
|
|
2815
2755
|
modal.open({
|
|
2816
2756
|
title: intl.formatMessage({
|
|
@@ -2842,12 +2782,12 @@ function useMatchWallet() {
|
|
|
2842
2782
|
};
|
|
2843
2783
|
}
|
|
2844
2784
|
function useMatchWalletRecords() {
|
|
2845
|
-
const [hasMore, setHasMore] = (0,
|
|
2846
|
-
const [items, setItems] = (0,
|
|
2785
|
+
const [hasMore, setHasMore] = (0, import_react37.useState)(true);
|
|
2786
|
+
const [items, setItems] = (0, import_react37.useState)([]);
|
|
2847
2787
|
const { chainId, publicClient } = useMatchChain();
|
|
2848
|
-
const { address } =
|
|
2849
|
-
const hasMoreRef = (0,
|
|
2850
|
-
const nextPageParamsRef = (0,
|
|
2788
|
+
const { address } = useWallet();
|
|
2789
|
+
const hasMoreRef = (0, import_react37.useRef)(hasMore);
|
|
2790
|
+
const nextPageParamsRef = (0, import_react37.useRef)(void 0);
|
|
2851
2791
|
const { contracts, setContracts } = useContractStore_default();
|
|
2852
2792
|
const fetchMoreData = async () => {
|
|
2853
2793
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
@@ -2874,7 +2814,7 @@ function useMatchWalletRecords() {
|
|
|
2874
2814
|
hasMoreRef.current = true;
|
|
2875
2815
|
fetchMoreData();
|
|
2876
2816
|
};
|
|
2877
|
-
(0,
|
|
2817
|
+
(0, import_react37.useEffect)(() => {
|
|
2878
2818
|
if (chainId && address) {
|
|
2879
2819
|
onInit();
|
|
2880
2820
|
}
|
|
@@ -2930,7 +2870,7 @@ function useMatchWalletRecords() {
|
|
|
2930
2870
|
setContracts(contractMap);
|
|
2931
2871
|
}
|
|
2932
2872
|
};
|
|
2933
|
-
const list = (0,
|
|
2873
|
+
const list = (0, import_react37.useMemo)(() => {
|
|
2934
2874
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
2935
2875
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
2936
2876
|
removeList.forEach((item) => {
|
|
@@ -2972,7 +2912,7 @@ function useMatchWalletAssets({
|
|
|
2972
2912
|
chainId: chainId || 0,
|
|
2973
2913
|
...assetListOptions
|
|
2974
2914
|
});
|
|
2975
|
-
const mergedAssets = (0,
|
|
2915
|
+
const mergedAssets = (0, import_react37.useMemo)(() => {
|
|
2976
2916
|
if (!assetListQuery.data && !importTokenQuery.data) return [];
|
|
2977
2917
|
const assetList = (assetListQuery.data || []).map((asset) => ({
|
|
2978
2918
|
...asset,
|
|
@@ -3030,7 +2970,7 @@ function useMatchWalletAssetList({
|
|
|
3030
2970
|
list
|
|
3031
2971
|
}) {
|
|
3032
2972
|
const { publicClient, chain } = useMatchChain();
|
|
3033
|
-
const { address } =
|
|
2973
|
+
const { address } = useWallet();
|
|
3034
2974
|
const { assets, setAssets } = useLocalStore_default();
|
|
3035
2975
|
const nativeToken = list.find((asset) => asset.address.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase()) || {
|
|
3036
2976
|
chain_id: chain?.id || "",
|
|
@@ -3059,7 +2999,7 @@ function useMatchWalletAssetList({
|
|
|
3059
2999
|
retry: 3
|
|
3060
3000
|
// Retry up to 3 times if failed
|
|
3061
3001
|
});
|
|
3062
|
-
const erc20Tokens = (0,
|
|
3002
|
+
const erc20Tokens = (0, import_react37.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
|
|
3063
3003
|
const erc20BalanceQuery = (0, import_react_query8.useQuery)({
|
|
3064
3004
|
queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
|
|
3065
3005
|
queryFn: async () => {
|
|
@@ -3087,7 +3027,7 @@ function useMatchWalletAssetList({
|
|
|
3087
3027
|
// Refresh every 15 seconds
|
|
3088
3028
|
retry: 3
|
|
3089
3029
|
});
|
|
3090
|
-
const enrichedAssets = (0,
|
|
3030
|
+
const enrichedAssets = (0, import_react37.useMemo)(() => {
|
|
3091
3031
|
if (!list) return [];
|
|
3092
3032
|
const erc20Balances = erc20BalanceQuery.data || [];
|
|
3093
3033
|
return list.map((asset) => {
|
|
@@ -3109,7 +3049,7 @@ function useMatchWalletAssetList({
|
|
|
3109
3049
|
return { ...asset, balance, value, balanceValue };
|
|
3110
3050
|
});
|
|
3111
3051
|
}, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
|
|
3112
|
-
(0,
|
|
3052
|
+
(0, import_react37.useEffect)(() => {
|
|
3113
3053
|
const list2 = enrichedAssets.sort((a, b) => {
|
|
3114
3054
|
if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
|
|
3115
3055
|
if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
|
|
@@ -3134,14 +3074,14 @@ function useMatchWalletAssetList({
|
|
|
3134
3074
|
}
|
|
3135
3075
|
|
|
3136
3076
|
// src/hooks/useReceipt.tsx
|
|
3137
|
-
var
|
|
3077
|
+
var import_react38 = require("react");
|
|
3138
3078
|
var import_react_query9 = require("@tanstack/react-query");
|
|
3139
3079
|
var import_viem12 = require("viem");
|
|
3140
3080
|
var CACHE_TTL = 86400 * 30 * 1e3;
|
|
3141
3081
|
var MAX_CACHE_SIZE = 500;
|
|
3142
3082
|
var STORAGE_KEY = "match_receipt_logs";
|
|
3143
3083
|
function useReceiptCache() {
|
|
3144
|
-
const [cache, setCache] = (0,
|
|
3084
|
+
const [cache, setCache] = (0, import_react38.useState)(/* @__PURE__ */ new Map());
|
|
3145
3085
|
const isLocalStorageAvailable = (() => {
|
|
3146
3086
|
try {
|
|
3147
3087
|
const testKey = "__test__";
|
|
@@ -3152,7 +3092,7 @@ function useReceiptCache() {
|
|
|
3152
3092
|
return false;
|
|
3153
3093
|
}
|
|
3154
3094
|
})();
|
|
3155
|
-
(0,
|
|
3095
|
+
(0, import_react38.useEffect)(() => {
|
|
3156
3096
|
if (isLocalStorageAvailable) {
|
|
3157
3097
|
try {
|
|
3158
3098
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -3171,7 +3111,7 @@ function useReceiptCache() {
|
|
|
3171
3111
|
}
|
|
3172
3112
|
}
|
|
3173
3113
|
}, []);
|
|
3174
|
-
const updateLocalStorage = (0,
|
|
3114
|
+
const updateLocalStorage = (0, import_react38.useCallback)((updatedCache) => {
|
|
3175
3115
|
if (isLocalStorageAvailable) {
|
|
3176
3116
|
try {
|
|
3177
3117
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -3188,7 +3128,7 @@ function useReceiptCache() {
|
|
|
3188
3128
|
}
|
|
3189
3129
|
}
|
|
3190
3130
|
}, []);
|
|
3191
|
-
const set = (0,
|
|
3131
|
+
const set = (0, import_react38.useCallback)((key, value) => {
|
|
3192
3132
|
const now = Date.now();
|
|
3193
3133
|
const newCache = new Map(cache);
|
|
3194
3134
|
newCache.forEach((entry, k) => {
|
|
@@ -3206,7 +3146,7 @@ function useReceiptCache() {
|
|
|
3206
3146
|
setCache(newCache);
|
|
3207
3147
|
updateLocalStorage(newCache);
|
|
3208
3148
|
}, [cache, updateLocalStorage]);
|
|
3209
|
-
const get = (0,
|
|
3149
|
+
const get = (0, import_react38.useCallback)((key) => {
|
|
3210
3150
|
const entry = cache.get(key);
|
|
3211
3151
|
if (entry) {
|
|
3212
3152
|
if (Date.now() - entry.timestamp > CACHE_TTL) {
|
|
@@ -3220,7 +3160,7 @@ function useReceiptCache() {
|
|
|
3220
3160
|
}
|
|
3221
3161
|
return void 0;
|
|
3222
3162
|
}, [cache, updateLocalStorage]);
|
|
3223
|
-
const del = (0,
|
|
3163
|
+
const del = (0, import_react38.useCallback)((key) => {
|
|
3224
3164
|
if (cache.has(key)) {
|
|
3225
3165
|
const newCache = new Map(cache);
|
|
3226
3166
|
newCache.delete(key);
|
|
@@ -3228,7 +3168,7 @@ function useReceiptCache() {
|
|
|
3228
3168
|
updateLocalStorage(newCache);
|
|
3229
3169
|
}
|
|
3230
3170
|
}, [cache, updateLocalStorage]);
|
|
3231
|
-
const clear = (0,
|
|
3171
|
+
const clear = (0, import_react38.useCallback)(() => {
|
|
3232
3172
|
setCache(/* @__PURE__ */ new Map());
|
|
3233
3173
|
if (isLocalStorageAvailable) {
|
|
3234
3174
|
localStorage.removeItem(STORAGE_KEY);
|
|
@@ -3243,7 +3183,7 @@ function useReceipt2({
|
|
|
3243
3183
|
const { list } = useMatchChain();
|
|
3244
3184
|
const cache = useReceiptCache();
|
|
3245
3185
|
const chain = list?.find((item) => item.id === chainId);
|
|
3246
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
3186
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react38.useState)(true);
|
|
3247
3187
|
const query = (0, import_react_query9.useQuery)({
|
|
3248
3188
|
queryKey: ["match-tx-receipt", hash, chain],
|
|
3249
3189
|
queryFn: async () => {
|
|
@@ -3269,7 +3209,7 @@ function useReceipt2({
|
|
|
3269
3209
|
},
|
|
3270
3210
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
3271
3211
|
});
|
|
3272
|
-
(0,
|
|
3212
|
+
(0, import_react38.useEffect)(() => {
|
|
3273
3213
|
if (query.data) {
|
|
3274
3214
|
setShouldRefetch(false);
|
|
3275
3215
|
}
|
|
@@ -3278,14 +3218,14 @@ function useReceipt2({
|
|
|
3278
3218
|
}
|
|
3279
3219
|
|
|
3280
3220
|
// src/hooks/useTransaction.tsx
|
|
3281
|
-
var
|
|
3221
|
+
var import_react39 = require("react");
|
|
3282
3222
|
var import_react_query10 = require("@tanstack/react-query");
|
|
3283
3223
|
var import_viem13 = require("viem");
|
|
3284
3224
|
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
3285
3225
|
var MAX_CACHE_SIZE2 = 500;
|
|
3286
3226
|
var STORAGE_KEY2 = "match_transaction_logs";
|
|
3287
3227
|
function useTransactionCache() {
|
|
3288
|
-
const [cache, setCache] = (0,
|
|
3228
|
+
const [cache, setCache] = (0, import_react39.useState)(/* @__PURE__ */ new Map());
|
|
3289
3229
|
const isLocalStorageAvailable = (() => {
|
|
3290
3230
|
try {
|
|
3291
3231
|
const testKey = "__test__";
|
|
@@ -3296,7 +3236,7 @@ function useTransactionCache() {
|
|
|
3296
3236
|
return false;
|
|
3297
3237
|
}
|
|
3298
3238
|
})();
|
|
3299
|
-
(0,
|
|
3239
|
+
(0, import_react39.useEffect)(() => {
|
|
3300
3240
|
if (isLocalStorageAvailable) {
|
|
3301
3241
|
try {
|
|
3302
3242
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -3315,7 +3255,7 @@ function useTransactionCache() {
|
|
|
3315
3255
|
}
|
|
3316
3256
|
}
|
|
3317
3257
|
}, []);
|
|
3318
|
-
const updateLocalStorage = (0,
|
|
3258
|
+
const updateLocalStorage = (0, import_react39.useCallback)((updatedCache) => {
|
|
3319
3259
|
if (isLocalStorageAvailable) {
|
|
3320
3260
|
try {
|
|
3321
3261
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -3332,7 +3272,7 @@ function useTransactionCache() {
|
|
|
3332
3272
|
}
|
|
3333
3273
|
}
|
|
3334
3274
|
}, []);
|
|
3335
|
-
const set = (0,
|
|
3275
|
+
const set = (0, import_react39.useCallback)((key, value) => {
|
|
3336
3276
|
const now = Date.now();
|
|
3337
3277
|
const newCache = new Map(cache);
|
|
3338
3278
|
newCache.forEach((entry, k) => {
|
|
@@ -3350,7 +3290,7 @@ function useTransactionCache() {
|
|
|
3350
3290
|
setCache(newCache);
|
|
3351
3291
|
updateLocalStorage(newCache);
|
|
3352
3292
|
}, [cache, updateLocalStorage]);
|
|
3353
|
-
const get = (0,
|
|
3293
|
+
const get = (0, import_react39.useCallback)((key) => {
|
|
3354
3294
|
const entry = cache.get(key);
|
|
3355
3295
|
if (entry) {
|
|
3356
3296
|
if (Date.now() - entry.timestamp > CACHE_TTL2) {
|
|
@@ -3364,7 +3304,7 @@ function useTransactionCache() {
|
|
|
3364
3304
|
}
|
|
3365
3305
|
return void 0;
|
|
3366
3306
|
}, [cache, updateLocalStorage]);
|
|
3367
|
-
const del = (0,
|
|
3307
|
+
const del = (0, import_react39.useCallback)((key) => {
|
|
3368
3308
|
if (cache.has(key)) {
|
|
3369
3309
|
const newCache = new Map(cache);
|
|
3370
3310
|
newCache.delete(key);
|
|
@@ -3372,7 +3312,7 @@ function useTransactionCache() {
|
|
|
3372
3312
|
updateLocalStorage(newCache);
|
|
3373
3313
|
}
|
|
3374
3314
|
}, [cache, updateLocalStorage]);
|
|
3375
|
-
const clear = (0,
|
|
3315
|
+
const clear = (0, import_react39.useCallback)(() => {
|
|
3376
3316
|
setCache(/* @__PURE__ */ new Map());
|
|
3377
3317
|
if (isLocalStorageAvailable) {
|
|
3378
3318
|
localStorage.removeItem(STORAGE_KEY2);
|
|
@@ -3387,7 +3327,7 @@ function useTransaction({
|
|
|
3387
3327
|
const { list } = useMatchChain();
|
|
3388
3328
|
const cache = useTransactionCache();
|
|
3389
3329
|
const chain = list?.find((item) => item.id === chainId);
|
|
3390
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
3330
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react39.useState)(true);
|
|
3391
3331
|
const query = (0, import_react_query10.useQuery)({
|
|
3392
3332
|
queryKey: ["match-tx-transaction", hash, chain],
|
|
3393
3333
|
queryFn: async () => {
|
|
@@ -3413,7 +3353,7 @@ function useTransaction({
|
|
|
3413
3353
|
},
|
|
3414
3354
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
3415
3355
|
});
|
|
3416
|
-
(0,
|
|
3356
|
+
(0, import_react39.useEffect)(() => {
|
|
3417
3357
|
if (query.data) {
|
|
3418
3358
|
setShouldRefetch(false);
|
|
3419
3359
|
}
|