mirror of
https://github.com/status-im/safe-react.git
synced 2025-02-17 12:07:09 +00:00
Fix condition in TX sent from safe-apps (#1037)
* fix condition * add type
This commit is contained in:
parent
b02924f5ef
commit
2f46268fdf
@ -3,7 +3,6 @@ import { BigNumber } from 'bignumber.js'
|
|||||||
import React, { ReactElement } from 'react'
|
import React, { ReactElement } from 'react'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
|
|
||||||
import { getWeb3 } from 'src/logic/wallets/getWeb3'
|
|
||||||
import AddressInfo from 'src/components/AddressInfo'
|
import AddressInfo from 'src/components/AddressInfo'
|
||||||
import DividerLine from 'src/components/DividerLine'
|
import DividerLine from 'src/components/DividerLine'
|
||||||
import Collapse from 'src/components/Collapse'
|
import Collapse from 'src/components/Collapse'
|
||||||
@ -55,17 +54,12 @@ const IconText = styled.div`
|
|||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
const isTxValid = (t): boolean => {
|
const isTxValid = (t: SafeAppTx): boolean => {
|
||||||
try {
|
if (!['string', 'number'].includes(typeof t.value)) {
|
||||||
if (!['string', 'number'].includes(typeof t.value)) {
|
return false
|
||||||
return false
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof t.value === 'string') {
|
if (typeof t.value === 'string' && !/^\d+$/.test(t.value)) {
|
||||||
const web3 = getWeb3()
|
|
||||||
web3.eth.abi.decodeParameter('uint256', t.value)
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user