Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParaTimes: fix Consensus amount not representable bug #1346

Merged
merged 1 commit into from
Mar 23, 2023
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
8 changes: 4 additions & 4 deletions src/app/pages/ParaTimesPage/TransactionAmount/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const TransactionAmount = () => {
const {
balance,
balanceInBaseUnit,
decimals,
consensusDecimals,
isDepositing,
isEvmcParaTime,
isLoading,
Expand Down Expand Up @@ -92,12 +92,12 @@ export const TransactionAmount = () => {
required
validate={[
(amount: string) =>
!new RegExp(`^\\d*(?:[.][0-9]{0,${decimals}})?$`).test(amount)
!new RegExp(`^\\d*(?:[.][0-9]{0,${consensusDecimals}})?$`).test(amount)
? {
message: t(
'paraTimes.validation.invalidDecimalValue',
'Maximum of {{token}} decimal places is allowed',
{ token: decimals },
'Maximum of {{decimals}} decimal places is allowed',
{ decimals: consensusDecimals },
),
status: 'error',
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/pages/ParaTimesPage/useParaTimes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type ParaTimesHook = {
balance: StringifiedBigInt | null
balanceInBaseUnit: boolean
clearTransactionForm: () => void
consensusDecimals: number
decimals: number
isDepositing: boolean
isEvmcParaTime: boolean
Expand Down Expand Up @@ -99,6 +100,7 @@ export const useParaTimes = (): ParaTimesHook => {
balance: walletBalance,
balanceInBaseUnit,
clearTransactionForm,
consensusDecimals,
decimals,
isDepositing,
isEvmcParaTime,
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
},
"unsupportedFormStep": "Unsupported form step",
"validation": {
"invalidDecimalValue": "Maximum of {{token}} decimal places is allowed",
"invalidDecimalValue": "Maximum of {{decimals}} decimal places is allowed",
"invalidEthPrivateKey": "Ethereum-compatible private key is invalid",
"invalidEthPrivateKeyLength": "Private key should be 64 characters long",
"invalidFee": "Value must be integer greater than or equal to 0",
Expand Down