From cfdbc8a76115780b5a00cbf4b74f7aee212352b6 Mon Sep 17 00:00:00 2001 From: apanizo Date: Tue, 29 May 2018 09:31:48 +0200 Subject: [PATCH] WA-238 Fixing error of safes 1+ owners and threshold 1 when sending txs --- .../AddTransaction/createTransactions.js | 3 +- .../Transactions/Collapsed/Confirmations.jsx | 57 +++++++++---------- .../Transactions/Collapsed/index.jsx | 5 +- .../Transactions/Transaction/index.jsx | 1 + 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/routes/safe/component/AddTransaction/createTransactions.js b/src/routes/safe/component/AddTransaction/createTransactions.js index f13db071..aa7fb298 100644 --- a/src/routes/safe/component/AddTransaction/createTransactions.js +++ b/src/routes/safe/component/AddTransaction/createTransactions.js @@ -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 = buildExecutedConfirmationFrom(safe.get('owners'), user) return storeTransaction(txName, nonce, txDestination, txValue, user, executedConfirmations, txReceipt.tx, safeAddress, safe.get('confirmations')) diff --git a/src/routes/safe/component/Transactions/Collapsed/Confirmations.jsx b/src/routes/safe/component/Transactions/Collapsed/Confirmations.jsx index 8822cffb..0b79b3d7 100644 --- a/src/routes/safe/component/Transactions/Collapsed/Confirmations.jsx +++ b/src/routes/safe/component/Transactions/Collapsed/Confirmations.jsx @@ -21,6 +21,7 @@ const styles = { type Props = Open & WithStyles & { confirmations: List, + 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 ( - - - - - - - - {open ? : } - - - - - {confirmations.map(confirmation => ( - - ))} - - - - ) -}) + open, toggle, confirmations, threshold, +}: Props) => ( + + + + + + + + {open ? : } + + + + + {confirmations.map(confirmation => ( + + ))} + + + +)) export default withStyles(styles)(Confirmaitons) diff --git a/src/routes/safe/component/Transactions/Collapsed/index.jsx b/src/routes/safe/component/Transactions/Collapsed/index.jsx index 21761f47..b92a0635 100644 --- a/src/routes/safe/component/Transactions/Collapsed/index.jsx +++ b/src/routes/safe/component/Transactions/Collapsed/index.jsx @@ -15,6 +15,7 @@ type Props = { safeName: string, confirmations: ImmutableList, destination: string, + threshold: number, } const listStyle = { @@ -24,7 +25,7 @@ const listStyle = { class Collapsed extends React.PureComponent { render() { const { - confirmations, destination, safeName, + confirmations, destination, safeName, threshold, } = this.props return ( @@ -35,7 +36,7 @@ class Collapsed extends React.PureComponent { - + diff --git a/src/routes/safe/component/Transactions/Transaction/index.jsx b/src/routes/safe/component/Transactions/Transaction/index.jsx index be4a18d5..5d5650f4 100644 --- a/src/routes/safe/component/Transactions/Transaction/index.jsx +++ b/src/routes/safe/component/Transactions/Transaction/index.jsx @@ -82,6 +82,7 @@ class GnoTransaction extends React.PureComponent { safeName={safeName} confirmations={transaction.get('confirmations')} destination={transaction.get('destination')} + threshold={transaction.get('threshold')} /> }