verification: add mainnet BadgeReg ids (#4190)

* verification: mainnet BadgeReg ids

* verification: fetch contracts by name

* verification: better wording

* typo

* reregistered badges
This commit is contained in:
Jannis Redmann 2017-01-19 08:45:32 +01:00 committed by arkpar
parent 516e16a36b
commit ff3ae33d99
5 changed files with 40 additions and 5 deletions

View File

@ -73,6 +73,26 @@ export default class BadgeReg {
}); });
} }
fetchCertifierByName (name) {
return this
.getContract()
.then((badgeReg) => {
return badgeReg.instance.fromName.call({}, [ name ]);
})
.then(([ id, address, owner ]) => {
if (address === ZERO20) {
throw new Error(`Certifier ${name} does not exist.`);
}
return this.fetchMeta(id)
.then(({ title, icon }) => {
const data = { address, id, name, title, icon };
this.certifiers[id] = data;
return data;
});
});
}
fetchMeta (id) { fetchMeta (id) {
return this return this
.getContract() .getContract()

View File

@ -115,13 +115,26 @@ export default class GatherData extends Component {
if (!fee) { if (!fee) {
return (<p>Fetching the fee</p>); return (<p>Fetching the fee</p>);
} }
if (fee.eq(0)) {
return (
<div className={ styles.container }>
<InfoIcon />
<p className={ styles.message }>
<FormattedMessage
id='ui.verification.gatherData.nofee'
defaultMessage='There is no additional fee.'
/>
</p>
</div>
);
}
return ( return (
<div className={ styles.container }> <div className={ styles.container }>
<InfoIcon /> <InfoIcon />
<p className={ styles.message }> <p className={ styles.message }>
<FormattedMessage <FormattedMessage
id='ui.verification.gatherData.fee' id='ui.verification.gatherData.fee'
defaultMessage='The fee is {amount} ETH.' defaultMessage='The additional fee is {amount} ETH.'
values={ { values={ {
amount: fromWei(fee).toFixed(3) amount: fromWei(fee).toFixed(3)
} } } }

View File

@ -23,7 +23,8 @@ import VerificationStore, {
} from './store'; } from './store';
import { isServerRunning, postToServer } from '../../3rdparty/email-verification'; import { isServerRunning, postToServer } from '../../3rdparty/email-verification';
const EMAIL_VERIFICATION = 7; // id in the `BadgeReg.sol` contract // name in the `BadgeReg.sol` contract
const EMAIL_VERIFICATION = 'emailverification';
export default class EmailVerificationStore extends VerificationStore { export default class EmailVerificationStore extends VerificationStore {
@observable email = ''; @observable email = '';

View File

@ -23,7 +23,8 @@ import VerificationStore, {
} from './store'; } from './store';
import { isServerRunning, postToServer } from '../../3rdparty/sms-verification'; import { isServerRunning, postToServer } from '../../3rdparty/sms-verification';
const SMS_VERIFICATION = 0; // id in the `BadgeReg.sol` contract // name in the `BadgeReg.sol` contract
const SMS_VERIFICATION = 'smsverification';
export default class SMSVerificationStore extends VerificationStore { export default class SMSVerificationStore extends VerificationStore {
@observable number = ''; @observable number = '';

View File

@ -47,13 +47,13 @@ export default class VerificationStore {
@observable isCodeValid = null; @observable isCodeValid = null;
@observable confirmationTx = null; @observable confirmationTx = null;
constructor (api, abi, certifierId, account, isTestnet) { constructor (api, abi, certifierName, account, isTestnet) {
this.api = api; this.api = api;
this.account = account; this.account = account;
this.isTestnet = isTestnet; this.isTestnet = isTestnet;
this.step = LOADING; this.step = LOADING;
Contracts.get().badgeReg.fetchCertifier(certifierId) Contracts.get().badgeReg.fetchCertifierByName(certifierName)
.then(({ address }) => { .then(({ address }) => {
this.contract = new Contract(api, abi).at(address); this.contract = new Contract(api, abi).at(address);
this.load(); this.load();