diff --git a/src/components/Modal/TACoCommitmentModal/index.tsx b/src/components/Modal/TACoCommitmentModal/index.tsx index c6ba530ed..f77cf8beb 100644 --- a/src/components/Modal/TACoCommitmentModal/index.tsx +++ b/src/components/Modal/TACoCommitmentModal/index.tsx @@ -1,35 +1,133 @@ -import { FC } from "react" +import { FC, useState } from "react" import { + AlertBox, BodyLg, + BodyXs, Button, - Card, - H5, ModalBody, ModalFooter, ModalHeader, - LabelSm, - BodyMd, - List, - ListItem, + Radio, + RadioGroup, + Table, + TableContainer, + Tbody, + Td, + Th, + Thead, + Tr, } from "@threshold-network/components" import TransactionSuccessModal from "../TransactionSuccessModal" -import StakingStats from "../../StakingStats" import InfoBox from "../../InfoBox" import { BaseModalProps } from "../../../types" -import { StakeData } from "../../../types/staking" import withBaseModal from "../withBaseModal" -import { UnstakeType, ExternalHref } from "../../../enums" -import Link from "../../Link" -import ModalCloseButton from "../ModalCloseButton" +import { + OnErrorCallback, + OnSuccessCallback, + useSendTransactionFromFn, +} from "../../../web3/hooks" +import { useThreshold } from "../../../contexts/ThresholdContext" +import { stakingAppNameToThresholdAppService } from "../../../hooks/staking-applications/useStakingAppContract" export type TACoCommitProps = BaseModalProps & { stakingProvider: string } +const submitCommitment = async (stakingProvider: string, choice: string) => { + console.log("submitting commitment") + console.log(stakingProvider) + console.log(parseInt(choice)) + const threshold = useThreshold() + useSendTransactionFromFn( + threshold.multiAppStaking[stakingAppNameToThresholdAppService["taco"]] + .approveAuthorizationDecrease + ) +} + // TACo Commitment Modal // has two buttons, one for committing and one for canceling -const TACoCommitmentModal: FC = ({}) => { - return {/* Header */} +const TACoCommitmentModal: FC = ({ + stakingProvider, + closeModal, +}) => { + const [value, setValue] = useState("") + return ( + <> + TACo App Commitment + + + + You have the option of locking up your tokens for longer durations + in order to receive a yield bonus of corresponding size. There are 4 + choices: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Lock-up DurationYield Bonus
+ + 9 months0.5%
+ + 12 months1%
+ + 18 months2%
+ + 24 months3%
+
+ + + Note that these durations include the obligatory and universal 6 + month deauthorization delay. + + +
+ + + + + + ) } export default withBaseModal(TACoCommitmentModal) diff --git a/src/threshold-ts/applications/index.ts b/src/threshold-ts/applications/index.ts index 347fbf0cf..16a6dbdaf 100644 --- a/src/threshold-ts/applications/index.ts +++ b/src/threshold-ts/applications/index.ts @@ -414,6 +414,16 @@ export class Application implements IApplication { return await this._application.bondOperator(stakingProvider, operator) } + makeCommitment = async ( + stakingProvider: string, + commitmentDuration: number + ): Promise => { + return await this._application.makeCommitment( + stakingProvider, + commitmentDuration + ) + } + stakingProviderToOperator = async ( stakingProvider: string ): Promise => {