Skip to content

Commit

Permalink
fix: show input error if chosen nonce is not an integer (#3609)
Browse files Browse the repository at this point in the history
* fix: show input error if chosen nonce is not an integer

* Change error message to be more understandable
  • Loading branch information
jmealy authored Apr 29, 2024
1 parent 7e19830 commit dd593da
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/tx-flow/common/TxNonce/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ enum ErrorMessages {
NONCE_TOO_HIGH = 'Nonce is too high',
NONCE_TOO_FAR = 'Nonce is much higher than the current nonce',
NONCE_GT_RECOMMENDED = 'Nonce is higher than the recommended nonce',
NONCE_MUST_BE_INTEGER = "Nonce can't contain decimals",
}

const MAX_NONCE_DIFFERENCE = 100
Expand Down Expand Up @@ -168,6 +169,10 @@ const TxNonceForm = ({ nonce, recommendedNonce }: { nonce: string; recommendedNo
return ErrorMessages.NONCE_TOO_HIGH
}

if (!Number.isInteger(newNonce)) {
return ErrorMessages.NONCE_MUST_BE_INTEGER
}

// Update context with valid nonce
setNonce(newNonce)
},
Expand Down

0 comments on commit dd593da

Please sign in to comment.