Fixes to the Registry dapp (#4838)

* Fix wrong ABI methods

* Fix
This commit is contained in:
Nicolas Gotchac 2017-03-09 16:55:57 +01:00 committed by Jaco Greeff
parent ea020948fc
commit 5342a482b5
3 changed files with 16 additions and 8 deletions

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
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) {

View File

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

View File

@ -34,7 +34,7 @@ export default (address) => {
return (
<img
src={ `${parityNode}/${address}/` }
src={ `${parityNode}/api/content/${address.replace(/^0x/, '')}` }
alt={ address }
style={ styles }
/>