Add event and error identifiers to cli hashes cmd

This commit is contained in:
joshieDo
2022-02-08 17:44:21 +01:00
committed by Marenz
parent 5c3bcb6c2d
commit 9e62f21b25
7 changed files with 109 additions and 2 deletions
+18 -2
View File
@@ -271,14 +271,30 @@ void CommandLineInterface::handleSignatureHashes(string const& _contract)
return;
Json::Value methodIdentifiers = m_compiler->methodIdentifiers(_contract);
string out;
string out = "Function signatures:\n";
for (auto const& name: methodIdentifiers.getMemberNames())
out += methodIdentifiers[name].asString() + ": " + name + "\n";
Json::Value errorIdentifiers = m_compiler->errorIdentifiers(_contract);
if (!errorIdentifiers.empty())
{
out += "\nError signatures:\n";
for (auto const& name: errorIdentifiers.getMemberNames())
out += errorIdentifiers[name].asString() + ": " + name + "\n";
}
Json::Value eventIdentifiers = m_compiler->eventIdentifiers(_contract);
if (!eventIdentifiers.empty())
{
out += "\nEvent signatures:\n";
for (auto const& name: eventIdentifiers.getMemberNames())
out += eventIdentifiers[name].asString() + ": " + name + "\n";
}
if (!m_options.output.dir.empty())
createFile(m_compiler->filesystemFriendlyName(_contract) + ".signatures", out);
else
sout() << "Function signatures:" << endl << out;
sout() << out;
}
void CommandLineInterface::handleMetadata(string const& _contract)