155 #include <anyoption/anyoption.hpp>
163 #include "TargetConditionals.h"
166 using namespace opentxs;
168 #define OT_OPTIONS_FILE_DEFAULT "command-line-ot.opt"
169 #define CLIENT_PATH_DEFAULT "client_data" // should get programmatically
171 #define CA_FILE "certs/special/ca.crt"
172 #define KEY_FILE "certs/special/client.pem"
193 std::string& str_ServerID, std::string& str_MyNym,
OTPseudonym*& pMyNym,
211 if (
nullptr == pWallet) {
213 <<
"The wallet object is still nullptr, somehow. Please load it.\n";
219 if (str_ServerID.size() > 0) {
224 if (
nullptr == pServerContract)
228 if (
nullptr != pServerContract) {
230 pServerContract->GetIdentifier(strTemp);
232 str_ServerID = strTemp.
Get();
233 otOut <<
"Using as server: " << str_ServerID <<
"\n";
237 <<
"Unable to find a server contract. Please use the option: "
238 "--server SERVER_ID\n"
239 "(Where SERVER_ID is the server ID. Partial matches are "
241 "if the contract is already in the wallet.)\n"
242 "Also, see default values located in "
243 "~/.ot/comand-line-ot.opt \n";
251 if (str_MyNym.size() > 0) {
257 if (
nullptr == pMyNym)
260 if (
nullptr != pMyNym) {
262 pMyNym->GetIdentifier(strTemp);
264 str_MyNym = strTemp.
Get();
265 otOut <<
"Using as mynym: " << str_MyNym <<
"\n";
268 otOut <<
"==> Unable to find My Nym. Please use the option: "
270 "(Where USER_ID is the Nym's ID. Partial matches are "
272 "if the nym is already in the wallet.)\n"
273 "Also, see default values located in "
274 "~/.ot/comand-line-ot.opt\n";
288 if (
nullptr == opt)
return;
292 bool GetConfigPathSuccess =
295 GetConfigPathSuccess,
296 "HandleCommandLineArguments: Must Set Conifg Path First!");
311 opt->addUsage(
" **** NOTE: DO NOT USE 'ot' !! Use 'opentxs help' instead! "
312 "*** OT CLI Usage: ");
315 "ot --stat (Prints the wallet contents) ot --prompt (Enter "
317 opt->addUsage(
"ot [-h|-?|--help] (Prints this help) ot --script "
318 "<filename> [--args \"key value ...\"]");
320 "The '|' symbol means use --balance or -b, use --withdraw or -w, etc.");
322 "The brackets '[]' show required arguments, where default values are");
324 "normally expected to be found in: ~/.ot/command-line-ot.opt");
326 "ot --balance | -b [--myacct <acct_id>] (Display "
328 opt->addUsage(
"ot --withdraw | -w <amount> [--myacct <acct_id>] "
329 "(Withdraw as CASH)");
331 "ot --transfer | -t <amount> [--myacct <acct_id>] [--hisacct "
334 "ot --cheque | -c <amount> [--myacct <acct_id>] [--hisnym "
337 "ot --voucher | -v <amount> [--myacct <acct_id>] [--hisnym "
340 "ot --depositcheque [--myacct <acct_id>] (Deposit a cheque.)");
342 "ot --depositpurse [--myacct <acct_id>] (Deposit a cash purse.)");
343 opt->addUsage(
"ot --deposittokens [--myacct <acct_id>] (Deposit "
344 "individual cash tokens.)");
346 "ot --inbox | -i [--myacct <acct_id>] (Display the inbox.)");
348 "ot --sign | -s [--mynym <nym_id> ] (Sign a contract.)");
350 "ot --verify [--mynym <nym_id> ] (Verify a signature.)");
352 "ot --purse | -p <arguments> (Display a purse.)");
354 " Arguments: [--mynym <nym_id> ] [--mypurse <asset_type_id>]");
355 opt->addUsage(
"ot --refresh | -r [--myacct <acct_id>] (Download "
356 "account files from server.)");
357 opt->addUsage(
"ot --refreshnym [--mynym <nym_id> ] (Download nym "
358 "files from server.)");
360 "ot --marketoffer [--mynym <nym_id> ] (Place an offer "
363 "Also, [--server <server_id>] will work with all of the above.");
365 opt->addUsage(
"Recurring payments:");
366 opt->addUsage(
"ot --proposeplan <arguments> (Merchant)");
367 opt->addUsage(
" Arguments: [--mynym <nym_id> ] [--myacct <acct_id>] "
369 opt->addUsage(
" Continued: [--hisnym <nym_id> ] [--hisacct <acct_id> ]");
370 opt->addUsage(
"ot --confirmplan <arguments> (Customer)");
371 opt->addUsage(
"ot --activateplan <arguments> (Customer again)");
372 opt->addUsage(
" Arguments: [--mynym <nym_id> ] [--myacct <acct_id>]");
374 " **** NOTE: DO NOT USE 'ot' !! Use 'opentxs help' instead! ***");
395 opt->setCommandOption(
"withdraw",
397 opt->setCommandOption(
"transfer",
399 opt->setCommandOption(
"cheque",
'c');
400 opt->setCommandOption(
"voucher",
'v');
401 opt->setCommandFlag(
"marketoffer");
402 opt->setCommandFlag(
"balance",
'b');
403 opt->setCommandFlag(
"depositcheque");
404 opt->setCommandFlag(
"depositpurse");
407 opt->setCommandFlag(
"proposeplan");
408 opt->setCommandFlag(
"confirmplan");
409 opt->setCommandFlag(
"activateplan");
410 opt->setCommandFlag(
"inbox",
'i');
411 opt->setCommandFlag(
"sign",
's');
412 opt->setCommandFlag(
"verify");
413 opt->setCommandFlag(
"purse",
'p');
414 opt->setCommandFlag(
"refresh",
'r');
416 opt->setCommandFlag(
"refreshnym");
418 opt->setCommandFlag(
"stat");
419 opt->setCommandFlag(
"prompt");
420 opt->setCommandOption(
422 opt->setCommandOption(
426 opt->setCommandFlag(
"help",
'h');
427 opt->setCommandFlag(
'?');
438 opt->setCommandOption(
"server");
440 opt->setCommandOption(
"myacct");
441 opt->setCommandOption(
"mynym");
442 opt->setCommandOption(
"mypurse");
443 opt->setCommandOption(
"hisacct");
444 opt->setCommandOption(
"hisnym");
445 opt->setCommandOption(
"hispurse");
452 opt->setFileOption(
"defaultserver");
455 opt->setFileOption(
"defaultmyacct");
457 opt->setFileOption(
"defaultmynym");
459 opt->setFileOption(
"defaultmypurse");
461 opt->setFileOption(
"defaulthisacct");
463 opt->setFileOption(
"defaulthisnym");
465 opt->setFileOption(
"defaulthispurse");
485 strIniFileExact, strConfigPath, strOptionsFile);
486 OT_ASSERT_MSG(bBuildFullPathSuccess,
"Unalbe to set Full Path");
489 opt->processFile(strIniFileExact.
Get());
490 opt->processCommandArgs(argc, argv);
500 std::string& str_MyAcct, std::string& str_MyNym,
501 std::string& str_MyPurse,
502 std::string& str_HisAcct, std::string& str_HisNym,
503 std::string& str_HisPurse)
512 if (opt->getValue(
"defaultserver") !=
nullptr) {
515 str_ServerID = opt->getValue(
"defaultserver");
516 otWarn <<
"Server default: " << str_ServerID <<
" \n";
519 if (opt->getValue(
"defaultmyacct") !=
nullptr) {
522 str_MyAcct = opt->getValue(
"defaultmyacct");
523 otWarn <<
"MyAcct default: " << str_MyAcct <<
" \n";
525 if (opt->getValue(
"defaultmynym") !=
nullptr) {
528 str_MyNym = opt->getValue(
"defaultmynym");
529 otWarn <<
"MyNym default: " << str_MyNym <<
" \n";
531 if (opt->getValue(
"defaultmypurse") !=
nullptr) {
534 str_MyPurse = opt->getValue(
"defaultmypurse");
535 otWarn <<
"MyPurse default: " << str_MyPurse <<
" \n";
538 if (opt->getValue(
"defaulthisacct") !=
nullptr) {
541 str_HisAcct = opt->getValue(
"defaulthisacct");
542 otWarn <<
"HisAcct default: " << str_HisAcct <<
" \n";
544 if (opt->getValue(
"defaulthisnym") !=
nullptr) {
547 str_HisNym = opt->getValue(
"defaulthisnym");
548 otWarn <<
"HisNym default: " << str_HisNym <<
" \n";
550 if (opt->getValue(
"defaulthispurse") !=
nullptr) {
553 str_HisPurse = opt->getValue(
"defaulthispurse");
554 otWarn <<
"HisPurse default: " << str_HisPurse <<
" \n";
560 if (opt->getValue(
"server") !=
nullptr) {
563 str_ServerID = opt->getValue(
"server");
564 otWarn <<
"Server from command-line: " << str_ServerID <<
" \n";
567 if (opt->getValue(
"myacct") !=
nullptr) {
571 str_MyAcct = opt->getValue(
"myacct");
572 otWarn <<
"MyAcct from command-line: " << str_MyAcct <<
" \n";
574 if (opt->getValue(
"mynym") !=
nullptr) {
578 str_MyNym = opt->getValue(
"mynym");
579 otWarn <<
"MyNym from command-line: " << str_MyNym <<
" \n";
581 if (opt->getValue(
"mypurse") !=
nullptr) {
584 str_MyPurse = opt->getValue(
"mypurse");
585 otWarn <<
"MyPurse from command-line: " << str_MyPurse <<
" \n";
588 if (opt->getValue(
"hisacct") !=
nullptr) {
591 str_HisAcct = opt->getValue(
"hisacct");
592 otWarn <<
"HisAcct from command-line: " << str_HisAcct <<
" \n";
594 if (opt->getValue(
"hisnym") !=
nullptr) {
598 str_HisNym = opt->getValue(
"hisnym");
599 otWarn <<
"HisNym from command-line: " << str_HisNym <<
" \n";
601 if (opt->getValue(
"hispurse") !=
nullptr) {
604 str_HisPurse = opt->getValue(
"hispurse");
605 otWarn <<
"HisPurse from command-line: " << str_HisPurse <<
" \n";
614 int32_t
main(int32_t argc,
char* argv[])
616 class __OTclient_RAII
638 __OTclient_RAII the_client_cleanup;
645 bool bConfigPathFound =
649 "RegisterAPIWithScript: Must set Config Path first!\n");
651 otWarn <<
"Using configuration path: " << strConfigPath <<
"\n";
662 AnyOption* opt =
new AnyOption();
664 std::unique_ptr<AnyOption> theOptionAngel(opt);
673 std::string str_ServerID;
675 std::string str_MyAcct;
676 std::string str_MyNym;
677 std::string str_MyPurse;
679 std::string str_HisAcct;
680 std::string str_HisNym;
681 std::string str_HisPurse;
684 str_MyPurse, str_HisAcct, str_HisNym,
689 std::string str_Args;
691 if (opt->getValue(
"args") !=
nullptr)
692 cerr <<
"User-defined arguments aka: --args "
693 << (str_Args = opt->getValue(
"args")) << endl;
697 if (opt->getFlag(
"help") || opt->getFlag(
'h') || opt->getFlag(
'?')) {
703 bool bIsCommandProvided =
false;
707 if (opt->hasOptions()) {
711 if (opt->getValue(
'w') !=
nullptr ||
712 opt->getValue(
"withdraw") !=
nullptr) {
713 bIsCommandProvided =
true;
714 cerr <<
"withdraw amount = " << opt->getValue(
'w') << endl;
716 else if (opt->getValue(
't') !=
nullptr ||
717 opt->getValue(
"transfer") !=
nullptr) {
718 bIsCommandProvided =
true;
719 cerr <<
"transfer amount = " << opt->getValue(
't') << endl;
721 else if (opt->getValue(
'c') !=
nullptr ||
722 opt->getValue(
"cheque") !=
nullptr) {
723 bIsCommandProvided =
true;
724 cerr <<
"cheque amount = " << opt->getValue(
'c') << endl;
726 else if (opt->getFlag(
"marketoffer") ==
true) {
727 bIsCommandProvided =
true;
728 cerr <<
"marketoffer flag set " << endl;
730 else if (opt->getValue(
'v') !=
nullptr ||
731 opt->getValue(
"voucher") !=
nullptr) {
732 bIsCommandProvided =
true;
733 cerr <<
"voucher amount = " << opt->getValue(
'v') << endl;
735 else if (opt->getFlag(
"depositcheque")) {
736 bIsCommandProvided =
true;
737 cerr <<
"deposit cheque flag set " << endl;
739 else if (opt->getFlag(
"depositpurse")) {
740 bIsCommandProvided =
true;
741 cerr <<
"deposit purse flag set " << endl;
743 else if (opt->getFlag(
"deposittokens")) {
744 bIsCommandProvided =
true;
745 cerr <<
"deposit tokens flag set " << endl;
747 else if (opt->getFlag(
"proposepaymentplan")) {
748 bIsCommandProvided =
true;
749 cerr <<
"proposepaymentplan flag set " << endl;
751 else if (opt->getFlag(
"confirmpaymentplan")) {
752 bIsCommandProvided =
true;
753 cerr <<
"confirm payment plan flag set " << endl;
755 else if (opt->getFlag(
"activatepaymentplan")) {
756 bIsCommandProvided =
true;
757 cerr <<
"activate payment plan flag set " << endl;
759 else if (opt->getFlag(
'b') || opt->getFlag(
"balance")) {
760 bIsCommandProvided =
true;
761 cerr <<
"balance flag set " << endl;
763 else if (opt->getFlag(
'i') || opt->getFlag(
"inbox")) {
764 bIsCommandProvided =
true;
765 cerr <<
"inbox flag set " << endl;
767 else if (opt->getFlag(
'p') || opt->getFlag(
"purse")) {
768 bIsCommandProvided =
true;
769 cerr <<
"purse flag set " << endl;
771 else if (opt->getFlag(
's') || opt->getFlag(
"sign")) {
772 bIsCommandProvided =
true;
773 cerr <<
"sign flag set " << endl;
775 else if (opt->getFlag(
"verify")) {
776 bIsCommandProvided =
true;
777 cerr <<
"verify flag set " << endl;
779 else if (opt->getFlag(
"stat")) {
780 bIsCommandProvided =
true;
781 cerr <<
"stat flag set " << endl;
783 else if (opt->getFlag(
"prompt")) {
784 bIsCommandProvided =
true;
785 cerr <<
"prompt flag set " << endl;
787 else if (opt->getValue(
"script") !=
nullptr) {
788 bIsCommandProvided =
true;
789 cerr <<
"script filename: " << opt->getValue(
"script") << endl;
791 else if (opt->getFlag(
'r') || opt->getFlag(
"refresh")) {
792 bIsCommandProvided =
true;
793 cerr <<
"refresh flag set " << endl;
795 else if (opt->getFlag(
"refreshnym")) {
796 bIsCommandProvided =
true;
797 cerr <<
"refreshnym flag set " << endl;
803 bIsCommandProvided =
false;
806 if (!(opt->getArgc() > 0) && (
false == bIsCommandProvided))
812 otOut <<
"\n\nYou probably don't want to do this... Use CTRL-C, "
813 "and try \"ot --help\" for instructions.\n\n "
814 "==> Expecting ot script from standard input. (Terminate "
818 std::cin >> std::noskipws;
821 std::istream_iterator<char> it(std::cin);
822 std::istream_iterator<char> end;
823 std::string results(it, end);
844 bool bMainPointersSetupSuccessful =
846 str_ServerID, str_MyNym, pMyNym, pWallet, pServerContract);
849 bMainPointersSetupSuccessful,
850 "main: SetupPointersForWalletMyNymAndServerContract failed "
864 if (
nullptr == pServerContract) {
865 otOut <<
"Unable to find a server contract to use. Please use "
866 "the option: --server SERVER_ID\n"
867 "(Where SERVER_ID is the Server's ID. Partial matches "
875 if (
nullptr != pServerContract) {
904 if (str_MyAcct.size() > 0) {
907 pMyAccount = pWallet->
GetAccount(MY_ACCOUNT_ID);
910 if (
nullptr == pMyAccount)
913 if (
nullptr != pMyAccount) {
915 pMyAccount->GetPurportedAccountID().GetString(strTemp);
917 str_MyAcct = strTemp.
Get();
918 otOut <<
"Using as myacct: " << str_MyAcct <<
"\n";
923 otOut <<
"Aborting: Unable to find specified myacct: "
924 << str_MyAcct <<
"\n";
935 if (str_HisAcct.size() > 0) {
938 pHisAccount = pWallet->
GetAccount(HIS_ACCOUNT_ID);
941 if (
nullptr == pHisAccount)
943 if (
nullptr != pHisAccount) {
945 pHisAccount->GetPurportedAccountID().GetString(strTemp);
947 str_HisAcct = strTemp.
Get();
948 otOut <<
"Using as hisacct: " << str_HisAcct <<
"\n";
983 otOut <<
"Unable to find My Nym. Please use the option: --mynym "
985 "(Where USER_ID is the Nym's ID. Partial matches and "
996 if (str_HisNym.size() > 0) {
1001 if (
nullptr == pHisNym)
1003 if (
nullptr != pHisNym) {
1005 pHisNym->GetIdentifier(strTemp);
1007 str_HisNym = strTemp.
Get();
1008 otOut <<
"Using as hisnym: " << str_HisNym <<
"\n";
1025 if (str_MyPurse.size() > 0) {
1026 const OTIdentifier MY_ASSET_TYPE_ID(str_MyPurse.c_str());
1030 if (
nullptr == pMyAssetContract)
1034 if (
nullptr != pMyAssetContract) {
1036 pMyAssetContract->GetIdentifier(strTemp);
1038 str_MyPurse = strTemp.
Get();
1039 otOut <<
"Using as mypurse: " << str_MyPurse <<
"\n";
1041 pMyAssetContract->GetIdentifier(thePurseAssetTypeID);
1050 else if (
nullptr != pMyAccount)
1052 if (!thePurseAssetTypeID.
IsEmpty()) {
1053 OTString strTempAssetType(thePurseAssetTypeID);
1054 str_MyPurse = strTempAssetType.
Get();
1064 if (str_HisPurse.size() > 0) {
1065 const OTIdentifier HIS_ASSET_TYPE_ID(str_HisPurse.c_str());
1070 if (
nullptr == pHisAssetContract)
1074 if (
nullptr != pHisAssetContract) {
1076 pHisAssetContract->GetIdentifier(strTemp);
1078 str_HisPurse = strTemp.
Get();
1079 otOut <<
"Using as hispurse: " << str_HisPurse <<
"\n";
1081 pHisAssetContract->GetIdentifier(hisPurseAssetTypeID);
1086 else if (
nullptr != pHisAccount)
1088 if (!hisPurseAssetTypeID.
IsEmpty()) {
1089 OTString strTempAssetType(hisPurseAssetTypeID);
1090 str_HisPurse = strTempAssetType.
Get();
1108 bool bSendCommand =
false;
1128 if ((
nullptr != pServerContract) && (
nullptr != pMyNym))
1130 *pServerContract, *pMyNym,
1151 if ((opt->getValue(
"script") !=
nullptr) || (opt->getArgc() > 0)) {
1165 std::string strFilename;
1171 if (opt->getArgc() > 0) {
1172 strFilename = opt->getArgv(0);
1186 if (
nullptr != opt->getValue(
"script")) {
1187 strFilename = opt->getValue(
"script");
1190 std::ifstream t(strFilename.c_str(),
1191 std::ios::in | std::ios::binary);
1192 std::stringstream buffer;
1193 buffer << t.rdbuf();
1194 std::string results = buffer.str();
1197 std::unique_ptr<OTVariable> angelArgs;
1199 std::unique_ptr<OTVariable> angelMyNymVar;
1200 std::unique_ptr<OTVariable> angelHisNymVar;
1201 std::unique_ptr<OTVariable> angelServer;
1202 std::unique_ptr<OTVariable> angelMyAcct;
1203 std::unique_ptr<OTVariable> angelHisAcct;
1204 std::unique_ptr<OTVariable> angelMyPurse;
1205 std::unique_ptr<OTVariable> angelHisPurse;
1207 if ((str_Args.size() > 0) || (opt->getArgc() > 1)) {
1208 const std::string str_var_name(
"Args");
1209 std::string str_var_value, str_command;
1211 if (str_Args.size() > 0) str_var_value += str_Args;
1213 if (opt->getArgc() > 1) {
1214 if (str_Args.size() > 0) str_var_value +=
" ";
1216 str_command = opt->getArgv(1);
1217 str_var_value +=
"ot_cli_command ";
1218 str_var_value += str_command;
1221 otWarn <<
"Adding user-defined command line arguments as '"
1222 << str_var_name <<
"' "
1223 "containing value: " << str_var_value
1233 angelArgs.reset(pVar);
1238 otInfo <<
"Args variable (optional user-defined "
1239 "arguments) isn't set...\n";
1242 if (str_ServerID.size() > 0) {
1243 const std::string str_var_name(
"Server");
1244 const std::string str_var_value(str_ServerID);
1246 otWarn <<
"Adding constant with name " << str_var_name
1247 <<
" and value: " << str_var_value <<
" ...\n";
1254 angelServer.reset(pVar);
1259 otInfo <<
"Server variable isn't set...\n";
1262 if (
nullptr != pMyNym) {
1263 const std::string str_party_name(
"MyNym");
1265 otWarn <<
"Adding constant with name " << str_party_name
1266 <<
" and value: " << str_MyNym <<
" ...\n";
1273 angelMyNymVar.reset(pVar);
1278 otInfo <<
"MyNym variable isn't set...\n";
1281 if ((
nullptr != pHisNym) || (str_HisNym.size() > 0))
1287 const std::string str_party_name(
"HisNym");
1289 otWarn <<
"Adding constant with name " << str_party_name
1290 <<
" and value: " << str_HisNym <<
" ...\n";
1297 angelHisNymVar.reset(pVar);
1302 otInfo <<
"HisNym variable isn't set...\n";
1344 if (str_MyAcct.size() > 0) {
1345 const std::string str_var_name(
"MyAcct");
1346 const std::string str_var_value(str_MyAcct);
1348 otWarn <<
"Adding variable with name " << str_var_name
1349 <<
" and value: " << str_var_value <<
" ...\n";
1356 angelMyAcct.reset(pVar);
1361 otInfo <<
"MyAcct variable isn't set...\n";
1364 if (str_MyPurse.size() > 0) {
1365 const std::string str_var_name(
"MyPurse");
1366 const std::string str_var_value(str_MyPurse);
1368 otWarn <<
"Adding variable with name " << str_var_name
1369 <<
" and value: " << str_var_value <<
" ...\n";
1376 angelMyPurse.reset(pVar);
1381 otInfo <<
"MyPurse variable isn't set...\n";
1384 if (str_HisAcct.size() > 0) {
1385 const std::string str_var_name(
"HisAcct");
1386 const std::string str_var_value(str_HisAcct);
1388 otWarn <<
"Adding variable with name " << str_var_name
1389 <<
" and value: " << str_var_value <<
" ...\n";
1396 angelHisAcct.reset(pVar);
1401 otInfo <<
"HisAcct variable isn't set...\n";
1404 if (str_HisPurse.size() > 0) {
1405 const std::string str_var_name(
"HisPurse");
1406 const std::string str_var_value(str_HisPurse);
1408 otWarn <<
"Adding variable with name " << str_var_name
1409 <<
" and value: " << str_var_value <<
" ...\n";
1416 angelHisPurse.reset(pVar);
1421 otInfo <<
"MyPurse variable isn't set...\n";
1426 otWarn <<
"Script output:\n\n";
1432 if ((
nullptr == pServerContract) || (
nullptr == pMyNym)) {
1433 otErr <<
"Unexpected nullptr: "
1434 << ((
nullptr == pServerContract) ?
"pServerContract" :
"")
1435 <<
" " << ((
nullptr == pMyNym) ?
"pMyNym" :
"") <<
"\n";
1437 else if (opt->getValue(
'w') !=
nullptr ||
1438 opt->getValue(
"withdraw") !=
nullptr) {
1439 const int64_t lAmount = atol(opt->getValue(
'w'));
1441 otOut <<
"(User has instructed to withdraw cash...)\n";
1447 *pServerContract, pMyAccount, lAmount)) {
1448 bSendCommand =
true;
1452 <<
"Error processing withdraw command in ProcessMessage.\n";
1454 else if (opt->getValue(
't') !=
nullptr ||
1455 opt->getValue(
"transfer") !=
nullptr) {
1456 const int64_t lAmount = atol(opt->getValue(
't'));
1459 (str_HisAcct.size() > 0) ? str_HisAcct.c_str() :
"aaaaaaaa");
1461 otOut <<
"User has instructed to send a Transfer command "
1462 "(Notarize Transactions)...\n";
1468 *pServerContract, pMyAccount, lAmount,
1471 (str_HisAcct.size() > 0) ? &HIS_ACCT_ID
1474 bSendCommand =
true;
1477 otErr <<
"Error processing notarizeTransactions (transfer) "
1479 "in ProcessMessage.\n";
1481 else if (opt->getValue(
'c') !=
nullptr ||
1482 opt->getValue(
"cheque") !=
nullptr) {
1483 otOut <<
"(User has instructed to write a cheque...)\n";
1485 const int64_t lAmount = atol(opt->getValue(
'c'));
1488 ? str_HisNym.c_str()
1493 pMyAccount, lAmount,
nullptr,
1494 (str_HisNym.size() > 0) ? &HIS_NYM_ID :
nullptr);
1496 else if (opt->getValue(
'v') !=
nullptr ||
1497 opt->getValue(
"voucher") !=
nullptr) {
1498 otOut <<
"(User has instructed to withdraw a voucher...)\n";
1500 const int64_t lAmount = atol(opt->getValue(
'v'));
1502 OTIdentifier HIS_NYM_ID((str_HisNym.size() > 0) ? str_HisNym.c_str()
1507 *pServerContract, pMyAccount, lAmount,
1509 (str_HisNym.size() > 0) ? &HIS_NYM_ID :
nullptr)) {
1510 bSendCommand =
true;
1513 otErr <<
"Error processing withdraw voucher command in "
1514 "ProcessMessage.\n";
1519 else if (opt->getValue(
"marketoffer") !=
nullptr) {
1520 otOut <<
"(User has instructed to send a marketOffer command to "
1531 bSendCommand =
true;
1534 otErr <<
"Error processing marketOffer command in "
1535 "ProcessMessage.\n";
1550 else if (opt->getFlag(
"proposepaymentplan")) {
1551 otOut <<
"(User has instructed to propose a payment plan...)\n";
1553 OTIdentifier HIS_NYM_ID((str_HisNym.size() > 0) ? str_HisNym.c_str()
1556 (str_HisAcct.size() > 0) ? str_HisAcct.c_str() :
"aaaaaaaa");
1560 *pServerContract, pMyAccount, 0, pMyAssetContract,
1561 (str_HisNym.size() > 0) ? &HIS_NYM_ID :
nullptr,
1562 (str_HisAcct.size() > 0) ? &HIS_ACCT_ID :
nullptr);
1564 else if (opt->getFlag(
"confirmpaymentplan")) {
1565 otOut <<
"(User has instructed to confirm a payment plan...)\n";
1572 else if (opt->getFlag(
"activatepaymentplan")) {
1573 otOut <<
"(User has instructed to activate a payment plan...)\n";
1577 *pServerContract, pMyAccount))
1581 bSendCommand =
true;
1584 otErr <<
"Error processing activate payment plan command in "
1585 "ProcessMessage.\n";
1587 else if (opt->getFlag(
"depositcheque")) {
1588 otOut <<
"(User has instructed to deposit a cheque...)\n";
1594 *pServerContract, pMyAccount)) {
1595 bSendCommand =
true;
1598 otErr <<
"Error processing deposit cheque command in "
1599 "ProcessMessage.\n";
1601 else if (opt->getFlag(
"depositpurse")) {
1602 otOut <<
"(User has instructed to deposit a cash purse...)\n";
1608 *pServerContract, pMyAccount, 0,
1609 pMyAssetContract)) {
1610 bSendCommand =
true;
1613 otErr <<
"Error processing deposit purse command in "
1614 "ProcessMessage.\n";
1616 else if (opt->getFlag(
"deposittokens")) {
1617 otOut <<
"(User has instructed to deposit individual cash "
1624 *pServerContract, pMyAccount)) {
1625 bSendCommand =
true;
1628 otErr <<
"Error processing deposit cash tokens command in "
1629 "ProcessMessage.\n";
1631 else if (opt->getFlag(
'i') || opt->getFlag(
"inbox")) {
1632 cerr <<
"DISPLAY INBOX CONTENTS HERE... (When I code this. What "
1634 "say? Use the GUI.)" << endl;
1636 else if (opt->getFlag(
's') || opt->getFlag(
"sign")) {
1637 otOut <<
"(User has instructed to sign a contract...)\n";
1643 else if (opt->getFlag(
'p') || opt->getFlag(
"purse")) {
1644 cerr <<
"User wants to display purse contents (not coded yet here.)"
1647 else if (opt->getFlag(
"verify")) {
1648 cerr <<
"User wants to verify a signature on a contract (not coded "
1652 else if (opt->getFlag(
"stat")) {
1653 otOut <<
"User has instructed to display wallet contents...\n";
1657 otOut << strStat <<
"\n";
1659 else if (opt->getFlag(
"prompt")) {
1660 otOut <<
"User has instructed to enter the OT prompt...\n";
1662 else if (opt->getFlag(
'b') || opt->getFlag(
"balance")) {
1663 otOut <<
"\n ACCT BALANCE (server-side): "
1667 theServerID, thePurseAssetTypeID, MY_NYM_ID);
1668 std::unique_ptr<Purse> thePurseAngel(pPurse);
1669 if (
nullptr != pPurse)
1670 otOut <<
" CASH PURSE (client-side): "
1673 else if (opt->getFlag(
'r') || opt->getFlag(
"refresh")) {
1674 otOut <<
"(User has instructed to download intermediary files "
1675 "for an asset account...)\n";
1681 *pServerContract, pMyAccount)) {
1682 bSendCommand =
true;
1685 otErr <<
"Error processing getAccount command in "
1686 "ProcessMessage.\n";
1688 else if (opt->getFlag(
"refreshnym")) {
1689 otOut <<
"(User has instructed to download intermediary files "
1696 *pServerContract,
nullptr)) {
1697 bSendCommand =
true;
1700 otErr <<
"Error processing getNymbox command in "
1701 "ProcessMessage.\n";
1707 if ((
nullptr == pServerNym) ||
1709 otOut <<
"The server Nym was nullptr or failed to verify on server "
1710 "contract: " << strServerID <<
"\n";
1716 OTString strEnvelopeContents(theMessage);
1719 theEnvelope.
Seal(*pServerNym, strEnvelopeContents);
1722 *pServerContract, theEnvelope);
1726 if (!opt->getFlag(
"prompt"))
1734 otOut <<
"\nLOOKING FOR INSTRUCTIONS for the OT COMMAND LINE?\n"
1736 "Followed by: ot -?\n"
1740 "(NOW ENTERING OT PROMPT) \n"
1741 "See docs/CLIENT-COMMANDS.txt\n\n";
1775 if ((str_ServerID.size() > 0) || (str_MyNym.size() > 0)) {
1778 str_ServerID, str_MyNym, pMyNym, pWallet, pServerContract)) {
1783 otOut <<
"\nYou may wish to 'load' then 'stat'.\n"
1784 "(FYI, --server SERVER_ID and --mynym NYM_ID were both "
1786 "Also, see: ~/.ot/command-line-ot.opt for defaults.\n";
1797 otLog4 <<
"Starting client loop.\n";
1808 otOut <<
"\nOT -- WARNING: This prompt is too low-level for you.\nType "
1809 "'quit', and then try 'opentxs help' and 'opentxs "
1813 fgets(buf, 190, stdin))
1817 otOut <<
".\n..\n...\n....\n.....\n......\n.......\n........\n........."
1818 "\n..........\n...........\n............\n.............\n";
1821 std::string strLine = buf;
1824 if (strLine.compare(0, 4,
"load") == 0) {
1825 otOut <<
"User has instructed to load wallet.xml...\n";
1828 str_ServerID, str_MyNym, pMyNym, pWallet,
1835 else if (
'\0' == buf[0]) {
1838 else if (strLine.compare(0, 4,
"test") == 0) {
1839 std::string strScript =
"print(\"Hello, world\")";
1875 else if (strLine.compare(0, 8,
"clearreq") ==
1878 if (
nullptr == pMyNym) {
1879 otOut <<
"No Nym yet available. Try 'load'.\n";
1886 otOut <<
"You are trying to mess around with your (clear your) "
1887 "request numbers.\n"
1888 "Enter the relevant server ID [" << strServerID <<
"]: ";
1892 const OTString strReqNumServerID((str_ServerID.size() > 0)
1893 ? str_ServerID.c_str()
1894 : strServerID.Get());
1900 otOut <<
"Successfully removed request number for server "
1901 << strReqNumServerID <<
". Saving nym...\n";
1904 else if (strLine.compare(0, 5,
"clear") == 0) {
1905 if (
nullptr == pMyNym) {
1906 otOut <<
"No Nym yet available. Try 'load'.\n";
1913 otOut <<
"You are trying to mess around with your (clear your) "
1914 "transaction numbers.\n"
1915 "Enter the relevant server ID [" << strServerID <<
"]: ";
1919 const OTString strTransNumServerID((str_ServerID.size() > 0)
1920 ? str_ServerID.c_str()
1921 : strServerID.Get());
1927 otOut <<
"Successfully removed all issued and transaction "
1928 "numbers for server " << strTransNumServerID
1929 <<
". Saving nym...\n";
1932 else if (strLine.compare(0, 7,
"decrypt") == 0) {
1933 if (
nullptr == pMyNym) {
1934 otOut <<
"No Nym yet available to decrypt with.\n";
1938 otOut <<
"Enter text to be decrypted:\n> ";
1941 char decode_buffer[200];
1944 decode_buffer[0] = 0;
1946 fgets(decode_buffer,
sizeof(decode_buffer) - 1, stdin)) {
1947 theArmoredText.
Concatenate(
"%s\n", decode_buffer);
1953 }
while (strlen(decode_buffer) > 1);
1958 theEnvelope.
Open(*pMyNym, strDecodedText);
1960 otOut <<
"\n\nDECRYPTED TEXT:\n\n" << strDecodedText <<
"\n\n";
1964 else if (strLine.compare(0, 6,
"decode") == 0) {
1965 otOut <<
"Enter text to be decoded:\n> ";
1968 char decode_buffer[200];
1971 decode_buffer[0] = 0;
1973 fgets(decode_buffer,
sizeof(decode_buffer) - 1, stdin)) {
1974 theArmoredText.
Concatenate(
"%s\n", decode_buffer);
1981 }
while (strlen(decode_buffer) > 1);
1983 OTString strDecodedText(theArmoredText);
1985 otOut <<
"\n\nDECODED TEXT:\n\n" << strDecodedText <<
"\n\n";
1989 else if (strLine.compare(0, 6,
"encode") == 0) {
1990 otOut <<
"Enter text to be ascii-encoded (terminate with ~ on a "
1994 char decode_buffer[200];
1997 decode_buffer[0] = 0;
2000 fgets(decode_buffer,
sizeof(decode_buffer) - 1, stdin)) &&
2001 (decode_buffer[0] !=
'~')) {
2009 }
while (decode_buffer[0] !=
'~');
2013 otOut <<
"\n\nENCODED TEXT:\n\n" << theArmoredText <<
"\n\n";
2017 else if (strLine.compare(0, 4,
"hash") == 0) {
2018 otOut <<
"Enter text to be hashed (terminate with ~ on a "
2022 char decode_buffer[200];
2025 decode_buffer[0] = 0;
2028 fgets(decode_buffer,
sizeof(decode_buffer) - 1, stdin)) &&
2029 (decode_buffer[0] !=
'~')) {
2030 strDecodedText.
Concatenate(
"%s\n", decode_buffer);
2037 }
while (decode_buffer[0] !=
'~');
2039 std::string str_Trim(strDecodedText.
Get());
2041 strDecodedText.
Set(str_Trim2.c_str());
2048 otOut <<
"\n\nMESSAGE DIGEST:\n\n" << strHash <<
"\n\n";
2052 else if (strLine.compare(0, 4,
"stat") == 0) {
2053 otOut <<
"User has instructed to display wallet contents...\n";
2058 otOut << strStat <<
"\n";
2061 otOut <<
"No wallet is loaded...\n";
2065 else if (strLine.compare(0, 4,
"help") == 0) {
2066 otOut <<
"User has instructed to display the help file...\nPlease "
2067 "see this file: docs/CLIENT_COMMANDS.txt\n";
2071 else if (strLine.compare(0, 4,
"quit") == 0) {
2072 otOut <<
"User has instructed to exit the wallet...\n";
2098 if (
nullptr == pServerContract) {
2099 otOut <<
"Unable to find a server contract. Please restart using "
2100 "the option: --server SERVER_ID\n"
2101 "(Where SERVER_ID is the server ID. Partial matches ARE "
2130 <<
"Unable to find My Nym. Please restart and use the option:\n"
2131 " --mynym USER_ID\n"
2132 "(Where USER_ID is the Nym's ID. Partial matches ARE "
2137 bool bSendCommand =
false;
2158 *pServerContract, *pMyNym,
2168 if (buf[0] ==
'c') {
2169 otOut <<
"(User has instructed to send a checkServerID command "
2170 "to the server...)\n";
2179 bSendCommand =
true;
2182 otErr <<
"Error processing checkServerID command in "
2183 "ProcessMessage: " << buf[0] <<
"\n";
2188 else if (buf[0] ==
'r') {
2189 otOut <<
"(User has instructed to send a createUserAccount "
2190 "command to the server...)\n";
2199 bSendCommand =
true;
2202 otErr <<
"Error processing createUserAccount command in "
2203 "ProcessMessage: " << buf[0] <<
"\n";
2212 else if (buf[0] ==
'u') {
2213 otOut <<
"(User has instructed to send a checkUser command to "
2223 bSendCommand =
true;
2226 otErr <<
"Error processing checkUser command in "
2227 "ProcessMessage: " << buf[0] <<
"\n";
2232 else if (buf[0] ==
'a') {
2233 otOut <<
"(User has instructed to send a createAccount command "
2234 "to the server...)\n";
2243 bSendCommand =
true;
2246 otErr <<
"Error processing createAccount command in "
2247 "ProcessMessage: " << buf[0] <<
"\n";
2252 else if (!strcmp(buf,
"issue\n")) {
2253 otOut <<
"(User has instructed to send an issueAssetType command "
2254 "to the server...)\n";
2263 bSendCommand =
true;
2266 otErr <<
"Error processing issueAssetType command in "
2267 "ProcessMessage: " << buf <<
"\n";
2272 else if (!strcmp(buf,
"basket\n")) {
2273 otOut <<
"(User has instructed to send an issueBasket command to "
2283 bSendCommand =
true;
2286 otErr <<
"Error processing issueBasket command in "
2287 "ProcessMessage: " << buf <<
"\n";
2292 else if (!strcmp(buf,
"exchange\n")) {
2293 otOut <<
"(User has instructed to send an exchangeBasket command "
2294 "to the server...)\n";
2303 bSendCommand =
true;
2306 otErr <<
"Error processing exchangeBasket command in "
2307 "ProcessMessage: " << buf <<
"\n";
2312 else if (!strcmp(buf,
"offer\n")) {
2313 otOut <<
"(User has instructed to send a marketOffer command to "
2323 bSendCommand =
true;
2326 otErr <<
"Error processing marketOffer command in "
2327 "ProcessMessage: " << buf <<
"\n";
2332 else if (!strcmp(buf,
"setservername\n")) {
2333 otOut <<
"(User wants to set a Server Contract's "
2334 "client-side name...)\n";
2350 else if (!strcmp(buf,
"setassetname\n")) {
2351 otOut <<
"(User wants to set an Asset Contract's "
2352 "client-side name...)\n";
2368 else if (!strcmp(buf,
"setnymname\n")) {
2369 otOut <<
"(User wants to set a Nym's client-side name...)\n";
2385 else if (!strcmp(buf,
"setaccountname\n")) {
2386 otOut <<
"(User wants to set an Asset Account's client-side "
2406 else if (!strcmp(buf,
"signcontract\n")) {
2407 otOut <<
"(User has instructed to sign a contract...)\n";
2416 else if (buf[0] ==
's') {
2417 otOut <<
"(User has instructed to send a sendUserMessage command "
2418 "to the server...)\n";
2427 bSendCommand =
true;
2430 otErr <<
"Error processing sendUserMessage command in "
2431 "ProcessMessage: " << buf[0] <<
"\n";
2436 else if (strLine.compare(0, 2,
"py") == 0) {
2437 otOut <<
"(User has instructed to send a processNymbox command "
2438 "to the server...)\n";
2447 bSendCommand =
true;
2450 otErr <<
"Error in processNymbox command in ProcessMessage: "
2456 else if (buf[0] ==
'y') {
2457 otOut <<
"(User has instructed to send a getNymbox command to "
2467 bSendCommand =
true;
2470 otErr <<
"Error processing getNymbox command in "
2471 "ProcessMessage: " << buf[0] <<
"\n";
2478 else if (strLine.compare(0, 2,
"pi") == 0) {
2479 otOut <<
"(User has instructed to send a processInbox command to "
2486 *pServerContract,
nullptr))
2489 bSendCommand =
true;
2492 otErr <<
"Error in processInbox command in ProcessMessage: "
2498 else if (buf[0] ==
'i') {
2499 otOut <<
"(User has instructed to send a getInbox command to the "
2506 *pServerContract,
nullptr)) {
2507 bSendCommand =
true;
2510 otErr <<
"Error processing getInbox command in ProcessMessage: "
2516 else if (buf[0] ==
'o') {
2517 otOut <<
"(User has instructed to send a getOutbox command to "
2524 *pServerContract,
nullptr)) {
2525 bSendCommand =
true;
2528 otErr <<
"Error processing getOutbox command in "
2529 "ProcessMessage: " << buf[0] <<
"\n";
2534 else if (buf[0] ==
'q') {
2535 otOut <<
"User has instructed to deposit a cheque...\n";
2541 *pServerContract,
nullptr)) {
2542 bSendCommand =
true;
2545 otErr <<
"Error processing deposit cheque command in "
2546 "ProcessMessage: " << buf[0] <<
"\n";
2551 else if (buf[0] ==
'p') {
2552 otOut <<
"(User has instructed to deposit a purse "
2553 "containing cash...)\n";
2559 *pServerContract,
nullptr)) {
2560 bSendCommand =
true;
2563 otErr <<
"Error processing deposit command in ProcessMessage: "
2569 else if (buf[0] ==
'd') {
2570 otOut <<
"(User has instructed to deposit cash tokens...)\n";
2576 *pServerContract,
nullptr)) {
2577 bSendCommand =
true;
2580 otErr <<
"Error processing deposit command in ProcessMessage: "
2586 else if (buf[0] ==
'v') {
2587 otOut <<
"User has instructed to withdraw a voucher (like a "
2588 "cashier's cheque)...\n";
2597 bSendCommand =
true;
2600 otErr <<
"Error processing withdraw voucher command in "
2601 "ProcessMessage: " << buf[0] <<
"\n";
2606 else if (buf[0] ==
'w') {
2607 otOut <<
"(User has instructed to withdraw cash...)\n";
2616 bSendCommand =
true;
2619 otErr <<
"Error processing withdraw command in ProcessMessage: "
2625 else if (!strcmp(buf,
"activate\n")) {
2626 otOut <<
"User has instructed to activate a payment plan...\n";
2635 bSendCommand =
true;
2638 otErr <<
"Error processing payment plan command in "
2639 "ProcessMessage: " << buf[0] <<
"\n";
2644 else if (!strcmp(buf,
"get\n")) {
2645 otOut <<
"(User has instructed to send a getAccount command to "
2655 bSendCommand =
true;
2658 otErr <<
"Error processing getAccount command in "
2659 "ProcessMessage: " << buf[0] <<
"\n";
2664 else if (!strcmp(buf,
"getcontract\n")) {
2665 otOut <<
"(User has instructed to send a getContract command to "
2675 bSendCommand =
true;
2678 otErr <<
"Error processing getContract command in "
2679 "ProcessMessage: " << buf[0] <<
"\n";
2682 else if (!strcmp(buf,
"propose\n")) {
2683 otOut <<
"(User has instructed to propose a payment plan...)\n";
2691 else if (!strcmp(buf,
"confirm\n")) {
2692 otOut <<
"(User has instructed to confirm a payment plan...)\n";
2700 else if (!strcmp(buf,
"cheque\n")) {
2701 otOut <<
"(User has instructed to write a cheque...)\n";
2710 else if (!strcmp(buf,
"getmint\n")) {
2711 otOut <<
"(User has instructed to send a getMint command "
2712 "to the server...)\n";
2721 bSendCommand =
true;
2724 otErr <<
"Error processing getMint command in ProcessMessage: "
2730 else if (buf[0] ==
't') {
2731 otOut <<
"(User has instructed to send a Transfer command "
2732 "(Notarize Transactions) to the server...)\n";
2741 bSendCommand =
true;
2744 otErr <<
"Error processing notarizeTransactions command in "
2745 "ProcessMessage: " << buf[0] <<
"\n";
2750 else if (buf[0] ==
'g') {
2751 otOut <<
"(User has instructed to send a getRequest command to "
2761 bSendCommand =
true;
2764 otErr <<
"Error processing getRequest command in "
2765 "ProcessMessage: " << buf[0] <<
"\n";
2770 else if (buf[0] ==
'n') {
2791 int64_t lTransactionNumber =
2792 ((strlen(buf) > 2) ? atol(&(buf[2])) : 0);
2794 if (lTransactionNumber > 0) {
2798 otOut <<
"You are trying to mess around with your (add to "
2799 "your) transaction numbers.\n"
2800 "Enter the relevant server ID [" << strServerID
2805 const OTString strTransNumServerID((str_ServerID.size() > 0)
2806 ? str_ServerID.c_str()
2807 : strServerID.Get());
2813 otOut <<
"Transaction number " << lTransactionNumber
2814 <<
" added to both lists "
2815 "(on client side.)\n";
2818 otOut <<
"(User has instructed to send a getTransactionNum "
2819 "command to the server...)\n";
2828 bSendCommand =
true;
2831 otErr <<
"Error processing getTransactionNum command in "
2832 "ProcessMessage: " << buf[0] <<
"\n";
2849 if (bSendCommand && (
nullptr != pServerNym) &&
2851 OTString strEnvelopeContents(theMessage);
2853 theEnvelope.
Seal(*pServerNym, strEnvelopeContents);
2856 *pServerContract, theEnvelope);
2861 otOut <<
"Exiting OT prompt.\n";
OTLOG_IMPORT OTLogStream otLog4
EXPORT bool SetFocusToServerAndNym(OTServerContract &theServerContract, OTPseudonym &theNym, TransportCallback *pCallback) const
static EXPORT bool AppCleanup()
OTClient * GetClient() const
EXPORT bool CalculateDigest(const OTData &dataInput)
EXPORT void ExecuteScript_ReturnVoid(const std::string &str_Code, std::string str_DisplayName="<BLANK>")
EXPORT void GetIdentifier(OTIdentifier &theIdentifier) const
EXPORT OTAccount * GetAccountPartialMatch(std::string PARTIAL_ID)
EXPORT static OT_OTAPI_OT void CopyVariables()
EXPORT const OTIdentifier & GetAssetTypeID() const
EXPORT OTAssetContract * GetAssetContract(const OTIdentifier &theContractID)
EXPORT int64_t GetBalance() const
EXPORT TransportCallback * GetTransportCallback() const
EXPORT OTWallet * GetWallet(const char *szFuncName=nullptr) const
bool SetupPointersForWalletMyNymAndServerContract(std::string &str_ServerID, std::string &str_MyNym, OTPseudonym *&pMyNym, OTWallet *&pWallet, OTServerContract *&pServerContract)
EXPORT OTPseudonym * GetNymByIDPartialMatch(std::string PARTIAL_ID)
OTLOG_IMPORT OTLogStream otOut
EXPORT void DisplayStatistics(OTString &strOutput)
EXPORT bool GetAccount(int32_t iIndex, OTIdentifier &THE_ID, OTString &THE_NAME)
EXPORT uint32_t GetLength() const
EXPORT int32_t ProcessUserCommand(OT_CLIENT_CMD_TYPE requestedCommand, OTMessage &theMessage, OTPseudonym &theNym, const OTServerContract &theServer, const OTAccount *pAccount=nullptr, int64_t lTransactionAmount=0, OTAssetContract *pMyAssetContract=nullptr, const OTIdentifier *pHisNymID=nullptr, const OTIdentifier *pHisAcctID=nullptr)
EXPORT bool Open(const OTPseudonym &theRecipient, OTString &theOutput, const OTPasswordData *pPWData=nullptr)
EXPORT void Concatenate(const char *arg,...)
EXPORT bool Seal(const OTPseudonym &theRecipient, const OTString &theInput)
EXPORT bool VerifyPseudonym() const
static EXPORT bool RelativeToCanonical(OTString &out_strCanonicalPath, const OTString &strBasePath, const OTString &strRelativePath)
EXPORT bool Exists() const
static EXPORT const OTString & AppDataFolder()
static EXPORT void Output(const int32_t &nLogLevel, const std::string &strOutput)
EXPORT const OTPseudonym * GetContractPublicNym() const
EXPORT bool LoadWallet() const
EXPORT void Set(const char *data, uint32_t enforcedMaxLength=0)
EXPORT bool AddTransactionNum(OTPseudonym &SIGNER_NYM, const OTString &strServerID, int64_t lTransNum, bool bSave)
EXPORT std::string OT_CLI_ReadLine()
void SetRunningAsScript()
EXPORT OTPseudonym * GetNymByID(const OTIdentifier &NYM_ID)
#define OT_OPTIONS_FILE_DEFAULT
void HandleCommandLineArguments(int32_t argc, char *argv[], AnyOption *opt)
EXPORT Purse * LoadPurse(const OTIdentifier &SERVER_ID, const OTIdentifier &ASSET_ID, const OTIdentifier &USER_ID, const OTString *pstrDisplay=nullptr) const
int64_t GetTotalValue() const
EXPORT OTAssetContract * GetAssetContractPartialMatch(std::string PARTIAL_ID)
#define OT_ASSERT_MSG(x, s)
static EXPORT bool AppInit()
OTLOG_IMPORT OTLogStream otInfo
virtual EXPORT void GetIdentifier(OTIdentifier &theIdentifier) const
OTLOG_IMPORT OTLogStream otWarn
EXPORT const char * Get() const
OTLOG_IMPORT OTLogStream otErr
EXPORT int32_t ExecuteScript_ReturnInt(const std::string &str_Code, std::string str_DisplayName="<BLANK>")
EXPORT void AddVariable(const std::string &str_var_name, OTVariable &theVar)
EXPORT void RemoveReqNumbers(const OTString *pstrServerID=nullptr)
EXPORT void GetString(OTString &theStr) const
EXPORT bool IsEmpty() const
EXPORT OTServerContract * GetServerContractPartialMatch(std::string PARTIAL_ID)
static EXPORT OT_API * OTAPI()
static EXPORT std::string & trim(std::string &str)
EXPORT void RemoveAllNumbers(const OTString *pstrServerID=nullptr, bool bRemoveHighestNum=true)
EXPORT OTServerContract * GetServerContract(const OTIdentifier &SERVER_ID)
int main(int argc, char *argv[])
void CollectDefaultedCLValues(AnyOption *opt, std::string &str_ServerID, std::string &str_MyAcct, std::string &str_MyNym, std::string &str_MyPurse, std::string &str_HisAcct, std::string &str_HisNym, std::string &str_HisPurse)
EXPORT bool SaveSignedNymfile(OTPseudonym &SIGNER_NYM)