@compass-labs/widgets 0.1.18 → 0.1.19

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.js CHANGED
@@ -4670,7 +4670,7 @@ function EarnAccount({
4670
4670
  defaultMarketType = "aave",
4671
4671
  defaultMinTvl = 0
4672
4672
  }) {
4673
- const { address, signTypedData, switchChain, walletChainId } = useEmbeddableWallet();
4673
+ const { address, isConnected, login, signTypedData, switchChain, walletChainId } = useEmbeddableWallet();
4674
4674
  const { isDeployed } = useEarnAccount();
4675
4675
  const { chainId: CHAIN_ID } = useChain();
4676
4676
  const queryClient = reactQuery.useQueryClient();
@@ -5697,8 +5697,8 @@ function EarnAccount({
5697
5697
  /* @__PURE__ */ jsxRuntime.jsx(
5698
5698
  "button",
5699
5699
  {
5700
- onClick: handleAction,
5701
- disabled: isProcessing || !selectedMarket || !amount || parseFloat(amount) <= 0 || parseFloat(amount) > maxAmount,
5700
+ onClick: !isConnected && login ? login : handleAction,
5701
+ disabled: isConnected && (isProcessing || !selectedMarket || !amount || parseFloat(amount) <= 0 || parseFloat(amount) > maxAmount),
5702
5702
  className: "w-full font-semibold transition-all disabled:opacity-50 disabled:cursor-not-allowed",
5703
5703
  style: {
5704
5704
  backgroundColor: "var(--compass-color-primary)",
@@ -5708,7 +5708,7 @@ function EarnAccount({
5708
5708
  fontSize: compact ? "0.875rem" : "1rem",
5709
5709
  transition: "var(--compass-transition-normal)"
5710
5710
  },
5711
- children: isProcessing ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center justify-center", style: { gap: "calc(var(--compass-spacing-unit) * 0.5)" }, children: [
5711
+ children: !isConnected ? "Connect Wallet" : isProcessing ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center justify-center", style: { gap: "calc(var(--compass-spacing-unit) * 0.5)" }, children: [
5712
5712
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { size: compact ? 16 : 20, className: "animate-spin" }),
5713
5713
  "Processing..."
5714
5714
  ] }) : !selectedMarket ? "Select a market" : needsActionSwap ? activeTab === "deposit" ? `Swap & Deposit` : `Withdraw & Swap` : activeTab === "deposit" ? "Deposit funds" : "Withdraw funds"