From 5342a482b5f5658f67f225747bc5f61dad9347e2 Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Thu, 9 Mar 2017 16:55:57 +0100 Subject: [PATCH] Fixes to the Registry dapp (#4838) * Fix wrong ABI methods * Fix --- js/src/dapps/registry/Lookup/actions.js | 17 ++++++++++++----- js/src/dapps/registry/Records/actions.js | 5 +++-- js/src/dapps/registry/ui/image.js | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/js/src/dapps/registry/Lookup/actions.js b/js/src/dapps/registry/Lookup/actions.js index 6f80fac0d..514039272 100644 --- a/js/src/dapps/registry/Lookup/actions.js +++ b/js/src/dapps/registry/Lookup/actions.js @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import { sha3 } from '../parity.js'; +import { api, sha3 } from '../parity.js'; import { getOwner } from '../util/registry'; export const clear = () => ({ type: 'lookup clear' }); @@ -34,14 +34,21 @@ export const lookup = (name, key) => (dispatch, getState) => { return; } - const getAddress = contract.functions - .find((f) => f.name === 'getAddress'); + const method = key === 'A' + ? contract.instance.getAddress + : contract.instance.getData; name = name.toLowerCase(); dispatch(lookupStart(name, key)); - getAddress.call({}, [ sha3.text(name), key ]) - .then((address) => dispatch(success('lookup', address))) + method.call({}, [ sha3.text(name), key ]) + .then((result) => { + if (key !== 'A') { + result = api.util.bytesToHex(result); + } + + dispatch(success('lookup', result)); + }) .catch((err) => { console.error(`could not lookup ${key} for ${name}`); if (err) { diff --git a/js/src/dapps/registry/Records/actions.js b/js/src/dapps/registry/Records/actions.js index 11c2ec405..9f0d1beff 100644 --- a/js/src/dapps/registry/Records/actions.js +++ b/js/src/dapps/registry/Records/actions.js @@ -46,8 +46,9 @@ export const update = (name, key, value) => (dispatch, getState) => { throw new Error(`you are not the owner of "${name}"`); } - const fnName = key === 'A' ? 'setAddress' : 'set'; - const method = contract.instance[fnName]; + const method = key === 'A' + ? contract.instance.setAddress + : contract.instance.setData || contract.instance.set; const options = { from: account.address diff --git a/js/src/dapps/registry/ui/image.js b/js/src/dapps/registry/ui/image.js index 1aee21457..3f0a90abe 100644 --- a/js/src/dapps/registry/ui/image.js +++ b/js/src/dapps/registry/ui/image.js @@ -34,7 +34,7 @@ export default (address) => { return ( {