@meshsdk/react 1.8.12 → 1.8.13

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 CHANGED
@@ -23457,7 +23457,7 @@ __export(index_exports, {
23457
23457
  module.exports = __toCommonJS(index_exports);
23458
23458
 
23459
23459
  // src/cardano-wallet/index.tsx
23460
- var import_react14 = require("react");
23460
+ var import_react13 = require("react");
23461
23461
 
23462
23462
  // src/common/button.tsx
23463
23463
  var React = __toESM(require("react"), 1);
@@ -23474,7 +23474,7 @@ function cn(...inputs) {
23474
23474
  // src/common/button.tsx
23475
23475
  var import_jsx_runtime = require("react/jsx-runtime");
23476
23476
  var buttonVariants = (0, import_class_variance_authority.cva)(
23477
- "mesh-inline-flex mesh-items-center mesh-justify-center mesh-whitespace-nowrap mesh-rounded-md mesh-text-sm mesh-font-medium mesh-transition-colors focus-visible:mesh-outline-none focus-visible:mesh-ring-1 focus-visible:mesh-ring-zinc-950 disabled:mesh-pointer-events-none disabled:mesh-opacity-50 dark:focus-visible:mesh-ring-zinc-300",
23477
+ "mesh-inline-flex mesh-items-center mesh-justify-center mesh-whitespace-nowrap mesh-rounded-md mesh-text-sm mesh-font-medium mesh-transition-colors focus-visible:mesh-outline-none focus-visible:mesh-ring-1 focus-visible:mesh-ring-zinc-950 disabled:mesh-pointer-events-none disabled:mesh-opacity-50 dark:focus-visible:mesh-ring-zinc-300 dark:mesh-text-white",
23478
23478
  {
23479
23479
  variants: {
23480
23480
  variant: {
@@ -23642,13 +23642,16 @@ var INITIAL_STATE = {
23642
23642
  walletName: void 0,
23643
23643
  walletInstance: {}
23644
23644
  };
23645
+ var localstoragePersist = "mesh-persist";
23645
23646
  var useWalletStore = () => {
23646
23647
  const [error, setError] = (0, import_react.useState)(void 0);
23647
23648
  const [connectingWallet, setConnectingWallet] = (0, import_react.useState)(false);
23649
+ const [persistSession, setPersistSession] = (0, import_react.useState)(false);
23650
+ const [address, setAddress] = (0, import_react.useState)("");
23648
23651
  const [connectedWalletInstance, setConnectedWalletInstance] = (0, import_react.useState)(INITIAL_STATE.walletInstance);
23649
23652
  const [connectedWalletName, setConnectedWalletName] = (0, import_react.useState)(INITIAL_STATE.walletName);
23650
23653
  const connectWallet = (0, import_react.useCallback)(
23651
- async (walletName, extensions) => {
23654
+ async (walletName, extensions, persist) => {
23652
23655
  setConnectingWallet(true);
23653
23656
  try {
23654
23657
  const walletInstance = await import_wallet.BrowserWallet.enable(
@@ -23658,6 +23661,12 @@ var useWalletStore = () => {
23658
23661
  setConnectedWalletInstance(walletInstance);
23659
23662
  setConnectedWalletName(walletName);
23660
23663
  setError(void 0);
23664
+ if (persist) {
23665
+ localStorage.setItem(
23666
+ localstoragePersist,
23667
+ JSON.stringify({ walletName })
23668
+ );
23669
+ }
23661
23670
  } catch (error2) {
23662
23671
  setError(error2);
23663
23672
  }
@@ -23668,6 +23677,7 @@ var useWalletStore = () => {
23668
23677
  const disconnect = (0, import_react.useCallback)(() => {
23669
23678
  setConnectedWalletName(INITIAL_STATE.walletName);
23670
23679
  setConnectedWalletInstance(INITIAL_STATE.walletInstance);
23680
+ localStorage.removeItem(localstoragePersist);
23671
23681
  }, []);
23672
23682
  const setWallet = (0, import_react.useCallback)(
23673
23683
  async (walletInstance, walletName) => {
@@ -23676,6 +23686,29 @@ var useWalletStore = () => {
23676
23686
  },
23677
23687
  []
23678
23688
  );
23689
+ const setPersist = (0, import_react.useCallback)((persist) => {
23690
+ setPersistSession(persist);
23691
+ }, []);
23692
+ (0, import_react.useEffect)(() => {
23693
+ async function load() {
23694
+ if (Object.keys(connectedWalletInstance).length > 0 && address.length === 0) {
23695
+ let address2 = (await connectedWalletInstance.getUnusedAddresses())[0];
23696
+ if (!address2)
23697
+ address2 = await connectedWalletInstance.getChangeAddress();
23698
+ setAddress(address2);
23699
+ }
23700
+ }
23701
+ load();
23702
+ }, [connectedWalletInstance]);
23703
+ (0, import_react.useEffect)(() => {
23704
+ const persist = localStorage.getItem(localstoragePersist);
23705
+ if (persistSession && persist) {
23706
+ const persist2 = JSON.parse(
23707
+ localStorage.getItem(localstoragePersist) || ""
23708
+ );
23709
+ connectWallet(persist2.walletName);
23710
+ }
23711
+ }, [persistSession]);
23679
23712
  return {
23680
23713
  hasConnectedWallet: INITIAL_STATE.walletName !== connectedWalletName,
23681
23714
  connectedWalletInstance,
@@ -23684,7 +23717,9 @@ var useWalletStore = () => {
23684
23717
  connectWallet,
23685
23718
  disconnect,
23686
23719
  setWallet,
23687
- error
23720
+ setPersist,
23721
+ error,
23722
+ address
23688
23723
  };
23689
23724
  };
23690
23725
  var WalletContext = (0, import_react.createContext)({
@@ -23697,7 +23732,10 @@ var WalletContext = (0, import_react.createContext)({
23697
23732
  disconnect: () => {
23698
23733
  },
23699
23734
  setWallet: async () => {
23700
- }
23735
+ },
23736
+ setPersist: () => {
23737
+ },
23738
+ address: ""
23701
23739
  });
23702
23740
 
23703
23741
  // src/contexts/index.tsx
@@ -23816,7 +23854,9 @@ var useWallet = () => {
23816
23854
  connectWallet,
23817
23855
  disconnect,
23818
23856
  setWallet,
23819
- error
23857
+ setPersist,
23858
+ error,
23859
+ address
23820
23860
  } = (0, import_react8.useContext)(WalletContext);
23821
23861
  if (connectWallet === void 0 || disconnect === void 0) {
23822
23862
  throw new Error(
@@ -23831,7 +23871,9 @@ var useWallet = () => {
23831
23871
  connect: connectWallet,
23832
23872
  disconnect,
23833
23873
  setWallet,
23834
- error
23874
+ setPersist,
23875
+ error,
23876
+ address
23835
23877
  };
23836
23878
  };
23837
23879
 
@@ -23866,9 +23908,6 @@ var useWalletSubmit = () => {
23866
23908
  };
23867
23909
  };
23868
23910
 
23869
- // src/cardano-wallet/connected-button.tsx
23870
- var import_react10 = require("react");
23871
-
23872
23911
  // src/common/dropdown-menu.tsx
23873
23912
  var React3 = __toESM(require("react"), 1);
23874
23913
  var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
@@ -24004,20 +24043,9 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
24004
24043
  // src/cardano-wallet/connected-button.tsx
24005
24044
  var import_jsx_runtime6 = require("react/jsx-runtime");
24006
24045
  function ConnectedButton() {
24007
- const { wallet, connected, disconnect } = useWallet();
24008
- const [address, setAddress] = (0, import_react10.useState)("");
24009
- (0, import_react10.useEffect)(() => {
24010
- if (connected && wallet) {
24011
- async function afterConnectedWallet() {
24012
- let address2 = (await wallet.getUnusedAddresses())[0];
24013
- if (!address2) address2 = await wallet.getChangeAddress();
24014
- setAddress(address2);
24015
- }
24016
- afterConnectedWallet();
24017
- }
24018
- }, [connected, wallet]);
24046
+ const { wallet, connected, disconnect, address } = useWallet();
24019
24047
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(DropdownMenu, { children: [
24020
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Button, { variant: "outline", className: "mesh-text-white", children: [
24048
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Button, { variant: "outline", children: [
24021
24049
  address.slice(0, 6),
24022
24050
  "...",
24023
24051
  address.slice(-6)
@@ -24065,7 +24093,7 @@ var screens = {
24065
24093
  };
24066
24094
 
24067
24095
  // src/cardano-wallet/screen-burner.tsx
24068
- var import_react11 = require("react");
24096
+ var import_react10 = require("react");
24069
24097
  var import_wallet3 = require("@meshsdk/wallet");
24070
24098
  var import_jsx_runtime7 = require("react/jsx-runtime");
24071
24099
  var localstoragekey = "mesh-burnerwallet";
@@ -24074,13 +24102,13 @@ function ScreenBurner({
24074
24102
  provider,
24075
24103
  setOpen
24076
24104
  }) {
24077
- const [loading, setLoading] = (0, import_react11.useState)(false);
24078
- const [hasKeyInStorage, setHasKeyInStorage] = (0, import_react11.useState)(false);
24105
+ const [loading, setLoading] = (0, import_react10.useState)(false);
24106
+ const [hasKeyInStorage, setHasKeyInStorage] = (0, import_react10.useState)(false);
24079
24107
  const { setWallet } = useWallet();
24080
24108
  function getKeyFromStorage() {
24081
24109
  return localStorage.getItem(localstoragekey);
24082
24110
  }
24083
- (0, import_react11.useEffect)(() => {
24111
+ (0, import_react10.useEffect)(() => {
24084
24112
  const key = getKeyFromStorage();
24085
24113
  if (key) {
24086
24114
  setHasKeyInStorage(true);
@@ -24120,7 +24148,6 @@ function ScreenBurner({
24120
24148
  Button,
24121
24149
  {
24122
24150
  variant: "outline",
24123
- className: "mesh-text-white",
24124
24151
  onClick: () => {
24125
24152
  handleRestoreWallet();
24126
24153
  },
@@ -24132,7 +24159,6 @@ function ScreenBurner({
24132
24159
  Button,
24133
24160
  {
24134
24161
  variant: "outline",
24135
- className: "mesh-text-white",
24136
24162
  onClick: () => {
24137
24163
  handleCreateWallet();
24138
24164
  },
@@ -24333,6 +24359,7 @@ function ScreenMain({
24333
24359
  extensions,
24334
24360
  setOpen,
24335
24361
  setScreen,
24362
+ persist,
24336
24363
  cardanoPeerConnect,
24337
24364
  burnerWallet,
24338
24365
  webauthn
@@ -24346,7 +24373,7 @@ function ScreenMain({
24346
24373
  icon: wallet.icon,
24347
24374
  name: wallet.name,
24348
24375
  action: () => {
24349
- connect2(wallet.id, extensions);
24376
+ connect2(wallet.id, extensions, persist);
24350
24377
  setOpen(false);
24351
24378
  }
24352
24379
  },
@@ -24399,19 +24426,19 @@ function ScreenMain({
24399
24426
  }
24400
24427
 
24401
24428
  // src/cardano-wallet/screen-p2p.tsx
24402
- var import_react12 = require("react");
24429
+ var import_react11 = require("react");
24403
24430
  var import_cardano_peer_connect = __toESM(require_dist(), 1);
24404
24431
  var import_jsx_runtime15 = require("react/jsx-runtime");
24405
24432
  function ScreenP2P({
24406
24433
  cardanoPeerConnect,
24407
24434
  setOpen
24408
24435
  }) {
24409
- const dAppConnect = (0, import_react12.useRef)(null);
24410
- const qrCodeField = (0, import_react12.useRef)(null);
24411
- const [address, setAddress] = (0, import_react12.useState)("");
24412
- const [copied, setCopied] = (0, import_react12.useState)(false);
24436
+ const dAppConnect = (0, import_react11.useRef)(null);
24437
+ const qrCodeField = (0, import_react11.useRef)(null);
24438
+ const [address, setAddress] = (0, import_react11.useState)("");
24439
+ const [copied, setCopied] = (0, import_react11.useState)(false);
24413
24440
  const { connect: connect2 } = useWallet();
24414
- (0, import_react12.useEffect)(() => {
24441
+ (0, import_react11.useEffect)(() => {
24415
24442
  if (cardanoPeerConnect) {
24416
24443
  if (dAppConnect.current === null) {
24417
24444
  dAppConnect.current = new import_cardano_peer_connect.DAppPeerConnect({
@@ -24451,7 +24478,6 @@ function ScreenP2P({
24451
24478
  Button,
24452
24479
  {
24453
24480
  variant: "outline",
24454
- className: "mesh-text-white",
24455
24481
  onClick: () => {
24456
24482
  navigator.clipboard.writeText(address);
24457
24483
  setCopied(true);
@@ -24463,7 +24489,7 @@ function ScreenP2P({
24463
24489
  }
24464
24490
 
24465
24491
  // src/cardano-wallet/screen-webauthn.tsx
24466
- var import_react13 = require("react");
24492
+ var import_react12 = require("react");
24467
24493
  var import_wallet4 = require("@meshsdk/wallet");
24468
24494
 
24469
24495
  // src/common/input.tsx
@@ -24513,9 +24539,9 @@ function ScreenWebauthn({
24513
24539
  provider,
24514
24540
  setOpen
24515
24541
  }) {
24516
- const [loading, setLoading] = (0, import_react13.useState)(false);
24517
- const [userName, setUserName] = (0, import_react13.useState)("");
24518
- const [password, setPassword] = (0, import_react13.useState)("");
24542
+ const [loading, setLoading] = (0, import_react12.useState)(false);
24543
+ const [userName, setUserName] = (0, import_react12.useState)("");
24544
+ const [password, setPassword] = (0, import_react12.useState)("");
24519
24545
  const { setWallet } = useWallet();
24520
24546
  function createWallet(root) {
24521
24547
  setTimeout(() => {
@@ -24587,26 +24613,30 @@ var CardanoWallet = ({
24587
24613
  label = "Connect Wallet",
24588
24614
  onConnected = void 0,
24589
24615
  isDark = false,
24616
+ persist = false,
24590
24617
  extensions = [],
24591
24618
  injectFn = void 0,
24592
24619
  cardanoPeerConnect = void 0,
24593
24620
  burnerWallet = void 0,
24594
24621
  webauthn = void 0
24595
24622
  }) => {
24596
- const [open, setOpen] = (0, import_react14.useState)(false);
24597
- const [screen, setScreen] = (0, import_react14.useState)("main");
24598
- const { wallet, connected } = useWallet();
24599
- (0, import_react14.useEffect)(() => {
24623
+ const [open, setOpen] = (0, import_react13.useState)(false);
24624
+ const [screen, setScreen] = (0, import_react13.useState)("main");
24625
+ const { wallet, connected, setPersist } = useWallet();
24626
+ (0, import_react13.useEffect)(() => {
24627
+ setPersist(persist);
24628
+ }, [persist]);
24629
+ (0, import_react13.useEffect)(() => {
24600
24630
  if (connected) {
24601
24631
  if (onConnected) onConnected();
24602
24632
  }
24603
24633
  }, [connected, wallet]);
24604
24634
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
24605
- !connected ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DialogTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { variant: "outline", className: "mesh-text-white", children: label }) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ConnectedButton, {}),
24635
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: isDark ? "mesh-dark" : "", children: !connected ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DialogTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { variant: "outline", children: label }) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ConnectedButton, {}) }),
24606
24636
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
24607
24637
  DialogContent,
24608
24638
  {
24609
- className: "sm:mesh-max-w-[425px]",
24639
+ className: "sm:mesh-max-w-[425px] mesh-dark",
24610
24640
  onOpenAutoFocus: (event) => event.preventDefault(),
24611
24641
  children: [
24612
24642
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Header, { screen, setScreen }),
@@ -24617,6 +24647,7 @@ var CardanoWallet = ({
24617
24647
  extensions,
24618
24648
  setOpen,
24619
24649
  setScreen,
24650
+ persist,
24620
24651
  cardanoPeerConnect: cardanoPeerConnect != void 0,
24621
24652
  burnerWallet: burnerWallet != void 0,
24622
24653
  webauthn: webauthn != void 0
@@ -24725,11 +24756,11 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ (0, import_jsx_runtime21
24725
24756
  );
24726
24757
 
24727
24758
  // src/stake-button/index.tsx
24728
- var import_react16 = require("react");
24759
+ var import_react15 = require("react");
24729
24760
  var import_transaction = require("@meshsdk/transaction");
24730
24761
 
24731
24762
  // src/cardano-wallet-dropdown/index.tsx
24732
- var import_react15 = require("react");
24763
+ var import_react14 = require("react");
24733
24764
 
24734
24765
  // src/common/button-dropdown.tsx
24735
24766
  var import_jsx_runtime22 = require("react/jsx-runtime");
@@ -24831,16 +24862,16 @@ var CardanoWallet2 = ({
24831
24862
  extensions = [],
24832
24863
  cardanoPeerConnect = void 0
24833
24864
  }) => {
24834
- const [isDarkMode, setIsDarkMode] = (0, import_react15.useState)(false);
24835
- const [hideMenuList, setHideMenuList] = (0, import_react15.useState)(true);
24865
+ const [isDarkMode, setIsDarkMode] = (0, import_react14.useState)(false);
24866
+ const [hideMenuList, setHideMenuList] = (0, import_react14.useState)(true);
24836
24867
  const { connect: connect2, connecting, connected, disconnect, name } = useWallet();
24837
24868
  const wallets = useWalletList();
24838
- (0, import_react15.useEffect)(() => {
24869
+ (0, import_react14.useEffect)(() => {
24839
24870
  if (connected && onConnected) {
24840
24871
  onConnected();
24841
24872
  }
24842
24873
  }, [connected]);
24843
- (0, import_react15.useEffect)(() => {
24874
+ (0, import_react14.useEffect)(() => {
24844
24875
  setIsDarkMode(isDark);
24845
24876
  }, [isDark]);
24846
24877
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
@@ -24909,9 +24940,9 @@ var StakeButton = ({
24909
24940
  onCheck,
24910
24941
  onDelegated = void 0
24911
24942
  }) => {
24912
- const [isDarkMode, setIsDarkMode] = (0, import_react16.useState)(false);
24943
+ const [isDarkMode, setIsDarkMode] = (0, import_react15.useState)(false);
24913
24944
  const { connected } = useWallet();
24914
- (0, import_react16.useEffect)(() => {
24945
+ (0, import_react15.useEffect)(() => {
24915
24946
  setIsDarkMode(isDark);
24916
24947
  }, [isDark]);
24917
24948
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: connected ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ButtonDropdown, { isDarkMode, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
@@ -24930,11 +24961,11 @@ var Delegate = ({
24930
24961
  }) => {
24931
24962
  const { wallet } = useWallet();
24932
24963
  const rewardAddress = useRewardAddress();
24933
- const [_, setError] = (0, import_react16.useState)();
24934
- const [checking, setChecking] = (0, import_react16.useState)(false);
24935
- const [accountInfo, setAccountInfo] = (0, import_react16.useState)();
24936
- const [processing, setProcessing] = (0, import_react16.useState)(false);
24937
- const [done, setDone] = (0, import_react16.useState)(false);
24964
+ const [_, setError] = (0, import_react15.useState)();
24965
+ const [checking, setChecking] = (0, import_react15.useState)(false);
24966
+ const [accountInfo, setAccountInfo] = (0, import_react15.useState)();
24967
+ const [processing, setProcessing] = (0, import_react15.useState)(false);
24968
+ const [done, setDone] = (0, import_react15.useState)(false);
24938
24969
  const checkAccountStatus = async () => {
24939
24970
  try {
24940
24971
  setChecking(true);
@@ -24985,7 +25016,7 @@ var Delegate = ({
24985
25016
  }
24986
25017
  setProcessing(false);
24987
25018
  };
24988
- (0, import_react16.useEffect)(() => {
25019
+ (0, import_react15.useEffect)(() => {
24989
25020
  checkAccountStatus();
24990
25021
  }, [rewardAddress]);
24991
25022
  if (checking) {
package/dist/index.css CHANGED
@@ -1379,109 +1379,112 @@ video {
1379
1379
  --tw-enter-translate-y: -48%;
1380
1380
  }
1381
1381
 
1382
- @media (min-width: 640px) {
1383
- .sm\:mesh-max-w-\[425px\] {
1384
- max-width: 425px;
1385
- }
1382
+ .dark\:mesh-border-zinc-800:is(.mesh-dark *) {
1383
+ --tw-border-opacity: 1;
1384
+ border-color: rgb(39 39 42 / var(--tw-border-opacity, 1));
1385
+ }
1386
1386
 
1387
- .sm\:mesh-flex-row {
1388
- flex-direction: row;
1389
- }
1387
+ .dark\:mesh-bg-red-900:is(.mesh-dark *) {
1388
+ --tw-bg-opacity: 1;
1389
+ background-color: rgb(127 29 29 / var(--tw-bg-opacity, 1));
1390
+ }
1390
1391
 
1391
- .sm\:mesh-justify-end {
1392
- justify-content: flex-end;
1393
- }
1392
+ .dark\:mesh-bg-zinc-50:is(.mesh-dark *) {
1393
+ --tw-bg-opacity: 1;
1394
+ background-color: rgb(250 250 250 / var(--tw-bg-opacity, 1));
1395
+ }
1394
1396
 
1395
- .sm\:mesh-space-x-2 > :not([hidden]) ~ :not([hidden]) {
1396
- --tw-space-x-reverse: 0;
1397
- margin-right: calc(0.5rem * var(--tw-space-x-reverse));
1398
- margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
1399
- }
1397
+ .dark\:mesh-bg-zinc-800:is(.mesh-dark *) {
1398
+ --tw-bg-opacity: 1;
1399
+ background-color: rgb(39 39 42 / var(--tw-bg-opacity, 1));
1400
+ }
1400
1401
 
1401
- .sm\:mesh-rounded-lg {
1402
- border-radius: 0.5rem;
1403
- }
1402
+ .dark\:mesh-bg-zinc-950:is(.mesh-dark *) {
1403
+ --tw-bg-opacity: 1;
1404
+ background-color: rgb(9 9 11 / var(--tw-bg-opacity, 1));
1405
+ }
1404
1406
 
1405
- .sm\:mesh-text-left {
1406
- text-align: left;
1407
- }
1407
+ .dark\:mesh-text-white:is(.mesh-dark *) {
1408
+ --tw-text-opacity: 1;
1409
+ color: rgb(255 255 255 / var(--tw-text-opacity, 1));
1408
1410
  }
1409
1411
 
1410
- @media (prefers-color-scheme: dark) {
1411
- .dark\:mesh-border-zinc-800 {
1412
- --tw-border-opacity: 1;
1413
- border-color: rgb(39 39 42 / var(--tw-border-opacity, 1));
1414
- }
1412
+ .dark\:mesh-text-zinc-50:is(.mesh-dark *) {
1413
+ --tw-text-opacity: 1;
1414
+ color: rgb(250 250 250 / var(--tw-text-opacity, 1));
1415
+ }
1415
1416
 
1416
- .dark\:mesh-bg-red-900 {
1417
- --tw-bg-opacity: 1;
1418
- background-color: rgb(127 29 29 / var(--tw-bg-opacity, 1));
1419
- }
1417
+ .dark\:mesh-text-zinc-900:is(.mesh-dark *) {
1418
+ --tw-text-opacity: 1;
1419
+ color: rgb(24 24 27 / var(--tw-text-opacity, 1));
1420
+ }
1420
1421
 
1421
- .dark\:mesh-bg-zinc-50 {
1422
- --tw-bg-opacity: 1;
1423
- background-color: rgb(250 250 250 / var(--tw-bg-opacity, 1));
1424
- }
1422
+ .dark\:hover\:mesh-bg-red-900\/90:hover:is(.mesh-dark *) {
1423
+ background-color: rgb(127 29 29 / 0.9);
1424
+ }
1425
1425
 
1426
- .dark\:mesh-bg-zinc-800 {
1427
- --tw-bg-opacity: 1;
1428
- background-color: rgb(39 39 42 / var(--tw-bg-opacity, 1));
1429
- }
1426
+ .dark\:hover\:mesh-bg-zinc-50\/90:hover:is(.mesh-dark *) {
1427
+ background-color: rgb(250 250 250 / 0.9);
1428
+ }
1430
1429
 
1431
- .dark\:mesh-bg-zinc-950 {
1432
- --tw-bg-opacity: 1;
1433
- background-color: rgb(9 9 11 / var(--tw-bg-opacity, 1));
1434
- }
1430
+ .dark\:hover\:mesh-bg-zinc-800:hover:is(.mesh-dark *) {
1431
+ --tw-bg-opacity: 1;
1432
+ background-color: rgb(39 39 42 / var(--tw-bg-opacity, 1));
1433
+ }
1435
1434
 
1436
- .dark\:mesh-text-zinc-50 {
1437
- --tw-text-opacity: 1;
1438
- color: rgb(250 250 250 / var(--tw-text-opacity, 1));
1439
- }
1435
+ .dark\:hover\:mesh-bg-zinc-800\/80:hover:is(.mesh-dark *) {
1436
+ background-color: rgb(39 39 42 / 0.8);
1437
+ }
1440
1438
 
1441
- .dark\:mesh-text-zinc-900 {
1442
- --tw-text-opacity: 1;
1443
- color: rgb(24 24 27 / var(--tw-text-opacity, 1));
1444
- }
1439
+ .dark\:hover\:mesh-text-zinc-50:hover:is(.mesh-dark *) {
1440
+ --tw-text-opacity: 1;
1441
+ color: rgb(250 250 250 / var(--tw-text-opacity, 1));
1442
+ }
1445
1443
 
1446
- .dark\:hover\:mesh-bg-red-900\/90:hover {
1447
- background-color: rgb(127 29 29 / 0.9);
1448
- }
1444
+ .dark\:focus\:mesh-bg-zinc-800:focus:is(.mesh-dark *) {
1445
+ --tw-bg-opacity: 1;
1446
+ background-color: rgb(39 39 42 / var(--tw-bg-opacity, 1));
1447
+ }
1449
1448
 
1450
- .dark\:hover\:mesh-bg-zinc-50\/90:hover {
1451
- background-color: rgb(250 250 250 / 0.9);
1452
- }
1449
+ .dark\:focus\:mesh-text-zinc-50:focus:is(.mesh-dark *) {
1450
+ --tw-text-opacity: 1;
1451
+ color: rgb(250 250 250 / var(--tw-text-opacity, 1));
1452
+ }
1453
1453
 
1454
- .dark\:hover\:mesh-bg-zinc-800:hover {
1455
- --tw-bg-opacity: 1;
1456
- background-color: rgb(39 39 42 / var(--tw-bg-opacity, 1));
1457
- }
1454
+ .dark\:focus-visible\:mesh-ring-zinc-300:focus-visible:is(.mesh-dark *) {
1455
+ --tw-ring-opacity: 1;
1456
+ --tw-ring-color: rgb(212 212 216 / var(--tw-ring-opacity, 1));
1457
+ }
1458
+
1459
+ .dark\:data-\[state\=open\]\:mesh-bg-zinc-800[data-state="open"]:is(.mesh-dark *) {
1460
+ --tw-bg-opacity: 1;
1461
+ background-color: rgb(39 39 42 / var(--tw-bg-opacity, 1));
1462
+ }
1458
1463
 
1459
- .dark\:hover\:mesh-bg-zinc-800\/80:hover {
1460
- background-color: rgb(39 39 42 / 0.8);
1464
+ @media (min-width: 640px) {
1465
+ .sm\:mesh-max-w-\[425px\] {
1466
+ max-width: 425px;
1461
1467
  }
1462
1468
 
1463
- .dark\:hover\:mesh-text-zinc-50:hover {
1464
- --tw-text-opacity: 1;
1465
- color: rgb(250 250 250 / var(--tw-text-opacity, 1));
1469
+ .sm\:mesh-flex-row {
1470
+ flex-direction: row;
1466
1471
  }
1467
1472
 
1468
- .dark\:focus\:mesh-bg-zinc-800:focus {
1469
- --tw-bg-opacity: 1;
1470
- background-color: rgb(39 39 42 / var(--tw-bg-opacity, 1));
1473
+ .sm\:mesh-justify-end {
1474
+ justify-content: flex-end;
1471
1475
  }
1472
1476
 
1473
- .dark\:focus\:mesh-text-zinc-50:focus {
1474
- --tw-text-opacity: 1;
1475
- color: rgb(250 250 250 / var(--tw-text-opacity, 1));
1477
+ .sm\:mesh-space-x-2 > :not([hidden]) ~ :not([hidden]) {
1478
+ --tw-space-x-reverse: 0;
1479
+ margin-right: calc(0.5rem * var(--tw-space-x-reverse));
1480
+ margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
1476
1481
  }
1477
1482
 
1478
- .dark\:focus-visible\:mesh-ring-zinc-300:focus-visible {
1479
- --tw-ring-opacity: 1;
1480
- --tw-ring-color: rgb(212 212 216 / var(--tw-ring-opacity, 1));
1483
+ .sm\:mesh-rounded-lg {
1484
+ border-radius: 0.5rem;
1481
1485
  }
1482
1486
 
1483
- .dark\:data-\[state\=open\]\:mesh-bg-zinc-800[data-state="open"] {
1484
- --tw-bg-opacity: 1;
1485
- background-color: rgb(39 39 42 / var(--tw-bg-opacity, 1));
1487
+ .sm\:mesh-text-left {
1488
+ text-align: left;
1486
1489
  }
1487
1490
  }
package/dist/index.d.cts CHANGED
@@ -7,6 +7,7 @@ interface ButtonProps$1 {
7
7
  label?: string;
8
8
  onConnected?: Function;
9
9
  isDark?: boolean;
10
+ persist?: boolean;
10
11
  extensions?: number[];
11
12
  injectFn?: () => Promise<void>;
12
13
  cardanoPeerConnect?: {
@@ -26,17 +27,19 @@ interface ButtonProps$1 {
26
27
  url: string;
27
28
  };
28
29
  }
29
- declare const CardanoWallet: ({ label, onConnected, isDark, extensions, injectFn, cardanoPeerConnect, burnerWallet, webauthn, }: ButtonProps$1) => react_jsx_runtime.JSX.Element;
30
+ declare const CardanoWallet: ({ label, onConnected, isDark, persist, extensions, injectFn, cardanoPeerConnect, burnerWallet, webauthn, }: ButtonProps$1) => react_jsx_runtime.JSX.Element;
30
31
 
31
32
  interface WalletContext {
32
33
  hasConnectedWallet: boolean;
33
34
  connectedWalletInstance: IWallet;
34
35
  connectedWalletName: string | undefined;
35
36
  connectingWallet: boolean;
36
- connectWallet: (walletName: string, extensions?: number[]) => Promise<void>;
37
+ connectWallet: (walletName: string, extensions?: number[], persist?: boolean) => Promise<void>;
37
38
  disconnect: () => void;
38
39
  setWallet: (walletInstance: IWallet, walletName: string) => void;
40
+ setPersist: (persist: boolean) => void;
39
41
  error?: unknown;
42
+ address: string;
40
43
  }
41
44
  declare const WalletContext: react.Context<WalletContext>;
42
45
 
@@ -64,10 +67,12 @@ declare const useWallet: () => {
64
67
  connecting: boolean;
65
68
  connected: boolean;
66
69
  wallet: _meshsdk_common.IWallet;
67
- connect: (walletName: string, extensions?: number[]) => Promise<void>;
70
+ connect: (walletName: string, extensions?: number[], persist?: boolean) => Promise<void>;
68
71
  disconnect: () => void;
69
72
  setWallet: (walletInstance: _meshsdk_common.IWallet, walletName: string) => void;
73
+ setPersist: (persist: boolean) => void;
70
74
  error: unknown;
75
+ address: string;
71
76
  };
72
77
 
73
78
  declare const useWalletSubmit: () => {
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ interface ButtonProps$1 {
7
7
  label?: string;
8
8
  onConnected?: Function;
9
9
  isDark?: boolean;
10
+ persist?: boolean;
10
11
  extensions?: number[];
11
12
  injectFn?: () => Promise<void>;
12
13
  cardanoPeerConnect?: {
@@ -26,17 +27,19 @@ interface ButtonProps$1 {
26
27
  url: string;
27
28
  };
28
29
  }
29
- declare const CardanoWallet: ({ label, onConnected, isDark, extensions, injectFn, cardanoPeerConnect, burnerWallet, webauthn, }: ButtonProps$1) => react_jsx_runtime.JSX.Element;
30
+ declare const CardanoWallet: ({ label, onConnected, isDark, persist, extensions, injectFn, cardanoPeerConnect, burnerWallet, webauthn, }: ButtonProps$1) => react_jsx_runtime.JSX.Element;
30
31
 
31
32
  interface WalletContext {
32
33
  hasConnectedWallet: boolean;
33
34
  connectedWalletInstance: IWallet;
34
35
  connectedWalletName: string | undefined;
35
36
  connectingWallet: boolean;
36
- connectWallet: (walletName: string, extensions?: number[]) => Promise<void>;
37
+ connectWallet: (walletName: string, extensions?: number[], persist?: boolean) => Promise<void>;
37
38
  disconnect: () => void;
38
39
  setWallet: (walletInstance: IWallet, walletName: string) => void;
40
+ setPersist: (persist: boolean) => void;
39
41
  error?: unknown;
42
+ address: string;
40
43
  }
41
44
  declare const WalletContext: react.Context<WalletContext>;
42
45
 
@@ -64,10 +67,12 @@ declare const useWallet: () => {
64
67
  connecting: boolean;
65
68
  connected: boolean;
66
69
  wallet: _meshsdk_common.IWallet;
67
- connect: (walletName: string, extensions?: number[]) => Promise<void>;
70
+ connect: (walletName: string, extensions?: number[], persist?: boolean) => Promise<void>;
68
71
  disconnect: () => void;
69
72
  setWallet: (walletInstance: _meshsdk_common.IWallet, walletName: string) => void;
73
+ setPersist: (persist: boolean) => void;
70
74
  error: unknown;
75
+ address: string;
71
76
  };
72
77
 
73
78
  declare const useWalletSubmit: () => {
package/dist/index.js CHANGED
@@ -23432,7 +23432,7 @@ var require_dist = __commonJS({
23432
23432
  });
23433
23433
 
23434
23434
  // src/cardano-wallet/index.tsx
23435
- import { useEffect as useEffect10, useState as useState13 } from "react";
23435
+ import { useEffect as useEffect10, useState as useState12 } from "react";
23436
23436
 
23437
23437
  // src/common/button.tsx
23438
23438
  import * as React from "react";
@@ -23449,7 +23449,7 @@ function cn(...inputs) {
23449
23449
  // src/common/button.tsx
23450
23450
  import { jsx } from "react/jsx-runtime";
23451
23451
  var buttonVariants = cva(
23452
- "mesh-inline-flex mesh-items-center mesh-justify-center mesh-whitespace-nowrap mesh-rounded-md mesh-text-sm mesh-font-medium mesh-transition-colors focus-visible:mesh-outline-none focus-visible:mesh-ring-1 focus-visible:mesh-ring-zinc-950 disabled:mesh-pointer-events-none disabled:mesh-opacity-50 dark:focus-visible:mesh-ring-zinc-300",
23452
+ "mesh-inline-flex mesh-items-center mesh-justify-center mesh-whitespace-nowrap mesh-rounded-md mesh-text-sm mesh-font-medium mesh-transition-colors focus-visible:mesh-outline-none focus-visible:mesh-ring-1 focus-visible:mesh-ring-zinc-950 disabled:mesh-pointer-events-none disabled:mesh-opacity-50 dark:focus-visible:mesh-ring-zinc-300 dark:mesh-text-white",
23453
23453
  {
23454
23454
  variants: {
23455
23455
  variant: {
@@ -23608,22 +23608,25 @@ function IconChevronRight() {
23608
23608
  }
23609
23609
 
23610
23610
  // src/hooks/useAddress.ts
23611
- import { useContext, useEffect, useState as useState2 } from "react";
23611
+ import { useContext, useEffect as useEffect2, useState as useState2 } from "react";
23612
23612
 
23613
23613
  // src/contexts/WalletContext.ts
23614
- import { createContext, useCallback, useState } from "react";
23614
+ import { createContext, useCallback, useEffect, useState } from "react";
23615
23615
  import { BrowserWallet } from "@meshsdk/wallet";
23616
23616
  var INITIAL_STATE = {
23617
23617
  walletName: void 0,
23618
23618
  walletInstance: {}
23619
23619
  };
23620
+ var localstoragePersist = "mesh-persist";
23620
23621
  var useWalletStore = () => {
23621
23622
  const [error, setError] = useState(void 0);
23622
23623
  const [connectingWallet, setConnectingWallet] = useState(false);
23624
+ const [persistSession, setPersistSession] = useState(false);
23625
+ const [address, setAddress] = useState("");
23623
23626
  const [connectedWalletInstance, setConnectedWalletInstance] = useState(INITIAL_STATE.walletInstance);
23624
23627
  const [connectedWalletName, setConnectedWalletName] = useState(INITIAL_STATE.walletName);
23625
23628
  const connectWallet = useCallback(
23626
- async (walletName, extensions) => {
23629
+ async (walletName, extensions, persist) => {
23627
23630
  setConnectingWallet(true);
23628
23631
  try {
23629
23632
  const walletInstance = await BrowserWallet.enable(
@@ -23633,6 +23636,12 @@ var useWalletStore = () => {
23633
23636
  setConnectedWalletInstance(walletInstance);
23634
23637
  setConnectedWalletName(walletName);
23635
23638
  setError(void 0);
23639
+ if (persist) {
23640
+ localStorage.setItem(
23641
+ localstoragePersist,
23642
+ JSON.stringify({ walletName })
23643
+ );
23644
+ }
23636
23645
  } catch (error2) {
23637
23646
  setError(error2);
23638
23647
  }
@@ -23643,6 +23652,7 @@ var useWalletStore = () => {
23643
23652
  const disconnect = useCallback(() => {
23644
23653
  setConnectedWalletName(INITIAL_STATE.walletName);
23645
23654
  setConnectedWalletInstance(INITIAL_STATE.walletInstance);
23655
+ localStorage.removeItem(localstoragePersist);
23646
23656
  }, []);
23647
23657
  const setWallet = useCallback(
23648
23658
  async (walletInstance, walletName) => {
@@ -23651,6 +23661,29 @@ var useWalletStore = () => {
23651
23661
  },
23652
23662
  []
23653
23663
  );
23664
+ const setPersist = useCallback((persist) => {
23665
+ setPersistSession(persist);
23666
+ }, []);
23667
+ useEffect(() => {
23668
+ async function load() {
23669
+ if (Object.keys(connectedWalletInstance).length > 0 && address.length === 0) {
23670
+ let address2 = (await connectedWalletInstance.getUnusedAddresses())[0];
23671
+ if (!address2)
23672
+ address2 = await connectedWalletInstance.getChangeAddress();
23673
+ setAddress(address2);
23674
+ }
23675
+ }
23676
+ load();
23677
+ }, [connectedWalletInstance]);
23678
+ useEffect(() => {
23679
+ const persist = localStorage.getItem(localstoragePersist);
23680
+ if (persistSession && persist) {
23681
+ const persist2 = JSON.parse(
23682
+ localStorage.getItem(localstoragePersist) || ""
23683
+ );
23684
+ connectWallet(persist2.walletName);
23685
+ }
23686
+ }, [persistSession]);
23654
23687
  return {
23655
23688
  hasConnectedWallet: INITIAL_STATE.walletName !== connectedWalletName,
23656
23689
  connectedWalletInstance,
@@ -23659,7 +23692,9 @@ var useWalletStore = () => {
23659
23692
  connectWallet,
23660
23693
  disconnect,
23661
23694
  setWallet,
23662
- error
23695
+ setPersist,
23696
+ error,
23697
+ address
23663
23698
  };
23664
23699
  };
23665
23700
  var WalletContext = createContext({
@@ -23672,7 +23707,10 @@ var WalletContext = createContext({
23672
23707
  disconnect: () => {
23673
23708
  },
23674
23709
  setWallet: async () => {
23675
- }
23710
+ },
23711
+ setPersist: () => {
23712
+ },
23713
+ address: ""
23676
23714
  });
23677
23715
 
23678
23716
  // src/contexts/index.tsx
@@ -23686,7 +23724,7 @@ var MeshProvider = (props) => {
23686
23724
  var useAddress = (accountId = 0) => {
23687
23725
  const [address, setAddress] = useState2();
23688
23726
  const { hasConnectedWallet, connectedWalletInstance } = useContext(WalletContext);
23689
- useEffect(() => {
23727
+ useEffect2(() => {
23690
23728
  if (hasConnectedWallet) {
23691
23729
  connectedWalletInstance.getUsedAddresses().then((addresses) => {
23692
23730
  if (addresses[accountId]) {
@@ -23699,11 +23737,11 @@ var useAddress = (accountId = 0) => {
23699
23737
  };
23700
23738
 
23701
23739
  // src/hooks/useAssets.ts
23702
- import { useContext as useContext2, useEffect as useEffect2, useState as useState3 } from "react";
23740
+ import { useContext as useContext2, useEffect as useEffect3, useState as useState3 } from "react";
23703
23741
  var useAssets = () => {
23704
23742
  const [assets, setAssets] = useState3();
23705
23743
  const { hasConnectedWallet, connectedWalletInstance } = useContext2(WalletContext);
23706
- useEffect2(() => {
23744
+ useEffect3(() => {
23707
23745
  if (hasConnectedWallet) {
23708
23746
  connectedWalletInstance.getAssets().then(setAssets);
23709
23747
  }
@@ -23712,13 +23750,13 @@ var useAssets = () => {
23712
23750
  };
23713
23751
 
23714
23752
  // src/hooks/useWalletList.ts
23715
- import { useEffect as useEffect3, useState as useState4 } from "react";
23753
+ import { useEffect as useEffect4, useState as useState4 } from "react";
23716
23754
  import { BrowserWallet as BrowserWallet2 } from "@meshsdk/wallet";
23717
23755
  var useWalletList = ({
23718
23756
  injectFn = void 0
23719
23757
  } = {}) => {
23720
23758
  const [wallets, setWallets] = useState4([]);
23721
- useEffect3(() => {
23759
+ useEffect4(() => {
23722
23760
  async function get() {
23723
23761
  setWallets(await BrowserWallet2.getAvailableWallets({ injectFn }));
23724
23762
  }
@@ -23728,12 +23766,12 @@ var useWalletList = ({
23728
23766
  };
23729
23767
 
23730
23768
  // src/hooks/useLovelace.ts
23731
- import { useContext as useContext3, useEffect as useEffect4, useMemo, useRef, useState as useState5 } from "react";
23769
+ import { useContext as useContext3, useEffect as useEffect5, useMemo, useRef, useState as useState5 } from "react";
23732
23770
  var useLovelace = () => {
23733
23771
  const [lovelace, setLovelace] = useState5();
23734
23772
  const { hasConnectedWallet, connectedWalletInstance } = useContext3(WalletContext);
23735
23773
  const hasFetchedLovelace = useRef(false);
23736
- useEffect4(() => {
23774
+ useEffect5(() => {
23737
23775
  async function getLovelace() {
23738
23776
  if (hasConnectedWallet && !hasFetchedLovelace.current) {
23739
23777
  setLovelace(await connectedWalletInstance.getLovelace());
@@ -23749,11 +23787,11 @@ var useLovelace = () => {
23749
23787
  };
23750
23788
 
23751
23789
  // src/hooks/useNetwork.ts
23752
- import { useContext as useContext4, useEffect as useEffect5, useState as useState6 } from "react";
23790
+ import { useContext as useContext4, useEffect as useEffect6, useState as useState6 } from "react";
23753
23791
  var useNetwork = () => {
23754
23792
  const [networkId, setNetworkId] = useState6();
23755
23793
  const { hasConnectedWallet, connectedWalletInstance } = useContext4(WalletContext);
23756
- useEffect5(() => {
23794
+ useEffect6(() => {
23757
23795
  if (hasConnectedWallet) {
23758
23796
  connectedWalletInstance.getNetworkId().then(setNetworkId);
23759
23797
  } else {
@@ -23764,11 +23802,11 @@ var useNetwork = () => {
23764
23802
  };
23765
23803
 
23766
23804
  // src/hooks/useRewardAddress.ts
23767
- import { useContext as useContext5, useEffect as useEffect6, useState as useState7 } from "react";
23805
+ import { useContext as useContext5, useEffect as useEffect7, useState as useState7 } from "react";
23768
23806
  var useRewardAddress = (accountId = 0) => {
23769
23807
  const [rewardAddress, setRewardAddress] = useState7();
23770
23808
  const { hasConnectedWallet, connectedWalletInstance } = useContext5(WalletContext);
23771
- useEffect6(() => {
23809
+ useEffect7(() => {
23772
23810
  if (hasConnectedWallet) {
23773
23811
  connectedWalletInstance.getRewardAddresses().then((addresses) => {
23774
23812
  if (addresses[accountId]) {
@@ -23791,7 +23829,9 @@ var useWallet = () => {
23791
23829
  connectWallet,
23792
23830
  disconnect,
23793
23831
  setWallet,
23794
- error
23832
+ setPersist,
23833
+ error,
23834
+ address
23795
23835
  } = useContext6(WalletContext);
23796
23836
  if (connectWallet === void 0 || disconnect === void 0) {
23797
23837
  throw new Error(
@@ -23806,7 +23846,9 @@ var useWallet = () => {
23806
23846
  connect: connectWallet,
23807
23847
  disconnect,
23808
23848
  setWallet,
23809
- error
23849
+ setPersist,
23850
+ error,
23851
+ address
23810
23852
  };
23811
23853
  };
23812
23854
 
@@ -23841,9 +23883,6 @@ var useWalletSubmit = () => {
23841
23883
  };
23842
23884
  };
23843
23885
 
23844
- // src/cardano-wallet/connected-button.tsx
23845
- import { useEffect as useEffect7, useState as useState9 } from "react";
23846
-
23847
23886
  // src/common/dropdown-menu.tsx
23848
23887
  import * as React3 from "react";
23849
23888
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
@@ -23983,20 +24022,9 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
23983
24022
  // src/cardano-wallet/connected-button.tsx
23984
24023
  import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
23985
24024
  function ConnectedButton() {
23986
- const { wallet, connected, disconnect } = useWallet();
23987
- const [address, setAddress] = useState9("");
23988
- useEffect7(() => {
23989
- if (connected && wallet) {
23990
- async function afterConnectedWallet() {
23991
- let address2 = (await wallet.getUnusedAddresses())[0];
23992
- if (!address2) address2 = await wallet.getChangeAddress();
23993
- setAddress(address2);
23994
- }
23995
- afterConnectedWallet();
23996
- }
23997
- }, [connected, wallet]);
24025
+ const { wallet, connected, disconnect, address } = useWallet();
23998
24026
  return /* @__PURE__ */ jsxs3(DropdownMenu, { children: [
23999
- /* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(Button, { variant: "outline", className: "mesh-text-white", children: [
24027
+ /* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(Button, { variant: "outline", children: [
24000
24028
  address.slice(0, 6),
24001
24029
  "...",
24002
24030
  address.slice(-6)
@@ -24044,7 +24072,7 @@ var screens = {
24044
24072
  };
24045
24073
 
24046
24074
  // src/cardano-wallet/screen-burner.tsx
24047
- import { useEffect as useEffect8, useState as useState10 } from "react";
24075
+ import { useEffect as useEffect8, useState as useState9 } from "react";
24048
24076
  import { MeshWallet } from "@meshsdk/wallet";
24049
24077
  import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
24050
24078
  var localstoragekey = "mesh-burnerwallet";
@@ -24053,8 +24081,8 @@ function ScreenBurner({
24053
24081
  provider,
24054
24082
  setOpen
24055
24083
  }) {
24056
- const [loading, setLoading] = useState10(false);
24057
- const [hasKeyInStorage, setHasKeyInStorage] = useState10(false);
24084
+ const [loading, setLoading] = useState9(false);
24085
+ const [hasKeyInStorage, setHasKeyInStorage] = useState9(false);
24058
24086
  const { setWallet } = useWallet();
24059
24087
  function getKeyFromStorage() {
24060
24088
  return localStorage.getItem(localstoragekey);
@@ -24099,7 +24127,6 @@ function ScreenBurner({
24099
24127
  Button,
24100
24128
  {
24101
24129
  variant: "outline",
24102
- className: "mesh-text-white",
24103
24130
  onClick: () => {
24104
24131
  handleRestoreWallet();
24105
24132
  },
@@ -24111,7 +24138,6 @@ function ScreenBurner({
24111
24138
  Button,
24112
24139
  {
24113
24140
  variant: "outline",
24114
- className: "mesh-text-white",
24115
24141
  onClick: () => {
24116
24142
  handleCreateWallet();
24117
24143
  },
@@ -24312,6 +24338,7 @@ function ScreenMain({
24312
24338
  extensions,
24313
24339
  setOpen,
24314
24340
  setScreen,
24341
+ persist,
24315
24342
  cardanoPeerConnect,
24316
24343
  burnerWallet,
24317
24344
  webauthn
@@ -24325,7 +24352,7 @@ function ScreenMain({
24325
24352
  icon: wallet.icon,
24326
24353
  name: wallet.name,
24327
24354
  action: () => {
24328
- connect2(wallet.id, extensions);
24355
+ connect2(wallet.id, extensions, persist);
24329
24356
  setOpen(false);
24330
24357
  }
24331
24358
  },
@@ -24379,7 +24406,7 @@ function ScreenMain({
24379
24406
 
24380
24407
  // src/cardano-wallet/screen-p2p.tsx
24381
24408
  var import_cardano_peer_connect = __toESM(require_dist(), 1);
24382
- import { useEffect as useEffect9, useRef as useRef2, useState as useState11 } from "react";
24409
+ import { useEffect as useEffect9, useRef as useRef2, useState as useState10 } from "react";
24383
24410
  import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
24384
24411
  function ScreenP2P({
24385
24412
  cardanoPeerConnect,
@@ -24387,8 +24414,8 @@ function ScreenP2P({
24387
24414
  }) {
24388
24415
  const dAppConnect = useRef2(null);
24389
24416
  const qrCodeField = useRef2(null);
24390
- const [address, setAddress] = useState11("");
24391
- const [copied, setCopied] = useState11(false);
24417
+ const [address, setAddress] = useState10("");
24418
+ const [copied, setCopied] = useState10(false);
24392
24419
  const { connect: connect2 } = useWallet();
24393
24420
  useEffect9(() => {
24394
24421
  if (cardanoPeerConnect) {
@@ -24430,7 +24457,6 @@ function ScreenP2P({
24430
24457
  Button,
24431
24458
  {
24432
24459
  variant: "outline",
24433
- className: "mesh-text-white",
24434
24460
  onClick: () => {
24435
24461
  navigator.clipboard.writeText(address);
24436
24462
  setCopied(true);
@@ -24442,7 +24468,7 @@ function ScreenP2P({
24442
24468
  }
24443
24469
 
24444
24470
  // src/cardano-wallet/screen-webauthn.tsx
24445
- import { useState as useState12 } from "react";
24471
+ import { useState as useState11 } from "react";
24446
24472
  import { connect, MeshWallet as MeshWallet2 } from "@meshsdk/wallet";
24447
24473
 
24448
24474
  // src/common/input.tsx
@@ -24492,9 +24518,9 @@ function ScreenWebauthn({
24492
24518
  provider,
24493
24519
  setOpen
24494
24520
  }) {
24495
- const [loading, setLoading] = useState12(false);
24496
- const [userName, setUserName] = useState12("");
24497
- const [password, setPassword] = useState12("");
24521
+ const [loading, setLoading] = useState11(false);
24522
+ const [userName, setUserName] = useState11("");
24523
+ const [password, setPassword] = useState11("");
24498
24524
  const { setWallet } = useWallet();
24499
24525
  function createWallet(root) {
24500
24526
  setTimeout(() => {
@@ -24566,26 +24592,30 @@ var CardanoWallet = ({
24566
24592
  label = "Connect Wallet",
24567
24593
  onConnected = void 0,
24568
24594
  isDark = false,
24595
+ persist = false,
24569
24596
  extensions = [],
24570
24597
  injectFn = void 0,
24571
24598
  cardanoPeerConnect = void 0,
24572
24599
  burnerWallet = void 0,
24573
24600
  webauthn = void 0
24574
24601
  }) => {
24575
- const [open, setOpen] = useState13(false);
24576
- const [screen, setScreen] = useState13("main");
24577
- const { wallet, connected } = useWallet();
24602
+ const [open, setOpen] = useState12(false);
24603
+ const [screen, setScreen] = useState12("main");
24604
+ const { wallet, connected, setPersist } = useWallet();
24605
+ useEffect10(() => {
24606
+ setPersist(persist);
24607
+ }, [persist]);
24578
24608
  useEffect10(() => {
24579
24609
  if (connected) {
24580
24610
  if (onConnected) onConnected();
24581
24611
  }
24582
24612
  }, [connected, wallet]);
24583
24613
  return /* @__PURE__ */ jsxs13(Dialog, { open, onOpenChange: setOpen, children: [
24584
- !connected ? /* @__PURE__ */ jsx19(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx19(Button, { variant: "outline", className: "mesh-text-white", children: label }) }) : /* @__PURE__ */ jsx19(ConnectedButton, {}),
24614
+ /* @__PURE__ */ jsx19("div", { className: isDark ? "mesh-dark" : "", children: !connected ? /* @__PURE__ */ jsx19(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx19(Button, { variant: "outline", children: label }) }) : /* @__PURE__ */ jsx19(ConnectedButton, {}) }),
24585
24615
  /* @__PURE__ */ jsxs13(
24586
24616
  DialogContent,
24587
24617
  {
24588
- className: "sm:mesh-max-w-[425px]",
24618
+ className: "sm:mesh-max-w-[425px] mesh-dark",
24589
24619
  onOpenAutoFocus: (event) => event.preventDefault(),
24590
24620
  children: [
24591
24621
  /* @__PURE__ */ jsx19(Header, { screen, setScreen }),
@@ -24596,6 +24626,7 @@ var CardanoWallet = ({
24596
24626
  extensions,
24597
24627
  setOpen,
24598
24628
  setScreen,
24629
+ persist,
24599
24630
  cardanoPeerConnect: cardanoPeerConnect != void 0,
24600
24631
  burnerWallet: burnerWallet != void 0,
24601
24632
  webauthn: webauthn != void 0
@@ -24704,11 +24735,11 @@ var MeshBadge = ({ isDark = false }) => /* @__PURE__ */ jsxs14(
24704
24735
  );
24705
24736
 
24706
24737
  // src/stake-button/index.tsx
24707
- import { useEffect as useEffect12, useState as useState15 } from "react";
24738
+ import { useEffect as useEffect12, useState as useState14 } from "react";
24708
24739
  import { Transaction } from "@meshsdk/transaction";
24709
24740
 
24710
24741
  // src/cardano-wallet-dropdown/index.tsx
24711
- import { useEffect as useEffect11, useState as useState14 } from "react";
24742
+ import { useEffect as useEffect11, useState as useState13 } from "react";
24712
24743
 
24713
24744
  // src/common/button-dropdown.tsx
24714
24745
  import { jsx as jsx22 } from "react/jsx-runtime";
@@ -24810,8 +24841,8 @@ var CardanoWallet2 = ({
24810
24841
  extensions = [],
24811
24842
  cardanoPeerConnect = void 0
24812
24843
  }) => {
24813
- const [isDarkMode, setIsDarkMode] = useState14(false);
24814
- const [hideMenuList, setHideMenuList] = useState14(true);
24844
+ const [isDarkMode, setIsDarkMode] = useState13(false);
24845
+ const [hideMenuList, setHideMenuList] = useState13(true);
24815
24846
  const { connect: connect2, connecting, connected, disconnect, name } = useWallet();
24816
24847
  const wallets = useWalletList();
24817
24848
  useEffect11(() => {
@@ -24888,7 +24919,7 @@ var StakeButton = ({
24888
24919
  onCheck,
24889
24920
  onDelegated = void 0
24890
24921
  }) => {
24891
- const [isDarkMode, setIsDarkMode] = useState15(false);
24922
+ const [isDarkMode, setIsDarkMode] = useState14(false);
24892
24923
  const { connected } = useWallet();
24893
24924
  useEffect12(() => {
24894
24925
  setIsDarkMode(isDark);
@@ -24909,11 +24940,11 @@ var Delegate = ({
24909
24940
  }) => {
24910
24941
  const { wallet } = useWallet();
24911
24942
  const rewardAddress = useRewardAddress();
24912
- const [_, setError] = useState15();
24913
- const [checking, setChecking] = useState15(false);
24914
- const [accountInfo, setAccountInfo] = useState15();
24915
- const [processing, setProcessing] = useState15(false);
24916
- const [done, setDone] = useState15(false);
24943
+ const [_, setError] = useState14();
24944
+ const [checking, setChecking] = useState14(false);
24945
+ const [accountInfo, setAccountInfo] = useState14();
24946
+ const [processing, setProcessing] = useState14(false);
24947
+ const [done, setDone] = useState14(false);
24917
24948
  const checkAccountStatus = async () => {
24918
24949
  try {
24919
24950
  setChecking(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshsdk/react",
3
- "version": "1.8.12",
3
+ "version": "1.8.13",
4
4
  "description": "React component library - https://meshjs.dev/react",
5
5
  "main": "./dist/index.cjs",
6
6
  "browser": "./dist/index.js",
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@fabianbormann/cardano-peer-connect": "^1.2.18",
33
- "@meshsdk/common": "1.8.12",
34
- "@meshsdk/transaction": "1.8.12",
35
- "@meshsdk/wallet": "1.8.12",
33
+ "@meshsdk/common": "1.8.13",
34
+ "@meshsdk/transaction": "1.8.13",
35
+ "@meshsdk/wallet": "1.8.13",
36
36
  "@radix-ui/react-dialog": "^1.1.2",
37
37
  "@radix-ui/react-dropdown-menu": "^2.1.2",
38
38
  "@radix-ui/react-icons": "^1.3.2",