136 #include "../core/OTLog.hpp"
147 using namespace opentxs;
151 const string& strMyServerID,
152 const string& strMyNymID)
155 bool bReturnVal =
true;
160 int32_t nTransCount =
163 if (nTransCount < nNumberNeeded) {
164 otOut <<
"insure_enough_nums: I don't have enough "
165 "transaction numbers. Grabbing more now...\n";
169 bool msgWasSent =
false;
172 otOut <<
"Error: cannot retrieve nym.\n";
181 if (nTransCount < nNumberNeeded) {
183 <<
"insure_enough_nums: I still don't have enough transaction "
184 "numbers (I have " << nTransCount <<
", but I need "
186 <<
".)\n(Tried grabbing some, but failed somehow.)\n";
205 string strResponse = theRequest.
SendRequest(theRequest,
"CREATE_USER_ACCT");
215 otOut <<
"\n Succeeded in register_nym, but strange: "
216 "then failed calling getRequest, to sync the "
217 "request number for the first time.\n";
224 otOut <<
"Failed to register_nym.\n";
235 bool& bWasMsgSent,
bool bForceDownload)
241 otOut <<
"\n Failed calling getRequest, to sync the "
242 "request number. (Finished.)\n";
248 otOut <<
"\n\n SUCCESS syncronizing the request number.\n";
252 strServerID, strMyNymID, bWasMsgSent, bForceDownload);
254 return nGetAndProcessNymbox;
260 const string& NYM_ID,
261 const string& TARGET_NYM_ID)
266 string strResponse = theRequest.
SendRequest(theRequest,
"CHECK_USER");
275 const string& strNymIDSource,
276 const string& strAltLocation)
278 string strLocation =
"OT_ME_create_nym";
281 nKeybits, strNymIDSource, strAltLocation);
285 <<
": Failed in OT_API_CreateNym(keybits == " << nKeybits
295 const string& NYM_ID,
296 const string& THE_CONTRACT)
301 string strResponse = theRequest.
SendRequest(theRequest,
"ISSUE_ASSET_TYPE");
309 const string& NYM_ID,
310 const string& THE_BASKET)
315 string strResponse = theRequest.
SendRequest(theRequest,
"ISSUE_BASKET");
323 const string& SERVER_ID,
const string& NYM_ID,
const string& ASSET_TYPE,
324 const string& THE_BASKET,
const string& ACCT_ID,
bool IN_OR_OUT)
328 int32_t nTransNumsNeeded =
332 THE_BASKET, ACCT_ID, IN_OR_OUT, nTransNumsNeeded);
342 const string& NYM_ID,
343 const string& CONTRACT_ID)
348 string strResponse = theRequest.
SendRequest(theRequest,
"GET_CONTRACT");
357 const string& NYM_ID,
358 const string& CONTRACT_ID)
365 string strResponse = retrieve_contract(SERVER_ID, NYM_ID, CONTRACT_ID);
378 const string& NYM_ID,
379 const string& ASSET_TYPE_ID)
385 theRequest.
SendRequest(theRequest,
"CREATE_ASSET_ACCT");
394 otOut <<
"\nstat_asset_account: Cannot find account wallet for: "
395 << ACCOUNT_ID <<
"\n";
402 <<
"\nstat_asset_account: Cannot cannot determine asset type for: "
403 << ACCOUNT_ID <<
"\n";
415 " (" + strName +
")\nAccount ID: " + ACCOUNT_ID +
" ( " + strName +
416 " )\nAsset Type: " + strAssetID +
" ( " + strAssetTypeName +
417 " )\nOwner Nym : " + strNymID +
" ( " + strNymName +
418 " )\nServer : " + strServerID +
" ( " + strServerName +
" )";
426 const string& SERVER_ID,
const string& NYM_ID,
const string& ACCOUNT_ID,
440 const string& ACCT_FROM,
const string& ACCT_TO,
441 int64_t AMOUNT,
const string& NOTE)
456 const string& NYM_ID,
457 const string& ACCOUNT_ID,
458 const string& RESPONSE_LEDGER)
480 otOut <<
"\nload_public_encryption_key: Trying to load public "
481 "key, assuming Nym isn't in the local wallet...\n";
487 otOut <<
"\nload_public_encryption_key: Didn't find the Nym (" << NYM_ID
488 <<
") as an 'other' user, so next, checking to see if there's "
489 "a pubkey available for one of the local private Nyms...\n";
494 otOut <<
"\nload_public_encryption_key: Didn't find "
495 "him as a local Nym either... returning nullptr.\n";
531 const string& NYM_ID,
532 const string& TARGET_NYM_ID)
536 string strPubkey = load_public_encryption_key(TARGET_NYM_ID);
539 string strResponse = check_user(SERVER_ID, NYM_ID, TARGET_NYM_ID);
542 strPubkey = load_public_encryption_key(TARGET_NYM_ID);
550 const string& NYM_ID,
551 const string& TARGET_NYM_ID)
555 string strPubkey = load_public_signing_key(TARGET_NYM_ID);
558 string strResponse = check_user(SERVER_ID, NYM_ID, TARGET_NYM_ID);
561 strPubkey = load_public_signing_key(TARGET_NYM_ID);
571 const string& NYM_ID,
572 const string& RECIPIENT_NYM_ID,
573 const string& RECIPIENT_PUBKEY,
574 const string& THE_MESSAGE)
579 RECIPIENT_NYM_ID, RECIPIENT_PUBKEY, THE_MESSAGE);
581 theRequest.
SendRequest(theRequest,
"SEND_USER_MESSAGE");
590 const string& NYM_ID,
591 const string& RECIPIENT_NYM_ID,
592 const string& RECIPIENT_PUBKEY,
593 const string& THE_INSTRUMENT)
598 RECIPIENT_NYM_ID, RECIPIENT_PUBKEY, THE_INSTRUMENT);
600 theRequest.
SendRequest(theRequest,
"SEND_USER_INSTRUMENT");
608 const string& SERVER_ID,
const string& NYM_ID,
609 const string& RECIPIENT_NYM_ID,
const string& RECIPIENT_PUBKEY,
610 const string& THE_INSTRUMENT,
const string& INSTRUMENT_FOR_SENDER)
615 RECIPIENT_NYM_ID, RECIPIENT_PUBKEY, THE_INSTRUMENT,
616 INSTRUMENT_FOR_SENDER);
618 theRequest.
SendRequest(theRequest,
"SEND_USER_INSTRUMENT");
627 const string& NYM_ID,
628 const string& RECIPIENT_NYM_ID,
629 const string& THE_MESSAGE)
633 string strRecipientPubkey =
634 load_or_retrieve_encrypt_key(SERVER_ID, NYM_ID, RECIPIENT_NYM_ID);
637 otOut <<
"OT_ME_send_user_msg: Unable to load or retrieve "
638 "public encryption key for recipient: " << RECIPIENT_NYM_ID
640 return strRecipientPubkey;
643 string strResponse = send_user_msg_pubkey(
644 SERVER_ID, NYM_ID, RECIPIENT_NYM_ID, strRecipientPubkey, THE_MESSAGE);
654 const string& RECIPIENT_NYM_ID,
655 const string& THE_PAYMENT)
659 string strRecipientPubkey =
660 load_or_retrieve_encrypt_key(SERVER_ID, NYM_ID, RECIPIENT_NYM_ID);
663 otOut <<
"OT_ME_send_user_payment: Unable to load or "
664 "retrieve public encryption key for recipient: "
665 << RECIPIENT_NYM_ID <<
"\n";
666 return strRecipientPubkey;
669 string strResponse = send_user_pmnt_pubkey(
670 SERVER_ID, NYM_ID, RECIPIENT_NYM_ID, strRecipientPubkey, THE_PAYMENT);
679 const string& NYM_ID,
680 const string& RECIPIENT_NYM_ID,
681 const string& THE_PAYMENT,
682 const string& SENDERS_COPY)
686 string strRecipientPubkey =
687 load_or_retrieve_encrypt_key(SERVER_ID, NYM_ID, RECIPIENT_NYM_ID);
690 otOut <<
"OT_ME_send_user_payment: Unable to load or "
691 "retrieve public encryption key for recipient: "
692 << RECIPIENT_NYM_ID <<
"\n";
693 return strRecipientPubkey;
697 send_user_cash_pubkey(SERVER_ID, NYM_ID, RECIPIENT_NYM_ID,
698 strRecipientPubkey, THE_PAYMENT, SENDERS_COPY);
706 const string& SERVER_ID,
const string& NYM_ID, int32_t nIndex,
707 const string& PRELOADED_INBOX)
709 string strInstrument;
717 otWarn <<
"\n\n get_payment_instrument: "
718 "OT_API_LoadPaymentInbox Failed. (Probably just "
719 "doesn't exist yet.)\n\n";
727 <<
"Unable to retrieve size of payments inbox ledger. (Failure.)\n";
730 if (nIndex > (nCount - 1)) {
731 otOut <<
"Index " << nIndex
732 <<
" out of bounds. (The last index is: " << (nCount - 1)
733 <<
". The first is 0.)\n";
740 otOut <<
"Failed trying to get payment instrument from payments box.\n";
744 return strInstrument;
756 const string& ACCT_ID, int32_t nBoxType,
757 const string& STR_TRANS_NUM)
763 string strResponse = theRequest.
SendRequest(theRequest,
"GET_BOX_RECEIPT");
771 const string& NYM_ID,
772 const string& ASSET_ID)
777 string strResponse = theRequest.
SendRequest(theRequest,
"GET_MINT");
795 const string& NYM_ID,
796 const string& ASSET_ID)
798 string strResponse = check_user(SERVER_ID, NYM_ID, NYM_ID);
800 otOut <<
"OT_ME_load_or_retrieve_mint: Cannot verify nym for IDs: \n";
801 otOut <<
" Server ID: " << SERVER_ID <<
"\n";
802 otOut <<
" Nym ID: " << NYM_ID <<
"\n";
803 otOut <<
" Asset ID: " << ASSET_ID <<
"\n";
814 otWarn <<
"OT_ME_load_or_retrieve_mint: Mint file is "
815 "missing or expired. Downloading from "
818 string strResponse = retrieve_mint(SERVER_ID, NYM_ID, ASSET_ID);
821 otOut <<
"OT_ME_load_or_retrieve_mint: Unable to "
822 "retrieve mint for IDs: \n";
823 otOut <<
" Server ID: " << SERVER_ID <<
"\n";
824 otOut <<
" Nym ID: " << NYM_ID <<
"\n";
825 otOut <<
" Asset ID: " << ASSET_ID <<
"\n";
830 otOut <<
"OT_ME_load_or_retrieve_mint: Retrieved "
831 "mint, but still 'not good' for IDs: \n";
832 otOut <<
" Server ID: " << SERVER_ID <<
"\n";
833 otOut <<
" Nym ID: " << NYM_ID <<
"\n";
834 otOut <<
" Asset ID: " << ASSET_ID <<
"\n";
847 otOut <<
"OT_ME_load_or_retrieve_mint: Unable to load mint for IDs: \n";
848 otOut <<
" Server ID: " << SERVER_ID <<
"\n";
849 otOut <<
" Nym ID: " << NYM_ID <<
"\n";
850 otOut <<
" Asset ID: " << ASSET_ID <<
"\n";
861 const string& NYM_ID,
862 const string& ENCODED_MAP)
868 theRequest.
SendRequest(theRequest,
"QUERY_ASSET_TYPES");
876 const string& ASSET_ACCT_ID,
const string& CURRENCY_ACCT_ID,
877 const string& scale,
const string& minIncrement,
const string& quantity,
878 const string& price,
bool bSelling,
const string& strLifespanInSeconds,
879 const string& strStopSign,
const string& strActivationPrice)
887 ASSET_ACCT_ID, CURRENCY_ACCT_ID, scale, minIncrement,
888 quantity, price, bSelling);
904 theRequest.
lData = stoll(strActivationPrice);
916 const string& NYM_ID,
917 const string& ASSET_ACCT_ID,
918 const string& STR_TRANS_NUM)
933 const string& NYM_ID,
934 const string& ACCT_ID,
935 const string& STR_TRANS_NUM)
950 const string& SERVER_ID,
const string& NYM_ID,
const string& ACCT_ID,
951 const string& AGENT_NAME,
const string& THE_SMART_CONTRACT)
959 AGENT_NAME, THE_SMART_CONTRACT);
970 const string& NYM_ID,
971 const string& THE_PAYMENT_PLAN)
983 string strSenderAcctID =
989 strSenderAcctID, THE_PAYMENT_PLAN);
1000 const string& THE_PAYMENT_PLAN)
1012 string strRecipientAcctID =
1037 strRecipientAcctID, THE_PAYMENT_PLAN);
1038 string strResponse =
1047 const string& STR_TRANS_NUM,
1048 const string& CLAUSE_NAME,
const string& STR_PARAM)
1059 CLAUSE_NAME, STR_PARAM);
1060 string strResponse = theRequest.
SendRequest(theRequest,
"TRIGGER_CLAUSE");
1069 const string& ACCT_ID, int64_t AMOUNT)
1074 string strResponse =
1084 const string& ACCT_ID,
1085 const string& RECIP_NYM_ID,
1086 const string& STR_MEMO, int64_t AMOUNT)
1091 RECIP_NYM_ID, STR_MEMO, AMOUNT);
1092 string strResponse =
1102 const string& SOURCE_ACCT_ID,
1103 const string& SHARES_ASSET_ID,
1104 const string& STR_MEMO, int64_t AMOUNT_PER_SHARE)
1109 SHARES_ASSET_ID, STR_MEMO, AMOUNT_PER_SHARE);
1110 string strResponse = theRequest.
SendTransaction(theRequest,
"PAY_DIVIDEND");
1117 const string& ACCT_ID,
const string& STR_CHEQUE)
1124 theRequest,
"DEPOSIT_CHEQUE");
1136 theRequest,
"GET_MARKET_LIST");
1148 const string& MARKET_ID, int64_t MAX_DEPTH)
1155 theRequest,
"GET_MARKET_OFFERS");
1161 const string& NYM_ID)
1167 theRequest,
"GET_NYM_MARKET_OFFERS");
1174 const string& NYM_ID,
1175 const string& MARKET_ID)
1182 theRequest,
"GET_MARKET_RECENT_TRADES");
1189 const string& USER_NYM_ID,
1190 const string& TARGET_NYM_ID,
1191 const string& ADJUSTMENT)
1196 TARGET_NYM_ID, ADJUSTMENT);
1198 theRequest,
"ADJUST_USAGE_CREDITS");
1207 const string& nymID,
1208 const string& assetID,
1209 string& userInput,
bool isPurse)
1224 serverID, assetID, nymID, nymID);
1227 otOut <<
"OT_ME_importCashPurse: Error: "
1228 "OT_API_CreatePurse returned null\n";
1235 nymID, purse, userInput);
1237 otOut <<
"OT_ME_importCashPurse: Error: "
1238 "OT_API_Purse_Push returned null\n";
1243 userInput = newPurse;
1303 string& newPurse,
string& newPurseForSender,
const string& serverID,
1304 const string& assetID,
const string& nymID,
string& oldPurse,
1305 const vector<string>& selectedTokens,
const string& recipientNymID,
1306 bool bPWProtectOldPurse,
bool bPWProtectNewPurse)
1311 string strLocation =
"OT_ME_processCashPurse";
1317 if (selectedTokens.size() < 1) {
1328 otOut << strLocation <<
": "
1329 << (bPWProtectNewPurse ?
"OT_API_CreatePurse_Passphrase"
1330 :
"OT_API_CreatePurse")
1331 <<
" returned null\n";
1346 otOut << strLocation
1347 <<
": Failure: OT_API_CreatePurse returned null\n";
1354 string tempOldPurse = oldPurse;
1356 for (int32_t i = 0; i < count; ++i) {
1371 otOut << strLocation
1372 <<
": OT_API_Purse_Peek or OT_API_Purse_Pop "
1373 "returned null... SHOULD NEVER HAPPEN. "
1374 "Returning null.\n";
1383 tempOldPurse = str1;
1385 string strSender = bPWProtectOldPurse ? oldPurse : nymID;
1386 string strRecipient =
1387 bPWProtectNewPurse ? newPurse : recipientNymID;
1389 string strSenderAsRecipient =
1398 serverID, assetID, token, nymID,
1404 otOut << strLocation <<
": 1, OT_API_Token_ChangeOwner "
1405 "returned null...(should never "
1406 "happen) Returning null.\n";
1413 serverID, assetID, token, nymID,
1415 strSenderAsRecipient);
1419 otOut << strLocation <<
": 2, OT_API_Token_ChangeOwner "
1420 "returned null...(should never "
1421 "happen) Returning null.\n";
1427 strRecipient = bPWProtectNewPurse ?
"" : recipientNymID;
1435 serverID, assetID, nymID,
1438 newPurse, exportedToken);
1442 otOut << strLocation
1443 <<
": OT_API_Purse_Push 1 returned null... "
1444 "(should never happen) Returning null.\n";
1453 serverID, assetID, nymID,
1454 strSenderAsRecipient,
1457 newPurseForSender, retainedToken);
1461 otOut << strLocation
1462 <<
": OT_API_Purse_Push 2 returned null... "
1463 "(should never happen) Returning null.\n";
1472 newPurse = strPushedForRecipient;
1473 newPurseForSender = strPushedForRetention;
1487 if (!bPWProtectOldPurse)
1497 otOut << strLocation <<
": OT_API_SavePurse "
1498 "FAILED. SHOULD NEVER HAPPEN!!!!!!\n";
1505 oldPurse = tempOldPurse;
1527 serverID, assetID, nymID,
1529 string newPurseSelectedTokens =
1536 serverID, assetID, nymID,
1543 otOut << strLocation <<
": OT_API_CreatePurse returned null\n";
1547 otOut << strLocation
1548 <<
": OT_API_CreatePurse or "
1549 "OT_API_CreatePurse_Passphrase returned null\n";
1553 otOut << strLocation <<
": OT_API_Purse_Empty returned null\n";
1560 string tempOldPurse = oldPurse;
1562 for (int32_t i = 0; i < count; ++i) {
1576 otOut << strLocation
1577 <<
": OT_API_Purse_Peek or "
1578 "OT_API_Purse_Pop returned null... returning Null. "
1579 "(SHOULD NEVER HAPPEN.)\n";
1586 tempOldPurse = str1;
1593 otOut << strLocation
1594 <<
": OT_API_Token_GetID returned null... "
1595 "SHOULD NEVER HAPPEN. Returning now.\n";
1602 if (find(selectedTokens.begin(), selectedTokens.end(), tokenID) !=
1603 selectedTokens.end())
1612 string strSender = bPWProtectOldPurse ? oldPurse : nymID;
1613 string strRecipient = bPWProtectNewPurse
1614 ? newPurseSelectedTokens
1617 string strSenderAsRecipient =
1623 serverID, assetID, token,
1628 otOut << strLocation <<
": 1 OT_API_Token_ChangeOwner "
1629 "returned null... SHOULD NEVER "
1630 "HAPPEN. Returning now.\n";
1635 serverID, assetID, token,
1638 strSenderAsRecipient);
1640 otOut << strLocation <<
": 2 OT_API_Token_ChangeOwner "
1641 "returned null... SHOULD NEVER "
1642 "HAPPEN. Returning now.\n";
1651 strRecipient = bPWProtectNewPurse ?
"" : recipientNymID;
1654 serverID, assetID, nymID,
1657 newPurseSelectedTokens, exportedToken);
1659 otOut << strLocation
1660 <<
": OT_API_Purse_Push "
1661 "newPurseSelectedTokens returned null... "
1662 "SHOULD NEVER HAPPEN (returning.)\n";
1676 serverID, assetID, nymID,
1677 strSenderAsRecipient, newPurseSelectedForSender,
1680 otOut << strLocation
1681 <<
": OT_API_Purse_Push "
1682 "newPurseSelectedForSender returned null... "
1683 "SHOULD NEVER HAPPEN (returning.)\n";
1687 newPurseSelectedTokens = strPushedForRecipient;
1688 newPurseSelectedForSender = strPushedForRetention;
1694 string strSender = bPWProtectOldPurse ?
"" : nymID;
1697 serverID, assetID, nymID,
1701 newPurseUnSelectedTokens, token);
1703 otOut << strLocation
1704 <<
": OT_API_Purse_Push "
1705 "newPurseUnSelectedTokens returned null... "
1706 "SHOULD NEVER HAPPEN. Returning false.\n";
1710 newPurseUnSelectedTokens = str;
1714 if (!bPWProtectOldPurse)
1718 newPurseUnSelectedTokens))
1724 otOut << strLocation <<
": OT_API_SavePurse "
1725 "FAILED. SHOULD NEVER HAPPEN!!!!!!\n";
1733 newPurseUnSelectedTokens;
1750 newPurse = newPurseSelectedTokens;
1751 newPurseForSender = newPurseSelectedForSender;
1763 const string& nymID,
const string& oldPurse,
1764 const vector<string>& selectedTokens,
1765 string& recipientNymID,
bool bPasswordProtected,
1766 string& strRetainedCopy)
1772 if (!bPasswordProtected) {
1775 if (!
VerifyStringVal(recipientNymID) || (recipientNymID.size() == 0)) {
1776 otOut <<
"OT_ME_exportCashPurse: recipientNym empty--using NymID "
1777 "for recipient instead: " << nymID <<
"\n";
1778 recipientNymID = nymID;
1781 if (!(recipientNymID == nymID)) {
1788 string recipientPubKey = load_or_retrieve_encrypt_key(
1789 serverID, nymID, recipientNymID);
1793 otOut <<
"OT_ME_exportCashPurse: recipientPubKey is null\n";
1804 string exportedToken =
"";
1805 string exportedPurse =
"";
1809 string newPurse =
"";
1810 string newPurseForSender =
"";
1811 string copyOfOldPurse = oldPurse;
1812 bool bSuccessProcess = processCashPurse(
1813 newPurse, newPurseForSender, serverID, assetID, nymID, copyOfOldPurse,
1814 selectedTokens, recipientNymID,
false, bPasswordProtected);
1816 if (bSuccessProcess) {
1817 strRetainedCopy = newPurseForSender;
1827 const string& serverID,
const string& assetID,
const string& nymID,
1828 const string& oldPurse,
const vector<string>& selectedTokens,
1829 const string& accountID,
1830 bool bReimportIfFailure)
1835 otOut <<
"\ndepositCashPurse: Unable to find recipient Nym based on "
1843 string newPurseForSender =
"";
1844 string copyOfOldPurse = oldPurse;
1845 bool bSuccessProcess = processCashPurse(
1846 newPurse, newPurseForSender, serverID, assetID, nymID, copyOfOldPurse,
1847 selectedTokens, recipientNymID, bPasswordProtected,
false);
1850 otOut <<
"OT_ME_depositCashPurse: new Purse is empty, after processing "
1851 "it for deposit. \n";
1859 theRequest,
"DEPOSIT_CASH");
1861 string strAttempt =
"deposit_cash";
1866 serverID, recipientNymID, accountID, strAttempt, strResponse);
1868 if (1 == nInterpretReply) {
1874 retrieve_account(serverID, recipientNymID, accountID,
1877 otOut <<
"\nServer response (" << strAttempt
1878 <<
"): SUCCESS depositing cash!\n";
1879 otOut << string(bRetrieved ?
"Success" :
"Failed")
1880 <<
" retrieving intermediary files for account.\n";
1885 if (!bPasswordProtected && bReimportIfFailure) {
1887 serverID, assetID, recipientNymID, newPurse);
1888 otOut <<
"Since failure in OT_ME_depositCashPurse, "
1889 "OT_API_Wallet_ImportPurse called. Status of "
1890 "import: " << importStatus <<
"\n";
1892 if (!importStatus) {
1896 otOut <<
"Error: Failed depositing the cash purse, and then "
1897 "failed re-importing it back to wallet. Therefore YOU "
1898 "must copy the purse NOW and save it to a safe place! "
1901 cout << newPurse <<
"\n";
1903 otOut <<
"AGAIN: Be sure to copy the above purse "
1904 "to a safe place, since it FAILED to "
1905 "deposit and FAILED to re-import back "
1906 "into the wallet. \n";
1910 otOut <<
"Error: Failed depositing the cash purse. "
1911 "Therefore YOU must copy the purse NOW and "
1912 "save it to a safe place! \n";
1914 cout << newPurse <<
"\n";
1916 otOut <<
"AGAIN: Be sure to copy the above purse to a "
1917 "safe place, since it FAILED to deposit. \n";
1926 return nInterpretReply;
1930 const string& serverID,
const string& assetID,
const string& nymID,
1931 string& oldPurse,
const vector<string>& selectedTokens)
1938 string newPurseForSender =
"";
1940 bool bProcessSuccess = processCashPurse(
1941 newPurse, newPurseForSender, serverID, assetID, nymID, oldPurse,
1942 selectedTokens, nymID,
false,
false);
1945 otOut <<
"OT_ME_exchangeCashPurse: Before server OT_API_exchangePurse "
1946 "call, new Purse is empty. Returning false.\n";
1953 theRequest,
"EXCHANGE_CASH");
1956 otOut <<
"IN OT_ME_exchangeCashPurse: theRequest.SendTransaction(() "
1957 "failed. (I give up.) \n";
1961 otOut <<
"Since failure in OT_ME_exchangeCashPurse, "
1962 "OT_API_Wallet_ImportPurse called, status of import: "
1963 << string(importStatus ?
"true" :
"false") <<
"\n";
1964 if (!importStatus) {
1979 const string& ACCT_ID,
const string& STR_PURSE)
1985 theRequest,
"DEPOSIT_CASH");
static EXPORT std::string GetAccountWallet_Name(const std::string &ACCOUNT_ID)
EXPORT static OT_MADE_EASY_OT std::string create_market_offer(const std::string &ASSET_ACCT_ID, const std::string &CURRENCY_ACCT_ID, const std::string &scale, const std::string &minIncrement, const std::string &quantity, const std::string &price, bool bSelling, const std::string &strLifespanInSeconds, const std::string &strStopSign, const std::string &strActivationPrice)
static EXPORT std::string GetAccountWallet_NymID(const std::string &ACCOUNT_ID)
static EXPORT std::string Instrmnt_GetSenderAcctID(const std::string &THE_INSTRUMENT)
static EXPORT std::string LoadAssetContract(const std::string &ASSET_TYPE_ID)
static EXPORT int32_t Basket_GetMemberCount(const std::string &BASKET_ASSET_TYPE_ID)
static EXPORT bool SavePurse(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &USER_ID, const std::string &THE_PURSE)
EXPORT static OT_MADE_EASY_OT std::string get_payment_instrument(const std::string &SERVER_ID, const std::string &NYM_ID, int32_t nIndex, const std::string &PRELOADED_INBOX)
EXPORT OT_UTILITY_OT int32_t getAndProcessNymbox_4(const std::string &serverID, const std::string &nymID, bool &bWasMsgSent, bool bForceDownload)
EXPORT static OT_MADE_EASY_OT std::string retrieve_mint(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ASSET_ID)
std::string to_string(const T &t)
EXPORT static OT_MADE_EASY_OT std::string register_nym(const std::string &SERVER_ID, const std::string &NYM_ID)
EXPORT static OT_MADE_EASY_OT int32_t depositCashPurse(const std::string &serverID, const std::string &assetID, const std::string &nymID, const std::string &oldPurse, const std::vector< std::string > &selectedTokens, const std::string &accountID, bool bReimportIfFailure)
static EXPORT std::string CreatePurse(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &OWNER_ID, const std::string &SIGNER_ID)
static EXPORT std::string LoadPubkey_Encryption(const std::string &USER_ID)
static EXPORT std::string Purse_Empty(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &SIGNER_ID, const std::string &THE_PURSE)
EXPORT static OT_MADE_EASY_OT std::string stat_asset_account(const std::string &ACCOUNT_ID)
static EXPORT std::string LoadPaymentInbox(const std::string &SERVER_ID, const std::string &USER_ID)
static EXPORT std::string Token_ChangeOwner(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &THE_TOKEN, const std::string &SIGNER_NYM_ID, const std::string &OLD_OWNER, const std::string &NEW_OWNER)
EXPORT static OT_MADE_EASY_OT std::string send_user_pmnt_pubkey(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &RECIPIENT_NYM_ID, const std::string &RECIPIENT_PUBKEY, const std::string &THE_INSTRUMENT)
EXPORT static OT_MADE_EASY_OT std::string send_user_cash_pubkey(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &RECIPIENT_NYM_ID, const std::string &RECIPIENT_PUBKEY, const std::string &THE_INSTRUMENT, const std::string &INSTRUMENT_FOR_SENDER)
EXPORT static OT_MADE_EASY_OT std::string exportCashPurse(const std::string &serverID, const std::string &assetID, const std::string &nymID, const std::string &oldPurse, const std::vector< std::string > &selectedTokens, std::string &recipientNymID, bool bPasswordProtected, std::string &strRetainedCopy)
static EXPORT std::string Instrmnt_GetRecipientAcctID(const std::string &THE_INSTRUMENT)
EXPORT static OT_MADE_EASY_OT std::string send_user_msg_pubkey(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &RECIPIENT_NYM_ID, const std::string &RECIPIENT_PUBKEY, const std::string &THE_MESSAGE)
OTLOG_IMPORT OTLogStream otOut
EXPORT static OT_MADE_EASY_OT std::string issue_asset_type(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &THE_CONTRACT)
EXPORT static OT_MADE_EASY_OT std::string issue_basket_currency(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &THE_BASKET)
EXPORT static OT_MADE_EASY_OT std::string withdraw_voucher(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ACCT_ID, const std::string &RECIP_NYM_ID, const std::string &STR_MEMO, int64_t AMOUNT)
EXPORT static OT_MADE_EASY_OT std::string withdraw_cash(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ACCT_ID, int64_t AMOUNT)
EXPORT static OT_MADE_EASY_OT std::string retrieve_contract(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &CONTRACT_ID)
time64_t OTTimeGetTimeFromSeconds(int64_t seconds)
EXPORT static OT_MADE_EASY_OT std::string send_user_msg(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &RECIPIENT_NYM_ID, const std::string &THE_MESSAGE)
EXPORT static OT_MADE_EASY_OT std::string get_box_receipt(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ACCT_ID, int32_t nBoxType, const std::string &STR_TRANS_NUM)
EXPORT static OT_MADE_EASY_OT int32_t retrieve_nym(const std::string &strServerID, const std::string &strMyNymID, bool &bWasMsgSent, bool bForceDownload)
OT_UTILITY_OT int32_t VerifyMessageSuccess(const string &strMessage)
static EXPORT int64_t GetAccountWallet_Balance(const std::string &ACCOUNT_ID)
EXPORT static OT_MADE_EASY_OT std::string load_or_retrieve_contract(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &CONTRACT_ID)
static EXPORT std::string FormatAmount(const std::string &ASSET_TYPE_ID, const int64_t &THE_AMOUNT)
static EXPORT std::string Ledger_GetInstrument(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_LEDGER, const int32_t &nIndex)
OT_UTILITY_OT int32_t InterpretTransactionMsgReply(const string &SERVER_ID, const string &USER_ID, const string &ACCOUNT_ID, const string &strAttempt, const string &strResponse)
static EXPORT std::string GetServer_Name(const std::string &SERVER_ID)
static EXPORT std::string Purse_Push(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &SIGNER_ID, const std::string &OWNER_ID, const std::string &THE_PURSE, const std::string &THE_TOKEN)
EXPORT static OT_MADE_EASY_OT std::string kill_market_offer(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ASSET_ACCT_ID, const std::string &STR_TRANS_NUM)
static EXPORT std::string CreateNym(const int32_t &nKeySize, const std::string &NYM_ID_SOURCE, const std::string &ALT_LOCATION)
static EXPORT std::string LoadPubkey_Signing(const std::string &USER_ID)
EXPORT static OT_MADE_EASY_OT std::string load_or_retrieve_encrypt_key(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &TARGET_NYM_ID)
EXPORT static OT_MADE_EASY_OT std::string trigger_clause(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &STR_TRANS_NUM, const std::string &CLAUSE_NAME, const std::string &STR_PARAM)
static EXPORT int32_t Ledger_GetCount(const std::string &SERVER_ID, const std::string &USER_ID, const std::string &ACCOUNT_ID, const std::string &THE_LEDGER)
Find out how many pending transactions (and receipts) are in this inbox.
static EXPORT int32_t Purse_Count(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &THE_PURSE)
returns a count of the number of cash tokens inside this purse.
EXPORT static OT_MADE_EASY_OT std::string get_market_recent_trades(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &MARKET_ID)
OT_OTAPI_OT std::string SendTransaction(OTAPI_Func &theFunction, const std::string &IN_FUNCTION)
EXPORT static OT_MADE_EASY_OT std::string create_nym(int32_t nKeybits, const std::string &strNymIDSource, const std::string &strAltLocation)
EXPORT OT_UTILITY_OT int32_t getRequestNumber(const std::string &serverID, const std::string &nymID)
static EXPORT std::string GetNym_Name(const std::string &NYM_ID)
EXPORT static OT_MADE_EASY_OT bool exchangeCashPurse(const std::string &serverID, const std::string &assetID, const std::string &nymID, std::string &oldPurse, const std::vector< std::string > &selectedTokens)
EXPORT static OT_MADE_EASY_OT std::string create_asset_acct(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ASSET_TYPE_ID)
EXPORT static OT_MADE_EASY_OT std::string load_or_retrieve_signing_key(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &TARGET_NYM_ID)
EXPORT static OT_MADE_EASY_OT std::string exchange_basket_currency(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ASSET_TYPE, const std::string &THE_BASKET, const std::string &ACCT_ID, bool IN_OR_OUT)
EXPORT OT_UTILITY_OT bool getTransactionNumbers(const std::string &serverID, const std::string &nymID)
static EXPORT bool Wallet_ImportPurse(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &USER_ID, const std::string &THE_PURSE)
Should handle duplicates. Should load, merge, and save.
EXPORT static OT_MADE_EASY_OT std::string load_public_signing_key(const std::string &NYM_ID)
EXPORT static OT_MADE_EASY_OT bool processCashPurse(std::string &newPurse, std::string &newPurseForSender, const std::string &serverID, const std::string &assetID, const std::string &nymID, std::string &oldPurse, const std::vector< std::string > &selectedTokens, const std::string &recipientNymID, bool bPWProtectOldPurse, bool bPWProtectNewPurse)
EXPORT static OT_MADE_EASY_OT std::string check_user(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &TARGET_NYM_ID)
EXPORT static OT_MADE_EASY_OT std::string send_user_payment(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &RECIPIENT_NYM_ID, const std::string &THE_PAYMENT)
OT_UTILITY_OT bool VerifyStringVal(const std::string &nValue)
EXPORT static OT_MADE_EASY_OT std::string deposit_purse(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ACCT_ID, const std::string &STR_PURSE)
static EXPORT std::string Purse_Pop(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &OWNER_OR_SIGNER_ID, const std::string &THE_PURSE)
static EXPORT bool Mint_IsStillGood(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID)
EXPORT static OT_MADE_EASY_OT bool retrieve_account(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ACCOUNT_ID, bool bForceDownload)
EXPORT static OT_MADE_EASY_OT std::string query_asset_types(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ENCODED_MAP)
EXPORT static OT_MADE_EASY_OT bool importCashPurse(const std::string &serverID, const std::string &nymID, const std::string &assetID, std::string &userInput, bool isPurse)
OTLOG_IMPORT OTLogStream otWarn
static EXPORT std::string LoadUserPubkey_Encryption(const std::string &USER_ID)
EXPORT static OT_MADE_EASY_OT std::string pay_dividend(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &SOURCE_ACCT_ID, const std::string &SHARES_ASSET_ID, const std::string &STR_MEMO, int64_t AMOUNT_PER_SHARE)
EXPORT static OT_MADE_EASY_OT std::string send_user_cash(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &RECIPIENT_NYM_ID, const std::string &THE_PAYMENT, const std::string &SENDERS_COPY)
EXPORT static OT_MADE_EASY_OT std::string load_public_encryption_key(const std::string &NYM_ID)
EXPORT static OT_MADE_EASY_OT std::string load_or_retrieve_mint(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ASSET_ID)
static EXPORT std::string LoadMint(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID)
EXPORT static OT_MADE_EASY_OT std::string get_market_offers(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &MARKET_ID, int64_t MAX_DEPTH)
static EXPORT int32_t GetNym_TransactionNumCount(const std::string &SERVER_ID, const std::string &NYM_ID)
static EXPORT std::string Token_GetID(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &THE_TOKEN)
EXPORT static OT_MADE_EASY_OT std::string deposit_payment_plan(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &THE_PAYMENT_PLAN)
EXPORT static OT_MADE_EASY_OT std::string cancel_payment_plan(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &THE_PAYMENT_PLAN)
static EXPORT std::string Purse_Peek(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &OWNER_ID, const std::string &THE_PURSE)
static EXPORT std::string LoadUserPubkey_Signing(const std::string &USER_ID)
EXPORT OT_UTILITY_OT bool getIntermediaryFiles(const std::string &serverID, const std::string &nymID, const std::string &accountID)
EXPORT static OT_MADE_EASY_OT std::string get_nym_market_offers(const std::string &SERVER_ID, const std::string &NYM_ID)
EXPORT static OT_MADE_EASY_OT std::string deposit_cheque(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ACCT_ID, const std::string &STR_CHEQUE)
EXPORT static OT_MADE_EASY_OT std::string adjust_usage_credits(const std::string &SERVER_ID, const std::string &USER_NYM_ID, const std::string &TARGET_NYM_ID, const std::string &ADJUSTMENT)
EXPORT static OT_MADE_EASY_OT std::string send_transfer(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ACCT_FROM, const std::string &ACCT_TO, int64_t AMOUNT, const std::string &NOTE)
EXPORT static OT_MADE_EASY_OT std::string activate_smart_contract(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ACCT_ID, const std::string &AGENT_NAME, const std::string &THE_SMART_CONTRACT)
OT_OTAPI_OT std::string SendRequest(OTAPI_Func &theFunction, const std::string &IN_FUNCTION) const
EXPORT static OT_MADE_EASY_OT std::string process_inbox(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ACCOUNT_ID, const std::string &RESPONSE_LEDGER)
EXPORT static OT_MADE_EASY_OT std::string get_market_list(const std::string &SERVER_ID, const std::string &NYM_ID)
EXPORT static OT_MADE_EASY_OT bool insure_enough_nums(int32_t nNumberNeeded, const std::string &strMyServerID, const std::string &strMyNymID)
EXPORT static OT_MADE_EASY_OT std::string kill_payment_plan(const std::string &SERVER_ID, const std::string &NYM_ID, const std::string &ACCT_ID, const std::string &STR_TRANS_NUM)
static EXPORT std::string GetAssetType_Name(const std::string &ASSET_TYPE_ID)
static EXPORT std::string CreatePurse_Passphrase(const std::string &SERVER_ID, const std::string &ASSET_TYPE_ID, const std::string &SIGNER_ID)
static EXPORT std::string GetAccountWallet_AssetTypeID(const std::string &ACCOUNT_ID)
static EXPORT std::string GetAccountWallet_ServerID(const std::string &ACCOUNT_ID)
static EXPORT bool Purse_HasPassword(const std::string &SERVER_ID, const std::string &THE_PURSE)