From fa551b6d9d090e18d6cc52fc0ea2583da3fd4926 Mon Sep 17 00:00:00 2001 From: Fouad Date: Tue, 5 Nov 2024 13:01:22 +0000 Subject: [PATCH] Nym node - Fix claim delegator rewards (#5090) * update function param from mixId to nodeId * fix claim operator rewards --- explorer/src/utils/index.ts | 1 - .../components/Bonding/modals/RedeemRewardsModal.tsx | 12 +++--------- nym-wallet/src/pages/bonding/Bonding.tsx | 2 +- nym-wallet/src/requests/actions.ts | 2 +- nym-wallet/src/requests/rewards.ts | 2 +- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/explorer/src/utils/index.ts b/explorer/src/utils/index.ts index 5375377b5a..91b082c5ca 100644 --- a/explorer/src/utils/index.ts +++ b/explorer/src/utils/index.ts @@ -102,7 +102,6 @@ export const isLessThan = (a: number, b: number) => a < b; */ export const isBalanceEnough = (fee: string, tx: string = '0', balance: string = '0') => { - console.log('balance', balance, fee, tx); try { return Big(balance).gte(Big(fee).plus(Big(tx))); } catch (e) { diff --git a/nym-wallet/src/components/Bonding/modals/RedeemRewardsModal.tsx b/nym-wallet/src/components/Bonding/modals/RedeemRewardsModal.tsx index 8e00ddbfa5..0243e765f3 100644 --- a/nym-wallet/src/components/Bonding/modals/RedeemRewardsModal.tsx +++ b/nym-wallet/src/components/Bonding/modals/RedeemRewardsModal.tsx @@ -4,11 +4,10 @@ import { ModalListItem } from 'src/components/Modals/ModalListItem'; import { SimpleModal } from 'src/components/Modals/SimpleModal'; import { ModalFee } from 'src/components/Modals/ModalFee'; import { useGetFee } from 'src/hooks/useGetFee'; -import { simulateClaimOperatorReward, simulateVestingClaimOperatorReward } from 'src/requests'; import { AppContext } from 'src/context'; import { BalanceWarning } from 'src/components/FeeWarning'; import { Box } from '@mui/material'; -import { TBondedMixnode } from 'src/requests/mixnodeDetails'; +import { TBondedNymNode } from 'src/requests/nymNodeDetails'; export const RedeemRewardsModal = ({ node, @@ -16,23 +15,18 @@ export const RedeemRewardsModal = ({ onError, onClose, }: { - node: TBondedMixnode; + node: TBondedNymNode; onConfirm: (fee?: FeeDetails) => Promise; onError: (err: string) => void; onClose: () => void; }) => { - const { fee, getFee, isFeeLoading, feeError } = useGetFee(); + const { fee, isFeeLoading, feeError } = useGetFee(); const { userBalance } = useContext(AppContext); useEffect(() => { if (feeError) onError(feeError); }, [feeError]); - useEffect(() => { - if (node.proxy) getFee(simulateVestingClaimOperatorReward, {}); - else getFee(simulateClaimOperatorReward, {}); - }, []); - const handleOnOK = async () => onConfirm(fee); return ( diff --git a/nym-wallet/src/pages/bonding/Bonding.tsx b/nym-wallet/src/pages/bonding/Bonding.tsx index b66ffbe58e..d618775e05 100644 --- a/nym-wallet/src/pages/bonding/Bonding.tsx +++ b/nym-wallet/src/pages/bonding/Bonding.tsx @@ -292,7 +292,7 @@ export const Bonding = () => { /> )} - {showModal === 'redeem' && bondedNode && isMixnode(bondedNode) && ( + {showModal === 'redeem' && bondedNode && isNymNode(bondedNode) && ( setShowModal(undefined)} diff --git a/nym-wallet/src/requests/actions.ts b/nym-wallet/src/requests/actions.ts index 6907cf054a..835fcb465b 100644 --- a/nym-wallet/src/requests/actions.ts +++ b/nym-wallet/src/requests/actions.ts @@ -7,7 +7,7 @@ import { NodeConfigUpdate, GatewayConfigUpdate, } from '@nymproject/types'; -import { TBondGatewayArgs, TBondGatewaySignatureArgs, TNodeConfigUpdateArgs } from '../types'; +import { TBondGatewayArgs, TBondGatewaySignatureArgs } from '../types'; import { invokeWrapper } from './wrapper'; export const bondGateway = async (args: TBondGatewayArgs) => diff --git a/nym-wallet/src/requests/rewards.ts b/nym-wallet/src/requests/rewards.ts index 36b90838e7..ed5dcb797a 100644 --- a/nym-wallet/src/requests/rewards.ts +++ b/nym-wallet/src/requests/rewards.ts @@ -6,7 +6,7 @@ export const claimOperatorReward = async (fee?: Fee) => export const claimDelegatorRewards = async (mixId: number, fee?: FeeDetails) => invokeWrapper('claim_locked_and_unlocked_delegator_reward', { - mixId, + nodeId: mixId, fee: fee?.fee, });