Skip to content

Commit

Permalink
Create a hook for min stake amount
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska committed Apr 9, 2024
1 parent 45d58fd commit 88f96d8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import React from "react"
import TokenAmountForm from "#/components/shared/TokenAmountForm"
import { TokenAmountFormValues } from "#/components/shared/TokenAmountForm/TokenAmountFormBase"
import { useAppSelector, useWalletContext } from "#/hooks"
import { useMinStakeAmount, useWalletContext } from "#/hooks"
import { FormSubmitButton } from "#/components/shared/Form"
import { selectMinStakeAmount } from "#/store/btc"
import StakeDetails from "./StakeDetails"

function StakeFormModal({
onSubmitForm,
}: {
onSubmitForm: (values: TokenAmountFormValues) => void
}) {
const minStakeAmount = useAppSelector(selectMinStakeAmount)
const minStakeAmount = useMinStakeAmount()
const { btcAccount } = useWalletContext()
const tokenBalance = btcAccount?.balance.toString() ?? "0"

Expand Down
1 change: 1 addition & 0 deletions dapp/src/hooks/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from "./useAppDispatch"
export * from "./useAppSelector"
export * from "./useEstimatedBTCBalance"
export * from "./useSharesBalance"
export * from "./useMinStakeAmount"
6 changes: 6 additions & 0 deletions dapp/src/hooks/store/useMinStakeAmount.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { selectMinStakeAmount } from "#/store/btc"
import { useAppSelector } from "./useAppSelector"

export function useMinStakeAmount() {
return useAppSelector(selectMinStakeAmount)
}

0 comments on commit 88f96d8

Please sign in to comment.