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

Commit

Permalink
verification: add mainnet BadgeReg ids (#4190)
Browse files Browse the repository at this point in the history
* verification: mainnet BadgeReg ids

* verification: fetch contracts by name

* verification: better wording

* typo

* reregistered badges
  • Loading branch information
derhuerst authored and arkpar committed Jan 19, 2017
1 parent 516e16a commit ff3ae33
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
20 changes: 20 additions & 0 deletions js/src/contracts/badgereg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
15 changes: 14 additions & 1 deletion js/src/modals/Verification/GatherData/gatherData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
} }
Expand Down
3 changes: 2 additions & 1 deletion js/src/modals/Verification/email-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down
3 changes: 2 additions & 1 deletion js/src/modals/Verification/sms-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down
4 changes: 2 additions & 2 deletions js/src/modals/Verification/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit ff3ae33

Please sign in to comment.