Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/app/routes/join/operator/register-operator-confirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { getOperatorQueryOptions } from "@/hooks/operator/use-operator";
import { withTransactionModal } from "@/lib/contract-interactions/utils/useWaitForTransactionReceipt";
import { useRegisterOperator } from "@/lib/contract-interactions/write/use-register-operator";
import { queryClient } from "@/lib/react-query";
import { roundOperatorFee } from "@/lib/utils/bigint";
import { formatBigintInput } from "@/lib/utils/number";
import { bigintMin, roundOperatorFee } from "@/lib/utils/bigint";
import { formatBigintInput, ms } from "@/lib/utils/number";
import { createDefaultOperator } from "@/lib/utils/operator";
import { shortenAddress } from "@/lib/utils/strings";
import { type FC } from "react";
Expand All @@ -22,19 +22,27 @@ import { encodeAbiParameters, parseAbiParameters } from "viem";
import { useAccount } from "@/hooks/account/use-account";
import { useRegisterOperatorContext } from "@/guard/register-operator-guards";
import { track } from "@/lib/analytics/mixpanel";
import { useGetMaximumOperatorFee } from "@/lib/contract-interactions/hooks/getter";

export const RegisterOperatorConfirmation: FC = () => {
const navigate = useNavigate();

const { address } = useAccount();
const { publicKey, yearlyFee, isPrivate } = useRegisterOperatorContext();

const { data: maxFee = 0n } = useGetMaximumOperatorFee({
staleTime: ms(1, "days"),
});

const register = useRegisterOperator();

const submit = () => {
const createOperatorArgs = {
setPrivate: isPrivate,
fee: roundOperatorFee(yearlyFee / globals.BLOCKS_PER_YEAR),
fee: bigintMin(
roundOperatorFee(yearlyFee / globals.BLOCKS_PER_YEAR),
maxFee,
),
publicKey: encodeAbiParameters(parseAbiParameters("string"), [publicKey]),
};

Expand Down
10 changes: 5 additions & 5 deletions src/app/routes/join/operator/set-operator-fee.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ export const SetOperatorFee: FC<ComponentPropsWithoutRef<"div">> = () => {
const rates = useRates();

const { data: minFee = 0n } = useGetMinimumOperatorEthFee({
staleTime: ms(1, "weeks"),
staleTime: ms(1, "days"),
});

const { data: maxFee = 0n } = useGetMaximumOperatorFee({
staleTime: ms(1, "days"),
});
const { data: maxFee = 13900000000n /* value from the contract */ } =
useGetMaximumOperatorFee({
staleTime: ms(1, "weeks"),
});

const minYearlyFee = getYearlyFee(minFee);
const minYearlyFeeFormatted = getYearlyFee(minFee, { format: true });
Expand Down