diff --git a/ui/src/components/ValidatorTable.tsx b/ui/src/components/ValidatorTable.tsx index 08270f3b..85bf0278 100644 --- a/ui/src/components/ValidatorTable.tsx +++ b/ui/src/components/ValidatorTable.tsx @@ -116,7 +116,7 @@ export function ValidatorTable({ validators, stakesByValidator }: ValidatorTable notation: 'compact', }).format(currentStake) - const maxStake = calculateMaxStake(validator, constraints!, true) + const maxStake = calculateMaxStake(validator, constraints, true) const maxStakeCompact = new Intl.NumberFormat(undefined, { notation: 'compact', }).format(maxStake) diff --git a/ui/src/utils/contracts.ts b/ui/src/utils/contracts.ts index 71843961..550a497d 100644 --- a/ui/src/utils/contracts.ts +++ b/ui/src/utils/contracts.ts @@ -380,10 +380,13 @@ export function getAddValidatorFormSchema(constraints: Constraints) { export function calculateMaxStake( validator: Validator, - constraints: Constraints, + constraints?: Constraints, algos = false, ): number { const { numPools } = validator.state + if (numPools === 0 || !constraints) { + return 0 + } const hardMaxDividedBetweenPools = constraints.maxAlgoPerValidator / BigInt(numPools) let { maxAlgoPerPool } = validator.config if (maxAlgoPerPool === 0n) {