int main()

in service/tools/utxo/wallet_tool/cpp/utxo_client_tools.cpp [118:182]


int main(int argc, char** argv) {
  if (argc < 3) {
    printf("-d <cmd> -c [config]\n");
    return 0;
  }

  int64_t transaction_id = 0;
  std::string address, to_address, params, contract_address, func_name,
      private_key, to_pub_key;
  int64_t end_id = 0;
  int num = 10;
  int c;
  std::string cmd;
  std::string value;
  std::string client_config_file;
  while ((c = getopt(argc, argv, "c:d:t:x:m:h:e:v:n:p:b:")) != -1) {
    switch (c) {
      case 'c':
        client_config_file = optarg;
        break;
      case 'd':
        address = optarg;
        break;
      case 't':
        to_address = optarg;
        break;
      case 'x':
        transaction_id = strtoull(optarg, NULL, 10);
        break;
      case 'm':
        cmd = optarg;
        break;
      case 'e':
        end_id = strtoull(optarg, NULL, 10);
        break;
      case 'n':
        num = strtoull(optarg, NULL, 10);
        break;
      case 'v':
        value = optarg;
        break;
      case 'p':
        private_key = optarg;
        break;
      case 'b':
        to_pub_key = optarg;
        break;
      case 'h':
        ShowUsage();
        break;
    }
  }

  ResDBConfig config = GenerateResDBConfig(client_config_file);
  config.SetClientTimeoutMs(100000);
  UTXOClient client(config);
  if (cmd == "transfer") {
    Transfer(&client, transaction_id, address, ParseString(to_address),
             ParseValue(value), private_key, ParseString(to_pub_key));
  } else if (cmd == "list") {
    GetList(&client, end_id, num);
  } else if (cmd == "wallet") {
    GetWallet(&client, to_address);
  }
}