Fix condition in TX sent from safe-apps (#1037)

* fix condition

* add type
This commit is contained in:
nicolas 2020-06-22 11:12:03 -03:00 committed by GitHub
parent b02924f5ef
commit 2f46268fdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 11 deletions

View File

@ -3,7 +3,6 @@ import { BigNumber } from 'bignumber.js'
import React, { ReactElement } from 'react'
import styled from 'styled-components'
import { getWeb3 } from 'src/logic/wallets/getWeb3'
import AddressInfo from 'src/components/AddressInfo'
import DividerLine from 'src/components/DividerLine'
import Collapse from 'src/components/Collapse'
@ -55,17 +54,12 @@ const IconText = styled.div`
margin-right: 4px;
}
`
const isTxValid = (t): boolean => {
try {
if (!['string', 'number'].includes(typeof t.value)) {
return false
}
const isTxValid = (t: SafeAppTx): boolean => {
if (!['string', 'number'].includes(typeof t.value)) {
return false
}
if (typeof t.value === 'string') {
const web3 = getWeb3()
web3.eth.abi.decodeParameter('uint256', t.value)
}
} catch (error) {
if (typeof t.value === 'string' && !/^\d+$/.test(t.value)) {
return false
}