@fairmint/ui 0.2.14 → 0.2.15

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.
@@ -6,6 +6,8 @@ export interface Wallet {
6
6
  type: string;
7
7
  /** Optional display label. */
8
8
  label?: string | null;
9
+ /** Whether this is the default equity recipient wallet. */
10
+ defaultRecipient?: boolean;
9
11
  }
10
12
  export interface WalletListProps {
11
13
  /** Wallets to display. */
@@ -14,12 +16,30 @@ export interface WalletListProps {
14
16
  onAdd?: (address: string) => void | Promise<void>;
15
17
  /** Called when user confirms removal of a wallet address. */
16
18
  onRemove?: (address: string) => void | Promise<void>;
17
- /** Whether add/remove actions are disabled (e.g. admin viewing another user). */
19
+ /** Called when user sets a wallet as default recipient. */
20
+ onSetDefault?: (address: string) => void | Promise<void>;
21
+ /** Called when user saves a label for a wallet. Null clears the label. May reject — label error is displayed inline. */
22
+ onLabel?: (address: string, label: string | null) => void | Promise<void>;
23
+ /** Called when user clicks the connect wallet button (Privy linking). */
24
+ onConnect?: () => void;
25
+ /** Returns a block explorer URL for a wallet address. If omitted, explorer link is hidden. */
26
+ getExplorerUrl?: (address: string) => string;
27
+ /** Whether add/remove/edit actions are disabled (e.g. admin viewing another user). */
18
28
  readOnly?: boolean;
19
29
  /** Whether an add operation is in progress. */
20
30
  addLoading?: boolean;
21
31
  /** Whether a remove operation is in progress. */
22
32
  removeLoading?: boolean;
33
+ /** Whether a set-default operation is in progress. */
34
+ setDefaultLoading?: boolean;
35
+ /** Address of the wallet currently being set as default (for per-row loading). */
36
+ setDefaultAddress?: string;
37
+ /** Whether a label operation is in progress. */
38
+ labelLoading?: boolean;
39
+ /** Address of the wallet currently being labeled (for per-row loading). */
40
+ labelAddress?: string;
41
+ /** Whether the connect wallet operation is in progress. */
42
+ connectLoading?: boolean;
23
43
  /** Icon for the empty state. Passed as ReactNode. */
24
44
  emptyIcon?: ReactNode;
25
45
  /** Icon for the copy button. Passed as ReactNode. */
@@ -30,16 +50,26 @@ export interface WalletListProps {
30
50
  removeIcon?: ReactNode;
31
51
  /** Icon for the add button. Passed as ReactNode. */
32
52
  addIcon?: ReactNode;
53
+ /** Icon for the set-default button. Passed as ReactNode. */
54
+ defaultIcon?: ReactNode;
55
+ /** Icon for the rename button. Passed as ReactNode. */
56
+ renameIcon?: ReactNode;
57
+ /** Icon for the block explorer link. Passed as ReactNode. */
58
+ explorerIcon?: ReactNode;
59
+ /** Icon for the connect wallet button. Passed as ReactNode. */
60
+ connectIcon?: ReactNode;
33
61
  /**
34
- * Map a wallet type string to a display label.
62
+ * Override default type → label mapping.
35
63
  * @default Built-in: "fairmint"|"privy" → "Fairmint Wallet", "manual" → "Manual", else as-is
36
64
  */
37
65
  typeLabels?: Record<string, string>;
38
66
  /**
39
- * Which wallet types can be removed.
40
- * @default ["manual"]
67
+ * Which wallet types can be removed. Overrides the default system-type check.
68
+ * @default All non-system types (everything except "fairmint" and "privy")
41
69
  */
42
70
  removableTypes?: string[];
71
+ /** Additional content rendered below the wallet list (e.g. advanced wallet forms). */
72
+ children?: ReactNode;
43
73
  }
44
- export declare function WalletList({ wallets, onAdd, onRemove, readOnly, addLoading, removeLoading, emptyIcon, copyIcon, copiedIcon, removeIcon, addIcon, typeLabels, removableTypes, }: WalletListProps): import("react/jsx-runtime").JSX.Element;
74
+ export declare function WalletList({ wallets, onAdd, onRemove, onSetDefault, onLabel, onConnect, getExplorerUrl, readOnly, addLoading, removeLoading, setDefaultLoading, setDefaultAddress, labelLoading, labelAddress, connectLoading, emptyIcon, copyIcon, copiedIcon, removeIcon, addIcon, defaultIcon, renameIcon, explorerIcon, connectIcon, typeLabels, removableTypes, children, }: WalletListProps): import("react/jsx-runtime").JSX.Element;
45
75
  //# sourceMappingURL=WalletList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WalletList.d.ts","sourceRoot":"","sources":["../../../../src/components/specific/WalletList/WalletList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS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WAAW,EACX,UAAU,EACV,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,QAAQ,GACT,EAAE,eAAe,2CA8YjB"}
@@ -30706,38 +30706,84 @@ function InvestorProfileCard({
30706
30706
  children
30707
30707
  ] });
30708
30708
  }
30709
- const DEFAULT_TYPE_LABELS = {
30709
+ const SYSTEM_TYPES = /* @__PURE__ */ new Set(["fairmint", "privy"]);
30710
+ const TYPE_LABELS = {
30710
30711
  fairmint: "Fairmint Wallet",
30711
30712
  privy: "Fairmint Wallet",
30712
30713
  manual: "Manual"
30713
30714
  };
30714
- function getTypeLabel(type, custom2) {
30715
- if (custom2?.[type]) return custom2[type];
30716
- return DEFAULT_TYPE_LABELS[type] ?? type;
30715
+ function normalizeWalletType(type) {
30716
+ return String(type ?? "").trim().toLowerCase();
30717
+ }
30718
+ function getWalletLabel(type, custom2) {
30719
+ const key = normalizeWalletType(type);
30720
+ const rawType = typeof type === "string" ? type : String(type ?? "");
30721
+ if (custom2?.[key]) return custom2[key];
30722
+ if (custom2?.[rawType]) return custom2[rawType];
30723
+ return TYPE_LABELS[key] ?? rawType;
30724
+ }
30725
+ function getWalletDisplayName(wallet, customLabels) {
30726
+ const label = wallet.label?.trim();
30727
+ if (label) return label;
30728
+ return getWalletLabel(wallet.type, customLabels);
30729
+ }
30730
+ function isSystemWalletType(type) {
30731
+ return SYSTEM_TYPES.has(normalizeWalletType(type));
30732
+ }
30733
+ function isRemovableWalletType(type) {
30734
+ return !isSystemWalletType(type);
30735
+ }
30736
+ function walletKey(w) {
30737
+ return `${normalizeWalletType(w.type)}:${w.address.toLowerCase()}`;
30717
30738
  }
30718
30739
  function WalletList({
30719
30740
  wallets,
30720
30741
  onAdd,
30721
30742
  onRemove,
30743
+ onSetDefault,
30744
+ onLabel,
30745
+ onConnect,
30746
+ getExplorerUrl,
30722
30747
  readOnly = false,
30723
30748
  addLoading = false,
30724
30749
  removeLoading = false,
30750
+ setDefaultLoading = false,
30751
+ setDefaultAddress,
30752
+ labelLoading = false,
30753
+ labelAddress,
30754
+ connectLoading = false,
30725
30755
  emptyIcon,
30726
30756
  copyIcon,
30727
30757
  copiedIcon,
30728
30758
  removeIcon,
30729
30759
  addIcon,
30760
+ defaultIcon,
30761
+ renameIcon,
30762
+ explorerIcon,
30763
+ connectIcon,
30730
30764
  typeLabels,
30731
- removableTypes = ["manual"]
30765
+ removableTypes,
30766
+ children
30732
30767
  }) {
30768
+ const normalizeWalletAddress = React.useCallback(
30769
+ (address) => address?.trim().toLowerCase() ?? "",
30770
+ []
30771
+ );
30733
30772
  const [newAddress, setNewAddress] = React.useState("");
30734
30773
  const [addressError, setAddressError] = React.useState(null);
30735
30774
  const [showAddForm, setShowAddForm] = React.useState(false);
30736
30775
  const [walletToRemove, setWalletToRemove] = React.useState(null);
30737
30776
  const [copiedAddress, setCopiedAddress] = React.useState(null);
30777
+ const [renamingAddress, setRenamingAddress] = React.useState(null);
30778
+ const [renameValue, setRenameValue] = React.useState("");
30779
+ const [labelError, setLabelError] = React.useState(null);
30780
+ const [setDefaultError, setSetDefaultError] = React.useState(null);
30738
30781
  const copyTimeoutRef = React.useRef(void 0);
30739
30782
  React.useEffect(() => () => clearTimeout(copyTimeoutRef.current), []);
30740
- const copyAddress = async (address) => {
30783
+ React.useEffect(() => {
30784
+ if (readOnly) setRenamingAddress(null);
30785
+ }, [readOnly]);
30786
+ const copyAddress = React.useCallback(async (address) => {
30741
30787
  try {
30742
30788
  await navigator.clipboard.writeText(address);
30743
30789
  clearTimeout(copyTimeoutRef.current);
@@ -30745,9 +30791,27 @@ function WalletList({
30745
30791
  copyTimeoutRef.current = setTimeout(() => setCopiedAddress(null), 2e3);
30746
30792
  } catch {
30747
30793
  }
30748
- };
30794
+ }, []);
30749
30795
  const canAdd = !readOnly && !!onAdd;
30750
30796
  const canRemove = !readOnly && !!onRemove;
30797
+ const canSetDefault = !readOnly && !!onSetDefault;
30798
+ const canLabel = !readOnly && !!onLabel;
30799
+ const canConnect = !readOnly && !!onConnect;
30800
+ const getSafeExplorerUrl = React.useCallback(
30801
+ (address) => {
30802
+ if (!getExplorerUrl) return null;
30803
+ try {
30804
+ const url = getExplorerUrl(address);
30805
+ if (!url) return null;
30806
+ const parsed = new URL(url);
30807
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return null;
30808
+ return parsed.toString();
30809
+ } catch {
30810
+ return null;
30811
+ }
30812
+ },
30813
+ [getExplorerUrl]
30814
+ );
30751
30815
  const handleAdd = async () => {
30752
30816
  const trimmed = newAddress.trim();
30753
30817
  const error2 = validateEthereumAddress(trimmed);
@@ -30775,8 +30839,191 @@ function WalletList({
30775
30839
  setRemoveError("Failed to remove wallet. Please try again.");
30776
30840
  }
30777
30841
  };
30778
- if (wallets.length === 0 && !showAddForm) {
30779
- return /* @__PURE__ */ jsxRuntime.jsx(
30842
+ const handleSetDefault = async (address) => {
30843
+ setSetDefaultError(null);
30844
+ try {
30845
+ await onSetDefault?.(address);
30846
+ } catch {
30847
+ setSetDefaultError("Failed to set default wallet. Please try again.");
30848
+ }
30849
+ };
30850
+ const handleLabelSave = async (address) => {
30851
+ setLabelError(null);
30852
+ try {
30853
+ await onLabel?.(address, renameValue.trim() || null);
30854
+ setRenamingAddress((current) => current === address ? null : current);
30855
+ } catch {
30856
+ setLabelError("Failed to update label. Please try again.");
30857
+ }
30858
+ };
30859
+ const hasWallets = wallets.length > 0;
30860
+ if (!hasWallets && !showAddForm && !canConnect) {
30861
+ return /* @__PURE__ */ jsxRuntime.jsxs(Stack, { gap: "sm", children: [
30862
+ /* @__PURE__ */ jsxRuntime.jsx(
30863
+ EmptyState,
30864
+ {
30865
+ icon: emptyIcon,
30866
+ title: "No wallets connected",
30867
+ description: "Add a wallet address to receive equity on-chain.",
30868
+ actionLabel: canAdd ? "Add Wallet" : void 0,
30869
+ onAction: canAdd ? () => setShowAddForm(true) : void 0
30870
+ }
30871
+ ),
30872
+ children
30873
+ ] });
30874
+ }
30875
+ return /* @__PURE__ */ jsxRuntime.jsxs(Stack, { gap: "sm", children: [
30876
+ wallets.map((w) => {
30877
+ const normalizedWalletAddress = normalizeWalletAddress(w.address);
30878
+ const setDefaultActionLoading = setDefaultLoading && (!setDefaultAddress || normalizeWalletAddress(setDefaultAddress) === normalizedWalletAddress);
30879
+ const labelActionLoading = labelLoading && (!labelAddress || normalizeWalletAddress(labelAddress) === normalizedWalletAddress);
30880
+ const explorerUrl = getSafeExplorerUrl(w.address);
30881
+ return /* @__PURE__ */ jsxRuntime.jsxs(Stack, { gap: 0, children: [
30882
+ /* @__PURE__ */ jsxRuntime.jsxs(
30883
+ Group,
30884
+ {
30885
+ justify: "space-between",
30886
+ p: "xs",
30887
+ style: {
30888
+ borderRadius: radii.sm,
30889
+ border: `1px solid ${neutralColors[200]}`
30890
+ },
30891
+ children: [
30892
+ /* @__PURE__ */ jsxRuntime.jsxs(Group, { gap: "xs", children: [
30893
+ /* @__PURE__ */ jsxRuntime.jsx(Badge, { size: "xs", variant: "light", children: getWalletLabel(w.type, typeLabels) }),
30894
+ w.label && /* @__PURE__ */ jsxRuntime.jsx(Text, { size: "xs", c: fairmintVars.colorTextSecondary, children: w.label }),
30895
+ w.defaultRecipient && /* @__PURE__ */ jsxRuntime.jsx(Badge, { size: "xs", color: colors.success, variant: "light", children: "Default" }),
30896
+ /* @__PURE__ */ jsxRuntime.jsx(Text, { size: "sm", ff: "monospace", children: truncateAddress(w.address) })
30897
+ ] }),
30898
+ /* @__PURE__ */ jsxRuntime.jsxs(Group, { gap: 4, children: [
30899
+ copyIcon && /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { label: copiedAddress === w.address ? "Copied!" : "Copy address", children: /* @__PURE__ */ jsxRuntime.jsx(
30900
+ ActionIcon,
30901
+ {
30902
+ variant: "subtle",
30903
+ size: "sm",
30904
+ onClick: () => copyAddress(w.address),
30905
+ "aria-label": "Copy wallet address",
30906
+ children: copiedAddress === w.address ? copiedIcon ?? copyIcon : copyIcon
30907
+ }
30908
+ ) }),
30909
+ canSetDefault && defaultIcon && !w.defaultRecipient && /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { label: "Set as default recipient", children: /* @__PURE__ */ jsxRuntime.jsx(
30910
+ ActionIcon,
30911
+ {
30912
+ variant: "subtle",
30913
+ size: "sm",
30914
+ onClick: () => handleSetDefault(w.address),
30915
+ loading: setDefaultActionLoading,
30916
+ disabled: setDefaultActionLoading,
30917
+ "aria-label": "Set as default wallet",
30918
+ children: defaultIcon
30919
+ }
30920
+ ) }),
30921
+ canLabel && renameIcon && /* @__PURE__ */ jsxRuntime.jsx(
30922
+ Tooltip,
30923
+ {
30924
+ label: renamingAddress === w.address ? "Cancel rename" : "Rename wallet",
30925
+ children: /* @__PURE__ */ jsxRuntime.jsx(
30926
+ ActionIcon,
30927
+ {
30928
+ variant: "subtle",
30929
+ size: "sm",
30930
+ onClick: () => {
30931
+ setLabelError(null);
30932
+ if (renamingAddress === w.address) {
30933
+ setRenamingAddress(null);
30934
+ } else {
30935
+ setRenamingAddress(w.address);
30936
+ setRenameValue(w.label ?? "");
30937
+ }
30938
+ },
30939
+ "aria-label": "Rename wallet",
30940
+ children: renameIcon
30941
+ }
30942
+ )
30943
+ }
30944
+ ),
30945
+ explorerUrl && explorerIcon && /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { label: "View on block explorer", children: /* @__PURE__ */ jsxRuntime.jsx(
30946
+ Anchor,
30947
+ {
30948
+ href: explorerUrl,
30949
+ target: "_blank",
30950
+ rel: "noopener noreferrer",
30951
+ "aria-label": "View on block explorer",
30952
+ c: colors.primary,
30953
+ style: {
30954
+ display: "inline-flex",
30955
+ alignItems: "center",
30956
+ justifyContent: "center",
30957
+ width: "1.625rem",
30958
+ height: "1.625rem",
30959
+ borderRadius: radii.sm
30960
+ },
30961
+ children: explorerIcon
30962
+ }
30963
+ ) }),
30964
+ canRemove && removeIcon && (removableTypes ? removableTypes.some(
30965
+ (t) => normalizeWalletType(t) === normalizeWalletType(w.type)
30966
+ ) : isRemovableWalletType(w.type)) && /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { label: "Remove wallet", children: /* @__PURE__ */ jsxRuntime.jsx(
30967
+ ActionIcon,
30968
+ {
30969
+ variant: "subtle",
30970
+ size: "sm",
30971
+ color: colors.error,
30972
+ onClick: () => setWalletToRemove(w.address),
30973
+ disabled: removeLoading,
30974
+ "aria-label": "Remove wallet",
30975
+ children: removeIcon
30976
+ }
30977
+ ) })
30978
+ ] })
30979
+ ]
30980
+ }
30981
+ ),
30982
+ renamingAddress === w.address && /* @__PURE__ */ jsxRuntime.jsxs(Group, { gap: "xs", mt: "xs", align: "flex-start", children: [
30983
+ /* @__PURE__ */ jsxRuntime.jsx(
30984
+ TextInput,
30985
+ {
30986
+ value: renameValue,
30987
+ onChange: (e) => {
30988
+ setRenameValue(e.currentTarget.value);
30989
+ setLabelError(null);
30990
+ },
30991
+ placeholder: getWalletLabel(w.type, typeLabels),
30992
+ size: "xs",
30993
+ style: { flex: 1 },
30994
+ "aria-label": "Wallet label",
30995
+ maxLength: 50,
30996
+ error: labelError
30997
+ }
30998
+ ),
30999
+ /* @__PURE__ */ jsxRuntime.jsx(
31000
+ Button,
31001
+ {
31002
+ size: "xs",
31003
+ loading: labelActionLoading,
31004
+ disabled: labelActionLoading,
31005
+ onClick: () => handleLabelSave(w.address),
31006
+ children: "Save"
31007
+ }
31008
+ ),
31009
+ /* @__PURE__ */ jsxRuntime.jsx(
31010
+ Button,
31011
+ {
31012
+ size: "xs",
31013
+ variant: "subtle",
31014
+ color: colors.neutral,
31015
+ onClick: () => {
31016
+ setRenamingAddress(null);
31017
+ setLabelError(null);
31018
+ },
31019
+ children: "Cancel"
31020
+ }
31021
+ )
31022
+ ] })
31023
+ ] }, walletKey(w));
31024
+ }),
31025
+ setDefaultError && /* @__PURE__ */ jsxRuntime.jsx(Text, { size: "sm", c: colors.error, children: setDefaultError }),
31026
+ !hasWallets && !showAddForm && /* @__PURE__ */ jsxRuntime.jsx(
30780
31027
  EmptyState,
30781
31028
  {
30782
31029
  icon: emptyIcon,
@@ -30785,52 +31032,19 @@ function WalletList({
30785
31032
  actionLabel: canAdd ? "Add Wallet" : void 0,
30786
31033
  onAction: canAdd ? () => setShowAddForm(true) : void 0
30787
31034
  }
30788
- );
30789
- }
30790
- return /* @__PURE__ */ jsxRuntime.jsxs(Stack, { gap: "sm", children: [
30791
- wallets.map((w) => /* @__PURE__ */ jsxRuntime.jsxs(
30792
- Group,
31035
+ ),
31036
+ canConnect && /* @__PURE__ */ jsxRuntime.jsx(
31037
+ Button,
30793
31038
  {
30794
- justify: "space-between",
30795
- p: "xs",
30796
- style: {
30797
- borderRadius: radii.sm,
30798
- border: `1px solid ${neutralColors[200]}`
30799
- },
30800
- children: [
30801
- /* @__PURE__ */ jsxRuntime.jsxs(Group, { gap: "xs", children: [
30802
- /* @__PURE__ */ jsxRuntime.jsx(Badge, { size: "xs", variant: "light", children: getTypeLabel(w.type, typeLabels) }),
30803
- w.label && /* @__PURE__ */ jsxRuntime.jsx(Text, { size: "xs", c: fairmintVars.colorTextSecondary, children: w.label }),
30804
- /* @__PURE__ */ jsxRuntime.jsx(Text, { size: "sm", ff: "monospace", children: truncateAddress(w.address) })
30805
- ] }),
30806
- /* @__PURE__ */ jsxRuntime.jsxs(Group, { gap: 4, children: [
30807
- copyIcon && /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { label: copiedAddress === w.address ? "Copied!" : "Copy address", children: /* @__PURE__ */ jsxRuntime.jsx(
30808
- ActionIcon,
30809
- {
30810
- variant: "subtle",
30811
- size: "sm",
30812
- onClick: () => copyAddress(w.address),
30813
- "aria-label": "Copy wallet address",
30814
- children: copiedAddress === w.address ? copiedIcon ?? copyIcon : copyIcon
30815
- }
30816
- ) }),
30817
- canRemove && removeIcon && removableTypes.includes(w.type) && /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { label: "Remove wallet", children: /* @__PURE__ */ jsxRuntime.jsx(
30818
- ActionIcon,
30819
- {
30820
- variant: "subtle",
30821
- size: "sm",
30822
- color: colors.error,
30823
- onClick: () => setWalletToRemove(w.address),
30824
- disabled: removeLoading,
30825
- "aria-label": "Remove wallet",
30826
- children: removeIcon
30827
- }
30828
- ) })
30829
- ] })
30830
- ]
30831
- },
30832
- w.address
30833
- )),
31039
+ variant: "light",
31040
+ size: "xs",
31041
+ leftSection: connectIcon,
31042
+ onClick: onConnect,
31043
+ loading: connectLoading,
31044
+ mt: "xs",
31045
+ children: "Connect Wallet"
31046
+ }
31047
+ ),
30834
31048
  canAdd && (showAddForm ? /* @__PURE__ */ jsxRuntime.jsxs(Group, { gap: "xs", mt: "xs", children: [
30835
31049
  /* @__PURE__ */ jsxRuntime.jsx(
30836
31050
  TextInput,
@@ -30861,7 +31075,7 @@ function WalletList({
30861
31075
  children: "Cancel"
30862
31076
  }
30863
31077
  )
30864
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(
31078
+ ] }) : hasWallets ? /* @__PURE__ */ jsxRuntime.jsx(
30865
31079
  Button,
30866
31080
  {
30867
31081
  variant: "light",
@@ -30871,7 +31085,8 @@ function WalletList({
30871
31085
  mt: "xs",
30872
31086
  children: "Add Wallet"
30873
31087
  }
30874
- )),
31088
+ ) : null),
31089
+ children,
30875
31090
  /* @__PURE__ */ jsxRuntime.jsx(
30876
31091
  ConfirmDialog,
30877
31092
  {
@@ -31030,9 +31245,14 @@ exports.formatPhone = formatPhone;
31030
31245
  exports.formatPhoneDisplay = formatPhoneDisplay;
31031
31246
  exports.formatPreciseWithCurrency = formatPreciseWithCurrency;
31032
31247
  exports.getAvatarColor = getAvatarColor;
31248
+ exports.getWalletDisplayName = getWalletDisplayName;
31249
+ exports.getWalletLabel = getWalletLabel;
31033
31250
  exports.isEthereumAddress = isEthereumAddress;
31251
+ exports.isRemovableWalletType = isRemovableWalletType;
31252
+ exports.isSystemWalletType = isSystemWalletType;
31034
31253
  exports.neutralColors = neutralColors;
31035
31254
  exports.normalizePhone = normalizePhone;
31255
+ exports.normalizeWalletType = normalizeWalletType;
31036
31256
  exports.notify = notify;
31037
31257
  exports.passwordSchema = passwordSchema;
31038
31258
  exports.phoneSchema = phoneSchema;
@@ -31055,6 +31275,7 @@ exports.useMediaQuery = useMediaQuery;
31055
31275
  exports.useScrollIntoView = useScrollIntoView;
31056
31276
  exports.useViewportSize = useViewportSize;
31057
31277
  exports.validateEthereumAddress = validateEthereumAddress;
31278
+ exports.walletKey = walletKey;
31058
31279
  exports.z = z;
31059
31280
  exports.zipSchema = zipSchema;
31060
31281
  //# sourceMappingURL=fairmint-ui.cjs.map