|
@ -228,25 +228,19 @@ byte toByte(json_spirit::mValue const& _v) |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bytes importByteArray(const std::string& str) |
|
|
bytes importByteArray(std::string const& _str) |
|
|
{ |
|
|
{ |
|
|
bytes data; |
|
|
return fromHex(_str.substr(0, 2) == "0x" ? _str.substr(2) : _str); |
|
|
if (str.find_first_of("0x") == 0) |
|
|
|
|
|
data = fromHex(str.substr(2)); |
|
|
|
|
|
else |
|
|
|
|
|
data = fromHex(str); |
|
|
|
|
|
return data; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bytes importData(json_spirit::mObject& _o) |
|
|
bytes importData(json_spirit::mObject& _o) |
|
|
{ |
|
|
{ |
|
|
bytes data; |
|
|
bytes data; |
|
|
if (_o["data"].type() == json_spirit::str_type) |
|
|
if (_o["data"].type() == json_spirit::str_type) |
|
|
data = importByteArray(_o["data"].get_str()); |
|
|
data = importByteArray(_o["data"].get_str()); |
|
|
else |
|
|
else |
|
|
for (auto const& j: _o["data"].get_array()) |
|
|
for (auto const& j: _o["data"].get_array()) |
|
|
data.push_back(toByte(j)); |
|
|
data.push_back(toByte(j)); |
|
|
|
|
|
|
|
|
return data; |
|
|
return data; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|