@compass-labs/widgets 0.1.17 → 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 +5 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2072,33 +2072,7 @@ function EarnAccountGuard({
|
|
|
2072
2072
|
const { isDeployed, isChecking, isCreating, createAccount, error } = useEarnAccount();
|
|
2073
2073
|
const [createError, setCreateError] = useState(null);
|
|
2074
2074
|
if (!isConnected) {
|
|
2075
|
-
return /* @__PURE__ */
|
|
2076
|
-
"div",
|
|
2077
|
-
{
|
|
2078
|
-
className: "compass-earn-guard p-6 text-center",
|
|
2079
|
-
style: {
|
|
2080
|
-
backgroundColor: "var(--compass-color-surface)",
|
|
2081
|
-
borderRadius: "var(--compass-border-radius-xl)",
|
|
2082
|
-
fontFamily: "var(--compass-font-family)"
|
|
2083
|
-
},
|
|
2084
|
-
children: [
|
|
2085
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm mb-4", style: { color: "var(--compass-color-text-secondary)" }, children: "Connect your wallet to continue" }),
|
|
2086
|
-
login && /* @__PURE__ */ jsx(
|
|
2087
|
-
"button",
|
|
2088
|
-
{
|
|
2089
|
-
onClick: login,
|
|
2090
|
-
className: "px-4 py-2 font-medium transition-colors",
|
|
2091
|
-
style: {
|
|
2092
|
-
backgroundColor: "var(--compass-color-primary)",
|
|
2093
|
-
color: "var(--compass-color-primary-text)",
|
|
2094
|
-
borderRadius: "var(--compass-border-radius-lg)"
|
|
2095
|
-
},
|
|
2096
|
-
children: "Connect Wallet"
|
|
2097
|
-
}
|
|
2098
|
-
)
|
|
2099
|
-
]
|
|
2100
|
-
}
|
|
2101
|
-
);
|
|
2075
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
2102
2076
|
}
|
|
2103
2077
|
if (isChecking) {
|
|
2104
2078
|
if (loadingComponent) {
|
|
@@ -4694,7 +4668,7 @@ function EarnAccount({
|
|
|
4694
4668
|
defaultMarketType = "aave",
|
|
4695
4669
|
defaultMinTvl = 0
|
|
4696
4670
|
}) {
|
|
4697
|
-
const { address, signTypedData, switchChain, walletChainId } = useEmbeddableWallet();
|
|
4671
|
+
const { address, isConnected, login, signTypedData, switchChain, walletChainId } = useEmbeddableWallet();
|
|
4698
4672
|
const { isDeployed } = useEarnAccount();
|
|
4699
4673
|
const { chainId: CHAIN_ID } = useChain();
|
|
4700
4674
|
const queryClient = useQueryClient();
|
|
@@ -5721,8 +5695,8 @@ function EarnAccount({
|
|
|
5721
5695
|
/* @__PURE__ */ jsx(
|
|
5722
5696
|
"button",
|
|
5723
5697
|
{
|
|
5724
|
-
onClick: handleAction,
|
|
5725
|
-
disabled: isProcessing || !selectedMarket || !amount || parseFloat(amount) <= 0 || parseFloat(amount) > maxAmount,
|
|
5698
|
+
onClick: !isConnected && login ? login : handleAction,
|
|
5699
|
+
disabled: isConnected && (isProcessing || !selectedMarket || !amount || parseFloat(amount) <= 0 || parseFloat(amount) > maxAmount),
|
|
5726
5700
|
className: "w-full font-semibold transition-all disabled:opacity-50 disabled:cursor-not-allowed",
|
|
5727
5701
|
style: {
|
|
5728
5702
|
backgroundColor: "var(--compass-color-primary)",
|
|
@@ -5732,7 +5706,7 @@ function EarnAccount({
|
|
|
5732
5706
|
fontSize: compact ? "0.875rem" : "1rem",
|
|
5733
5707
|
transition: "var(--compass-transition-normal)"
|
|
5734
5708
|
},
|
|
5735
|
-
children: isProcessing ? /* @__PURE__ */ jsxs("span", { className: "flex items-center justify-center", style: { gap: "calc(var(--compass-spacing-unit) * 0.5)" }, children: [
|
|
5709
|
+
children: !isConnected ? "Connect Wallet" : isProcessing ? /* @__PURE__ */ jsxs("span", { className: "flex items-center justify-center", style: { gap: "calc(var(--compass-spacing-unit) * 0.5)" }, children: [
|
|
5736
5710
|
/* @__PURE__ */ jsx(Loader2, { size: compact ? 16 : 20, className: "animate-spin" }),
|
|
5737
5711
|
"Processing..."
|
|
5738
5712
|
] }) : !selectedMarket ? "Select a market" : needsActionSwap ? activeTab === "deposit" ? `Swap & Deposit` : `Withdraw & Swap` : activeTab === "deposit" ? "Deposit funds" : "Withdraw funds"
|