Skip to content

Commit

Permalink
Send commitment tx successfully!
Browse files Browse the repository at this point in the history
  • Loading branch information
theref committed Dec 5, 2023
1 parent 6f48c4f commit 3190b11
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 27 deletions.
42 changes: 15 additions & 27 deletions src/components/Modal/TACoCommitmentModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,26 @@ 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<TACoCommitProps> = ({
stakingProvider,
closeModal,
}) => {
const [value, setValue] = useState("")
const threshold = useThreshold()
const { sendTransaction } = useSendTransactionFromFn(
threshold.multiAppStaking[stakingAppNameToThresholdAppService["taco"]]
.makeCommitment
)

const submitCommitment = async (stakingProvider: string, choice: string) => {
console.log("submitting commitment")
console.log(stakingProvider)
console.log(parseInt(choice))
sendTransaction(stakingProvider, parseInt(choice))
}

return (
<>
<ModalHeader>TACo App Commitment</ModalHeader>
Expand All @@ -74,32 +76,18 @@ const TACoCommitmentModal: FC<TACoCommitProps> = ({
<Tbody>
<Tr>
<Td>
<Radio value="0" />
<Radio value="15724800" />
</Td>
<Td>9 months</Td>
<Td>0.5%</Td>
</Tr>
<Tr>
<Td>
<Radio value="1" />
<Radio value="31449600" />
</Td>
<Td>12 months</Td>
<Td>1%</Td>
</Tr>
<Tr>
<Td>
<Radio value="2" />
</Td>
<Td>18 months</Td>
<Td>2%</Td>
</Tr>
<Tr>
<Td>
<Radio value="3" />
</Td>
<Td>24 months</Td>
<Td>3%</Td>
</Tr>
</Tbody>
</Table>
</RadioGroup>
Expand Down
5 changes: 5 additions & 0 deletions src/threshold-ts/applications/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ export interface IApplication {
operatorToStakingProvider(operator: string): Promise<string>

updateOperatorStatus(operator: string): Promise<ContractTransaction>

makeCommitment(
stakingProvider: string,
commitmentDuration: number
): Promise<ContractTransaction>
}

export class Application implements IApplication {
Expand Down

0 comments on commit 3190b11

Please sign in to comment.