@matchain/matchid-sdk-react 0.1.53-alpha.8 → 0.1.54
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 +2 -2
- package/dist/assets/icon/index.d.ts +2 -2
- package/dist/{chunk-X5HGL3ZX.mjs → chunk-ZPBHHXEE.mjs} +7689 -338
- package/dist/chunk-ZPBHHXEE.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 +363 -343
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +9 -11
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +493 -478
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +2 -3
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +258 -248
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +3 -5
- package/dist/{index-D5WIVIkc.d.ts → index-91BdMYDA.d.ts} +4 -2
- package/dist/{index-BVfCh4l-.d.mts → index-CPk553v5.d.mts} +1 -1
- package/dist/{index-D7S5DMUy.d.mts → index-CPwcm70o.d.mts} +3 -3
- package/dist/{index-zc2GEzJ9.d.ts → index-CZu_8fKl.d.ts} +40 -39
- package/dist/{index-SOVt-ADK.d.mts → index-ChHJD4NZ.d.mts} +4 -2
- package/dist/{index-CQmN0dN4.d.ts → index-CkHDxE7B.d.mts} +16 -4
- package/dist/{index-C0UKUm0h.d.ts → index-D5geEbXf.d.ts} +4 -3
- package/dist/{index-D3Kp05kW.d.ts → index-DFBrN7dx.d.ts} +1 -1
- package/dist/{index-DC4F1u-w.d.mts → index-DSvRdAyZ.d.mts} +4 -3
- package/dist/{index-DjbH13zc.d.mts → index-DX1vzCrM.d.mts} +40 -39
- package/dist/{index-DQFQ39D9.d.ts → index-Dj1K-UdZ.d.ts} +3 -3
- package/dist/{index-BDffLLM_.d.mts → index-DjwwXNp4.d.mts} +15 -3
- package/dist/{index-BaFmUVw-.d.mts → index-SRHVQn5G.d.ts} +16 -4
- package/dist/{index-BsX-ovIl.d.ts → index-Vxvd14yW.d.ts} +15 -3
- package/dist/index.css +141 -34
- package/dist/index.d.mts +758 -11
- package/dist/index.d.ts +758 -11
- package/dist/index.js +3859 -3738
- 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-VrV1kYga.d.mts → types-Bi9iq57H.d.mts} +13 -1
- package/dist/{types-VrV1kYga.d.ts → types-Bi9iq57H.d.ts} +13 -1
- package/dist/ui/index.d.mts +3 -3
- package/dist/ui/index.d.ts +3 -3
- package/dist/ui/index.js +937 -160
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +6 -1
- package/example/package.json +1 -0
- package/example/src/App.tsx +24 -20
- package/package.json +1 -1
- package/dist/chunk-QTUR37B2.mjs +0 -7275
- package/dist/chunk-QTUR37B2.mjs.map +0 -1
- package/dist/chunk-X5HGL3ZX.mjs.map +0 -1
package/dist/hooks/index.js
CHANGED
|
@@ -356,10 +356,10 @@ var localStore = useLocalStore;
|
|
|
356
356
|
var useLocalStore_default = useLocalStore;
|
|
357
357
|
|
|
358
358
|
// src/hooks/useUserInfo.tsx
|
|
359
|
-
var
|
|
359
|
+
var import_react36 = require("react");
|
|
360
360
|
|
|
361
361
|
// src/MatchContext.tsx
|
|
362
|
-
var
|
|
362
|
+
var import_react35 = require("react");
|
|
363
363
|
|
|
364
364
|
// src/store/useModalStore.ts
|
|
365
365
|
var import_zustand2 = require("zustand");
|
|
@@ -691,7 +691,10 @@ var useWalletModalStore = (0, import_zustand2.create)((set) => ({
|
|
|
691
691
|
}));
|
|
692
692
|
|
|
693
693
|
// src/components/EmailModal/index.tsx
|
|
694
|
-
var
|
|
694
|
+
var import_react7 = require("react");
|
|
695
|
+
|
|
696
|
+
// src/ui/Modal/index.tsx
|
|
697
|
+
var import_react3 = require("react");
|
|
695
698
|
|
|
696
699
|
// src/ui/Overlay/index.tsx
|
|
697
700
|
var import_react2 = require("react");
|
|
@@ -724,6 +727,7 @@ function Overlay({
|
|
|
724
727
|
}
|
|
725
728
|
|
|
726
729
|
// src/ui/Modal/index.tsx
|
|
730
|
+
var import_react_intl = require("react-intl");
|
|
727
731
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
728
732
|
function Modal({
|
|
729
733
|
children,
|
|
@@ -762,7 +766,7 @@ function ModalWithHeader({
|
|
|
762
766
|
}
|
|
763
767
|
|
|
764
768
|
// src/components/EmailModal/StepEmail.tsx
|
|
765
|
-
var
|
|
769
|
+
var import_react5 = require("react");
|
|
766
770
|
|
|
767
771
|
// src/utils/index.tsx
|
|
768
772
|
var import_moment = __toESM(require("moment"));
|
|
@@ -862,7 +866,8 @@ function Button({
|
|
|
862
866
|
type = "button",
|
|
863
867
|
rounded = true,
|
|
864
868
|
className = "",
|
|
865
|
-
style = {}
|
|
869
|
+
style = {},
|
|
870
|
+
dataset = {}
|
|
866
871
|
}) {
|
|
867
872
|
const onAction = () => {
|
|
868
873
|
if (!disabled && !loading) {
|
|
@@ -879,13 +884,14 @@ function Button({
|
|
|
879
884
|
...style
|
|
880
885
|
},
|
|
881
886
|
onClick: onAction,
|
|
887
|
+
...dataset,
|
|
882
888
|
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(LoadingIcon_default, { className: "matchid-btn-loading-icon", color: "var(--matchid-btn-loading-color)" }) : children
|
|
883
889
|
}
|
|
884
890
|
);
|
|
885
891
|
}
|
|
886
892
|
|
|
887
893
|
// src/ui/Input/index.tsx
|
|
888
|
-
var
|
|
894
|
+
var import_react4 = require("react");
|
|
889
895
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
890
896
|
function Input({
|
|
891
897
|
onChange,
|
|
@@ -894,7 +900,7 @@ function Input({
|
|
|
894
900
|
className = "",
|
|
895
901
|
...props
|
|
896
902
|
}) {
|
|
897
|
-
const [inputType, setInputType] = (0,
|
|
903
|
+
const [inputType, setInputType] = (0, import_react4.useState)(type);
|
|
898
904
|
const isDownMd = useDownMd();
|
|
899
905
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
900
906
|
"div",
|
|
@@ -943,30 +949,30 @@ function Field({
|
|
|
943
949
|
}
|
|
944
950
|
|
|
945
951
|
// src/components/EmailModal/StepEmail.tsx
|
|
946
|
-
var
|
|
952
|
+
var import_react_intl2 = require("react-intl");
|
|
947
953
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
948
954
|
|
|
949
955
|
// src/components/EmailModal/StepVerify.tsx
|
|
950
|
-
var
|
|
956
|
+
var import_react6 = require("react");
|
|
951
957
|
|
|
952
958
|
// src/config/index.tsx
|
|
953
959
|
var NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
954
960
|
|
|
955
961
|
// src/components/EmailModal/StepVerify.tsx
|
|
956
|
-
var
|
|
962
|
+
var import_react_intl3 = require("react-intl");
|
|
957
963
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
958
964
|
|
|
959
965
|
// src/components/EmailModal/index.tsx
|
|
960
|
-
var
|
|
966
|
+
var import_react_intl4 = require("react-intl");
|
|
961
967
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
962
968
|
|
|
963
969
|
// src/ui/Popover/index.tsx
|
|
964
|
-
var
|
|
970
|
+
var import_react8 = require("react");
|
|
965
971
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
966
972
|
|
|
967
973
|
// src/components/LoginBox/index.tsx
|
|
968
|
-
var
|
|
969
|
-
var
|
|
974
|
+
var import_react9 = require("react");
|
|
975
|
+
var import_react_intl5 = require("react-intl");
|
|
970
976
|
|
|
971
977
|
// src/hooks/useAppConfig.ts
|
|
972
978
|
var import_react_query = require("@tanstack/react-query");
|
|
@@ -975,32 +981,32 @@ var import_react_query = require("@tanstack/react-query");
|
|
|
975
981
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
976
982
|
|
|
977
983
|
// src/components/LoginButton/index.tsx
|
|
978
|
-
var
|
|
984
|
+
var import_react11 = require("react");
|
|
979
985
|
|
|
980
986
|
// src/components/LoginPanel/index.tsx
|
|
981
|
-
var
|
|
987
|
+
var import_react_intl6 = require("react-intl");
|
|
982
988
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
983
989
|
|
|
984
990
|
// src/components/LoginModal/index.tsx
|
|
985
991
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
986
992
|
|
|
987
993
|
// src/components/UserPopover/index.tsx
|
|
988
|
-
var
|
|
994
|
+
var import_react10 = require("react");
|
|
989
995
|
|
|
990
996
|
// src/assets/icon/ProfileIcon.tsx
|
|
991
997
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
992
998
|
|
|
993
999
|
// src/components/UserPopover/index.tsx
|
|
994
|
-
var
|
|
1000
|
+
var import_react_intl7 = require("react-intl");
|
|
995
1001
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
996
1002
|
|
|
997
1003
|
// src/components/LoginButton/index.tsx
|
|
998
|
-
var
|
|
1004
|
+
var import_react_intl8 = require("react-intl");
|
|
999
1005
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
1000
1006
|
|
|
1001
1007
|
// src/components/UsernameModal/index.tsx
|
|
1002
|
-
var
|
|
1003
|
-
var
|
|
1008
|
+
var import_react12 = require("react");
|
|
1009
|
+
var import_react_intl9 = require("react-intl");
|
|
1004
1010
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
1005
1011
|
|
|
1006
1012
|
// src/ui/Drawer/index.tsx
|
|
@@ -1030,7 +1036,7 @@ function Drawer({
|
|
|
1030
1036
|
}
|
|
1031
1037
|
|
|
1032
1038
|
// src/ui/HashPanel/index.tsx
|
|
1033
|
-
var
|
|
1039
|
+
var import_react13 = require("react");
|
|
1034
1040
|
|
|
1035
1041
|
// src/ui/ModalDrawer/index.tsx
|
|
1036
1042
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
@@ -1107,7 +1113,7 @@ function HashPanel({
|
|
|
1107
1113
|
onClose,
|
|
1108
1114
|
zIndex
|
|
1109
1115
|
}) {
|
|
1110
|
-
const [status, setStatus] = (0,
|
|
1116
|
+
const [status, setStatus] = (0, import_react13.useState)("confirm");
|
|
1111
1117
|
const statusMaps = {
|
|
1112
1118
|
"confirm": {
|
|
1113
1119
|
icon: confirm_default,
|
|
@@ -1131,8 +1137,8 @@ function HashPanel({
|
|
|
1131
1137
|
}
|
|
1132
1138
|
};
|
|
1133
1139
|
const statusValue = statusMaps[status];
|
|
1134
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
1135
|
-
(0,
|
|
1140
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react13.useState)(true);
|
|
1141
|
+
(0, import_react13.useEffect)(() => {
|
|
1136
1142
|
if (hash) {
|
|
1137
1143
|
setShouldRefetch(true);
|
|
1138
1144
|
setStatus("pending");
|
|
@@ -1145,7 +1151,7 @@ function HashPanel({
|
|
|
1145
1151
|
chain,
|
|
1146
1152
|
refetchInterval: shouldRefetch ? 3e3 : false
|
|
1147
1153
|
});
|
|
1148
|
-
(0,
|
|
1154
|
+
(0, import_react13.useEffect)(() => {
|
|
1149
1155
|
if (hashQuery.data == 1 || hashQuery.data == -1) {
|
|
1150
1156
|
setShouldRefetch(false);
|
|
1151
1157
|
}
|
|
@@ -1199,7 +1205,7 @@ function HashPanel_default(props) {
|
|
|
1199
1205
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
1200
1206
|
|
|
1201
1207
|
// src/ui/AlphaAvatar/index.tsx
|
|
1202
|
-
var
|
|
1208
|
+
var import_react14 = require("react");
|
|
1203
1209
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
1204
1210
|
function AlphaAvatar({
|
|
1205
1211
|
name,
|
|
@@ -1207,7 +1213,7 @@ function AlphaAvatar({
|
|
|
1207
1213
|
className = "",
|
|
1208
1214
|
style
|
|
1209
1215
|
}) {
|
|
1210
|
-
const avatar = (0,
|
|
1216
|
+
const avatar = (0, import_react14.useMemo)(() => {
|
|
1211
1217
|
if (name) {
|
|
1212
1218
|
const char = name[0].toUpperCase();
|
|
1213
1219
|
if (char.match(/[a-zA-Z0-9]/)) {
|
|
@@ -1254,7 +1260,7 @@ var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
|
1254
1260
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
1255
1261
|
|
|
1256
1262
|
// src/components/EVMModal/index.tsx
|
|
1257
|
-
var
|
|
1263
|
+
var import_react17 = require("react");
|
|
1258
1264
|
|
|
1259
1265
|
// src/hooks/eventManager.ts
|
|
1260
1266
|
var EventManager = class {
|
|
@@ -1285,85 +1291,21 @@ var eventManager = new EventManager();
|
|
|
1285
1291
|
var eventManager_default = eventManager;
|
|
1286
1292
|
|
|
1287
1293
|
// src/components/EVMModal/index.tsx
|
|
1288
|
-
var
|
|
1294
|
+
var import_react_intl10 = require("react-intl");
|
|
1289
1295
|
|
|
1290
1296
|
// src/components/WalletModalContent/index.tsx
|
|
1291
|
-
var
|
|
1297
|
+
var import_react15 = require("react");
|
|
1292
1298
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
1293
1299
|
|
|
1294
1300
|
// src/components/EVMModal/index.tsx
|
|
1295
|
-
var import_chains = require("wagmi/chains");
|
|
1296
1301
|
var import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
1297
1302
|
var import_wagmi2 = require("wagmi");
|
|
1298
|
-
var import_wallets = require("@rainbow-me/rainbowkit/wallets");
|
|
1299
|
-
|
|
1300
|
-
// src/config/chains/MatchMain.ts
|
|
1301
|
-
var import_viem2 = require("viem");
|
|
1302
|
-
var matchMain = /* @__PURE__ */ (0, import_viem2.defineChain)({
|
|
1303
|
-
//定义match链
|
|
1304
|
-
id: 698,
|
|
1305
|
-
name: "Matchain",
|
|
1306
|
-
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
1307
|
-
rpcUrls: {
|
|
1308
|
-
default: {
|
|
1309
|
-
http: ["https://rpc.matchain.io"]
|
|
1310
|
-
}
|
|
1311
|
-
},
|
|
1312
|
-
blockExplorers: {
|
|
1313
|
-
default: {
|
|
1314
|
-
name: "Matchscan",
|
|
1315
|
-
url: "https://matchscan.io/",
|
|
1316
|
-
apiUrl: "https://matchscan.io/api"
|
|
1317
|
-
}
|
|
1318
|
-
},
|
|
1319
|
-
iconUrl: "https://matchscan.io/static/identicon_logos/blockies.png",
|
|
1320
|
-
contracts: {
|
|
1321
|
-
multicall3: {
|
|
1322
|
-
address: "0xca11bde05977b3631167028862be2a173976ca11"
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
// testnet: true,
|
|
1326
|
-
});
|
|
1327
|
-
|
|
1328
|
-
// src/config/chains/MatchTest.ts
|
|
1329
|
-
var import_viem3 = require("viem");
|
|
1330
|
-
var matchTest = /* @__PURE__ */ (0, import_viem3.defineChain)({
|
|
1331
|
-
//定义matchTest链
|
|
1332
|
-
id: 699,
|
|
1333
|
-
name: "MatchTest",
|
|
1334
|
-
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
1335
|
-
rpcUrls: {
|
|
1336
|
-
default: {
|
|
1337
|
-
http: ["https://testnet-rpc.matchain.io"]
|
|
1338
|
-
}
|
|
1339
|
-
},
|
|
1340
|
-
blockExplorers: {
|
|
1341
|
-
default: {
|
|
1342
|
-
name: "Matchscan",
|
|
1343
|
-
url: "https://testnet.matchscan.io/",
|
|
1344
|
-
apiUrl: "https://testnet.matchscan.io/api"
|
|
1345
|
-
}
|
|
1346
|
-
},
|
|
1347
|
-
iconUrl: "https://testnet.matchscan.io/static/identicon_logos/blockies.png",
|
|
1348
|
-
contracts: {
|
|
1349
|
-
multicall3: {
|
|
1350
|
-
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
1351
|
-
blockCreated: 751532
|
|
1352
|
-
},
|
|
1353
|
-
ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
|
|
1354
|
-
ensUniversalResolver: {
|
|
1355
|
-
address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",
|
|
1356
|
-
blockCreated: 5317080
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
// testnet: true,
|
|
1360
|
-
});
|
|
1361
1303
|
|
|
1362
1304
|
// src/hooks/useWalletBox.ts
|
|
1363
|
-
var
|
|
1305
|
+
var import_react16 = require("react");
|
|
1364
1306
|
|
|
1365
1307
|
// src/hooks/useEthersSigner.ts
|
|
1366
|
-
var
|
|
1308
|
+
var React5 = __toESM(require("react"));
|
|
1367
1309
|
var import_wagmi = require("wagmi");
|
|
1368
1310
|
var import_ethers = require("ethers");
|
|
1369
1311
|
|
|
@@ -1371,64 +1313,47 @@ var import_ethers = require("ethers");
|
|
|
1371
1313
|
var import_siwe = require("siwe");
|
|
1372
1314
|
var import_styles = require("@rainbow-me/rainbowkit/styles.css");
|
|
1373
1315
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
1374
|
-
var wagmiConfig = (0, import_rainbowkit.getDefaultConfig)({
|
|
1375
|
-
appName: "MatchID",
|
|
1376
|
-
projectId: "9ac6ea7e07860f04616fb311b447dee9",
|
|
1377
|
-
wallets: [
|
|
1378
|
-
{
|
|
1379
|
-
groupName: "Recommended",
|
|
1380
|
-
wallets: [
|
|
1381
|
-
import_wallets.metaMaskWallet,
|
|
1382
|
-
import_wallets.walletConnectWallet,
|
|
1383
|
-
import_wallets.okxWallet,
|
|
1384
|
-
import_wallets.bitgetWallet,
|
|
1385
|
-
import_wallets.injectedWallet
|
|
1386
|
-
]
|
|
1387
|
-
}
|
|
1388
|
-
],
|
|
1389
|
-
chains: [import_chains.mainnet, import_chains.polygon, import_chains.optimism, import_chains.arbitrum, import_chains.base, matchMain, matchTest, import_chains.bsc]
|
|
1390
|
-
});
|
|
1391
1316
|
|
|
1392
1317
|
// src/components/TRONModal/index.tsx
|
|
1393
|
-
var
|
|
1394
|
-
var
|
|
1318
|
+
var import_react19 = __toESM(require("react"));
|
|
1319
|
+
var import_react_intl11 = require("react-intl");
|
|
1395
1320
|
|
|
1396
1321
|
// src/hooks/useTRONWallet.ts
|
|
1397
|
-
var
|
|
1322
|
+
var import_react18 = require("react");
|
|
1398
1323
|
|
|
1399
1324
|
// src/components/TRONModal/index.tsx
|
|
1400
1325
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
1401
1326
|
|
|
1402
1327
|
// src/components/TONModal/index.tsx
|
|
1403
|
-
var
|
|
1404
|
-
var
|
|
1328
|
+
var import_react20 = __toESM(require("react"));
|
|
1329
|
+
var import_react_intl12 = require("react-intl");
|
|
1405
1330
|
var import_ui_react = require("@tonconnect/ui-react");
|
|
1406
1331
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
1407
1332
|
|
|
1408
1333
|
// src/components/BTCModal/index.tsx
|
|
1409
|
-
var
|
|
1410
|
-
var
|
|
1334
|
+
var import_react22 = __toESM(require("react"));
|
|
1335
|
+
var import_react_intl13 = require("react-intl");
|
|
1411
1336
|
|
|
1412
1337
|
// src/lib/btc/XverseAdapter.ts
|
|
1413
1338
|
var import_sats_connect = require("sats-connect");
|
|
1414
1339
|
|
|
1415
1340
|
// src/hooks/useBTCWallet.ts
|
|
1416
|
-
var
|
|
1341
|
+
var import_react21 = require("react");
|
|
1417
1342
|
|
|
1418
1343
|
// src/components/BTCModal/index.tsx
|
|
1419
1344
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
1420
1345
|
|
|
1421
1346
|
// src/components/WalletModal/index.tsx
|
|
1422
|
-
var
|
|
1423
|
-
var
|
|
1347
|
+
var import_react23 = require("react");
|
|
1348
|
+
var import_react_intl14 = require("react-intl");
|
|
1424
1349
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
1425
1350
|
|
|
1426
1351
|
// src/components/AlphaAvatar/index.tsx
|
|
1427
|
-
var
|
|
1352
|
+
var import_react24 = require("react");
|
|
1428
1353
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
1429
1354
|
function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
1430
|
-
const [avatar, setAvatar] = (0,
|
|
1431
|
-
(0,
|
|
1355
|
+
const [avatar, setAvatar] = (0, import_react24.useState)(void 0);
|
|
1356
|
+
(0, import_react24.useEffect)(() => {
|
|
1432
1357
|
if (name) {
|
|
1433
1358
|
const char = name[0].toUpperCase();
|
|
1434
1359
|
setAvatar(char);
|
|
@@ -1445,9 +1370,9 @@ function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
|
1445
1370
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
1446
1371
|
|
|
1447
1372
|
// src/components/TokenSend/index.tsx
|
|
1448
|
-
var
|
|
1449
|
-
var
|
|
1450
|
-
var
|
|
1373
|
+
var import_react25 = require("react");
|
|
1374
|
+
var import_viem2 = require("viem");
|
|
1375
|
+
var import_react_intl15 = require("react-intl");
|
|
1451
1376
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
1452
1377
|
function Input2({
|
|
1453
1378
|
onChange,
|
|
@@ -1480,36 +1405,36 @@ function TokenSend({
|
|
|
1480
1405
|
onBack
|
|
1481
1406
|
}) {
|
|
1482
1407
|
const { list: chainList } = useMatchChain();
|
|
1483
|
-
const intl = (0,
|
|
1408
|
+
const intl = (0, import_react_intl15.useIntl)();
|
|
1484
1409
|
const { createWalletClient: createWalletClient2 } = useWallet();
|
|
1485
1410
|
const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
|
|
1486
|
-
const chain = (0,
|
|
1411
|
+
const chain = (0, import_react25.useMemo)(() => {
|
|
1487
1412
|
return chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
1488
1413
|
}, [chainList, token.chain_id]);
|
|
1489
|
-
const walletClient = (0,
|
|
1414
|
+
const walletClient = (0, import_react25.useMemo)(() => {
|
|
1490
1415
|
return createWalletClient2({
|
|
1491
1416
|
// @ts-ignore
|
|
1492
|
-
chain: (0,
|
|
1493
|
-
transport: (0,
|
|
1417
|
+
chain: (0, import_viem2.defineChain)(chain),
|
|
1418
|
+
transport: (0, import_viem2.http)()
|
|
1494
1419
|
});
|
|
1495
1420
|
}, [chain]);
|
|
1496
|
-
const [amount, setAmount] = (0,
|
|
1497
|
-
const [address, setAddress] = (0,
|
|
1498
|
-
const [loading, setLoading] = (0,
|
|
1499
|
-
const [sending, setSending] = (0,
|
|
1500
|
-
const [txError, setTxError] = (0,
|
|
1501
|
-
const transaction = (0,
|
|
1421
|
+
const [amount, setAmount] = (0, import_react25.useState)("");
|
|
1422
|
+
const [address, setAddress] = (0, import_react25.useState)("");
|
|
1423
|
+
const [loading, setLoading] = (0, import_react25.useState)(false);
|
|
1424
|
+
const [sending, setSending] = (0, import_react25.useState)(false);
|
|
1425
|
+
const [txError, setTxError] = (0, import_react25.useState)("");
|
|
1426
|
+
const transaction = (0, import_react25.useMemo)(() => {
|
|
1502
1427
|
const reg = /^0x[a-fA-F0-9]{40}$/;
|
|
1503
1428
|
if (!amount || !address || !reg.test(address)) {
|
|
1504
1429
|
return;
|
|
1505
1430
|
}
|
|
1506
|
-
const viemChain = (0,
|
|
1431
|
+
const viemChain = (0, import_viem2.defineChain)(chain);
|
|
1507
1432
|
const to = isNative ? address : token.address;
|
|
1508
|
-
const value = isNative ? (0,
|
|
1509
|
-
const data = isNative ? "0x" : (0,
|
|
1510
|
-
abi:
|
|
1433
|
+
const value = isNative ? (0, import_viem2.parseUnits)(amount, parseInt(token?.decimals || "18")) : BigInt(0);
|
|
1434
|
+
const data = isNative ? "0x" : (0, import_viem2.encodeFunctionData)({
|
|
1435
|
+
abi: import_viem2.erc20Abi,
|
|
1511
1436
|
functionName: "transfer",
|
|
1512
|
-
args: [address, (0,
|
|
1437
|
+
args: [address, (0, import_viem2.parseUnits)(amount, parseInt(token?.decimals || "18"))]
|
|
1513
1438
|
});
|
|
1514
1439
|
return {
|
|
1515
1440
|
to,
|
|
@@ -1529,7 +1454,7 @@ function TokenSend({
|
|
|
1529
1454
|
setLoading(false);
|
|
1530
1455
|
}
|
|
1531
1456
|
};
|
|
1532
|
-
const error = (0,
|
|
1457
|
+
const error = (0, import_react25.useMemo)(() => {
|
|
1533
1458
|
setTxError("");
|
|
1534
1459
|
let amountError = "";
|
|
1535
1460
|
let addressError = "";
|
|
@@ -1572,7 +1497,7 @@ function TokenSend({
|
|
|
1572
1497
|
setAmount(value);
|
|
1573
1498
|
}
|
|
1574
1499
|
};
|
|
1575
|
-
const canSend = (0,
|
|
1500
|
+
const canSend = (0, import_react25.useMemo)(() => {
|
|
1576
1501
|
return !error.amount && !error.address && amount && address;
|
|
1577
1502
|
}, [error]);
|
|
1578
1503
|
const onNext = async () => {
|
|
@@ -1582,7 +1507,7 @@ function TokenSend({
|
|
|
1582
1507
|
}
|
|
1583
1508
|
onClose();
|
|
1584
1509
|
};
|
|
1585
|
-
(0,
|
|
1510
|
+
(0, import_react25.useEffect)(() => {
|
|
1586
1511
|
const receiveMessage = (event) => {
|
|
1587
1512
|
if (event.data) {
|
|
1588
1513
|
if (event.data.source == "match-wallet") {
|
|
@@ -1598,11 +1523,11 @@ function TokenSend({
|
|
|
1598
1523
|
window.removeEventListener("message", receiveMessage);
|
|
1599
1524
|
};
|
|
1600
1525
|
}, []);
|
|
1601
|
-
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ModalDrawer, { isOpen: true, onClose, zIndex, title: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
1526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ModalDrawer, { isOpen: true, onClose, zIndex, title: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react_intl15.FormattedMessage, { id: "send" }), onBack, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-send-box`, children: [
|
|
1602
1527
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
1603
1528
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-amount-content`, children: [
|
|
1604
1529
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-amount-header`, children: [
|
|
1605
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: `matchid-token-amount-title`, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
1530
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: `matchid-token-amount-title`, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react_intl15.FormattedMessage, { id: "amount" }) }),
|
|
1606
1531
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-amount-chain`, children: [
|
|
1607
1532
|
token.icon ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
1608
1533
|
"img",
|
|
@@ -1630,7 +1555,7 @@ function TokenSend({
|
|
|
1630
1555
|
),
|
|
1631
1556
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-amount-footer`, children: [
|
|
1632
1557
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-amount-title`, children: [
|
|
1633
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
1558
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react_intl15.FormattedMessage, { id: "balance" }),
|
|
1634
1559
|
":"
|
|
1635
1560
|
] }),
|
|
1636
1561
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: `matchid-token-amount-value`, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(NumberFormatter, { value: token.balance, tFixNum: 10, suffix: " " + token.symbol }) })
|
|
@@ -1638,7 +1563,7 @@ function TokenSend({
|
|
|
1638
1563
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(TransferIcon, { className: "matchid-token-amount-transfer" })
|
|
1639
1564
|
] }),
|
|
1640
1565
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-address-content`, children: [
|
|
1641
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: `matchid-token-address-header`, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: `matchid-token-address-title`, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
1566
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: `matchid-token-address-header`, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: `matchid-token-address-title`, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react_intl15.FormattedMessage, { id: "receiveTitle" }) }) }),
|
|
1642
1567
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
1643
1568
|
Input2,
|
|
1644
1569
|
{
|
|
@@ -1664,19 +1589,19 @@ function TokenSend({
|
|
|
1664
1589
|
disabled: !canSend || !!txError,
|
|
1665
1590
|
onClick: onNext,
|
|
1666
1591
|
loading: loading || sending,
|
|
1667
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
1592
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react_intl15.FormattedMessage, { id: "next" })
|
|
1668
1593
|
}
|
|
1669
1594
|
)
|
|
1670
1595
|
] }) });
|
|
1671
1596
|
}
|
|
1672
1597
|
|
|
1673
1598
|
// src/components/TokenDetail/index.tsx
|
|
1674
|
-
var
|
|
1599
|
+
var import_react_intl16 = require("react-intl");
|
|
1675
1600
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
1676
1601
|
|
|
1677
1602
|
// src/components/TokenSendList/index.tsx
|
|
1678
|
-
var
|
|
1679
|
-
var
|
|
1603
|
+
var import_react26 = require("react");
|
|
1604
|
+
var import_react_intl17 = require("react-intl");
|
|
1680
1605
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
1681
1606
|
function TokenSendList({ close }) {
|
|
1682
1607
|
const isDownMd = useDownMd();
|
|
@@ -1685,7 +1610,7 @@ function TokenSendList({ close }) {
|
|
|
1685
1610
|
list: walletAssets.mergedAssets
|
|
1686
1611
|
});
|
|
1687
1612
|
const { list } = useMatchChain();
|
|
1688
|
-
const [checked, setChecked] = (0,
|
|
1613
|
+
const [checked, setChecked] = (0, import_react26.useState)();
|
|
1689
1614
|
const modal = useModal();
|
|
1690
1615
|
const onNext = () => {
|
|
1691
1616
|
checked && modal.show((props) => {
|
|
@@ -1736,15 +1661,15 @@ function TokenSendList({ close }) {
|
|
|
1736
1661
|
index
|
|
1737
1662
|
);
|
|
1738
1663
|
}) }),
|
|
1739
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Button, { size: "lg", highlight: true, block: true, disabled: !checked, onClick: onNext, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
1664
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Button, { size: "lg", highlight: true, block: true, disabled: !checked, onClick: onNext, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react_intl17.FormattedMessage, { id: "next" }) })
|
|
1740
1665
|
] });
|
|
1741
1666
|
}
|
|
1742
1667
|
|
|
1743
1668
|
// src/components/TransactionList/index.tsx
|
|
1744
1669
|
var import_react_infinite_scroll_component = __toESM(require("react-infinite-scroll-component"));
|
|
1745
|
-
var
|
|
1746
|
-
var
|
|
1747
|
-
var
|
|
1670
|
+
var import_react27 = require("react");
|
|
1671
|
+
var import_viem3 = require("viem");
|
|
1672
|
+
var import_viem4 = require("viem");
|
|
1748
1673
|
|
|
1749
1674
|
// src/store/useContractStore.ts
|
|
1750
1675
|
var import_zustand3 = require("zustand");
|
|
@@ -1803,7 +1728,7 @@ var useContractStore = (0, import_zustand3.create)((0, import_middleware2.devtoo
|
|
|
1803
1728
|
var useContractStore_default = useContractStore;
|
|
1804
1729
|
|
|
1805
1730
|
// src/components/TransactionList/index.tsx
|
|
1806
|
-
var
|
|
1731
|
+
var import_react_intl18 = require("react-intl");
|
|
1807
1732
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
1808
1733
|
|
|
1809
1734
|
// src/hooks/api/bind.ts
|
|
@@ -1870,17 +1795,17 @@ function useImportTokenListQuery({
|
|
|
1870
1795
|
// src/hooks/api/contact.ts
|
|
1871
1796
|
var import_react_query6 = require("@tanstack/react-query");
|
|
1872
1797
|
var import_last = __toESM(require("lodash/last"));
|
|
1873
|
-
var
|
|
1798
|
+
var import_react28 = require("react");
|
|
1874
1799
|
|
|
1875
1800
|
// src/components/ContactList/index.tsx
|
|
1876
1801
|
var import_react_virtuoso = require("react-virtuoso");
|
|
1877
|
-
var
|
|
1878
|
-
var
|
|
1802
|
+
var import_react29 = require("react");
|
|
1803
|
+
var import_react_intl19 = require("react-intl");
|
|
1879
1804
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
1880
1805
|
|
|
1881
1806
|
// src/components/CEXBindModal/index.tsx
|
|
1882
|
-
var
|
|
1883
|
-
var
|
|
1807
|
+
var import_react30 = require("react");
|
|
1808
|
+
var import_react_intl20 = require("react-intl");
|
|
1884
1809
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
1885
1810
|
|
|
1886
1811
|
// src/context/BusinessProvider.tsx
|
|
@@ -1902,12 +1827,12 @@ var useStore_default = useStore;
|
|
|
1902
1827
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
1903
1828
|
|
|
1904
1829
|
// src/context/ModalContext.tsx
|
|
1905
|
-
var
|
|
1830
|
+
var import_react31 = __toESM(require("react"));
|
|
1906
1831
|
var import_react_dom = require("react-dom");
|
|
1907
1832
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
1908
|
-
var ModalContext = (0,
|
|
1833
|
+
var ModalContext = (0, import_react31.createContext)(null);
|
|
1909
1834
|
function useModal() {
|
|
1910
|
-
const context = (0,
|
|
1835
|
+
const context = (0, import_react31.useContext)(ModalContext);
|
|
1911
1836
|
if (!context) {
|
|
1912
1837
|
throw new Error("useModal must be used within a ModalProvider");
|
|
1913
1838
|
}
|
|
@@ -1915,12 +1840,12 @@ function useModal() {
|
|
|
1915
1840
|
}
|
|
1916
1841
|
|
|
1917
1842
|
// src/context/ToastContext.tsx
|
|
1918
|
-
var
|
|
1843
|
+
var import_react32 = require("react");
|
|
1919
1844
|
var import_react_dom2 = require("react-dom");
|
|
1920
1845
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
1921
|
-
var ToastContext = (0,
|
|
1846
|
+
var ToastContext = (0, import_react32.createContext)(null);
|
|
1922
1847
|
function useToast() {
|
|
1923
|
-
const context = (0,
|
|
1848
|
+
const context = (0, import_react32.useContext)(ToastContext);
|
|
1924
1849
|
if (!context) {
|
|
1925
1850
|
throw new Error("useToast must be used within a ToastProvider");
|
|
1926
1851
|
}
|
|
@@ -1931,20 +1856,105 @@ function useToast() {
|
|
|
1931
1856
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
1932
1857
|
|
|
1933
1858
|
// src/hooks/useWalletInit.ts
|
|
1934
|
-
var
|
|
1859
|
+
var import_react33 = require("react");
|
|
1935
1860
|
var AppClientId = getAppClientId();
|
|
1936
1861
|
|
|
1937
1862
|
// src/hooks/useInit.tsx
|
|
1938
|
-
var
|
|
1863
|
+
var import_react34 = require("react");
|
|
1939
1864
|
|
|
1940
1865
|
// src/MatchContext.tsx
|
|
1941
1866
|
var import_react_query8 = require("@tanstack/react-query");
|
|
1942
|
-
var
|
|
1867
|
+
var import_react_intl21 = require("react-intl");
|
|
1868
|
+
var import_rainbowkit2 = require("@rainbow-me/rainbowkit");
|
|
1869
|
+
var import_wallets = require("@rainbow-me/rainbowkit/wallets");
|
|
1870
|
+
var import_chains = require("wagmi/chains");
|
|
1871
|
+
|
|
1872
|
+
// src/config/chains/MatchMain.ts
|
|
1873
|
+
var import_viem5 = require("viem");
|
|
1874
|
+
var matchMain = /* @__PURE__ */ (0, import_viem5.defineChain)({
|
|
1875
|
+
//定义match链
|
|
1876
|
+
id: 698,
|
|
1877
|
+
name: "Matchain",
|
|
1878
|
+
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
1879
|
+
rpcUrls: {
|
|
1880
|
+
default: {
|
|
1881
|
+
http: ["https://rpc.matchain.io"]
|
|
1882
|
+
}
|
|
1883
|
+
},
|
|
1884
|
+
blockExplorers: {
|
|
1885
|
+
default: {
|
|
1886
|
+
name: "Matchscan",
|
|
1887
|
+
url: "https://matchscan.io/",
|
|
1888
|
+
apiUrl: "https://matchscan.io/api"
|
|
1889
|
+
}
|
|
1890
|
+
},
|
|
1891
|
+
iconUrl: "https://matchscan.io/static/identicon_logos/blockies.png",
|
|
1892
|
+
contracts: {
|
|
1893
|
+
multicall3: {
|
|
1894
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11"
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
// testnet: true,
|
|
1898
|
+
});
|
|
1899
|
+
|
|
1900
|
+
// src/config/chains/MatchTest.ts
|
|
1901
|
+
var import_viem6 = require("viem");
|
|
1902
|
+
var matchTest = /* @__PURE__ */ (0, import_viem6.defineChain)({
|
|
1903
|
+
//定义matchTest链
|
|
1904
|
+
id: 699,
|
|
1905
|
+
name: "MatchTest",
|
|
1906
|
+
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
1907
|
+
rpcUrls: {
|
|
1908
|
+
default: {
|
|
1909
|
+
http: ["https://testnet-rpc.matchain.io"]
|
|
1910
|
+
}
|
|
1911
|
+
},
|
|
1912
|
+
blockExplorers: {
|
|
1913
|
+
default: {
|
|
1914
|
+
name: "Matchscan",
|
|
1915
|
+
url: "https://testnet.matchscan.io/",
|
|
1916
|
+
apiUrl: "https://testnet.matchscan.io/api"
|
|
1917
|
+
}
|
|
1918
|
+
},
|
|
1919
|
+
iconUrl: "https://testnet.matchscan.io/static/identicon_logos/blockies.png",
|
|
1920
|
+
contracts: {
|
|
1921
|
+
multicall3: {
|
|
1922
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
1923
|
+
blockCreated: 751532
|
|
1924
|
+
},
|
|
1925
|
+
ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
|
|
1926
|
+
ensUniversalResolver: {
|
|
1927
|
+
address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",
|
|
1928
|
+
blockCreated: 5317080
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
// testnet: true,
|
|
1932
|
+
});
|
|
1933
|
+
|
|
1934
|
+
// src/MatchContext.tsx
|
|
1935
|
+
var import_wagmi3 = require("wagmi");
|
|
1943
1936
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
1944
1937
|
var queryClient = new import_react_query8.QueryClient();
|
|
1945
|
-
var
|
|
1938
|
+
var wagmiConfig = (0, import_rainbowkit2.getDefaultConfig)({
|
|
1939
|
+
appName: "MatchID",
|
|
1940
|
+
projectId: "9ac6ea7e07860f04616fb311b447dee9",
|
|
1941
|
+
wallets: [
|
|
1942
|
+
{
|
|
1943
|
+
groupName: "Recommended",
|
|
1944
|
+
wallets: [
|
|
1945
|
+
import_wallets.metaMaskWallet,
|
|
1946
|
+
import_wallets.walletConnectWallet,
|
|
1947
|
+
import_wallets.okxWallet,
|
|
1948
|
+
import_wallets.bitgetWallet,
|
|
1949
|
+
import_wallets.injectedWallet
|
|
1950
|
+
]
|
|
1951
|
+
}
|
|
1952
|
+
],
|
|
1953
|
+
chains: [import_chains.mainnet, import_chains.polygon, import_chains.optimism, import_chains.arbitrum, import_chains.base, matchMain, matchTest, import_chains.bsc]
|
|
1954
|
+
});
|
|
1955
|
+
var MatchContext = (0, import_react35.createContext)(void 0);
|
|
1946
1956
|
var useMatch = () => {
|
|
1947
|
-
const context = (0,
|
|
1957
|
+
const context = (0, import_react35.useContext)(MatchContext);
|
|
1948
1958
|
if (context === void 0) {
|
|
1949
1959
|
throw new Error("useMatch must be used within a MatchProvider");
|
|
1950
1960
|
}
|
|
@@ -1978,7 +1988,7 @@ function useUserInfo() {
|
|
|
1978
1988
|
const getRedirectUri = () => {
|
|
1979
1989
|
return encodeURIComponent(window.location.href);
|
|
1980
1990
|
};
|
|
1981
|
-
const isLogin = (0,
|
|
1991
|
+
const isLogin = (0, import_react36.useMemo)(() => !!token && !!overview, [token, overview]);
|
|
1982
1992
|
const logout = async () => {
|
|
1983
1993
|
try {
|
|
1984
1994
|
await toLogoutApi();
|
|
@@ -2249,9 +2259,9 @@ function useUserInfo() {
|
|
|
2249
2259
|
}
|
|
2250
2260
|
|
|
2251
2261
|
// src/hooks/useMatchEvents.ts
|
|
2252
|
-
var
|
|
2262
|
+
var import_react37 = require("react");
|
|
2253
2263
|
function useMatchEvents(handlers) {
|
|
2254
|
-
(0,
|
|
2264
|
+
(0, import_react37.useEffect)(() => {
|
|
2255
2265
|
Object.entries(handlers).forEach(([event, handler2]) => {
|
|
2256
2266
|
if (handler2) {
|
|
2257
2267
|
eventManager_default.on(event, handler2);
|
|
@@ -2271,7 +2281,7 @@ function useMatchEvents(handlers) {
|
|
|
2271
2281
|
var import_viem7 = require("viem");
|
|
2272
2282
|
var import_accounts = require("viem/accounts");
|
|
2273
2283
|
var import_viem8 = require("viem");
|
|
2274
|
-
var
|
|
2284
|
+
var import_react38 = require("react");
|
|
2275
2285
|
var import_viem9 = require("viem");
|
|
2276
2286
|
|
|
2277
2287
|
// src/store/useTransactionStore.ts
|
|
@@ -2356,7 +2366,7 @@ function useWallet() {
|
|
|
2356
2366
|
throw error;
|
|
2357
2367
|
}
|
|
2358
2368
|
};
|
|
2359
|
-
const evmAccount = (0,
|
|
2369
|
+
const evmAccount = (0, import_react38.useMemo)(() => {
|
|
2360
2370
|
try {
|
|
2361
2371
|
return address ? (0, import_accounts.toAccount)({
|
|
2362
2372
|
address,
|
|
@@ -2395,7 +2405,7 @@ function useWallet() {
|
|
|
2395
2405
|
return void 0;
|
|
2396
2406
|
}
|
|
2397
2407
|
}, [address]);
|
|
2398
|
-
(0,
|
|
2408
|
+
(0, import_react38.useEffect)(() => {
|
|
2399
2409
|
matchlog_default.log("qwe-evmAccount", evmAccount);
|
|
2400
2410
|
}, [evmAccount]);
|
|
2401
2411
|
const realCreateWalletClient = (parameters) => {
|
|
@@ -2531,14 +2541,14 @@ function useWallet() {
|
|
|
2531
2541
|
|
|
2532
2542
|
// src/hooks/useCopyClipboard.ts
|
|
2533
2543
|
var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
|
|
2534
|
-
var
|
|
2544
|
+
var import_react39 = require("react");
|
|
2535
2545
|
function useCopyClipboard(timeout = 500) {
|
|
2536
|
-
const [isCopied, setIsCopied] = (0,
|
|
2537
|
-
const staticCopy = (0,
|
|
2546
|
+
const [isCopied, setIsCopied] = (0, import_react39.useState)(false);
|
|
2547
|
+
const staticCopy = (0, import_react39.useCallback)((text) => {
|
|
2538
2548
|
const didCopy = (0, import_copy_to_clipboard.default)(text);
|
|
2539
2549
|
setIsCopied(didCopy);
|
|
2540
2550
|
}, []);
|
|
2541
|
-
(0,
|
|
2551
|
+
(0, import_react39.useEffect)(() => {
|
|
2542
2552
|
if (isCopied) {
|
|
2543
2553
|
const hide = setTimeout(() => {
|
|
2544
2554
|
setIsCopied(false);
|
|
@@ -2553,16 +2563,16 @@ function useCopyClipboard(timeout = 500) {
|
|
|
2553
2563
|
}
|
|
2554
2564
|
|
|
2555
2565
|
// src/hooks/useMatchChain.tsx
|
|
2556
|
-
var
|
|
2566
|
+
var import_react40 = require("react");
|
|
2557
2567
|
var import_viem10 = require("viem");
|
|
2558
|
-
var
|
|
2568
|
+
var import_react_intl22 = require("react-intl");
|
|
2559
2569
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
2560
2570
|
function useMatchChain() {
|
|
2561
2571
|
const chainListQuery = useChainListQuery();
|
|
2562
2572
|
const modal = useModal();
|
|
2563
|
-
const intl = (0,
|
|
2573
|
+
const intl = (0, import_react_intl22.useIntl)();
|
|
2564
2574
|
const { chainId: storeChainId, setChainId } = useLocalStore_default();
|
|
2565
|
-
const chainId = (0,
|
|
2575
|
+
const chainId = (0, import_react40.useMemo)(() => {
|
|
2566
2576
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
2567
2577
|
return null;
|
|
2568
2578
|
}
|
|
@@ -2571,7 +2581,7 @@ function useMatchChain() {
|
|
|
2571
2581
|
}
|
|
2572
2582
|
return chainListQuery.data[0].id;
|
|
2573
2583
|
}, [storeChainId, chainListQuery.data]);
|
|
2574
|
-
const chain = (0,
|
|
2584
|
+
const chain = (0, import_react40.useMemo)(() => {
|
|
2575
2585
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
2576
2586
|
return null;
|
|
2577
2587
|
}
|
|
@@ -2585,7 +2595,7 @@ function useMatchChain() {
|
|
|
2585
2595
|
close
|
|
2586
2596
|
}) {
|
|
2587
2597
|
const { chainId: storeChainId2, setChainId: setChainId2 } = useLocalStore_default();
|
|
2588
|
-
const [selectedChainId, setSelectedChainId] = (0,
|
|
2598
|
+
const [selectedChainId, setSelectedChainId] = (0, import_react40.useState)(storeChainId2);
|
|
2589
2599
|
const isDownMd = useDownMd();
|
|
2590
2600
|
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: `matchid-change-network-box`, children: [
|
|
2591
2601
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: `matchid-change-network-list`, children: chainListQuery.data?.map((item, index) => {
|
|
@@ -2608,7 +2618,7 @@ function useMatchChain() {
|
|
|
2608
2618
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Button, { size: "lg", highlight: true, onClick: () => {
|
|
2609
2619
|
setChainId2(selectedChainId || 0);
|
|
2610
2620
|
close();
|
|
2611
|
-
}, block: true, children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
2621
|
+
}, block: true, children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_react_intl22.FormattedMessage, { id: "confirm" }) })
|
|
2612
2622
|
] });
|
|
2613
2623
|
}
|
|
2614
2624
|
const showChangeNetwork = () => {
|
|
@@ -2617,7 +2627,7 @@ function useMatchChain() {
|
|
|
2617
2627
|
content: ChangeNetwork
|
|
2618
2628
|
});
|
|
2619
2629
|
};
|
|
2620
|
-
const publicClient = (0,
|
|
2630
|
+
const publicClient = (0, import_react40.useMemo)(() => {
|
|
2621
2631
|
if (!chain) {
|
|
2622
2632
|
return null;
|
|
2623
2633
|
}
|
|
@@ -2645,14 +2655,14 @@ function useMatchChain() {
|
|
|
2645
2655
|
|
|
2646
2656
|
// src/hooks/useMatchWallet.tsx
|
|
2647
2657
|
var import_react_qrcode = require("react-qrcode");
|
|
2648
|
-
var
|
|
2658
|
+
var import_react42 = require("react");
|
|
2649
2659
|
var import_react_query11 = require("@tanstack/react-query");
|
|
2650
2660
|
var import_viem13 = require("viem");
|
|
2651
|
-
var
|
|
2661
|
+
var import_react_intl24 = require("react-intl");
|
|
2652
2662
|
|
|
2653
2663
|
// src/components/ImportToken/index.tsx
|
|
2654
|
-
var
|
|
2655
|
-
var
|
|
2664
|
+
var import_react41 = require("react");
|
|
2665
|
+
var import_react_intl23 = require("react-intl");
|
|
2656
2666
|
var import_react_query10 = require("@tanstack/react-query");
|
|
2657
2667
|
var import_viem12 = require("viem");
|
|
2658
2668
|
|
|
@@ -2683,12 +2693,12 @@ function useIsContract({
|
|
|
2683
2693
|
// src/components/ImportToken/index.tsx
|
|
2684
2694
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
2685
2695
|
function ImportToken({ close }) {
|
|
2686
|
-
const [status, setStatus] = (0,
|
|
2696
|
+
const [status, setStatus] = (0, import_react41.useState)("");
|
|
2687
2697
|
const { token } = useUserInfo();
|
|
2688
|
-
const [address, setAddress] = (0,
|
|
2689
|
-
const [symbol, setSymbol] = (0,
|
|
2690
|
-
const [decimals, setDecimals] = (0,
|
|
2691
|
-
const [error, setError] = (0,
|
|
2698
|
+
const [address, setAddress] = (0, import_react41.useState)("");
|
|
2699
|
+
const [symbol, setSymbol] = (0, import_react41.useState)("");
|
|
2700
|
+
const [decimals, setDecimals] = (0, import_react41.useState)("");
|
|
2701
|
+
const [error, setError] = (0, import_react41.useState)({});
|
|
2692
2702
|
const { publicClient, chainId, chain } = useMatchChain();
|
|
2693
2703
|
const getContractInfo = async () => {
|
|
2694
2704
|
if (!publicClient) return;
|
|
@@ -2721,8 +2731,8 @@ function ImportToken({ close }) {
|
|
|
2721
2731
|
});
|
|
2722
2732
|
}
|
|
2723
2733
|
};
|
|
2724
|
-
const intl = (0,
|
|
2725
|
-
(0,
|
|
2734
|
+
const intl = (0, import_react_intl23.useIntl)();
|
|
2735
|
+
(0, import_react41.useEffect)(() => {
|
|
2726
2736
|
if (address.length === 42) {
|
|
2727
2737
|
const reg = /^0x[0-9a-fA-F]{40}$/;
|
|
2728
2738
|
if (!reg.test(address)) {
|
|
@@ -2741,7 +2751,7 @@ function ImportToken({ close }) {
|
|
|
2741
2751
|
}
|
|
2742
2752
|
}
|
|
2743
2753
|
}, [address, publicClient]);
|
|
2744
|
-
const [loading, setLoading] = (0,
|
|
2754
|
+
const [loading, setLoading] = (0, import_react41.useState)(false);
|
|
2745
2755
|
const toast = useToast();
|
|
2746
2756
|
const queryClient2 = (0, import_react_query10.useQueryClient)();
|
|
2747
2757
|
const onImport = async () => {
|
|
@@ -2769,7 +2779,7 @@ function ImportToken({ close }) {
|
|
|
2769
2779
|
setLoading(false);
|
|
2770
2780
|
}
|
|
2771
2781
|
};
|
|
2772
|
-
const canImport = (0,
|
|
2782
|
+
const canImport = (0, import_react41.useMemo)(() => {
|
|
2773
2783
|
if (!address) {
|
|
2774
2784
|
return false;
|
|
2775
2785
|
}
|
|
@@ -2795,9 +2805,9 @@ function ImportToken({ close }) {
|
|
|
2795
2805
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: `matchid-import-token-result matchid-flex`, children: [
|
|
2796
2806
|
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: `matchid-import-token-result-box matchid-flex`, children: [
|
|
2797
2807
|
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("img", { src: status == "success" ? success_default : fail_default, alt: status == "success" ? "success" : "fail", className: `matchid-import-token-result-img` }),
|
|
2798
|
-
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: `matchid-import-token-result-text matchid-import-token-result-text-${status}`, children: status == "success" ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
2808
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: `matchid-import-token-result-text matchid-import-token-result-text-${status}`, children: status == "success" ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_react_intl23.FormattedMessage, { id: "importSuccess" }) : /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_react_intl23.FormattedMessage, { id: "importFail" }) })
|
|
2799
2809
|
] }),
|
|
2800
|
-
status == "success" ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Button, { size: "lg", onClick: close, block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
2810
|
+
status == "success" ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Button, { size: "lg", onClick: close, block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_react_intl23.FormattedMessage, { id: "close" }) }) : /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Button, { size: "lg", onClick: () => setStatus(""), block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_react_intl23.FormattedMessage, { id: "back" }) })
|
|
2801
2811
|
] });
|
|
2802
2812
|
}
|
|
2803
2813
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: `matchid-import-token`, children: [
|
|
@@ -2851,7 +2861,7 @@ function ImportToken({ close }) {
|
|
|
2851
2861
|
loading: loading || isContractQuery.isLoading,
|
|
2852
2862
|
disabled: !canImport || !isContractQuery.data,
|
|
2853
2863
|
highlight: true,
|
|
2854
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
2864
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_react_intl23.FormattedMessage, { id: "import" })
|
|
2855
2865
|
}
|
|
2856
2866
|
)
|
|
2857
2867
|
] });
|
|
@@ -2864,7 +2874,7 @@ var ReceiveModal = () => {
|
|
|
2864
2874
|
const { address } = useWallet();
|
|
2865
2875
|
const [copied, setCopied] = useCopyClipboard();
|
|
2866
2876
|
const toast = useToast();
|
|
2867
|
-
const intl = (0,
|
|
2877
|
+
const intl = (0, import_react_intl24.useIntl)();
|
|
2868
2878
|
const onCopy = () => {
|
|
2869
2879
|
setCopied(address);
|
|
2870
2880
|
toast.success(intl.formatMessage({
|
|
@@ -2874,7 +2884,7 @@ var ReceiveModal = () => {
|
|
|
2874
2884
|
const chainLink = chain.explorerLink("address/" + address);
|
|
2875
2885
|
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: `matchid-receive-modal`, children: [
|
|
2876
2886
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "matchid-receive-container", children: [
|
|
2877
|
-
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: `matchid-receive-text`, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
2887
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: `matchid-receive-text`, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_react_intl24.FormattedMessage, { id: "receiveQrcode" }) }),
|
|
2878
2888
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: `matchid-qr-container`, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
2879
2889
|
import_react_qrcode.QRCode,
|
|
2880
2890
|
{
|
|
@@ -2894,7 +2904,7 @@ var ReceiveModal = () => {
|
|
|
2894
2904
|
)
|
|
2895
2905
|
] }),
|
|
2896
2906
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Button, { size: "lg", onClick: onCopy, block: true, highlight: true, disabled: copied, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
2897
|
-
|
|
2907
|
+
import_react_intl24.FormattedMessage,
|
|
2898
2908
|
{
|
|
2899
2909
|
id: "copyAddress"
|
|
2900
2910
|
}
|
|
@@ -2903,7 +2913,7 @@ var ReceiveModal = () => {
|
|
|
2903
2913
|
};
|
|
2904
2914
|
function useMatchWallet() {
|
|
2905
2915
|
const modal = useModal();
|
|
2906
|
-
const intl = (0,
|
|
2916
|
+
const intl = (0, import_react_intl24.useIntl)();
|
|
2907
2917
|
const showReceiveModal = () => {
|
|
2908
2918
|
modal.open({
|
|
2909
2919
|
title: intl.formatMessage({
|
|
@@ -2935,12 +2945,12 @@ function useMatchWallet() {
|
|
|
2935
2945
|
};
|
|
2936
2946
|
}
|
|
2937
2947
|
function useMatchWalletRecords() {
|
|
2938
|
-
const [hasMore, setHasMore] = (0,
|
|
2939
|
-
const [items, setItems] = (0,
|
|
2948
|
+
const [hasMore, setHasMore] = (0, import_react42.useState)(true);
|
|
2949
|
+
const [items, setItems] = (0, import_react42.useState)([]);
|
|
2940
2950
|
const { chainId, publicClient } = useMatchChain();
|
|
2941
2951
|
const { address } = useWallet();
|
|
2942
|
-
const hasMoreRef = (0,
|
|
2943
|
-
const nextPageParamsRef = (0,
|
|
2952
|
+
const hasMoreRef = (0, import_react42.useRef)(hasMore);
|
|
2953
|
+
const nextPageParamsRef = (0, import_react42.useRef)(void 0);
|
|
2944
2954
|
const { contracts, setContracts } = useContractStore_default();
|
|
2945
2955
|
const fetchMoreData = async () => {
|
|
2946
2956
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
@@ -2957,7 +2967,7 @@ function useMatchWalletRecords() {
|
|
|
2957
2967
|
}
|
|
2958
2968
|
hasMoreRef.current = res.data && res.data.transactions && res.data.transactions.length >= 50;
|
|
2959
2969
|
setHasMore(hasMoreRef.current);
|
|
2960
|
-
nextPageParamsRef.current = res.data
|
|
2970
|
+
nextPageParamsRef.current = res.data?.next_page_params;
|
|
2961
2971
|
}
|
|
2962
2972
|
};
|
|
2963
2973
|
const onInit = async () => {
|
|
@@ -2967,7 +2977,7 @@ function useMatchWalletRecords() {
|
|
|
2967
2977
|
hasMoreRef.current = true;
|
|
2968
2978
|
fetchMoreData();
|
|
2969
2979
|
};
|
|
2970
|
-
(0,
|
|
2980
|
+
(0, import_react42.useEffect)(() => {
|
|
2971
2981
|
if (chainId && address) {
|
|
2972
2982
|
onInit();
|
|
2973
2983
|
}
|
|
@@ -3023,7 +3033,7 @@ function useMatchWalletRecords() {
|
|
|
3023
3033
|
setContracts(contractMap);
|
|
3024
3034
|
}
|
|
3025
3035
|
};
|
|
3026
|
-
const list = (0,
|
|
3036
|
+
const list = (0, import_react42.useMemo)(() => {
|
|
3027
3037
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
3028
3038
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
3029
3039
|
removeList.forEach((item) => {
|
|
@@ -3065,7 +3075,7 @@ function useMatchWalletAssets({
|
|
|
3065
3075
|
chainId: chainId || 0,
|
|
3066
3076
|
...assetListOptions
|
|
3067
3077
|
});
|
|
3068
|
-
const mergedAssets = (0,
|
|
3078
|
+
const mergedAssets = (0, import_react42.useMemo)(() => {
|
|
3069
3079
|
if (!assetListQuery.data && !importTokenQuery.data) return [];
|
|
3070
3080
|
const assetList = (assetListQuery.data || []).map((asset) => ({
|
|
3071
3081
|
...asset,
|
|
@@ -3152,7 +3162,7 @@ function useMatchWalletAssetList({
|
|
|
3152
3162
|
retry: 3
|
|
3153
3163
|
// Retry up to 3 times if failed
|
|
3154
3164
|
});
|
|
3155
|
-
const erc20Tokens = (0,
|
|
3165
|
+
const erc20Tokens = (0, import_react42.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
|
|
3156
3166
|
const erc20BalanceQuery = (0, import_react_query11.useQuery)({
|
|
3157
3167
|
queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
|
|
3158
3168
|
queryFn: async () => {
|
|
@@ -3180,7 +3190,7 @@ function useMatchWalletAssetList({
|
|
|
3180
3190
|
// Refresh every 15 seconds
|
|
3181
3191
|
retry: 3
|
|
3182
3192
|
});
|
|
3183
|
-
const enrichedAssets = (0,
|
|
3193
|
+
const enrichedAssets = (0, import_react42.useMemo)(() => {
|
|
3184
3194
|
if (!list) return [];
|
|
3185
3195
|
const erc20Balances = erc20BalanceQuery.data || [];
|
|
3186
3196
|
return list.map((asset) => {
|
|
@@ -3202,7 +3212,7 @@ function useMatchWalletAssetList({
|
|
|
3202
3212
|
return { ...asset, balance, value, balanceValue };
|
|
3203
3213
|
});
|
|
3204
3214
|
}, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
|
|
3205
|
-
(0,
|
|
3215
|
+
(0, import_react42.useEffect)(() => {
|
|
3206
3216
|
const list2 = enrichedAssets.sort((a, b) => {
|
|
3207
3217
|
if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
|
|
3208
3218
|
if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
|
|
@@ -3227,14 +3237,14 @@ function useMatchWalletAssetList({
|
|
|
3227
3237
|
}
|
|
3228
3238
|
|
|
3229
3239
|
// src/hooks/useReceipt.tsx
|
|
3230
|
-
var
|
|
3240
|
+
var import_react43 = require("react");
|
|
3231
3241
|
var import_react_query12 = require("@tanstack/react-query");
|
|
3232
3242
|
var import_viem14 = require("viem");
|
|
3233
3243
|
var CACHE_TTL = 86400 * 30 * 1e3;
|
|
3234
3244
|
var MAX_CACHE_SIZE = 500;
|
|
3235
3245
|
var STORAGE_KEY = "match_receipt_logs";
|
|
3236
3246
|
function useReceiptCache() {
|
|
3237
|
-
const [cache, setCache] = (0,
|
|
3247
|
+
const [cache, setCache] = (0, import_react43.useState)(/* @__PURE__ */ new Map());
|
|
3238
3248
|
const isLocalStorageAvailable = (() => {
|
|
3239
3249
|
try {
|
|
3240
3250
|
const testKey = "__test__";
|
|
@@ -3245,7 +3255,7 @@ function useReceiptCache() {
|
|
|
3245
3255
|
return false;
|
|
3246
3256
|
}
|
|
3247
3257
|
})();
|
|
3248
|
-
(0,
|
|
3258
|
+
(0, import_react43.useEffect)(() => {
|
|
3249
3259
|
if (isLocalStorageAvailable) {
|
|
3250
3260
|
try {
|
|
3251
3261
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -3264,7 +3274,7 @@ function useReceiptCache() {
|
|
|
3264
3274
|
}
|
|
3265
3275
|
}
|
|
3266
3276
|
}, []);
|
|
3267
|
-
const updateLocalStorage = (0,
|
|
3277
|
+
const updateLocalStorage = (0, import_react43.useCallback)((updatedCache) => {
|
|
3268
3278
|
if (isLocalStorageAvailable) {
|
|
3269
3279
|
try {
|
|
3270
3280
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -3281,7 +3291,7 @@ function useReceiptCache() {
|
|
|
3281
3291
|
}
|
|
3282
3292
|
}
|
|
3283
3293
|
}, []);
|
|
3284
|
-
const set = (0,
|
|
3294
|
+
const set = (0, import_react43.useCallback)((key, value) => {
|
|
3285
3295
|
const now = Date.now();
|
|
3286
3296
|
const newCache = new Map(cache);
|
|
3287
3297
|
newCache.forEach((entry, k) => {
|
|
@@ -3299,7 +3309,7 @@ function useReceiptCache() {
|
|
|
3299
3309
|
setCache(newCache);
|
|
3300
3310
|
updateLocalStorage(newCache);
|
|
3301
3311
|
}, [cache, updateLocalStorage]);
|
|
3302
|
-
const get = (0,
|
|
3312
|
+
const get = (0, import_react43.useCallback)((key) => {
|
|
3303
3313
|
const entry = cache.get(key);
|
|
3304
3314
|
if (entry) {
|
|
3305
3315
|
if (Date.now() - entry.timestamp > CACHE_TTL) {
|
|
@@ -3313,7 +3323,7 @@ function useReceiptCache() {
|
|
|
3313
3323
|
}
|
|
3314
3324
|
return void 0;
|
|
3315
3325
|
}, [cache, updateLocalStorage]);
|
|
3316
|
-
const del = (0,
|
|
3326
|
+
const del = (0, import_react43.useCallback)((key) => {
|
|
3317
3327
|
if (cache.has(key)) {
|
|
3318
3328
|
const newCache = new Map(cache);
|
|
3319
3329
|
newCache.delete(key);
|
|
@@ -3321,7 +3331,7 @@ function useReceiptCache() {
|
|
|
3321
3331
|
updateLocalStorage(newCache);
|
|
3322
3332
|
}
|
|
3323
3333
|
}, [cache, updateLocalStorage]);
|
|
3324
|
-
const clear = (0,
|
|
3334
|
+
const clear = (0, import_react43.useCallback)(() => {
|
|
3325
3335
|
setCache(/* @__PURE__ */ new Map());
|
|
3326
3336
|
if (isLocalStorageAvailable) {
|
|
3327
3337
|
localStorage.removeItem(STORAGE_KEY);
|
|
@@ -3336,7 +3346,7 @@ function useReceipt2({
|
|
|
3336
3346
|
const { list } = useMatchChain();
|
|
3337
3347
|
const cache = useReceiptCache();
|
|
3338
3348
|
const chain = list?.find((item) => item.id === chainId);
|
|
3339
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
3349
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react43.useState)(true);
|
|
3340
3350
|
const query = (0, import_react_query12.useQuery)({
|
|
3341
3351
|
queryKey: ["match-tx-receipt", hash, chain],
|
|
3342
3352
|
queryFn: async () => {
|
|
@@ -3362,7 +3372,7 @@ function useReceipt2({
|
|
|
3362
3372
|
},
|
|
3363
3373
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
3364
3374
|
});
|
|
3365
|
-
(0,
|
|
3375
|
+
(0, import_react43.useEffect)(() => {
|
|
3366
3376
|
if (query.data) {
|
|
3367
3377
|
setShouldRefetch(false);
|
|
3368
3378
|
}
|
|
@@ -3371,14 +3381,14 @@ function useReceipt2({
|
|
|
3371
3381
|
}
|
|
3372
3382
|
|
|
3373
3383
|
// src/hooks/useTransaction.tsx
|
|
3374
|
-
var
|
|
3384
|
+
var import_react44 = require("react");
|
|
3375
3385
|
var import_react_query13 = require("@tanstack/react-query");
|
|
3376
3386
|
var import_viem15 = require("viem");
|
|
3377
3387
|
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
3378
3388
|
var MAX_CACHE_SIZE2 = 500;
|
|
3379
3389
|
var STORAGE_KEY2 = "match_transaction_logs";
|
|
3380
3390
|
function useTransactionCache() {
|
|
3381
|
-
const [cache, setCache] = (0,
|
|
3391
|
+
const [cache, setCache] = (0, import_react44.useState)(/* @__PURE__ */ new Map());
|
|
3382
3392
|
const isLocalStorageAvailable = (() => {
|
|
3383
3393
|
try {
|
|
3384
3394
|
const testKey = "__test__";
|
|
@@ -3389,7 +3399,7 @@ function useTransactionCache() {
|
|
|
3389
3399
|
return false;
|
|
3390
3400
|
}
|
|
3391
3401
|
})();
|
|
3392
|
-
(0,
|
|
3402
|
+
(0, import_react44.useEffect)(() => {
|
|
3393
3403
|
if (isLocalStorageAvailable) {
|
|
3394
3404
|
try {
|
|
3395
3405
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -3408,7 +3418,7 @@ function useTransactionCache() {
|
|
|
3408
3418
|
}
|
|
3409
3419
|
}
|
|
3410
3420
|
}, []);
|
|
3411
|
-
const updateLocalStorage = (0,
|
|
3421
|
+
const updateLocalStorage = (0, import_react44.useCallback)((updatedCache) => {
|
|
3412
3422
|
if (isLocalStorageAvailable) {
|
|
3413
3423
|
try {
|
|
3414
3424
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -3425,7 +3435,7 @@ function useTransactionCache() {
|
|
|
3425
3435
|
}
|
|
3426
3436
|
}
|
|
3427
3437
|
}, []);
|
|
3428
|
-
const set = (0,
|
|
3438
|
+
const set = (0, import_react44.useCallback)((key, value) => {
|
|
3429
3439
|
const now = Date.now();
|
|
3430
3440
|
const newCache = new Map(cache);
|
|
3431
3441
|
newCache.forEach((entry, k) => {
|
|
@@ -3443,7 +3453,7 @@ function useTransactionCache() {
|
|
|
3443
3453
|
setCache(newCache);
|
|
3444
3454
|
updateLocalStorage(newCache);
|
|
3445
3455
|
}, [cache, updateLocalStorage]);
|
|
3446
|
-
const get = (0,
|
|
3456
|
+
const get = (0, import_react44.useCallback)((key) => {
|
|
3447
3457
|
const entry = cache.get(key);
|
|
3448
3458
|
if (entry) {
|
|
3449
3459
|
if (Date.now() - entry.timestamp > CACHE_TTL2) {
|
|
@@ -3457,7 +3467,7 @@ function useTransactionCache() {
|
|
|
3457
3467
|
}
|
|
3458
3468
|
return void 0;
|
|
3459
3469
|
}, [cache, updateLocalStorage]);
|
|
3460
|
-
const del = (0,
|
|
3470
|
+
const del = (0, import_react44.useCallback)((key) => {
|
|
3461
3471
|
if (cache.has(key)) {
|
|
3462
3472
|
const newCache = new Map(cache);
|
|
3463
3473
|
newCache.delete(key);
|
|
@@ -3465,7 +3475,7 @@ function useTransactionCache() {
|
|
|
3465
3475
|
updateLocalStorage(newCache);
|
|
3466
3476
|
}
|
|
3467
3477
|
}, [cache, updateLocalStorage]);
|
|
3468
|
-
const clear = (0,
|
|
3478
|
+
const clear = (0, import_react44.useCallback)(() => {
|
|
3469
3479
|
setCache(/* @__PURE__ */ new Map());
|
|
3470
3480
|
if (isLocalStorageAvailable) {
|
|
3471
3481
|
localStorage.removeItem(STORAGE_KEY2);
|
|
@@ -3480,7 +3490,7 @@ function useTransaction({
|
|
|
3480
3490
|
const { list } = useMatchChain();
|
|
3481
3491
|
const cache = useTransactionCache();
|
|
3482
3492
|
const chain = list?.find((item) => item.id === chainId);
|
|
3483
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
3493
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react44.useState)(true);
|
|
3484
3494
|
const query = (0, import_react_query13.useQuery)({
|
|
3485
3495
|
queryKey: ["match-tx-transaction", hash, chain],
|
|
3486
3496
|
queryFn: async () => {
|
|
@@ -3506,7 +3516,7 @@ function useTransaction({
|
|
|
3506
3516
|
},
|
|
3507
3517
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
3508
3518
|
});
|
|
3509
|
-
(0,
|
|
3519
|
+
(0, import_react44.useEffect)(() => {
|
|
3510
3520
|
if (query.data) {
|
|
3511
3521
|
setShouldRefetch(false);
|
|
3512
3522
|
}
|