From 8a1fcefec3fdd8312775646af602fbbbe2aa8897 Mon Sep 17 00:00:00 2001 From: Brandon Curtis Date: Fri, 31 Jul 2020 15:54:51 -0700 Subject: [PATCH] magically hex TDT ID if given in decimal --- src/components/redemption/Start.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/redemption/Start.js b/src/components/redemption/Start.js index 55d893d3..ecf2a427 100644 --- a/src/components/redemption/Start.js +++ b/src/components/redemption/Start.js @@ -37,12 +37,17 @@ class Start extends Component { handleDepositAddressChange = (evt) => { const address = evt.target.value + const addressHexed = web3.utils.toHex(address) - const isValid = web3.utils.isAddress(address) - const hasError = ! isValid + const isValidAddr = web3.utils.isAddress(address) + const isValidAddrDecimal = web3.utils.isAddress(addressHexed) + const isValid = isValidAddr || isValidAddrDecimal + const addr = isValidAddrDecimal ? addressHexed : address + const hasError = ! isValid && ! isValidAddrDecimal + this.setState({ - depositAddress: address, + depositAddress: addr, depositAddressIsValid: isValid, depositAddressHasError: hasError })