This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from gnosis/development
WA-234 & WA-235 - Threshold modifications & Add owners
- Loading branch information
Showing
63 changed files
with
1,090 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// @flow | ||
jest.setTimeout(30000) | ||
jest.setTimeout(45000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// @flow | ||
import React from 'react' | ||
import Checkbox, { type CheckoxProps } from 'material-ui/Checkbox' | ||
|
||
class GnoCheckbox extends React.PureComponent<CheckoxProps> { | ||
render() { | ||
const { | ||
input: { | ||
checked, name, onChange, ...restInput | ||
}, | ||
meta, | ||
...rest | ||
} = this.props | ||
|
||
return ( | ||
<Checkbox | ||
{...rest} | ||
name={name} | ||
inputProps={restInput} | ||
onChange={onChange} | ||
checked={!!checked} | ||
/> | ||
) | ||
} | ||
} | ||
|
||
export default GnoCheckbox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// @flow | ||
import * as React from 'react' | ||
import Field from '~/components/forms/Field' | ||
import TextField from '~/components/forms/TextField' | ||
import Checkbox from '~/components/forms/Checkbox' | ||
import { composeValidators, required, mustBeEthereumAddress, uniqueAddress } from '~/components/forms/validator' | ||
import Block from '~/components/layout/Block' | ||
import Heading from '~/components/layout/Heading' | ||
|
||
export const CONFIRMATIONS_ERROR = 'Number of confirmations can not be higher than the number of owners' | ||
|
||
export const NAME_PARAM = 'name' | ||
export const OWNER_ADDRESS_PARAM = 'ownerAddress' | ||
export const INCREASE_PARAM = 'increase' | ||
|
||
export const safeFieldsValidation = (values: Object) => { | ||
const errors = {} | ||
|
||
if (Number.parseInt(values.owners, 10) < Number.parseInt(values.confirmations, 10)) { | ||
errors.confirmations = CONFIRMATIONS_ERROR | ||
} | ||
|
||
return errors | ||
} | ||
|
||
type Props = { | ||
numOwners: number, | ||
threshold: number, | ||
addresses: string[] | ||
} | ||
|
||
const AddOwnerForm = ({ addresses, numOwners, threshold }: Props) => () => ( | ||
<Block margin="md"> | ||
<Heading tag="h2" margin="lg"> | ||
Add Owner | ||
</Heading> | ||
<Heading tag="h4" margin="lg"> | ||
{`Actual number of owners: ${numOwners}, with threshold: ${threshold}`} | ||
</Heading> | ||
<Block margin="md"> | ||
<Field | ||
name={NAME_PARAM} | ||
component={TextField} | ||
type="text" | ||
validate={required} | ||
placeholder="Owner Name*" | ||
text="Owner Name*" | ||
/> | ||
</Block> | ||
<Block margin="md"> | ||
<Field | ||
name={OWNER_ADDRESS_PARAM} | ||
component={TextField} | ||
type="text" | ||
validate={composeValidators(required, mustBeEthereumAddress, uniqueAddress(addresses))} | ||
placeholder="Owner address*" | ||
text="Owner address*" | ||
/> | ||
</Block> | ||
<Block margin="md"> | ||
<Field | ||
name={INCREASE_PARAM} | ||
component={Checkbox} | ||
type="checkbox" | ||
/> | ||
<Block>Increase owner?</Block> | ||
</Block> | ||
</Block> | ||
) | ||
|
||
export default AddOwnerForm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// @flow | ||
import * as React from 'react' | ||
import { CircularProgress } from 'material-ui/Progress' | ||
import Block from '~/components/layout/Block' | ||
import Bold from '~/components/layout/Bold' | ||
import Heading from '~/components/layout/Heading' | ||
import Paragraph from '~/components/layout/Paragraph' | ||
import { NAME_PARAM, OWNER_ADDRESS_PARAM, INCREASE_PARAM } from '~/routes/safe/component/AddOwner/AddOwnerForm' | ||
|
||
type FormProps = { | ||
values: Object, | ||
submitting: boolean, | ||
} | ||
|
||
const spinnerStyle = { | ||
minHeight: '50px', | ||
} | ||
|
||
const Review = () => ({ values, submitting }: FormProps) => { | ||
const text = values[INCREASE_PARAM] | ||
? 'This operation will increase the threshold of the safe' | ||
: 'This operation will not modify the threshold of the safe' | ||
|
||
return ( | ||
<Block> | ||
<Heading tag="h2">Review the Add Owner operation</Heading> | ||
<Paragraph align="left"> | ||
<Bold>Owner Name: </Bold> {values[NAME_PARAM]} | ||
</Paragraph> | ||
<Paragraph align="left"> | ||
<Bold>Owner Address: </Bold> {values[OWNER_ADDRESS_PARAM]} | ||
</Paragraph> | ||
<Paragraph align="left"> | ||
<Bold>{text}</Bold> | ||
</Paragraph> | ||
<Block style={spinnerStyle}> | ||
{ submitting && <CircularProgress size={50} /> } | ||
</Block> | ||
</Block> | ||
) | ||
} | ||
|
||
export default Review |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// @flow | ||
import fetchTransactions from '~/routes/safe/store/actions/fetchTransactions' | ||
|
||
type FetchTransactions = typeof fetchTransactions | ||
|
||
export type Actions = { | ||
fetchTransactions: FetchTransactions, | ||
} | ||
|
||
export default { | ||
fetchTransactions, | ||
} |
Oops, something went wrong.