mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add errors to the ABI.
This commit is contained in:
@@ -121,6 +121,23 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef)
|
||||
abi.emplace(std::move(event));
|
||||
}
|
||||
|
||||
for (ErrorDefinition const* error: _contractDef.interfaceErrors())
|
||||
{
|
||||
Json::Value errorJson;
|
||||
errorJson["type"] = "error";
|
||||
errorJson["name"] = error->name();
|
||||
errorJson["inputs"] = Json::arrayValue;
|
||||
for (auto const& p: error->parameters())
|
||||
{
|
||||
Type const* type = p->annotation().type->interfaceType(false);
|
||||
solAssert(type, "");
|
||||
errorJson["inputs"].append(
|
||||
formatType(p->name(), *type, *p->annotation().type, false)
|
||||
);
|
||||
}
|
||||
abi.emplace(move(errorJson));
|
||||
}
|
||||
|
||||
Json::Value abiJson{Json::arrayValue};
|
||||
for (auto& f: abi)
|
||||
abiJson.append(std::move(f));
|
||||
|
||||
Reference in New Issue
Block a user