diff --git a/eth/main.cpp b/eth/main.cpp index f3dfcf276..61a0fea01 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -78,6 +78,8 @@ void interactiveHelp() << " transact Execute a given transaction." << endl << " send Execute a given transaction with current secret." << endl << " contract Create a new contract with current secret." << endl + << " listAccounts List the accounts on the network." << endl + << " listContract List the contracts on the network." << endl << " inspect Dumps a contract to /.evm." << endl << " exit Exits the application." << endl; } @@ -460,6 +462,40 @@ int main(int argc, char** argv) cwarn << "Require parameters: transact ADDRESS AMOUNT GASPRICE GAS SECRET DATA"; } } + else if (cmd == "listContracts") + { + ClientGuard g(&c); + auto const& st = c.state(); + auto acs = st.addresses(); + for (auto const& i: acs) + { + auto r = i.first; + + string ss; + ss = toString(r) + pretty(r, st) + " : " + toString(formatBalance(i.second)) + " [" + toString((unsigned)st.transactionsFrom(i.first)) + "]"; + // cwarn << ss; + + if (st.addressHasCode(r)) + { + ss = toString(r) + " : " + toString(formatBalance(i.second)) + " [" + toString((unsigned)st.transactionsFrom(i.first)) + "]"; + cwarn << ss; + } + } + } + else if (cmd == "listAccounts") + { + ClientGuard g(&c); + auto const& st = c.state(); + auto acs = st.addresses(); + for (auto const& i: acs) + { + auto r = i.first; + + string ss; + ss = toString(r) + pretty(r, st) + " : " + toString(formatBalance(i.second)) + " [" + toString((unsigned)st.transactionsFrom(i.first)) + "]"; + cwarn << ss; + } + } else if (cmd == "send") { ClientGuard g(&c);