From 76ad4daededb483dfcb656d2a6f9bc7468d6ede6 Mon Sep 17 00:00:00 2001 From: arkpar Date: Tue, 14 Jul 2015 13:13:32 +0200 Subject: [PATCH] Allow 0x prefix for address entry in AZ --- alethzero/MainWin.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 60c07fd8d..6b0fc7989 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -638,18 +638,22 @@ pair Main::fromString(std::string const& _n) const if (_n == "(Create Contract)") return make_pair(Address(), bytes()); + std::string n = _n; + if (n.find_first_of("0x") == 0) + n.erase(0, 2); + auto g_newNameReg = getNameReg(); if (g_newNameReg) { - Address a = abiOut
(ethereum()->call(g_newNameReg, abiIn("addr(bytes32)", ::toString32(_n))).output); + Address a = abiOut
(ethereum()->call(g_newNameReg, abiIn("addr(bytes32)", ::toString32(n))).output); if (a) return make_pair(a, bytes()); } - if (_n.size() == 40) + if (n.size() == 40) { try { - return make_pair(Address(fromHex(_n, WhenError::Throw)), bytes()); + return make_pair(Address(fromHex(n, WhenError::Throw)), bytes()); } catch (BadHexCharacter& _e) { @@ -665,7 +669,7 @@ pair Main::fromString(std::string const& _n) const } else try { - return ICAP::decoded(_n).address([&](Address const& a, bytes const& b) -> bytes + return ICAP::decoded(n).address([&](Address const& a, bytes const& b) -> bytes { return ethereum()->call(a, b).output; }, g_newNameReg);