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

@@ -39,7 +39,7 @@ export const lookup = (name, key) => (dispatch, getState) => {
name = name.toLowerCase();
dispatch(lookupStart(name, key));
getAddress.call({}, [ sha3(name), key ])
getAddress.call({}, [ sha3.text(name), key ])
.then((address) => dispatch(success('lookup', address)))
.catch((err) => {
console.error(`could not lookup ${key} for ${name}`);

View File

@@ -62,7 +62,7 @@ export const reserve = (name) => (dispatch, getState) => {
value: fee
};
const values = [
sha3(name)
sha3.text(name)
];
return postTx(api, reserve, options, values);
@@ -116,7 +116,7 @@ export const drop = (name) => (dispatch, getState) => {
};
const values = [
sha3(name)
sha3.text(name)
];
return postTx(api, drop, options, values);

View File

@@ -54,7 +54,7 @@ export const update = (name, key, value) => (dispatch, getState) => {
};
const values = [
sha3(name),
sha3.text(name),
key,
value
];

View File

@@ -17,7 +17,7 @@
export const getOwner = (contract, name) => {
const { address, api } = contract;
const key = api.util.sha3(name) + '0000000000000000000000000000000000000000000000000000000000000001';
const key = api.util.sha3.text(name) + '0000000000000000000000000000000000000000000000000000000000000001';
const position = api.util.sha3(key, { encoding: 'hex' });
return api