@matchain/matchid-sdk-react 0.1.53-alpha.2 → 0.1.53-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icon/index.d.mts +4 -2
- package/dist/assets/icon/index.d.ts +4 -2
- package/dist/assets/icon/index.js +19 -0
- package/dist/assets/icon/index.js.map +1 -1
- package/dist/assets/icon/index.mjs +3 -1
- package/dist/chunk-3CR66BEX.mjs +19 -0
- package/dist/chunk-3CR66BEX.mjs.map +1 -0
- package/dist/{chunk-LHNKZISB.mjs → chunk-3USZ4ZZY.mjs} +20 -2
- package/dist/chunk-3USZ4ZZY.mjs.map +1 -0
- package/dist/{chunk-4A2YPGO3.mjs → chunk-4J3KZCLG.mjs} +2 -2
- package/dist/{chunk-HYQ3T6WW.mjs → chunk-JX73EY6V.mjs} +2 -14
- package/dist/chunk-JX73EY6V.mjs.map +1 -0
- package/dist/{chunk-MX7N57AH.mjs → chunk-OCQ2AIM3.mjs} +7 -2
- package/dist/{chunk-MX7N57AH.mjs.map → chunk-OCQ2AIM3.mjs.map} +1 -1
- package/dist/{chunk-FB5MHLWX.mjs → chunk-V2S54LGG.mjs} +2 -2
- package/dist/{chunk-W5A6WY7Y.mjs → chunk-XXZZYALJ.mjs} +807 -191
- package/dist/chunk-XXZZYALJ.mjs.map +1 -0
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +1111 -442
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +7 -4
- package/dist/config/chains/index.mjs +2 -1
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +202 -88
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +6 -5
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +515 -401
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +5 -4
- package/dist/{index-IwwXQ_QV.d.ts → index-BaYTgL99.d.mts} +3 -2
- package/dist/{index-B8cUP7cH.d.ts → index-BhU3hF7y.d.ts} +2 -2
- package/dist/{index-iWHaT8HV.d.mts → index-Bpd2gBNh.d.mts} +1 -1
- package/dist/{index-Df-WlkXq.d.ts → index-C5StsjWY.d.ts} +11 -4
- package/dist/{index-BS-NO8Y2.d.ts → index-CFqk8eNo.d.ts} +12 -12
- package/dist/{index-BCGJczpk.d.mts → index-D1QeVZyN.d.ts} +3 -2
- package/dist/{index-DNJuiNdz.d.mts → index-D_UNctDI.d.mts} +11 -4
- package/dist/{index-BsL6zo6a.d.ts → index-DaXXoRxr.d.ts} +1 -1
- package/dist/{index-K5vXmiRX.d.ts → index-Dt92N6yZ.d.ts} +1 -1
- package/dist/{index-CZqdmQu1.d.mts → index-W6yjuOKT.d.mts} +1 -1
- package/dist/{index-Bil_db2f.d.mts → index-mxbJ8CFx.d.mts} +12 -12
- package/dist/{index-yy3VTdFU.d.mts → index-wqqEUufi.d.mts} +2 -2
- package/dist/index.css +3 -0
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1297 -680
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -11
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/{types-CZbR7ERa.d.mts → types-Bx_FJ11s.d.mts} +2 -1
- package/dist/{types-CZbR7ERa.d.ts → types-Bx_FJ11s.d.ts} +2 -1
- package/dist/ui/index.d.mts +3 -3
- package/dist/ui/index.d.ts +3 -3
- package/dist/ui/index.js +62 -59
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +2 -2
- package/dist/utils/index.d.mts +2 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +3 -1
- package/example/dist/assets/ccip-nxE3Zma4.js +1 -0
- package/example/dist/assets/index-BFAv3rdU.css +1 -0
- package/example/dist/assets/index-DMWWRDPI.js +1658 -0
- package/example/dist/index.html +2 -2
- package/example/src/pages/User/index.tsx +7 -1
- package/package.json +2 -1
- package/dist/chunk-HYQ3T6WW.mjs.map +0 -1
- package/dist/chunk-LHNKZISB.mjs.map +0 -1
- package/dist/chunk-W5A6WY7Y.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/dist/{chunk-4A2YPGO3.mjs.map → chunk-4J3KZCLG.mjs.map} +0 -0
- /package/dist/{chunk-FB5MHLWX.mjs.map → chunk-V2S54LGG.mjs.map} +0 -0
package/dist/hooks/index.js
CHANGED
|
@@ -349,10 +349,10 @@ var localStore = useLocalStore;
|
|
|
349
349
|
var useLocalStore_default = useLocalStore;
|
|
350
350
|
|
|
351
351
|
// src/hooks/useUserInfo.tsx
|
|
352
|
-
var
|
|
352
|
+
var import_react33 = require("react");
|
|
353
353
|
|
|
354
354
|
// src/MatchContext.tsx
|
|
355
|
-
var
|
|
355
|
+
var import_react32 = require("react");
|
|
356
356
|
|
|
357
357
|
// src/store/useModalStore.ts
|
|
358
358
|
var import_zustand2 = require("zustand");
|
|
@@ -614,6 +614,9 @@ function TransferIcon({ size = 40, ...props }) {
|
|
|
614
614
|
// src/assets/icon/ArrowSendIcon.tsx
|
|
615
615
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
616
616
|
|
|
617
|
+
// src/assets/icon/PhantomIcon.tsx
|
|
618
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
619
|
+
|
|
617
620
|
// src/hooks/useLayout.tsx
|
|
618
621
|
var useLayout_exports = {};
|
|
619
622
|
__export(useLayout_exports, {
|
|
@@ -635,7 +638,7 @@ function useDownMd() {
|
|
|
635
638
|
}
|
|
636
639
|
|
|
637
640
|
// src/hooks/useConfig.tsx
|
|
638
|
-
var
|
|
641
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
639
642
|
var DEFAULT_WALLET_METHODS = ["evm", "sol", "btc", "tron", "ton"];
|
|
640
643
|
|
|
641
644
|
// src/store/useModalStore.ts
|
|
@@ -657,6 +660,12 @@ var useBTCModalStore = (0, import_zustand2.create)((set) => ({
|
|
|
657
660
|
open: (type) => set({ isOpen: true, type }),
|
|
658
661
|
close: () => set({ isOpen: false })
|
|
659
662
|
}));
|
|
663
|
+
var useEVMModalStore = (0, import_zustand2.create)((set) => ({
|
|
664
|
+
isOpen: false,
|
|
665
|
+
type: "",
|
|
666
|
+
open: (type) => set({ isOpen: true, type }),
|
|
667
|
+
close: () => set({ isOpen: false })
|
|
668
|
+
}));
|
|
660
669
|
var useCEXBindModalStore = (0, import_zustand2.create)((set) => ({
|
|
661
670
|
type: "",
|
|
662
671
|
isOpen: false,
|
|
@@ -676,7 +685,7 @@ var import_react6 = require("react");
|
|
|
676
685
|
|
|
677
686
|
// src/ui/Overlay/index.tsx
|
|
678
687
|
var import_react2 = require("react");
|
|
679
|
-
var
|
|
688
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
680
689
|
function Overlay({
|
|
681
690
|
isOpen = false,
|
|
682
691
|
children,
|
|
@@ -692,7 +701,7 @@ function Overlay({
|
|
|
692
701
|
document.body.style.overflow = "";
|
|
693
702
|
};
|
|
694
703
|
}, [isOpen]);
|
|
695
|
-
return isOpen ? /* @__PURE__ */ (0,
|
|
704
|
+
return isOpen ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
696
705
|
"div",
|
|
697
706
|
{
|
|
698
707
|
className: "matchid-overlay",
|
|
@@ -701,11 +710,11 @@ function Overlay({
|
|
|
701
710
|
},
|
|
702
711
|
children
|
|
703
712
|
}
|
|
704
|
-
) : /* @__PURE__ */ (0,
|
|
713
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, {});
|
|
705
714
|
}
|
|
706
715
|
|
|
707
716
|
// src/ui/Modal/index.tsx
|
|
708
|
-
var
|
|
717
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
709
718
|
function Modal({
|
|
710
719
|
children,
|
|
711
720
|
isOpen,
|
|
@@ -713,10 +722,10 @@ function Modal({
|
|
|
713
722
|
zIndex = 100,
|
|
714
723
|
className = ""
|
|
715
724
|
}) {
|
|
716
|
-
return /* @__PURE__ */ (0,
|
|
725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Overlay, { isOpen, zIndex, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: `matchid-modal ${className}`, style: {
|
|
717
726
|
width
|
|
718
727
|
}, children: [
|
|
719
|
-
/* @__PURE__ */ (0,
|
|
728
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "matchid-modal-mobile-header" }),
|
|
720
729
|
children
|
|
721
730
|
] }) });
|
|
722
731
|
}
|
|
@@ -730,13 +739,13 @@ function ModalWithHeader({
|
|
|
730
739
|
...props
|
|
731
740
|
}) {
|
|
732
741
|
const isDownMd = useDownMd();
|
|
733
|
-
return /* @__PURE__ */ (0,
|
|
734
|
-
/* @__PURE__ */ (0,
|
|
735
|
-
/* @__PURE__ */ (0,
|
|
736
|
-
onBack && /* @__PURE__ */ (0,
|
|
737
|
-
/* @__PURE__ */ (0,
|
|
742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Modal, { ...props, children: [
|
|
743
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: `matchid-modal-header ${showBorder ? "matchid-modal-header-border" : ""}`, children: [
|
|
744
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "matchid-modal-header-content", children: [
|
|
745
|
+
onBack && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ArrowLeftIcon, { height: isDownMd ? 20 : 25, width: isDownMd ? 20 : 24, className: "matchid-modal-header-back", onClick: onBack }),
|
|
746
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "matchid-modal-header-title", children: title })
|
|
738
747
|
] }),
|
|
739
|
-
onClose && /* @__PURE__ */ (0,
|
|
748
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(CloseRoundIcon, { size: isDownMd ? 24 : 30, className: "matchid-modal-header-close", onClick: onClose })
|
|
740
749
|
] }),
|
|
741
750
|
children
|
|
742
751
|
] });
|
|
@@ -747,7 +756,7 @@ var import_react4 = require("react");
|
|
|
747
756
|
|
|
748
757
|
// src/utils/index.tsx
|
|
749
758
|
var import_moment = __toESM(require("moment"));
|
|
750
|
-
var
|
|
759
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
751
760
|
var getVersion = () => {
|
|
752
761
|
return "0.0.2";
|
|
753
762
|
};
|
|
@@ -779,10 +788,10 @@ var NumberFormatter = ({
|
|
|
779
788
|
const [intPart, decimalPart] = numberValue.toString().split(".");
|
|
780
789
|
const intFormat = separator ? intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : intPart;
|
|
781
790
|
if (Math.abs(parseFloat(numberValue)) >= 1) {
|
|
782
|
-
return /* @__PURE__ */ (0,
|
|
783
|
-
prefix && /* @__PURE__ */ (0,
|
|
784
|
-
/* @__PURE__ */ (0,
|
|
785
|
-
decimalPart ? /* @__PURE__ */ (0,
|
|
791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className, children: [
|
|
792
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: prefixClassName, children: prefix }),
|
|
793
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: intClassName, children: intFormat }),
|
|
794
|
+
decimalPart ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: decimalClassName, children: [
|
|
786
795
|
".",
|
|
787
796
|
decimalPart.substring(0, fixNum)
|
|
788
797
|
] }) : "",
|
|
@@ -799,30 +808,30 @@ var NumberFormatter = ({
|
|
|
799
808
|
}
|
|
800
809
|
}
|
|
801
810
|
if (zeroCount < tFixNum) {
|
|
802
|
-
return /* @__PURE__ */ (0,
|
|
803
|
-
prefix && /* @__PURE__ */ (0,
|
|
804
|
-
/* @__PURE__ */ (0,
|
|
805
|
-
/* @__PURE__ */ (0,
|
|
811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className, children: [
|
|
812
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: prefixClassName, children: prefix }),
|
|
813
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: intClassName, children: intFormat }),
|
|
814
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: decimalClassName, children: [
|
|
806
815
|
".",
|
|
807
816
|
decimalPart.substring(0, tFixNum)
|
|
808
817
|
] }),
|
|
809
818
|
suffix
|
|
810
819
|
] });
|
|
811
820
|
}
|
|
812
|
-
return /* @__PURE__ */ (0,
|
|
813
|
-
prefix && /* @__PURE__ */ (0,
|
|
814
|
-
/* @__PURE__ */ (0,
|
|
815
|
-
/* @__PURE__ */ (0,
|
|
821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className, children: [
|
|
822
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: prefixClassName, children: prefix }),
|
|
823
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: intClassName, children: intFormat }),
|
|
824
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: decimalClassName, children: [
|
|
816
825
|
".0",
|
|
817
|
-
/* @__PURE__ */ (0,
|
|
826
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("sub", { children: zeroCount }),
|
|
818
827
|
decimalPart?.substring(zeroCount, zeroCount + tFixNum - 2)
|
|
819
828
|
] }),
|
|
820
829
|
suffix
|
|
821
830
|
] });
|
|
822
831
|
}
|
|
823
|
-
return /* @__PURE__ */ (0,
|
|
824
|
-
prefix && /* @__PURE__ */ (0,
|
|
825
|
-
/* @__PURE__ */ (0,
|
|
832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className, children: [
|
|
833
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: prefixClassName, children: prefix }),
|
|
834
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: intClassName, children: intPart }),
|
|
826
835
|
suffix
|
|
827
836
|
] });
|
|
828
837
|
};
|
|
@@ -831,7 +840,7 @@ var isInTgApp = () => {
|
|
|
831
840
|
};
|
|
832
841
|
|
|
833
842
|
// src/ui/Button/index.tsx
|
|
834
|
-
var
|
|
843
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
835
844
|
function Button({
|
|
836
845
|
size = "df",
|
|
837
846
|
disabled = false,
|
|
@@ -850,7 +859,7 @@ function Button({
|
|
|
850
859
|
onClick && onClick();
|
|
851
860
|
}
|
|
852
861
|
};
|
|
853
|
-
return /* @__PURE__ */ (0,
|
|
862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
854
863
|
"button",
|
|
855
864
|
{
|
|
856
865
|
type,
|
|
@@ -860,14 +869,14 @@ function Button({
|
|
|
860
869
|
...style
|
|
861
870
|
},
|
|
862
871
|
onClick: onAction,
|
|
863
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
872
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(LoadingIcon_default, { className: "matchid-btn-loading-icon", color: "var(--matchid-btn-loading-color)" }) : children
|
|
864
873
|
}
|
|
865
874
|
);
|
|
866
875
|
}
|
|
867
876
|
|
|
868
877
|
// src/ui/Input/index.tsx
|
|
869
878
|
var import_react3 = require("react");
|
|
870
|
-
var
|
|
879
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
871
880
|
function Input({
|
|
872
881
|
onChange,
|
|
873
882
|
type,
|
|
@@ -877,17 +886,17 @@ function Input({
|
|
|
877
886
|
}) {
|
|
878
887
|
const [inputType, setInputType] = (0, import_react3.useState)(type);
|
|
879
888
|
const isDownMd = useDownMd();
|
|
880
|
-
return /* @__PURE__ */ (0,
|
|
889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
881
890
|
"div",
|
|
882
891
|
{
|
|
883
892
|
className: `matchid-input-box ${props.value && props.value.length > 0 ? "matchid-input-has-content" : ""} ${className}`,
|
|
884
893
|
children: [
|
|
885
|
-
/* @__PURE__ */ (0,
|
|
886
|
-
props.value && props.value.length > 0 && /* @__PURE__ */ (0,
|
|
894
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("input", { type: inputType, onChange, ...props, className: "matchid-input-field" }),
|
|
895
|
+
props.value && props.value.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "matchid-input-delete-icon", onClick: (e) => {
|
|
887
896
|
if (onChange) {
|
|
888
897
|
onChange({ target: { value: "" } });
|
|
889
898
|
}
|
|
890
|
-
}, children: /* @__PURE__ */ (0,
|
|
899
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
891
900
|
DeleteRoundIcon,
|
|
892
901
|
{
|
|
893
902
|
height: isDownMd ? 16 : 21,
|
|
@@ -895,9 +904,9 @@ function Input({
|
|
|
895
904
|
color: "var(--matchid-input-delete-icon-color)"
|
|
896
905
|
}
|
|
897
906
|
) }),
|
|
898
|
-
type === "password" && /* @__PURE__ */ (0,
|
|
907
|
+
type === "password" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "matchid-input-eye-icon", onClick: () => {
|
|
899
908
|
setInputType(inputType === "password" ? "text" : "password");
|
|
900
|
-
}, children: inputType === "password" ? /* @__PURE__ */ (0,
|
|
909
|
+
}, children: inputType === "password" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(CloseEyeIcon, { size: isDownMd ? 16 : 20 }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(OpenEyeIcon, { size: isDownMd ? 16 : 20 }) }),
|
|
901
910
|
after
|
|
902
911
|
]
|
|
903
912
|
}
|
|
@@ -905,7 +914,7 @@ function Input({
|
|
|
905
914
|
}
|
|
906
915
|
|
|
907
916
|
// src/ui/Field/index.tsx
|
|
908
|
-
var
|
|
917
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
909
918
|
function Field({
|
|
910
919
|
label,
|
|
911
920
|
children,
|
|
@@ -913,19 +922,19 @@ function Field({
|
|
|
913
922
|
required,
|
|
914
923
|
className = ""
|
|
915
924
|
}) {
|
|
916
|
-
return /* @__PURE__ */ (0,
|
|
917
|
-
/* @__PURE__ */ (0,
|
|
918
|
-
required && /* @__PURE__ */ (0,
|
|
925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: `matchid-field-box ${className}`, children: [
|
|
926
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "matchid-field-label", children: [
|
|
927
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "matchid-field-required", children: "*" }),
|
|
919
928
|
label
|
|
920
929
|
] }),
|
|
921
930
|
children,
|
|
922
|
-
error && /* @__PURE__ */ (0,
|
|
931
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "matchid-field-error", children: error })
|
|
923
932
|
] });
|
|
924
933
|
}
|
|
925
934
|
|
|
926
935
|
// src/components/EmailModal/StepEmail.tsx
|
|
927
936
|
var import_react_intl = require("react-intl");
|
|
928
|
-
var
|
|
937
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
929
938
|
|
|
930
939
|
// src/components/EmailModal/StepVerify.tsx
|
|
931
940
|
var import_react5 = require("react");
|
|
@@ -935,15 +944,15 @@ var NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
|
935
944
|
|
|
936
945
|
// src/components/EmailModal/StepVerify.tsx
|
|
937
946
|
var import_react_intl2 = require("react-intl");
|
|
938
|
-
var
|
|
947
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
939
948
|
|
|
940
949
|
// src/components/EmailModal/index.tsx
|
|
941
950
|
var import_react_intl3 = require("react-intl");
|
|
942
|
-
var
|
|
951
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
943
952
|
|
|
944
953
|
// src/ui/Popover/index.tsx
|
|
945
954
|
var import_react7 = require("react");
|
|
946
|
-
var
|
|
955
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
947
956
|
|
|
948
957
|
// src/components/LoginBox/index.tsx
|
|
949
958
|
var import_react8 = require("react");
|
|
@@ -953,128 +962,39 @@ var import_react_intl4 = require("react-intl");
|
|
|
953
962
|
var import_react_query = require("@tanstack/react-query");
|
|
954
963
|
|
|
955
964
|
// src/components/LoginBox/index.tsx
|
|
956
|
-
var
|
|
965
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
957
966
|
|
|
958
967
|
// src/components/LoginButton/index.tsx
|
|
959
968
|
var import_react10 = require("react");
|
|
960
969
|
|
|
961
970
|
// src/components/LoginPanel/index.tsx
|
|
962
971
|
var import_react_intl5 = require("react-intl");
|
|
963
|
-
var
|
|
972
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
964
973
|
|
|
965
974
|
// src/components/LoginModal/index.tsx
|
|
966
|
-
var
|
|
975
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
967
976
|
|
|
968
977
|
// src/components/UserPopover/index.tsx
|
|
969
978
|
var import_react9 = require("react");
|
|
970
979
|
|
|
971
980
|
// src/assets/icon/ProfileIcon.tsx
|
|
972
|
-
var
|
|
981
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
973
982
|
|
|
974
983
|
// src/components/UserPopover/index.tsx
|
|
975
984
|
var import_react_intl6 = require("react-intl");
|
|
976
|
-
var
|
|
985
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
977
986
|
|
|
978
987
|
// src/components/LoginButton/index.tsx
|
|
979
988
|
var import_react_intl7 = require("react-intl");
|
|
980
|
-
var
|
|
989
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
981
990
|
|
|
982
991
|
// src/components/UsernameModal/index.tsx
|
|
983
992
|
var import_react11 = require("react");
|
|
984
993
|
var import_react_intl8 = require("react-intl");
|
|
985
|
-
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
986
|
-
|
|
987
|
-
// src/components/TRONModal/index.tsx
|
|
988
|
-
var import_react14 = __toESM(require("react"));
|
|
989
|
-
|
|
990
|
-
// src/hooks/eventManager.ts
|
|
991
|
-
var EventManager = class {
|
|
992
|
-
constructor() {
|
|
993
|
-
this.listeners = {};
|
|
994
|
-
}
|
|
995
|
-
on(event, callback) {
|
|
996
|
-
if (!this.listeners[event]) {
|
|
997
|
-
this.listeners[event] = /* @__PURE__ */ new Set();
|
|
998
|
-
}
|
|
999
|
-
this.listeners[event].add(callback);
|
|
1000
|
-
}
|
|
1001
|
-
off(event, callback) {
|
|
1002
|
-
if (this.listeners[event]) {
|
|
1003
|
-
this.listeners[event].delete(callback);
|
|
1004
|
-
if (this.listeners[event].size === 0) {
|
|
1005
|
-
delete this.listeners[event];
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
emit(event, ...args) {
|
|
1010
|
-
if (this.listeners[event]) {
|
|
1011
|
-
this.listeners[event].forEach((callback) => callback(...args));
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
};
|
|
1015
|
-
var eventManager = new EventManager();
|
|
1016
|
-
var eventManager_default = eventManager;
|
|
1017
|
-
|
|
1018
|
-
// src/components/TRONModal/index.tsx
|
|
1019
|
-
var import_react_intl9 = require("react-intl");
|
|
1020
|
-
|
|
1021
|
-
// src/components/WalletModalContent/index.tsx
|
|
1022
|
-
var import_react12 = require("react");
|
|
1023
994
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
1024
995
|
|
|
1025
|
-
// src/hooks/useTRONWallet.ts
|
|
1026
|
-
var import_react13 = require("react");
|
|
1027
|
-
|
|
1028
|
-
// src/components/TRONModal/index.tsx
|
|
1029
|
-
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
1030
|
-
|
|
1031
|
-
// src/components/TONModal/index.tsx
|
|
1032
|
-
var import_react15 = __toESM(require("react"));
|
|
1033
|
-
var import_react_intl10 = require("react-intl");
|
|
1034
|
-
var import_ui_react = require("@tonconnect/ui-react");
|
|
1035
|
-
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
1036
|
-
|
|
1037
|
-
// src/components/BTCModal/index.tsx
|
|
1038
|
-
var import_react17 = __toESM(require("react"));
|
|
1039
|
-
var import_react_intl11 = require("react-intl");
|
|
1040
|
-
|
|
1041
|
-
// src/lib/btc/XverseAdapter.ts
|
|
1042
|
-
var import_sats_connect = require("sats-connect");
|
|
1043
|
-
|
|
1044
|
-
// src/hooks/useBTCWallet.ts
|
|
1045
|
-
var import_react16 = require("react");
|
|
1046
|
-
|
|
1047
|
-
// src/components/BTCModal/index.tsx
|
|
1048
|
-
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
1049
|
-
|
|
1050
|
-
// src/components/WalletModal/index.tsx
|
|
1051
|
-
var import_react18 = require("react");
|
|
1052
|
-
var import_react_intl12 = require("react-intl");
|
|
1053
|
-
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
1054
|
-
|
|
1055
|
-
// src/components/AlphaAvatar/index.tsx
|
|
1056
|
-
var import_react19 = require("react");
|
|
1057
|
-
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
1058
|
-
function AlphaAvatar({ name, size = 40, className = "" }) {
|
|
1059
|
-
const [avatar, setAvatar] = (0, import_react19.useState)(void 0);
|
|
1060
|
-
(0, import_react19.useEffect)(() => {
|
|
1061
|
-
if (name) {
|
|
1062
|
-
const char = name[0].toUpperCase();
|
|
1063
|
-
setAvatar(char);
|
|
1064
|
-
}
|
|
1065
|
-
}, [name]);
|
|
1066
|
-
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
1067
|
-
width: size,
|
|
1068
|
-
height: size,
|
|
1069
|
-
fontSize: Math.ceil(size / 2)
|
|
1070
|
-
}, children: avatar });
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
// src/components/WalletAsset/index.tsx
|
|
1074
|
-
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
1075
|
-
|
|
1076
996
|
// src/ui/Drawer/index.tsx
|
|
1077
|
-
var
|
|
997
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
1078
998
|
function Drawer({
|
|
1079
999
|
children,
|
|
1080
1000
|
showClose = true,
|
|
@@ -1085,25 +1005,25 @@ function Drawer({
|
|
|
1085
1005
|
onBack
|
|
1086
1006
|
}) {
|
|
1087
1007
|
if (!isOpen) {
|
|
1088
|
-
return /* @__PURE__ */ (0,
|
|
1008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_jsx_runtime68.Fragment, {});
|
|
1089
1009
|
}
|
|
1090
|
-
return /* @__PURE__ */ (0,
|
|
1091
|
-
/* @__PURE__ */ (0,
|
|
1092
|
-
/* @__PURE__ */ (0,
|
|
1093
|
-
onBack && /* @__PURE__ */ (0,
|
|
1010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Overlay, { isOpen, zIndex, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "matchid-drawer", children: [
|
|
1011
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: `matchid-drawer-header matchid-flex`, children: [
|
|
1012
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: `matchid-drawer-header-content matchid-flex`, children: [
|
|
1013
|
+
onBack && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ArrowLeftIcon, { height: 25, width: 24, className: "matchid-drawer-header-back", onClick: onBack }),
|
|
1094
1014
|
title
|
|
1095
1015
|
] }),
|
|
1096
|
-
showClose && /* @__PURE__ */ (0,
|
|
1016
|
+
showClose && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(CloseRoundIcon, { className: "matchid-drawer-header-close", onClick: onClose })
|
|
1097
1017
|
] }),
|
|
1098
1018
|
children
|
|
1099
1019
|
] }) });
|
|
1100
1020
|
}
|
|
1101
1021
|
|
|
1102
1022
|
// src/ui/HashPanel/index.tsx
|
|
1103
|
-
var
|
|
1023
|
+
var import_react12 = require("react");
|
|
1104
1024
|
|
|
1105
1025
|
// src/ui/ModalDrawer/index.tsx
|
|
1106
|
-
var
|
|
1026
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
1107
1027
|
function ModalDrawer({
|
|
1108
1028
|
title,
|
|
1109
1029
|
drawerTitleVisible = true,
|
|
@@ -1111,9 +1031,9 @@ function ModalDrawer({
|
|
|
1111
1031
|
}) {
|
|
1112
1032
|
const isDownMd = useDownMd();
|
|
1113
1033
|
if (isDownMd) {
|
|
1114
|
-
return /* @__PURE__ */ (0,
|
|
1034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ModalWithHeader, { ...props, title });
|
|
1115
1035
|
}
|
|
1116
|
-
return /* @__PURE__ */ (0,
|
|
1036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Drawer, { ...props, title: drawerTitleVisible ? title : null });
|
|
1117
1037
|
}
|
|
1118
1038
|
|
|
1119
1039
|
// src/assets/img/confirm.gif
|
|
@@ -1169,7 +1089,7 @@ function useHash({
|
|
|
1169
1089
|
}
|
|
1170
1090
|
|
|
1171
1091
|
// src/ui/HashPanel/index.tsx
|
|
1172
|
-
var
|
|
1092
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
1173
1093
|
function HashPanel({
|
|
1174
1094
|
hash,
|
|
1175
1095
|
chain,
|
|
@@ -1177,7 +1097,7 @@ function HashPanel({
|
|
|
1177
1097
|
onClose,
|
|
1178
1098
|
zIndex
|
|
1179
1099
|
}) {
|
|
1180
|
-
const [status, setStatus] = (0,
|
|
1100
|
+
const [status, setStatus] = (0, import_react12.useState)("confirm");
|
|
1181
1101
|
const statusMaps = {
|
|
1182
1102
|
"confirm": {
|
|
1183
1103
|
icon: confirm_default,
|
|
@@ -1201,8 +1121,8 @@ function HashPanel({
|
|
|
1201
1121
|
}
|
|
1202
1122
|
};
|
|
1203
1123
|
const statusValue = statusMaps[status];
|
|
1204
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
1205
|
-
(0,
|
|
1124
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react12.useState)(true);
|
|
1125
|
+
(0, import_react12.useEffect)(() => {
|
|
1206
1126
|
if (hash) {
|
|
1207
1127
|
setShouldRefetch(true);
|
|
1208
1128
|
setStatus("pending");
|
|
@@ -1215,7 +1135,7 @@ function HashPanel({
|
|
|
1215
1135
|
chain,
|
|
1216
1136
|
refetchInterval: shouldRefetch ? 3e3 : false
|
|
1217
1137
|
});
|
|
1218
|
-
(0,
|
|
1138
|
+
(0, import_react12.useEffect)(() => {
|
|
1219
1139
|
if (hashQuery.data == 1 || hashQuery.data == -1) {
|
|
1220
1140
|
setShouldRefetch(false);
|
|
1221
1141
|
}
|
|
@@ -1228,14 +1148,14 @@ function HashPanel({
|
|
|
1228
1148
|
}
|
|
1229
1149
|
}, [hashQuery.data]);
|
|
1230
1150
|
const link = chain ? `${chain?.blockExplorers?.default.url}/tx/${hash}` : "";
|
|
1231
|
-
return /* @__PURE__ */ (0,
|
|
1151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
1232
1152
|
ModalDrawer,
|
|
1233
1153
|
{
|
|
1234
1154
|
isOpen,
|
|
1235
1155
|
showClose: true,
|
|
1236
1156
|
onClose,
|
|
1237
1157
|
zIndex,
|
|
1238
|
-
title: /* @__PURE__ */ (0,
|
|
1158
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
1239
1159
|
"div",
|
|
1240
1160
|
{
|
|
1241
1161
|
className: "matchid-hashpanel-header",
|
|
@@ -1245,39 +1165,39 @@ function HashPanel({
|
|
|
1245
1165
|
children: statusValue.text
|
|
1246
1166
|
}
|
|
1247
1167
|
),
|
|
1248
|
-
children: /* @__PURE__ */ (0,
|
|
1249
|
-
/* @__PURE__ */ (0,
|
|
1250
|
-
/* @__PURE__ */ (0,
|
|
1168
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "matchid-hashpanel-box", children: [
|
|
1169
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "matchid-hashpanel-content", children: [
|
|
1170
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: `matchid-hashpanel-status`, style: {
|
|
1251
1171
|
color: statusValue.color
|
|
1252
1172
|
}, children: statusValue.text }),
|
|
1253
|
-
/* @__PURE__ */ (0,
|
|
1254
|
-
hash && /* @__PURE__ */ (0,
|
|
1173
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("img", { src: statusValue.icon, alt: statusValue.text, className: `matchid-hashpanel-img` }),
|
|
1174
|
+
hash && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "matchid-hashpanel-hash", children: [
|
|
1255
1175
|
"Hash:",
|
|
1256
|
-
/* @__PURE__ */ (0,
|
|
1176
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("a", { href: link, target: "_blank", children: hash })
|
|
1257
1177
|
] })
|
|
1258
1178
|
] }),
|
|
1259
|
-
/* @__PURE__ */ (0,
|
|
1179
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Button, { onClick: onClose, size: "lg", block: true, children: "Back" })
|
|
1260
1180
|
] })
|
|
1261
1181
|
}
|
|
1262
1182
|
);
|
|
1263
1183
|
}
|
|
1264
1184
|
function HashPanel_default(props) {
|
|
1265
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
1185
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(HashPanel, { ...props });
|
|
1266
1186
|
}
|
|
1267
1187
|
|
|
1268
1188
|
// src/ui/Switch/index.tsx
|
|
1269
|
-
var
|
|
1189
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
1270
1190
|
|
|
1271
1191
|
// src/ui/AlphaAvatar/index.tsx
|
|
1272
|
-
var
|
|
1273
|
-
var
|
|
1274
|
-
function
|
|
1192
|
+
var import_react13 = require("react");
|
|
1193
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
1194
|
+
function AlphaAvatar({
|
|
1275
1195
|
name,
|
|
1276
1196
|
size = "default",
|
|
1277
1197
|
className = "",
|
|
1278
1198
|
style
|
|
1279
1199
|
}) {
|
|
1280
|
-
const avatar = (0,
|
|
1200
|
+
const avatar = (0, import_react13.useMemo)(() => {
|
|
1281
1201
|
if (name) {
|
|
1282
1202
|
const char = name[0].toUpperCase();
|
|
1283
1203
|
if (char.match(/[a-zA-Z0-9]/)) {
|
|
@@ -1287,7 +1207,7 @@ function AlphaAvatar2({
|
|
|
1287
1207
|
return "";
|
|
1288
1208
|
}, [name]);
|
|
1289
1209
|
const numberSize = typeof size === "number" ? size : size === "sm" ? 24 : size === "default" ? 40 : 64;
|
|
1290
|
-
return /* @__PURE__ */ (0,
|
|
1210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
1291
1211
|
width: numberSize,
|
|
1292
1212
|
height: numberSize,
|
|
1293
1213
|
fontSize: Math.ceil(numberSize / 2),
|
|
@@ -1296,7 +1216,7 @@ function AlphaAvatar2({
|
|
|
1296
1216
|
}
|
|
1297
1217
|
|
|
1298
1218
|
// src/ui/Radio/index.tsx
|
|
1299
|
-
var
|
|
1219
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
1300
1220
|
function Radio({
|
|
1301
1221
|
checked = false,
|
|
1302
1222
|
onChange,
|
|
@@ -1305,23 +1225,214 @@ function Radio({
|
|
|
1305
1225
|
className = "",
|
|
1306
1226
|
style = {}
|
|
1307
1227
|
}) {
|
|
1308
|
-
return /* @__PURE__ */ (0,
|
|
1228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { onClick: onChange, className: `matchid-radio ${className} ${checked ? "matchid-radio-checked" : ""}`, style: {
|
|
1309
1229
|
width: size,
|
|
1310
1230
|
height: size,
|
|
1311
1231
|
...style,
|
|
1312
1232
|
// @ts-ignore
|
|
1313
1233
|
"--matchid-radio-checked": color
|
|
1314
|
-
}, children: checked && /* @__PURE__ */ (0,
|
|
1234
|
+
}, children: checked && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: `matchid-radio-content`, style: {
|
|
1315
1235
|
width: Math.floor(size * 0.7),
|
|
1316
1236
|
height: Math.floor(size * 0.7)
|
|
1317
1237
|
} }) });
|
|
1318
1238
|
}
|
|
1319
1239
|
|
|
1320
|
-
// src/components/
|
|
1321
|
-
var
|
|
1240
|
+
// src/components/EVMModal/index.tsx
|
|
1241
|
+
var import_react16 = require("react");
|
|
1242
|
+
|
|
1243
|
+
// src/hooks/eventManager.ts
|
|
1244
|
+
var EventManager = class {
|
|
1245
|
+
constructor() {
|
|
1246
|
+
this.listeners = {};
|
|
1247
|
+
}
|
|
1248
|
+
on(event, callback) {
|
|
1249
|
+
if (!this.listeners[event]) {
|
|
1250
|
+
this.listeners[event] = /* @__PURE__ */ new Set();
|
|
1251
|
+
}
|
|
1252
|
+
this.listeners[event].add(callback);
|
|
1253
|
+
}
|
|
1254
|
+
off(event, callback) {
|
|
1255
|
+
if (this.listeners[event]) {
|
|
1256
|
+
this.listeners[event].delete(callback);
|
|
1257
|
+
if (this.listeners[event].size === 0) {
|
|
1258
|
+
delete this.listeners[event];
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
emit(event, ...args) {
|
|
1263
|
+
if (this.listeners[event]) {
|
|
1264
|
+
this.listeners[event].forEach((callback) => callback(...args));
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
var eventManager = new EventManager();
|
|
1269
|
+
var eventManager_default = eventManager;
|
|
1270
|
+
|
|
1271
|
+
// src/components/EVMModal/index.tsx
|
|
1272
|
+
var import_react_intl9 = require("react-intl");
|
|
1273
|
+
|
|
1274
|
+
// src/components/WalletModalContent/index.tsx
|
|
1275
|
+
var import_react14 = require("react");
|
|
1276
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
1277
|
+
|
|
1278
|
+
// src/components/EVMModal/index.tsx
|
|
1279
|
+
var import_chains = require("wagmi/chains");
|
|
1280
|
+
var import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
1281
|
+
var import_wagmi2 = require("wagmi");
|
|
1282
|
+
var import_wallets = require("@rainbow-me/rainbowkit/wallets");
|
|
1283
|
+
|
|
1284
|
+
// src/config/chains/MatchMain.ts
|
|
1322
1285
|
var import_viem2 = require("viem");
|
|
1286
|
+
var matchMain = /* @__PURE__ */ (0, import_viem2.defineChain)({
|
|
1287
|
+
//定义match链
|
|
1288
|
+
id: 698,
|
|
1289
|
+
name: "Matchain",
|
|
1290
|
+
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
1291
|
+
rpcUrls: {
|
|
1292
|
+
default: {
|
|
1293
|
+
http: ["https://rpc.matchain.io"]
|
|
1294
|
+
}
|
|
1295
|
+
},
|
|
1296
|
+
blockExplorers: {
|
|
1297
|
+
default: {
|
|
1298
|
+
name: "Matchscan",
|
|
1299
|
+
url: "https://matchscan.io/",
|
|
1300
|
+
apiUrl: "https://matchscan.io/api"
|
|
1301
|
+
}
|
|
1302
|
+
},
|
|
1303
|
+
iconUrl: "https://matchscan.io/static/identicon_logos/blockies.png",
|
|
1304
|
+
contracts: {
|
|
1305
|
+
multicall3: {
|
|
1306
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11"
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
// testnet: true,
|
|
1310
|
+
});
|
|
1311
|
+
|
|
1312
|
+
// src/config/chains/MatchTest.ts
|
|
1313
|
+
var import_viem3 = require("viem");
|
|
1314
|
+
var matchTest = /* @__PURE__ */ (0, import_viem3.defineChain)({
|
|
1315
|
+
//定义matchTest链
|
|
1316
|
+
id: 699,
|
|
1317
|
+
name: "MatchTest",
|
|
1318
|
+
nativeCurrency: { name: "Match Coin", symbol: "BNB", decimals: 18 },
|
|
1319
|
+
rpcUrls: {
|
|
1320
|
+
default: {
|
|
1321
|
+
http: ["https://testnet-rpc.matchain.io"]
|
|
1322
|
+
}
|
|
1323
|
+
},
|
|
1324
|
+
blockExplorers: {
|
|
1325
|
+
default: {
|
|
1326
|
+
name: "Matchscan",
|
|
1327
|
+
url: "https://testnet.matchscan.io/",
|
|
1328
|
+
apiUrl: "https://testnet.matchscan.io/api"
|
|
1329
|
+
}
|
|
1330
|
+
},
|
|
1331
|
+
iconUrl: "https://testnet.matchscan.io/static/identicon_logos/blockies.png",
|
|
1332
|
+
contracts: {
|
|
1333
|
+
multicall3: {
|
|
1334
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
1335
|
+
blockCreated: 751532
|
|
1336
|
+
},
|
|
1337
|
+
ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
|
|
1338
|
+
ensUniversalResolver: {
|
|
1339
|
+
address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",
|
|
1340
|
+
blockCreated: 5317080
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
// testnet: true,
|
|
1344
|
+
});
|
|
1345
|
+
|
|
1346
|
+
// src/hooks/useWalletBox.ts
|
|
1347
|
+
var import_react15 = require("react");
|
|
1348
|
+
|
|
1349
|
+
// src/hooks/useEthersSigner.ts
|
|
1350
|
+
var React4 = __toESM(require("react"));
|
|
1351
|
+
var import_wagmi = require("wagmi");
|
|
1352
|
+
var import_ethers = require("ethers");
|
|
1353
|
+
|
|
1354
|
+
// src/components/EVMModal/index.tsx
|
|
1355
|
+
var import_siwe = require("siwe");
|
|
1356
|
+
var import_styles = require("@rainbow-me/rainbowkit/styles.css");
|
|
1357
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
1358
|
+
var wagmiConfig = (0, import_rainbowkit.getDefaultConfig)({
|
|
1359
|
+
appName: "MatchID",
|
|
1360
|
+
projectId: "9ac6ea7e07860f04616fb311b447dee9",
|
|
1361
|
+
wallets: [
|
|
1362
|
+
{
|
|
1363
|
+
groupName: "Recommended",
|
|
1364
|
+
wallets: [
|
|
1365
|
+
import_wallets.metaMaskWallet,
|
|
1366
|
+
import_wallets.walletConnectWallet,
|
|
1367
|
+
import_wallets.okxWallet,
|
|
1368
|
+
import_wallets.bitgetWallet,
|
|
1369
|
+
import_wallets.injectedWallet
|
|
1370
|
+
]
|
|
1371
|
+
}
|
|
1372
|
+
],
|
|
1373
|
+
chains: [import_chains.mainnet, import_chains.polygon, import_chains.optimism, import_chains.arbitrum, import_chains.base, matchMain, matchTest, import_chains.bsc]
|
|
1374
|
+
});
|
|
1375
|
+
|
|
1376
|
+
// src/components/TRONModal/index.tsx
|
|
1377
|
+
var import_react18 = __toESM(require("react"));
|
|
1378
|
+
var import_react_intl10 = require("react-intl");
|
|
1379
|
+
|
|
1380
|
+
// src/hooks/useTRONWallet.ts
|
|
1381
|
+
var import_react17 = require("react");
|
|
1382
|
+
|
|
1383
|
+
// src/components/TRONModal/index.tsx
|
|
1384
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
1385
|
+
|
|
1386
|
+
// src/components/TONModal/index.tsx
|
|
1387
|
+
var import_react19 = __toESM(require("react"));
|
|
1388
|
+
var import_react_intl11 = require("react-intl");
|
|
1389
|
+
var import_ui_react = require("@tonconnect/ui-react");
|
|
1390
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
1391
|
+
|
|
1392
|
+
// src/components/BTCModal/index.tsx
|
|
1393
|
+
var import_react21 = __toESM(require("react"));
|
|
1394
|
+
var import_react_intl12 = require("react-intl");
|
|
1395
|
+
|
|
1396
|
+
// src/lib/btc/XverseAdapter.ts
|
|
1397
|
+
var import_sats_connect = require("sats-connect");
|
|
1398
|
+
|
|
1399
|
+
// src/hooks/useBTCWallet.ts
|
|
1400
|
+
var import_react20 = require("react");
|
|
1401
|
+
|
|
1402
|
+
// src/components/BTCModal/index.tsx
|
|
1403
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
1404
|
+
|
|
1405
|
+
// src/components/WalletModal/index.tsx
|
|
1406
|
+
var import_react22 = require("react");
|
|
1323
1407
|
var import_react_intl13 = require("react-intl");
|
|
1408
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
1409
|
+
|
|
1410
|
+
// src/components/AlphaAvatar/index.tsx
|
|
1411
|
+
var import_react23 = require("react");
|
|
1324
1412
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
1413
|
+
function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
1414
|
+
const [avatar, setAvatar] = (0, import_react23.useState)(void 0);
|
|
1415
|
+
(0, import_react23.useEffect)(() => {
|
|
1416
|
+
if (name) {
|
|
1417
|
+
const char = name[0].toUpperCase();
|
|
1418
|
+
setAvatar(char);
|
|
1419
|
+
}
|
|
1420
|
+
}, [name]);
|
|
1421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
1422
|
+
width: size,
|
|
1423
|
+
height: size,
|
|
1424
|
+
fontSize: Math.ceil(size / 2)
|
|
1425
|
+
}, children: avatar });
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
// src/components/WalletAsset/index.tsx
|
|
1429
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
1430
|
+
|
|
1431
|
+
// src/components/TokenSend/index.tsx
|
|
1432
|
+
var import_react24 = require("react");
|
|
1433
|
+
var import_viem4 = require("viem");
|
|
1434
|
+
var import_react_intl14 = require("react-intl");
|
|
1435
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
1325
1436
|
function Input2({
|
|
1326
1437
|
onChange,
|
|
1327
1438
|
placeholder,
|
|
@@ -1331,8 +1442,8 @@ function Input2({
|
|
|
1331
1442
|
error,
|
|
1332
1443
|
size = "df"
|
|
1333
1444
|
}) {
|
|
1334
|
-
return /* @__PURE__ */ (0,
|
|
1335
|
-
/* @__PURE__ */ (0,
|
|
1445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-input-box ${"matchid-token-input-" + size}`, children: [
|
|
1446
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
1336
1447
|
"input",
|
|
1337
1448
|
{
|
|
1338
1449
|
placeholder,
|
|
@@ -1343,7 +1454,7 @@ function Input2({
|
|
|
1343
1454
|
className: `matchid-token-input ${error ? "matchid-token-input-error" : ""}`
|
|
1344
1455
|
}
|
|
1345
1456
|
),
|
|
1346
|
-
error && /* @__PURE__ */ (0,
|
|
1457
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "matchid-token-input-error-text", children: error })
|
|
1347
1458
|
] });
|
|
1348
1459
|
}
|
|
1349
1460
|
function TokenSend({
|
|
@@ -1353,36 +1464,36 @@ function TokenSend({
|
|
|
1353
1464
|
onBack
|
|
1354
1465
|
}) {
|
|
1355
1466
|
const { list: chainList } = useMatchChain();
|
|
1356
|
-
const intl = (0,
|
|
1467
|
+
const intl = (0, import_react_intl14.useIntl)();
|
|
1357
1468
|
const { createWalletClient: createWalletClient2 } = useWallet();
|
|
1358
1469
|
const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
|
|
1359
|
-
const chain = (0,
|
|
1470
|
+
const chain = (0, import_react24.useMemo)(() => {
|
|
1360
1471
|
return chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
1361
1472
|
}, [chainList, token.chain_id]);
|
|
1362
|
-
const walletClient = (0,
|
|
1473
|
+
const walletClient = (0, import_react24.useMemo)(() => {
|
|
1363
1474
|
return createWalletClient2({
|
|
1364
1475
|
// @ts-ignore
|
|
1365
|
-
chain: (0,
|
|
1366
|
-
transport: (0,
|
|
1476
|
+
chain: (0, import_viem4.defineChain)(chain),
|
|
1477
|
+
transport: (0, import_viem4.http)()
|
|
1367
1478
|
});
|
|
1368
1479
|
}, [chain]);
|
|
1369
|
-
const [amount, setAmount] = (0,
|
|
1370
|
-
const [address, setAddress] = (0,
|
|
1371
|
-
const [loading, setLoading] = (0,
|
|
1372
|
-
const [sending, setSending] = (0,
|
|
1373
|
-
const [txError, setTxError] = (0,
|
|
1374
|
-
const transaction = (0,
|
|
1480
|
+
const [amount, setAmount] = (0, import_react24.useState)("");
|
|
1481
|
+
const [address, setAddress] = (0, import_react24.useState)("");
|
|
1482
|
+
const [loading, setLoading] = (0, import_react24.useState)(false);
|
|
1483
|
+
const [sending, setSending] = (0, import_react24.useState)(false);
|
|
1484
|
+
const [txError, setTxError] = (0, import_react24.useState)("");
|
|
1485
|
+
const transaction = (0, import_react24.useMemo)(() => {
|
|
1375
1486
|
const reg = /^0x[a-fA-F0-9]{40}$/;
|
|
1376
1487
|
if (!amount || !address || !reg.test(address)) {
|
|
1377
1488
|
return;
|
|
1378
1489
|
}
|
|
1379
|
-
const viemChain = (0,
|
|
1490
|
+
const viemChain = (0, import_viem4.defineChain)(chain);
|
|
1380
1491
|
const to = isNative ? address : token.address;
|
|
1381
|
-
const value = isNative ? (0,
|
|
1382
|
-
const data = isNative ? "0x" : (0,
|
|
1383
|
-
abi:
|
|
1492
|
+
const value = isNative ? (0, import_viem4.parseUnits)(amount, parseInt(token?.decimals || "18")) : BigInt(0);
|
|
1493
|
+
const data = isNative ? "0x" : (0, import_viem4.encodeFunctionData)({
|
|
1494
|
+
abi: import_viem4.erc20Abi,
|
|
1384
1495
|
functionName: "transfer",
|
|
1385
|
-
args: [address, (0,
|
|
1496
|
+
args: [address, (0, import_viem4.parseUnits)(amount, parseInt(token?.decimals || "18"))]
|
|
1386
1497
|
});
|
|
1387
1498
|
return {
|
|
1388
1499
|
to,
|
|
@@ -1402,7 +1513,7 @@ function TokenSend({
|
|
|
1402
1513
|
setLoading(false);
|
|
1403
1514
|
}
|
|
1404
1515
|
};
|
|
1405
|
-
const error = (0,
|
|
1516
|
+
const error = (0, import_react24.useMemo)(() => {
|
|
1406
1517
|
setTxError("");
|
|
1407
1518
|
let amountError = "";
|
|
1408
1519
|
let addressError = "";
|
|
@@ -1445,7 +1556,7 @@ function TokenSend({
|
|
|
1445
1556
|
setAmount(value);
|
|
1446
1557
|
}
|
|
1447
1558
|
};
|
|
1448
|
-
const canSend = (0,
|
|
1559
|
+
const canSend = (0, import_react24.useMemo)(() => {
|
|
1449
1560
|
return !error.amount && !error.address && amount && address;
|
|
1450
1561
|
}, [error]);
|
|
1451
1562
|
const onNext = async () => {
|
|
@@ -1455,7 +1566,7 @@ function TokenSend({
|
|
|
1455
1566
|
}
|
|
1456
1567
|
onClose();
|
|
1457
1568
|
};
|
|
1458
|
-
(0,
|
|
1569
|
+
(0, import_react24.useEffect)(() => {
|
|
1459
1570
|
const receiveMessage = (event) => {
|
|
1460
1571
|
if (event.data) {
|
|
1461
1572
|
if (event.data.source == "match-wallet") {
|
|
@@ -1471,24 +1582,24 @@ function TokenSend({
|
|
|
1471
1582
|
window.removeEventListener("message", receiveMessage);
|
|
1472
1583
|
};
|
|
1473
1584
|
}, []);
|
|
1474
|
-
return /* @__PURE__ */ (0,
|
|
1475
|
-
/* @__PURE__ */ (0,
|
|
1476
|
-
/* @__PURE__ */ (0,
|
|
1477
|
-
/* @__PURE__ */ (0,
|
|
1478
|
-
/* @__PURE__ */ (0,
|
|
1479
|
-
/* @__PURE__ */ (0,
|
|
1480
|
-
token.icon ? /* @__PURE__ */ (0,
|
|
1585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(ModalDrawer, { isOpen: true, onClose, zIndex, title: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react_intl14.FormattedMessage, { id: "send" }), onBack, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-send-box`, children: [
|
|
1586
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
1587
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-amount-content`, children: [
|
|
1588
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-amount-header`, children: [
|
|
1589
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: `matchid-token-amount-title`, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react_intl14.FormattedMessage, { id: "amount" }) }),
|
|
1590
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-amount-chain`, children: [
|
|
1591
|
+
token.icon ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
1481
1592
|
"img",
|
|
1482
1593
|
{
|
|
1483
1594
|
src: token?.icon,
|
|
1484
1595
|
alt: token?.symbol,
|
|
1485
1596
|
className: `matchid-token-amount-chain-icon`
|
|
1486
1597
|
}
|
|
1487
|
-
) : /* @__PURE__ */ (0,
|
|
1488
|
-
/* @__PURE__ */ (0,
|
|
1598
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(AlphaAvatar, { name: token.symbol || token.name || "", size: 16 }),
|
|
1599
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { children: token?.symbol })
|
|
1489
1600
|
] })
|
|
1490
1601
|
] }),
|
|
1491
|
-
/* @__PURE__ */ (0,
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
1492
1603
|
Input2,
|
|
1493
1604
|
{
|
|
1494
1605
|
type: "text",
|
|
@@ -1501,18 +1612,18 @@ function TokenSend({
|
|
|
1501
1612
|
error: error.amount || txError
|
|
1502
1613
|
}
|
|
1503
1614
|
),
|
|
1504
|
-
/* @__PURE__ */ (0,
|
|
1505
|
-
/* @__PURE__ */ (0,
|
|
1506
|
-
/* @__PURE__ */ (0,
|
|
1615
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-amount-footer`, children: [
|
|
1616
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-amount-title`, children: [
|
|
1617
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react_intl14.FormattedMessage, { id: "balance" }),
|
|
1507
1618
|
":"
|
|
1508
1619
|
] }),
|
|
1509
|
-
/* @__PURE__ */ (0,
|
|
1620
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: `matchid-token-amount-value`, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(NumberFormatter, { value: token.balance, tFixNum: 10, suffix: " " + token.symbol }) })
|
|
1510
1621
|
] }),
|
|
1511
|
-
/* @__PURE__ */ (0,
|
|
1622
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(TransferIcon, { className: "matchid-token-amount-transfer" })
|
|
1512
1623
|
] }),
|
|
1513
|
-
/* @__PURE__ */ (0,
|
|
1514
|
-
/* @__PURE__ */ (0,
|
|
1515
|
-
/* @__PURE__ */ (0,
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `matchid-token-address-content`, children: [
|
|
1625
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: `matchid-token-address-header`, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: `matchid-token-address-title`, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react_intl14.FormattedMessage, { id: "receiveTitle" }) }) }),
|
|
1626
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
1516
1627
|
Input2,
|
|
1517
1628
|
{
|
|
1518
1629
|
type: "text",
|
|
@@ -1528,7 +1639,7 @@ function TokenSend({
|
|
|
1528
1639
|
)
|
|
1529
1640
|
] })
|
|
1530
1641
|
] }),
|
|
1531
|
-
/* @__PURE__ */ (0,
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
1532
1643
|
Button,
|
|
1533
1644
|
{
|
|
1534
1645
|
size: "lg",
|
|
@@ -1537,20 +1648,20 @@ function TokenSend({
|
|
|
1537
1648
|
disabled: !canSend || !!txError,
|
|
1538
1649
|
onClick: onNext,
|
|
1539
1650
|
loading: loading || sending,
|
|
1540
|
-
children: /* @__PURE__ */ (0,
|
|
1651
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react_intl14.FormattedMessage, { id: "next" })
|
|
1541
1652
|
}
|
|
1542
1653
|
)
|
|
1543
1654
|
] }) });
|
|
1544
1655
|
}
|
|
1545
1656
|
|
|
1546
1657
|
// src/components/TokenDetail/index.tsx
|
|
1547
|
-
var
|
|
1548
|
-
var
|
|
1658
|
+
var import_react_intl15 = require("react-intl");
|
|
1659
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
1549
1660
|
|
|
1550
1661
|
// src/components/TokenSendList/index.tsx
|
|
1551
|
-
var
|
|
1552
|
-
var
|
|
1553
|
-
var
|
|
1662
|
+
var import_react25 = require("react");
|
|
1663
|
+
var import_react_intl16 = require("react-intl");
|
|
1664
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
1554
1665
|
function TokenSendList({ close }) {
|
|
1555
1666
|
const isDownMd = useDownMd();
|
|
1556
1667
|
const walletAssets = useMatchWalletAssets();
|
|
@@ -1558,20 +1669,20 @@ function TokenSendList({ close }) {
|
|
|
1558
1669
|
list: walletAssets.mergedAssets
|
|
1559
1670
|
});
|
|
1560
1671
|
const { list } = useMatchChain();
|
|
1561
|
-
const [checked, setChecked] = (0,
|
|
1672
|
+
const [checked, setChecked] = (0, import_react25.useState)();
|
|
1562
1673
|
const modal = useModal();
|
|
1563
1674
|
const onNext = () => {
|
|
1564
1675
|
checked && modal.show((props) => {
|
|
1565
|
-
return /* @__PURE__ */ (0,
|
|
1676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(TokenSend, { onClose: () => {
|
|
1566
1677
|
props.close();
|
|
1567
1678
|
close();
|
|
1568
1679
|
}, onBack: props.close, zIndex: props.zIndex, token: checked });
|
|
1569
1680
|
});
|
|
1570
1681
|
};
|
|
1571
|
-
return /* @__PURE__ */ (0,
|
|
1572
|
-
/* @__PURE__ */ (0,
|
|
1682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "matchid-token-send-list-box", children: [
|
|
1683
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "matchid-token-send-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
1573
1684
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
1574
|
-
return /* @__PURE__ */ (0,
|
|
1685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
1575
1686
|
"div",
|
|
1576
1687
|
{
|
|
1577
1688
|
className: `matchid-token-send-item ${checked?.address == n.address ? "matchid-token-send-chekced" : ""}`,
|
|
@@ -1579,18 +1690,18 @@ function TokenSendList({ close }) {
|
|
|
1579
1690
|
setChecked(n);
|
|
1580
1691
|
},
|
|
1581
1692
|
children: [
|
|
1582
|
-
/* @__PURE__ */ (0,
|
|
1583
|
-
/* @__PURE__ */ (0,
|
|
1584
|
-
/* @__PURE__ */ (0,
|
|
1585
|
-
n.icon ? /* @__PURE__ */ (0,
|
|
1586
|
-
|
|
1693
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Radio, { checked: checked?.address == n.address, size: isDownMd ? 18 : 24 }),
|
|
1694
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
1695
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "matchid-token-send-logo", children: [
|
|
1696
|
+
n.icon ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("img", { src: n.icon, alt: n.symbol, className: `matchid-token-send-icon` }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
1697
|
+
AlphaAvatar2,
|
|
1587
1698
|
{
|
|
1588
1699
|
className: `matchid-token-send-icon`,
|
|
1589
1700
|
size: isDownMd ? 28 : 40,
|
|
1590
1701
|
name: n.symbol || n.name || ""
|
|
1591
1702
|
}
|
|
1592
1703
|
),
|
|
1593
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
1704
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
1594
1705
|
"img",
|
|
1595
1706
|
{
|
|
1596
1707
|
src: chain.iconUrl,
|
|
@@ -1599,9 +1710,9 @@ function TokenSendList({ close }) {
|
|
|
1599
1710
|
}
|
|
1600
1711
|
)
|
|
1601
1712
|
] }),
|
|
1602
|
-
/* @__PURE__ */ (0,
|
|
1603
|
-
/* @__PURE__ */ (0,
|
|
1604
|
-
/* @__PURE__ */ (0,
|
|
1713
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: `matchid-token-send-info`, children: [
|
|
1714
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: `matchid-token-send-name`, children: n.symbol }),
|
|
1715
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: `matchid-token-send-balance`, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(NumberFormatter, { value: n.balance, tFixNum: 3 }) })
|
|
1605
1716
|
] })
|
|
1606
1717
|
] })
|
|
1607
1718
|
]
|
|
@@ -1609,15 +1720,15 @@ function TokenSendList({ close }) {
|
|
|
1609
1720
|
index
|
|
1610
1721
|
);
|
|
1611
1722
|
}) }),
|
|
1612
|
-
/* @__PURE__ */ (0,
|
|
1723
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Button, { size: "lg", highlight: true, block: true, disabled: !checked, onClick: onNext, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_react_intl16.FormattedMessage, { id: "next" }) })
|
|
1613
1724
|
] });
|
|
1614
1725
|
}
|
|
1615
1726
|
|
|
1616
1727
|
// src/components/TransactionList/index.tsx
|
|
1617
1728
|
var import_react_infinite_scroll_component = __toESM(require("react-infinite-scroll-component"));
|
|
1618
|
-
var
|
|
1619
|
-
var
|
|
1620
|
-
var
|
|
1729
|
+
var import_react26 = require("react");
|
|
1730
|
+
var import_viem5 = require("viem");
|
|
1731
|
+
var import_viem6 = require("viem");
|
|
1621
1732
|
|
|
1622
1733
|
// src/store/useContractStore.ts
|
|
1623
1734
|
var import_zustand3 = require("zustand");
|
|
@@ -1676,13 +1787,13 @@ var useContractStore = (0, import_zustand3.create)((0, import_middleware2.devtoo
|
|
|
1676
1787
|
var useContractStore_default = useContractStore;
|
|
1677
1788
|
|
|
1678
1789
|
// src/components/TransactionList/index.tsx
|
|
1679
|
-
var
|
|
1680
|
-
var
|
|
1790
|
+
var import_react_intl17 = require("react-intl");
|
|
1791
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
1681
1792
|
|
|
1682
1793
|
// src/components/CEXBindModal/index.tsx
|
|
1683
|
-
var
|
|
1684
|
-
var
|
|
1685
|
-
var
|
|
1794
|
+
var import_react27 = require("react");
|
|
1795
|
+
var import_react_intl18 = require("react-intl");
|
|
1796
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
1686
1797
|
|
|
1687
1798
|
// src/context/BusinessProvider.tsx
|
|
1688
1799
|
var import_react_query3 = require("@tanstack/react-query");
|
|
@@ -1700,15 +1811,15 @@ var useStore = (0, import_zustand4.create)((set) => ({
|
|
|
1700
1811
|
var useStore_default = useStore;
|
|
1701
1812
|
|
|
1702
1813
|
// src/context/BusinessProvider.tsx
|
|
1703
|
-
var
|
|
1814
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
1704
1815
|
|
|
1705
1816
|
// src/context/ModalContext.tsx
|
|
1706
|
-
var
|
|
1817
|
+
var import_react28 = require("react");
|
|
1707
1818
|
var import_react_dom = require("react-dom");
|
|
1708
|
-
var
|
|
1709
|
-
var ModalContext = (0,
|
|
1819
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
1820
|
+
var ModalContext = (0, import_react28.createContext)(null);
|
|
1710
1821
|
function useModal() {
|
|
1711
|
-
const context = (0,
|
|
1822
|
+
const context = (0, import_react28.useContext)(ModalContext);
|
|
1712
1823
|
if (!context) {
|
|
1713
1824
|
throw new Error("useModal must be used within a ModalProvider");
|
|
1714
1825
|
}
|
|
@@ -1716,12 +1827,12 @@ function useModal() {
|
|
|
1716
1827
|
}
|
|
1717
1828
|
|
|
1718
1829
|
// src/context/ToastContext.tsx
|
|
1719
|
-
var
|
|
1830
|
+
var import_react29 = require("react");
|
|
1720
1831
|
var import_react_dom2 = require("react-dom");
|
|
1721
|
-
var
|
|
1722
|
-
var ToastContext = (0,
|
|
1832
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
1833
|
+
var ToastContext = (0, import_react29.createContext)(null);
|
|
1723
1834
|
function useToast() {
|
|
1724
|
-
const context = (0,
|
|
1835
|
+
const context = (0, import_react29.useContext)(ToastContext);
|
|
1725
1836
|
if (!context) {
|
|
1726
1837
|
throw new Error("useToast must be used within a ToastProvider");
|
|
1727
1838
|
}
|
|
@@ -1729,23 +1840,23 @@ function useToast() {
|
|
|
1729
1840
|
}
|
|
1730
1841
|
|
|
1731
1842
|
// src/context/index.tsx
|
|
1732
|
-
var
|
|
1843
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
1733
1844
|
|
|
1734
1845
|
// src/hooks/useWalletInit.ts
|
|
1735
|
-
var
|
|
1846
|
+
var import_react30 = require("react");
|
|
1736
1847
|
var AppClientId = getAppClientId();
|
|
1737
1848
|
|
|
1738
1849
|
// src/hooks/useInit.tsx
|
|
1739
|
-
var
|
|
1850
|
+
var import_react31 = require("react");
|
|
1740
1851
|
|
|
1741
1852
|
// src/MatchContext.tsx
|
|
1742
1853
|
var import_react_query4 = require("@tanstack/react-query");
|
|
1743
|
-
var
|
|
1744
|
-
var
|
|
1854
|
+
var import_react_intl19 = require("react-intl");
|
|
1855
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
1745
1856
|
var queryClient = new import_react_query4.QueryClient();
|
|
1746
|
-
var MatchContext = (0,
|
|
1857
|
+
var MatchContext = (0, import_react32.createContext)(void 0);
|
|
1747
1858
|
var useMatch = () => {
|
|
1748
|
-
const context = (0,
|
|
1859
|
+
const context = (0, import_react32.useContext)(MatchContext);
|
|
1749
1860
|
if (context === void 0) {
|
|
1750
1861
|
throw new Error("useMatch must be used within a MatchProvider");
|
|
1751
1862
|
}
|
|
@@ -1770,6 +1881,7 @@ function useUserInfo() {
|
|
|
1770
1881
|
const { setTgAppAuthCode, emailLoginKey, setEmailLoginKey } = useStore_default();
|
|
1771
1882
|
const isDownMd = useDownMd();
|
|
1772
1883
|
const { events, login } = useMatch();
|
|
1884
|
+
const { open: EVMOpen } = useEVMModalStore();
|
|
1773
1885
|
const { open: TRONOpen } = useTRONModalStore();
|
|
1774
1886
|
const { open: TONOpen } = useTONModalStore();
|
|
1775
1887
|
const { open: BTCOpen } = useBTCModalStore();
|
|
@@ -1778,7 +1890,7 @@ function useUserInfo() {
|
|
|
1778
1890
|
const getRedirectUri = () => {
|
|
1779
1891
|
return encodeURIComponent(window.location.href);
|
|
1780
1892
|
};
|
|
1781
|
-
const isLogin = (0,
|
|
1893
|
+
const isLogin = (0, import_react33.useMemo)(() => !!token && !!overview, [token, overview]);
|
|
1782
1894
|
const logout = async () => {
|
|
1783
1895
|
try {
|
|
1784
1896
|
await toLogoutApi();
|
|
@@ -1846,7 +1958,8 @@ function useUserInfo() {
|
|
|
1846
1958
|
case "wallet":
|
|
1847
1959
|
return walletModalStore.open("login", extra?.methods);
|
|
1848
1960
|
case "evm":
|
|
1849
|
-
return
|
|
1961
|
+
return EVMOpen("login");
|
|
1962
|
+
// return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`)
|
|
1850
1963
|
case "sol":
|
|
1851
1964
|
if (isDownMd) {
|
|
1852
1965
|
return window.location.href = `${endpoints.auth}login/sol?appid=${appid}&locale=${locale}&redirect_uri=${getRedirectUri()}`;
|
|
@@ -1938,7 +2051,8 @@ function useUserInfo() {
|
|
|
1938
2051
|
case "wallet":
|
|
1939
2052
|
return walletModalStore.open("bind", extra?.methods);
|
|
1940
2053
|
case "evm":
|
|
1941
|
-
return
|
|
2054
|
+
return EVMOpen("bind");
|
|
2055
|
+
// return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)))
|
|
1942
2056
|
case "sol":
|
|
1943
2057
|
if (isDownMd) {
|
|
1944
2058
|
return window.location.href = `${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}&redirect_uri=${getRedirectUri()}`;
|
|
@@ -2041,9 +2155,9 @@ function useUserInfo() {
|
|
|
2041
2155
|
}
|
|
2042
2156
|
|
|
2043
2157
|
// src/hooks/useMatchEvents.ts
|
|
2044
|
-
var
|
|
2158
|
+
var import_react34 = require("react");
|
|
2045
2159
|
function useMatchEvents(handlers) {
|
|
2046
|
-
(0,
|
|
2160
|
+
(0, import_react34.useEffect)(() => {
|
|
2047
2161
|
Object.entries(handlers).forEach(([event, handler2]) => {
|
|
2048
2162
|
if (handler2) {
|
|
2049
2163
|
eventManager_default.on(event, handler2);
|
|
@@ -2060,11 +2174,11 @@ function useMatchEvents(handlers) {
|
|
|
2060
2174
|
}
|
|
2061
2175
|
|
|
2062
2176
|
// src/hooks/useWallet.tsx
|
|
2063
|
-
var import_viem5 = require("viem");
|
|
2064
|
-
var import_accounts = require("viem/accounts");
|
|
2065
|
-
var import_viem6 = require("viem");
|
|
2066
|
-
var import_react33 = require("react");
|
|
2067
2177
|
var import_viem7 = require("viem");
|
|
2178
|
+
var import_accounts = require("viem/accounts");
|
|
2179
|
+
var import_viem8 = require("viem");
|
|
2180
|
+
var import_react35 = require("react");
|
|
2181
|
+
var import_viem9 = require("viem");
|
|
2068
2182
|
|
|
2069
2183
|
// src/store/useTransactionStore.ts
|
|
2070
2184
|
var import_zustand5 = require("zustand");
|
|
@@ -2097,7 +2211,7 @@ var useTransactionStore = (0, import_zustand5.create)((0, import_middleware3.dev
|
|
|
2097
2211
|
var useTransactionStore_default = useTransactionStore;
|
|
2098
2212
|
|
|
2099
2213
|
// src/hooks/useWallet.tsx
|
|
2100
|
-
var
|
|
2214
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
2101
2215
|
var AppClientId2 = "react-sdk-" + getVersion();
|
|
2102
2216
|
function useWallet() {
|
|
2103
2217
|
const { address, wallet: walletConfig } = useLocalStore_default();
|
|
@@ -2148,7 +2262,7 @@ function useWallet() {
|
|
|
2148
2262
|
throw error;
|
|
2149
2263
|
}
|
|
2150
2264
|
};
|
|
2151
|
-
const evmAccount = (0,
|
|
2265
|
+
const evmAccount = (0, import_react35.useMemo)(() => {
|
|
2152
2266
|
try {
|
|
2153
2267
|
return address ? (0, import_accounts.toAccount)({
|
|
2154
2268
|
address,
|
|
@@ -2187,14 +2301,14 @@ function useWallet() {
|
|
|
2187
2301
|
return void 0;
|
|
2188
2302
|
}
|
|
2189
2303
|
}, [address]);
|
|
2190
|
-
(0,
|
|
2304
|
+
(0, import_react35.useEffect)(() => {
|
|
2191
2305
|
matchlog_default.log("qwe-evmAccount", evmAccount);
|
|
2192
2306
|
}, [evmAccount]);
|
|
2193
2307
|
const realCreateWalletClient = (parameters) => {
|
|
2194
2308
|
if (!evmAccount) {
|
|
2195
2309
|
return;
|
|
2196
2310
|
}
|
|
2197
|
-
const obj = (0,
|
|
2311
|
+
const obj = (0, import_viem8.createWalletClient)({
|
|
2198
2312
|
...parameters,
|
|
2199
2313
|
account: evmAccount
|
|
2200
2314
|
});
|
|
@@ -2270,7 +2384,7 @@ function useWallet() {
|
|
|
2270
2384
|
address: evmAccount.address
|
|
2271
2385
|
});
|
|
2272
2386
|
modal.show((props) => {
|
|
2273
|
-
return /* @__PURE__ */ (0,
|
|
2387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, hash: txHash, chain: _chain });
|
|
2274
2388
|
});
|
|
2275
2389
|
clearInterval(window.matchProvider.transactionMessageIntervalMap[transactionId].interval);
|
|
2276
2390
|
delete window.matchProvider.transactionMessageIntervalMap[transactionId];
|
|
@@ -2284,7 +2398,7 @@ function useWallet() {
|
|
|
2284
2398
|
};
|
|
2285
2399
|
const deployContract = async (parameters2) => {
|
|
2286
2400
|
const { abi, args, bytecode, ...request3 } = parameters2;
|
|
2287
|
-
const calldata = (0,
|
|
2401
|
+
const calldata = (0, import_viem9.encodeDeployData)({ abi, args, bytecode });
|
|
2288
2402
|
return await sendTransaction({
|
|
2289
2403
|
...request3,
|
|
2290
2404
|
data: calldata
|
|
@@ -2292,7 +2406,7 @@ function useWallet() {
|
|
|
2292
2406
|
};
|
|
2293
2407
|
const writeContract = async (parameters2) => {
|
|
2294
2408
|
const { abi, address: address2, args, dataSuffix, functionName, ...request3 } = parameters2;
|
|
2295
|
-
const data = (0,
|
|
2409
|
+
const data = (0, import_viem7.encodeFunctionData)({
|
|
2296
2410
|
abi,
|
|
2297
2411
|
args,
|
|
2298
2412
|
functionName
|
|
@@ -2323,14 +2437,14 @@ function useWallet() {
|
|
|
2323
2437
|
|
|
2324
2438
|
// src/hooks/useCopyClipboard.ts
|
|
2325
2439
|
var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
|
|
2326
|
-
var
|
|
2440
|
+
var import_react36 = require("react");
|
|
2327
2441
|
function useCopyClipboard(timeout = 500) {
|
|
2328
|
-
const [isCopied, setIsCopied] = (0,
|
|
2329
|
-
const staticCopy = (0,
|
|
2442
|
+
const [isCopied, setIsCopied] = (0, import_react36.useState)(false);
|
|
2443
|
+
const staticCopy = (0, import_react36.useCallback)((text) => {
|
|
2330
2444
|
const didCopy = (0, import_copy_to_clipboard.default)(text);
|
|
2331
2445
|
setIsCopied(didCopy);
|
|
2332
2446
|
}, []);
|
|
2333
|
-
(0,
|
|
2447
|
+
(0, import_react36.useEffect)(() => {
|
|
2334
2448
|
if (isCopied) {
|
|
2335
2449
|
const hide = setTimeout(() => {
|
|
2336
2450
|
setIsCopied(false);
|
|
@@ -2400,16 +2514,16 @@ function useImportTokenListQuery({
|
|
|
2400
2514
|
}
|
|
2401
2515
|
|
|
2402
2516
|
// src/hooks/useMatchChain.tsx
|
|
2403
|
-
var
|
|
2404
|
-
var
|
|
2405
|
-
var
|
|
2406
|
-
var
|
|
2517
|
+
var import_react37 = require("react");
|
|
2518
|
+
var import_viem10 = require("viem");
|
|
2519
|
+
var import_react_intl20 = require("react-intl");
|
|
2520
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
2407
2521
|
function useMatchChain() {
|
|
2408
2522
|
const chainListQuery = useChainListQuery();
|
|
2409
2523
|
const modal = useModal();
|
|
2410
|
-
const intl = (0,
|
|
2524
|
+
const intl = (0, import_react_intl20.useIntl)();
|
|
2411
2525
|
const { chainId: storeChainId, setChainId } = useLocalStore_default();
|
|
2412
|
-
const chainId = (0,
|
|
2526
|
+
const chainId = (0, import_react37.useMemo)(() => {
|
|
2413
2527
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
2414
2528
|
return null;
|
|
2415
2529
|
}
|
|
@@ -2418,7 +2532,7 @@ function useMatchChain() {
|
|
|
2418
2532
|
}
|
|
2419
2533
|
return chainListQuery.data[0].id;
|
|
2420
2534
|
}, [storeChainId, chainListQuery.data]);
|
|
2421
|
-
const chain = (0,
|
|
2535
|
+
const chain = (0, import_react37.useMemo)(() => {
|
|
2422
2536
|
if (!chainListQuery.data || !chainListQuery.data.length) {
|
|
2423
2537
|
return null;
|
|
2424
2538
|
}
|
|
@@ -2432,30 +2546,30 @@ function useMatchChain() {
|
|
|
2432
2546
|
close
|
|
2433
2547
|
}) {
|
|
2434
2548
|
const { chainId: storeChainId2, setChainId: setChainId2 } = useLocalStore_default();
|
|
2435
|
-
const [selectedChainId, setSelectedChainId] = (0,
|
|
2549
|
+
const [selectedChainId, setSelectedChainId] = (0, import_react37.useState)(storeChainId2);
|
|
2436
2550
|
const isDownMd = useDownMd();
|
|
2437
|
-
return /* @__PURE__ */ (0,
|
|
2438
|
-
/* @__PURE__ */ (0,
|
|
2439
|
-
return /* @__PURE__ */ (0,
|
|
2551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: `matchid-change-network-box`, children: [
|
|
2552
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: `matchid-change-network-list`, children: chainListQuery.data?.map((item, index) => {
|
|
2553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
2440
2554
|
"div",
|
|
2441
2555
|
{
|
|
2442
2556
|
onClick: () => setSelectedChainId(item.id),
|
|
2443
2557
|
className: `matchid-change-network-item ${selectedChainId == item.id ? "matchid-change-network-selected" : ""}`,
|
|
2444
2558
|
children: [
|
|
2445
|
-
/* @__PURE__ */ (0,
|
|
2446
|
-
/* @__PURE__ */ (0,
|
|
2447
|
-
/* @__PURE__ */ (0,
|
|
2559
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: `matchid-change-network-item-content`, children: [
|
|
2560
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("img", { src: item.iconUrl, className: `matchid-change-network-item-icon` }),
|
|
2561
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "matchid-change-network-item-name", children: item.name })
|
|
2448
2562
|
] }),
|
|
2449
|
-
/* @__PURE__ */ (0,
|
|
2563
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Radio, { checked: selectedChainId === item.id, size: isDownMd ? 18 : 24 })
|
|
2450
2564
|
]
|
|
2451
2565
|
},
|
|
2452
2566
|
index
|
|
2453
2567
|
);
|
|
2454
2568
|
}) }),
|
|
2455
|
-
/* @__PURE__ */ (0,
|
|
2569
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Button, { size: "lg", highlight: true, onClick: () => {
|
|
2456
2570
|
setChainId2(selectedChainId || 0);
|
|
2457
2571
|
close();
|
|
2458
|
-
}, block: true, children: /* @__PURE__ */ (0,
|
|
2572
|
+
}, block: true, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_intl20.FormattedMessage, { id: "confirm" }) })
|
|
2459
2573
|
] });
|
|
2460
2574
|
}
|
|
2461
2575
|
const showChangeNetwork = () => {
|
|
@@ -2464,13 +2578,13 @@ function useMatchChain() {
|
|
|
2464
2578
|
content: ChangeNetwork
|
|
2465
2579
|
});
|
|
2466
2580
|
};
|
|
2467
|
-
const publicClient = (0,
|
|
2581
|
+
const publicClient = (0, import_react37.useMemo)(() => {
|
|
2468
2582
|
if (!chain) {
|
|
2469
2583
|
return null;
|
|
2470
2584
|
}
|
|
2471
|
-
return (0,
|
|
2585
|
+
return (0, import_viem10.createPublicClient)({
|
|
2472
2586
|
chain,
|
|
2473
|
-
transport: (0,
|
|
2587
|
+
transport: (0, import_viem10.http)()
|
|
2474
2588
|
});
|
|
2475
2589
|
}, [chain]);
|
|
2476
2590
|
return {
|
|
@@ -2482,29 +2596,29 @@ function useMatchChain() {
|
|
|
2482
2596
|
showChangeNetwork,
|
|
2483
2597
|
publicClient,
|
|
2484
2598
|
formatUnits: (value) => {
|
|
2485
|
-
return (0,
|
|
2599
|
+
return (0, import_viem10.formatUnits)(value, chain?.nativeCurrency.decimals || 18);
|
|
2486
2600
|
},
|
|
2487
2601
|
parseUnits: (value) => {
|
|
2488
|
-
return (0,
|
|
2602
|
+
return (0, import_viem10.parseUnits)(value, chain?.nativeCurrency.decimals || 18);
|
|
2489
2603
|
}
|
|
2490
2604
|
};
|
|
2491
2605
|
}
|
|
2492
2606
|
|
|
2493
2607
|
// src/hooks/useMatchWallet.tsx
|
|
2494
2608
|
var import_react_qrcode = require("react-qrcode");
|
|
2495
|
-
var
|
|
2609
|
+
var import_react39 = require("react");
|
|
2496
2610
|
var import_react_query8 = require("@tanstack/react-query");
|
|
2497
|
-
var
|
|
2498
|
-
var
|
|
2611
|
+
var import_viem13 = require("viem");
|
|
2612
|
+
var import_react_intl22 = require("react-intl");
|
|
2499
2613
|
|
|
2500
2614
|
// src/components/ImportToken/index.tsx
|
|
2501
|
-
var
|
|
2502
|
-
var
|
|
2615
|
+
var import_react38 = require("react");
|
|
2616
|
+
var import_react_intl21 = require("react-intl");
|
|
2503
2617
|
var import_react_query7 = require("@tanstack/react-query");
|
|
2504
|
-
var
|
|
2618
|
+
var import_viem12 = require("viem");
|
|
2505
2619
|
|
|
2506
2620
|
// src/hooks/useIsContract.ts
|
|
2507
|
-
var
|
|
2621
|
+
var import_viem11 = require("viem");
|
|
2508
2622
|
var import_react_query6 = require("@tanstack/react-query");
|
|
2509
2623
|
function useIsContract({
|
|
2510
2624
|
address,
|
|
@@ -2516,9 +2630,9 @@ function useIsContract({
|
|
|
2516
2630
|
queryFn: async () => {
|
|
2517
2631
|
if (!chain) return false;
|
|
2518
2632
|
if (!address) return false;
|
|
2519
|
-
const publicClient = (0,
|
|
2633
|
+
const publicClient = (0, import_viem11.createPublicClient)({
|
|
2520
2634
|
chain,
|
|
2521
|
-
transport: (0,
|
|
2635
|
+
transport: (0, import_viem11.http)()
|
|
2522
2636
|
});
|
|
2523
2637
|
const res = await publicClient.getCode({ address });
|
|
2524
2638
|
return res !== null && res !== void 0;
|
|
@@ -2528,27 +2642,27 @@ function useIsContract({
|
|
|
2528
2642
|
}
|
|
2529
2643
|
|
|
2530
2644
|
// src/components/ImportToken/index.tsx
|
|
2531
|
-
var
|
|
2645
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
2532
2646
|
function ImportToken({ close }) {
|
|
2533
|
-
const [status, setStatus] = (0,
|
|
2647
|
+
const [status, setStatus] = (0, import_react38.useState)("");
|
|
2534
2648
|
const { token } = useUserInfo();
|
|
2535
|
-
const [address, setAddress] = (0,
|
|
2536
|
-
const [symbol, setSymbol] = (0,
|
|
2537
|
-
const [decimals, setDecimals] = (0,
|
|
2538
|
-
const [error, setError] = (0,
|
|
2649
|
+
const [address, setAddress] = (0, import_react38.useState)("");
|
|
2650
|
+
const [symbol, setSymbol] = (0, import_react38.useState)("");
|
|
2651
|
+
const [decimals, setDecimals] = (0, import_react38.useState)("");
|
|
2652
|
+
const [error, setError] = (0, import_react38.useState)({});
|
|
2539
2653
|
const { publicClient, chainId, chain } = useMatchChain();
|
|
2540
2654
|
const getContractInfo = async () => {
|
|
2541
2655
|
if (!publicClient) return;
|
|
2542
2656
|
const calls = [
|
|
2543
2657
|
{
|
|
2544
2658
|
address,
|
|
2545
|
-
abi:
|
|
2659
|
+
abi: import_viem12.erc20Abi,
|
|
2546
2660
|
functionName: "symbol",
|
|
2547
2661
|
args: []
|
|
2548
2662
|
},
|
|
2549
2663
|
{
|
|
2550
2664
|
address,
|
|
2551
|
-
abi:
|
|
2665
|
+
abi: import_viem12.erc20Abi,
|
|
2552
2666
|
functionName: "decimals",
|
|
2553
2667
|
args: []
|
|
2554
2668
|
}
|
|
@@ -2568,8 +2682,8 @@ function ImportToken({ close }) {
|
|
|
2568
2682
|
});
|
|
2569
2683
|
}
|
|
2570
2684
|
};
|
|
2571
|
-
const intl = (0,
|
|
2572
|
-
(0,
|
|
2685
|
+
const intl = (0, import_react_intl21.useIntl)();
|
|
2686
|
+
(0, import_react38.useEffect)(() => {
|
|
2573
2687
|
if (address.length === 42) {
|
|
2574
2688
|
const reg = /^0x[0-9a-fA-F]{40}$/;
|
|
2575
2689
|
if (!reg.test(address)) {
|
|
@@ -2588,7 +2702,7 @@ function ImportToken({ close }) {
|
|
|
2588
2702
|
}
|
|
2589
2703
|
}
|
|
2590
2704
|
}, [address, publicClient]);
|
|
2591
|
-
const [loading, setLoading] = (0,
|
|
2705
|
+
const [loading, setLoading] = (0, import_react38.useState)(false);
|
|
2592
2706
|
const toast = useToast();
|
|
2593
2707
|
const queryClient2 = (0, import_react_query7.useQueryClient)();
|
|
2594
2708
|
const onImport = async () => {
|
|
@@ -2616,7 +2730,7 @@ function ImportToken({ close }) {
|
|
|
2616
2730
|
setLoading(false);
|
|
2617
2731
|
}
|
|
2618
2732
|
};
|
|
2619
|
-
const canImport = (0,
|
|
2733
|
+
const canImport = (0, import_react38.useMemo)(() => {
|
|
2620
2734
|
if (!address) {
|
|
2621
2735
|
return false;
|
|
2622
2736
|
}
|
|
@@ -2634,24 +2748,24 @@ function ImportToken({ close }) {
|
|
|
2634
2748
|
}, [error, address, symbol, decimals]);
|
|
2635
2749
|
const isContractQuery = useIsContract({
|
|
2636
2750
|
//@ts-ignore
|
|
2637
|
-
chain: (0,
|
|
2751
|
+
chain: (0, import_viem12.defineChain)(chain),
|
|
2638
2752
|
address,
|
|
2639
2753
|
enabled: canImport
|
|
2640
2754
|
});
|
|
2641
2755
|
if (status == "success" || status == "fail") {
|
|
2642
|
-
return /* @__PURE__ */ (0,
|
|
2643
|
-
/* @__PURE__ */ (0,
|
|
2644
|
-
/* @__PURE__ */ (0,
|
|
2645
|
-
/* @__PURE__ */ (0,
|
|
2756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: `matchid-import-token-result matchid-flex`, children: [
|
|
2757
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: `matchid-import-token-result-box matchid-flex`, children: [
|
|
2758
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("img", { src: status == "success" ? success_default : fail_default, alt: status == "success" ? "success" : "fail", className: `matchid-import-token-result-img` }),
|
|
2759
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: `matchid-import-token-result-text matchid-import-token-result-text-${status}`, children: status == "success" ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_intl21.FormattedMessage, { id: "importSuccess" }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_intl21.FormattedMessage, { id: "importFail" }) })
|
|
2646
2760
|
] }),
|
|
2647
|
-
status == "success" ? /* @__PURE__ */ (0,
|
|
2761
|
+
status == "success" ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Button, { size: "lg", onClick: close, block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_intl21.FormattedMessage, { id: "close" }) }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Button, { size: "lg", onClick: () => setStatus(""), block: true, highlight: true, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_intl21.FormattedMessage, { id: "back" }) })
|
|
2648
2762
|
] });
|
|
2649
2763
|
}
|
|
2650
|
-
return /* @__PURE__ */ (0,
|
|
2651
|
-
/* @__PURE__ */ (0,
|
|
2652
|
-
/* @__PURE__ */ (0,
|
|
2764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: `matchid-import-token`, children: [
|
|
2765
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "matchid-import-token-form", children: [
|
|
2766
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Field, { label: intl.formatMessage({
|
|
2653
2767
|
id: "tokenSmartContract"
|
|
2654
|
-
}), error: error.address ? error.address : isContractQuery.isFetched && !isContractQuery.isLoading && !isContractQuery.data && canImport ? "Address isn't a contract address" : "", children: /* @__PURE__ */ (0,
|
|
2768
|
+
}), error: error.address ? error.address : isContractQuery.isFetched && !isContractQuery.isLoading && !isContractQuery.data && canImport ? "Address isn't a contract address" : "", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
2655
2769
|
Input,
|
|
2656
2770
|
{
|
|
2657
2771
|
placeholder: intl.formatMessage({
|
|
@@ -2662,9 +2776,9 @@ function ImportToken({ close }) {
|
|
|
2662
2776
|
maxLength: 42
|
|
2663
2777
|
}
|
|
2664
2778
|
) }),
|
|
2665
|
-
/* @__PURE__ */ (0,
|
|
2779
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Field, { label: intl.formatMessage({
|
|
2666
2780
|
id: "tokenSymbol"
|
|
2667
|
-
}), error: error.symbol, children: /* @__PURE__ */ (0,
|
|
2781
|
+
}), error: error.symbol, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
2668
2782
|
Input,
|
|
2669
2783
|
{
|
|
2670
2784
|
placeholder: intl.formatMessage({
|
|
@@ -2675,9 +2789,9 @@ function ImportToken({ close }) {
|
|
|
2675
2789
|
maxLength: 16
|
|
2676
2790
|
}
|
|
2677
2791
|
) }),
|
|
2678
|
-
/* @__PURE__ */ (0,
|
|
2792
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Field, { label: intl.formatMessage({
|
|
2679
2793
|
id: "tokenDecimals"
|
|
2680
|
-
}), error: error.decimals, children: /* @__PURE__ */ (0,
|
|
2794
|
+
}), error: error.decimals, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
2681
2795
|
Input,
|
|
2682
2796
|
{
|
|
2683
2797
|
placeholder: intl.formatMessage({
|
|
@@ -2689,7 +2803,7 @@ function ImportToken({ close }) {
|
|
|
2689
2803
|
}
|
|
2690
2804
|
) })
|
|
2691
2805
|
] }),
|
|
2692
|
-
/* @__PURE__ */ (0,
|
|
2806
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
2693
2807
|
Button,
|
|
2694
2808
|
{
|
|
2695
2809
|
size: "lg",
|
|
@@ -2698,20 +2812,20 @@ function ImportToken({ close }) {
|
|
|
2698
2812
|
loading: loading || isContractQuery.isLoading,
|
|
2699
2813
|
disabled: !canImport || !isContractQuery.data,
|
|
2700
2814
|
highlight: true,
|
|
2701
|
-
children: /* @__PURE__ */ (0,
|
|
2815
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_intl21.FormattedMessage, { id: "import" })
|
|
2702
2816
|
}
|
|
2703
2817
|
)
|
|
2704
2818
|
] });
|
|
2705
2819
|
}
|
|
2706
2820
|
|
|
2707
2821
|
// src/hooks/useMatchWallet.tsx
|
|
2708
|
-
var
|
|
2822
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
2709
2823
|
var ReceiveModal = () => {
|
|
2710
2824
|
const chain = useMatchChain();
|
|
2711
2825
|
const { address } = useWallet();
|
|
2712
2826
|
const [copied, setCopied] = useCopyClipboard();
|
|
2713
2827
|
const toast = useToast();
|
|
2714
|
-
const intl = (0,
|
|
2828
|
+
const intl = (0, import_react_intl22.useIntl)();
|
|
2715
2829
|
const onCopy = () => {
|
|
2716
2830
|
setCopied(address);
|
|
2717
2831
|
toast.success(intl.formatMessage({
|
|
@@ -2719,10 +2833,10 @@ var ReceiveModal = () => {
|
|
|
2719
2833
|
}));
|
|
2720
2834
|
};
|
|
2721
2835
|
const chainLink = chain.explorerLink("address/" + address);
|
|
2722
|
-
return /* @__PURE__ */ (0,
|
|
2723
|
-
/* @__PURE__ */ (0,
|
|
2724
|
-
/* @__PURE__ */ (0,
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: `matchid-receive-modal`, children: [
|
|
2837
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "matchid-receive-container", children: [
|
|
2838
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: `matchid-receive-text`, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react_intl22.FormattedMessage, { id: "receiveQrcode" }) }),
|
|
2839
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: `matchid-qr-container`, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
2726
2840
|
import_react_qrcode.QRCode,
|
|
2727
2841
|
{
|
|
2728
2842
|
margin: "0",
|
|
@@ -2730,7 +2844,7 @@ var ReceiveModal = () => {
|
|
|
2730
2844
|
value: address
|
|
2731
2845
|
}
|
|
2732
2846
|
) }),
|
|
2733
|
-
/* @__PURE__ */ (0,
|
|
2847
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
2734
2848
|
"a",
|
|
2735
2849
|
{
|
|
2736
2850
|
href: chainLink,
|
|
@@ -2740,8 +2854,8 @@ var ReceiveModal = () => {
|
|
|
2740
2854
|
}
|
|
2741
2855
|
)
|
|
2742
2856
|
] }),
|
|
2743
|
-
/* @__PURE__ */ (0,
|
|
2744
|
-
|
|
2857
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Button, { size: "lg", onClick: onCopy, block: true, highlight: true, disabled: copied, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
2858
|
+
import_react_intl22.FormattedMessage,
|
|
2745
2859
|
{
|
|
2746
2860
|
id: "copyAddress"
|
|
2747
2861
|
}
|
|
@@ -2750,7 +2864,7 @@ var ReceiveModal = () => {
|
|
|
2750
2864
|
};
|
|
2751
2865
|
function useMatchWallet() {
|
|
2752
2866
|
const modal = useModal();
|
|
2753
|
-
const intl = (0,
|
|
2867
|
+
const intl = (0, import_react_intl22.useIntl)();
|
|
2754
2868
|
const showReceiveModal = () => {
|
|
2755
2869
|
modal.open({
|
|
2756
2870
|
title: intl.formatMessage({
|
|
@@ -2782,12 +2896,12 @@ function useMatchWallet() {
|
|
|
2782
2896
|
};
|
|
2783
2897
|
}
|
|
2784
2898
|
function useMatchWalletRecords() {
|
|
2785
|
-
const [hasMore, setHasMore] = (0,
|
|
2786
|
-
const [items, setItems] = (0,
|
|
2899
|
+
const [hasMore, setHasMore] = (0, import_react39.useState)(true);
|
|
2900
|
+
const [items, setItems] = (0, import_react39.useState)([]);
|
|
2787
2901
|
const { chainId, publicClient } = useMatchChain();
|
|
2788
2902
|
const { address } = useWallet();
|
|
2789
|
-
const hasMoreRef = (0,
|
|
2790
|
-
const nextPageParamsRef = (0,
|
|
2903
|
+
const hasMoreRef = (0, import_react39.useRef)(hasMore);
|
|
2904
|
+
const nextPageParamsRef = (0, import_react39.useRef)(void 0);
|
|
2791
2905
|
const { contracts, setContracts } = useContractStore_default();
|
|
2792
2906
|
const fetchMoreData = async () => {
|
|
2793
2907
|
const chainIdStr = chainId ? chainId.toString() : "";
|
|
@@ -2814,7 +2928,7 @@ function useMatchWalletRecords() {
|
|
|
2814
2928
|
hasMoreRef.current = true;
|
|
2815
2929
|
fetchMoreData();
|
|
2816
2930
|
};
|
|
2817
|
-
(0,
|
|
2931
|
+
(0, import_react39.useEffect)(() => {
|
|
2818
2932
|
if (chainId && address) {
|
|
2819
2933
|
onInit();
|
|
2820
2934
|
}
|
|
@@ -2838,13 +2952,13 @@ function useMatchWalletRecords() {
|
|
|
2838
2952
|
for (const contract of contractUnique) {
|
|
2839
2953
|
calls.push({
|
|
2840
2954
|
address: contract,
|
|
2841
|
-
abi:
|
|
2955
|
+
abi: import_viem13.erc20Abi,
|
|
2842
2956
|
functionName: "symbol",
|
|
2843
2957
|
args: []
|
|
2844
2958
|
});
|
|
2845
2959
|
calls.push({
|
|
2846
2960
|
address: contract,
|
|
2847
|
-
abi:
|
|
2961
|
+
abi: import_viem13.erc20Abi,
|
|
2848
2962
|
functionName: "decimals",
|
|
2849
2963
|
args: []
|
|
2850
2964
|
});
|
|
@@ -2870,7 +2984,7 @@ function useMatchWalletRecords() {
|
|
|
2870
2984
|
setContracts(contractMap);
|
|
2871
2985
|
}
|
|
2872
2986
|
};
|
|
2873
|
-
const list = (0,
|
|
2987
|
+
const list = (0, import_react39.useMemo)(() => {
|
|
2874
2988
|
const localTransactions = transactions[`${chainId}-${address}`] || [];
|
|
2875
2989
|
const removeList = localTransactions.filter((n) => items.findIndex((m) => m.hash == n.hash) >= 0);
|
|
2876
2990
|
removeList.forEach((item) => {
|
|
@@ -2912,7 +3026,7 @@ function useMatchWalletAssets({
|
|
|
2912
3026
|
chainId: chainId || 0,
|
|
2913
3027
|
...assetListOptions
|
|
2914
3028
|
});
|
|
2915
|
-
const mergedAssets = (0,
|
|
3029
|
+
const mergedAssets = (0, import_react39.useMemo)(() => {
|
|
2916
3030
|
if (!assetListQuery.data && !importTokenQuery.data) return [];
|
|
2917
3031
|
const assetList = (assetListQuery.data || []).map((asset) => ({
|
|
2918
3032
|
...asset,
|
|
@@ -2999,14 +3113,14 @@ function useMatchWalletAssetList({
|
|
|
2999
3113
|
retry: 3
|
|
3000
3114
|
// Retry up to 3 times if failed
|
|
3001
3115
|
});
|
|
3002
|
-
const erc20Tokens = (0,
|
|
3116
|
+
const erc20Tokens = (0, import_react39.useMemo)(() => list.filter((asset) => asset.address !== NATIVE_TOKEN_ADDRESS), [list]);
|
|
3003
3117
|
const erc20BalanceQuery = (0, import_react_query8.useQuery)({
|
|
3004
3118
|
queryKey: ["erc20Balances", erc20Tokens.map((token) => token.address)],
|
|
3005
3119
|
queryFn: async () => {
|
|
3006
3120
|
if (!erc20Tokens.length || !publicClient) return [];
|
|
3007
3121
|
const calls = erc20Tokens.map((token) => ({
|
|
3008
3122
|
address: token.address,
|
|
3009
|
-
abi:
|
|
3123
|
+
abi: import_viem13.erc20Abi,
|
|
3010
3124
|
functionName: "balanceOf",
|
|
3011
3125
|
args: [address]
|
|
3012
3126
|
}));
|
|
@@ -3027,7 +3141,7 @@ function useMatchWalletAssetList({
|
|
|
3027
3141
|
// Refresh every 15 seconds
|
|
3028
3142
|
retry: 3
|
|
3029
3143
|
});
|
|
3030
|
-
const enrichedAssets = (0,
|
|
3144
|
+
const enrichedAssets = (0, import_react39.useMemo)(() => {
|
|
3031
3145
|
if (!list) return [];
|
|
3032
3146
|
const erc20Balances = erc20BalanceQuery.data || [];
|
|
3033
3147
|
return list.map((asset) => {
|
|
@@ -3037,11 +3151,11 @@ function useMatchWalletAssetList({
|
|
|
3037
3151
|
const assetAddress = asset.address.toLowerCase();
|
|
3038
3152
|
if (assetAddress === NATIVE_TOKEN_ADDRESS) {
|
|
3039
3153
|
balanceValue = nativeBalanceQuery.data?.toString() || "0";
|
|
3040
|
-
balance = nativeBalanceQuery.data ? Number((0,
|
|
3154
|
+
balance = nativeBalanceQuery.data ? Number((0, import_viem13.formatUnits)(nativeBalanceQuery.data, decimals)) : 0;
|
|
3041
3155
|
} else {
|
|
3042
3156
|
const index = erc20Tokens.findIndex((t) => t.address.toLowerCase() === assetAddress);
|
|
3043
3157
|
if (index !== -1 && erc20Balances[index] && erc20Balances[index].status === "success") {
|
|
3044
|
-
balance = Number((0,
|
|
3158
|
+
balance = Number((0, import_viem13.formatUnits)(erc20Balances[index].result, decimals));
|
|
3045
3159
|
balanceValue = erc20Balances[index].result?.toString() || "0";
|
|
3046
3160
|
}
|
|
3047
3161
|
}
|
|
@@ -3049,7 +3163,7 @@ function useMatchWalletAssetList({
|
|
|
3049
3163
|
return { ...asset, balance, value, balanceValue };
|
|
3050
3164
|
});
|
|
3051
3165
|
}, [list, nativeBalanceQuery.data, erc20BalanceQuery.data]);
|
|
3052
|
-
(0,
|
|
3166
|
+
(0, import_react39.useEffect)(() => {
|
|
3053
3167
|
const list2 = enrichedAssets.sort((a, b) => {
|
|
3054
3168
|
if (a.address === NATIVE_TOKEN_ADDRESS) return -1;
|
|
3055
3169
|
if (b.address === NATIVE_TOKEN_ADDRESS) return 1;
|
|
@@ -3074,14 +3188,14 @@ function useMatchWalletAssetList({
|
|
|
3074
3188
|
}
|
|
3075
3189
|
|
|
3076
3190
|
// src/hooks/useReceipt.tsx
|
|
3077
|
-
var
|
|
3191
|
+
var import_react40 = require("react");
|
|
3078
3192
|
var import_react_query9 = require("@tanstack/react-query");
|
|
3079
|
-
var
|
|
3193
|
+
var import_viem14 = require("viem");
|
|
3080
3194
|
var CACHE_TTL = 86400 * 30 * 1e3;
|
|
3081
3195
|
var MAX_CACHE_SIZE = 500;
|
|
3082
3196
|
var STORAGE_KEY = "match_receipt_logs";
|
|
3083
3197
|
function useReceiptCache() {
|
|
3084
|
-
const [cache, setCache] = (0,
|
|
3198
|
+
const [cache, setCache] = (0, import_react40.useState)(/* @__PURE__ */ new Map());
|
|
3085
3199
|
const isLocalStorageAvailable = (() => {
|
|
3086
3200
|
try {
|
|
3087
3201
|
const testKey = "__test__";
|
|
@@ -3092,7 +3206,7 @@ function useReceiptCache() {
|
|
|
3092
3206
|
return false;
|
|
3093
3207
|
}
|
|
3094
3208
|
})();
|
|
3095
|
-
(0,
|
|
3209
|
+
(0, import_react40.useEffect)(() => {
|
|
3096
3210
|
if (isLocalStorageAvailable) {
|
|
3097
3211
|
try {
|
|
3098
3212
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -3111,7 +3225,7 @@ function useReceiptCache() {
|
|
|
3111
3225
|
}
|
|
3112
3226
|
}
|
|
3113
3227
|
}, []);
|
|
3114
|
-
const updateLocalStorage = (0,
|
|
3228
|
+
const updateLocalStorage = (0, import_react40.useCallback)((updatedCache) => {
|
|
3115
3229
|
if (isLocalStorageAvailable) {
|
|
3116
3230
|
try {
|
|
3117
3231
|
const storedData = localStorage.getItem(STORAGE_KEY);
|
|
@@ -3128,7 +3242,7 @@ function useReceiptCache() {
|
|
|
3128
3242
|
}
|
|
3129
3243
|
}
|
|
3130
3244
|
}, []);
|
|
3131
|
-
const set = (0,
|
|
3245
|
+
const set = (0, import_react40.useCallback)((key, value) => {
|
|
3132
3246
|
const now = Date.now();
|
|
3133
3247
|
const newCache = new Map(cache);
|
|
3134
3248
|
newCache.forEach((entry, k) => {
|
|
@@ -3146,7 +3260,7 @@ function useReceiptCache() {
|
|
|
3146
3260
|
setCache(newCache);
|
|
3147
3261
|
updateLocalStorage(newCache);
|
|
3148
3262
|
}, [cache, updateLocalStorage]);
|
|
3149
|
-
const get = (0,
|
|
3263
|
+
const get = (0, import_react40.useCallback)((key) => {
|
|
3150
3264
|
const entry = cache.get(key);
|
|
3151
3265
|
if (entry) {
|
|
3152
3266
|
if (Date.now() - entry.timestamp > CACHE_TTL) {
|
|
@@ -3160,7 +3274,7 @@ function useReceiptCache() {
|
|
|
3160
3274
|
}
|
|
3161
3275
|
return void 0;
|
|
3162
3276
|
}, [cache, updateLocalStorage]);
|
|
3163
|
-
const del = (0,
|
|
3277
|
+
const del = (0, import_react40.useCallback)((key) => {
|
|
3164
3278
|
if (cache.has(key)) {
|
|
3165
3279
|
const newCache = new Map(cache);
|
|
3166
3280
|
newCache.delete(key);
|
|
@@ -3168,7 +3282,7 @@ function useReceiptCache() {
|
|
|
3168
3282
|
updateLocalStorage(newCache);
|
|
3169
3283
|
}
|
|
3170
3284
|
}, [cache, updateLocalStorage]);
|
|
3171
|
-
const clear = (0,
|
|
3285
|
+
const clear = (0, import_react40.useCallback)(() => {
|
|
3172
3286
|
setCache(/* @__PURE__ */ new Map());
|
|
3173
3287
|
if (isLocalStorageAvailable) {
|
|
3174
3288
|
localStorage.removeItem(STORAGE_KEY);
|
|
@@ -3183,7 +3297,7 @@ function useReceipt2({
|
|
|
3183
3297
|
const { list } = useMatchChain();
|
|
3184
3298
|
const cache = useReceiptCache();
|
|
3185
3299
|
const chain = list?.find((item) => item.id === chainId);
|
|
3186
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
3300
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react40.useState)(true);
|
|
3187
3301
|
const query = (0, import_react_query9.useQuery)({
|
|
3188
3302
|
queryKey: ["match-tx-receipt", hash, chain],
|
|
3189
3303
|
queryFn: async () => {
|
|
@@ -3193,9 +3307,9 @@ function useReceipt2({
|
|
|
3193
3307
|
return cache.get(cacheKey);
|
|
3194
3308
|
}
|
|
3195
3309
|
try {
|
|
3196
|
-
const publicClient = (0,
|
|
3197
|
-
chain: (0,
|
|
3198
|
-
transport: (0,
|
|
3310
|
+
const publicClient = (0, import_viem14.createPublicClient)({
|
|
3311
|
+
chain: (0, import_viem14.defineChain)(chain),
|
|
3312
|
+
transport: (0, import_viem14.http)()
|
|
3199
3313
|
});
|
|
3200
3314
|
const receipt = await publicClient.getTransactionReceipt({ hash });
|
|
3201
3315
|
if (!receipt) {
|
|
@@ -3209,7 +3323,7 @@ function useReceipt2({
|
|
|
3209
3323
|
},
|
|
3210
3324
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
3211
3325
|
});
|
|
3212
|
-
(0,
|
|
3326
|
+
(0, import_react40.useEffect)(() => {
|
|
3213
3327
|
if (query.data) {
|
|
3214
3328
|
setShouldRefetch(false);
|
|
3215
3329
|
}
|
|
@@ -3218,14 +3332,14 @@ function useReceipt2({
|
|
|
3218
3332
|
}
|
|
3219
3333
|
|
|
3220
3334
|
// src/hooks/useTransaction.tsx
|
|
3221
|
-
var
|
|
3335
|
+
var import_react41 = require("react");
|
|
3222
3336
|
var import_react_query10 = require("@tanstack/react-query");
|
|
3223
|
-
var
|
|
3337
|
+
var import_viem15 = require("viem");
|
|
3224
3338
|
var CACHE_TTL2 = 86400 * 30 * 1e3;
|
|
3225
3339
|
var MAX_CACHE_SIZE2 = 500;
|
|
3226
3340
|
var STORAGE_KEY2 = "match_transaction_logs";
|
|
3227
3341
|
function useTransactionCache() {
|
|
3228
|
-
const [cache, setCache] = (0,
|
|
3342
|
+
const [cache, setCache] = (0, import_react41.useState)(/* @__PURE__ */ new Map());
|
|
3229
3343
|
const isLocalStorageAvailable = (() => {
|
|
3230
3344
|
try {
|
|
3231
3345
|
const testKey = "__test__";
|
|
@@ -3236,7 +3350,7 @@ function useTransactionCache() {
|
|
|
3236
3350
|
return false;
|
|
3237
3351
|
}
|
|
3238
3352
|
})();
|
|
3239
|
-
(0,
|
|
3353
|
+
(0, import_react41.useEffect)(() => {
|
|
3240
3354
|
if (isLocalStorageAvailable) {
|
|
3241
3355
|
try {
|
|
3242
3356
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -3255,7 +3369,7 @@ function useTransactionCache() {
|
|
|
3255
3369
|
}
|
|
3256
3370
|
}
|
|
3257
3371
|
}, []);
|
|
3258
|
-
const updateLocalStorage = (0,
|
|
3372
|
+
const updateLocalStorage = (0, import_react41.useCallback)((updatedCache) => {
|
|
3259
3373
|
if (isLocalStorageAvailable) {
|
|
3260
3374
|
try {
|
|
3261
3375
|
const storedData = localStorage.getItem(STORAGE_KEY2);
|
|
@@ -3272,7 +3386,7 @@ function useTransactionCache() {
|
|
|
3272
3386
|
}
|
|
3273
3387
|
}
|
|
3274
3388
|
}, []);
|
|
3275
|
-
const set = (0,
|
|
3389
|
+
const set = (0, import_react41.useCallback)((key, value) => {
|
|
3276
3390
|
const now = Date.now();
|
|
3277
3391
|
const newCache = new Map(cache);
|
|
3278
3392
|
newCache.forEach((entry, k) => {
|
|
@@ -3290,7 +3404,7 @@ function useTransactionCache() {
|
|
|
3290
3404
|
setCache(newCache);
|
|
3291
3405
|
updateLocalStorage(newCache);
|
|
3292
3406
|
}, [cache, updateLocalStorage]);
|
|
3293
|
-
const get = (0,
|
|
3407
|
+
const get = (0, import_react41.useCallback)((key) => {
|
|
3294
3408
|
const entry = cache.get(key);
|
|
3295
3409
|
if (entry) {
|
|
3296
3410
|
if (Date.now() - entry.timestamp > CACHE_TTL2) {
|
|
@@ -3304,7 +3418,7 @@ function useTransactionCache() {
|
|
|
3304
3418
|
}
|
|
3305
3419
|
return void 0;
|
|
3306
3420
|
}, [cache, updateLocalStorage]);
|
|
3307
|
-
const del = (0,
|
|
3421
|
+
const del = (0, import_react41.useCallback)((key) => {
|
|
3308
3422
|
if (cache.has(key)) {
|
|
3309
3423
|
const newCache = new Map(cache);
|
|
3310
3424
|
newCache.delete(key);
|
|
@@ -3312,7 +3426,7 @@ function useTransactionCache() {
|
|
|
3312
3426
|
updateLocalStorage(newCache);
|
|
3313
3427
|
}
|
|
3314
3428
|
}, [cache, updateLocalStorage]);
|
|
3315
|
-
const clear = (0,
|
|
3429
|
+
const clear = (0, import_react41.useCallback)(() => {
|
|
3316
3430
|
setCache(/* @__PURE__ */ new Map());
|
|
3317
3431
|
if (isLocalStorageAvailable) {
|
|
3318
3432
|
localStorage.removeItem(STORAGE_KEY2);
|
|
@@ -3327,7 +3441,7 @@ function useTransaction({
|
|
|
3327
3441
|
const { list } = useMatchChain();
|
|
3328
3442
|
const cache = useTransactionCache();
|
|
3329
3443
|
const chain = list?.find((item) => item.id === chainId);
|
|
3330
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
3444
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react41.useState)(true);
|
|
3331
3445
|
const query = (0, import_react_query10.useQuery)({
|
|
3332
3446
|
queryKey: ["match-tx-transaction", hash, chain],
|
|
3333
3447
|
queryFn: async () => {
|
|
@@ -3337,9 +3451,9 @@ function useTransaction({
|
|
|
3337
3451
|
return cache.get(cacheKey);
|
|
3338
3452
|
}
|
|
3339
3453
|
try {
|
|
3340
|
-
const publicClient = (0,
|
|
3341
|
-
chain: (0,
|
|
3342
|
-
transport: (0,
|
|
3454
|
+
const publicClient = (0, import_viem15.createPublicClient)({
|
|
3455
|
+
chain: (0, import_viem15.defineChain)(chain),
|
|
3456
|
+
transport: (0, import_viem15.http)()
|
|
3343
3457
|
});
|
|
3344
3458
|
const transaction = await publicClient.getTransaction({ hash });
|
|
3345
3459
|
if (!transaction) {
|
|
@@ -3353,7 +3467,7 @@ function useTransaction({
|
|
|
3353
3467
|
},
|
|
3354
3468
|
refetchInterval: shouldRefetch ? 1e4 : false
|
|
3355
3469
|
});
|
|
3356
|
-
(0,
|
|
3470
|
+
(0, import_react41.useEffect)(() => {
|
|
3357
3471
|
if (query.data) {
|
|
3358
3472
|
setShouldRefetch(false);
|
|
3359
3473
|
}
|