Auto-detect hex encoded bytes in sha3 (#4108)
* Auto-detect hex encoded bytes in sha3 * Using types/isHex * Removing unused imports
This commit is contained in:
@@ -68,13 +68,13 @@ const STORE = {
|
||||
};
|
||||
|
||||
function createApi (result = true) {
|
||||
const sha3 = sinon.stub().resolves('0x0000000000000000000000000000000000000000');
|
||||
sha3.text = sha3;
|
||||
return {
|
||||
parity: {
|
||||
registryAddress: sinon.stub().resolves('0x0000000000000000000000000000000000000000')
|
||||
},
|
||||
util: {
|
||||
sha3: sinon.stub().resolves('0x0000000000000000000000000000000000000000')
|
||||
}
|
||||
util: { sha3 }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ export default class EmailVerificationStore extends VerificationStore {
|
||||
super(api, EmailVerificationABI, EMAIL_VERIFICATION, account, isTestnet);
|
||||
}
|
||||
|
||||
requestValues = () => [ sha3(this.email) ]
|
||||
requestValues = () => [ sha3.text(this.email) ]
|
||||
|
||||
@action setEmail = (email) => {
|
||||
this.email = email;
|
||||
|
||||
@@ -120,7 +120,7 @@ export default class VerificationStore {
|
||||
|
||||
const confirm = contract.functions.find((fn) => fn.name === 'confirm');
|
||||
const options = { from: account };
|
||||
const values = [ sha3(code) ];
|
||||
const values = [ sha3.text(code) ];
|
||||
|
||||
this.code = code;
|
||||
this.isCodeValid = null;
|
||||
@@ -192,7 +192,7 @@ export default class VerificationStore {
|
||||
|
||||
@action sendConfirmation = () => {
|
||||
const { api, account, contract, code } = this;
|
||||
const token = sha3(code);
|
||||
const token = sha3.text(code);
|
||||
|
||||
const confirm = contract.functions.find((fn) => fn.name === 'confirm');
|
||||
const options = { from: account };
|
||||
|
||||
Reference in New Issue
Block a user