WA-238 Fixing error of safes 1+ owners and threshold 1 when sending txs

This commit is contained in:
apanizo 2018-05-29 09:31:48 +02:00
parent a7076b9a1a
commit cfdbc8a761
4 changed files with 33 additions and 33 deletions

View File

@ -94,7 +94,8 @@ export const createTransaction = async (
const valueInWei = web3.toWei(txValue, 'ether')
const CALL = 0
if (hasOneOwner(safe)) {
const thresholdIsOne = safe.get('confirmations') === 1
if (hasOneOwner(safe) || thresholdIsOne) {
const txReceipt = await gnosisSafe.execTransactionIfApproved(txDestination, valueInWei, '0x', CALL, nonce, { from: user, gas: '5000000' })
const executedConfirmations: List<Confirmation> = buildExecutedConfirmationFrom(safe.get('owners'), user)
return storeTransaction(txName, nonce, txDestination, txValue, user, executedConfirmations, txReceipt.tx, safeAddress, safe.get('confirmations'))

View File

@ -21,6 +21,7 @@ const styles = {
type Props = Open & WithStyles & {
confirmations: List<Confirmation>,
threshold: number,
}
const GnoConfirmation = ({ owner, status, hash }: ConfirmationProps) => {
@ -45,35 +46,31 @@ const GnoConfirmation = ({ owner, status, hash }: ConfirmationProps) => {
}
const Confirmaitons = openHoc(({
open, toggle, confirmations,
}: Props) => {
const threshold = confirmations.count()
return (
<React.Fragment>
<ListItem onClick={toggle}>
<Avatar>
<Group />
</Avatar>
<ListItemText primary="Threshold" secondary={`${threshold} confirmation${threshold === 1 ? '' : 's'} needed`} />
<ListItemIcon>
{open ? <ExpandLess /> : <ExpandMore />}
</ListItemIcon>
</ListItem>
<Collapse in={open} timeout="auto" unmountOnExit>
<List component="div" disablePadding style={{ width: '100%' }}>
{confirmations.map(confirmation => (
<GnoConfirmation
key={confirmation.get('owner').get('address')}
owner={confirmation.get('owner')}
status={confirmation.get('status')}
hash={confirmation.get('hash')}
/>
))}
</List>
</Collapse>
</React.Fragment>
)
})
open, toggle, confirmations, threshold,
}: Props) => (
<React.Fragment>
<ListItem onClick={toggle}>
<Avatar>
<Group />
</Avatar>
<ListItemText primary="Threshold" secondary={`${threshold} confirmation${threshold === 1 ? '' : 's'} needed`} />
<ListItemIcon>
{open ? <ExpandLess /> : <ExpandMore />}
</ListItemIcon>
</ListItem>
<Collapse in={open} timeout="auto" unmountOnExit>
<List component="div" disablePadding style={{ width: '100%' }}>
{confirmations.map(confirmation => (
<GnoConfirmation
key={confirmation.get('owner').get('address')}
owner={confirmation.get('owner')}
status={confirmation.get('status')}
hash={confirmation.get('hash')}
/>
))}
</List>
</Collapse>
</React.Fragment>
))
export default withStyles(styles)(Confirmaitons)

View File

@ -15,6 +15,7 @@ type Props = {
safeName: string,
confirmations: ImmutableList<Confirmation>,
destination: string,
threshold: number,
}
const listStyle = {
@ -24,7 +25,7 @@ const listStyle = {
class Collapsed extends React.PureComponent<Props, {}> {
render() {
const {
confirmations, destination, safeName,
confirmations, destination, safeName, threshold,
} = this.props
return (
@ -35,7 +36,7 @@ class Collapsed extends React.PureComponent<Props, {}> {
<Avatar><Group /></Avatar>
<ListItemText primary={safeName} secondary="Safe Name" />
</ListItem>
<Confirmations confirmations={confirmations} />
<Confirmations confirmations={confirmations} threshold={threshold} />
<ListItem>
<Avatar><MailOutline /></Avatar>
<ListItemText primary="Destination" secondary={destination} />

View File

@ -82,6 +82,7 @@ class GnoTransaction extends React.PureComponent<Props, {}> {
safeName={safeName}
confirmations={transaction.get('confirmations')}
destination={transaction.get('destination')}
threshold={transaction.get('threshold')}
/> }
<Hairline />
</React.Fragment>