Browse Source

Merge remote-tracking branch 'origin/deploydialog' into deploydialog

cl-refactor
yann300 9 years ago
parent
commit
9934ee8fd0
  1. 6
      mix/ContractCallDataEncoder.cpp
  2. 2
      mix/ContractCallDataEncoder.h
  3. 2
      mix/qml/StructView.qml
  4. 2
      mix/qml/js/InputValidator.js

6
mix/ContractCallDataEncoder.cpp

@ -298,10 +298,16 @@ QVariant ContractCallDataEncoder::decode(SolidityType const& _type, bytes const&
return QVariant::fromValue(QString("struct")); //TODO
else if (type == QSolidityType::Type::Address)
return QVariant::fromValue(toString(decodeBytes(unpadLeft(rawParam))));
else if (type == QSolidityType::Type::Enum)
return QVariant::fromValue(decodeEnum(rawParam));
else
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Parameter declaration not found"));
}
QString ContractCallDataEncoder::decodeEnum(bytes _value){
return toString(decodeInt(_value));
}
QString ContractCallDataEncoder::decode(QVariableDeclaration* const& _param, bytes _value)
{
SolidityType const& type = _param->type()->type();

2
mix/ContractCallDataEncoder.h

@ -64,6 +64,8 @@ public:
QJsonArray decodeArray(SolidityType const& _type, bytes const& _value, int& pos);
/// Decode array items
QJsonValue decodeArrayContent(SolidityType const& _type, bytes const& _value, int& pos);
/// Decode enum
QString decodeEnum(bytes _value);
private:
unsigned encodeSingleItem(QString const& _data, SolidityType const& _type, bytes& _dest);

2
mix/qml/StructView.qml

@ -60,6 +60,8 @@ Column
return Qt.createComponent("qrc:/qml/QHashTypeView.qml");
else if (t === QSolidityType.Struct)
return Qt.createComponent("qrc:/qml/StructView.qml");
else if (t === QSolidityType.Enum)
return Qt.createComponent("qrc:/qml/QStringTypeView.qml");
else if (t === QSolidityType.Address)
return Qt.createComponent("qrc:/qml/QAddressView.qml");
else

2
mix/qml/js/InputValidator.js

@ -38,6 +38,8 @@ function check(type, value)
res = validateArray(type, value);
else if (type.indexOf("int") !== -1)
res = validateInt(type, value);
else if (type.indexOf("enum") !== -1)
res = validateInt(type, value);
else if (type.indexOf("bytes") !== -1)
res = validateBytes(type, value);
else if (type.indexOf("bool") !== -1)

Loading…
Cancel
Save