Skip to content

Commit

Permalink
Fix error message for withdraw form
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska committed Nov 7, 2024
1 parent b3310fa commit d697770
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dapp/src/constants/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export const TOKEN_FORM_ERRORS = {
REQUIRED: "Please enter an amount.",
EXCEEDED_VALUE:
"The amount exceeds your current wallet balance. Add more funds to your wallet or lower the deposit amount.",
INSUFFICIENT_VALUE: (minValue: string) =>
`The amount is below the minimum required deposit of ${minValue} BTC.`,
INSUFFICIENT_VALUE: (formType: string, minValue: string) =>
`The amount is below the minimum required ${formType} of ${minValue} BTC.`,
}

export const PASSWORD_FORM_ERRORS = {
Expand Down
3 changes: 2 additions & 1 deletion dapp/src/utils/forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
TOKEN_FORM_ERRORS,
} from "#/constants"
import sentry from "#/sentry"
import { ActionFlowType, CurrencyType } from "#/types"
import { ACTION_FLOW_TYPES, ActionFlowType, CurrencyType } from "#/types"
import acreApi from "./acreApi"
import { getCurrencyByType } from "./currency"
import { fixedPointNumberToString } from "./numbers"
Expand Down Expand Up @@ -52,6 +52,7 @@ export function validateTokenAmount(
if (isMaximumValueExceeded) return ERRORS_BY_ACTION_TYPE.EXCEEDED_VALUE
if (!isMinimumValueFulfilled)
return ERRORS_BY_ACTION_TYPE.INSUFFICIENT_VALUE(
actionType === ACTION_FLOW_TYPES.STAKE ? "deposit" : "withdraw",
fixedPointNumberToString(minValue, decimals),
)

Expand Down

0 comments on commit d697770

Please sign in to comment.