@meshsdk/react 1.7.22 → 1.7.24
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/index.cjs +455 -317
- package/dist/index.js +459 -321
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/cardano-wallet/index.tsx
|
|
2
|
-
import { useEffect as
|
|
2
|
+
import { useEffect as useEffect9, useState as useState11 } from "react";
|
|
3
3
|
|
|
4
4
|
// src/common/button.tsx
|
|
5
5
|
import * as React3 from "react";
|
|
@@ -2736,146 +2736,10 @@ var DialogDescription = React4.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
2736
2736
|
));
|
|
2737
2737
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
2738
2738
|
|
|
2739
|
-
// src/common/dropdown-menu.tsx
|
|
2740
|
-
import * as React5 from "react";
|
|
2741
|
-
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
2742
|
-
import {
|
|
2743
|
-
CheckIcon,
|
|
2744
|
-
ChevronRightIcon,
|
|
2745
|
-
DotFilledIcon
|
|
2746
|
-
} from "@radix-ui/react-icons";
|
|
2747
|
-
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2748
|
-
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
2749
|
-
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
2750
|
-
var DropdownMenuSubTrigger = React5.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs2(
|
|
2751
|
-
DropdownMenuPrimitive.SubTrigger,
|
|
2752
|
-
{
|
|
2753
|
-
ref,
|
|
2754
|
-
className: cn(
|
|
2755
|
-
"mesh-flex mesh-cursor-default mesh-select-none mesh-items-center mesh-rounded-sm mesh-px-2 mesh-py-1.5 mesh-text-sm mesh-outline-none focus:mesh-bg-zinc-100 data-[state=open]:mesh-bg-zinc-100 dark:focus:mesh-bg-zinc-800 dark:data-[state=open]:mesh-bg-zinc-800",
|
|
2756
|
-
inset && "mesh-pl-8",
|
|
2757
|
-
className
|
|
2758
|
-
),
|
|
2759
|
-
...props,
|
|
2760
|
-
children: [
|
|
2761
|
-
children,
|
|
2762
|
-
/* @__PURE__ */ jsx4(ChevronRightIcon, { className: "mesh-ml-auto mesh-h-4 mesh-w-4" })
|
|
2763
|
-
]
|
|
2764
|
-
}
|
|
2765
|
-
));
|
|
2766
|
-
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
2767
|
-
var DropdownMenuSubContent = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
2768
|
-
DropdownMenuPrimitive.SubContent,
|
|
2769
|
-
{
|
|
2770
|
-
ref,
|
|
2771
|
-
className: cn(
|
|
2772
|
-
"mesh-z-50 mesh-min-w-[8rem] mesh-overflow-hidden mesh-rounded-md mesh-border mesh-border-zinc-200 mesh-bg-white mesh-p-1 mesh-text-zinc-950 mesh-shadow-lg data-[state=open]:mesh-animate-in data-[state=closed]:mesh-animate-out data-[state=closed]:mesh-fade-out-0 data-[state=open]:mesh-fade-in-0 data-[state=closed]:mesh-zoom-out-95 data-[state=open]:mesh-zoom-in-95 data-[side=bottom]:mesh-slide-in-from-top-2 data-[side=left]:mesh-slide-in-from-right-2 data-[side=right]:mesh-slide-in-from-left-2 data-[side=top]:mesh-slide-in-from-bottom-2 dark:mesh-border-zinc-800 dark:mesh-bg-zinc-950 dark:mesh-text-zinc-50",
|
|
2773
|
-
className
|
|
2774
|
-
),
|
|
2775
|
-
...props
|
|
2776
|
-
}
|
|
2777
|
-
));
|
|
2778
|
-
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
2779
|
-
var DropdownMenuContent = React5.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx4(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx4(
|
|
2780
|
-
DropdownMenuPrimitive.Content,
|
|
2781
|
-
{
|
|
2782
|
-
ref,
|
|
2783
|
-
sideOffset,
|
|
2784
|
-
className: cn(
|
|
2785
|
-
"mesh-z-50 mesh-min-w-[8rem] mesh-overflow-hidden mesh-rounded-md mesh-border mesh-border-zinc-200 mesh-bg-white mesh-p-1 mesh-text-zinc-950 mesh-shadow-md dark:mesh-border-zinc-800 dark:mesh-bg-zinc-950 dark:mesh-text-zinc-50",
|
|
2786
|
-
"data-[state=open]:mesh-animate-in data-[state=closed]:mesh-animate-out data-[state=closed]:mesh-fade-out-0 data-[state=open]:mesh-fade-in-0 data-[state=closed]:mesh-zoom-out-95 data-[state=open]:mesh-zoom-in-95 data-[side=bottom]:mesh-slide-in-from-top-2 data-[side=left]:mesh-slide-in-from-right-2 data-[side=right]:mesh-slide-in-from-left-2 data-[side=top]:mesh-slide-in-from-bottom-2",
|
|
2787
|
-
className
|
|
2788
|
-
),
|
|
2789
|
-
...props
|
|
2790
|
-
}
|
|
2791
|
-
) }));
|
|
2792
|
-
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
2793
|
-
var DropdownMenuItem = React5.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
2794
|
-
DropdownMenuPrimitive.Item,
|
|
2795
|
-
{
|
|
2796
|
-
ref,
|
|
2797
|
-
className: cn(
|
|
2798
|
-
"mesh-relative mesh-flex mesh-cursor-default mesh-select-none mesh-items-center mesh-rounded-sm mesh-px-2 mesh-py-1.5 mesh-text-sm mesh-outline-none mesh-transition-colors focus:mesh-bg-zinc-100 focus:mesh-text-zinc-900 data-[disabled]:mesh-pointer-events-none data-[disabled]:mesh-opacity-50 dark:focus:mesh-bg-zinc-800 dark:focus:mesh-text-zinc-50",
|
|
2799
|
-
inset && "mesh-pl-8",
|
|
2800
|
-
className
|
|
2801
|
-
),
|
|
2802
|
-
...props
|
|
2803
|
-
}
|
|
2804
|
-
));
|
|
2805
|
-
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
2806
|
-
var DropdownMenuCheckboxItem = React5.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs2(
|
|
2807
|
-
DropdownMenuPrimitive.CheckboxItem,
|
|
2808
|
-
{
|
|
2809
|
-
ref,
|
|
2810
|
-
className: cn(
|
|
2811
|
-
"mesh-relative mesh-flex mesh-cursor-default mesh-select-none mesh-items-center mesh-rounded-sm mesh-py-1.5 mesh-pl-8 mesh-pr-2 mesh-text-sm mesh-outline-none mesh-transition-colors focus:mesh-bg-zinc-100 focus:mesh-text-zinc-900 data-[disabled]:mesh-pointer-events-none data-[disabled]:mesh-opacity-50 dark:focus:mesh-bg-zinc-800 dark:focus:mesh-text-zinc-50",
|
|
2812
|
-
className
|
|
2813
|
-
),
|
|
2814
|
-
checked,
|
|
2815
|
-
...props,
|
|
2816
|
-
children: [
|
|
2817
|
-
/* @__PURE__ */ jsx4("span", { className: "mesh-absolute mesh-left-2 mesh-flex mesh-h-3.5 mesh-w-3.5 mesh-items-center mesh-justify-center", children: /* @__PURE__ */ jsx4(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx4(CheckIcon, { className: "mesh-h-4 mesh-w-4" }) }) }),
|
|
2818
|
-
children
|
|
2819
|
-
]
|
|
2820
|
-
}
|
|
2821
|
-
));
|
|
2822
|
-
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
2823
|
-
var DropdownMenuRadioItem = React5.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs2(
|
|
2824
|
-
DropdownMenuPrimitive.RadioItem,
|
|
2825
|
-
{
|
|
2826
|
-
ref,
|
|
2827
|
-
className: cn(
|
|
2828
|
-
"mesh-relative mesh-flex mesh-cursor-default mesh-select-none mesh-items-center mesh-rounded-sm mesh-py-1.5 mesh-pl-8 mesh-pr-2 mesh-text-sm mesh-outline-none mesh-transition-colors focus:mesh-bg-zinc-100 focus:mesh-text-zinc-900 data-[disabled]:mesh-pointer-events-none data-[disabled]:mesh-opacity-50 dark:focus:mesh-bg-zinc-800 dark:focus:mesh-text-zinc-50",
|
|
2829
|
-
className
|
|
2830
|
-
),
|
|
2831
|
-
...props,
|
|
2832
|
-
children: [
|
|
2833
|
-
/* @__PURE__ */ jsx4("span", { className: "mesh-absolute mesh-left-2 mesh-flex mesh-h-3.5 mesh-w-3.5 mesh-items-center mesh-justify-center", children: /* @__PURE__ */ jsx4(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx4(DotFilledIcon, { className: "mesh-h-4 mesh-w-4 mesh-fill-current" }) }) }),
|
|
2834
|
-
children
|
|
2835
|
-
]
|
|
2836
|
-
}
|
|
2837
|
-
));
|
|
2838
|
-
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
2839
|
-
var DropdownMenuLabel = React5.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
2840
|
-
DropdownMenuPrimitive.Label,
|
|
2841
|
-
{
|
|
2842
|
-
ref,
|
|
2843
|
-
className: cn(
|
|
2844
|
-
"mesh-px-2 mesh-py-1.5 mesh-text-sm mesh-font-semibold",
|
|
2845
|
-
inset && "mesh-pl-8",
|
|
2846
|
-
className
|
|
2847
|
-
),
|
|
2848
|
-
...props
|
|
2849
|
-
}
|
|
2850
|
-
));
|
|
2851
|
-
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
2852
|
-
var DropdownMenuSeparator = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
2853
|
-
DropdownMenuPrimitive.Separator,
|
|
2854
|
-
{
|
|
2855
|
-
ref,
|
|
2856
|
-
className: cn("-mesh-mx-1 mesh-my-1 mesh-h-px mesh-bg-zinc-100 dark:mesh-bg-zinc-800", className),
|
|
2857
|
-
...props
|
|
2858
|
-
}
|
|
2859
|
-
));
|
|
2860
|
-
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
2861
|
-
var DropdownMenuShortcut = ({
|
|
2862
|
-
className,
|
|
2863
|
-
...props
|
|
2864
|
-
}) => {
|
|
2865
|
-
return /* @__PURE__ */ jsx4(
|
|
2866
|
-
"span",
|
|
2867
|
-
{
|
|
2868
|
-
className: cn("mesh-ml-auto mesh-text-xs mesh-tracking-widest mesh-opacity-60", className),
|
|
2869
|
-
...props
|
|
2870
|
-
}
|
|
2871
|
-
);
|
|
2872
|
-
};
|
|
2873
|
-
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
2874
|
-
|
|
2875
2739
|
// src/common/icons/icon-chevron-right.tsx
|
|
2876
|
-
import { jsx as
|
|
2740
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2877
2741
|
function IconChevronRight() {
|
|
2878
|
-
return /* @__PURE__ */
|
|
2742
|
+
return /* @__PURE__ */ jsx4(
|
|
2879
2743
|
"svg",
|
|
2880
2744
|
{
|
|
2881
2745
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2894,59 +2758,7 @@ function IconChevronRight() {
|
|
|
2894
2758
|
strokeWidth: "1px"
|
|
2895
2759
|
},
|
|
2896
2760
|
className: "hover:mesh-fill-white",
|
|
2897
|
-
children: /* @__PURE__ */
|
|
2898
|
-
}
|
|
2899
|
-
);
|
|
2900
|
-
}
|
|
2901
|
-
|
|
2902
|
-
// src/common/icons/icon-monitor-smartphone.tsx
|
|
2903
|
-
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2904
|
-
function IconMonitorSmartphone() {
|
|
2905
|
-
return /* @__PURE__ */ jsxs3(
|
|
2906
|
-
"svg",
|
|
2907
|
-
{
|
|
2908
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2909
|
-
width: "24",
|
|
2910
|
-
height: "24",
|
|
2911
|
-
viewBox: "0 0 24 24",
|
|
2912
|
-
fill: "none",
|
|
2913
|
-
stroke: "black",
|
|
2914
|
-
strokeWidth: "2",
|
|
2915
|
-
strokeLinecap: "round",
|
|
2916
|
-
strokeLinejoin: "round",
|
|
2917
|
-
style: {
|
|
2918
|
-
color: "#ffadff",
|
|
2919
|
-
width: "56px",
|
|
2920
|
-
height: "56px",
|
|
2921
|
-
strokeWidth: "1px"
|
|
2922
|
-
},
|
|
2923
|
-
children: [
|
|
2924
|
-
/* @__PURE__ */ jsx6("path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8" }),
|
|
2925
|
-
/* @__PURE__ */ jsx6("path", { d: "M10 19v-3.96 3.15" }),
|
|
2926
|
-
/* @__PURE__ */ jsx6("path", { d: "M7 19h5" }),
|
|
2927
|
-
/* @__PURE__ */ jsx6("rect", { width: "6", height: "10", x: "16", y: "12", rx: "2" })
|
|
2928
|
-
]
|
|
2929
|
-
}
|
|
2930
|
-
);
|
|
2931
|
-
}
|
|
2932
|
-
|
|
2933
|
-
// src/common/icons/wallet-icon.tsx
|
|
2934
|
-
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2935
|
-
function WalletIcon({
|
|
2936
|
-
icon,
|
|
2937
|
-
name,
|
|
2938
|
-
action,
|
|
2939
|
-
iconReactNode
|
|
2940
|
-
}) {
|
|
2941
|
-
return /* @__PURE__ */ jsxs4(
|
|
2942
|
-
"button",
|
|
2943
|
-
{
|
|
2944
|
-
className: "mesh-flex mesh-items-center mesh-justify-center mesh-rounded-lg mesh-w-10 mesh-h-10 mesh-bg-neutral-50 mesh-border mesh-border-zinc-700 hover:mesh-border-zinc-200 mesh-cursor-pointer",
|
|
2945
|
-
onClick: action,
|
|
2946
|
-
children: [
|
|
2947
|
-
icon && /* @__PURE__ */ jsx7("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
2948
|
-
iconReactNode && iconReactNode
|
|
2949
|
-
]
|
|
2761
|
+
children: /* @__PURE__ */ jsx4("path", { d: "m15 18-6-6 6-6" })
|
|
2950
2762
|
}
|
|
2951
2763
|
);
|
|
2952
2764
|
}
|
|
@@ -3008,10 +2820,10 @@ var WalletContext = createContext({
|
|
|
3008
2820
|
});
|
|
3009
2821
|
|
|
3010
2822
|
// src/contexts/index.tsx
|
|
3011
|
-
import { Fragment as Fragment2, jsx as
|
|
2823
|
+
import { Fragment as Fragment2, jsx as jsx5 } from "react/jsx-runtime";
|
|
3012
2824
|
var MeshProvider = (props) => {
|
|
3013
2825
|
const store = useWalletStore();
|
|
3014
|
-
return /* @__PURE__ */
|
|
2826
|
+
return /* @__PURE__ */ jsx5(WalletContext.Provider, { value: store, children: /* @__PURE__ */ jsx5(Fragment2, { children: props.children }) });
|
|
3015
2827
|
};
|
|
3016
2828
|
|
|
3017
2829
|
// src/hooks/useAddress.ts
|
|
@@ -3171,74 +2983,148 @@ var useWalletSubmit = () => {
|
|
|
3171
2983
|
};
|
|
3172
2984
|
};
|
|
3173
2985
|
|
|
3174
|
-
// src/cardano-wallet/
|
|
3175
|
-
import {
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
2986
|
+
// src/cardano-wallet/connected-button.tsx
|
|
2987
|
+
import { useEffect as useEffect7, useState as useState9 } from "react";
|
|
2988
|
+
|
|
2989
|
+
// src/common/dropdown-menu.tsx
|
|
2990
|
+
import * as React5 from "react";
|
|
2991
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
2992
|
+
import {
|
|
2993
|
+
CheckIcon,
|
|
2994
|
+
ChevronRightIcon,
|
|
2995
|
+
DotFilledIcon
|
|
2996
|
+
} from "@radix-ui/react-icons";
|
|
2997
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2998
|
+
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
2999
|
+
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
3000
|
+
var DropdownMenuSubTrigger = React5.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs2(
|
|
3001
|
+
DropdownMenuPrimitive.SubTrigger,
|
|
3002
|
+
{
|
|
3003
|
+
ref,
|
|
3004
|
+
className: cn(
|
|
3005
|
+
"mesh-flex mesh-cursor-default mesh-select-none mesh-items-center mesh-rounded-sm mesh-px-2 mesh-py-1.5 mesh-text-sm mesh-outline-none focus:mesh-bg-zinc-100 data-[state=open]:mesh-bg-zinc-100 dark:focus:mesh-bg-zinc-800 dark:data-[state=open]:mesh-bg-zinc-800",
|
|
3006
|
+
inset && "mesh-pl-8",
|
|
3007
|
+
className
|
|
3008
|
+
),
|
|
3009
|
+
...props,
|
|
3010
|
+
children: [
|
|
3011
|
+
children,
|
|
3012
|
+
/* @__PURE__ */ jsx6(ChevronRightIcon, { className: "mesh-ml-auto mesh-h-4 mesh-w-4" })
|
|
3013
|
+
]
|
|
3014
|
+
}
|
|
3015
|
+
));
|
|
3016
|
+
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
3017
|
+
var DropdownMenuSubContent = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
3018
|
+
DropdownMenuPrimitive.SubContent,
|
|
3019
|
+
{
|
|
3020
|
+
ref,
|
|
3021
|
+
className: cn(
|
|
3022
|
+
"mesh-z-50 mesh-min-w-[8rem] mesh-overflow-hidden mesh-rounded-md mesh-border mesh-border-zinc-200 mesh-bg-white mesh-p-1 mesh-text-zinc-950 mesh-shadow-lg data-[state=open]:mesh-animate-in data-[state=closed]:mesh-animate-out data-[state=closed]:mesh-fade-out-0 data-[state=open]:mesh-fade-in-0 data-[state=closed]:mesh-zoom-out-95 data-[state=open]:mesh-zoom-in-95 data-[side=bottom]:mesh-slide-in-from-top-2 data-[side=left]:mesh-slide-in-from-right-2 data-[side=right]:mesh-slide-in-from-left-2 data-[side=top]:mesh-slide-in-from-bottom-2 dark:mesh-border-zinc-800 dark:mesh-bg-zinc-950 dark:mesh-text-zinc-50",
|
|
3023
|
+
className
|
|
3024
|
+
),
|
|
3025
|
+
...props
|
|
3026
|
+
}
|
|
3027
|
+
));
|
|
3028
|
+
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
3029
|
+
var DropdownMenuContent = React5.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx6(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx6(
|
|
3030
|
+
DropdownMenuPrimitive.Content,
|
|
3031
|
+
{
|
|
3032
|
+
ref,
|
|
3033
|
+
sideOffset,
|
|
3034
|
+
className: cn(
|
|
3035
|
+
"mesh-z-50 mesh-min-w-[8rem] mesh-overflow-hidden mesh-rounded-md mesh-border mesh-border-zinc-200 mesh-bg-white mesh-p-1 mesh-text-zinc-950 mesh-shadow-md dark:mesh-border-zinc-800 dark:mesh-bg-zinc-950 dark:mesh-text-zinc-50",
|
|
3036
|
+
"data-[state=open]:mesh-animate-in data-[state=closed]:mesh-animate-out data-[state=closed]:mesh-fade-out-0 data-[state=open]:mesh-fade-in-0 data-[state=closed]:mesh-zoom-out-95 data-[state=open]:mesh-zoom-in-95 data-[side=bottom]:mesh-slide-in-from-top-2 data-[side=left]:mesh-slide-in-from-right-2 data-[side=right]:mesh-slide-in-from-left-2 data-[side=top]:mesh-slide-in-from-bottom-2",
|
|
3037
|
+
className
|
|
3038
|
+
),
|
|
3039
|
+
...props
|
|
3040
|
+
}
|
|
3041
|
+
) }));
|
|
3042
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
3043
|
+
var DropdownMenuItem = React5.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
3044
|
+
DropdownMenuPrimitive.Item,
|
|
3045
|
+
{
|
|
3046
|
+
ref,
|
|
3047
|
+
className: cn(
|
|
3048
|
+
"mesh-relative mesh-flex mesh-cursor-default mesh-select-none mesh-items-center mesh-rounded-sm mesh-px-2 mesh-py-1.5 mesh-text-sm mesh-outline-none mesh-transition-colors focus:mesh-bg-zinc-100 focus:mesh-text-zinc-900 data-[disabled]:mesh-pointer-events-none data-[disabled]:mesh-opacity-50 dark:focus:mesh-bg-zinc-800 dark:focus:mesh-text-zinc-50",
|
|
3049
|
+
inset && "mesh-pl-8",
|
|
3050
|
+
className
|
|
3051
|
+
),
|
|
3052
|
+
...props
|
|
3053
|
+
}
|
|
3054
|
+
));
|
|
3055
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
3056
|
+
var DropdownMenuCheckboxItem = React5.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs2(
|
|
3057
|
+
DropdownMenuPrimitive.CheckboxItem,
|
|
3058
|
+
{
|
|
3059
|
+
ref,
|
|
3060
|
+
className: cn(
|
|
3061
|
+
"mesh-relative mesh-flex mesh-cursor-default mesh-select-none mesh-items-center mesh-rounded-sm mesh-py-1.5 mesh-pl-8 mesh-pr-2 mesh-text-sm mesh-outline-none mesh-transition-colors focus:mesh-bg-zinc-100 focus:mesh-text-zinc-900 data-[disabled]:mesh-pointer-events-none data-[disabled]:mesh-opacity-50 dark:focus:mesh-bg-zinc-800 dark:focus:mesh-text-zinc-50",
|
|
3062
|
+
className
|
|
3063
|
+
),
|
|
3064
|
+
checked,
|
|
3065
|
+
...props,
|
|
3066
|
+
children: [
|
|
3067
|
+
/* @__PURE__ */ jsx6("span", { className: "mesh-absolute mesh-left-2 mesh-flex mesh-h-3.5 mesh-w-3.5 mesh-items-center mesh-justify-center", children: /* @__PURE__ */ jsx6(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx6(CheckIcon, { className: "mesh-h-4 mesh-w-4" }) }) }),
|
|
3068
|
+
children
|
|
3069
|
+
]
|
|
3070
|
+
}
|
|
3071
|
+
));
|
|
3072
|
+
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
3073
|
+
var DropdownMenuRadioItem = React5.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs2(
|
|
3074
|
+
DropdownMenuPrimitive.RadioItem,
|
|
3075
|
+
{
|
|
3076
|
+
ref,
|
|
3077
|
+
className: cn(
|
|
3078
|
+
"mesh-relative mesh-flex mesh-cursor-default mesh-select-none mesh-items-center mesh-rounded-sm mesh-py-1.5 mesh-pl-8 mesh-pr-2 mesh-text-sm mesh-outline-none mesh-transition-colors focus:mesh-bg-zinc-100 focus:mesh-text-zinc-900 data-[disabled]:mesh-pointer-events-none data-[disabled]:mesh-opacity-50 dark:focus:mesh-bg-zinc-800 dark:focus:mesh-text-zinc-50",
|
|
3079
|
+
className
|
|
3080
|
+
),
|
|
3081
|
+
...props,
|
|
3082
|
+
children: [
|
|
3083
|
+
/* @__PURE__ */ jsx6("span", { className: "mesh-absolute mesh-left-2 mesh-flex mesh-h-3.5 mesh-w-3.5 mesh-items-center mesh-justify-center", children: /* @__PURE__ */ jsx6(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx6(DotFilledIcon, { className: "mesh-h-4 mesh-w-4 mesh-fill-current" }) }) }),
|
|
3084
|
+
children
|
|
3085
|
+
]
|
|
3086
|
+
}
|
|
3087
|
+
));
|
|
3088
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
3089
|
+
var DropdownMenuLabel = React5.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
3090
|
+
DropdownMenuPrimitive.Label,
|
|
3091
|
+
{
|
|
3092
|
+
ref,
|
|
3093
|
+
className: cn(
|
|
3094
|
+
"mesh-px-2 mesh-py-1.5 mesh-text-sm mesh-font-semibold",
|
|
3095
|
+
inset && "mesh-pl-8",
|
|
3096
|
+
className
|
|
3097
|
+
),
|
|
3098
|
+
...props
|
|
3099
|
+
}
|
|
3100
|
+
));
|
|
3101
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
3102
|
+
var DropdownMenuSeparator = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
3103
|
+
DropdownMenuPrimitive.Separator,
|
|
3104
|
+
{
|
|
3105
|
+
ref,
|
|
3106
|
+
className: cn("-mesh-mx-1 mesh-my-1 mesh-h-px mesh-bg-zinc-100 dark:mesh-bg-zinc-800", className),
|
|
3107
|
+
...props
|
|
3108
|
+
}
|
|
3109
|
+
));
|
|
3110
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
3111
|
+
var DropdownMenuShortcut = ({
|
|
3112
|
+
className,
|
|
3113
|
+
...props
|
|
3183
3114
|
}) => {
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
if (onConnected) onConnected();
|
|
3115
|
+
return /* @__PURE__ */ jsx6(
|
|
3116
|
+
"span",
|
|
3117
|
+
{
|
|
3118
|
+
className: cn("mesh-ml-auto mesh-text-xs mesh-tracking-widest mesh-opacity-60", className),
|
|
3119
|
+
...props
|
|
3190
3120
|
}
|
|
3191
|
-
|
|
3192
|
-
return /* @__PURE__ */ jsxs5(Dialog, { open, onOpenChange: setOpen, children: [
|
|
3193
|
-
!connected ? /* @__PURE__ */ jsx9(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx9(Button, { variant: "outline", className: "mesh-text-white", children: label }) }) : /* @__PURE__ */ jsx9(ConnectedDropdown, {}),
|
|
3194
|
-
/* @__PURE__ */ jsxs5(DialogContent, { className: "sm:mesh-max-w-[425px]", children: [
|
|
3195
|
-
/* @__PURE__ */ jsxs5(DialogHeader, { children: [
|
|
3196
|
-
/* @__PURE__ */ jsxs5(DialogTitle, { className: "mesh-flex mesh-justify-between", children: [
|
|
3197
|
-
screen != "main" ? /* @__PURE__ */ jsx9("button", { onClick: () => setScreen("main"), children: /* @__PURE__ */ jsx9(IconChevronRight, {}) }) : /* @__PURE__ */ jsx9("span", { style: { width: "24px" } }),
|
|
3198
|
-
/* @__PURE__ */ jsxs5("span", { children: [
|
|
3199
|
-
screen == "main" && "Connect Wallet",
|
|
3200
|
-
screen == "p2p" && "P2P Connect"
|
|
3201
|
-
] }),
|
|
3202
|
-
/* @__PURE__ */ jsx9("span", { style: { width: "24px" } })
|
|
3203
|
-
] }),
|
|
3204
|
-
/* @__PURE__ */ jsx9(DialogDescription, { children: screen == "p2p" && "Use wallet that supports CIP-45, scan this QR code to connect." })
|
|
3205
|
-
] }),
|
|
3206
|
-
screen == "main" && /* @__PURE__ */ jsx9(
|
|
3207
|
-
MainScreen,
|
|
3208
|
-
{
|
|
3209
|
-
metamask,
|
|
3210
|
-
extensions,
|
|
3211
|
-
setOpen,
|
|
3212
|
-
setScreen
|
|
3213
|
-
}
|
|
3214
|
-
),
|
|
3215
|
-
/* @__PURE__ */ jsx9(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ jsxs5(
|
|
3216
|
-
"a",
|
|
3217
|
-
{
|
|
3218
|
-
href: "https://meshjs.dev/",
|
|
3219
|
-
target: "_blank",
|
|
3220
|
-
className: "mesh-grow mesh-flex mesh-gap-1 mesh-items-center mesh-justify-center mesh-text-zinc-500 hover:mesh-text-white mesh-fill-zinc-500 hover:mesh-fill-white",
|
|
3221
|
-
children: [
|
|
3222
|
-
/* @__PURE__ */ jsx9("span", { className: "", children: "Powered by" }),
|
|
3223
|
-
/* @__PURE__ */ jsx9(
|
|
3224
|
-
"svg",
|
|
3225
|
-
{
|
|
3226
|
-
width: 24,
|
|
3227
|
-
height: 24,
|
|
3228
|
-
enableBackground: "new 0 0 300 200",
|
|
3229
|
-
viewBox: "0 0 300 200",
|
|
3230
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3231
|
-
children: /* @__PURE__ */ jsx9("path", { d: "m289 127-45-60-45-60c-.9-1.3-2.4-2-4-2s-3.1.7-4 2l-37 49.3c-2 2.7-6 2.7-8 0l-37-49.3c-.9-1.3-2.4-2-4-2s-3.1.7-4 2l-45 60-45 60c-1.3 1.8-1.3 4.2 0 6l45 60c.9 1.3 2.4 2 4 2s3.1-.7 4-2l37-49.3c2-2.7 6-2.7 8 0l37 49.3c.9 1.3 2.4 2 4 2s3.1-.7 4-2l37-49.3c2-2.7 6-2.7 8 0l37 49.3c.9 1.3 2.4 2 4 2s3.1-.7 4-2l45-60c1.3-1.8 1.3-4.2 0-6zm-90-103.3 32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0l-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0zm-90 0 32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0l-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0zm-53 152.6-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0zm90 0-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0zm90 0-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0z" })
|
|
3232
|
-
}
|
|
3233
|
-
),
|
|
3234
|
-
/* @__PURE__ */ jsx9("span", { className: "", children: "Mesh SDK" })
|
|
3235
|
-
]
|
|
3236
|
-
}
|
|
3237
|
-
) })
|
|
3238
|
-
] })
|
|
3239
|
-
] });
|
|
3121
|
+
);
|
|
3240
3122
|
};
|
|
3241
|
-
|
|
3123
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
3124
|
+
|
|
3125
|
+
// src/cardano-wallet/connected-button.tsx
|
|
3126
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3127
|
+
function ConnectedButton() {
|
|
3242
3128
|
const { wallet, connected, disconnect } = useWallet();
|
|
3243
3129
|
const [address, setAddress] = useState9("");
|
|
3244
3130
|
useEffect7(() => {
|
|
@@ -3251,16 +3137,16 @@ function ConnectedDropdown() {
|
|
|
3251
3137
|
afterConnectedWallet();
|
|
3252
3138
|
}
|
|
3253
3139
|
}, [connected, wallet]);
|
|
3254
|
-
return /* @__PURE__ */
|
|
3255
|
-
/* @__PURE__ */
|
|
3140
|
+
return /* @__PURE__ */ jsxs3(DropdownMenu, { children: [
|
|
3141
|
+
/* @__PURE__ */ jsx7(DropdownMenuTrigger, { children: /* @__PURE__ */ jsxs3(Button, { variant: "outline", className: "mesh-text-white", children: [
|
|
3256
3142
|
address.slice(0, 6),
|
|
3257
3143
|
"...",
|
|
3258
3144
|
address.slice(-6)
|
|
3259
3145
|
] }) }),
|
|
3260
|
-
/* @__PURE__ */
|
|
3261
|
-
/* @__PURE__ */
|
|
3262
|
-
/* @__PURE__ */
|
|
3263
|
-
/* @__PURE__ */
|
|
3146
|
+
/* @__PURE__ */ jsxs3(DropdownMenuContent, { children: [
|
|
3147
|
+
/* @__PURE__ */ jsx7(DropdownMenuLabel, { children: "Wallet" }),
|
|
3148
|
+
/* @__PURE__ */ jsx7(DropdownMenuSeparator, {}),
|
|
3149
|
+
/* @__PURE__ */ jsx7(
|
|
3264
3150
|
DropdownMenuItem,
|
|
3265
3151
|
{
|
|
3266
3152
|
onClick: () => {
|
|
@@ -3269,7 +3155,7 @@ function ConnectedDropdown() {
|
|
|
3269
3155
|
children: "Copy Address"
|
|
3270
3156
|
}
|
|
3271
3157
|
),
|
|
3272
|
-
/* @__PURE__ */
|
|
3158
|
+
/* @__PURE__ */ jsx7(
|
|
3273
3159
|
DropdownMenuItem,
|
|
3274
3160
|
{
|
|
3275
3161
|
onClick: () => {
|
|
@@ -3281,16 +3167,103 @@ function ConnectedDropdown() {
|
|
|
3281
3167
|
] })
|
|
3282
3168
|
] });
|
|
3283
3169
|
}
|
|
3284
|
-
|
|
3170
|
+
|
|
3171
|
+
// src/common/icons/icon-download.tsx
|
|
3172
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3173
|
+
function IconDownload() {
|
|
3174
|
+
return /* @__PURE__ */ jsxs4(
|
|
3175
|
+
"svg",
|
|
3176
|
+
{
|
|
3177
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3178
|
+
width: "24",
|
|
3179
|
+
height: "24",
|
|
3180
|
+
viewBox: "0 0 24 24",
|
|
3181
|
+
fill: "none",
|
|
3182
|
+
stroke: "gray",
|
|
3183
|
+
strokeWidth: "2",
|
|
3184
|
+
strokeLinecap: "round",
|
|
3185
|
+
strokeLinejoin: "round",
|
|
3186
|
+
style: {
|
|
3187
|
+
color: "#ffadff",
|
|
3188
|
+
width: "24px",
|
|
3189
|
+
height: "24px",
|
|
3190
|
+
strokeWidth: "1px"
|
|
3191
|
+
},
|
|
3192
|
+
className: "hover:mesh-fill-white",
|
|
3193
|
+
children: [
|
|
3194
|
+
/* @__PURE__ */ jsx8("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
3195
|
+
/* @__PURE__ */ jsx8("polyline", { points: "7 10 12 15 17 10" }),
|
|
3196
|
+
/* @__PURE__ */ jsx8("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
|
|
3197
|
+
]
|
|
3198
|
+
}
|
|
3199
|
+
);
|
|
3200
|
+
}
|
|
3201
|
+
|
|
3202
|
+
// src/common/icons/icon-monitor-smartphone.tsx
|
|
3203
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3204
|
+
function IconMonitorSmartphone() {
|
|
3205
|
+
return /* @__PURE__ */ jsxs5(
|
|
3206
|
+
"svg",
|
|
3207
|
+
{
|
|
3208
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3209
|
+
width: "24",
|
|
3210
|
+
height: "24",
|
|
3211
|
+
viewBox: "0 0 24 24",
|
|
3212
|
+
fill: "none",
|
|
3213
|
+
stroke: "black",
|
|
3214
|
+
strokeWidth: "2",
|
|
3215
|
+
strokeLinecap: "round",
|
|
3216
|
+
strokeLinejoin: "round",
|
|
3217
|
+
style: {
|
|
3218
|
+
color: "#ffadff",
|
|
3219
|
+
width: "56px",
|
|
3220
|
+
height: "56px",
|
|
3221
|
+
strokeWidth: "1px"
|
|
3222
|
+
},
|
|
3223
|
+
children: [
|
|
3224
|
+
/* @__PURE__ */ jsx9("path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8" }),
|
|
3225
|
+
/* @__PURE__ */ jsx9("path", { d: "M10 19v-3.96 3.15" }),
|
|
3226
|
+
/* @__PURE__ */ jsx9("path", { d: "M7 19h5" }),
|
|
3227
|
+
/* @__PURE__ */ jsx9("rect", { width: "6", height: "10", x: "16", y: "12", rx: "2" })
|
|
3228
|
+
]
|
|
3229
|
+
}
|
|
3230
|
+
);
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3233
|
+
// src/common/icons/wallet-icon.tsx
|
|
3234
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3235
|
+
function WalletIcon({
|
|
3236
|
+
icon,
|
|
3237
|
+
name,
|
|
3238
|
+
action,
|
|
3239
|
+
iconReactNode
|
|
3240
|
+
}) {
|
|
3241
|
+
return /* @__PURE__ */ jsxs6(
|
|
3242
|
+
"button",
|
|
3243
|
+
{
|
|
3244
|
+
className: "mesh-flex mesh-items-center mesh-justify-center mesh-rounded-lg mesh-w-10 mesh-h-10 mesh-bg-neutral-50 mesh-border mesh-border-zinc-700 hover:mesh-border-zinc-200 mesh-cursor-pointer",
|
|
3245
|
+
onClick: action,
|
|
3246
|
+
children: [
|
|
3247
|
+
icon && /* @__PURE__ */ jsx10("img", { src: icon, alt: name, className: "mesh-w-8 mesh-h-8" }),
|
|
3248
|
+
iconReactNode && iconReactNode
|
|
3249
|
+
]
|
|
3250
|
+
}
|
|
3251
|
+
);
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3254
|
+
// src/cardano-wallet/screen-main.tsx
|
|
3255
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3256
|
+
function ScreenMain({
|
|
3285
3257
|
metamask,
|
|
3286
3258
|
extensions,
|
|
3287
3259
|
setOpen,
|
|
3288
|
-
setScreen
|
|
3260
|
+
setScreen,
|
|
3261
|
+
cardanoPeerConnect
|
|
3289
3262
|
}) {
|
|
3290
3263
|
const wallets = useWalletList({ metamask });
|
|
3291
3264
|
const { connect } = useWallet();
|
|
3292
|
-
return /* @__PURE__ */
|
|
3293
|
-
wallets.map((wallet, index) => /* @__PURE__ */
|
|
3265
|
+
return /* @__PURE__ */ jsxs7("div", { className: "mesh-grid mesh-gap-4 mesh-py-4 mesh-grid-cols-4 mesh-place-items-center", children: [
|
|
3266
|
+
wallets.map((wallet, index) => /* @__PURE__ */ jsx11(
|
|
3294
3267
|
WalletIcon,
|
|
3295
3268
|
{
|
|
3296
3269
|
icon: wallet.icon,
|
|
@@ -3302,7 +3275,7 @@ function MainScreen({
|
|
|
3302
3275
|
},
|
|
3303
3276
|
index
|
|
3304
3277
|
)),
|
|
3305
|
-
/* @__PURE__ */
|
|
3278
|
+
cardanoPeerConnect && /* @__PURE__ */ jsx11(
|
|
3306
3279
|
WalletIcon,
|
|
3307
3280
|
{
|
|
3308
3281
|
iconReactNode: IconMonitorSmartphone(),
|
|
@@ -3311,26 +3284,191 @@ function MainScreen({
|
|
|
3311
3284
|
setScreen("p2p");
|
|
3312
3285
|
}
|
|
3313
3286
|
}
|
|
3287
|
+
),
|
|
3288
|
+
/* @__PURE__ */ jsx11(
|
|
3289
|
+
WalletIcon,
|
|
3290
|
+
{
|
|
3291
|
+
iconReactNode: IconDownload(),
|
|
3292
|
+
name: `Download`,
|
|
3293
|
+
action: () => {
|
|
3294
|
+
window.open(
|
|
3295
|
+
"https://developers.cardano.org/showcase/?tags=wallet",
|
|
3296
|
+
"_blank"
|
|
3297
|
+
);
|
|
3298
|
+
}
|
|
3299
|
+
}
|
|
3314
3300
|
)
|
|
3315
3301
|
] });
|
|
3316
3302
|
}
|
|
3317
3303
|
|
|
3304
|
+
// src/cardano-wallet/screen-p2p.tsx
|
|
3305
|
+
import { useEffect as useEffect8, useRef as useRef2, useState as useState10 } from "react";
|
|
3306
|
+
|
|
3307
|
+
// src/common/cardano-peer-connect/index.ts
|
|
3308
|
+
import * as cjsCardanopeerconnect from "@fabianbormann/cardano-peer-connect";
|
|
3309
|
+
var cardanopeerconnect = cjsCardanopeerconnect;
|
|
3310
|
+
var exportedCardanopeerconnect = cardanopeerconnect?.default || cardanopeerconnect;
|
|
3311
|
+
var DAppPeerConnect = exportedCardanopeerconnect.DAppPeerConnect;
|
|
3312
|
+
|
|
3313
|
+
// src/cardano-wallet/screen-p2p.tsx
|
|
3314
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3315
|
+
function ScreenP2P({
|
|
3316
|
+
cardanoPeerConnect
|
|
3317
|
+
}) {
|
|
3318
|
+
const dAppConnect = useRef2(null);
|
|
3319
|
+
const qrCodeField = useRef2(null);
|
|
3320
|
+
const [address, setAddress] = useState10("");
|
|
3321
|
+
const [copied, setCopied] = useState10(false);
|
|
3322
|
+
useEffect8(() => {
|
|
3323
|
+
if (cardanoPeerConnect) {
|
|
3324
|
+
if (dAppConnect.current === null) {
|
|
3325
|
+
dAppConnect.current = new DAppPeerConnect({
|
|
3326
|
+
dAppInfo: {
|
|
3327
|
+
name: cardanoPeerConnect.dAppInfo.name,
|
|
3328
|
+
url: cardanoPeerConnect.dAppInfo.url
|
|
3329
|
+
},
|
|
3330
|
+
announce: cardanoPeerConnect.announce,
|
|
3331
|
+
onApiInject: (name, address2) => {
|
|
3332
|
+
console.log("onApiInject", name, address2);
|
|
3333
|
+
},
|
|
3334
|
+
onApiEject: (name, address2) => {
|
|
3335
|
+
console.log("onApiEject", name, address2);
|
|
3336
|
+
},
|
|
3337
|
+
onConnect: (address2, walletInfo) => {
|
|
3338
|
+
console.log("Connected to wallet", address2, walletInfo);
|
|
3339
|
+
},
|
|
3340
|
+
onDisconnect: () => {
|
|
3341
|
+
console.log("Disconnected from wallet");
|
|
3342
|
+
},
|
|
3343
|
+
verifyConnection: (walletInfo, callback) => {
|
|
3344
|
+
console.log("verifyConnection", walletInfo);
|
|
3345
|
+
callback(true, true);
|
|
3346
|
+
},
|
|
3347
|
+
useWalletDiscovery: true
|
|
3348
|
+
});
|
|
3349
|
+
if (dAppConnect.current) {
|
|
3350
|
+
const address2 = dAppConnect.current.getAddress();
|
|
3351
|
+
setAddress(address2);
|
|
3352
|
+
console.log("address", address2);
|
|
3353
|
+
if (qrCodeField.current !== null) {
|
|
3354
|
+
dAppConnect.current.generateQRCode(qrCodeField.current);
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3359
|
+
}, []);
|
|
3360
|
+
return /* @__PURE__ */ jsxs8("div", { className: "mesh-flex mesh-flex-col mesh-items-center mesh-justify-center", children: [
|
|
3361
|
+
/* @__PURE__ */ jsx12("div", { style: { marginTop: 16, marginBottom: 16 }, ref: qrCodeField }),
|
|
3362
|
+
/* @__PURE__ */ jsx12(
|
|
3363
|
+
Button,
|
|
3364
|
+
{
|
|
3365
|
+
variant: "outline",
|
|
3366
|
+
className: "mesh-text-white",
|
|
3367
|
+
onClick: () => {
|
|
3368
|
+
navigator.clipboard.writeText(address);
|
|
3369
|
+
setCopied(true);
|
|
3370
|
+
},
|
|
3371
|
+
children: copied ? "Copied" : "Copy Address"
|
|
3372
|
+
}
|
|
3373
|
+
)
|
|
3374
|
+
] });
|
|
3375
|
+
}
|
|
3376
|
+
|
|
3377
|
+
// src/cardano-wallet/index.tsx
|
|
3378
|
+
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3379
|
+
var CardanoWallet = ({
|
|
3380
|
+
label = "Connect Wallet",
|
|
3381
|
+
onConnected = void 0,
|
|
3382
|
+
isDark = false,
|
|
3383
|
+
metamask = void 0,
|
|
3384
|
+
extensions = [],
|
|
3385
|
+
cardanoPeerConnect = void 0
|
|
3386
|
+
}) => {
|
|
3387
|
+
const [open, setOpen] = useState11(false);
|
|
3388
|
+
const [screen, setScreen] = useState11("main");
|
|
3389
|
+
const { wallet, connected } = useWallet();
|
|
3390
|
+
useEffect9(() => {
|
|
3391
|
+
if (connected && wallet) {
|
|
3392
|
+
if (onConnected) onConnected();
|
|
3393
|
+
}
|
|
3394
|
+
}, [connected, wallet]);
|
|
3395
|
+
return /* @__PURE__ */ jsxs9(Dialog, { open, onOpenChange: setOpen, children: [
|
|
3396
|
+
!connected ? /* @__PURE__ */ jsx13(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx13(Button, { variant: "outline", className: "mesh-text-white", children: label }) }) : /* @__PURE__ */ jsx13(ConnectedButton, {}),
|
|
3397
|
+
/* @__PURE__ */ jsxs9(DialogContent, { className: "sm:mesh-max-w-[425px]", children: [
|
|
3398
|
+
/* @__PURE__ */ jsx13(Header, { screen, setScreen }),
|
|
3399
|
+
screen == "main" && /* @__PURE__ */ jsx13(
|
|
3400
|
+
ScreenMain,
|
|
3401
|
+
{
|
|
3402
|
+
metamask,
|
|
3403
|
+
extensions,
|
|
3404
|
+
setOpen,
|
|
3405
|
+
setScreen,
|
|
3406
|
+
cardanoPeerConnect
|
|
3407
|
+
}
|
|
3408
|
+
),
|
|
3409
|
+
screen == "p2p" && /* @__PURE__ */ jsx13(ScreenP2P, { cardanoPeerConnect }),
|
|
3410
|
+
/* @__PURE__ */ jsx13(Footer, {})
|
|
3411
|
+
] })
|
|
3412
|
+
] });
|
|
3413
|
+
};
|
|
3414
|
+
function Header({
|
|
3415
|
+
screen,
|
|
3416
|
+
setScreen
|
|
3417
|
+
}) {
|
|
3418
|
+
return /* @__PURE__ */ jsxs9(DialogHeader, { children: [
|
|
3419
|
+
/* @__PURE__ */ jsxs9(DialogTitle, { className: "mesh-flex mesh-justify-between", children: [
|
|
3420
|
+
screen != "main" ? /* @__PURE__ */ jsx13("button", { onClick: () => setScreen("main"), children: /* @__PURE__ */ jsx13(IconChevronRight, {}) }) : /* @__PURE__ */ jsx13("span", { style: { width: "24px" } }),
|
|
3421
|
+
/* @__PURE__ */ jsxs9("span", { children: [
|
|
3422
|
+
screen == "main" && "Connect Wallet",
|
|
3423
|
+
screen == "p2p" && "P2P Connect"
|
|
3424
|
+
] }),
|
|
3425
|
+
/* @__PURE__ */ jsx13("span", { style: { width: "24px" } })
|
|
3426
|
+
] }),
|
|
3427
|
+
/* @__PURE__ */ jsx13(DialogDescription, { children: screen == "p2p" && "Use wallet that supports CIP-45, scan this QR code to connect." })
|
|
3428
|
+
] });
|
|
3429
|
+
}
|
|
3430
|
+
function Footer() {
|
|
3431
|
+
return /* @__PURE__ */ jsx13(DialogFooter, { className: "mesh-justify-center mesh-text-sm", children: /* @__PURE__ */ jsxs9(
|
|
3432
|
+
"a",
|
|
3433
|
+
{
|
|
3434
|
+
href: "https://meshjs.dev/",
|
|
3435
|
+
target: "_blank",
|
|
3436
|
+
className: "mesh-grow mesh-flex mesh-gap-1 mesh-items-center mesh-justify-center mesh-text-zinc-500 hover:mesh-text-white mesh-fill-zinc-500 hover:mesh-fill-white",
|
|
3437
|
+
children: [
|
|
3438
|
+
/* @__PURE__ */ jsx13("span", { className: "", children: "Powered by" }),
|
|
3439
|
+
/* @__PURE__ */ jsx13(
|
|
3440
|
+
"svg",
|
|
3441
|
+
{
|
|
3442
|
+
width: 24,
|
|
3443
|
+
height: 24,
|
|
3444
|
+
enableBackground: "new 0 0 300 200",
|
|
3445
|
+
viewBox: "0 0 300 200",
|
|
3446
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3447
|
+
children: /* @__PURE__ */ jsx13("path", { d: "m289 127-45-60-45-60c-.9-1.3-2.4-2-4-2s-3.1.7-4 2l-37 49.3c-2 2.7-6 2.7-8 0l-37-49.3c-.9-1.3-2.4-2-4-2s-3.1.7-4 2l-45 60-45 60c-1.3 1.8-1.3 4.2 0 6l45 60c.9 1.3 2.4 2 4 2s3.1-.7 4-2l37-49.3c2-2.7 6-2.7 8 0l37 49.3c.9 1.3 2.4 2 4 2s3.1-.7 4-2l37-49.3c2-2.7 6-2.7 8 0l37 49.3c.9 1.3 2.4 2 4 2s3.1-.7 4-2l45-60c1.3-1.8 1.3-4.2 0-6zm-90-103.3 32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0l-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0zm-90 0 32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0l-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0zm-53 152.6-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0zm90 0-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0zm90 0-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0z" })
|
|
3448
|
+
}
|
|
3449
|
+
),
|
|
3450
|
+
/* @__PURE__ */ jsx13("span", { className: "", children: "Mesh SDK" })
|
|
3451
|
+
]
|
|
3452
|
+
}
|
|
3453
|
+
) });
|
|
3454
|
+
}
|
|
3455
|
+
|
|
3318
3456
|
// src/mesh-badge/mesh-logo.tsx
|
|
3319
|
-
import { jsx as
|
|
3320
|
-
var MeshLogo = () => /* @__PURE__ */
|
|
3457
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
3458
|
+
var MeshLogo = () => /* @__PURE__ */ jsx14(
|
|
3321
3459
|
"svg",
|
|
3322
3460
|
{
|
|
3323
3461
|
className: "mesh-h-16 mesh-p-2",
|
|
3324
3462
|
fill: "currentColor",
|
|
3325
3463
|
viewBox: "0 0 300 200",
|
|
3326
3464
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3327
|
-
children: /* @__PURE__ */
|
|
3465
|
+
children: /* @__PURE__ */ jsx14("path", { d: "m289 127-45-60-45-60c-.9-1.3-2.4-2-4-2s-3.1.7-4 2l-37 49.3c-2 2.7-6 2.7-8 0l-37-49.3c-.9-1.3-2.4-2-4-2s-3.1.7-4 2l-45 60-45 60c-1.3 1.8-1.3 4.2 0 6l45 60c.9 1.3 2.4 2 4 2s3.1-.7 4-2l37-49.3c2-2.7 6-2.7 8 0l37 49.3c.9 1.3 2.4 2 4 2s3.1-.7 4-2l37-49.3c2-2.7 6-2.7 8 0l37 49.3c.9 1.3 2.4 2 4 2s3.1-.7 4-2l45-60c1.3-1.8 1.3-4.2 0-6zm-90-103.3 32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0l-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0zm-90 0 32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0l-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0zm-53 152.6-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0zm90 0-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0zm90 0-32.5-43.3c-1.3-1.8-1.3-4.2 0-6l32.5-43.3c2-2.7 6-2.7 8 0l32.5 43.3c1.3 1.8 1.3 4.2 0 6l-32.5 43.3c-2 2.7-6 2.7-8 0z" })
|
|
3328
3466
|
}
|
|
3329
3467
|
);
|
|
3330
3468
|
|
|
3331
3469
|
// src/mesh-badge/index.tsx
|
|
3332
|
-
import { jsx as
|
|
3333
|
-
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */
|
|
3470
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3471
|
+
var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs10(
|
|
3334
3472
|
"a",
|
|
3335
3473
|
{
|
|
3336
3474
|
className: `mesh-flex mesh-max-w-fit mesh-flex-col mesh-items-center mesh-rounded-md mesh-border mesh-border-solid mesh-border-current mesh-p-1 mesh-text-xl mesh-font-semibold mesh-no-underline ${isDark ? `mesh-bg-neutral-950 mesh-text-neutral-50` : `mesh-bg-neutral-50 mesh-text-neutral-950`}`,
|
|
@@ -3342,21 +3480,21 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs6(
|
|
|
3342
3480
|
rel: "noopener noreferrer",
|
|
3343
3481
|
target: "_blank",
|
|
3344
3482
|
children: [
|
|
3345
|
-
/* @__PURE__ */
|
|
3483
|
+
/* @__PURE__ */ jsx15(MeshLogo, {}),
|
|
3346
3484
|
"Mesh"
|
|
3347
3485
|
]
|
|
3348
3486
|
}
|
|
3349
3487
|
);
|
|
3350
3488
|
|
|
3351
3489
|
// src/stake-button/index.tsx
|
|
3352
|
-
import { useEffect as
|
|
3490
|
+
import { useEffect as useEffect11, useState as useState13 } from "react";
|
|
3353
3491
|
import { Transaction } from "@meshsdk/transaction";
|
|
3354
3492
|
|
|
3355
3493
|
// src/cardano-wallet-dropdown/index.tsx
|
|
3356
|
-
import { useEffect as
|
|
3494
|
+
import { useEffect as useEffect10, useState as useState12 } from "react";
|
|
3357
3495
|
|
|
3358
3496
|
// src/common/button-dropdown.tsx
|
|
3359
|
-
import { jsx as
|
|
3497
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
3360
3498
|
function ButtonDropdown({
|
|
3361
3499
|
children,
|
|
3362
3500
|
isDarkMode = false,
|
|
@@ -3365,7 +3503,7 @@ function ButtonDropdown({
|
|
|
3365
3503
|
onMouseEnter,
|
|
3366
3504
|
onMouseLeave
|
|
3367
3505
|
}) {
|
|
3368
|
-
return /* @__PURE__ */
|
|
3506
|
+
return /* @__PURE__ */ jsx16(
|
|
3369
3507
|
"button",
|
|
3370
3508
|
{
|
|
3371
3509
|
className: `mesh-mr-menu-list mesh-flex mesh-w-60 mesh-items-center mesh-justify-center mesh-rounded-t-md mesh-border mesh-px-4 mesh-py-2 mesh-text-lg mesh-font-normal mesh-shadow-sm ${isDarkMode ? `mesh-bg-neutral-950 mesh-text-neutral-50` : `mesh-bg-neutral-50 mesh-text-neutral-950`}`,
|
|
@@ -3378,21 +3516,21 @@ function ButtonDropdown({
|
|
|
3378
3516
|
}
|
|
3379
3517
|
|
|
3380
3518
|
// src/cardano-wallet-dropdown/menu-item.tsx
|
|
3381
|
-
import { jsx as
|
|
3519
|
+
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3382
3520
|
function MenuItem({
|
|
3383
3521
|
icon,
|
|
3384
3522
|
label,
|
|
3385
3523
|
action,
|
|
3386
3524
|
active
|
|
3387
3525
|
}) {
|
|
3388
|
-
return /* @__PURE__ */
|
|
3526
|
+
return /* @__PURE__ */ jsxs11(
|
|
3389
3527
|
"div",
|
|
3390
3528
|
{
|
|
3391
3529
|
className: "mesh-flex mesh-cursor-pointer mesh-items-center mesh-px-4 mesh-py-2 mesh-opacity-80 hover:mesh-opacity-100 mesh-h-16",
|
|
3392
3530
|
onClick: action,
|
|
3393
3531
|
children: [
|
|
3394
|
-
icon && /* @__PURE__ */
|
|
3395
|
-
/* @__PURE__ */
|
|
3532
|
+
icon && /* @__PURE__ */ jsx17("img", { className: "mesh-pr-2 mesh-m-1 mesh-h-8", src: icon }),
|
|
3533
|
+
/* @__PURE__ */ jsx17("span", { className: "mesh-mr-menu-item mesh-text-xl mesh-font-normal mesh-text-gray-700 hover:mesh-text-black", children: label.split(" ").map((word) => {
|
|
3396
3534
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
3397
3535
|
}).join(" ") })
|
|
3398
3536
|
]
|
|
@@ -3401,8 +3539,8 @@ function MenuItem({
|
|
|
3401
3539
|
}
|
|
3402
3540
|
|
|
3403
3541
|
// src/cardano-wallet-dropdown/chevron-down.tsx
|
|
3404
|
-
import { jsx as
|
|
3405
|
-
var ChevronDown = () => /* @__PURE__ */
|
|
3542
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
3543
|
+
var ChevronDown = () => /* @__PURE__ */ jsx18(
|
|
3406
3544
|
"svg",
|
|
3407
3545
|
{
|
|
3408
3546
|
className: "mesh-m-2 mesh-h-6",
|
|
@@ -3411,7 +3549,7 @@ var ChevronDown = () => /* @__PURE__ */ jsx14(
|
|
|
3411
3549
|
viewBox: "0 0 24 24",
|
|
3412
3550
|
stroke: "currentColor",
|
|
3413
3551
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3414
|
-
children: /* @__PURE__ */
|
|
3552
|
+
children: /* @__PURE__ */ jsx18(
|
|
3415
3553
|
"path",
|
|
3416
3554
|
{
|
|
3417
3555
|
strokeLinecap: "round",
|
|
@@ -3424,7 +3562,7 @@ var ChevronDown = () => /* @__PURE__ */ jsx14(
|
|
|
3424
3562
|
);
|
|
3425
3563
|
|
|
3426
3564
|
// src/cardano-wallet-dropdown/wallet-balance.tsx
|
|
3427
|
-
import { Fragment as Fragment3, jsx as
|
|
3565
|
+
import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3428
3566
|
var WalletBalance = ({
|
|
3429
3567
|
connected,
|
|
3430
3568
|
connecting,
|
|
@@ -3432,22 +3570,22 @@ var WalletBalance = ({
|
|
|
3432
3570
|
wallet
|
|
3433
3571
|
}) => {
|
|
3434
3572
|
const lovelace = useLovelace();
|
|
3435
|
-
return connected && lovelace && wallet?.icon ? /* @__PURE__ */
|
|
3436
|
-
/* @__PURE__ */
|
|
3573
|
+
return connected && lovelace && wallet?.icon ? /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
3574
|
+
/* @__PURE__ */ jsx19("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }),
|
|
3437
3575
|
"\u20B3",
|
|
3438
3576
|
" ",
|
|
3439
3577
|
parseInt((parseInt(lovelace, 10) / 1e6).toString(), 10),
|
|
3440
3578
|
".",
|
|
3441
|
-
/* @__PURE__ */
|
|
3442
|
-
] }) : connected && wallet?.icon ? /* @__PURE__ */
|
|
3579
|
+
/* @__PURE__ */ jsx19("span", { className: "mesh-text-xs", children: lovelace.substring(lovelace.length - 6) })
|
|
3580
|
+
] }) : connected && wallet?.icon ? /* @__PURE__ */ jsx19(Fragment3, { children: /* @__PURE__ */ jsx19("img", { className: "mesh-m-2 mesh-h-6", src: wallet.icon }) }) : connecting ? /* @__PURE__ */ jsx19(Fragment3, { children: "Connecting..." }) : /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
3443
3581
|
label,
|
|
3444
3582
|
" ",
|
|
3445
|
-
/* @__PURE__ */
|
|
3583
|
+
/* @__PURE__ */ jsx19(ChevronDown, {})
|
|
3446
3584
|
] });
|
|
3447
3585
|
};
|
|
3448
3586
|
|
|
3449
3587
|
// src/cardano-wallet-dropdown/index.tsx
|
|
3450
|
-
import { Fragment as Fragment4, jsx as
|
|
3588
|
+
import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3451
3589
|
var CardanoWallet2 = ({
|
|
3452
3590
|
label = "Connect Wallet",
|
|
3453
3591
|
onConnected = void 0,
|
|
@@ -3456,32 +3594,32 @@ var CardanoWallet2 = ({
|
|
|
3456
3594
|
extensions = [],
|
|
3457
3595
|
cardanoPeerConnect = void 0
|
|
3458
3596
|
}) => {
|
|
3459
|
-
const [isDarkMode, setIsDarkMode] =
|
|
3460
|
-
const [hideMenuList, setHideMenuList] =
|
|
3597
|
+
const [isDarkMode, setIsDarkMode] = useState12(false);
|
|
3598
|
+
const [hideMenuList, setHideMenuList] = useState12(true);
|
|
3461
3599
|
const { connect, connecting, connected, disconnect, name } = useWallet();
|
|
3462
3600
|
const wallets = useWalletList({ metamask });
|
|
3463
|
-
|
|
3601
|
+
useEffect10(() => {
|
|
3464
3602
|
if (connected && onConnected) {
|
|
3465
3603
|
onConnected();
|
|
3466
3604
|
}
|
|
3467
3605
|
}, [connected]);
|
|
3468
|
-
|
|
3606
|
+
useEffect10(() => {
|
|
3469
3607
|
setIsDarkMode(isDark);
|
|
3470
3608
|
}, [isDark]);
|
|
3471
|
-
return /* @__PURE__ */
|
|
3609
|
+
return /* @__PURE__ */ jsxs13(
|
|
3472
3610
|
"div",
|
|
3473
3611
|
{
|
|
3474
3612
|
onMouseEnter: () => setHideMenuList(false),
|
|
3475
3613
|
onMouseLeave: () => setHideMenuList(true),
|
|
3476
3614
|
style: { width: "min-content", zIndex: 50 },
|
|
3477
3615
|
children: [
|
|
3478
|
-
/* @__PURE__ */
|
|
3616
|
+
/* @__PURE__ */ jsx20(
|
|
3479
3617
|
ButtonDropdown,
|
|
3480
3618
|
{
|
|
3481
3619
|
isDarkMode,
|
|
3482
3620
|
hideMenuList,
|
|
3483
3621
|
setHideMenuList,
|
|
3484
|
-
children: /* @__PURE__ */
|
|
3622
|
+
children: /* @__PURE__ */ jsx20(
|
|
3485
3623
|
WalletBalance,
|
|
3486
3624
|
{
|
|
3487
3625
|
connected,
|
|
@@ -3492,12 +3630,12 @@ var CardanoWallet2 = ({
|
|
|
3492
3630
|
)
|
|
3493
3631
|
}
|
|
3494
3632
|
),
|
|
3495
|
-
/* @__PURE__ */
|
|
3633
|
+
/* @__PURE__ */ jsx20(
|
|
3496
3634
|
"div",
|
|
3497
3635
|
{
|
|
3498
3636
|
className: `mesh-mr-menu-list mesh-absolute mesh-w-60 mesh-rounded-b-md mesh-border mesh-text-center mesh-shadow-sm mesh-backdrop-blur ${hideMenuList && "mesh-hidden"} ${isDarkMode ? `mesh-bg-neutral-950 mesh-text-neutral-50` : `mesh-bg-neutral-50 mesh-text-neutral-950`}`,
|
|
3499
3637
|
style: { zIndex: 50 },
|
|
3500
|
-
children: !connected && wallets.length > 0 ? /* @__PURE__ */
|
|
3638
|
+
children: !connected && wallets.length > 0 ? /* @__PURE__ */ jsx20(Fragment4, { children: wallets.map((wallet, index) => /* @__PURE__ */ jsx20(
|
|
3501
3639
|
MenuItem,
|
|
3502
3640
|
{
|
|
3503
3641
|
icon: wallet.icon,
|
|
@@ -3509,7 +3647,7 @@ var CardanoWallet2 = ({
|
|
|
3509
3647
|
active: name === wallet.id
|
|
3510
3648
|
},
|
|
3511
3649
|
index
|
|
3512
|
-
)) }) : wallets.length === 0 ? /* @__PURE__ */
|
|
3650
|
+
)) }) : wallets.length === 0 ? /* @__PURE__ */ jsx20("span", { children: "No Wallet Found" }) : /* @__PURE__ */ jsx20(Fragment4, { children: /* @__PURE__ */ jsx20(
|
|
3513
3651
|
MenuItem,
|
|
3514
3652
|
{
|
|
3515
3653
|
active: false,
|
|
@@ -3526,7 +3664,7 @@ var CardanoWallet2 = ({
|
|
|
3526
3664
|
};
|
|
3527
3665
|
|
|
3528
3666
|
// src/stake-button/index.tsx
|
|
3529
|
-
import { Fragment as Fragment5, jsx as
|
|
3667
|
+
import { Fragment as Fragment5, jsx as jsx21 } from "react/jsx-runtime";
|
|
3530
3668
|
var StakeButton = ({
|
|
3531
3669
|
label = "Stake your ADA",
|
|
3532
3670
|
isDark = false,
|
|
@@ -3534,19 +3672,19 @@ var StakeButton = ({
|
|
|
3534
3672
|
onCheck,
|
|
3535
3673
|
onDelegated = void 0
|
|
3536
3674
|
}) => {
|
|
3537
|
-
const [isDarkMode, setIsDarkMode] =
|
|
3675
|
+
const [isDarkMode, setIsDarkMode] = useState13(false);
|
|
3538
3676
|
const { connected } = useWallet();
|
|
3539
|
-
|
|
3677
|
+
useEffect11(() => {
|
|
3540
3678
|
setIsDarkMode(isDark);
|
|
3541
3679
|
}, [isDark]);
|
|
3542
|
-
return /* @__PURE__ */
|
|
3680
|
+
return /* @__PURE__ */ jsx21(Fragment5, { children: connected ? /* @__PURE__ */ jsx21(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ jsx21(
|
|
3543
3681
|
Delegate,
|
|
3544
3682
|
{
|
|
3545
3683
|
poolId,
|
|
3546
3684
|
onCheck,
|
|
3547
3685
|
onDelegated
|
|
3548
3686
|
}
|
|
3549
|
-
) }) : /* @__PURE__ */
|
|
3687
|
+
) }) : /* @__PURE__ */ jsx21(CardanoWallet2, { label, isDark }) });
|
|
3550
3688
|
};
|
|
3551
3689
|
var Delegate = ({
|
|
3552
3690
|
poolId,
|
|
@@ -3555,11 +3693,11 @@ var Delegate = ({
|
|
|
3555
3693
|
}) => {
|
|
3556
3694
|
const { wallet } = useWallet();
|
|
3557
3695
|
const rewardAddress = useRewardAddress();
|
|
3558
|
-
const [_, setError] =
|
|
3559
|
-
const [checking, setChecking] =
|
|
3560
|
-
const [accountInfo, setAccountInfo] =
|
|
3561
|
-
const [processing, setProcessing] =
|
|
3562
|
-
const [done, setDone] =
|
|
3696
|
+
const [_, setError] = useState13();
|
|
3697
|
+
const [checking, setChecking] = useState13(false);
|
|
3698
|
+
const [accountInfo, setAccountInfo] = useState13();
|
|
3699
|
+
const [processing, setProcessing] = useState13(false);
|
|
3700
|
+
const [done, setDone] = useState13(false);
|
|
3563
3701
|
const checkAccountStatus = async () => {
|
|
3564
3702
|
try {
|
|
3565
3703
|
setChecking(true);
|
|
@@ -3610,22 +3748,22 @@ var Delegate = ({
|
|
|
3610
3748
|
}
|
|
3611
3749
|
setProcessing(false);
|
|
3612
3750
|
};
|
|
3613
|
-
|
|
3751
|
+
useEffect11(() => {
|
|
3614
3752
|
checkAccountStatus();
|
|
3615
3753
|
}, [rewardAddress]);
|
|
3616
3754
|
if (checking) {
|
|
3617
|
-
return /* @__PURE__ */
|
|
3755
|
+
return /* @__PURE__ */ jsx21("span", { children: "Checking..." });
|
|
3618
3756
|
}
|
|
3619
3757
|
if (processing) {
|
|
3620
|
-
return /* @__PURE__ */
|
|
3758
|
+
return /* @__PURE__ */ jsx21("span", { children: "Loading..." });
|
|
3621
3759
|
}
|
|
3622
3760
|
if (done) {
|
|
3623
|
-
return /* @__PURE__ */
|
|
3761
|
+
return /* @__PURE__ */ jsx21("span", { children: "Stake Delegated" });
|
|
3624
3762
|
}
|
|
3625
3763
|
if (accountInfo?.active) {
|
|
3626
|
-
return accountInfo.poolId === poolId ? /* @__PURE__ */
|
|
3764
|
+
return accountInfo.poolId === poolId ? /* @__PURE__ */ jsx21("span", { children: "Stake Delegated" }) : /* @__PURE__ */ jsx21("span", { onClick: delegateStake, children: "Begin Staking" });
|
|
3627
3765
|
}
|
|
3628
|
-
return /* @__PURE__ */
|
|
3766
|
+
return /* @__PURE__ */ jsx21("span", { onClick: registerAddress, children: "Begin Staking" });
|
|
3629
3767
|
};
|
|
3630
3768
|
export {
|
|
3631
3769
|
CardanoWallet,
|