Nym node - Fix claim delegator rewards (#5090)

* update function param from mixId to nodeId

* fix claim operator rewards
This commit is contained in:
Fouad
2024-11-05 13:01:22 +00:00
committed by GitHub
parent c6959d3e2d
commit fa551b6d9d
5 changed files with 6 additions and 13 deletions
-1
View File
@@ -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) {
@@ -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<void>;
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 (
+1 -1
View File
@@ -292,7 +292,7 @@ export const Bonding = () => {
/>
)}
{showModal === 'redeem' && bondedNode && isMixnode(bondedNode) && (
{showModal === 'redeem' && bondedNode && isNymNode(bondedNode) && (
<RedeemRewardsModal
node={bondedNode}
onClose={() => setShowModal(undefined)}
+1 -1
View File
@@ -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) =>
+1 -1
View File
@@ -6,7 +6,7 @@ export const claimOperatorReward = async (fee?: Fee) =>
export const claimDelegatorRewards = async (mixId: number, fee?: FeeDetails) =>
invokeWrapper<TransactionExecuteResult[]>('claim_locked_and_unlocked_delegator_reward', {
mixId,
nodeId: mixId,
fee: fee?.fee,
});