|
|
@ -74,10 +74,16 @@ void interactiveHelp() |
|
|
|
<< " secret Gives the current secret" << endl |
|
|
|
<< " block Gives the current block height." << endl |
|
|
|
<< " balance Gives the current balance." << endl |
|
|
|
<< " peers List the peers that are connected" << endl |
|
|
|
<< " transact Execute a given transaction." << endl |
|
|
|
<< " send Execute a given transaction with current secret." << endl |
|
|
|
<< " contract Create a new contract with current secret." << endl |
|
|
|
<< " peers List the peers that are connected" << endl |
|
|
|
<< " listAccounts List the accounts on the network." << endl |
|
|
|
<< " listContracts List the contracts on the network." << endl |
|
|
|
<< " setSecret <secret> Set the secret to the hex secret key." <<endl |
|
|
|
<< " setAddress <addr> Set the coinbase (mining payout) address." <<endl |
|
|
|
<< " exportConfig <path> Export the config (.RLP) to the path provided." <<endl |
|
|
|
<< " importConfig <path> Import the config (.RLP) from the path provided." <<endl |
|
|
|
<< " inspect <contract> Dumps a contract to <APPDATA>/<contract>.evm." << endl |
|
|
|
<< " exit Exits the application." << endl; |
|
|
|
} |
|
|
@ -460,6 +466,39 @@ 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(); |
|
|
|
string ss; |
|
|
|
for (auto const& i: acs) |
|
|
|
{ |
|
|
|
auto r = i.first; |
|
|
|
if (st.addressHasCode(r)) |
|
|
|
{ |
|
|
|
ss = toString(r) + " : " + toString(formatBalance(i.second)) + " [" + toString((unsigned)st.transactionsFrom(i.first)) + "]"; |
|
|
|
cout << ss << endl; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (cmd == "listAccounts") |
|
|
|
{ |
|
|
|
ClientGuard g(&c); |
|
|
|
auto const& st = c.state(); |
|
|
|
auto acs = st.addresses(); |
|
|
|
string ss; |
|
|
|
for (auto const& i: acs) |
|
|
|
{ |
|
|
|
auto r = i.first; |
|
|
|
if (!st.addressHasCode(r)) |
|
|
|
{ |
|
|
|
ss = toString(r) + pretty(r, st) + " : " + toString(formatBalance(i.second)) + " [" + toString((unsigned)st.transactionsFrom(i.first)) + "]"; |
|
|
|
cout << ss << endl; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else if (cmd == "send") |
|
|
|
{ |
|
|
|
ClientGuard g(&c); |
|
|
@ -561,6 +600,12 @@ int main(int argc, char** argv) |
|
|
|
ofs.close(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (cmd == "setSecret") |
|
|
|
{ |
|
|
|
string hexSec; |
|
|
|
iss >> hexSec; |
|
|
|
us = KeyPair(h256(fromHex(hexSec))); |
|
|
|
} |
|
|
|
else if (cmd == "help") |
|
|
|
interactiveHelp(); |
|
|
|
else if (cmd == "exit") |
|
|
|