Skip to content

Commit

Permalink
Removed Signing Push User from yield Farming V1 (#1760)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek-01k authored and corlard3y committed Jul 27, 2024
1 parent 7276c6b commit 3e4de9c
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions src/components/yield/YieldPoolCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { ethers } from 'ethers';
// External Packages
import styled, { useTheme } from 'styled-components';
import { MdCheckCircle, MdError } from 'react-icons/md';
import { useSelector } from 'react-redux';

// Internal Compoonents
import useToast from 'hooks/useToast';
Expand All @@ -26,7 +25,6 @@ import {
SkeletonLine,
SpanV2,
} from 'components/reusables/SharedStylingV2';
import { AppContext } from 'contexts/AppContext';

// Internal Configs
import { abis, addresses } from 'config/index.js';
Expand All @@ -41,7 +39,8 @@ const YieldPoolCard = ({
tokenAddress,
setActiveTab,
}: any) => {
const { account, provider, wallet } = useAccount();
const { account, provider, wallet, isWalletConnected, connect } = useAccount();


const [txInProgressWithdraw, setTxInProgressWithdraw] = useState(false);
const [txInProgressClaimRewards, setTxInProgressClaimRewards] = useState(false);
Expand All @@ -52,20 +51,15 @@ const YieldPoolCard = ({
const [unstakeErrorMessage, setUnstakeErrorMessage] = useState(null);
const [withdrawErrorMessage, setWithdrawErrorMessage] = useState(null);

const { userPushSDKInstance } = useSelector((state: any) => {
return state.user;
});
const { handleConnectWalletAndEnableProfile } = useContext(AppContext);

const [filled, setFilled] = useState(0);

const yieldFarmToast = useToast();

const theme = useTheme();

const massClaimRewardsTokensAll = async () => {
if (!userPushSDKInstance.signer) {
handleConnectWalletAndEnableProfile({ wallet });
if (!isWalletConnected) {
connect();
return;
}

Expand Down Expand Up @@ -152,11 +146,13 @@ const YieldPoolCard = ({
};

const withdrawTokens = async () => {
if (!userPushSDKInstance.signer) {
handleConnectWalletAndEnableProfile({ wallet });

if (!isWalletConnected) {
connect();
return;
}


if (txInProgressWithdraw) {
return;
}
Expand Down Expand Up @@ -218,7 +214,7 @@ const YieldPoolCard = ({
}).catch((err) => {
yieldFarmToast.showMessageToast({
toastTitle: 'Error',
toastMessage: `Transaction Cancelled!`,
toastMessage: `Transaction Cancelled! ${err.message}`,
toastType: 'ERROR',
getToastIcon: (size) => (
<MdError
Expand All @@ -233,8 +229,8 @@ const YieldPoolCard = ({
};

const migrateToNewPool = async () => {
if (!userPushSDKInstance.signer) {
handleConnectWalletAndEnableProfile({ wallet });
if (!isWalletConnected) {
connect();
return;
}

Expand Down Expand Up @@ -456,8 +452,8 @@ const YieldPoolCard = ({
};

const depositLpToken = async (tx, withdrawAmount, totalTxnSteps) => {
if (!userPushSDKInstance.signer) {
handleConnectWalletAndEnableProfile({ wallet });
if (!isWalletConnected) {
connect();
return;
}

Expand Down Expand Up @@ -509,8 +505,8 @@ const YieldPoolCard = ({
};

const depositPushToken = async (tx, withdrawAmount, totalTxnSteps) => {
if (!userPushSDKInstance.signer) {
handleConnectWalletAndEnableProfile({ wallet });
if (!isWalletConnected) {
connect();
return;
}

Expand Down Expand Up @@ -613,7 +609,7 @@ const YieldPoolCard = ({
<ItemVV2
margin={isMobile ? '0px 6px 0 0 ' : '0px 18px 0px 0px'}
padding={isMobile ? ' 7px' : '10px'}
// padding="10px"
// padding="10px"
>
{PoolStats ? (
<>
Expand Down Expand Up @@ -650,7 +646,7 @@ const YieldPoolCard = ({
<ItemVV2
margin={isMobile ? '0px 6px 0 0 ' : '0px 18px 0px 0px'}
padding={isMobile ? ' 7px' : '10px'}
// padding="10px"
// padding="10px"
>
{PoolStats ? (
<>
Expand Down

0 comments on commit 3e4de9c

Please sign in to comment.