certification: use BadgeReg to load the contract
This commit is contained in:
parent
452b8c9c74
commit
c249c51dd3
@ -17,6 +17,7 @@
|
|||||||
import { observable, computed, action } from 'mobx';
|
import { observable, computed, action } from 'mobx';
|
||||||
import { sha3 } from '~/api/util/sha3';
|
import { sha3 } from '~/api/util/sha3';
|
||||||
|
|
||||||
|
import EmailVerificationABI from '~/contracts/abi/email-verification.json';
|
||||||
import VerificationStore, {
|
import VerificationStore, {
|
||||||
LOADING, QUERY_DATA, QUERY_CODE, POSTED_CONFIRMATION, DONE
|
LOADING, QUERY_DATA, QUERY_CODE, POSTED_CONFIRMATION, DONE
|
||||||
} from './store';
|
} from './store';
|
||||||
@ -53,7 +54,7 @@ export default class EmailVerificationStore extends VerificationStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor (api, account, isTestnet) {
|
constructor (api, account, isTestnet) {
|
||||||
super(api, account, isTestnet, 'emailverification3');
|
super(api, EmailVerificationABI, 'emailverification3', account, isTestnet);
|
||||||
}
|
}
|
||||||
|
|
||||||
requestValues = () => [ sha3(this.email) ]
|
requestValues = () => [ sha3(this.email) ]
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import { observable, computed, action } from 'mobx';
|
import { observable, computed, action } from 'mobx';
|
||||||
import phone from 'phoneformat.js';
|
import phone from 'phoneformat.js';
|
||||||
|
|
||||||
|
import SMSVerificationABI from '~/contracts/abi/sms-verification.json';
|
||||||
import VerificationStore, {
|
import VerificationStore, {
|
||||||
LOADING, QUERY_DATA, QUERY_CODE, POSTED_CONFIRMATION, DONE
|
LOADING, QUERY_DATA, QUERY_CODE, POSTED_CONFIRMATION, DONE
|
||||||
} from './store';
|
} from './store';
|
||||||
@ -52,7 +53,7 @@ export default class SMSVerificationStore extends VerificationStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor (api, account, isTestnet) {
|
constructor (api, account, isTestnet) {
|
||||||
super(api, account, isTestnet, 'smsverification');
|
super(api, SMSVerificationABI, 'smsverification', account, isTestnet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@action setNumber = (number) => {
|
@action setNumber = (number) => {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
import { observable, autorun, action } from 'mobx';
|
import { observable, autorun, action } from 'mobx';
|
||||||
import { sha3 } from '~/api/util/sha3';
|
import { sha3 } from '~/api/util/sha3';
|
||||||
|
import Contract from '~/api/contract';
|
||||||
import Contracts from '~/contracts';
|
import Contracts from '~/contracts';
|
||||||
|
|
||||||
import { checkIfVerified, checkIfRequested, awaitPuzzle } from '~/contracts/verification';
|
import { checkIfVerified, checkIfRequested, awaitPuzzle } from '~/contracts/verification';
|
||||||
@ -46,18 +47,19 @@ export default class VerificationStore {
|
|||||||
@observable isCodeValid = null;
|
@observable isCodeValid = null;
|
||||||
@observable confirmationTx = null;
|
@observable confirmationTx = null;
|
||||||
|
|
||||||
constructor (api, account, isTestnet, name) {
|
constructor (api, abi, name, 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().registry.getContract(name)
|
Contracts.get().badgeReg.fetchCertifier(name)
|
||||||
.then((contract) => {
|
.then(({ address }) => {
|
||||||
this.contract = contract;
|
this.contract = new Contract(api, abi).at(address);
|
||||||
this.load();
|
this.load();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
console.error('error', err);
|
||||||
this.error = 'Failed to fetch the contract: ' + err.message;
|
this.error = 'Failed to fetch the contract: ' + err.message;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user