@matchain/matchid-sdk-react 0.1.53-alpha.1 → 0.1.53-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icon/index.d.mts +4 -144
- package/dist/assets/icon/index.d.ts +4 -144
- package/dist/assets/icon/index.js +54 -0
- package/dist/assets/icon/index.js.map +1 -1
- package/dist/assets/icon/index.mjs +5 -1
- package/dist/chunk-3CR66BEX.mjs +19 -0
- package/dist/chunk-3CR66BEX.mjs.map +1 -0
- package/dist/{chunk-LHNKZISB.mjs → chunk-FKXS2XRG.mjs} +114 -2
- package/dist/chunk-FKXS2XRG.mjs.map +1 -0
- package/dist/{chunk-HLUFAIFV.mjs → chunk-IZOOVZAD.mjs} +11 -6
- package/dist/chunk-IZOOVZAD.mjs.map +1 -0
- package/dist/{chunk-HYQ3T6WW.mjs → chunk-JX73EY6V.mjs} +2 -14
- package/dist/chunk-JX73EY6V.mjs.map +1 -0
- package/dist/{chunk-2DVC6WCN.mjs → chunk-NCVBLRAJ.mjs} +5750 -4942
- package/dist/chunk-NCVBLRAJ.mjs.map +1 -0
- package/dist/{chunk-FB5MHLWX.mjs → chunk-X5HGL3ZX.mjs} +45 -3
- package/dist/chunk-X5HGL3ZX.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 +1467 -590
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +11 -6
- package/dist/config/chains/index.mjs +2 -1
- package/dist/hooks/api/index.d.mts +3 -2
- package/dist/hooks/api/index.d.ts +3 -2
- package/dist/hooks/api/index.js +401 -147
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +9 -8
- package/dist/hooks/index.d.mts +3 -2
- package/dist/hooks/index.d.ts +3 -2
- package/dist/hooks/index.js +637 -544
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +5 -4
- package/dist/index-BVfCh4l-.d.mts +203 -0
- package/dist/{index-B_o9HBS1.d.mts → index-BaFmUVw-.d.mts} +1 -1
- package/dist/{index-CDqIk5k2.d.mts → index-BgdY5xdW.d.ts} +41 -17
- package/dist/{index-DvM6x6e6.d.ts → index-BrzFSkOe.d.mts} +41 -17
- package/dist/{index-DMUZQqNB.d.ts → index-C0UKUm0h.d.ts} +25 -5
- package/dist/{index-BUj9mOrS.d.ts → index-CQmN0dN4.d.ts} +1 -1
- package/dist/index-D3Kp05kW.d.ts +203 -0
- package/dist/{index-k2Uf0F94.d.ts → index-D5WIVIkc.d.ts} +4 -2
- package/dist/{index-BDoEk1EK.d.ts → index-D7S5DMUy.d.mts} +21 -8
- package/dist/{index-D5OzNRfu.d.mts → index-DC4F1u-w.d.mts} +25 -5
- package/dist/{index-XzSw1Bym.d.mts → index-DQFQ39D9.d.ts} +21 -8
- package/dist/{index-B-QfwtE5.d.mts → index-DjbH13zc.d.mts} +16 -14
- package/dist/{index-Bmir-Wor.d.mts → index-SOVt-ADK.d.mts} +4 -2
- package/dist/{index-X_fw5wX_.d.ts → index-zc2GEzJ9.d.ts} +16 -14
- package/dist/index.css +124 -13
- package/dist/index.d.mts +9 -8
- package/dist/index.d.ts +9 -8
- package/dist/index.js +1860 -919
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -11
- package/dist/request-B0CyrGFT.d.mts +15 -0
- package/dist/request-B0CyrGFT.d.ts +15 -0
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/{types-Dd_ExpLx.d.mts → types-VrV1kYga.d.mts} +10 -2
- package/dist/{types-Dd_ExpLx.d.ts → types-VrV1kYga.d.ts} +10 -2
- package/dist/ui/index.d.mts +3 -3
- package/dist/ui/index.d.ts +3 -3
- package/dist/ui/index.js +109 -61
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +8 -4
- package/dist/utils/index.d.mts +3 -2
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.js +10 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +3 -1
- package/example/package.json +3 -1
- package/example/src/App.tsx +30 -7
- package/example/src/pages/Contact/index.tsx +90 -0
- package/example/src/pages/UI/components/Tabs.tsx +18 -0
- package/example/src/pages/UI/index.tsx +2 -0
- package/example/src/pages/User/index.tsx +7 -1
- package/package.json +5 -5
- package/dist/chunk-2DVC6WCN.mjs.map +0 -1
- package/dist/chunk-6QTW3KXN.mjs +0 -97
- package/dist/chunk-6QTW3KXN.mjs.map +0 -1
- package/dist/chunk-FB5MHLWX.mjs.map +0 -1
- package/dist/chunk-HLUFAIFV.mjs.map +0 -1
- package/dist/chunk-HYQ3T6WW.mjs.map +0 -1
- package/dist/chunk-LHNKZISB.mjs.map +0 -1
- package/example/dist/assets/TransportWebHID-BEu7tC0r.js +0 -1
- package/example/dist/assets/bignumber-iG7K-qxw.js +0 -10
- package/example/dist/assets/ccip-a6wQ1Vcb.js +0 -1
- package/example/dist/assets/draggabilly-CRYR_S0q.js +0 -14
- package/example/dist/assets/index--dp9m9Ep.js +0 -1
- package/example/dist/assets/index-BDTHolFv.js +0 -569
- package/example/dist/assets/index-BZl59qLb.js +0 -179
- package/example/dist/assets/index-BmMbYNHO.js +0 -303
- package/example/dist/assets/index-C7cxVRDF.js +0 -1677
- package/example/dist/assets/index-CJk171Yb.js +0 -1
- package/example/dist/assets/index-CQiBesAa.js +0 -3
- package/example/dist/assets/index-D62loNA9.js +0 -3
- package/example/dist/assets/index-DqyX3FG6.js +0 -1
- package/example/dist/assets/index-Gy3FXGhr.css +0 -1
- package/example/dist/assets/inherits_browser-BlmhoU4v.js +0 -1
- package/example/dist/assets/solanaEmbed.esm-Djn-u4Vn.js +0 -38
- package/example/dist/index.html +0 -14
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
|
|
|
@@ -293,6 +293,13 @@ var tgAppLoginInitApi = () => {
|
|
|
293
293
|
method: "GET"
|
|
294
294
|
});
|
|
295
295
|
};
|
|
296
|
+
var userInviteApi = (data) => {
|
|
297
|
+
return request_default({
|
|
298
|
+
url: `/api/v1/user/invite`,
|
|
299
|
+
method: "POST",
|
|
300
|
+
data
|
|
301
|
+
});
|
|
302
|
+
};
|
|
296
303
|
|
|
297
304
|
// src/store/useLocalStore.ts
|
|
298
305
|
var persistedState = (0, import_middleware.persist)(
|
|
@@ -349,10 +356,10 @@ var localStore = useLocalStore;
|
|
|
349
356
|
var useLocalStore_default = useLocalStore;
|
|
350
357
|
|
|
351
358
|
// src/hooks/useUserInfo.tsx
|
|
352
|
-
var
|
|
359
|
+
var import_react35 = require("react");
|
|
353
360
|
|
|
354
361
|
// src/MatchContext.tsx
|
|
355
|
-
var
|
|
362
|
+
var import_react34 = require("react");
|
|
356
363
|
|
|
357
364
|
// src/store/useModalStore.ts
|
|
358
365
|
var import_zustand2 = require("zustand");
|
|
@@ -614,6 +621,12 @@ function TransferIcon({ size = 40, ...props }) {
|
|
|
614
621
|
// src/assets/icon/ArrowSendIcon.tsx
|
|
615
622
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
616
623
|
|
|
624
|
+
// src/assets/icon/PhantomIcon.tsx
|
|
625
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
626
|
+
|
|
627
|
+
// src/assets/icon/MoreIcon.tsx
|
|
628
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
629
|
+
|
|
617
630
|
// src/hooks/useLayout.tsx
|
|
618
631
|
var useLayout_exports = {};
|
|
619
632
|
__export(useLayout_exports, {
|
|
@@ -635,29 +648,29 @@ function useDownMd() {
|
|
|
635
648
|
}
|
|
636
649
|
|
|
637
650
|
// src/hooks/useConfig.tsx
|
|
638
|
-
var
|
|
651
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
639
652
|
var DEFAULT_WALLET_METHODS = ["evm", "sol", "btc", "tron", "ton"];
|
|
640
653
|
|
|
641
654
|
// src/store/useModalStore.ts
|
|
642
|
-
var
|
|
655
|
+
var useTRONModalStore = (0, import_zustand2.create)((set) => ({
|
|
643
656
|
isOpen: false,
|
|
644
657
|
type: "",
|
|
645
658
|
open: (type) => set({ isOpen: true, type }),
|
|
646
659
|
close: () => set({ isOpen: false })
|
|
647
660
|
}));
|
|
648
|
-
var
|
|
661
|
+
var useTONModalStore = (0, import_zustand2.create)((set) => ({
|
|
649
662
|
isOpen: false,
|
|
650
663
|
type: "",
|
|
651
664
|
open: (type) => set({ isOpen: true, type }),
|
|
652
665
|
close: () => set({ isOpen: false })
|
|
653
666
|
}));
|
|
654
|
-
var
|
|
667
|
+
var useBTCModalStore = (0, import_zustand2.create)((set) => ({
|
|
655
668
|
isOpen: false,
|
|
656
669
|
type: "",
|
|
657
670
|
open: (type) => set({ isOpen: true, type }),
|
|
658
671
|
close: () => set({ isOpen: false })
|
|
659
672
|
}));
|
|
660
|
-
var
|
|
673
|
+
var useEVMModalStore = (0, import_zustand2.create)((set) => ({
|
|
661
674
|
isOpen: false,
|
|
662
675
|
type: "",
|
|
663
676
|
open: (type) => set({ isOpen: true, type }),
|
|
@@ -682,7 +695,7 @@ var import_react6 = require("react");
|
|
|
682
695
|
|
|
683
696
|
// src/ui/Overlay/index.tsx
|
|
684
697
|
var import_react2 = require("react");
|
|
685
|
-
var
|
|
698
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
686
699
|
function Overlay({
|
|
687
700
|
isOpen = false,
|
|
688
701
|
children,
|
|
@@ -698,7 +711,7 @@ function Overlay({
|
|
|
698
711
|
document.body.style.overflow = "";
|
|
699
712
|
};
|
|
700
713
|
}, [isOpen]);
|
|
701
|
-
return isOpen ? /* @__PURE__ */ (0,
|
|
714
|
+
return isOpen ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
702
715
|
"div",
|
|
703
716
|
{
|
|
704
717
|
className: "matchid-overlay",
|
|
@@ -707,11 +720,11 @@ function Overlay({
|
|
|
707
720
|
},
|
|
708
721
|
children
|
|
709
722
|
}
|
|
710
|
-
) : /* @__PURE__ */ (0,
|
|
723
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, {});
|
|
711
724
|
}
|
|
712
725
|
|
|
713
726
|
// src/ui/Modal/index.tsx
|
|
714
|
-
var
|
|
727
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
715
728
|
function Modal({
|
|
716
729
|
children,
|
|
717
730
|
isOpen,
|
|
@@ -719,10 +732,10 @@ function Modal({
|
|
|
719
732
|
zIndex = 100,
|
|
720
733
|
className = ""
|
|
721
734
|
}) {
|
|
722
|
-
return /* @__PURE__ */ (0,
|
|
735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Overlay, { isOpen, zIndex, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: `matchid-modal ${className}`, style: {
|
|
723
736
|
width
|
|
724
737
|
}, children: [
|
|
725
|
-
/* @__PURE__ */ (0,
|
|
738
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "matchid-modal-mobile-header" }),
|
|
726
739
|
children
|
|
727
740
|
] }) });
|
|
728
741
|
}
|
|
@@ -736,13 +749,13 @@ function ModalWithHeader({
|
|
|
736
749
|
...props
|
|
737
750
|
}) {
|
|
738
751
|
const isDownMd = useDownMd();
|
|
739
|
-
return /* @__PURE__ */ (0,
|
|
740
|
-
/* @__PURE__ */ (0,
|
|
741
|
-
/* @__PURE__ */ (0,
|
|
742
|
-
onBack && /* @__PURE__ */ (0,
|
|
743
|
-
/* @__PURE__ */ (0,
|
|
752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Modal, { ...props, children: [
|
|
753
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: `matchid-modal-header ${showBorder ? "matchid-modal-header-border" : ""}`, children: [
|
|
754
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "matchid-modal-header-content", children: [
|
|
755
|
+
onBack && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowLeftIcon, { height: isDownMd ? 20 : 25, width: isDownMd ? 20 : 24, className: "matchid-modal-header-back", onClick: onBack }),
|
|
756
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "matchid-modal-header-title", children: title })
|
|
744
757
|
] }),
|
|
745
|
-
onClose && /* @__PURE__ */ (0,
|
|
758
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(CloseRoundIcon, { size: isDownMd ? 24 : 30, className: "matchid-modal-header-close", onClick: onClose })
|
|
746
759
|
] }),
|
|
747
760
|
children
|
|
748
761
|
] });
|
|
@@ -753,7 +766,7 @@ var import_react4 = require("react");
|
|
|
753
766
|
|
|
754
767
|
// src/utils/index.tsx
|
|
755
768
|
var import_moment = __toESM(require("moment"));
|
|
756
|
-
var
|
|
769
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
757
770
|
var getVersion = () => {
|
|
758
771
|
return "0.0.2";
|
|
759
772
|
};
|
|
@@ -785,10 +798,10 @@ var NumberFormatter = ({
|
|
|
785
798
|
const [intPart, decimalPart] = numberValue.toString().split(".");
|
|
786
799
|
const intFormat = separator ? intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : intPart;
|
|
787
800
|
if (Math.abs(parseFloat(numberValue)) >= 1) {
|
|
788
|
-
return /* @__PURE__ */ (0,
|
|
789
|
-
prefix && /* @__PURE__ */ (0,
|
|
790
|
-
/* @__PURE__ */ (0,
|
|
791
|
-
decimalPart ? /* @__PURE__ */ (0,
|
|
801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className, children: [
|
|
802
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: prefixClassName, children: prefix }),
|
|
803
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: intClassName, children: intFormat }),
|
|
804
|
+
decimalPart ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: decimalClassName, children: [
|
|
792
805
|
".",
|
|
793
806
|
decimalPart.substring(0, fixNum)
|
|
794
807
|
] }) : "",
|
|
@@ -805,30 +818,30 @@ var NumberFormatter = ({
|
|
|
805
818
|
}
|
|
806
819
|
}
|
|
807
820
|
if (zeroCount < tFixNum) {
|
|
808
|
-
return /* @__PURE__ */ (0,
|
|
809
|
-
prefix && /* @__PURE__ */ (0,
|
|
810
|
-
/* @__PURE__ */ (0,
|
|
811
|
-
/* @__PURE__ */ (0,
|
|
821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className, children: [
|
|
822
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: prefixClassName, children: prefix }),
|
|
823
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: intClassName, children: intFormat }),
|
|
824
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: decimalClassName, children: [
|
|
812
825
|
".",
|
|
813
826
|
decimalPart.substring(0, tFixNum)
|
|
814
827
|
] }),
|
|
815
828
|
suffix
|
|
816
829
|
] });
|
|
817
830
|
}
|
|
818
|
-
return /* @__PURE__ */ (0,
|
|
819
|
-
prefix && /* @__PURE__ */ (0,
|
|
820
|
-
/* @__PURE__ */ (0,
|
|
821
|
-
/* @__PURE__ */ (0,
|
|
831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className, children: [
|
|
832
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: prefixClassName, children: prefix }),
|
|
833
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: intClassName, children: intFormat }),
|
|
834
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: decimalClassName, children: [
|
|
822
835
|
".0",
|
|
823
|
-
/* @__PURE__ */ (0,
|
|
836
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("sub", { children: zeroCount }),
|
|
824
837
|
decimalPart?.substring(zeroCount, zeroCount + tFixNum - 2)
|
|
825
838
|
] }),
|
|
826
839
|
suffix
|
|
827
840
|
] });
|
|
828
841
|
}
|
|
829
|
-
return /* @__PURE__ */ (0,
|
|
830
|
-
prefix && /* @__PURE__ */ (0,
|
|
831
|
-
/* @__PURE__ */ (0,
|
|
842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className, children: [
|
|
843
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: prefixClassName, children: prefix }),
|
|
844
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: intClassName, children: intPart }),
|
|
832
845
|
suffix
|
|
833
846
|
] });
|
|
834
847
|
};
|
|
@@ -837,7 +850,7 @@ var isInTgApp = () => {
|
|
|
837
850
|
};
|
|
838
851
|
|
|
839
852
|
// src/ui/Button/index.tsx
|
|
840
|
-
var
|
|
853
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
841
854
|
function Button({
|
|
842
855
|
size = "df",
|
|
843
856
|
disabled = false,
|
|
@@ -856,7 +869,7 @@ function Button({
|
|
|
856
869
|
onClick && onClick();
|
|
857
870
|
}
|
|
858
871
|
};
|
|
859
|
-
return /* @__PURE__ */ (0,
|
|
872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
860
873
|
"button",
|
|
861
874
|
{
|
|
862
875
|
type,
|
|
@@ -866,14 +879,14 @@ function Button({
|
|
|
866
879
|
...style
|
|
867
880
|
},
|
|
868
881
|
onClick: onAction,
|
|
869
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
882
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(LoadingIcon_default, { className: "matchid-btn-loading-icon", color: "var(--matchid-btn-loading-color)" }) : children
|
|
870
883
|
}
|
|
871
884
|
);
|
|
872
885
|
}
|
|
873
886
|
|
|
874
887
|
// src/ui/Input/index.tsx
|
|
875
888
|
var import_react3 = require("react");
|
|
876
|
-
var
|
|
889
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
877
890
|
function Input({
|
|
878
891
|
onChange,
|
|
879
892
|
type,
|
|
@@ -883,17 +896,17 @@ function Input({
|
|
|
883
896
|
}) {
|
|
884
897
|
const [inputType, setInputType] = (0, import_react3.useState)(type);
|
|
885
898
|
const isDownMd = useDownMd();
|
|
886
|
-
return /* @__PURE__ */ (0,
|
|
899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
887
900
|
"div",
|
|
888
901
|
{
|
|
889
902
|
className: `matchid-input-box ${props.value && props.value.length > 0 ? "matchid-input-has-content" : ""} ${className}`,
|
|
890
903
|
children: [
|
|
891
|
-
/* @__PURE__ */ (0,
|
|
892
|
-
props.value && props.value.length > 0 && /* @__PURE__ */ (0,
|
|
904
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("input", { type: inputType, onChange, ...props, className: "matchid-input-field" }),
|
|
905
|
+
props.value && props.value.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "matchid-input-delete-icon", onClick: (e) => {
|
|
893
906
|
if (onChange) {
|
|
894
907
|
onChange({ target: { value: "" } });
|
|
895
908
|
}
|
|
896
|
-
}, children: /* @__PURE__ */ (0,
|
|
909
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
897
910
|
DeleteRoundIcon,
|
|
898
911
|
{
|
|
899
912
|
height: isDownMd ? 16 : 21,
|
|
@@ -901,9 +914,9 @@ function Input({
|
|
|
901
914
|
color: "var(--matchid-input-delete-icon-color)"
|
|
902
915
|
}
|
|
903
916
|
) }),
|
|
904
|
-
type === "password" && /* @__PURE__ */ (0,
|
|
917
|
+
type === "password" && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "matchid-input-eye-icon", onClick: () => {
|
|
905
918
|
setInputType(inputType === "password" ? "text" : "password");
|
|
906
|
-
}, children: inputType === "password" ? /* @__PURE__ */ (0,
|
|
919
|
+
}, children: inputType === "password" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(CloseEyeIcon, { size: isDownMd ? 16 : 20 }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(OpenEyeIcon, { size: isDownMd ? 16 : 20 }) }),
|
|
907
920
|
after
|
|
908
921
|
]
|
|
909
922
|
}
|
|
@@ -911,7 +924,7 @@ function Input({
|
|
|
911
924
|
}
|
|
912
925
|
|
|
913
926
|
// src/ui/Field/index.tsx
|
|
914
|
-
var
|
|
927
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
915
928
|
function Field({
|
|
916
929
|
label,
|
|
917
930
|
children,
|
|
@@ -919,19 +932,19 @@ function Field({
|
|
|
919
932
|
required,
|
|
920
933
|
className = ""
|
|
921
934
|
}) {
|
|
922
|
-
return /* @__PURE__ */ (0,
|
|
923
|
-
/* @__PURE__ */ (0,
|
|
924
|
-
required && /* @__PURE__ */ (0,
|
|
935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: `matchid-field-box ${className}`, children: [
|
|
936
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "matchid-field-label", children: [
|
|
937
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "matchid-field-required", children: "*" }),
|
|
925
938
|
label
|
|
926
939
|
] }),
|
|
927
940
|
children,
|
|
928
|
-
error && /* @__PURE__ */ (0,
|
|
941
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "matchid-field-error", children: error })
|
|
929
942
|
] });
|
|
930
943
|
}
|
|
931
944
|
|
|
932
945
|
// src/components/EmailModal/StepEmail.tsx
|
|
933
946
|
var import_react_intl = require("react-intl");
|
|
934
|
-
var
|
|
947
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
935
948
|
|
|
936
949
|
// src/components/EmailModal/StepVerify.tsx
|
|
937
950
|
var import_react5 = require("react");
|
|
@@ -941,15 +954,15 @@ var NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
|
941
954
|
|
|
942
955
|
// src/components/EmailModal/StepVerify.tsx
|
|
943
956
|
var import_react_intl2 = require("react-intl");
|
|
944
|
-
var
|
|
957
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
945
958
|
|
|
946
959
|
// src/components/EmailModal/index.tsx
|
|
947
960
|
var import_react_intl3 = require("react-intl");
|
|
948
|
-
var
|
|
961
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
949
962
|
|
|
950
963
|
// src/ui/Popover/index.tsx
|
|
951
964
|
var import_react7 = require("react");
|
|
952
|
-
var
|
|
965
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
953
966
|
|
|
954
967
|
// src/components/LoginBox/index.tsx
|
|
955
968
|
var import_react8 = require("react");
|
|
@@ -959,191 +972,39 @@ var import_react_intl4 = require("react-intl");
|
|
|
959
972
|
var import_react_query = require("@tanstack/react-query");
|
|
960
973
|
|
|
961
974
|
// src/components/LoginBox/index.tsx
|
|
962
|
-
var
|
|
975
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
963
976
|
|
|
964
977
|
// src/components/LoginButton/index.tsx
|
|
965
978
|
var import_react10 = require("react");
|
|
966
979
|
|
|
967
980
|
// src/components/LoginPanel/index.tsx
|
|
968
981
|
var import_react_intl5 = require("react-intl");
|
|
969
|
-
var
|
|
982
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
970
983
|
|
|
971
984
|
// src/components/LoginModal/index.tsx
|
|
972
|
-
var
|
|
985
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
973
986
|
|
|
974
987
|
// src/components/UserPopover/index.tsx
|
|
975
988
|
var import_react9 = require("react");
|
|
976
989
|
|
|
977
990
|
// src/assets/icon/ProfileIcon.tsx
|
|
978
|
-
var
|
|
991
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
979
992
|
|
|
980
993
|
// src/components/UserPopover/index.tsx
|
|
981
994
|
var import_react_intl6 = require("react-intl");
|
|
982
|
-
var
|
|
995
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
983
996
|
|
|
984
997
|
// src/components/LoginButton/index.tsx
|
|
985
998
|
var import_react_intl7 = require("react-intl");
|
|
986
|
-
var
|
|
999
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
987
1000
|
|
|
988
1001
|
// src/components/UsernameModal/index.tsx
|
|
989
1002
|
var import_react11 = require("react");
|
|
990
1003
|
var import_react_intl8 = require("react-intl");
|
|
991
|
-
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
992
|
-
|
|
993
|
-
// src/components/SOLModal/index.tsx
|
|
994
|
-
var import_react13 = __toESM(require("react"));
|
|
995
|
-
|
|
996
|
-
// src/hooks/eventManager.ts
|
|
997
|
-
var EventManager = class {
|
|
998
|
-
constructor() {
|
|
999
|
-
this.listeners = {};
|
|
1000
|
-
}
|
|
1001
|
-
on(event, callback) {
|
|
1002
|
-
if (!this.listeners[event]) {
|
|
1003
|
-
this.listeners[event] = /* @__PURE__ */ new Set();
|
|
1004
|
-
}
|
|
1005
|
-
this.listeners[event].add(callback);
|
|
1006
|
-
}
|
|
1007
|
-
off(event, callback) {
|
|
1008
|
-
if (this.listeners[event]) {
|
|
1009
|
-
this.listeners[event].delete(callback);
|
|
1010
|
-
if (this.listeners[event].size === 0) {
|
|
1011
|
-
delete this.listeners[event];
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
emit(event, ...args) {
|
|
1016
|
-
if (this.listeners[event]) {
|
|
1017
|
-
this.listeners[event].forEach((callback) => callback(...args));
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
};
|
|
1021
|
-
var eventManager = new EventManager();
|
|
1022
|
-
var eventManager_default = eventManager;
|
|
1023
|
-
|
|
1024
|
-
// src/components/SOLModal/index.tsx
|
|
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");
|
|
1040
|
-
var import_react_intl9 = require("react-intl");
|
|
1041
|
-
|
|
1042
|
-
// src/components/WalletModalContent/index.tsx
|
|
1043
|
-
var import_react12 = require("react");
|
|
1044
|
-
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
1045
|
-
|
|
1046
|
-
// src/components/SOLModal/index.tsx
|
|
1047
1004
|
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
|
-
// src/hooks/useTRONWallet.ts
|
|
1095
|
-
var import_react14 = require("react");
|
|
1096
|
-
|
|
1097
|
-
// src/components/TRONModal/index.tsx
|
|
1098
|
-
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
1099
|
-
|
|
1100
|
-
// src/components/TONModal/index.tsx
|
|
1101
|
-
var import_react16 = __toESM(require("react"));
|
|
1102
|
-
var import_react_intl11 = require("react-intl");
|
|
1103
|
-
var import_ui_react = require("@tonconnect/ui-react");
|
|
1104
|
-
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
1105
|
-
|
|
1106
|
-
// src/components/BTCModal/index.tsx
|
|
1107
|
-
var import_react18 = __toESM(require("react"));
|
|
1108
|
-
var import_react_intl12 = require("react-intl");
|
|
1109
|
-
|
|
1110
|
-
// src/lib/btc/XverseAdapter.ts
|
|
1111
|
-
var import_sats_connect = require("sats-connect");
|
|
1112
|
-
|
|
1113
|
-
// src/hooks/useBTCWallet.ts
|
|
1114
|
-
var import_react17 = require("react");
|
|
1115
|
-
|
|
1116
|
-
// src/components/BTCModal/index.tsx
|
|
1117
|
-
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
1118
|
-
|
|
1119
|
-
// src/components/WalletModal/index.tsx
|
|
1120
|
-
var import_react19 = require("react");
|
|
1121
|
-
var import_react_intl13 = require("react-intl");
|
|
1122
|
-
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
1123
|
-
|
|
1124
|
-
// src/components/AlphaAvatar/index.tsx
|
|
1125
|
-
var import_react20 = require("react");
|
|
1126
|
-
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
1127
|
-
function AlphaAvatar({ name, size = 40, className = "" }) {
|
|
1128
|
-
const [avatar, setAvatar] = (0, import_react20.useState)(void 0);
|
|
1129
|
-
(0, import_react20.useEffect)(() => {
|
|
1130
|
-
if (name) {
|
|
1131
|
-
const char = name[0].toUpperCase();
|
|
1132
|
-
setAvatar(char);
|
|
1133
|
-
}
|
|
1134
|
-
}, [name]);
|
|
1135
|
-
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
1136
|
-
width: size,
|
|
1137
|
-
height: size,
|
|
1138
|
-
fontSize: Math.ceil(size / 2)
|
|
1139
|
-
}, children: avatar });
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
// src/components/WalletAsset/index.tsx
|
|
1143
|
-
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
1144
1005
|
|
|
1145
1006
|
// src/ui/Drawer/index.tsx
|
|
1146
|
-
var
|
|
1007
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
1147
1008
|
function Drawer({
|
|
1148
1009
|
children,
|
|
1149
1010
|
showClose = true,
|
|
@@ -1154,25 +1015,25 @@ function Drawer({
|
|
|
1154
1015
|
onBack
|
|
1155
1016
|
}) {
|
|
1156
1017
|
if (!isOpen) {
|
|
1157
|
-
return /* @__PURE__ */ (0,
|
|
1018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_jsx_runtime69.Fragment, {});
|
|
1158
1019
|
}
|
|
1159
|
-
return /* @__PURE__ */ (0,
|
|
1160
|
-
/* @__PURE__ */ (0,
|
|
1161
|
-
/* @__PURE__ */ (0,
|
|
1162
|
-
onBack && /* @__PURE__ */ (0,
|
|
1020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Overlay, { isOpen, zIndex, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "matchid-drawer", children: [
|
|
1021
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `matchid-drawer-header matchid-flex`, children: [
|
|
1022
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `matchid-drawer-header-content matchid-flex`, children: [
|
|
1023
|
+
onBack && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ArrowLeftIcon, { height: 25, width: 24, className: "matchid-drawer-header-back", onClick: onBack }),
|
|
1163
1024
|
title
|
|
1164
1025
|
] }),
|
|
1165
|
-
showClose && /* @__PURE__ */ (0,
|
|
1026
|
+
showClose && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(CloseRoundIcon, { className: "matchid-drawer-header-close", onClick: onClose })
|
|
1166
1027
|
] }),
|
|
1167
1028
|
children
|
|
1168
1029
|
] }) });
|
|
1169
1030
|
}
|
|
1170
1031
|
|
|
1171
1032
|
// src/ui/HashPanel/index.tsx
|
|
1172
|
-
var
|
|
1033
|
+
var import_react12 = require("react");
|
|
1173
1034
|
|
|
1174
1035
|
// src/ui/ModalDrawer/index.tsx
|
|
1175
|
-
var
|
|
1036
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
1176
1037
|
function ModalDrawer({
|
|
1177
1038
|
title,
|
|
1178
1039
|
drawerTitleVisible = true,
|
|
@@ -1180,9 +1041,9 @@ function ModalDrawer({
|
|
|
1180
1041
|
}) {
|
|
1181
1042
|
const isDownMd = useDownMd();
|
|
1182
1043
|
if (isDownMd) {
|
|
1183
|
-
return /* @__PURE__ */ (0,
|
|
1044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ModalWithHeader, { ...props, title });
|
|
1184
1045
|
}
|
|
1185
|
-
return /* @__PURE__ */ (0,
|
|
1046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Drawer, { ...props, title: drawerTitleVisible ? title : null });
|
|
1186
1047
|
}
|
|
1187
1048
|
|
|
1188
1049
|
// src/assets/img/confirm.gif
|
|
@@ -1238,7 +1099,7 @@ function useHash({
|
|
|
1238
1099
|
}
|
|
1239
1100
|
|
|
1240
1101
|
// src/ui/HashPanel/index.tsx
|
|
1241
|
-
var
|
|
1102
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
1242
1103
|
function HashPanel({
|
|
1243
1104
|
hash,
|
|
1244
1105
|
chain,
|
|
@@ -1246,7 +1107,7 @@ function HashPanel({
|
|
|
1246
1107
|
onClose,
|
|
1247
1108
|
zIndex
|
|
1248
1109
|
}) {
|
|
1249
|
-
const [status, setStatus] = (0,
|
|
1110
|
+
const [status, setStatus] = (0, import_react12.useState)("confirm");
|
|
1250
1111
|
const statusMaps = {
|
|
1251
1112
|
"confirm": {
|
|
1252
1113
|
icon: confirm_default,
|
|
@@ -1270,8 +1131,8 @@ function HashPanel({
|
|
|
1270
1131
|
}
|
|
1271
1132
|
};
|
|
1272
1133
|
const statusValue = statusMaps[status];
|
|
1273
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
1274
|
-
(0,
|
|
1134
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react12.useState)(true);
|
|
1135
|
+
(0, import_react12.useEffect)(() => {
|
|
1275
1136
|
if (hash) {
|
|
1276
1137
|
setShouldRefetch(true);
|
|
1277
1138
|
setStatus("pending");
|
|
@@ -1284,7 +1145,7 @@ function HashPanel({
|
|
|
1284
1145
|
chain,
|
|
1285
1146
|
refetchInterval: shouldRefetch ? 3e3 : false
|
|
1286
1147
|
});
|
|
1287
|
-
(0,
|
|
1148
|
+
(0, import_react12.useEffect)(() => {
|
|
1288
1149
|
if (hashQuery.data == 1 || hashQuery.data == -1) {
|
|
1289
1150
|
setShouldRefetch(false);
|
|
1290
1151
|
}
|
|
@@ -1297,14 +1158,14 @@ function HashPanel({
|
|
|
1297
1158
|
}
|
|
1298
1159
|
}, [hashQuery.data]);
|
|
1299
1160
|
const link = chain ? `${chain?.blockExplorers?.default.url}/tx/${hash}` : "";
|
|
1300
|
-
return /* @__PURE__ */ (0,
|
|
1161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
1301
1162
|
ModalDrawer,
|
|
1302
1163
|
{
|
|
1303
1164
|
isOpen,
|
|
1304
1165
|
showClose: true,
|
|
1305
1166
|
onClose,
|
|
1306
1167
|
zIndex,
|
|
1307
|
-
title: /* @__PURE__ */ (0,
|
|
1168
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
1308
1169
|
"div",
|
|
1309
1170
|
{
|
|
1310
1171
|
className: "matchid-hashpanel-header",
|
|
@@ -1314,39 +1175,39 @@ function HashPanel({
|
|
|
1314
1175
|
children: statusValue.text
|
|
1315
1176
|
}
|
|
1316
1177
|
),
|
|
1317
|
-
children: /* @__PURE__ */ (0,
|
|
1318
|
-
/* @__PURE__ */ (0,
|
|
1319
|
-
/* @__PURE__ */ (0,
|
|
1178
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "matchid-hashpanel-box", children: [
|
|
1179
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "matchid-hashpanel-content", children: [
|
|
1180
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: `matchid-hashpanel-status`, style: {
|
|
1320
1181
|
color: statusValue.color
|
|
1321
1182
|
}, children: statusValue.text }),
|
|
1322
|
-
/* @__PURE__ */ (0,
|
|
1323
|
-
hash && /* @__PURE__ */ (0,
|
|
1183
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("img", { src: statusValue.icon, alt: statusValue.text, className: `matchid-hashpanel-img` }),
|
|
1184
|
+
hash && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "matchid-hashpanel-hash", children: [
|
|
1324
1185
|
"Hash:",
|
|
1325
|
-
/* @__PURE__ */ (0,
|
|
1186
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("a", { href: link, target: "_blank", children: hash })
|
|
1326
1187
|
] })
|
|
1327
1188
|
] }),
|
|
1328
|
-
/* @__PURE__ */ (0,
|
|
1189
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Button, { onClick: onClose, size: "lg", block: true, children: "Back" })
|
|
1329
1190
|
] })
|
|
1330
1191
|
}
|
|
1331
1192
|
);
|
|
1332
1193
|
}
|
|
1333
1194
|
function HashPanel_default(props) {
|
|
1334
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
1195
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(HashPanel, { ...props });
|
|
1335
1196
|
}
|
|
1336
1197
|
|
|
1337
1198
|
// src/ui/Switch/index.tsx
|
|
1338
|
-
var
|
|
1199
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
1339
1200
|
|
|
1340
1201
|
// src/ui/AlphaAvatar/index.tsx
|
|
1341
|
-
var
|
|
1342
|
-
var
|
|
1343
|
-
function
|
|
1202
|
+
var import_react13 = require("react");
|
|
1203
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
1204
|
+
function AlphaAvatar({
|
|
1344
1205
|
name,
|
|
1345
1206
|
size = "default",
|
|
1346
1207
|
className = "",
|
|
1347
1208
|
style
|
|
1348
1209
|
}) {
|
|
1349
|
-
const avatar = (0,
|
|
1210
|
+
const avatar = (0, import_react13.useMemo)(() => {
|
|
1350
1211
|
if (name) {
|
|
1351
1212
|
const char = name[0].toUpperCase();
|
|
1352
1213
|
if (char.match(/[a-zA-Z0-9]/)) {
|
|
@@ -1356,7 +1217,7 @@ function AlphaAvatar2({
|
|
|
1356
1217
|
return "";
|
|
1357
1218
|
}, [name]);
|
|
1358
1219
|
const numberSize = typeof size === "number" ? size : size === "sm" ? 24 : size === "default" ? 40 : 64;
|
|
1359
|
-
return /* @__PURE__ */ (0,
|
|
1220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
1360
1221
|
width: numberSize,
|
|
1361
1222
|
height: numberSize,
|
|
1362
1223
|
fontSize: Math.ceil(numberSize / 2),
|
|
@@ -1365,7 +1226,7 @@ function AlphaAvatar2({
|
|
|
1365
1226
|
}
|
|
1366
1227
|
|
|
1367
1228
|
// src/ui/Radio/index.tsx
|
|
1368
|
-
var
|
|
1229
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
1369
1230
|
function Radio({
|
|
1370
1231
|
checked = false,
|
|
1371
1232
|
onChange,
|
|
@@ -1374,23 +1235,220 @@ function Radio({
|
|
|
1374
1235
|
className = "",
|
|
1375
1236
|
style = {}
|
|
1376
1237
|
}) {
|
|
1377
|
-
return /* @__PURE__ */ (0,
|
|
1238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { onClick: onChange, className: `matchid-radio ${className} ${checked ? "matchid-radio-checked" : ""}`, style: {
|
|
1378
1239
|
width: size,
|
|
1379
1240
|
height: size,
|
|
1380
1241
|
...style,
|
|
1381
1242
|
// @ts-ignore
|
|
1382
1243
|
"--matchid-radio-checked": color
|
|
1383
|
-
}, children: checked && /* @__PURE__ */ (0,
|
|
1244
|
+
}, children: checked && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: `matchid-radio-content`, style: {
|
|
1384
1245
|
width: Math.floor(size * 0.7),
|
|
1385
1246
|
height: Math.floor(size * 0.7)
|
|
1386
1247
|
} }) });
|
|
1387
1248
|
}
|
|
1388
1249
|
|
|
1389
|
-
// src/
|
|
1390
|
-
var
|
|
1250
|
+
// src/ui/Skeleton/index.tsx
|
|
1251
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
1252
|
+
|
|
1253
|
+
// src/ui/Tabs/index.tsx
|
|
1254
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
1255
|
+
|
|
1256
|
+
// src/components/EVMModal/index.tsx
|
|
1257
|
+
var import_react16 = require("react");
|
|
1258
|
+
|
|
1259
|
+
// src/hooks/eventManager.ts
|
|
1260
|
+
var EventManager = class {
|
|
1261
|
+
constructor() {
|
|
1262
|
+
this.listeners = {};
|
|
1263
|
+
}
|
|
1264
|
+
on(event, callback) {
|
|
1265
|
+
if (!this.listeners[event]) {
|
|
1266
|
+
this.listeners[event] = /* @__PURE__ */ new Set();
|
|
1267
|
+
}
|
|
1268
|
+
this.listeners[event].add(callback);
|
|
1269
|
+
}
|
|
1270
|
+
off(event, callback) {
|
|
1271
|
+
if (this.listeners[event]) {
|
|
1272
|
+
this.listeners[event].delete(callback);
|
|
1273
|
+
if (this.listeners[event].size === 0) {
|
|
1274
|
+
delete this.listeners[event];
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
emit(event, ...args) {
|
|
1279
|
+
if (this.listeners[event]) {
|
|
1280
|
+
this.listeners[event].forEach((callback) => callback(...args));
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
};
|
|
1284
|
+
var eventManager = new EventManager();
|
|
1285
|
+
var eventManager_default = eventManager;
|
|
1286
|
+
|
|
1287
|
+
// src/components/EVMModal/index.tsx
|
|
1288
|
+
var import_react_intl9 = require("react-intl");
|
|
1289
|
+
|
|
1290
|
+
// src/components/WalletModalContent/index.tsx
|
|
1291
|
+
var import_react14 = require("react");
|
|
1292
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
1293
|
+
|
|
1294
|
+
// src/components/EVMModal/index.tsx
|
|
1295
|
+
var import_chains = require("wagmi/chains");
|
|
1296
|
+
var import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
1297
|
+
var import_wagmi2 = require("wagmi");
|
|
1298
|
+
var import_wallets = require("@rainbow-me/rainbowkit/wallets");
|
|
1299
|
+
|
|
1300
|
+
// src/config/chains/MatchMain.ts
|
|
1391
1301
|
var import_viem2 = require("viem");
|
|
1392
|
-
var
|
|
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
|
+
|
|
1362
|
+
// src/hooks/useWalletBox.ts
|
|
1363
|
+
var import_react15 = require("react");
|
|
1364
|
+
|
|
1365
|
+
// src/hooks/useEthersSigner.ts
|
|
1366
|
+
var React4 = __toESM(require("react"));
|
|
1367
|
+
var import_wagmi = require("wagmi");
|
|
1368
|
+
var import_ethers = require("ethers");
|
|
1369
|
+
|
|
1370
|
+
// src/components/EVMModal/index.tsx
|
|
1371
|
+
var import_siwe = require("siwe");
|
|
1372
|
+
var import_styles = require("@rainbow-me/rainbowkit/styles.css");
|
|
1373
|
+
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
|
+
|
|
1392
|
+
// src/components/TRONModal/index.tsx
|
|
1393
|
+
var import_react18 = __toESM(require("react"));
|
|
1394
|
+
var import_react_intl10 = require("react-intl");
|
|
1395
|
+
|
|
1396
|
+
// src/hooks/useTRONWallet.ts
|
|
1397
|
+
var import_react17 = require("react");
|
|
1398
|
+
|
|
1399
|
+
// src/components/TRONModal/index.tsx
|
|
1400
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
1401
|
+
|
|
1402
|
+
// src/components/TONModal/index.tsx
|
|
1403
|
+
var import_react19 = __toESM(require("react"));
|
|
1404
|
+
var import_react_intl11 = require("react-intl");
|
|
1405
|
+
var import_ui_react = require("@tonconnect/ui-react");
|
|
1406
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
1407
|
+
|
|
1408
|
+
// src/components/BTCModal/index.tsx
|
|
1409
|
+
var import_react21 = __toESM(require("react"));
|
|
1410
|
+
var import_react_intl12 = require("react-intl");
|
|
1411
|
+
|
|
1412
|
+
// src/lib/btc/XverseAdapter.ts
|
|
1413
|
+
var import_sats_connect = require("sats-connect");
|
|
1414
|
+
|
|
1415
|
+
// src/hooks/useBTCWallet.ts
|
|
1416
|
+
var import_react20 = require("react");
|
|
1417
|
+
|
|
1418
|
+
// src/components/BTCModal/index.tsx
|
|
1393
1419
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
1420
|
+
|
|
1421
|
+
// src/components/WalletModal/index.tsx
|
|
1422
|
+
var import_react22 = require("react");
|
|
1423
|
+
var import_react_intl13 = require("react-intl");
|
|
1424
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
1425
|
+
|
|
1426
|
+
// src/components/AlphaAvatar/index.tsx
|
|
1427
|
+
var import_react23 = require("react");
|
|
1428
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
1429
|
+
function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
1430
|
+
const [avatar, setAvatar] = (0, import_react23.useState)(void 0);
|
|
1431
|
+
(0, import_react23.useEffect)(() => {
|
|
1432
|
+
if (name) {
|
|
1433
|
+
const char = name[0].toUpperCase();
|
|
1434
|
+
setAvatar(char);
|
|
1435
|
+
}
|
|
1436
|
+
}, [name]);
|
|
1437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
1438
|
+
width: size,
|
|
1439
|
+
height: size,
|
|
1440
|
+
fontSize: Math.ceil(size / 2)
|
|
1441
|
+
}, children: avatar });
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
// src/components/WalletAsset/index.tsx
|
|
1445
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
1446
|
+
|
|
1447
|
+
// src/components/TokenSend/index.tsx
|
|
1448
|
+
var import_react24 = require("react");
|
|
1449
|
+
var import_viem4 = require("viem");
|
|
1450
|
+
var import_react_intl14 = require("react-intl");
|
|
1451
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
1394
1452
|
function Input2({
|
|
1395
1453
|
onChange,
|
|
1396
1454
|
placeholder,
|
|
@@ -1400,8 +1458,8 @@ function Input2({
|
|
|
1400
1458
|
error,
|
|
1401
1459
|
size = "df"
|
|
1402
1460
|
}) {
|
|
1403
|
-
return /* @__PURE__ */ (0,
|
|
1404
|
-
/* @__PURE__ */ (0,
|
|
1461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-input-box ${"matchid-token-input-" + size}`, children: [
|
|
1462
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
1405
1463
|
"input",
|
|
1406
1464
|
{
|
|
1407
1465
|
placeholder,
|
|
@@ -1412,7 +1470,7 @@ function Input2({
|
|
|
1412
1470
|
className: `matchid-token-input ${error ? "matchid-token-input-error" : ""}`
|
|
1413
1471
|
}
|
|
1414
1472
|
),
|
|
1415
|
-
error && /* @__PURE__ */ (0,
|
|
1473
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "matchid-token-input-error-text", children: error })
|
|
1416
1474
|
] });
|
|
1417
1475
|
}
|
|
1418
1476
|
function TokenSend({
|
|
@@ -1423,35 +1481,35 @@ function TokenSend({
|
|
|
1423
1481
|
}) {
|
|
1424
1482
|
const { list: chainList } = useMatchChain();
|
|
1425
1483
|
const intl = (0, import_react_intl14.useIntl)();
|
|
1426
|
-
const { createWalletClient: createWalletClient2 } =
|
|
1484
|
+
const { createWalletClient: createWalletClient2 } = useWallet();
|
|
1427
1485
|
const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
|
|
1428
|
-
const chain = (0,
|
|
1486
|
+
const chain = (0, import_react24.useMemo)(() => {
|
|
1429
1487
|
return chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
1430
1488
|
}, [chainList, token.chain_id]);
|
|
1431
|
-
const walletClient = (0,
|
|
1489
|
+
const walletClient = (0, import_react24.useMemo)(() => {
|
|
1432
1490
|
return createWalletClient2({
|
|
1433
1491
|
// @ts-ignore
|
|
1434
|
-
chain: (0,
|
|
1435
|
-
transport: (0,
|
|
1492
|
+
chain: (0, import_viem4.defineChain)(chain),
|
|
1493
|
+
transport: (0, import_viem4.http)()
|
|
1436
1494
|
});
|
|
1437
1495
|
}, [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,
|
|
1496
|
+
const [amount, setAmount] = (0, import_react24.useState)("");
|
|
1497
|
+
const [address, setAddress] = (0, import_react24.useState)("");
|
|
1498
|
+
const [loading, setLoading] = (0, import_react24.useState)(false);
|
|
1499
|
+
const [sending, setSending] = (0, import_react24.useState)(false);
|
|
1500
|
+
const [txError, setTxError] = (0, import_react24.useState)("");
|
|
1501
|
+
const transaction = (0, import_react24.useMemo)(() => {
|
|
1444
1502
|
const reg = /^0x[a-fA-F0-9]{40}$/;
|
|
1445
1503
|
if (!amount || !address || !reg.test(address)) {
|
|
1446
1504
|
return;
|
|
1447
1505
|
}
|
|
1448
|
-
const viemChain = (0,
|
|
1506
|
+
const viemChain = (0, import_viem4.defineChain)(chain);
|
|
1449
1507
|
const to = isNative ? address : token.address;
|
|
1450
|
-
const value = isNative ? (0,
|
|
1451
|
-
const data = isNative ? "0x" : (0,
|
|
1452
|
-
abi:
|
|
1508
|
+
const value = isNative ? (0, import_viem4.parseUnits)(amount, parseInt(token?.decimals || "18")) : BigInt(0);
|
|
1509
|
+
const data = isNative ? "0x" : (0, import_viem4.encodeFunctionData)({
|
|
1510
|
+
abi: import_viem4.erc20Abi,
|
|
1453
1511
|
functionName: "transfer",
|
|
1454
|
-
args: [address, (0,
|
|
1512
|
+
args: [address, (0, import_viem4.parseUnits)(amount, parseInt(token?.decimals || "18"))]
|
|
1455
1513
|
});
|
|
1456
1514
|
return {
|
|
1457
1515
|
to,
|
|
@@ -1471,7 +1529,7 @@ function TokenSend({
|
|
|
1471
1529
|
setLoading(false);
|
|
1472
1530
|
}
|
|
1473
1531
|
};
|
|
1474
|
-
const error = (0,
|
|
1532
|
+
const error = (0, import_react24.useMemo)(() => {
|
|
1475
1533
|
setTxError("");
|
|
1476
1534
|
let amountError = "";
|
|
1477
1535
|
let addressError = "";
|
|
@@ -1514,7 +1572,7 @@ function TokenSend({
|
|
|
1514
1572
|
setAmount(value);
|
|
1515
1573
|
}
|
|
1516
1574
|
};
|
|
1517
|
-
const canSend = (0,
|
|
1575
|
+
const canSend = (0, import_react24.useMemo)(() => {
|
|
1518
1576
|
return !error.amount && !error.address && amount && address;
|
|
1519
1577
|
}, [error]);
|
|
1520
1578
|
const onNext = async () => {
|
|
@@ -1524,7 +1582,7 @@ function TokenSend({
|
|
|
1524
1582
|
}
|
|
1525
1583
|
onClose();
|
|
1526
1584
|
};
|
|
1527
|
-
(0,
|
|
1585
|
+
(0, import_react24.useEffect)(() => {
|
|
1528
1586
|
const receiveMessage = (event) => {
|
|
1529
1587
|
if (event.data) {
|
|
1530
1588
|
if (event.data.source == "match-wallet") {
|
|
@@ -1540,24 +1598,24 @@ function TokenSend({
|
|
|
1540
1598
|
window.removeEventListener("message", receiveMessage);
|
|
1541
1599
|
};
|
|
1542
1600
|
}, []);
|
|
1543
|
-
return /* @__PURE__ */ (0,
|
|
1544
|
-
/* @__PURE__ */ (0,
|
|
1545
|
-
/* @__PURE__ */ (0,
|
|
1546
|
-
/* @__PURE__ */ (0,
|
|
1547
|
-
/* @__PURE__ */ (0,
|
|
1548
|
-
/* @__PURE__ */ (0,
|
|
1549
|
-
token.icon ? /* @__PURE__ */ (0,
|
|
1601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ModalDrawer, { isOpen: true, onClose, zIndex, title: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react_intl14.FormattedMessage, { id: "send" }), onBack, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-send-box`, children: [
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
1603
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-amount-content`, children: [
|
|
1604
|
+
/* @__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)(import_react_intl14.FormattedMessage, { id: "amount" }) }),
|
|
1606
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-amount-chain`, children: [
|
|
1607
|
+
token.icon ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
1550
1608
|
"img",
|
|
1551
1609
|
{
|
|
1552
1610
|
src: token?.icon,
|
|
1553
1611
|
alt: token?.symbol,
|
|
1554
1612
|
className: `matchid-token-amount-chain-icon`
|
|
1555
1613
|
}
|
|
1556
|
-
) : /* @__PURE__ */ (0,
|
|
1557
|
-
/* @__PURE__ */ (0,
|
|
1614
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(AlphaAvatar, { name: token.symbol || token.name || "", size: 16 }),
|
|
1615
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { children: token?.symbol })
|
|
1558
1616
|
] })
|
|
1559
1617
|
] }),
|
|
1560
|
-
/* @__PURE__ */ (0,
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
1561
1619
|
Input2,
|
|
1562
1620
|
{
|
|
1563
1621
|
type: "text",
|
|
@@ -1570,18 +1628,18 @@ function TokenSend({
|
|
|
1570
1628
|
error: error.amount || txError
|
|
1571
1629
|
}
|
|
1572
1630
|
),
|
|
1573
|
-
/* @__PURE__ */ (0,
|
|
1574
|
-
/* @__PURE__ */ (0,
|
|
1575
|
-
/* @__PURE__ */ (0,
|
|
1631
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-amount-footer`, children: [
|
|
1632
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `matchid-token-amount-title`, children: [
|
|
1633
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react_intl14.FormattedMessage, { id: "balance" }),
|
|
1576
1634
|
":"
|
|
1577
1635
|
] }),
|
|
1578
|
-
/* @__PURE__ */ (0,
|
|
1636
|
+
/* @__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 }) })
|
|
1579
1637
|
] }),
|
|
1580
|
-
/* @__PURE__ */ (0,
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(TransferIcon, { className: "matchid-token-amount-transfer" })
|
|
1581
1639
|
] }),
|
|
1582
|
-
/* @__PURE__ */ (0,
|
|
1583
|
-
/* @__PURE__ */ (0,
|
|
1584
|
-
/* @__PURE__ */ (0,
|
|
1640
|
+
/* @__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)(import_react_intl14.FormattedMessage, { id: "receiveTitle" }) }) }),
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
1585
1643
|
Input2,
|
|
1586
1644
|
{
|
|
1587
1645
|
type: "text",
|
|
@@ -1597,7 +1655,7 @@ function TokenSend({
|
|
|
1597
1655
|
)
|
|
1598
1656
|
] })
|
|
1599
1657
|
] }),
|
|
1600
|
-
/* @__PURE__ */ (0,
|
|
1658
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
1601
1659
|
Button,
|
|
1602
1660
|
{
|
|
1603
1661
|
size: "lg",
|
|
@@ -1606,7 +1664,7 @@ function TokenSend({
|
|
|
1606
1664
|
disabled: !canSend || !!txError,
|
|
1607
1665
|
onClick: onNext,
|
|
1608
1666
|
loading: loading || sending,
|
|
1609
|
-
children: /* @__PURE__ */ (0,
|
|
1667
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react_intl14.FormattedMessage, { id: "next" })
|
|
1610
1668
|
}
|
|
1611
1669
|
)
|
|
1612
1670
|
] }) });
|
|
@@ -1614,12 +1672,12 @@ function TokenSend({
|
|
|
1614
1672
|
|
|
1615
1673
|
// src/components/TokenDetail/index.tsx
|
|
1616
1674
|
var import_react_intl15 = require("react-intl");
|
|
1617
|
-
var
|
|
1675
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
1618
1676
|
|
|
1619
1677
|
// src/components/TokenSendList/index.tsx
|
|
1620
|
-
var
|
|
1678
|
+
var import_react25 = require("react");
|
|
1621
1679
|
var import_react_intl16 = require("react-intl");
|
|
1622
|
-
var
|
|
1680
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
1623
1681
|
function TokenSendList({ close }) {
|
|
1624
1682
|
const isDownMd = useDownMd();
|
|
1625
1683
|
const walletAssets = useMatchWalletAssets();
|
|
@@ -1627,20 +1685,20 @@ function TokenSendList({ close }) {
|
|
|
1627
1685
|
list: walletAssets.mergedAssets
|
|
1628
1686
|
});
|
|
1629
1687
|
const { list } = useMatchChain();
|
|
1630
|
-
const [checked, setChecked] = (0,
|
|
1688
|
+
const [checked, setChecked] = (0, import_react25.useState)();
|
|
1631
1689
|
const modal = useModal();
|
|
1632
1690
|
const onNext = () => {
|
|
1633
1691
|
checked && modal.show((props) => {
|
|
1634
|
-
return /* @__PURE__ */ (0,
|
|
1692
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TokenSend, { onClose: () => {
|
|
1635
1693
|
props.close();
|
|
1636
1694
|
close();
|
|
1637
1695
|
}, onBack: props.close, zIndex: props.zIndex, token: checked });
|
|
1638
1696
|
});
|
|
1639
1697
|
};
|
|
1640
|
-
return /* @__PURE__ */ (0,
|
|
1641
|
-
/* @__PURE__ */ (0,
|
|
1698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "matchid-token-send-list-box", children: [
|
|
1699
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "matchid-token-send-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
1642
1700
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
1643
|
-
return /* @__PURE__ */ (0,
|
|
1701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
1644
1702
|
"div",
|
|
1645
1703
|
{
|
|
1646
1704
|
className: `matchid-token-send-item ${checked?.address == n.address ? "matchid-token-send-chekced" : ""}`,
|
|
@@ -1648,18 +1706,18 @@ function TokenSendList({ close }) {
|
|
|
1648
1706
|
setChecked(n);
|
|
1649
1707
|
},
|
|
1650
1708
|
children: [
|
|
1651
|
-
/* @__PURE__ */ (0,
|
|
1652
|
-
/* @__PURE__ */ (0,
|
|
1653
|
-
/* @__PURE__ */ (0,
|
|
1654
|
-
n.icon ? /* @__PURE__ */ (0,
|
|
1655
|
-
|
|
1709
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Radio, { checked: checked?.address == n.address, size: isDownMd ? 18 : 24 }),
|
|
1710
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
1711
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "matchid-token-send-logo", children: [
|
|
1712
|
+
n.icon ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("img", { src: n.icon, alt: n.symbol, className: `matchid-token-send-icon` }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
1713
|
+
AlphaAvatar2,
|
|
1656
1714
|
{
|
|
1657
1715
|
className: `matchid-token-send-icon`,
|
|
1658
1716
|
size: isDownMd ? 28 : 40,
|
|
1659
1717
|
name: n.symbol || n.name || ""
|
|
1660
1718
|
}
|
|
1661
1719
|
),
|
|
1662
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
1720
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
1663
1721
|
"img",
|
|
1664
1722
|
{
|
|
1665
1723
|
src: chain.iconUrl,
|
|
@@ -1668,9 +1726,9 @@ function TokenSendList({ close }) {
|
|
|
1668
1726
|
}
|
|
1669
1727
|
)
|
|
1670
1728
|
] }),
|
|
1671
|
-
/* @__PURE__ */ (0,
|
|
1672
|
-
/* @__PURE__ */ (0,
|
|
1673
|
-
/* @__PURE__ */ (0,
|
|
1729
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `matchid-token-send-info`, children: [
|
|
1730
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: `matchid-token-send-name`, children: n.symbol }),
|
|
1731
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: `matchid-token-send-balance`, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(NumberFormatter, { value: n.balance, tFixNum: 3 }) })
|
|
1674
1732
|
] })
|
|
1675
1733
|
] })
|
|
1676
1734
|
]
|
|
@@ -1678,15 +1736,15 @@ function TokenSendList({ close }) {
|
|
|
1678
1736
|
index
|
|
1679
1737
|
);
|
|
1680
1738
|
}) }),
|
|
1681
|
-
/* @__PURE__ */ (0,
|
|
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)(import_react_intl16.FormattedMessage, { id: "next" }) })
|
|
1682
1740
|
] });
|
|
1683
1741
|
}
|
|
1684
1742
|
|
|
1685
1743
|
// src/components/TransactionList/index.tsx
|
|
1686
1744
|
var import_react_infinite_scroll_component = __toESM(require("react-infinite-scroll-component"));
|
|
1687
|
-
var
|
|
1688
|
-
var
|
|
1689
|
-
var
|
|
1745
|
+
var import_react26 = require("react");
|
|
1746
|
+
var import_viem5 = require("viem");
|
|
1747
|
+
var import_viem6 = require("viem");
|
|
1690
1748
|
|
|
1691
1749
|
// src/store/useContractStore.ts
|
|
1692
1750
|
var import_zustand3 = require("zustand");
|
|
@@ -1746,15 +1804,87 @@ var useContractStore_default = useContractStore;
|
|
|
1746
1804
|
|
|
1747
1805
|
// src/components/TransactionList/index.tsx
|
|
1748
1806
|
var import_react_intl17 = require("react-intl");
|
|
1749
|
-
var
|
|
1807
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
1750
1808
|
|
|
1751
|
-
// src/
|
|
1752
|
-
var
|
|
1809
|
+
// src/hooks/api/bind.ts
|
|
1810
|
+
var import_react_query3 = require("@tanstack/react-query");
|
|
1811
|
+
|
|
1812
|
+
// src/hooks/api/poh.ts
|
|
1813
|
+
var import_react_query4 = require("@tanstack/react-query");
|
|
1814
|
+
|
|
1815
|
+
// src/hooks/api/wallet.ts
|
|
1816
|
+
var import_react_query5 = require("@tanstack/react-query");
|
|
1817
|
+
function useChainListQuery(options) {
|
|
1818
|
+
const { isLogin, token } = useUserInfo();
|
|
1819
|
+
return (0, import_react_query5.useQuery)({
|
|
1820
|
+
queryKey: ["match-user-chain-list", token],
|
|
1821
|
+
queryFn: async () => {
|
|
1822
|
+
const res = await getUserChainListApi();
|
|
1823
|
+
if (!isSuccess(res)) {
|
|
1824
|
+
return [];
|
|
1825
|
+
}
|
|
1826
|
+
return res.data;
|
|
1827
|
+
},
|
|
1828
|
+
enabled: isLogin,
|
|
1829
|
+
...options
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
function useAssetListQuery({
|
|
1833
|
+
chainId,
|
|
1834
|
+
...options
|
|
1835
|
+
}) {
|
|
1836
|
+
const { isLogin, token } = useUserInfo();
|
|
1837
|
+
return (0, import_react_query5.useQuery)({
|
|
1838
|
+
queryKey: ["match-user-asset-list", token, chainId],
|
|
1839
|
+
queryFn: async () => {
|
|
1840
|
+
const res = await getUserWalletAssetApi({ chain_id: chainId.toString() });
|
|
1841
|
+
if (!isSuccess(res)) {
|
|
1842
|
+
return [];
|
|
1843
|
+
}
|
|
1844
|
+
return res.data || [];
|
|
1845
|
+
},
|
|
1846
|
+
enabled: isLogin,
|
|
1847
|
+
...options
|
|
1848
|
+
});
|
|
1849
|
+
}
|
|
1850
|
+
var USER_IMPORT_TOKEN_LIST_KEY = "match-user-import-token-list";
|
|
1851
|
+
function useImportTokenListQuery({
|
|
1852
|
+
chainId,
|
|
1853
|
+
...options
|
|
1854
|
+
}) {
|
|
1855
|
+
const { isLogin, token } = useUserInfo();
|
|
1856
|
+
return (0, import_react_query5.useQuery)({
|
|
1857
|
+
queryKey: [USER_IMPORT_TOKEN_LIST_KEY, token, chainId],
|
|
1858
|
+
queryFn: async () => {
|
|
1859
|
+
const res = await getUserImportTokenListApi({ chain_id: chainId.toString() });
|
|
1860
|
+
if (!isSuccess(res)) {
|
|
1861
|
+
return [];
|
|
1862
|
+
}
|
|
1863
|
+
return res.data || [];
|
|
1864
|
+
},
|
|
1865
|
+
enabled: isLogin,
|
|
1866
|
+
...options
|
|
1867
|
+
});
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
// src/hooks/api/contact.ts
|
|
1871
|
+
var import_react_query6 = require("@tanstack/react-query");
|
|
1872
|
+
var import_last = __toESM(require("lodash/last"));
|
|
1873
|
+
var import_react27 = require("react");
|
|
1874
|
+
|
|
1875
|
+
// src/components/ContactList/index.tsx
|
|
1876
|
+
var import_react_virtuoso = require("react-virtuoso");
|
|
1877
|
+
var import_react28 = require("react");
|
|
1753
1878
|
var import_react_intl18 = require("react-intl");
|
|
1754
|
-
var
|
|
1879
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
1880
|
+
|
|
1881
|
+
// src/components/CEXBindModal/index.tsx
|
|
1882
|
+
var import_react29 = require("react");
|
|
1883
|
+
var import_react_intl19 = require("react-intl");
|
|
1884
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
1755
1885
|
|
|
1756
1886
|
// src/context/BusinessProvider.tsx
|
|
1757
|
-
var
|
|
1887
|
+
var import_react_query7 = require("@tanstack/react-query");
|
|
1758
1888
|
|
|
1759
1889
|
// src/store/useStore.ts
|
|
1760
1890
|
var import_zustand4 = require("zustand");
|
|
@@ -1769,15 +1899,15 @@ var useStore = (0, import_zustand4.create)((set) => ({
|
|
|
1769
1899
|
var useStore_default = useStore;
|
|
1770
1900
|
|
|
1771
1901
|
// src/context/BusinessProvider.tsx
|
|
1772
|
-
var
|
|
1902
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
1773
1903
|
|
|
1774
1904
|
// src/context/ModalContext.tsx
|
|
1775
|
-
var
|
|
1905
|
+
var import_react30 = require("react");
|
|
1776
1906
|
var import_react_dom = require("react-dom");
|
|
1777
|
-
var
|
|
1778
|
-
var ModalContext = (0,
|
|
1907
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
1908
|
+
var ModalContext = (0, import_react30.createContext)(null);
|
|
1779
1909
|
function useModal() {
|
|
1780
|
-
const context = (0,
|
|
1910
|
+
const context = (0, import_react30.useContext)(ModalContext);
|
|
1781
1911
|
if (!context) {
|
|
1782
1912
|
throw new Error("useModal must be used within a ModalProvider");
|
|
1783
1913
|
}
|
|
@@ -1785,12 +1915,12 @@ function useModal() {
|
|
|
1785
1915
|
}
|
|
1786
1916
|
|
|
1787
1917
|
// src/context/ToastContext.tsx
|
|
1788
|
-
var
|
|
1918
|
+
var import_react31 = require("react");
|
|
1789
1919
|
var import_react_dom2 = require("react-dom");
|
|
1790
|
-
var
|
|
1791
|
-
var ToastContext = (0,
|
|
1920
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
1921
|
+
var ToastContext = (0, import_react31.createContext)(null);
|
|
1792
1922
|
function useToast() {
|
|
1793
|
-
const context = (0,
|
|
1923
|
+
const context = (0, import_react31.useContext)(ToastContext);
|
|
1794
1924
|
if (!context) {
|
|
1795
1925
|
throw new Error("useToast must be used within a ToastProvider");
|
|
1796
1926
|
}
|
|
@@ -1798,23 +1928,23 @@ function useToast() {
|
|
|
1798
1928
|
}
|
|
1799
1929
|
|
|
1800
1930
|
// src/context/index.tsx
|
|
1801
|
-
var
|
|
1931
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
1802
1932
|
|
|
1803
1933
|
// src/hooks/useWalletInit.ts
|
|
1804
|
-
var
|
|
1934
|
+
var import_react32 = require("react");
|
|
1805
1935
|
var AppClientId = getAppClientId();
|
|
1806
1936
|
|
|
1807
1937
|
// src/hooks/useInit.tsx
|
|
1808
|
-
var
|
|
1938
|
+
var import_react33 = require("react");
|
|
1809
1939
|
|
|
1810
1940
|
// src/MatchContext.tsx
|
|
1811
|
-
var
|
|
1812
|
-
var
|
|
1813
|
-
var
|
|
1814
|
-
var queryClient = new
|
|
1815
|
-
var MatchContext = (0,
|
|
1941
|
+
var import_react_query8 = require("@tanstack/react-query");
|
|
1942
|
+
var import_react_intl20 = require("react-intl");
|
|
1943
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
1944
|
+
var queryClient = new import_react_query8.QueryClient();
|
|
1945
|
+
var MatchContext = (0, import_react34.createContext)(void 0);
|
|
1816
1946
|
var useMatch = () => {
|
|
1817
|
-
const context = (0,
|
|
1947
|
+
const context = (0, import_react34.useContext)(MatchContext);
|
|
1818
1948
|
if (context === void 0) {
|
|
1819
1949
|
throw new Error("useMatch must be used within a MatchProvider");
|
|
1820
1950
|
}
|
|
@@ -1837,14 +1967,18 @@ function useUserInfo() {
|
|
|
1837
1967
|
refreshOverview
|
|
1838
1968
|
} = useLocalStore_default();
|
|
1839
1969
|
const { setTgAppAuthCode, emailLoginKey, setEmailLoginKey } = useStore_default();
|
|
1970
|
+
const isDownMd = useDownMd();
|
|
1840
1971
|
const { events, login } = useMatch();
|
|
1841
|
-
const { open:
|
|
1972
|
+
const { open: EVMOpen } = useEVMModalStore();
|
|
1842
1973
|
const { open: TRONOpen } = useTRONModalStore();
|
|
1843
1974
|
const { open: TONOpen } = useTONModalStore();
|
|
1844
1975
|
const { open: BTCOpen } = useBTCModalStore();
|
|
1845
1976
|
const { open: CEXBindOpen } = useCEXBindModalStore();
|
|
1846
1977
|
const walletModalStore = useWalletModalStore();
|
|
1847
|
-
const
|
|
1978
|
+
const getRedirectUri = () => {
|
|
1979
|
+
return encodeURIComponent(window.location.href);
|
|
1980
|
+
};
|
|
1981
|
+
const isLogin = (0, import_react35.useMemo)(() => !!token && !!overview, [token, overview]);
|
|
1848
1982
|
const logout = async () => {
|
|
1849
1983
|
try {
|
|
1850
1984
|
await toLogoutApi();
|
|
@@ -1912,8 +2046,12 @@ function useUserInfo() {
|
|
|
1912
2046
|
case "wallet":
|
|
1913
2047
|
return walletModalStore.open("login", extra?.methods);
|
|
1914
2048
|
case "evm":
|
|
1915
|
-
return
|
|
2049
|
+
return EVMOpen("login");
|
|
2050
|
+
// return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`)
|
|
1916
2051
|
case "sol":
|
|
2052
|
+
if (isDownMd) {
|
|
2053
|
+
return window.location.href = `${endpoints.auth}login/sol?appid=${appid}&locale=${locale}&redirect_uri=${getRedirectUri()}`;
|
|
2054
|
+
}
|
|
1917
2055
|
return window.open(`${endpoints.auth}login/sol?appid=${appid}&locale=${locale}`);
|
|
1918
2056
|
case "tron":
|
|
1919
2057
|
return TRONOpen("login");
|
|
@@ -1956,7 +2094,7 @@ function useUserInfo() {
|
|
|
1956
2094
|
const res = await verifyEmailCodeApi(obj);
|
|
1957
2095
|
if (res && res.data && isSuccess(res)) {
|
|
1958
2096
|
await login({
|
|
1959
|
-
mid: res.data.mid,
|
|
2097
|
+
// mid: res.data.mid,
|
|
1960
2098
|
token: `${res.data.token_type} ${res.data.access_token}`
|
|
1961
2099
|
});
|
|
1962
2100
|
return true;
|
|
@@ -2001,9 +2139,13 @@ function useUserInfo() {
|
|
|
2001
2139
|
case "wallet":
|
|
2002
2140
|
return walletModalStore.open("bind", extra?.methods);
|
|
2003
2141
|
case "evm":
|
|
2004
|
-
return
|
|
2142
|
+
return EVMOpen("bind");
|
|
2143
|
+
// return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)))
|
|
2005
2144
|
case "sol":
|
|
2006
|
-
|
|
2145
|
+
if (isDownMd) {
|
|
2146
|
+
return window.location.href = `${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}&redirect_uri=${getRedirectUri()}`;
|
|
2147
|
+
}
|
|
2148
|
+
return window.open(`${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}`);
|
|
2007
2149
|
case "tron":
|
|
2008
2150
|
return TRONOpen("bind");
|
|
2009
2151
|
case "ton":
|
|
@@ -2073,6 +2215,11 @@ function useUserInfo() {
|
|
|
2073
2215
|
window.addEventListener("message", authMessageHandle);
|
|
2074
2216
|
});
|
|
2075
2217
|
};
|
|
2218
|
+
const invite = async (invite_code) => {
|
|
2219
|
+
return await userInviteApi({
|
|
2220
|
+
invite_code
|
|
2221
|
+
});
|
|
2222
|
+
};
|
|
2076
2223
|
return {
|
|
2077
2224
|
loginByMethod,
|
|
2078
2225
|
loginByTelegram,
|
|
@@ -2096,14 +2243,15 @@ function useUserInfo() {
|
|
|
2096
2243
|
auth,
|
|
2097
2244
|
login: loginMethod,
|
|
2098
2245
|
bind,
|
|
2099
|
-
getAuthInfo
|
|
2246
|
+
getAuthInfo,
|
|
2247
|
+
invite
|
|
2100
2248
|
};
|
|
2101
2249
|
}
|
|
2102
2250
|
|
|
2103
2251
|
// src/hooks/useMatchEvents.ts
|
|
2104
|
-
var
|
|
2252
|
+
var import_react36 = require("react");
|
|
2105
2253
|
function useMatchEvents(handlers) {
|
|
2106
|
-
(0,
|
|
2254
|
+
(0, import_react36.useEffect)(() => {
|
|
2107
2255
|
Object.entries(handlers).forEach(([event, handler2]) => {
|
|
2108
2256
|
if (handler2) {
|
|
2109
2257
|
eventManager_default.on(event, handler2);
|
|
@@ -2120,11 +2268,11 @@ function useMatchEvents(handlers) {
|
|
|
2120
2268
|
}
|
|
2121
2269
|
|
|
2122
2270
|
// src/hooks/useWallet.tsx
|
|
2123
|
-
var import_viem5 = require("viem");
|
|
2124
|
-
var import_accounts = require("viem/accounts");
|
|
2125
|
-
var import_viem6 = require("viem");
|
|
2126
|
-
var import_react34 = require("react");
|
|
2127
2271
|
var import_viem7 = require("viem");
|
|
2272
|
+
var import_accounts = require("viem/accounts");
|
|
2273
|
+
var import_viem8 = require("viem");
|
|
2274
|
+
var import_react37 = require("react");
|
|
2275
|
+
var import_viem9 = require("viem");
|
|
2128
2276
|
|
|
2129
2277
|
// src/store/useTransactionStore.ts
|
|
2130
2278
|
var import_zustand5 = require("zustand");
|
|
@@ -2157,9 +2305,9 @@ var useTransactionStore = (0, import_zustand5.create)((0, import_middleware3.dev
|
|
|
2157
2305
|
var useTransactionStore_default = useTransactionStore;
|
|
2158
2306
|
|
|
2159
2307
|
// src/hooks/useWallet.tsx
|
|
2160
|
-
var
|
|
2308
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
2161
2309
|
var AppClientId2 = "react-sdk-" + getVersion();
|
|
2162
|
-
function
|
|
2310
|
+
function useWallet() {
|
|
2163
2311
|
const { address, wallet: walletConfig } = useLocalStore_default();
|
|
2164
2312
|
const { walletReady } = useStore_default();
|
|
2165
2313
|
const modal = useModal();
|
|
@@ -2208,7 +2356,7 @@ function useWallet2() {
|
|
|
2208
2356
|
throw error;
|
|
2209
2357
|
}
|
|
2210
2358
|
};
|
|
2211
|
-
const evmAccount = (0,
|
|
2359
|
+
const evmAccount = (0, import_react37.useMemo)(() => {
|
|
2212
2360
|
try {
|
|
2213
2361
|
return address ? (0, import_accounts.toAccount)({
|
|
2214
2362
|
address,
|
|
@@ -2247,14 +2395,14 @@ function useWallet2() {
|
|
|
2247
2395
|
return void 0;
|
|
2248
2396
|
}
|
|
2249
2397
|
}, [address]);
|
|
2250
|
-
(0,
|
|
2398
|
+
(0, import_react37.useEffect)(() => {
|
|
2251
2399
|
matchlog_default.log("qwe-evmAccount", evmAccount);
|
|
2252
2400
|
}, [evmAccount]);
|
|
2253
2401
|
const realCreateWalletClient = (parameters) => {
|
|
2254
2402
|
if (!evmAccount) {
|
|
2255
2403
|
return;
|
|
2256
2404
|
}
|
|
2257
|
-
const obj = (0,
|
|
2405
|
+
const obj = (0, import_viem8.createWalletClient)({
|
|
2258
2406
|
...parameters,
|
|
2259
2407
|
account: evmAccount
|
|
2260
2408
|
});
|
|
@@ -2330,7 +2478,7 @@ function useWallet2() {
|
|
|
2330
2478
|
address: evmAccount.address
|
|
2331
2479
|
});
|
|
2332
2480
|
modal.show((props) => {
|
|
2333
|
-
return /* @__PURE__ */ (0,
|
|
2481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, hash: txHash, chain: _chain });
|
|
2334
2482
|
});
|
|
2335
2483
|
clearInterval(window.matchProvider.transactionMessageIntervalMap[transactionId].interval);
|
|
2336
2484
|
delete window.matchProvider.transactionMessageIntervalMap[transactionId];
|
|
@@ -2344,7 +2492,7 @@ function useWallet2() {
|
|
|
2344
2492
|
};
|
|
2345
2493
|
const deployContract = async (parameters2) => {
|
|
2346
2494
|
const { abi, args, bytecode, ...request3 } = parameters2;
|
|
2347
|
-
const calldata = (0,
|
|
2495
|
+
const calldata = (0, import_viem9.encodeDeployData)({ abi, args, bytecode });
|
|
2348
2496
|
return await sendTransaction({
|
|
2349
2497
|
...request3,
|
|
2350
2498
|
data: calldata
|
|
@@ -2352,7 +2500,7 @@ function useWallet2() {
|
|
|
2352
2500
|
};
|
|
2353
2501
|
const writeContract = async (parameters2) => {
|
|
2354
2502
|
const { abi, address: address2, args, dataSuffix, functionName, ...request3 } = parameters2;
|
|
2355
|
-
const data = (0,
|
|
2503
|
+
const data = (0, import_viem7.encodeFunctionData)({
|
|
2356
2504
|
abi,
|
|
2357
2505
|
args,
|
|
2358
2506
|
functionName
|
|
@@ -2383,14 +2531,14 @@ function useWallet2() {
|
|
|
2383
2531
|
|
|
2384
2532
|
// src/hooks/useCopyClipboard.ts
|
|
2385
2533
|
var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
|
|
2386
|
-
var
|
|
2534
|
+
var import_react38 = require("react");
|
|
2387
2535
|
function useCopyClipboard(timeout = 500) {
|
|
2388
|
-
const [isCopied, setIsCopied] = (0,
|
|
2389
|
-
const staticCopy = (0,
|
|
2536
|
+
const [isCopied, setIsCopied] = (0, import_react38.useState)(false);
|
|
2537
|
+
const staticCopy = (0, import_react38.useCallback)((text) => {
|
|
2390
2538
|
const didCopy = (0, import_copy_to_clipboard.default)(text);
|
|
2391
2539
|
setIsCopied(didCopy);
|
|
2392
2540
|
}, []);
|
|
2393
|
-
(0,
|
|
2541
|
+
(0, import_react38.useEffect)(() => {
|
|
2394
2542
|
if (isCopied) {
|
|
2395
2543
|
const hide = setTimeout(() => {
|
|
2396
2544
|
setIsCopied(false);
|
|
@@ -2404,72 +2552,17 @@ function useCopyClipboard(timeout = 500) {
|
|
|
2404
2552
|
return [isCopied, staticCopy];
|
|
2405
2553
|
}
|
|
2406
2554
|
|
|
2407
|
-
// src/hooks/api/wallet.ts
|
|
2408
|
-
var import_react_query5 = require("@tanstack/react-query");
|
|
2409
|
-
function useChainListQuery(options) {
|
|
2410
|
-
const { isLogin, token } = useUserInfo();
|
|
2411
|
-
return (0, import_react_query5.useQuery)({
|
|
2412
|
-
queryKey: ["match-user-chain-list", token],
|
|
2413
|
-
queryFn: async () => {
|
|
2414
|
-
const res = await getUserChainListApi();
|
|
2415
|
-
if (!isSuccess(res)) {
|
|
2416
|
-
return [];
|
|
2417
|
-
}
|
|
2418
|
-
return res.data;
|
|
2419
|
-
},
|
|
2420
|
-
enabled: isLogin,
|
|
2421
|
-
...options
|
|
2422
|
-
});
|
|
2423
|
-
}
|
|
2424
|
-
function useAssetListQuery({
|
|
2425
|
-
chainId,
|
|
2426
|
-
...options
|
|
2427
|
-
}) {
|
|
2428
|
-
const { isLogin, token } = useUserInfo();
|
|
2429
|
-
return (0, import_react_query5.useQuery)({
|
|
2430
|
-
queryKey: ["match-user-asset-list", token, chainId],
|
|
2431
|
-
queryFn: async () => {
|
|
2432
|
-
const res = await getUserWalletAssetApi({ chain_id: chainId.toString() });
|
|
2433
|
-
if (!isSuccess(res)) {
|
|
2434
|
-
return [];
|
|
2435
|
-
}
|
|
2436
|
-
return res.data || [];
|
|
2437
|
-
},
|
|
2438
|
-
enabled: isLogin,
|
|
2439
|
-
...options
|
|
2440
|
-
});
|
|
2441
|
-
}
|
|
2442
|
-
var USER_IMPORT_TOKEN_LIST_KEY = "match-user-import-token-list";
|
|
2443
|
-
function useImportTokenListQuery({
|
|
2444
|
-
chainId,
|
|
2445
|
-
...options
|
|
2446
|
-
}) {
|
|
2447
|
-
const { isLogin, token } = useUserInfo();
|
|
2448
|
-
return (0, import_react_query5.useQuery)({
|
|
2449
|
-
queryKey: [USER_IMPORT_TOKEN_LIST_KEY, token, chainId],
|
|
2450
|
-
queryFn: async () => {
|
|
2451
|
-
const res = await getUserImportTokenListApi({ chain_id: chainId.toString() });
|
|
2452
|
-
if (!isSuccess(res)) {
|
|
2453
|
-
return [];
|
|
2454
|
-
}
|
|
2455
|
-
return res.data || [];
|
|
2456
|
-
},
|
|
2457
|
-
enabled: isLogin,
|
|
2458
|
-
...options
|
|
2459
|
-
});
|
|
2460
|
-
}
|
|
2461
|
-
|
|
2462
2555
|
// src/hooks/useMatchChain.tsx
|
|
2463
|
-
var
|
|
2464
|
-
var
|
|
2465
|
-
var
|
|
2466
|
-
var
|
|
2556
|
+
var import_react39 = require("react");
|
|
2557
|
+
var import_viem10 = require("viem");
|
|
2558
|
+
var import_react_intl21 = require("react-intl");
|
|
2559
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
2467
2560
|
function useMatchChain() {
|
|
2468
2561
|
const chainListQuery = useChainListQuery();
|
|
2469
2562
|
const modal = useModal();
|
|
2470
|
-
const intl = (0,
|
|
2563
|
+
const intl = (0, import_react_intl21.useIntl)();
|
|
2471
2564
|
const { chainId: storeChainId, setChainId } = useLocalStore_default();
|
|
2472
|
-
const chainId = (0,
|
|
2565
|
+
const chainId = (0, import_react39.useMemo)(() => {
|
|
2473
2566
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
2474
2567
|
return null;
|
|
2475
2568
|
}
|
|
@@ -2478,7 +2571,7 @@ function useMatchChain() {
|
|
|
2478
2571
|
}
|
|
2479
2572
|
return chainListQuery.data[0].id;
|
|
2480
2573
|
}, [storeChainId, chainListQuery.data]);
|
|
2481
|
-
const chain = (0,
|
|
2574
|
+
const chain = (0, import_react39.useMemo)(() => {
|
|
2482
2575
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
2483
2576
|
return null;
|
|
2484
2577
|
}
|
|
@@ -2492,30 +2585,30 @@ function useMatchChain() {
|
|
|
2492
2585
|
close
|
|
2493
2586
|
}) {
|
|
2494
2587
|
const { chainId: storeChainId2, setChainId: setChainId2 } = useLocalStore_default();
|
|
2495
|
-
const [selectedChainId, setSelectedChainId] = (0,
|
|
2588
|
+
const [selectedChainId, setSelectedChainId] = (0, import_react39.useState)(storeChainId2);
|
|
2496
2589
|
const isDownMd = useDownMd();
|
|
2497
|
-
return /* @__PURE__ */ (0,
|
|
2498
|
-
/* @__PURE__ */ (0,
|
|
2499
|
-
return /* @__PURE__ */ (0,
|
|
2590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: `matchid-change-network-box`, children: [
|
|
2591
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: `matchid-change-network-list`, children: chainListQuery.data?.map((item, index) => {
|
|
2592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
2500
2593
|
"div",
|
|
2501
2594
|
{
|
|
2502
2595
|
onClick: () => setSelectedChainId(item.id),
|
|
2503
2596
|
className: `matchid-change-network-item ${selectedChainId == item.id ? "matchid-change-network-selected" : ""}`,
|
|
2504
2597
|
children: [
|
|
2505
|
-
/* @__PURE__ */ (0,
|
|
2506
|
-
/* @__PURE__ */ (0,
|
|
2507
|
-
/* @__PURE__ */ (0,
|
|
2598
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: `matchid-change-network-item-content`, children: [
|
|
2599
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("img", { src: item.iconUrl, className: `matchid-change-network-item-icon` }),
|
|
2600
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "matchid-change-network-item-name", children: item.name })
|
|
2508
2601
|
] }),
|
|
2509
|
-
/* @__PURE__ */ (0,
|
|
2602
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Radio, { checked: selectedChainId === item.id, size: isDownMd ? 18 : 24 })
|
|
2510
2603
|
]
|
|
2511
2604
|
},
|
|
2512
2605
|
index
|
|
2513
2606
|
);
|
|
2514
2607
|
}) }),
|
|
2515
|
-
/* @__PURE__ */ (0,
|
|
2608
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Button, { size: "lg", highlight: true, onClick: () => {
|
|
2516
2609
|
setChainId2(selectedChainId || 0);
|
|
2517
2610
|
close();
|
|
2518
|
-
}, block: true, children: /* @__PURE__ */ (0,
|
|
2611
|
+
}, block: true, children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_react_intl21.FormattedMessage, { id: "confirm" }) })
|
|
2519
2612
|
] });
|
|
2520
2613
|
}
|
|
2521
2614
|
const showChangeNetwork = () => {
|
|
@@ -2524,13 +2617,13 @@ function useMatchChain() {
|
|
|
2524
2617
|
content: ChangeNetwork
|
|
2525
2618
|
});
|
|
2526
2619
|
};
|
|
2527
|
-
const publicClient = (0,
|
|
2620
|
+
const publicClient = (0, import_react39.useMemo)(() => {
|
|
2528
2621
|
if (!chain) {
|
|
2529
2622
|
return null;
|
|
2530
2623
|
}
|
|
2531
|
-
return (0,
|
|
2624
|
+
return (0, import_viem10.createPublicClient)({
|
|
2532
2625
|
chain,
|
|
2533
|
-
transport: (0,
|
|
2626
|
+
transport: (0, import_viem10.http)()
|
|
2534
2627
|
});
|
|
2535
2628
|
}, [chain]);
|
|
2536
2629
|
return {
|
|
@@ -2542,43 +2635,43 @@ function useMatchChain() {
|
|
|
2542
2635
|
showChangeNetwork,
|
|
2543
2636
|
publicClient,
|
|
2544
2637
|
formatUnits: (value) => {
|
|
2545
|
-
return (0,
|
|
2638
|
+
return (0, import_viem10.formatUnits)(value, chain?.nativeCurrency.decimals || 18);
|
|
2546
2639
|
},
|
|
2547
2640
|
parseUnits: (value) => {
|
|
2548
|
-
return (0,
|
|
2641
|
+
return (0, import_viem10.parseUnits)(value, chain?.nativeCurrency.decimals || 18);
|
|
2549
2642
|
}
|
|
2550
2643
|
};
|
|
2551
2644
|
}
|
|
2552
2645
|
|
|
2553
2646
|
// src/hooks/useMatchWallet.tsx
|
|
2554
2647
|
var import_react_qrcode = require("react-qrcode");
|
|
2555
|
-
var
|
|
2556
|
-
var
|
|
2557
|
-
var
|
|
2558
|
-
var
|
|
2648
|
+
var import_react41 = require("react");
|
|
2649
|
+
var import_react_query11 = require("@tanstack/react-query");
|
|
2650
|
+
var import_viem13 = require("viem");
|
|
2651
|
+
var import_react_intl23 = require("react-intl");
|
|
2559
2652
|
|
|
2560
2653
|
// src/components/ImportToken/index.tsx
|
|
2561
|
-
var
|
|
2562
|
-
var
|
|
2563
|
-
var
|
|
2564
|
-
var
|
|
2654
|
+
var import_react40 = require("react");
|
|
2655
|
+
var import_react_intl22 = require("react-intl");
|
|
2656
|
+
var import_react_query10 = require("@tanstack/react-query");
|
|
2657
|
+
var import_viem12 = require("viem");
|
|
2565
2658
|
|
|
2566
2659
|
// src/hooks/useIsContract.ts
|
|
2567
|
-
var
|
|
2568
|
-
var
|
|
2660
|
+
var import_viem11 = require("viem");
|
|
2661
|
+
var import_react_query9 = require("@tanstack/react-query");
|
|
2569
2662
|
function useIsContract({
|
|
2570
2663
|
address,
|
|
2571
2664
|
chain,
|
|
2572
2665
|
enabled
|
|
2573
2666
|
}) {
|
|
2574
|
-
return (0,
|
|
2667
|
+
return (0, import_react_query9.useQuery)({
|
|
2575
2668
|
queryKey: ["is_contract", chain?.id, address],
|
|
2576
2669
|
queryFn: async () => {
|
|
2577
2670
|
if (!chain) return false;
|
|
2578
2671
|
if (!address) return false;
|
|
2579
|
-
const publicClient = (0,
|
|
2672
|
+
const publicClient = (0, import_viem11.createPublicClient)({
|
|
2580
2673
|
chain,
|
|
2581
|
-
transport: (0,
|
|
2674
|
+
transport: (0, import_viem11.http)()
|
|
2582
2675
|
});
|
|
2583
2676
|
const res = await publicClient.getCode({ address });
|
|
2584
2677
|
return res !== null && res !== void 0;
|
|
@@ -2588,27 +2681,27 @@ function useIsContract({
|
|
|
2588
2681
|
}
|
|
2589
2682
|
|
|
2590
2683
|
// src/components/ImportToken/index.tsx
|
|
2591
|
-
var
|
|
2684
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
2592
2685
|
function ImportToken({ close }) {
|
|
2593
|
-
const [status, setStatus] = (0,
|
|
2686
|
+
const [status, setStatus] = (0, import_react40.useState)("");
|
|
2594
2687
|
const { token } = useUserInfo();
|
|
2595
|
-
const [address, setAddress] = (0,
|
|
2596
|
-
const [symbol, setSymbol] = (0,
|
|
2597
|
-
const [decimals, setDecimals] = (0,
|
|
2598
|
-
const [error, setError] = (0,
|
|
2688
|
+
const [address, setAddress] = (0, import_react40.useState)("");
|
|
2689
|
+
const [symbol, setSymbol] = (0, import_react40.useState)("");
|
|
2690
|
+
const [decimals, setDecimals] = (0, import_react40.useState)("");
|
|
2691
|
+
const [error, setError] = (0, import_react40.useState)({});
|
|
2599
2692
|
const { publicClient, chainId, chain } = useMatchChain();
|
|
2600
2693
|
const getContractInfo = async () => {
|
|
2601
2694
|
if (!publicClient) return;
|
|
2602
2695
|
const calls = [
|
|
2603
2696
|
{
|
|
2604
2697
|
address,
|
|
2605
|
-
abi:
|
|
2698
|
+
abi: import_viem12.erc20Abi,
|
|
2606
2699
|
functionName: "symbol",
|
|
2607
2700
|
args: []
|
|
2608
2701
|
},
|
|
2609
2702
|
{
|
|
2610
2703
|
address,
|
|
2611
|
-
abi:
|
|
2704
|
+
abi: import_viem12.erc20Abi,
|
|
2612
2705
|
functionName: "decimals",
|
|
2613
2706
|
args: []
|
|
2614
2707
|
}
|
|
@@ -2628,8 +2721,8 @@ function ImportToken({ close }) {
|
|
|
2628
2721
|
});
|
|
2629
2722
|
}
|
|
2630
2723
|
};
|
|
2631
|
-
const intl = (0,
|
|
2632
|
-
(0,
|
|
2724
|
+
const intl = (0, import_react_intl22.useIntl)();
|
|
2725
|
+
(0, import_react40.useEffect)(() => {
|
|
2633
2726
|
if (address.length === 42) {
|
|
2634
2727
|
const reg = /^0x[0-9a-fA-F]{40}$/;
|
|
2635
2728
|
if (!reg.test(address)) {
|
|
@@ -2648,9 +2741,9 @@ function ImportToken({ close }) {
|
|
|
2648
2741
|
}
|
|
2649
2742
|
}
|
|
2650
2743
|
}, [address, publicClient]);
|
|
2651
|
-
const [loading, setLoading] = (0,
|
|
2744
|
+
const [loading, setLoading] = (0, import_react40.useState)(false);
|
|
2652
2745
|
const toast = useToast();
|
|
2653
|
-
const queryClient2 = (0,
|
|
2746
|
+
const queryClient2 = (0, import_react_query10.useQueryClient)();
|
|
2654
2747
|
const onImport = async () => {
|
|
2655
2748
|
setLoading(true);
|
|
2656
2749
|
try {
|
|
@@ -2676,7 +2769,7 @@ function ImportToken({ close }) {
|
|
|
2676
2769
|
setLoading(false);
|
|
2677
2770
|
}
|
|
2678
2771
|
};
|
|
2679
|
-
const canImport = (0,
|
|
2772
|
+
const canImport = (0, import_react40.useMemo)(() => {
|
|
2680
2773
|
if (!address) {
|
|
2681
2774
|
return false;
|
|
2682
2775
|
}
|
|
@@ -2694,24 +2787,24 @@ function ImportToken({ close }) {
|
|
|
2694
2787
|
}, [error, address, symbol, decimals]);
|
|
2695
2788
|
const isContractQuery = useIsContract({
|
|
2696
2789
|
//@ts-ignore
|
|
2697
|
-
chain: (0,
|
|
2790
|
+
chain: (0, import_viem12.defineChain)(chain),
|
|
2698
2791
|
address,
|
|
2699
2792
|
enabled: canImport
|
|
2700
2793
|
});
|
|
2701
2794
|
if (status == "success" || status == "fail") {
|
|
2702
|
-
return /* @__PURE__ */ (0,
|
|
2703
|
-
/* @__PURE__ */ (0,
|
|
2704
|
-
/* @__PURE__ */ (0,
|
|
2705
|
-
/* @__PURE__ */ (0,
|
|
2795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: `matchid-import-token-result matchid-flex`, children: [
|
|
2796
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: `matchid-import-token-result-box matchid-flex`, children: [
|
|
2797
|
+
/* @__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)(import_react_intl22.FormattedMessage, { id: "importSuccess" }) : /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_react_intl22.FormattedMessage, { id: "importFail" }) })
|
|
2706
2799
|
] }),
|
|
2707
|
-
status == "success" ? /* @__PURE__ */ (0,
|
|
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)(import_react_intl22.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_intl22.FormattedMessage, { id: "back" }) })
|
|
2708
2801
|
] });
|
|
2709
2802
|
}
|
|
2710
|
-
return /* @__PURE__ */ (0,
|
|
2711
|
-
/* @__PURE__ */ (0,
|
|
2712
|
-
/* @__PURE__ */ (0,
|
|
2803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: `matchid-import-token`, children: [
|
|
2804
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "matchid-import-token-form", children: [
|
|
2805
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Field, { label: intl.formatMessage({
|
|
2713
2806
|
id: "tokenSmartContract"
|
|
2714
|
-
}), error: error.address ? error.address : isContractQuery.isFetched && !isContractQuery.isLoading && !isContractQuery.data && canImport ? "Address isn't a contract address" : "", children: /* @__PURE__ */ (0,
|
|
2807
|
+
}), error: error.address ? error.address : isContractQuery.isFetched && !isContractQuery.isLoading && !isContractQuery.data && canImport ? "Address isn't a contract address" : "", children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
2715
2808
|
Input,
|
|
2716
2809
|
{
|
|
2717
2810
|
placeholder: intl.formatMessage({
|
|
@@ -2722,9 +2815,9 @@ function ImportToken({ close }) {
|
|
|
2722
2815
|
maxLength: 42
|
|
2723
2816
|
}
|
|
2724
2817
|
) }),
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2818
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Field, { label: intl.formatMessage({
|
|
2726
2819
|
id: "tokenSymbol"
|
|
2727
|
-
}), error: error.symbol, children: /* @__PURE__ */ (0,
|
|
2820
|
+
}), error: error.symbol, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
2728
2821
|
Input,
|
|
2729
2822
|
{
|
|
2730
2823
|
placeholder: intl.formatMessage({
|
|
@@ -2735,9 +2828,9 @@ function ImportToken({ close }) {
|
|
|
2735
2828
|
maxLength: 16
|
|
2736
2829
|
}
|
|
2737
2830
|
) }),
|
|
2738
|
-
/* @__PURE__ */ (0,
|
|
2831
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Field, { label: intl.formatMessage({
|
|
2739
2832
|
id: "tokenDecimals"
|
|
2740
|
-
}), error: error.decimals, children: /* @__PURE__ */ (0,
|
|
2833
|
+
}), error: error.decimals, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
2741
2834
|
Input,
|
|
2742
2835
|
{
|
|
2743
2836
|
placeholder: intl.formatMessage({
|
|
@@ -2749,7 +2842,7 @@ function ImportToken({ close }) {
|
|
|
2749
2842
|
}
|
|
2750
2843
|
) })
|
|
2751
2844
|
] }),
|
|
2752
|
-
/* @__PURE__ */ (0,
|
|
2845
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
2753
2846
|
Button,
|
|
2754
2847
|
{
|
|
2755
2848
|
size: "lg",
|
|
@@ -2758,20 +2851,20 @@ function ImportToken({ close }) {
|
|
|
2758
2851
|
loading: loading || isContractQuery.isLoading,
|
|
2759
2852
|
disabled: !canImport || !isContractQuery.data,
|
|
2760
2853
|
highlight: true,
|
|
2761
|
-
children: /* @__PURE__ */ (0,
|
|
2854
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_react_intl22.FormattedMessage, { id: "import" })
|
|
2762
2855
|
}
|
|
2763
2856
|
)
|
|
2764
2857
|
] });
|
|
2765
2858
|
}
|
|
2766
2859
|
|
|
2767
2860
|
// src/hooks/useMatchWallet.tsx
|
|
2768
|
-
var
|
|
2861
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
2769
2862
|
var ReceiveModal = () => {
|
|
2770
2863
|
const chain = useMatchChain();
|
|
2771
|
-
const { address } =
|
|
2864
|
+
const { address } = useWallet();
|
|
2772
2865
|
const [copied, setCopied] = useCopyClipboard();
|
|
2773
2866
|
const toast = useToast();
|
|
2774
|
-
const intl = (0,
|
|
2867
|
+
const intl = (0, import_react_intl23.useIntl)();
|
|
2775
2868
|
const onCopy = () => {
|
|
2776
2869
|
setCopied(address);
|
|
2777
2870
|
toast.success(intl.formatMessage({
|
|
@@ -2779,10 +2872,10 @@ var ReceiveModal = () => {
|
|
|
2779
2872
|
}));
|
|
2780
2873
|
};
|
|
2781
2874
|
const chainLink = chain.explorerLink("address/" + address);
|
|
2782
|
-
return /* @__PURE__ */ (0,
|
|
2783
|
-
/* @__PURE__ */ (0,
|
|
2784
|
-
/* @__PURE__ */ (0,
|
|
2785
|
-
/* @__PURE__ */ (0,
|
|
2875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: `matchid-receive-modal`, children: [
|
|
2876
|
+
/* @__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)(import_react_intl23.FormattedMessage, { id: "receiveQrcode" }) }),
|
|
2878
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: `matchid-qr-container`, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
2786
2879
|
import_react_qrcode.QRCode,
|
|
2787
2880
|
{
|
|
2788
2881
|
margin: "0",
|
|
@@ -2790,7 +2883,7 @@ var ReceiveModal = () => {
|
|
|
2790
2883
|
value: address
|
|
2791
2884
|
}
|
|
2792
2885
|
) }),
|
|
2793
|
-
/* @__PURE__ */ (0,
|
|
2886
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
2794
2887
|
"a",
|
|
2795
2888
|
{
|
|
2796
2889
|
href: chainLink,
|
|
@@ -2800,8 +2893,8 @@ var ReceiveModal = () => {
|
|
|
2800
2893
|
}
|
|
2801
2894
|
)
|
|
2802
2895
|
] }),
|
|
2803
|
-
/* @__PURE__ */ (0,
|
|
2804
|
-
|
|
2896
|
+
/* @__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
|
+
import_react_intl23.FormattedMessage,
|
|
2805
2898
|
{
|
|
2806
2899
|
id: "copyAddress"
|
|
2807
2900
|
}
|
|
@@ -2810,7 +2903,7 @@ var ReceiveModal = () => {
|
|
|
2810
2903
|
};
|
|
2811
2904
|
function useMatchWallet() {
|
|
2812
2905
|
const modal = useModal();
|
|
2813
|
-
const intl = (0,
|
|
2906
|
+
const intl = (0, import_react_intl23.useIntl)();
|
|
2814
2907
|
const showReceiveModal = () => {
|
|
2815
2908
|
modal.open({
|
|
2816
2909
|
title: intl.formatMessage({
|
|
@@ -2842,12 +2935,12 @@ function useMatchWallet() {
|
|
|
2842
2935
|
};
|
|
2843
2936
|
}
|
|
2844
2937
|
function useMatchWalletRecords() {
|
|
2845
|
-
const [hasMore, setHasMore] = (0,
|
|
2846
|
-
const [items, setItems] = (0,
|
|
2938
|
+
const [hasMore, setHasMore] = (0, import_react41.useState)(true);
|
|
2939
|
+
const [items, setItems] = (0, import_react41.useState)([]);
|
|
2847
2940
|
const { chainId, publicClient } = useMatchChain();
|
|
2848
|
-
const { address } =
|
|
2849
|
-
const hasMoreRef = (0,
|
|
2850
|
-
const nextPageParamsRef = (0,
|
|
2941
|
+
const { address } = useWallet();
|
|
2942
|
+
const hasMoreRef = (0, import_react41.useRef)(hasMore);
|
|
2943
|
+
const nextPageParamsRef = (0, import_react41.useRef)(void 0);
|
|
2851
2944
|
const { contracts, setContracts } = useContractStore_default();
|
|
2852
2945
|
const fetchMoreData = async () => {
|
|
2853
2946
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
@@ -2874,7 +2967,7 @@ function useMatchWalletRecords() {
|
|
|
2874
2967
|
hasMoreRef.current = true;
|
|
2875
2968
|
fetchMoreData();
|
|
2876
2969
|
};
|
|
2877
|
-
(0,
|
|
2970
|
+
(0, import_react41.useEffect)(() => {
|
|
2878
2971
|
if (chainId && address) {
|
|
2879
2972
|
onInit();
|
|
2880
2973
|
}
|
|
@@ -2898,13 +2991,13 @@ function useMatchWalletRecords() {
|
|
|
2898
2991
|
for (const contract of contractUnique) {
|
|
2899
2992
|
calls.push({
|
|
2900
2993
|
address: contract,
|
|
2901
|
-
abi:
|
|
2994
|
+
abi: import_viem13.erc20Abi,
|
|
2902
2995
|
functionName: "symbol",
|
|
2903
2996
|
args: []
|
|
2904
2997
|
});
|
|
2905
2998
|
calls.push({
|
|
2906
2999
|
address: contract,
|
|
2907
|
-
abi:
|
|
3000
|
+
abi: import_viem13.erc20Abi,
|
|
2908
3001
|
functionName: "decimals",
|
|
2909
3002
|
args: []
|
|
2910
3003
|
});
|
|
@@ -2930,7 +3023,7 @@ function useMatchWalletRecords() {
|
|
|
2930
3023
|
setContracts(contractMap);
|
|
2931
3024
|
}
|
|
2932
3025
|
};
|
|
2933
|
-
const list = (0,
|
|
3026
|
+
const list = (0, import_react41.useMemo)(() => {
|
|
2934
3027
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
2935
3028
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
2936
3029
|
removeList.forEach((item) => {
|
|
@@ -2972,7 +3065,7 @@ function useMatchWalletAssets({
|
|
|
2972
3065
|
chainId: chainId || 0,
|
|
2973
3066
|
...assetListOptions
|
|
2974
3067
|
});
|
|
2975
|
-
const mergedAssets = (0,
|
|
3068
|
+
const mergedAssets = (0, import_react41.useMemo)(() => {
|
|
2976
3069
|
if (!assetListQuery.data && !importTokenQuery.data) return [];
|
|
2977
3070
|
const assetList = (assetListQuery.data || []).map((asset) => ({
|
|
2978
3071
|
...asset,
|
|
@@ -3030,7 +3123,7 @@ function useMatchWalletAssetList({
|
|
|
3030
3123
|
list
|
|
3031
3124
|
}) {
|
|
3032
3125
|
const { publicClient, chain } = useMatchChain();
|
|
3033
|
-
const { address } =
|
|
3126
|
+
const { address } = useWallet();
|
|
3034
3127
|
const { assets, setAssets } = useLocalStore_default();
|
|
3035
3128
|
const nativeToken = list.find((asset) => asset.address.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase()) || {
|
|
3036
3129
|
chain_id: chain?.id || "",
|
|
@@ -3040,7 +3133,7 @@ function useMatchWalletAssetList({
|
|
|
3040
3133
|
name: chain?.nativeCurrency.name,
|
|
3041
3134
|
balance: 0
|
|
3042
3135
|
};
|
|
3043
|
-
const nativeBalanceQuery = (0,
|
|
3136
|
+
const nativeBalanceQuery = (0, import_react_query11.useQuery)({
|
|
3044
3137
|
queryKey: ["nativeBalance", nativeToken?.chain_id],
|
|
3045
3138
|
queryFn: async () => {
|
|
3046
3139
|
if (!nativeToken || !publicClient) return null;
|
|
@@ -3059,14 +3152,14 @@ function useMatchWalletAssetList({
|
|
|
3059
3152
|
retry: 3
|
|
3060
3153
|
// Retry up to 3 times if failed
|
|
3061
3154
|
});
|
|
3062
|
-
const erc20Tokens = (0,
|
|
3063
|
-
const erc20BalanceQuery = (0,
|
|
3155
|
+
const erc20Tokens = (0, import_react41.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
|
|
3156
|
+
const erc20BalanceQuery = (0, import_react_query11.useQuery)({
|
|
3064
3157
|
queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
|
|
3065
3158
|
queryFn: async () => {
|
|
3066
3159
|
if (!erc20Tokens.length || !publicClient) return [];
|
|
3067
3160
|
const calls = erc20Tokens.map((token) => ({
|
|
3068
3161
|
address: token.address,
|
|
3069
|
-
abi:
|
|
3162
|
+
abi: import_viem13.erc20Abi,
|
|
3070
3163
|
functionName: "balanceOf",
|
|
3071
3164
|
args: [address]
|
|
3072
3165
|
}));
|
|
@@ -3087,7 +3180,7 @@ function useMatchWalletAssetList({
|
|
|
3087
3180
|
// Refresh every 15 seconds
|
|
3088
3181
|
retry: 3
|
|
3089
3182
|
});
|
|
3090
|
-
const enrichedAssets = (0,
|
|
3183
|
+
const enrichedAssets = (0, import_react41.useMemo)(() => {
|
|
3091
3184
|
if (!list) return [];
|
|
3092
3185
|
const erc20Balances = erc20BalanceQuery.data || [];
|
|
3093
3186
|
return list.map((asset) => {
|
|
@@ -3097,11 +3190,11 @@ function useMatchWalletAssetList({
|
|
|
3097
3190
|
const assetAddress = asset.address.toLowerCase();
|
|
3098
3191
|
if (assetAddress === NATIVE_TOKEN_ADDRESS) {
|
|
3099
3192
|
balanceValue = nativeBalanceQuery.data?.toString() || "0";
|
|
3100
|
-
balance = nativeBalanceQuery.data ? Number((0,
|
|
3193
|
+
balance = nativeBalanceQuery.data ? Number((0, import_viem13.formatUnits)(nativeBalanceQuery.data, decimals)) : 0;
|
|
3101
3194
|
} else {
|
|
3102
3195
|
const index = erc20Tokens.findIndex((t) => t.address.toLowerCase() === assetAddress);
|
|
3103
3196
|
if (index !== -1 && erc20Balances[index] && erc20Balances[index].status === "success") {
|
|
3104
|
-
balance = Number((0,
|
|
3197
|
+
balance = Number((0, import_viem13.formatUnits)(erc20Balances[index].result, decimals));
|
|
3105
3198
|
balanceValue = erc20Balances[index].result?.toString() || "0";
|
|
3106
3199
|
}
|
|
3107
3200
|
}
|
|
@@ -3109,7 +3202,7 @@ function useMatchWalletAssetList({
|
|
|
3109
3202
|
return { ...asset, balance, value, balanceValue };
|
|
3110
3203
|
});
|
|
3111
3204
|
}, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
|
|
3112
|
-
(0,
|
|
3205
|
+
(0, import_react41.useEffect)(() => {
|
|
3113
3206
|
const list2 = enrichedAssets.sort((a, b) => {
|
|
3114
3207
|
if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
|
|
3115
3208
|
if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
|
|
@@ -3134,14 +3227,14 @@ function useMatchWalletAssetList({
|
|
|
3134
3227
|
}
|
|
3135
3228
|
|
|
3136
3229
|
// src/hooks/useReceipt.tsx
|
|
3137
|
-
var
|
|
3138
|
-
var
|
|
3139
|
-
var
|
|
3230
|
+
var import_react42 = require("react");
|
|
3231
|
+
var import_react_query12 = require("@tanstack/react-query");
|
|
3232
|
+
var import_viem14 = require("viem");
|
|
3140
3233
|
var CACHE_TTL = 86400 * 30 * 1e3;
|
|
3141
3234
|
var MAX_CACHE_SIZE = 500;
|
|
3142
3235
|
var STORAGE_KEY = "match_receipt_logs";
|
|
3143
3236
|
function useReceiptCache() {
|
|
3144
|
-
const [cache, setCache] = (0,
|
|
3237
|
+
const [cache, setCache] = (0, import_react42.useState)(/* @__PURE__ */ new Map());
|
|
3145
3238
|
const isLocalStorageAvailable = (() => {
|
|
3146
3239
|
try {
|
|
3147
3240
|
const testKey = "__test__";
|
|
@@ -3152,7 +3245,7 @@ function useReceiptCache() {
|
|
|
3152
3245
|
return false;
|
|
3153
3246
|
}
|
|
3154
3247
|
})();
|
|
3155
|
-
(0,
|
|
3248
|
+
(0, import_react42.useEffect)(() => {
|
|
3156
3249
|
if (isLocalStorageAvailable) {
|
|
3157
3250
|
try {
|
|
3158
3251
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -3171,7 +3264,7 @@ function useReceiptCache() {
|
|
|
3171
3264
|
}
|
|
3172
3265
|
}
|
|
3173
3266
|
}, []);
|
|
3174
|
-
const updateLocalStorage = (0,
|
|
3267
|
+
const updateLocalStorage = (0, import_react42.useCallback)((updatedCache) => {
|
|
3175
3268
|
if (isLocalStorageAvailable) {
|
|
3176
3269
|
try {
|
|
3177
3270
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -3188,7 +3281,7 @@ function useReceiptCache() {
|
|
|
3188
3281
|
}
|
|
3189
3282
|
}
|
|
3190
3283
|
}, []);
|
|
3191
|
-
const set = (0,
|
|
3284
|
+
const set = (0, import_react42.useCallback)((key, value) => {
|
|
3192
3285
|
const now = Date.now();
|
|
3193
3286
|
const newCache = new Map(cache);
|
|
3194
3287
|
newCache.forEach((entry, k) => {
|
|
@@ -3206,7 +3299,7 @@ function useReceiptCache() {
|
|
|
3206
3299
|
setCache(newCache);
|
|
3207
3300
|
updateLocalStorage(newCache);
|
|
3208
3301
|
}, [cache, updateLocalStorage]);
|
|
3209
|
-
const get = (0,
|
|
3302
|
+
const get = (0, import_react42.useCallback)((key) => {
|
|
3210
3303
|
const entry = cache.get(key);
|
|
3211
3304
|
if (entry) {
|
|
3212
3305
|
if (Date.now() - entry.timestamp > CACHE_TTL) {
|
|
@@ -3220,7 +3313,7 @@ function useReceiptCache() {
|
|
|
3220
3313
|
}
|
|
3221
3314
|
return void 0;
|
|
3222
3315
|
}, [cache, updateLocalStorage]);
|
|
3223
|
-
const del = (0,
|
|
3316
|
+
const del = (0, import_react42.useCallback)((key) => {
|
|
3224
3317
|
if (cache.has(key)) {
|
|
3225
3318
|
const newCache = new Map(cache);
|
|
3226
3319
|
newCache.delete(key);
|
|
@@ -3228,7 +3321,7 @@ function useReceiptCache() {
|
|
|
3228
3321
|
updateLocalStorage(newCache);
|
|
3229
3322
|
}
|
|
3230
3323
|
}, [cache, updateLocalStorage]);
|
|
3231
|
-
const clear = (0,
|
|
3324
|
+
const clear = (0, import_react42.useCallback)(() => {
|
|
3232
3325
|
setCache(/* @__PURE__ */ new Map());
|
|
3233
3326
|
if (isLocalStorageAvailable) {
|
|
3234
3327
|
localStorage.removeItem(STORAGE_KEY);
|
|
@@ -3243,8 +3336,8 @@ function useReceipt2({
|
|
|
3243
3336
|
const { list } = useMatchChain();
|
|
3244
3337
|
const cache = useReceiptCache();
|
|
3245
3338
|
const chain = list?.find((item) => item.id === chainId);
|
|
3246
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
3247
|
-
const query = (0,
|
|
3339
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react42.useState)(true);
|
|
3340
|
+
const query = (0, import_react_query12.useQuery)({
|
|
3248
3341
|
queryKey: ["match-tx-receipt", hash, chain],
|
|
3249
3342
|
queryFn: async () => {
|
|
3250
3343
|
if (!chain || !hash) return false;
|
|
@@ -3253,9 +3346,9 @@ function useReceipt2({
|
|
|
3253
3346
|
return cache.get(cacheKey);
|
|
3254
3347
|
}
|
|
3255
3348
|
try {
|
|
3256
|
-
const publicClient = (0,
|
|
3257
|
-
chain: (0,
|
|
3258
|
-
transport: (0,
|
|
3349
|
+
const publicClient = (0, import_viem14.createPublicClient)({
|
|
3350
|
+
chain: (0, import_viem14.defineChain)(chain),
|
|
3351
|
+
transport: (0, import_viem14.http)()
|
|
3259
3352
|
});
|
|
3260
3353
|
const receipt = await publicClient.getTransactionReceipt({ hash });
|
|
3261
3354
|
if (!receipt) {
|
|
@@ -3269,7 +3362,7 @@ function useReceipt2({
|
|
|
3269
3362
|
},
|
|
3270
3363
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
3271
3364
|
});
|
|
3272
|
-
(0,
|
|
3365
|
+
(0, import_react42.useEffect)(() => {
|
|
3273
3366
|
if (query.data) {
|
|
3274
3367
|
setShouldRefetch(false);
|
|
3275
3368
|
}
|
|
@@ -3278,14 +3371,14 @@ function useReceipt2({
|
|
|
3278
3371
|
}
|
|
3279
3372
|
|
|
3280
3373
|
// src/hooks/useTransaction.tsx
|
|
3281
|
-
var
|
|
3282
|
-
var
|
|
3283
|
-
var
|
|
3374
|
+
var import_react43 = require("react");
|
|
3375
|
+
var import_react_query13 = require("@tanstack/react-query");
|
|
3376
|
+
var import_viem15 = require("viem");
|
|
3284
3377
|
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
3285
3378
|
var MAX_CACHE_SIZE2 = 500;
|
|
3286
3379
|
var STORAGE_KEY2 = "match_transaction_logs";
|
|
3287
3380
|
function useTransactionCache() {
|
|
3288
|
-
const [cache, setCache] = (0,
|
|
3381
|
+
const [cache, setCache] = (0, import_react43.useState)(/* @__PURE__ */ new Map());
|
|
3289
3382
|
const isLocalStorageAvailable = (() => {
|
|
3290
3383
|
try {
|
|
3291
3384
|
const testKey = "__test__";
|
|
@@ -3296,7 +3389,7 @@ function useTransactionCache() {
|
|
|
3296
3389
|
return false;
|
|
3297
3390
|
}
|
|
3298
3391
|
})();
|
|
3299
|
-
(0,
|
|
3392
|
+
(0, import_react43.useEffect)(() => {
|
|
3300
3393
|
if (isLocalStorageAvailable) {
|
|
3301
3394
|
try {
|
|
3302
3395
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -3315,7 +3408,7 @@ function useTransactionCache() {
|
|
|
3315
3408
|
}
|
|
3316
3409
|
}
|
|
3317
3410
|
}, []);
|
|
3318
|
-
const updateLocalStorage = (0,
|
|
3411
|
+
const updateLocalStorage = (0, import_react43.useCallback)((updatedCache) => {
|
|
3319
3412
|
if (isLocalStorageAvailable) {
|
|
3320
3413
|
try {
|
|
3321
3414
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -3332,7 +3425,7 @@ function useTransactionCache() {
|
|
|
3332
3425
|
}
|
|
3333
3426
|
}
|
|
3334
3427
|
}, []);
|
|
3335
|
-
const set = (0,
|
|
3428
|
+
const set = (0, import_react43.useCallback)((key, value) => {
|
|
3336
3429
|
const now = Date.now();
|
|
3337
3430
|
const newCache = new Map(cache);
|
|
3338
3431
|
newCache.forEach((entry, k) => {
|
|
@@ -3350,7 +3443,7 @@ function useTransactionCache() {
|
|
|
3350
3443
|
setCache(newCache);
|
|
3351
3444
|
updateLocalStorage(newCache);
|
|
3352
3445
|
}, [cache, updateLocalStorage]);
|
|
3353
|
-
const get = (0,
|
|
3446
|
+
const get = (0, import_react43.useCallback)((key) => {
|
|
3354
3447
|
const entry = cache.get(key);
|
|
3355
3448
|
if (entry) {
|
|
3356
3449
|
if (Date.now() - entry.timestamp > CACHE_TTL2) {
|
|
@@ -3364,7 +3457,7 @@ function useTransactionCache() {
|
|
|
3364
3457
|
}
|
|
3365
3458
|
return void 0;
|
|
3366
3459
|
}, [cache, updateLocalStorage]);
|
|
3367
|
-
const del = (0,
|
|
3460
|
+
const del = (0, import_react43.useCallback)((key) => {
|
|
3368
3461
|
if (cache.has(key)) {
|
|
3369
3462
|
const newCache = new Map(cache);
|
|
3370
3463
|
newCache.delete(key);
|
|
@@ -3372,7 +3465,7 @@ function useTransactionCache() {
|
|
|
3372
3465
|
updateLocalStorage(newCache);
|
|
3373
3466
|
}
|
|
3374
3467
|
}, [cache, updateLocalStorage]);
|
|
3375
|
-
const clear = (0,
|
|
3468
|
+
const clear = (0, import_react43.useCallback)(() => {
|
|
3376
3469
|
setCache(/* @__PURE__ */ new Map());
|
|
3377
3470
|
if (isLocalStorageAvailable) {
|
|
3378
3471
|
localStorage.removeItem(STORAGE_KEY2);
|
|
@@ -3387,8 +3480,8 @@ function useTransaction({
|
|
|
3387
3480
|
const { list } = useMatchChain();
|
|
3388
3481
|
const cache = useTransactionCache();
|
|
3389
3482
|
const chain = list?.find((item) => item.id === chainId);
|
|
3390
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
3391
|
-
const query = (0,
|
|
3483
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react43.useState)(true);
|
|
3484
|
+
const query = (0, import_react_query13.useQuery)({
|
|
3392
3485
|
queryKey: ["match-tx-transaction", hash, chain],
|
|
3393
3486
|
queryFn: async () => {
|
|
3394
3487
|
if (!chain || !hash) return false;
|
|
@@ -3397,9 +3490,9 @@ function useTransaction({
|
|
|
3397
3490
|
return cache.get(cacheKey);
|
|
3398
3491
|
}
|
|
3399
3492
|
try {
|
|
3400
|
-
const publicClient = (0,
|
|
3401
|
-
chain: (0,
|
|
3402
|
-
transport: (0,
|
|
3493
|
+
const publicClient = (0, import_viem15.createPublicClient)({
|
|
3494
|
+
chain: (0, import_viem15.defineChain)(chain),
|
|
3495
|
+
transport: (0, import_viem15.http)()
|
|
3403
3496
|
});
|
|
3404
3497
|
const transaction = await publicClient.getTransaction({ hash });
|
|
3405
3498
|
if (!transaction) {
|
|
@@ -3413,7 +3506,7 @@ function useTransaction({
|
|
|
3413
3506
|
},
|
|
3414
3507
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
3415
3508
|
});
|
|
3416
|
-
(0,
|
|
3509
|
+
(0, import_react43.useEffect)(() => {
|
|
3417
3510
|
if (query.data) {
|
|
3418
3511
|
setShouldRefetch(false);
|
|
3419
3512
|
}
|