Skip to content

Commit

Permalink
fix: 🐛 closes #37 input amount insert preceding 0 & fix validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jojobyte committed Feb 11, 2024
1 parent 9420124 commit 6aa694b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const PHRASE_REGEX = new RegExp(
)
export const AMOUNT_REGEX = new RegExp(
// /^[0-9]{1,5}?$/
/^[0-9]+(\.[0-9]{1,9})?%?$/
/^[0-9]+(\.[0-9]{1,8})?%?$/
)
export const ALIAS_REGEX = new RegExp(
/^[a-zA-Z0-9]{1,}([a-zA-Z0-9_.\-]+[a-zA-Z0-9])?$/
Expand Down
7 changes: 7 additions & 0 deletions src/rigs/send-or-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ export let sendOrReceiveRig = (async function (globals) {
}
event.target.reportValidity()

if (
event.target?.name === 'amount' &&
event.target.value.startsWith('.')
) {
event.target.value = `0${event.target.value}`
}

if (event.target?.name === 'to') {
if (
event.target.value &&
Expand Down

0 comments on commit 6aa694b

Please sign in to comment.