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:
Tomasz Drwięga
2017-01-10 18:56:56 +01:00
committed by Gav Wood
parent 23feb7998f
commit 7aa2af3e21
14 changed files with 40 additions and 16 deletions

View File

@@ -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 }
};
}

View File

@@ -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;

View File

@@ -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 };