Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Make sure Token is ECR20 #3347

Merged
merged 2 commits into from
Nov 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export default class AccountSelector extends Component {
static propTypes = {
list: PropTypes.array.isRequired,
selected: PropTypes.object.isRequired,
handleSetSelected: PropTypes.func.isRequired
handleSetSelected: PropTypes.func.isRequired,
onAccountChange: PropTypes.func
};

state = {
Expand All @@ -85,7 +86,8 @@ export default class AccountSelector extends Component {
nestedItems={ nestedAccounts }
open={ this.state.open }
onSelectAccount={ this.onToggleOpen }
autoGenerateNestedIndicator={ false } />
autoGenerateNestedIndicator={ false }
nestedListStyle={ { maxHeight: '14em', overflow: 'auto' } } />
);

return (
Expand All @@ -110,6 +112,10 @@ export default class AccountSelector extends Component {

onToggleOpen = () => {
this.setState({ open: !this.state.open });

if (typeof this.props.onAccountChange === 'function') {
this.props.onAccountChange();
}
}

onSelectAccount = (address) => {
Expand Down
10 changes: 9 additions & 1 deletion js/src/dapps/tokenreg/Actions/Register/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default class RegisterAction extends Component {
className={ styles.dialog }
onRequestClose={ this.onClose }
actions={ this.renderActions() }
ref='dialog'
autoScrollBodyContent
>
{ this.renderContent() }
Expand Down Expand Up @@ -149,7 +150,9 @@ export default class RegisterAction extends Component {
renderForm () {
return (
<div>
<AccountSelector />
<AccountSelector
onAccountChange={ this.onAccountChange }
/>
{ this.renderInputs() }
</div>
);
Expand All @@ -175,6 +178,11 @@ export default class RegisterAction extends Component {
});
}

onAccountChange = () => {
const { dialog } = this.refs;
dialog.forceUpdate();
}

onChange (fieldKey, valid, value) {
const { fields } = this.state;
const field = fields[fieldKey];
Expand Down
2 changes: 1 addition & 1 deletion js/src/dapps/tokenreg/Inputs/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const validateTokenAddress = (address, contract, simple) => {

return getTokenTotalSupply(address)
.then(balance => {
if (balance === null) {
if (balance === null || balance.equals(0)) {
return {
error: ERRORS.invalidTokenAddress,
valid: false
Expand Down