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 Gav Wood
parent 24aec5191a
commit b9031953e0
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) {
return this
.getContract()

View File

@ -115,13 +115,26 @@ export default class GatherData extends Component {
if (!fee) {
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 (
<div className={ styles.container }>
<InfoIcon />
<p className={ styles.message }>
<FormattedMessage
id='ui.verification.gatherData.fee'
defaultMessage='The fee is {amount} ETH.'
defaultMessage='The additional fee is {amount} ETH.'
values={ {
amount: fromWei(fee).toFixed(3)
} }

View File

@ -23,7 +23,8 @@ import VerificationStore, {
} from './store';
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 {
@observable email = '';

View File

@ -23,7 +23,8 @@ import VerificationStore, {
} from './store';
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 {
@observable number = '';

View File

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